decocms 2.276.1 → 2.276.2
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-DzLXavEa.js → AlertCircle-BBqU1qWS.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-CyEr_HFQ.js → ArrowNarrowLeft-CNekOP3n.js} +1 -1
- package/dist/client/assets/{CheckCircle-CMotQv5X.js → CheckCircle-D1VIcB1v.js} +1 -1
- package/dist/client/assets/{ChevronDown-L-DKp152.js → ChevronDown-D3j8fwsA.js} +1 -1
- package/dist/client/assets/{ChevronRight-BU1ygmWa.js → ChevronRight-iahU_m85.js} +1 -1
- package/dist/client/assets/{ChevronUp-7uxSSWGB.js → ChevronUp-gcRxFSBd.js} +1 -1
- package/dist/client/assets/{Container-DXt1Y9Wv.js → Container-ClismqwZ.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DzF5OZ-B.js → LinkExternal01-Cr5TrBdV.js} +1 -1
- package/dist/client/assets/{Lock01-KkAI4eIi.js → Lock01-BaFHhauP.js} +1 -1
- package/dist/client/assets/{Palette-DjlDo0fl.js → Palette-B56V8p0g.js} +1 -1
- package/dist/client/assets/{Play-mrdTPMT2.js → Play-CJl6p68m.js} +1 -1
- package/dist/client/assets/{Plus-BnKCd83q.js → Plus-uRTzng7P.js} +1 -1
- package/dist/client/assets/{SearchMd-tnuXyfyF.js → SearchMd-w0SZQ38I.js} +1 -1
- package/dist/client/assets/{Settings02-CN6Z9eZa.js → Settings02-JhLe5T4h.js} +1 -1
- package/dist/client/assets/{Star01-DeLN6-0b.js → Star01-izvvU391.js} +1 -1
- package/dist/client/assets/{Sun-LtQGOgdh.js → Sun-B88VGXex.js} +1 -1
- package/dist/client/assets/{Tool01-lLv0JLVY.js → Tool01-DTFWc1H6.js} +1 -1
- package/dist/client/assets/{Trash01-DoOAWIQI.js → Trash01-DpAt8su9.js} +1 -1
- package/dist/client/assets/{Upload01-7P4qiqOJ.js → Upload01-xcbOBsW3.js} +1 -1
- package/dist/client/assets/{User01-C8Udq3pX.js → User01-B4t4xc7U.js} +1 -1
- package/dist/client/assets/{Users03-DbtRtQOU.js → Users03-DlknPznL.js} +1 -1
- package/dist/client/assets/{X-BFlss5X6.js → X-g-dkGEmI.js} +1 -1
- package/dist/client/assets/{XCircle-dq7U4Ag4.js → XCircle-poys0PpN.js} +1 -1
- package/dist/client/assets/{Zap-BAW2hqs8.js → Zap-DKHqYmya.js} +1 -1
- package/dist/client/assets/{ZapSquare-47s5RaJz.js → ZapSquare-CZVrqALN.js} +1 -1
- package/dist/client/assets/{accordion-CJFetHYg.js → accordion-DWL2RSp4.js} +1 -1
- package/dist/client/assets/{agent-icon-BlE73Zsp.js → agent-icon-UJwlsHQH.js} +1 -1
- package/dist/client/assets/{agents-list-8pSgveYv.js → agents-list-BLMcQORq.js} +1 -1
- package/dist/client/assets/ai-providers-lpqEGWpz.js +1 -0
- package/dist/client/assets/{alert-dialog-eE56pYmR.js → alert-dialog-FDHWZ_uw.js} +1 -1
- package/dist/client/assets/{auth-catchall-BwK0uWKA.js → auth-catchall-B0v3A89U.js} +1 -1
- package/dist/client/assets/{automation-list-row-BPrk3J0B.js → automation-list-row-C6mcsBHm.js} +1 -1
- package/dist/client/assets/{automations-DdUI9sAB.js → automations-z7BI_mS7.js} +1 -1
- package/dist/client/assets/{avatar-CtYV06kc.js → avatar-USIFL3XA.js} +1 -1
- package/dist/client/assets/{badge-tpgHtQ7V.js → badge-Dw59WStE.js} +1 -1
- package/dist/client/assets/{brand-context-lj0GAPtO.js → brand-context-BXlYB8LR.js} +1 -1
- package/dist/client/assets/{card-DLDrg93a.js → card-DlmO8yFT.js} +1 -1
- package/dist/client/assets/{chat-context-D07By542.js → chat-context-BzUFrztp.js} +1 -1
- package/dist/client/assets/{checkbox-d841RB1L.js → checkbox-DWN5XcT5.js} +1 -1
- package/dist/client/assets/{collection-detail--VmlTh4t.js → collection-detail-Di2yAOsh.js} +1 -1
- package/dist/client/assets/{collection-display-button-DI9Fama5.js → collection-display-button-B_BTdRYF.js} +1 -1
- package/dist/client/assets/{collection-search-D-I9_t8m.js → collection-search-ClPQOcN2.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-itdO5bAr.js → collection-table-wrapper-BeRe_RwV.js} +1 -1
- package/dist/client/assets/{collection-tabs-pP86sgyd.js → collection-tabs-8zopfSWv.js} +1 -1
- package/dist/client/assets/{collections-BPUbighK.js → collections-Bzlz5pov.js} +1 -1
- package/dist/client/assets/{command-D8O3Gl1-.js → command-DKdp37Eh.js} +1 -1
- package/dist/client/assets/{connection-card-BGPp7cgG.js → connection-card-2gDnhNHg.js} +1 -1
- package/dist/client/assets/{connection-detail-DAn-_duM.js → connection-detail-ItRBP4TJ.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Dlhs2WWB.js → connection-form-helpers-8n1o0jn6.js} +1 -1
- package/dist/client/assets/{connections-BRZqo7jJ.js → connections-Eb9MEf-Q.js} +1 -1
- package/dist/client/assets/{constants-DyN4OIf-.js → constants-45iVR-Pa.js} +1 -1
- package/dist/client/assets/{constants-BZ8fIY1P.js → constants-B6Y_WQ-J.js} +1 -1
- package/dist/client/assets/{dialog-DLubr7v0.js → dialog-Cqz8DxyP.js} +1 -1
- package/dist/client/assets/{drawer-CVqexqUr.js → drawer-D1waomcL.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BXJH7fBR.js → dropdown-menu-CqFvWQQD.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-AXXFjwEt.js → dynamic-plugin-layout-CC7bPba5.js} +1 -1
- package/dist/client/assets/{empty-state-hH1NKVzr.js → empty-state-A7wIyI5K.js} +1 -1
- package/dist/client/assets/{empty-state-BL3PU4_L.js → empty-state-VbPFzdDp.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DL9tWRm2.js → extract-connection-data-B9Ysw6Jg.js} +1 -1
- package/dist/client/assets/{features-DJXnzWer.js → features-CbgyfbY9.js} +1 -1
- package/dist/client/assets/{form-BDmSvtuk.js → form-CGj888dU.js} +1 -1
- package/dist/client/assets/{general-BVT3P06A.js → general-B2hBrPb3.js} +1 -1
- package/dist/client/assets/{index-CUWSLjT5.js → index-46g4uSud.js} +1 -1
- package/dist/client/assets/{index-npGPP9fY.js → index-6j1-PJ1E.js} +1 -1
- package/dist/client/assets/{index-C0c2Yov8.js → index-BBSrDR2H.js} +1 -1
- package/dist/client/assets/{index-e1fvgisD.js → index-BH4kwjXY.js} +4 -4
- package/dist/client/assets/{index-C0PreFo1.js → index-BX-c_NH6.js} +1 -1
- package/dist/client/assets/{index-BpYvJ4OX.js → index-BhyPvUQF.js} +1 -1
- package/dist/client/assets/{index-C2OWmxK2.js → index-BoqnJI2v.js} +1 -1
- package/dist/client/assets/{index-WFhI_y7d.js → index-ChD4d8Fy.js} +1 -1
- package/dist/client/assets/{index-D1NUtWck.js → index-DN06f7L5.js} +2 -2
- package/dist/client/assets/{index-BkXWz19f.js → index-Do97zrKf.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-DGAc9onj.js → infiniteQueryObserver-DYIxP7Ht.js} +1 -1
- package/dist/client/assets/{input-CEXK-6_7.js → input-BoegRSKK.js} +1 -1
- package/dist/client/assets/{integration-icon-C8gBnSmM.js → integration-icon-TghpaT83.js} +1 -1
- package/dist/client/assets/{label-T5gX1YRQ.js → label-Dx2DK5Dz.js} +1 -1
- package/dist/client/assets/{layout-BzOmqcKp.js → layout-BzY3AXeK.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-C2DCGFQ1.js → lean-canvas-recruit-modal-C13TMEgP.js} +1 -1
- package/dist/client/assets/{login-B6wwzBSU.js → login-1lxLZ3Kr.js} +1 -1
- package/dist/client/assets/{members-Dr1JTJgA.js → members-KfmXClfA.js} +1 -1
- package/dist/client/assets/{monaco-editor-8HO4_Ur2.js → monaco-editor-Bfj-f9tF.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CrqaEYtA.js → monitoring-stats-row-CSTJIouh.js} +1 -1
- package/dist/client/assets/{oauth-callback-CvzMLH2Y.js → oauth-callback-Dx7lhm8n.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DOqxOVP-.js → oauth-callback-ai-provider-DwImkwo0.js} +1 -1
- package/dist/client/assets/{onboarding-BBoB61YC.js → onboarding-DpKoGqp_.js} +1 -1
- package/dist/client/assets/{org-layout-dSdEDy3w.js → org-layout-B07ttmYa.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-B69PHyTA.js → org-plugin-layout-CN8r2uUV.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-B8LUxp43.js → plugin-empty-state-21KJ1EZ0.js} +1 -1
- package/dist/client/assets/{plugin-header-D4iyZL7p.js → plugin-header-CFKYrYBT.js} +1 -1
- package/dist/client/assets/{plugin-layout-6dzgt8Nf.js → plugin-layout-DQ0HFj99.js} +1 -1
- package/dist/client/assets/{popover-4Tx1bf1c.js → popover-BJYX_eUP.js} +1 -1
- package/dist/client/assets/{profile-rlJtNFFu.js → profile-B6iGmBgK.js} +1 -1
- package/dist/client/assets/{project-app-view-DOiFaagj.js → project-app-view-DveHsLbW.js} +1 -1
- package/dist/client/assets/registry-DKg4oxXI.js +2 -0
- package/dist/client/assets/{registry-layout-A3CSCPwV.js → registry-layout-BZ3jOtRw.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CUSrNfcX.js → required-auth-layout-6vnmXRJt.js} +1 -1
- package/dist/client/assets/{reset-password-BTZ0YHYT.js → reset-password-C6Q7kFiS.js} +1 -1
- package/dist/client/assets/{scroll-area-Byxq0szm.js → scroll-area-C7RniLKT.js} +1 -1
- package/dist/client/assets/{search-input-DfsQvBcu.js → search-input-CspVzFsE.js} +1 -1
- package/dist/client/assets/{select-Hz5eqHFW.js → select-CeLGcRm_.js} +1 -1
- package/dist/client/assets/{select-model-CaIQoO4S.js → select-model-CTvOd2v6.js} +2 -2
- package/dist/client/assets/{settings-layout-Gl-7FoEv.js → settings-layout-B5NmiwtZ.js} +1 -1
- package/dist/client/assets/{shell-layout-DzdppxnK.js → shell-layout-D-glHQwJ.js} +1 -1
- package/dist/client/assets/{skeleton-BDzML6PF.js → skeleton-DL22VZPi.js} +1 -1
- package/dist/client/assets/{sso-BkIleXYV.js → sso-Or0eg9-K.js} +1 -1
- package/dist/client/assets/{store-CjYuUqaI.js → store-9Z2sns3t.js} +1 -1
- package/dist/client/assets/store-registry-D53q05D2.js +2 -0
- package/dist/client/assets/{switch-B6g8A-mV.js → switch-Dgj2Qk7i.js} +1 -1
- package/dist/client/assets/{table-DQ3t1bXu.js → table-DD05ZO6T.js} +1 -1
- package/dist/client/assets/{tabs-DOhjGqW5.js → tabs-BX4b83RA.js} +1 -1
- package/dist/client/assets/{task-status-DKL9nwsD.js → task-status-g2-NV9sQ.js} +1 -1
- package/dist/client/assets/{textarea-CVQkfOJk.js → textarea-BhcVKoF_.js} +1 -1
- package/dist/client/assets/{toggle-group-Cfen_q_R.js → toggle-group-Cmi6TIOk.js} +1 -1
- package/dist/client/assets/{tools-list-C4GBCzQF.js → tools-list-CsG9Mnwi.js} +1 -1
- package/dist/client/assets/{types-DRPjvsJK.js → types-CHdbkHyV.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CAFjrKsE.js → use-ai-providers-Sx7HvH7l.js} +1 -1
- package/dist/client/assets/{use-collections-QllonpeS.js → use-collections-jpFK-1KA.js} +1 -1
- package/dist/client/assets/{use-connection-c_kVH9Ba.js → use-connection-DJhKa9wi.js} +1 -1
- package/dist/client/assets/{use-copy-BnJAUU38.js → use-copy-XHJJc9Ag.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CSKx5CUZ.js → use-create-virtual-mcp-C17uvNYd.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-PnZv-Hxt.js → use-decopilot-events-D2SrJLT6.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CZOJYy5I.js → use-delete-connection-Vpt8BqAw.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-FOngU937.js → use-infinite-scroll-bSbQel-x.js} +1 -1
- package/dist/client/assets/{use-list-state-C5ucIHNM.js → use-list-state-CCp8M8Xv.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DXfa1vn-.js → use-mcp-tools-BOQ7XAnx.js} +1 -1
- package/dist/client/assets/{use-members-BaFj-cNr.js → use-members-fPhtXrk4.js} +1 -1
- package/dist/client/assets/{use-mobile-fJpaHrzf.js → use-mobile-DiyZoirm.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-ChDeCHV2.js → use-navigate-to-agent-CNUExhtk.js} +1 -1
- package/dist/client/assets/{use-org-sso-CpH4bty0.js → use-org-sso-B3dpLK1-.js} +1 -1
- package/dist/client/assets/{use-organization-settings-Dw8RIB4J.js → use-organization-settings-PJvdW7d7.js} +1 -1
- package/dist/client/assets/{use-public-config-C1IrfsO5.js → use-public-config-BnjdnqEK.js} +1 -1
- package/dist/client/assets/{use-registry-connections-BQbpOdXR.js → use-registry-connections-DwO9HoC-.js} +1 -1
- package/dist/client/assets/{use-status-sounds-N7o4x9JG.js → use-status-sounds-DEQHOZ-w.js} +1 -1
- package/dist/client/assets/{use-tasks-DExM7Bgy.js → use-tasks-CTpvHrCM.js} +1 -1
- package/dist/client/assets/{use-view-mode-LxYzzwlc.js → use-view-mode-DQzsTtxY.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CF_Xz2vS.js → use-virtual-mcp-DQie-k1B.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-D4FFCIqQ.js +1 -0
- package/dist/client/assets/{user-CxWIE8Wy.js → user-CZGUOwnk.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-BRUUFACT.js → view-mode-toggle-BueEh3Rt.js} +1 -1
- package/dist/client/assets/{workflow-9q-Zd6nw.js → workflow-CLN31xo6.js} +1 -1
- package/dist/client/assets/workflow-detail-CWECDm-G.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/node_modules/convert-to-spaces/dist/index.d.ts +2 -0
- package/dist/server/node_modules/convert-to-spaces/dist/index.js +4 -0
- package/dist/server/node_modules/convert-to-spaces/license +21 -0
- package/dist/server/node_modules/convert-to-spaces/package.json +40 -0
- package/dist/server/node_modules/convert-to-spaces/readme.md +39 -0
- package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/dist/server/node_modules/is-fullwidth-code-point/index.js +12 -0
- package/dist/server/node_modules/is-fullwidth-code-point/package.json +53 -0
- package/dist/server/node_modules/is-fullwidth-code-point/readme.md +31 -0
- package/dist/server/node_modules/onetime/index.d.ts +64 -0
- package/dist/server/node_modules/onetime/index.js +44 -0
- package/dist/server/node_modules/onetime/package.json +43 -0
- package/dist/server/node_modules/onetime/readme.md +94 -0
- package/dist/server/node_modules/pg-cloudflare/README.md +112 -0
- package/dist/server/node_modules/pg-cloudflare/dist/empty.d.ts +2 -0
- package/dist/server/node_modules/pg-cloudflare/dist/empty.js +6 -0
- package/dist/server/node_modules/pg-cloudflare/dist/empty.js.map +1 -0
- package/dist/server/node_modules/pg-cloudflare/dist/index.d.ts +31 -0
- package/dist/server/node_modules/pg-cloudflare/dist/index.js +152 -0
- package/dist/server/node_modules/pg-cloudflare/dist/index.js.map +1 -0
- package/dist/server/node_modules/pg-cloudflare/esm/index.mjs +3 -0
- package/dist/server/node_modules/pg-cloudflare/package.json +39 -0
- package/dist/server/node_modules/pg-cloudflare/src/empty.ts +3 -0
- package/dist/server/node_modules/pg-cloudflare/src/index.ts +166 -0
- package/dist/server/node_modules/pg-cloudflare/src/types.d.ts +25 -0
- package/dist/server/node_modules/pg-connection-string/LICENSE +21 -0
- package/dist/server/node_modules/pg-connection-string/README.md +105 -0
- package/dist/server/node_modules/pg-connection-string/esm/index.mjs +8 -0
- package/dist/server/node_modules/pg-connection-string/index.d.ts +36 -0
- package/dist/server/node_modules/pg-connection-string/index.js +231 -0
- package/dist/server/node_modules/pg-connection-string/package.json +52 -0
- package/dist/server/node_modules/pg-int8/LICENSE +13 -0
- package/dist/server/node_modules/pg-int8/README.md +16 -0
- package/dist/server/node_modules/pg-int8/index.js +100 -0
- package/dist/server/node_modules/pg-int8/package.json +24 -0
- package/dist/server/node_modules/{scheduler → pg-pool}/LICENSE +1 -1
- package/dist/server/node_modules/pg-pool/README.md +357 -0
- package/dist/server/node_modules/pg-pool/esm/index.mjs +5 -0
- package/dist/server/node_modules/pg-pool/index.js +517 -0
- package/dist/server/node_modules/pg-pool/package.json +51 -0
- package/dist/server/node_modules/pg-protocol/LICENSE +21 -0
- package/dist/server/node_modules/pg-protocol/README.md +3 -0
- package/dist/server/node_modules/pg-protocol/dist/b.d.ts +1 -0
- package/dist/server/node_modules/pg-protocol/dist/b.js +23 -0
- package/dist/server/node_modules/pg-protocol/dist/b.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/dist/buffer-reader.d.ts +15 -0
- package/dist/server/node_modules/pg-protocol/dist/buffer-reader.js +55 -0
- package/dist/server/node_modules/pg-protocol/dist/buffer-reader.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/dist/buffer-writer.d.ts +16 -0
- package/dist/server/node_modules/pg-protocol/dist/buffer-writer.js +81 -0
- package/dist/server/node_modules/pg-protocol/dist/buffer-writer.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.d.ts +1 -0
- package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.js +530 -0
- package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/dist/index.d.ts +6 -0
- package/dist/server/node_modules/pg-protocol/dist/index.js +15 -0
- package/dist/server/node_modules/pg-protocol/dist/index.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/dist/messages.d.ts +162 -0
- package/dist/server/node_modules/pg-protocol/dist/messages.js +160 -0
- package/dist/server/node_modules/pg-protocol/dist/messages.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.d.ts +1 -0
- package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.js +252 -0
- package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/dist/parser.d.ts +24 -0
- package/dist/server/node_modules/pg-protocol/dist/parser.js +324 -0
- package/dist/server/node_modules/pg-protocol/dist/parser.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/dist/serializer.d.ts +42 -0
- package/dist/server/node_modules/pg-protocol/dist/serializer.js +189 -0
- package/dist/server/node_modules/pg-protocol/dist/serializer.js.map +1 -0
- package/dist/server/node_modules/pg-protocol/esm/index.js +11 -0
- package/dist/server/node_modules/pg-protocol/package.json +45 -0
- package/dist/server/node_modules/pg-protocol/src/b.ts +25 -0
- package/dist/server/node_modules/pg-protocol/src/buffer-reader.ts +58 -0
- package/dist/server/node_modules/pg-protocol/src/buffer-writer.ts +85 -0
- package/dist/server/node_modules/pg-protocol/src/inbound-parser.test.ts +575 -0
- package/dist/server/node_modules/pg-protocol/src/index.ts +11 -0
- package/dist/server/node_modules/pg-protocol/src/messages.ts +262 -0
- package/dist/server/node_modules/pg-protocol/src/outbound-serializer.test.ts +276 -0
- package/dist/server/node_modules/pg-protocol/src/parser.ts +413 -0
- package/dist/server/node_modules/pg-protocol/src/serializer.ts +274 -0
- package/dist/server/node_modules/pg-protocol/src/testing/buffer-list.ts +67 -0
- package/dist/server/node_modules/pg-protocol/src/testing/test-buffers.ts +166 -0
- package/dist/server/node_modules/pg-protocol/src/types/chunky.d.ts +1 -0
- package/dist/server/node_modules/pg-types/.travis.yml +7 -0
- package/dist/server/node_modules/pg-types/Makefile +14 -0
- package/dist/server/node_modules/pg-types/README.md +75 -0
- package/dist/server/node_modules/pg-types/index.d.ts +137 -0
- package/dist/server/node_modules/pg-types/index.js +47 -0
- package/dist/server/node_modules/pg-types/index.test-d.ts +21 -0
- package/dist/server/node_modules/pg-types/lib/arrayParser.js +11 -0
- package/dist/server/node_modules/pg-types/lib/binaryParsers.js +257 -0
- package/dist/server/node_modules/pg-types/lib/builtins.js +73 -0
- package/dist/server/node_modules/pg-types/lib/textParsers.js +215 -0
- package/dist/server/node_modules/pg-types/package.json +42 -0
- package/dist/server/node_modules/pg-types/test/index.js +24 -0
- package/dist/server/node_modules/pg-types/test/types.js +597 -0
- package/dist/server/node_modules/pgpass/README.md +74 -0
- package/dist/server/node_modules/pgpass/lib/helper.js +233 -0
- package/dist/server/node_modules/pgpass/lib/index.js +23 -0
- package/dist/server/node_modules/pgpass/package.json +41 -0
- package/dist/server/node_modules/postgres-array/index.d.ts +4 -0
- package/dist/server/node_modules/postgres-array/index.js +97 -0
- package/dist/server/node_modules/postgres-array/license +21 -0
- package/dist/server/node_modules/postgres-array/package.json +35 -0
- package/dist/server/node_modules/postgres-array/readme.md +43 -0
- package/dist/server/node_modules/postgres-bytea/index.js +33 -0
- package/dist/server/node_modules/postgres-bytea/license +21 -0
- package/dist/server/node_modules/postgres-bytea/package.json +34 -0
- package/dist/server/node_modules/postgres-bytea/readme.md +34 -0
- package/dist/server/node_modules/postgres-date/index.js +116 -0
- package/dist/server/node_modules/postgres-date/license +21 -0
- package/dist/server/node_modules/postgres-date/package.json +33 -0
- package/dist/server/node_modules/postgres-date/readme.md +49 -0
- package/dist/server/node_modules/postgres-interval/index.d.ts +20 -0
- package/dist/server/node_modules/postgres-interval/index.js +125 -0
- package/dist/server/node_modules/postgres-interval/license +21 -0
- package/dist/server/node_modules/postgres-interval/package.json +36 -0
- package/dist/server/node_modules/postgres-interval/readme.md +48 -0
- package/dist/server/node_modules/split2/LICENSE +13 -0
- package/dist/server/node_modules/split2/README.md +85 -0
- package/dist/server/node_modules/split2/bench.js +27 -0
- package/dist/server/node_modules/split2/index.js +141 -0
- package/dist/server/node_modules/split2/package.json +39 -0
- package/dist/server/node_modules/split2/test.js +409 -0
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-CnO63wjr.js +0 -1
- package/dist/client/assets/registry-BTomiBS2.js +0 -2
- package/dist/client/assets/store-registry-_EZSKcWm.js +0 -2
- package/dist/client/assets/useInfiniteQuery-DquktRvH.js +0 -1
- package/dist/client/assets/workflow-detail-DWLk3cWV.js +0 -1
- package/dist/server/node_modules/ansi-styles/index.d.ts +0 -236
- package/dist/server/node_modules/ansi-styles/index.js +0 -223
- package/dist/server/node_modules/ansi-styles/package.json +0 -54
- package/dist/server/node_modules/ansi-styles/readme.md +0 -173
- package/dist/server/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/dist/server/node_modules/get-east-asian-width/index.js +0 -30
- package/dist/server/node_modules/get-east-asian-width/lookup-data.js +0 -18
- package/dist/server/node_modules/get-east-asian-width/lookup.js +0 -135
- package/dist/server/node_modules/get-east-asian-width/package.json +0 -71
- package/dist/server/node_modules/get-east-asian-width/readme.md +0 -65
- package/dist/server/node_modules/get-east-asian-width/utilities.js +0 -24
- package/dist/server/node_modules/pg/README.md +0 -95
- package/dist/server/node_modules/pg/esm/index.mjs +0 -20
- package/dist/server/node_modules/pg/lib/client.js +0 -743
- package/dist/server/node_modules/pg/lib/connection-parameters.js +0 -171
- package/dist/server/node_modules/pg/lib/connection.js +0 -221
- package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +0 -122
- package/dist/server/node_modules/pg/lib/crypto/sasl.js +0 -212
- package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +0 -43
- package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +0 -89
- package/dist/server/node_modules/pg/lib/crypto/utils.js +0 -9
- package/dist/server/node_modules/pg/lib/defaults.js +0 -91
- package/dist/server/node_modules/pg/lib/index.js +0 -73
- package/dist/server/node_modules/pg/lib/native/client.js +0 -323
- package/dist/server/node_modules/pg/lib/native/index.js +0 -2
- package/dist/server/node_modules/pg/lib/native/query.js +0 -165
- package/dist/server/node_modules/pg/lib/query.js +0 -252
- package/dist/server/node_modules/pg/lib/result.js +0 -109
- package/dist/server/node_modules/pg/lib/stream.js +0 -83
- package/dist/server/node_modules/pg/lib/type-overrides.js +0 -35
- package/dist/server/node_modules/pg/lib/utils.js +0 -217
- package/dist/server/node_modules/pg/package.json +0 -76
- package/dist/server/node_modules/scheduler/README.md +0 -9
- package/dist/server/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +0 -414
- package/dist/server/node_modules/scheduler/cjs/scheduler-unstable_mock.production.js +0 -406
- package/dist/server/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +0 -150
- package/dist/server/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.js +0 -140
- package/dist/server/node_modules/scheduler/cjs/scheduler.development.js +0 -364
- package/dist/server/node_modules/scheduler/cjs/scheduler.native.development.js +0 -350
- package/dist/server/node_modules/scheduler/cjs/scheduler.native.production.js +0 -330
- package/dist/server/node_modules/scheduler/cjs/scheduler.production.js +0 -340
- package/dist/server/node_modules/scheduler/index.js +0 -7
- package/dist/server/node_modules/scheduler/index.native.js +0 -7
- package/dist/server/node_modules/scheduler/package.json +0 -27
- package/dist/server/node_modules/scheduler/unstable_mock.js +0 -7
- package/dist/server/node_modules/scheduler/unstable_post_task.js +0 -7
- package/dist/server/node_modules/slice-ansi/index.d.ts +0 -19
- package/dist/server/node_modules/slice-ansi/index.js +0 -260
- package/dist/server/node_modules/slice-ansi/license +0 -10
- package/dist/server/node_modules/slice-ansi/package.json +0 -59
- package/dist/server/node_modules/slice-ansi/readme.md +0 -54
- package/dist/server/node_modules/slice-ansi/tokenize-ansi.js +0 -752
- package/dist/server/node_modules/strip-ansi/index.d.ts +0 -15
- package/dist/server/node_modules/strip-ansi/index.js +0 -19
- package/dist/server/node_modules/strip-ansi/license +0 -9
- package/dist/server/node_modules/strip-ansi/package.json +0 -59
- package/dist/server/node_modules/strip-ansi/readme.md +0 -37
- /package/dist/server/node_modules/{ansi-styles → is-fullwidth-code-point}/license +0 -0
- /package/dist/server/node_modules/{get-east-asian-width → onetime}/license +0 -0
- /package/dist/server/node_modules/{pg → pg-cloudflare}/LICENSE +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-
|
|
2
|
-
import{o as Mt,r as S,p as Bm,q as Om,e as B,s as ve,K as lt,n as Fi,a as Br,v as Vs,w as Or,x as Hi,j as r,B as re,y as Et,c as Y,E as Cs,z as me,C as Wi,_ as $m,t as ye,f as Ke,D as yh,F as zm,R as Sh,G as Fm,H as ys,I as So,J as ds,L as Hm,M as wo,P as Wm,Q as Um,T as Km,U as qm,V as wh,W as Gm,X as Ym,Y as Xm,Z as Jm,$ as lc,l as Ee,b as St,u as Qm,a0 as pr,a1 as vn,a2 as nl,a3 as ol,g as $r,a4 as Vh,d as vi,a5 as Zm,a6 as ep,a7 as tp,a8 as sp,a9 as ip,aa as rp,ab as np,ac as zt,ad as op,ae as ap,af as lp,ag as cp,ah as Zi,ai as dp,aj as hp,ak as up,al as fp,am as Ch,an as mp,ao as pp,ap as gp,aq as _p,ar as xp,as as vp,at as bp,au as yp,av as Sp,aw as wp,ax as jh,ay as bn,az as Vp,aA as Ai,aB as nn,aC as kh,aD as Cp,aE as jp}from"./index-D1NUtWck.js";import{u as ni,a as Ui,b as es,A as kp,C as Np,c as ia,d as Ap,e as Zn,f as cc,t as Ep}from"./chat-context-D07By542.js";import{d as eo,g as si,c as Ip,s as al,t as Rp,a as Tp,M as Dp,i as Mp,b as Cr,e as Pp,F as Lp,f as Nh,S as Bp,u as Op,h as dc,j as $p,k as zp,l as ra,r as Fp,m as Hp,p as Ah,n as Wp,o as Up,q as ll,G as Kp,L as qp,v as Gp,w as Yp,x as Xp,y as Jp}from"./task-status-DKL9nwsD.js";import{S as jr,u as to,P as na,a as Qp,b as Zp,c as eg,E as tg,i as sg,d as ig,e as Eh}from"./scroll-area-Byxq0szm.js";import{T as Mi,u as Rs,a as tt,b as st,c as it}from"./use-mobile-fJpaHrzf.js";import{D as Ts,a as Ds,b as cl,c as ms,d as ps,e as dl}from"./dialog-DLubr7v0.js";import{D as so,a as bi,b as yi,c as Si,d as rg,e as ng,f as og}from"./drawer-CVqexqUr.js";import{C as Ih}from"./collection-search-D-I9_t8m.js";import{S as Ht,u as Me,g as io,i as Mn,c as ag,W as Os,a as lg,b as hl}from"./constants-BZ8fIY1P.js";import{u as Rh,g as ul,T as Th,a as yn,l as Pn,b as Vo,c as cg}from"./tabs-DOhjGqW5.js";import{F as Pi,a as It,b as Rt,c as rs,d as Tt,e as Dt,f as dg}from"./form-BDmSvtuk.js";import{I as bt}from"./input-CEXK-6_7.js";import{i as Dh,u as zr,r as Mh}from"./shell-layout-DzdppxnK.js";import{D as ot,a as Sn,b as wn,c as js,d as ks,e as Ns,f as Ph,g as Lh,h as hc}from"./dropdown-menu-BXJH7fBR.js";import{t as hg,i as Bh,n as ug,A as zs,a as Oh,b as fl,s as ii,c as fg,d as mg,e as $h,f as zh,g as pg,h as ml,j as gr,k as gg,l as pl,m as _g,o as xg,p as Fr,q as Hr,r as vg,u as uc,v as fc,w as bg,x as yg,y as mc,z as Sg,B as gl,C as Fh,D as oa,E as Co,F as pc,G as wg,H as Vg,I as Cg,J as jg,K as Hh,L as Wh,M as Uh,N as Kh,O as gc,P as kg,Q as _r,R as Ng,S as Ag,T as Eg,U as qh}from"./agent-icon-BlE73Zsp.js";import{n as Gh,a as aa,i as Ig,b as Rg,c as Tg}from"./ZapSquare-47s5RaJz.js";import{i as Jt,t as kr}from"./ChevronDown-L-DKp152.js";import{s as Ti}from"./Star01-DeLN6-0b.js";import{a as la,t as _l}from"./Tool01-lLv0JLVY.js";import{i as Yh}from"./Lock01-KkAI4eIi.js";import{s as Qt}from"./Plus-BnKCd83q.js";import{i as Xh}from"./Upload01-7P4qiqOJ.js";import{i as fi}from"./X-BFlss5X6.js";import{i as ri}from"./AlertCircle-DzLXavEa.js";import{S as Js,a as Qs,b as Ft,c as Zs,d as ei}from"./select-Hz5eqHFW.js";import{i as xl,a as vl,b as Dg}from"./SearchMd-tnuXyfyF.js";import{i as ro,t as Mg,a as Pg,b as Lg,c as Bg,d as Og,e as Li,f as Jh}from"./XCircle-dq7U4Ag4.js";import{T as Qh,a as Ln}from"./toggle-group-Cfen_q_R.js";import{u as bl,a as Zh}from"./use-ai-providers-CAFjrKsE.js";import{m as no,M as eu,N as $g}from"./select-model-CaIQoO4S.js";import{S as zg,A as Fg,a as Hg,b as Wg,c as Ug,R as tu,d as Kg,e as qg}from"./accordion-CJFetHYg.js";import{r as su,l as xr,u as Gg,g as Yg}from"./types-DRPjvsJK.js";import{u as oo,a as ts,b as yl}from"./use-virtual-mcp-CF_Xz2vS.js";import{u as Wr,a as Sl,b as wl}from"./use-connection-c_kVH9Ba.js";import{p as Xg,q as _c}from"./question-004-sINsf4GQ.js";import{g as xc}from"./ai-providers-logos-CS4PCiqI.js";import{g as iu,s as ru}from"./connection-slug-eyAPH6o3.js";import{u as nu,a as ou,g as Jg,C as jo}from"./connection-card-BGPp7cgG.js";import{C as au}from"./collection-tabs-pP86sgyd.js";import{g as lu}from"./constants-DyN4OIf-.js";import{T as ca}from"./textarea-CVQkfOJk.js";import{n as Vn}from"./Container-DXt1Y9Wv.js";import{c as Qg,i as on,a as vc,E as Zg,p as e_,b as t_,d as s_}from"./connection-form-helpers-Dlhs2WWB.js";import{u as bc}from"./use-infinite-scroll-FOngU937.js";import{u as i_,C as r_,a as yc,b as Sc,c as n_,d as o_,e as a_,f as l_}from"./command-D8O3Gl1-.js";import{g as c_,e as d_,a as h_}from"./extract-connection-data-DL9tWRm2.js";import{B as wc}from"./badge-tpgHtQ7V.js";import{i as Vl}from"./ChevronRight-BU1ygmWa.js";import{I as Ms}from"./integration-icon-C8gBnSmM.js";import{S as Bi}from"./skeleton-BDzML6PF.js";import{a as ao}from"./Users03-DbtRtQOU.js";import{I as Bn,S as cu,G as u_,L as f_,a as m_,b as du}from"./lean-canvas-recruit-modal-C2DCGFQ1.js";import{u as lo,a as hu}from"./use-navigate-to-agent-ChDeCHV2.js";import{u as uu}from"./use-create-virtual-mcp-CSKx5CUZ.js";import{i as p_}from"./CheckCircle-CMotQv5X.js";import{P as oi,a as ai,b as li}from"./popover-4Tx1bf1c.js";import{u as wi,a as g_}from"./use-mcp-tools-DXfa1vn-.js";import{E as Oi}from"./empty-state-hH1NKVzr.js";import{u as __}from"./use-decopilot-events-PnZv-Hxt.js";import{i as $i}from"./Zap-BAW2hqs8.js";import{i as fu,S as Ur,a as Kr,b as gs,u as qr,c as us,d as Zt,e as mu,f as pu,g as x_,h as gu,j as _u,P as hs,k as v_,l as b_,m as y_,n as S_,o as w_,p as V_}from"./index-npGPP9fY.js";import{u as xu,D as vu}from"./use-public-config-C1IrfsO5.js";import{A as Vc}from"./avatar-CtYV06kc.js";import{n as C_,a as j_,i as k_}from"./Sun-LtQGOgdh.js";import{a as Gr}from"./Settings02-CN6Z9eZa.js";import{A as Cl,a as jl,b as kl,c as Nl,d as Al,e as El,f as Il,g as bu}from"./alert-dialog-eE56pYmR.js";import"./index-CUWSLjT5.js";import{u as yu}from"./use-tasks-DExM7Bgy.js";import{u as N_}from"./use-status-sounds-N7o4x9JG.js";import{T as A_,u as Su}from"./tools-list-C4GBCzQF.js";import{u as ko}from"./unwrap-tool-result-BYXdCQMg.js";import{C as E_,a as Cc}from"./card-DLDrg93a.js";import{L as vr}from"./label-T5gX1YRQ.js";import{S as da}from"./switch-B6g8A-mV.js";import{i as Cn}from"./Play-mrdTPMT2.js";import{s as ha}from"./Trash01-DoOAWIQI.js";import{C as I_}from"./checkbox-d841RB1L.js";import{n as Vi}from"./LinkExternal01-DzF5OZ-B.js";import{V as R_}from"./view-mode-toggle-BRUUFACT.js";import{U as T_}from"./user-CxWIE8Wy.js";import{u as Yr,a as D_,b as M_,c as P_,A as L_,d as B_}from"./automation-list-row-BPrk3J0B.js";import{S as O_}from"./search-input-DfsQvBcu.js";import"./use-collections-QllonpeS.js";import"./use-organization-settings-Dw8RIB4J.js";import"./use-copy-BnJAUU38.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./required-auth-layout-CUSrNfcX.js";import"./use-org-sso-CpH4bty0.js";import"./ArrowNarrowLeft-CyEr_HFQ.js";import"./ChevronUp-7uxSSWGB.js";import"./Palette-DjlDo0fl.js";import"./User01-C8Udq3pX.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./use-registry-connections-BQbpOdXR.js";import"./useInfiniteQuery-DquktRvH.js";import"./infiniteQueryObserver-DGAc9onj.js";import"./collections-BPUbighK.js";import"./index-BkXWz19f.js";import"./create-sse-subscription-CxkOgzKf.js";function $_(t,e){const s=Mt(e);return z_({filters:{...t,status:"pending"}},s).length}function jc(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function z_(t={},e){const s=Mt(e).getMutationCache(),i=S.useRef(t),n=S.useRef(null);return n.current===null&&(n.current=jc(s,t)),S.useEffect(()=>{i.current=t}),S.useSyncExternalStore(S.useCallback(o=>s.subscribe(()=>{const a=Bm(n.current,jc(s,i.current));n.current!==a&&(n.current=a,Om.schedule(o))}),[s]),()=>n.current,()=>n.current)}function F_(t,e){const s=B.c(37),{org:i,locator:n}=ve();let o;s[0]!==i.id?(o={connectionId:Ht,orgId:i.id},s[0]=i.id,s[1]=o):o=s[1];const a=Me(o),l=Mt();let c;s[2]!==t||s[3]!==i.id?(c=lt.ensureTask(i.id,t),s[2]=t,s[3]=i.id,s[4]=c):c=s[4];let d;s[5]!==a||s[6]!==t?(d=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[5]=a,s[6]=t,s[7]=d):d=s[7];let u;s[8]!==c||s[9]!==d?(u={queryKey:c,queryFn:d,retry:!1,refetchOnWindowFocus:!1},s[8]=c,s[9]=d,s[10]=u):u=s[10];const h=Fi(u);let f;s[11]!==a||s[12]!==e?(f=async b=>{const y=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:b,virtual_mcp_id:e}}});if(y.isError){const j=y.content,w=Array.isArray(j)&&j[0]&&typeof j[0]=="object"?j[0].text??"Create failed":"Create failed";throw new Error(w)}return y.structuredContent.item},s[11]=a,s[12]=e,s[13]=f):f=s[13];let m;s[14]!==n||s[15]!==i.id||s[16]!==h||s[17]!==l?(m=()=>{l.invalidateQueries({predicate:b=>b.queryKey[1]===i.id&&b.queryKey[3]==="collection"&&b.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:lt.tasksPrefix(n)}),h.refetch()},s[14]=n,s[15]=i.id,s[16]=h,s[17]=l,s[18]=m):m=s[18];let p;s[19]!==f||s[20]!==m?(p={mutationFn:f,onSuccess:m},s[19]=f,s[20]=m,s[21]=p):p=s[21];const g=Br(p);let _,v;if(s[22]!==g||s[23]!==t||s[24]!==h.data||s[25]!==h.isSuccess?(_=()=>{!h.isSuccess||h.data||g.isPending||g.variables!==t&&g.mutate(t)},v=[t,h.isSuccess,h.data,g],s[22]=g,s[23]=t,s[24]=h.data,s[25]=h.isSuccess,s[26]=_,s[27]=v):(_=s[26],v=s[27]),S.useEffect(_,v),h.isLoading){let b;return s[28]===Symbol.for("react.memo_cache_sentinel")?(b={status:"loading"},s[28]=b):b=s[28],b}if(h.isError){const b=h.error;let y;return s[29]!==b?(y={status:"error",error:b},s[29]=b,s[30]=y):y=s[30],y}if(h.isSuccess&&h.data){let b;return s[31]!==h.data?(b={status:"ready",task:h.data},s[31]=h.data,s[32]=b):b=s[32],b}if(g.isPending||h.isSuccess&&!h.data){let b;return s[33]===Symbol.for("react.memo_cache_sentinel")?(b={status:"creating"},s[33]=b):b=s[33],b}if(g.isError){let b;return s[34]!==g.error?(b={status:"error",error:g.error},s[34]=g.error,s[35]=b):b=s[35],b}let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[36]=x):x=s[36],x}function H_(t){const e={};for(const s of t.arguments??[])e[s.name]=s.required?Et().min(1,"Required"):Et();return Vs(e)}function W_(t){const e={};for(const s of t.arguments??[])e[s.name]="";return e}function Rl(t){const e=B.c(65),{prompt:s,setPrompt:i,onSubmit:n}=t,o=S.useId();let a;if(e[0]!==s){const D=s?H_(s):Vs({});a=Or(D),e[0]=s,e[1]=a}else a=e[1];const c=a;let d;e[2]!==s?(d=s?W_(s):{},e[2]=s,e[3]=d):d=e[3];let u;e[4]!==c||e[5]!==d?(u={resolver:c,defaultValues:d,mode:"onChange"},e[4]=c,e[5]=d,e[6]=u):u=e[6];const h=Hi(u);let f;e[7]!==s?.arguments?(f=s?.arguments??[],e[7]=s?.arguments,e[8]=f):f=e[8];const m=f;let p;e[9]!==h||e[10]!==n||e[11]!==i?(p=async D=>{await n(D),i(null),h.reset()},e[9]=h,e[10]=n,e[11]=i,e[12]=p):p=e[12];const g=p;let _;e[13]!==h||e[14]!==i?(_=D=>{D||(h.reset(),i(null))},e[13]=h,e[14]=i,e[15]=_):_=e[15];const v=_;if(!s)return null;let x;e[16]!==s._meta||e[17]!==s.name||e[18]!==s.title?(x=s.title||eo(s.name,si(s._meta)),e[16]=s._meta,e[17]=s.name,e[18]=s.title,e[19]=x):x=e[19];let b;e[20]!==x?(b=r.jsx(Ts,{children:r.jsx("span",{className:"capitalize",children:x})}),e[20]=x,e[21]=b):b=e[21];let y;e[22]!==s.description?(y=s.description&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.description}),e[22]=s.description,e[23]=y):y=e[23];let C;e[24]!==y||e[25]!==b?(C=r.jsxs(Ds,{children:[b,y]}),e[24]=y,e[25]=b,e[26]=C):C=e[26];let j;e[27]!==h||e[28]!==g?(j=D=>{D.stopPropagation(),h.handleSubmit(g)(D)},e[27]=h,e[28]=g,e[29]=j):j=e[29];let w;if(e[30]!==m||e[31]!==h.control||e[32]!==h.formState.isSubmitting){let D;e[34]!==h.control||e[35]!==h.formState.isSubmitting?(D=P=>r.jsx(It,{control:h.control,name:P.name,render:$=>{const{field:z}=$;return r.jsxs(Rt,{children:[r.jsxs(rs,{className:"text-xs",children:[P.name,P.required?null:r.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),r.jsx(Tt,{children:r.jsx(bt,{...z,value:z.value??"",required:P.required,placeholder:P.description??"",className:"h-9",disabled:h.formState.isSubmitting})}),r.jsx(Dt,{})]})}},P.name),e[34]=h.control,e[35]=h.formState.isSubmitting,e[36]=D):D=e[36],w=m.map(D),e[30]=m,e[31]=h.control,e[32]=h.formState.isSubmitting,e[33]=w}else w=e[33];let V;e[37]!==v?(V=()=>v(!1),e[37]=v,e[38]=V):V=e[38];let k;e[39]!==h.formState.isSubmitting||e[40]!==V?(k=r.jsx(re,{type:"button",variant:"ghost",onClick:V,disabled:h.formState.isSubmitting,children:"Cancel"}),e[39]=h.formState.isSubmitting,e[40]=V,e[41]=k):k=e[41];const T=!h.formState.isValid||h.formState.isSubmitting;let I;e[42]!==h.formState.isSubmitting?(I=h.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(jr,{size:"xs"}),"Loading..."]}):"Use prompt",e[42]=h.formState.isSubmitting,e[43]=I):I=e[43];let A;e[44]!==o||e[45]!==T||e[46]!==I?(A=r.jsx(re,{type:"submit",form:o,disabled:T,children:I}),e[44]=o,e[45]=T,e[46]=I,e[47]=A):A=e[47];let N;e[48]!==k||e[49]!==A?(N=r.jsxs(cl,{children:[k,A]}),e[48]=k,e[49]=A,e[50]=N):N=e[50];let E;e[51]!==o||e[52]!==j||e[53]!==w||e[54]!==N?(E=r.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:j,children:[w,N]}),e[51]=o,e[52]=j,e[53]=w,e[54]=N,e[55]=E):E=e[55];let R;e[56]!==h||e[57]!==E?(R=r.jsx(Pi,{...h,children:E}),e[56]=h,e[57]=E,e[58]=R):R=e[58];let M;e[59]!==C||e[60]!==R?(M=r.jsxs(ms,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[59]=C,e[60]=R,e[61]=M):M=e[61];let L;return e[62]!==v||e[63]!==M?(L=r.jsx(ps,{open:!0,onOpenChange:v,children:M}),e[62]=v,e[63]=M,e[64]=L):L=e[64],L}function U_(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}function K_(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const kc=3,wu="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",q_="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Vu(t){const e=B.c(46),{item:s,onSelect:i,isLoading:n,isDisabled:o,variant:a}=t,l=a===void 0?"pill":a,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const w=si(c._meta);d=c.title??eo(c.name,w),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const u=d,h=c.description||null;if(l==="card"){let w;e[4]!==i||e[5]!==c?(w=()=>i(c),e[4]=i,e[5]=c,e[6]=w):w=e[6];const V=o||n,k=n&&"bg-accent/40",T=(o||n)&&"cursor-not-allowed opacity-50";let I;e[7]!==k||e[8]!==T?(I=Y(q_,"hover:bg-accent/60 text-foreground",k,T),e[7]=k,e[8]=T,e[9]=I):I=e[9];let A;e[10]!==u?(A=r.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=A):A=e[11];let N;e[12]!==n?(N=n&&r.jsx(jr,{size:"xs"}),e[12]=n,e[13]=N):N=e[13];let E;e[14]!==A||e[15]!==N?(E=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[A,N]}),e[14]=A,e[15]=N,e[16]=E):E=e[16];let R;e[17]!==h?(R=h&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=R):R=e[18];let M;return e[19]!==E||e[20]!==R||e[21]!==w||e[22]!==V||e[23]!==I?(M=r.jsxs("button",{type:"button",onClick:w,disabled:V,className:I,children:[E,R]}),e[19]=E,e[20]=R,e[21]=w,e[22]=V,e[23]=I,e[24]=M):M=e[24],M}let f;e[25]!==i||e[26]!==c?(f=()=>i(c),e[25]=i,e[26]=c,e[27]=f):f=e[27];const m=o||n,p=n&&"bg-muted/50",g=(o||n)&&"cursor-not-allowed opacity-50";let _;e[28]!==p||e[29]!==g?(_=Y(wu,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=_):_=e[30];let v;e[31]!==u?(v=r.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=v):v=e[32];let x;e[33]!==n?(x=n&&r.jsx(jr,{size:"xs"}),e[33]=n,e[34]=x):x=e[34];let b;e[35]!==f||e[36]!==m||e[37]!==_||e[38]!==v||e[39]!==x?(b=r.jsx(tt,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:m,className:_,children:[v,x]})}),e[35]=f,e[36]=m,e[37]=_,e[38]=v,e[39]=x,e[40]=b):b=e[40];const y=h??u;let C;e[41]!==y?(C=r.jsx(st,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=C):C=e[42];let j;return e[43]!==b||e[44]!==C?(j=r.jsxs(it,{delayDuration:400,children:[b,C]}),e[43]=b,e[44]=C,e[45]=j):j=e[45],j}function G_(t){const e=B.c(41),{items:s,open:i,onOpenChange:n,onSelect:o,loadingPrompt:a}=t,[l,c]=S.useState(""),d=!!a;let u;e[0]!==s||e[1]!==l?(u=l.trim()?s.filter(V=>{const k=l.toLowerCase();return V.prompt.name.toLowerCase().includes(k)||(V.prompt.title??"").toLowerCase().includes(k)||(V.prompt.description??"").toLowerCase().includes(k)}):s,e[0]=s,e[1]=l,e[2]=u):u=e[2];const h=u,f=Rs();let m;e[3]!==h.length||e[4]!==l?(m=h.length===0&&r.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",l,"”"]}),e[3]=h.length,e[4]=l,e[5]=m):m=e[5];let p;if(e[6]!==h||e[7]!==d||e[8]!==a?.name||e[9]!==n||e[10]!==o){let V;e[12]!==d||e[13]!==a?.name||e[14]!==n||e[15]!==o?(V=k=>r.jsx(Vu,{item:k,variant:"card",onSelect:T=>{n(!1),o(T)},isLoading:a?.name===k.prompt.name,isDisabled:d&&a?.name!==k.prompt.name},k.prompt.name),e[12]=d,e[13]=a?.name,e[14]=n,e[15]=o,e[16]=V):V=e[16],p=h.map(V),e[6]=h,e[7]=d,e[8]=a?.name,e[9]=n,e[10]=o,e[11]=p}else p=e[11];let g;e[17]!==m||e[18]!==p?(g=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[m,p]})}),e[17]=m,e[18]=p,e[19]=g):g=e[19];const _=g;let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=V=>{V.key==="Escape"&&c("")},e[20]=v):v=e[20];let x;e[21]!==l?(x=r.jsx(Ih,{value:l,onChange:c,placeholder:"Search prompts...",onKeyDown:v}),e[21]=l,e[22]=x):x=e[22];const b=x;if(f){let V;e[23]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(so,{className:"sr-only",children:r.jsx(bi,{children:"All prompts"})}),e[23]=V):V=e[23];let k;e[24]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=k):k=e[24];let T;e[25]!==_||e[26]!==b?(T=r.jsxs(yi,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[V,k,b,_]}),e[25]=_,e[26]=b,e[27]=T):T=e[27];let I;return e[28]!==n||e[29]!==i||e[30]!==T?(I=r.jsx(Mi,{delayDuration:400,children:r.jsx(Si,{open:i,onOpenChange:n,children:T})}),e[28]=n,e[29]=i,e[30]=T,e[31]=I):I=e[31],I}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Ds,{className:"sr-only",children:r.jsx(Ts,{children:"All prompts"})}),e[32]=y):y=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=C):C=e[33];let j;e[34]!==_||e[35]!==b?(j=r.jsxs(ms,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,C,b,_]}),e[34]=_,e[35]=b,e[36]=j):j=e[36];let w;return e[37]!==n||e[38]!==i||e[39]!==j?(w=r.jsx(Mi,{delayDuration:400,children:r.jsx(ps,{open:i,onOpenChange:n,children:j})}),e[37]=n,e[38]=i,e[39]=j,e[40]=w):w=e[40],w}function Y_(t){const e=B.c(29),{items:s,onSelect:i,loadingPrompt:n,className:o}=t,[a,l]=S.useState(!1);if(s.length===0)return null;let c,d,u;if(e[0]!==s||e[1]!==n||e[2]!==i){const v=s.slice(0,kc);let x;e[6]!==s?(x=s.slice(kc),e[6]=s,e[7]=x):x=e[7],c=x,d=!!n;let b;e[8]!==d||e[9]!==n?.name||e[10]!==i?(b=y=>r.jsx(Vu,{item:y,onSelect:i,isLoading:n?.name===y.prompt.name,isDisabled:d&&n?.name!==y.prompt.name},y.prompt.name),e[8]=d,e[9]=n?.name,e[10]=i,e[11]=b):b=e[11],u=v.map(b),e[0]=s,e[1]=n,e[2]=i,e[3]=c,e[4]=d,e[5]=u}else c=e[3],d=e[4],u=e[5];const h=u;let f;e[12]!==o?(f=Y("w-full flex flex-wrap gap-2 justify-center",o),e[12]=o,e[13]=f):f=e[13];let m;e[14]!==c.length||e[15]!==d?(m=c.length>0&&r.jsxs("button",{type:"button",disabled:d,onClick:()=>l(!0),className:Y(wu,"hover:bg-muted/70 hover:text-foreground",d&&"opacity-50 cursor-not-allowed"),children:["+",c.length," more"]}),e[14]=c.length,e[15]=d,e[16]=m):m=e[16];let p;e[17]!==h||e[18]!==f||e[19]!==m?(p=r.jsxs("div",{className:f,children:[h,m]}),e[17]=h,e[18]=f,e[19]=m,e[20]=p):p=e[20];let g;e[21]!==s||e[22]!==n||e[23]!==a||e[24]!==i?(g=r.jsx(G_,{items:s,open:a,onOpenChange:l,onSelect:i,loadingPrompt:n}),e[21]=s,e[22]=n,e[23]=a,e[24]=i,e[25]=g):g=e[25];let _;return e[26]!==p||e[27]!==g?(_=r.jsxs(Mi,{delayDuration:400,children:[p,g]}),e[26]=p,e[27]=g,e[28]=_):_=e[28],_}function X_(){return null}function J_(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function Q_(t){const e=B.c(30),{connectionId:s}=t,{sendMessage:i}=Ui(),{tiptapDocRef:n}=ni(),{org:o}=ve();let a;e[0]!==s||e[1]!==o.id?(a={connectionId:s,orgId:o.id},e[0]=s,e[1]=o.id,e[2]=a):a=e[2];const l=Me(a);let c;e[3]!==l?(c={client:l,staleTime:6e4},e[3]=l,e[4]=c):c=e[4];const{data:d}=Rh(c);let u;e[5]!==d?.prompts?(u=d?.prompts??[],e[5]=d?.prompts,e[6]=u):u=e[6];const h=u;let f;e[7]!==h?(f=h.map(Z_),e[7]=h,e[8]=f):f=e[8];const m=f;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[9]=p):p=e[9];const[g,_]=S.useReducer(J_,p),[v,x]=S.useState(null);let b;e[10]!==l||e[11]!==i||e[12]!==n?(b=async(E,R)=>{if(!l){me.error("MCP client not available"),_({type:"RESET"});return}try{const M=await ul(l,E.name,R);_({type:"RESET"});const L=K_(n.current,{type:"paragraph",content:[Ip({id:E.name,name:al(E.name,si(E._meta)),metadata:M.messages,char:"/"})]});await i(L)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),me.error("Failed to load prompt. Please try again."),_({type:"RESET"})}},e[10]=l,e[11]=i,e[12]=n,e[13]=b):b=e[13];const y=b;let C;e[14]!==y?(C=async E=>{if(E.arguments&&E.arguments.length>0){_({type:"SELECT_PROMPT",prompt:E}),x(E);return}_({type:"START_LOADING",prompt:E}),await y(E)},e[14]=y,e[15]=C):C=e[15];const j=C;let w;e[16]!==v||e[17]!==y?(w=async E=>{v&&(_({type:"START_LOADING",prompt:v,arguments:E}),x(null),await y(v,E))},e[16]=v,e[17]=y,e[18]=w):w=e[18];const V=w;if(m.length===0)return null;const k=g.stage==="loading"?g.prompt:null;let T;e[19]!==j||e[20]!==m||e[21]!==k?(T=r.jsx(Y_,{items:m,onSelect:j,loadingPrompt:k}),e[19]=j,e[20]=m,e[21]=k,e[22]=T):T=e[22];let I;e[23]===Symbol.for("react.memo_cache_sentinel")?(I=()=>{x(null),_({type:"RESET"})},e[23]=I):I=e[23];let A;e[24]!==v||e[25]!==V?(A=r.jsx(Rl,{prompt:v,setPrompt:I,onSubmit:V}),e[24]=v,e[25]=V,e[26]=A):A=e[26];let N;return e[27]!==T||e[28]!==A?(N=r.jsxs(r.Fragment,{children:[T,A]}),e[27]=T,e[28]=A,e[29]=N):N=e[29],N}function Z_(t){return{prompt:t}}function ex(t){const e=B.c(13),{className:s}=t,{selectedVirtualMcp:i}=ni(),{org:n}=ve();let o;e[0]!==n.id?(o=io(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=o.id,l=i?.id??a;let c;e[2]!==s?(c=Y("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=l??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(X_,{}),e[4]=u):u=e[4];let h;e[5]!==l?(h=r.jsx(Q_,{connectionId:l}),e[5]=l,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=r.jsx(Cs,{fallback:null,children:r.jsx(S.Suspense,{fallback:u,children:h},d)}),e[7]=d,e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=r.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}function Cu(t){const e=B.c(21),{current:s,total:i,onPrev:n,onNext:o}=t;if(i<=1)return null;const a=s===0,l=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let c;e[0]!==l?(c=Y("p-0.5 rounded transition-colors",l),e[0]=l,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(xl,{size:14}),e[2]=d):d=e[2];let u;e[3]!==n||e[4]!==a||e[5]!==c?(u=r.jsx("button",{type:"button",onClick:n,disabled:a,className:c,"aria-label":"Previous question",children:d}),e[3]=n,e[4]=a,e[5]=c,e[6]=u):u=e[6];const h=s+1;let f;e[7]!==h||e[8]!==i?(f=r.jsxs("span",{className:"tabular-nums text-xs",children:[h," of ",i]}),e[7]=h,e[8]=i,e[9]=f):f=e[9];const m=s===i-1,p=s===i-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==p?(g=Y("p-0.5 rounded transition-colors",p),e[10]=p,e[11]=g):g=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(ro,{size:14}),e[12]=_):_=e[12];let v;e[13]!==o||e[14]!==g||e[15]!==m?(v=r.jsx("button",{type:"button",onClick:o,disabled:m,className:g,"aria-label":"Next question",children:_}),e[13]=o,e[14]=g,e[15]=m,e[16]=v):v=e[16];let x;return e[17]!==v||e[18]!==u||e[19]!==f?(x=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[u,f,v]}),e[17]=v,e[18]=u,e[19]=f,e[20]=x):x=e[20],x}function On(t){const e=B.c(18),{title:s,children:i,footerLeft:n,footerRight:o,className:a}=t,l=a??"border-border";let c;e[0]!==l?(c=Y("flex flex-col rounded-xl bg-background border shadow-md w-[calc(100%-16px)] max-w-[584px] mx-auto mb-[-16px]",l),e[0]=l,e[1]=c):c=e[1];let d;e[2]!==s?(d=r.jsx("div",{className:"flex items-center gap-2 p-4",children:r.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:s})}),e[2]=s,e[3]=d):d=e[3];let u;e[4]!==i?(u=r.jsx("div",{className:"overflow-clip pb-4",children:i}),e[4]=i,e[5]=u):u=e[5];let h;e[6]!==n?(h=r.jsx("div",{children:n}),e[6]=n,e[7]=h):h=e[7];let f;e[8]!==o?(f=r.jsx("div",{className:"flex items-center gap-2",children:o}),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==h||e[11]!==f?(m=r.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[h,f]})}),e[10]=h,e[11]=f,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==d||e[15]!==u||e[16]!==m?(p=r.jsxs("div",{className:c,children:[d,u,m]}),e[13]=c,e[14]=d,e[15]=u,e[16]=m,e[17]=p):p=e[17],p}const tx="User denied this tool call, give other alternatives.",sx=[{value:"readonly",label:"Ask before edit"},{value:"auto",label:"Auto approve"}];function ix(t){const e=B.c(9),{onYolo:s}=t,[i,n]=Wi();let o;e[0]!==s||e[1]!==i||e[2]!==n?(o=u=>{const h=u;n({...i,toolApprovalLevel:h}),h==="auto"&&s()},e[0]=s,e[1]=i,e[2]=n,e[3]=o):o=e[3];const a=o;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Zs,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:nx,children:r.jsx(ei,{})}),e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Js,{children:sx.map(rx)}),e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==i.toolApprovalLevel?(d=r.jsxs(Qs,{value:i.toolApprovalLevel,onValueChange:a,children:[l,c]}),e[6]=a,e[7]=i.toolApprovalLevel,e[8]=d):d=e[8],d}function rx(t){return r.jsx(Ft,{value:t.value,children:t.label},t.value)}function nx(t){return t.stopPropagation()}function ox(t){const e=B.c(5),{input:s}=t;if(s==null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=o):o=e[0],o}let i;try{let o;e[1]!==s?(o=JSON.stringify(s,null,2),e[1]=s,e[2]=o):o=e[2],i=o}catch{i=String(s)}let n;return e[3]!==i?(n=r.jsx("div",{className:"px-4",children:r.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:i})}),e[3]=i,e[4]=n):n=e[4],n}function ax(t){const e=B.c(42),{approvals:s,onRespond:i}=t,[n,o]=S.useState(0),a=Math.min(n,s.length-1),l=s[a];if(!l)return null;let c;e[0]!==l.approvalId||e[1]!==i?(c=()=>{i(l.approvalId,!1,tx)},e[0]=l.approvalId,e[1]=i,e[2]=c):c=e[2];const d=c;let u;e[3]!==l.approvalId||e[4]!==i?(u=()=>{i(l.approvalId,!0)},e[3]=l.approvalId,e[4]=i,e[5]=u):u=e[5];const h=u;let f;e[6]!==s||e[7]!==i?(f=()=>{for(const N of s)i(N.approvalId,!0)},e[6]=s,e[7]=i,e[8]=f):f=e[8];const m=f;let p;e[9]!==a?(p=()=>{a>0&&o(a-1)},e[9]=a,e[10]=p):p=e[10];const g=p;let _;e[11]!==s.length||e[12]!==a?(_=()=>{a<s.length-1&&o(a+1)},e[11]=s.length,e[12]=a,e[13]=_):_=e[13];const v=_;let x;e[14]!==m?(x=r.jsx(ix,{onYolo:m}),e[14]=m,e[15]=x):x=e[15];let b;e[16]!==s.length||e[17]!==v||e[18]!==g||e[19]!==a?(b=r.jsx(Cu,{current:a,total:s.length,onPrev:g,onNext:v}),e[16]=s.length,e[17]=v,e[18]=g,e[19]=a,e[20]=b):b=e[20];let y;e[21]!==x||e[22]!==b?(y=r.jsxs("div",{className:"flex items-center gap-2",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23];const C=y;let j;e[24]!==d?(j=r.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:d,children:"Deny"}),e[24]=d,e[25]=j):j=e[25];let w;e[26]!==s.length||e[27]!==m?(w=s.length>1&&r.jsx(re,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:m,children:"Accept All"}),e[26]=s.length,e[27]=m,e[28]=w):w=e[28];let V;e[29]!==h?(V=r.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:h,children:"Accept"}),e[29]=h,e[30]=V):V=e[30];let k;e[31]!==w||e[32]!==V||e[33]!==j?(k=r.jsxs(r.Fragment,{children:[j,w,V]}),e[31]=w,e[32]=V,e[33]=j,e[34]=k):k=e[34];const T=k;let I;e[35]!==l.input?(I=r.jsx(ox,{input:l.input}),e[35]=l.input,e[36]=I):I=e[36];let A;return e[37]!==l.friendlyName||e[38]!==C||e[39]!==T||e[40]!==I?(A=r.jsx(On,{title:l.friendlyName,footerLeft:C,footerRight:T,children:I}),e[37]=l.friendlyName,e[38]=C,e[39]=T,e[40]=I,e[41]=A):A=e[41],A}function lx(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[r.jsx(hg,{className:"size-5 text-muted-foreground shimmer"}),r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function cx(t){const e=B.c(4),{approvals:s,isStreaming:i,onRespond:n}=t;if(i&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(lx,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;let o;return e[1]!==s||e[2]!==n?(o=r.jsx(ax,{approvals:s,onRespond:n}),e[1]=s,e[2]=n,e[3]=o):o=e[3],o}function dx(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const i="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:i,friendlyName:Rp(Tp(i)),input:s.input})}return e}function hx(t){const e=B.c(15),{plan:s,onApprove:i,onDismiss:n}=t;let o;e[0]!==i||e[1]!==s.plan?(o=()=>{i(s.plan)},e[0]=i,e[1]=s.plan,e[2]=o):o=e[2];const a=o;let l;e[3]!==n?(l=r.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:n,children:"Keep iterating"}),e[3]=n,e[4]=l):l=e[4];let c;e[5]!==a?(c=r.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:"Let's go"}),e[5]=a,e[6]=c):c=e[6];let d;e[7]!==l||e[8]!==c?(d=r.jsxs(r.Fragment,{children:[l,c]}),e[7]=l,e[8]=c,e[9]=d):d=e[9];const u=d;let h;e[10]!==s.plan?(h=r.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:r.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:r.jsx(Dp,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[10]=s.plan,e[11]=h):h=e[11];let f;return e[12]!==u||e[13]!==h?(f=r.jsx(On,{title:"Implementation Plan",footerRight:u,className:"border-dashed border-purple-500",children:h}),e[12]=u,e[13]=h,e[14]=f):f=e[14],f}function ux(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[r.jsx(Jt,{className:"size-5 text-purple-500 shimmer"}),r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function fx(t){const e=B.c(7),{plans:s,isStreaming:i,onApprove:n,onDismiss:o}=t;if(i&&s.length===0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(ux,{}),e[0]=d):d=e[0],d}let a;e[1]!==s?(a=s.at(-1),e[1]=s,e[2]=a):a=e[2];const l=a;if(!l)return null;let c;return e[3]!==l||e[4]!==n||e[5]!==o?(c=r.jsx(hx,{plan:l,onApprove:n,onDismiss:o}),e[3]=l,e[4]=n,e[5]=o,e[6]=c):c=e[6],c}function mx(t){const e=[];for(const s of t)if("type"in s&&s.type==="tool-propose_plan"&&"state"in s&&s.state==="input-available"&&"toolCallId"in s&&"input"in s){const i=s.input;e.push({toolCallId:s.toolCallId,plan:i.plan,state:s.state})}return e}const Nc=Vs({response:Et().min(1,"Response is required")}),px=Vs({response:Et().min(1,"Please select or enter an option")}),gx=Vs({response:$m(["yes","no"])});function _x(t){switch(t.type){case"text":return Nc;case"choice":return px;case"confirm":return gx;default:return Nc}}function xx(t){const e={};for(const s of t)e[s.toolCallId]=_x(s.input);return Vs(e)}function vx(t){const e=B.c(6),{control:s,name:i,placeholder:n}=t;let o;e[0]!==n?(o=l=>{const{field:c}=l;return r.jsxs(Rt,{children:[r.jsx(Tt,{children:r.jsx("div",{className:"px-2",children:r.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(Bh,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...c,type:"text",placeholder:n||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),r.jsx(Dt,{})]})},e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==s||e[3]!==i||e[4]!==o?(a=r.jsx(It,{control:s,name:i,render:o}),e[2]=s,e[3]=i,e[4]=o,e[5]=a):a=e[5],a}function ju(t,e){const s=B.c(4);let i,n;s[0]!==t||s[1]!==e?(i=()=>{const o=a=>{const l=a.target.tagName;if(l==="INPUT"||l==="TEXTAREA"||a.metaKey||a.ctrlKey||a.altKey)return;const c=Number.parseInt(a.key,10);c>=1&&c<=t&&(a.preventDefault(),e(c-1))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},n=[t,e],s[0]=t,s[1]=e,s[2]=i,s[3]=n):(i=s[2],n=s[3]),S.useEffect(i,n)}function bx(t){const e=B.c(9),{control:s,name:i,options:n}=t,[o,a]=S.useState(!1),l=S.useRef(null),c=S.useRef(null);let d;if(e[0]!==n?(d=f=>{c.current?.onChange(n[f]??""),a(!1)},e[0]=n,e[1]=d):d=e[1],ju(n.length,d),n.length===0)return null;let u;e[2]!==o||e[3]!==n?(u=f=>{const{field:m}=f;c.current=m;const p=o||!!m.value&&!n.includes(m.value);return r.jsxs(Rt,{children:[r.jsx(Tt,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[n.map((g,_)=>{const v=m.value===g;return r.jsxs("button",{type:"button",onClick:()=>{m.onChange(g??""),a(!1)},className:Y("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",v&&"bg-accent/50",!v&&"hover:bg-accent/30"),"aria-label":`Select ${g}`,children:[r.jsx("span",{className:Y("flex items-center justify-center size-6 rounded-md text-sm shrink-0",v?"bg-chart-1 text-white":"bg-muted text-foreground"),children:_+1}),r.jsx("span",{className:"text-sm text-foreground truncate",children:g})]},`${_}-${g}`)}),r.jsxs("div",{className:Y("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),onClick:()=>{a(!0),n.includes(m.value)&&m.onChange(""),setTimeout(()=>l.current?.focus(),0)},children:[r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(Bh,{size:16,className:"text-muted-foreground"})}),p?r.jsx("input",{ref:l,type:"text",value:m.value,onChange:g=>m.onChange(g.target.value),placeholder:"Something else...",autoFocus:!0,"aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}):r.jsx("span",{className:"text-sm text-foreground/25",children:"Something else..."})]})]})}),r.jsx(Dt,{})]})},e[2]=o,e[3]=n,e[4]=u):u=e[4];let h;return e[5]!==s||e[6]!==i||e[7]!==u?(h=r.jsx(It,{control:s,name:i,render:u}),e[5]=s,e[6]=i,e[7]=u,e[8]=h):h=e[8],h}function yx(t){const e=B.c(6),{control:s,name:i}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["yes","no"],e[0]=n):n=e[0];const o=n,a=S.useRef(null);let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=u=>{a.current?.onChange(o[u]??"")},e[1]=l):l=e[1],ju(o.length,l);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{const{field:h}=u;return a.current=h,r.jsxs(Rt,{children:[r.jsx(Tt,{children:r.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:o.map(f=>{const m=h.value===f;return r.jsxs("button",{type:"button",onClick:()=>h.onChange(f),className:Y("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",m&&"bg-accent/50",!m&&"hover:bg-accent/30"),"aria-label":`Confirm ${f}`,children:[r.jsx("span",{className:Y("flex items-center justify-center size-6 rounded-md text-sm shrink-0",m?"bg-chart-1 text-white":"bg-muted text-foreground"),children:f==="yes"?1:2}),r.jsx("span",{className:"text-sm text-foreground capitalize",children:f})]},f)})})}),r.jsx(Dt,{})]})},e[2]=c):c=e[2];let d;return e[3]!==s||e[4]!==i?(d=r.jsx(It,{control:s,name:i,render:c}),e[3]=s,e[4]=i,e[5]=d):d=e[5],d}function Ac(t){const e=B.c(13),{input:s,control:i,name:n}=t;switch(s.type){case"text":{let o;return e[0]!==i||e[1]!==s.default||e[2]!==n?(o=r.jsx(vx,{control:i,name:n,placeholder:s.default}),e[0]=i,e[1]=s.default,e[2]=n,e[3]=o):o=e[3],o}case"choice":{let o;e[4]!==s.options?(o=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=o):o=e[5];const a=o;let l;return e[6]!==i||e[7]!==n||e[8]!==a?(l=r.jsx(bx,{control:i,name:n,options:a}),e[6]=i,e[7]=n,e[8]=a,e[9]=l):l=e[9],l}case"confirm":{let o;return e[10]!==i||e[11]!==n?(o=r.jsx(yx,{control:i,name:n}),e[10]=i,e[11]=n,e[12]=o):o=e[12],o}default:return null}}function Sx({parts:t,onSubmit:e}){const[s,i]=S.useState(t[0]?.toolCallId??""),n=xx(t.map(x=>({toolCallId:x.toolCallId,input:x.input}))),o=Hi({resolver:Or(n),defaultValues:Object.fromEntries(t.map(x=>[x.toolCallId,{response:""}]))}),a=o.watch(),l=t.findIndex(x=>x.toolCallId===s),c=!!a[s]?.response,d=t.every(x=>!!a[x.toolCallId]?.response),u=x=>{for(const b of t){const y=x[b.toolCallId]?.response;y&&e(b,y)}},h=x=>t.find(b=>!x[b.toolCallId]?.response&&b.toolCallId!==s)??null,f=()=>{const x=o.getValues();if(t.every(y=>!!x[y.toolCallId]?.response))o.handleSubmit(u)();else{const y=h(x);y&&i(y.toolCallId)}},m=()=>{o.setValue(`${s}.response`,"user has skip this question"),f()},p=()=>{if(l>0){const x=t[l-1];x&&i(x.toolCallId)}},g=()=>{if(l<t.length-1){const x=t[l+1];x&&i(x.toolCallId)}},_=r.jsxs(r.Fragment,{children:[r.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:m,className:"h-7",children:"Skip"}),r.jsx(re,{type:"button",size:"sm",disabled:!c,onClick:f,className:Y("h-7",c?"":"opacity-50"),children:d?"Submit":"Next"})]}),v=r.jsx(Cu,{current:l,total:t.length,onPrev:p,onNext:g});if(t.length===1){const x=t[0];return x?.input?r.jsx(Pi,{...o,children:r.jsx("form",{onSubmit:o.handleSubmit(u),autoComplete:"off",children:r.jsx(On,{title:x.input?.prompt??"Question",footerRight:_,children:r.jsx(Ac,{input:x.input,control:o.control,name:`${x.toolCallId}.response`})})})}):null}return r.jsx(Pi,{...o,children:r.jsx("form",{onSubmit:o.handleSubmit(u),autoComplete:"off",children:r.jsx(Th,{value:s,onValueChange:i,children:t.map(x=>r.jsx(yn,{value:x.toolCallId,className:"mt-0",children:r.jsx(On,{title:x.input?.prompt??"Question",footerLeft:v,footerRight:_,children:r.jsx(Ac,{input:x.input,control:o.control,name:`${x.toolCallId}.response`})})},x.toolCallId))})})})}function wx(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[r.jsx(Mg,{className:"size-5 text-muted-foreground shimmer"}),r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function ku(t){const e=B.c(6),{userAskParts:s,isStreaming:i,onSubmit:n}=t;let o;e[0]!==s?(o=s.filter(Vx),e[0]=s,e[1]=o):o=e[1];const a=o;if(i){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(wx,{}),e[2]=c):c=e[2],c}if(a.length===0)return null;let l;return e[3]!==n||e[4]!==a?(l=r.jsx(Sx,{parts:a,onSubmit:n}),e[3]=n,e[4]=a,e[5]=l):l=e[5],l}function Vx(t){return t.state==="input-available"}const Ec=new Map;function co(){const{org:t}=ve(),e=Me({connectionId:Ht,orgId:t.id}),s=bl(),i=s.find(_=>_.providerId==="deco"),{data:n,isLoading:o,refetch:a,isFetching:l}=Fi({queryKey:lt.aiProviderCredits(t.id,"deco"),enabled:!!i,staleTime:6e4,queryFn:async()=>{const _=await e.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return _?.isError?null:_.structuredContent??null}}),c=n?.balanceCents??null,d=c!=null?c/100:null,u=S.useRef(new Map);if(c!=null){const _=Ec.get(t.id);u.current.get(t.id)&&_!=null&&c>_&&ye("credits_topped_up_detected",{organization_id:t.id}),Ec.set(t.id,c),u.current.set(t.id,!0)}const h=!!i,f=c!=null&&c>0,m=c!=null&&c===0,p=c!=null&&c===200,g=s.length>0&&s.every(_=>_.providerId==="deco");return{hasDecoKey:h,decoKeyId:i?.id??null,balanceCents:c,balanceDollars:d,hasCredits:f,isZeroBalance:m,isInitialFreeCredit:p,hasOnlyDecoProvider:g,isLoading:o,isFetching:l,refetch:a}}function Cx(t){return t?t.message.startsWith("[CREDITS]"):!1}const jx={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},kx=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function Nu(t){const e=B.c(43),{onDismiss:s}=t,{org:i}=ve(),n=Ke(),{decoKeyId:o}=co();let a;e[0]!==i.id?(a={connectionId:Ht,orgId:i.id},e[0]=i.id,e[1]=a):a=e[1];const l=Me(a),[c,d]=S.useState(""),[u,h]=S.useState(!1),[f,m]=S.useState("usd"),p=f==="brl"?"R$":"$";let g,_;e[2]!==i.id?(g=()=>{ye("credits_exhausted_shown",{organization_id:i.id})},_=[i.id],e[2]=i.id,e[3]=g,e[4]=_):(g=e[3],_=e[4]),S.useEffect(g,_);let v;e[5]!==l||e[6]!==f?(v=async D=>{const P=await l.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:D,currency:f}});if(P?.isError)throw new Error(P.content?.[0]?.text??"Failed to get top-up URL");return P.structuredContent?.url},e[5]=l,e[6]=f,e[7]=v):v=e[7];let x;e[8]!==s?(x=D=>{D&&window.open(D,"_blank","noopener,noreferrer"),s?.()},e[8]=s,e[9]=x):x=e[9];let b;e[10]!==v||e[11]!==x?(b={mutationFn:v,onSuccess:x,onError:Ex},e[10]=v,e[11]=x,e[12]=b):b=e[12];const{mutate:y,isPending:C}=Br(b),j=parseFloat(c),w=!isNaN(j)&&j>=1;let V;e[13]!==s?(V=D=>!D&&s?.(),e[13]=s,e[14]=V):V=e[14];let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[15]=k):k=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:k.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[16]=T):T=e[16];let I;e[17]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[T,r.jsxs(Ds,{className:"relative gap-4",children:[r.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),r.jsxs("div",{children:[r.jsx(Ts,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),r.jsx(dl,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[17]=I):I=e[17];let A;e[18]!==f||e[19]!==p||e[20]!==c||e[21]!==j||e[22]!==o||e[23]!==w||e[24]!==C||e[25]!==u||e[26]!==y?(A=o&&r.jsxs("div",{className:"px-8 pt-5 pb-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(Qh,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:D=>{D&&m(D)},children:[r.jsx(Ln,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Ln,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsxs("div",{className:"rounded-xl border border-border p-5",children:[r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:jx[f].map(D=>{const{dollars:P,label:$}=D;return r.jsxs("button",{type:"button",disabled:C,onClick:()=>{y(P*100)},className:Y("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,P]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:$})]},P)})}),u?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(bt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:D=>d(D.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(re,{className:"h-10",disabled:!w||C,onClick:()=>{y(Math.round(j*100))},children:C?"Opening...":"Add"})]}):r.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>h(!0),children:"Enter custom amount"})]}),r.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:kx.map(Nx)})]}),e[18]=f,e[19]=p,e[20]=c,e[21]=j,e[22]=o,e[23]=w,e[24]=C,e[25]=u,e[26]=y,e[27]=A):A=e[27];let N;e[28]!==s?(N=r.jsx(re,{variant:"ghost",size:"sm",onClick:s,children:"Dismiss"}),e[28]=s,e[29]=N):N=e[29];let E;e[30]!==n||e[31]!==s||e[32]!==i.slug?(E=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{n({to:"/$org/settings/ai-providers",params:{org:i.slug}}),s?.()},children:"Manage providers"}),e[30]=n,e[31]=s,e[32]=i.slug,e[33]=E):E=e[33];let R;e[34]!==N||e[35]!==E?(R=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[N,E]}),e[34]=N,e[35]=E,e[36]=R):R=e[36];let M;e[37]!==A||e[38]!==R?(M=r.jsxs(ms,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Ax,children:[I,A,R]}),e[37]=A,e[38]=R,e[39]=M):M=e[39];let L;return e[40]!==M||e[41]!==V?(L=r.jsx(ps,{open:!0,onOpenChange:V,children:M}),e[40]=M,e[41]=V,e[42]=L):L=e[42],L}function Nx(t){return r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:r.jsx(Jt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),r.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Ax(t){return t.preventDefault()}function Ex(t){me.error(`Top-up failed: ${t.message}`)}const Ix={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function $n(t){const e=B.c(32),{variant:s,onDismiss:i}=t,n=s==="error",o=n?"Error occurred":"Response incomplete",a=n?t.error.message:Ix[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,l=n?"border-destructive/30 bg-destructive/5":"border-amber-500/30 bg-amber-500/5",c=n?"text-destructive":"text-amber-600 dark:text-amber-500",d=n?ri:yh;let u;e[0]!==l?(u=Y("flex items-start gap-2 px-3 py-2.5 rounded-lg border border-dashed text-sm w-full mb-2 shadow",l),e[0]=l,e[1]=u):u=e[1];let h;e[2]!==c?(h=Y("mt-0.5 shrink-0",c),e[2]=c,e[3]=h):h=e[3];let f;e[4]!==d?(f=r.jsx(d,{size:16}),e[4]=d,e[5]=f):f=e[5];let m;e[6]!==h||e[7]!==f?(m=r.jsx("div",{className:h,children:f}),e[6]=h,e[7]=f,e[8]=m):m=e[8];let p;e[9]!==c?(p=Y("text-xs mb-1 font-medium",c),e[9]=c,e[10]=p):p=e[10];let g;e[11]!==p||e[12]!==o?(g=r.jsx("div",{className:p,children:o}),e[11]=p,e[12]=o,e[13]=g):g=e[13];let _;e[14]!==a?(_=r.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground mb-2",children:a}),e[14]=a,e[15]=_):_=e[15];let v;e[16]!==n||e[17]!==t.onContinue||e[18]!==t.onFixInChat?(v=r.jsx("div",{className:"flex gap-2",children:n?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}),r.jsx(re,{size:"sm",variant:"outline",disabled:!0,className:"h-7 text-xs",children:"Report"})]}):r.jsx(re,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"})}),e[16]=n,e[17]=t.onContinue,e[18]=t.onFixInChat,e[19]=v):v=e[19];let x;e[20]!==g||e[21]!==_||e[22]!==v?(x=r.jsxs("div",{className:"flex-1 min-w-0",children:[g,_,v]}),e[20]=g,e[21]=_,e[22]=v,e[23]=x):x=e[23];let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(fi,{size:14}),e[24]=b):b=e[24];let y;e[25]!==i?(y=r.jsx("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Dismiss",children:b}),e[25]=i,e[26]=y):y=e[26];let C;return e[27]!==u||e[28]!==y||e[29]!==m||e[30]!==x?(C=r.jsx("div",{className:"px-0.5",children:r.jsxs("div",{className:u,children:[m,x,y]})}),e[27]=u,e[28]=y,e[29]=m,e[30]=x,e[31]=C):C=e[31],C}function ho(){const t=B.c(41),{error:e,clearError:s,finishReason:i,clearFinishReason:n,messages:o,isStreaming:a,isWaitingForApprovals:l,addToolOutput:c,addToolApprovalResponse:d,sendMessage:u}=Ui(),[h,f]=Wi(),{virtualMcpId:m,createTaskWithMessage:p}=es();let g,_,v,x;if(t[0]!==o){const R=o.at(-1);x=R?.role==="assistant"?R.parts.filter(Dx):null,g=x?.filter(Tx)?.length,_=R?.role==="assistant"?mx(R.parts):[],v=R?.role==="assistant"?dx(R.parts):[],t[0]=o,t[1]=g,t[2]=_,t[3]=v,t[4]=x}else g=t[1],_=t[2],v=t[3],x=t[4];const b=v;let y;t[5]!==e||t[6]!==u?(y=()=>{if(e){const M={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};u(M)}},t[5]=e,t[6]=u,t[7]=y):y=t[7];const C=y;let j;t[8]!==u?(j=()=>{u({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[8]=u,t[9]=j):j=t[9];const w=j;let V;t[10]!==c?(V=(R,M)=>{c({tool:"user_ask",toolCallId:R.toolCallId,output:{response:M}})},t[10]=c,t[11]=V):V=t[11];const k=V;let T;t[12]!==p||t[13]!==h||t[14]!==f||t[15]!==m?(T=R=>{f({...h,toolApprovalLevel:"auto"}),p({virtualMcpId:m,message:{parts:[{type:"text",text:`Implement this plan:
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-DveHsLbW.js","assets/index-DN06f7L5.js","assets/index-B2LlXg0m.css","assets/task-status-g2-NV9sQ.js","assets/agent-icon-UJwlsHQH.js","assets/AlertCircle-BBqU1qWS.js","assets/Tool01-DTFWc1H6.js","assets/SearchMd-w0SZQ38I.js","assets/ArrowNarrowLeft-CNekOP3n.js","assets/XCircle-poys0PpN.js","assets/ZapSquare-CZVrqALN.js","assets/Users03-DlknPznL.js","assets/CheckCircle-D1VIcB1v.js","assets/ChevronDown-D3j8fwsA.js","assets/ChevronRight-iahU_m85.js","assets/ChevronUp-gcRxFSBd.js","assets/Container-ClismqwZ.js","assets/Star01-izvvU391.js","assets/Palette-B56V8p0g.js","assets/index-6j1-PJ1E.js","assets/use-mobile-DiyZoirm.js","assets/X-g-dkGEmI.js","assets/LinkExternal01-Cr5TrBdV.js","assets/Lock01-BaFHhauP.js","assets/Sun-B88VGXex.js","assets/Play-CJl6p68m.js","assets/Plus-uRTzng7P.js","assets/Settings02-JhLe5T4h.js","assets/Trash01-DpAt8su9.js","assets/Upload01-xcbOBsW3.js","assets/User01-B4t4xc7U.js","assets/Zap-DKHqYmya.js","assets/scroll-area-C7RniLKT.js","assets/select-CeLGcRm_.js","assets/use-copy-XHJJc9Ag.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-Cqz8DxyP.js","assets/content-blocks-o63cs2vh.js","assets/types-CHdbkHyV.js","assets/constants-B6Y_WQ-J.js","assets/chat-context-BzUFrztp.js","assets/use-virtual-mcp-DQie-k1B.js","assets/use-collections-jpFK-1KA.js","assets/use-ai-providers-Sx7HvH7l.js","assets/use-decopilot-events-D2SrJLT6.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-CTpvHrCM.js","assets/use-organization-settings-PJvdW7d7.js","assets/shell-layout-D-glHQwJ.js","assets/required-auth-layout-6vnmXRJt.js","assets/use-org-sso-B3dpLK1-.js","assets/integration-icon-TghpaT83.js","assets/use-mcp-tools-BOQ7XAnx.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as Mt,r as S,p as Bm,q as Om,e as B,s as ve,K as lt,n as Fi,a as Br,v as Vs,w as Or,x as Hi,j as r,B as re,y as Et,c as Y,E as Cs,z as me,C as Wi,_ as $m,t as ye,f as Ke,D as yh,F as zm,R as Sh,G as Fm,H as ys,I as So,J as ds,L as Hm,M as wo,P as Wm,Q as Um,T as Km,U as qm,V as wh,W as Gm,X as Ym,Y as Xm,Z as Jm,$ as lc,l as Ee,b as St,u as Qm,a0 as pr,a1 as vn,a2 as nl,a3 as ol,g as $r,a4 as Vh,d as vi,a5 as Zm,a6 as ep,a7 as tp,a8 as sp,a9 as ip,aa as rp,ab as np,ac as zt,ad as op,ae as ap,af as lp,ag as cp,ah as Zi,ai as dp,aj as hp,ak as up,al as fp,am as Ch,an as mp,ao as pp,ap as gp,aq as _p,ar as xp,as as vp,at as bp,au as yp,av as Sp,aw as wp,ax as jh,ay as bn,az as Vp,aA as Ai,aB as nn,aC as kh,aD as Cp,aE as jp}from"./index-DN06f7L5.js";import{u as ni,a as Ui,b as es,A as kp,C as Np,c as ia,d as Ap,e as Zn,f as cc,t as Ep}from"./chat-context-BzUFrztp.js";import{d as eo,g as si,c as Ip,s as al,t as Rp,a as Tp,M as Dp,i as Mp,b as Cr,e as Pp,F as Lp,f as Nh,S as Bp,u as Op,h as dc,j as $p,k as zp,l as ra,r as Fp,m as Hp,p as Ah,n as Wp,o as Up,q as ll,G as Kp,L as qp,v as Gp,w as Yp,x as Xp,y as Jp}from"./task-status-g2-NV9sQ.js";import{S as jr,u as to,P as na,a as Qp,b as Zp,c as eg,E as tg,i as sg,d as ig,e as Eh}from"./scroll-area-C7RniLKT.js";import{T as Mi,u as Rs,a as tt,b as st,c as it}from"./use-mobile-DiyZoirm.js";import{D as Ts,a as Ds,b as cl,c as ms,d as ps,e as dl}from"./dialog-Cqz8DxyP.js";import{D as so,a as bi,b as yi,c as Si,d as rg,e as ng,f as og}from"./drawer-D1waomcL.js";import{C as Ih}from"./collection-search-ClPQOcN2.js";import{S as Ht,u as Me,g as io,i as Mn,c as ag,W as Os,a as lg,b as hl}from"./constants-B6Y_WQ-J.js";import{u as Rh,g as ul,T as Th,a as yn,l as Pn,b as Vo,c as cg}from"./tabs-BX4b83RA.js";import{F as Pi,a as It,b as Rt,c as rs,d as Tt,e as Dt,f as dg}from"./form-CGj888dU.js";import{I as bt}from"./input-BoegRSKK.js";import{i as Dh,u as zr,r as Mh}from"./shell-layout-D-glHQwJ.js";import{D as ot,a as Sn,b as wn,c as js,d as ks,e as Ns,f as Ph,g as Lh,h as hc}from"./dropdown-menu-CqFvWQQD.js";import{t as hg,i as Bh,n as ug,A as zs,a as Oh,b as fl,s as ii,c as fg,d as mg,e as $h,f as zh,g as pg,h as ml,j as gr,k as gg,l as pl,m as _g,o as xg,p as Fr,q as Hr,r as vg,u as uc,v as fc,w as bg,x as yg,y as mc,z as Sg,B as gl,C as Fh,D as oa,E as Co,F as pc,G as wg,H as Vg,I as Cg,J as jg,K as Hh,L as Wh,M as Uh,N as Kh,O as gc,P as kg,Q as _r,R as Ng,S as Ag,T as Eg,U as qh}from"./agent-icon-UJwlsHQH.js";import{n as Gh,a as aa,i as Ig,b as Rg,c as Tg}from"./ZapSquare-CZVrqALN.js";import{i as Jt,t as kr}from"./ChevronDown-D3j8fwsA.js";import{s as Ti}from"./Star01-izvvU391.js";import{a as la,t as _l}from"./Tool01-DTFWc1H6.js";import{i as Yh}from"./Lock01-BaFHhauP.js";import{s as Qt}from"./Plus-uRTzng7P.js";import{i as Xh}from"./Upload01-xcbOBsW3.js";import{i as fi}from"./X-g-dkGEmI.js";import{i as ri}from"./AlertCircle-BBqU1qWS.js";import{S as Js,a as Qs,b as Ft,c as Zs,d as ei}from"./select-CeLGcRm_.js";import{i as xl,a as vl,b as Dg}from"./SearchMd-w0SZQ38I.js";import{i as ro,t as Mg,a as Pg,b as Lg,c as Bg,d as Og,e as Li,f as Jh}from"./XCircle-poys0PpN.js";import{T as Qh,a as Ln}from"./toggle-group-Cmi6TIOk.js";import{u as bl,a as Zh}from"./use-ai-providers-Sx7HvH7l.js";import{m as no,M as eu,N as $g}from"./select-model-CTvOd2v6.js";import{S as zg,A as Fg,a as Hg,b as Wg,c as Ug,R as tu,d as Kg,e as qg}from"./accordion-DWL2RSp4.js";import{r as su,l as xr,u as Gg,g as Yg}from"./types-CHdbkHyV.js";import{u as oo,a as ts,b as yl}from"./use-virtual-mcp-DQie-k1B.js";import{u as Wr,a as Sl,b as wl}from"./use-connection-DJhKa9wi.js";import{p as Xg,q as _c}from"./question-004-sINsf4GQ.js";import{g as xc}from"./ai-providers-logos-CS4PCiqI.js";import{g as iu,s as ru}from"./connection-slug-eyAPH6o3.js";import{u as nu,a as ou,g as Jg,C as jo}from"./connection-card-2gDnhNHg.js";import{C as au}from"./collection-tabs-8zopfSWv.js";import{g as lu}from"./constants-45iVR-Pa.js";import{T as ca}from"./textarea-BhcVKoF_.js";import{n as Vn}from"./Container-ClismqwZ.js";import{c as Qg,i as on,a as vc,E as Zg,p as e_,b as t_,d as s_}from"./connection-form-helpers-8n1o0jn6.js";import{u as bc}from"./use-infinite-scroll-bSbQel-x.js";import{u as i_,C as r_,a as yc,b as Sc,c as n_,d as o_,e as a_,f as l_}from"./command-DKdp37Eh.js";import{g as c_,e as d_,a as h_}from"./extract-connection-data-B9Ysw6Jg.js";import{B as wc}from"./badge-Dw59WStE.js";import{i as Vl}from"./ChevronRight-iahU_m85.js";import{I as Ms}from"./integration-icon-TghpaT83.js";import{S as Bi}from"./skeleton-DL22VZPi.js";import{a as ao}from"./Users03-DlknPznL.js";import{I as Bn,S as cu,G as u_,L as f_,a as m_,b as du}from"./lean-canvas-recruit-modal-C13TMEgP.js";import{u as lo,a as hu}from"./use-navigate-to-agent-CNUExhtk.js";import{u as uu}from"./use-create-virtual-mcp-C17uvNYd.js";import{i as p_}from"./CheckCircle-D1VIcB1v.js";import{P as oi,a as ai,b as li}from"./popover-BJYX_eUP.js";import{u as wi,a as g_}from"./use-mcp-tools-BOQ7XAnx.js";import{E as Oi}from"./empty-state-A7wIyI5K.js";import{u as __}from"./use-decopilot-events-D2SrJLT6.js";import{i as $i}from"./Zap-DKHqYmya.js";import{i as fu,S as Ur,a as Kr,b as gs,u as qr,c as us,d as Zt,e as mu,f as pu,g as x_,h as gu,j as _u,P as hs,k as v_,l as b_,m as y_,n as S_,o as w_,p as V_}from"./index-6j1-PJ1E.js";import{u as xu,D as vu}from"./use-public-config-BnjdnqEK.js";import{A as Vc}from"./avatar-USIFL3XA.js";import{n as C_,a as j_,i as k_}from"./Sun-B88VGXex.js";import{a as Gr}from"./Settings02-JhLe5T4h.js";import{A as Cl,a as jl,b as kl,c as Nl,d as Al,e as El,f as Il,g as bu}from"./alert-dialog-FDHWZ_uw.js";import"./index-46g4uSud.js";import{u as yu}from"./use-tasks-CTpvHrCM.js";import{u as N_}from"./use-status-sounds-DEQHOZ-w.js";import{T as A_,u as Su}from"./tools-list-CsG9Mnwi.js";import{u as ko}from"./unwrap-tool-result-BYXdCQMg.js";import{C as E_,a as Cc}from"./card-DlmO8yFT.js";import{L as vr}from"./label-Dx2DK5Dz.js";import{S as da}from"./switch-Dgj2Qk7i.js";import{i as Cn}from"./Play-CJl6p68m.js";import{s as ha}from"./Trash01-DpAt8su9.js";import{C as I_}from"./checkbox-DWN5XcT5.js";import{n as Vi}from"./LinkExternal01-Cr5TrBdV.js";import{V as R_}from"./view-mode-toggle-BueEh3Rt.js";import{U as T_}from"./user-CZGUOwnk.js";import{u as Yr,a as D_,b as M_,c as P_,A as L_,d as B_}from"./automation-list-row-C6mcsBHm.js";import{S as O_}from"./search-input-CspVzFsE.js";import"./use-collections-jpFK-1KA.js";import"./use-organization-settings-PJvdW7d7.js";import"./use-copy-XHJJc9Ag.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./required-auth-layout-6vnmXRJt.js";import"./use-org-sso-B3dpLK1-.js";import"./ArrowNarrowLeft-CNekOP3n.js";import"./ChevronUp-gcRxFSBd.js";import"./Palette-B56V8p0g.js";import"./User01-B4t4xc7U.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./use-registry-connections-DwO9HoC-.js";import"./useInfiniteQuery-D4FFCIqQ.js";import"./infiniteQueryObserver-DYIxP7Ht.js";import"./collections-Bzlz5pov.js";import"./index-Do97zrKf.js";import"./create-sse-subscription-CxkOgzKf.js";function $_(t,e){const s=Mt(e);return z_({filters:{...t,status:"pending"}},s).length}function jc(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function z_(t={},e){const s=Mt(e).getMutationCache(),i=S.useRef(t),n=S.useRef(null);return n.current===null&&(n.current=jc(s,t)),S.useEffect(()=>{i.current=t}),S.useSyncExternalStore(S.useCallback(o=>s.subscribe(()=>{const a=Bm(n.current,jc(s,i.current));n.current!==a&&(n.current=a,Om.schedule(o))}),[s]),()=>n.current,()=>n.current)}function F_(t,e){const s=B.c(37),{org:i,locator:n}=ve();let o;s[0]!==i.id?(o={connectionId:Ht,orgId:i.id},s[0]=i.id,s[1]=o):o=s[1];const a=Me(o),l=Mt();let c;s[2]!==t||s[3]!==i.id?(c=lt.ensureTask(i.id,t),s[2]=t,s[3]=i.id,s[4]=c):c=s[4];let d;s[5]!==a||s[6]!==t?(d=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[5]=a,s[6]=t,s[7]=d):d=s[7];let u;s[8]!==c||s[9]!==d?(u={queryKey:c,queryFn:d,retry:!1,refetchOnWindowFocus:!1},s[8]=c,s[9]=d,s[10]=u):u=s[10];const h=Fi(u);let f;s[11]!==a||s[12]!==e?(f=async b=>{const y=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:b,virtual_mcp_id:e}}});if(y.isError){const j=y.content,w=Array.isArray(j)&&j[0]&&typeof j[0]=="object"?j[0].text??"Create failed":"Create failed";throw new Error(w)}return y.structuredContent.item},s[11]=a,s[12]=e,s[13]=f):f=s[13];let m;s[14]!==n||s[15]!==i.id||s[16]!==h||s[17]!==l?(m=()=>{l.invalidateQueries({predicate:b=>b.queryKey[1]===i.id&&b.queryKey[3]==="collection"&&b.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:lt.tasksPrefix(n)}),h.refetch()},s[14]=n,s[15]=i.id,s[16]=h,s[17]=l,s[18]=m):m=s[18];let p;s[19]!==f||s[20]!==m?(p={mutationFn:f,onSuccess:m},s[19]=f,s[20]=m,s[21]=p):p=s[21];const g=Br(p);let _,v;if(s[22]!==g||s[23]!==t||s[24]!==h.data||s[25]!==h.isSuccess?(_=()=>{!h.isSuccess||h.data||g.isPending||g.variables!==t&&g.mutate(t)},v=[t,h.isSuccess,h.data,g],s[22]=g,s[23]=t,s[24]=h.data,s[25]=h.isSuccess,s[26]=_,s[27]=v):(_=s[26],v=s[27]),S.useEffect(_,v),h.isLoading){let b;return s[28]===Symbol.for("react.memo_cache_sentinel")?(b={status:"loading"},s[28]=b):b=s[28],b}if(h.isError){const b=h.error;let y;return s[29]!==b?(y={status:"error",error:b},s[29]=b,s[30]=y):y=s[30],y}if(h.isSuccess&&h.data){let b;return s[31]!==h.data?(b={status:"ready",task:h.data},s[31]=h.data,s[32]=b):b=s[32],b}if(g.isPending||h.isSuccess&&!h.data){let b;return s[33]===Symbol.for("react.memo_cache_sentinel")?(b={status:"creating"},s[33]=b):b=s[33],b}if(g.isError){let b;return s[34]!==g.error?(b={status:"error",error:g.error},s[34]=g.error,s[35]=b):b=s[35],b}let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[36]=x):x=s[36],x}function H_(t){const e={};for(const s of t.arguments??[])e[s.name]=s.required?Et().min(1,"Required"):Et();return Vs(e)}function W_(t){const e={};for(const s of t.arguments??[])e[s.name]="";return e}function Rl(t){const e=B.c(65),{prompt:s,setPrompt:i,onSubmit:n}=t,o=S.useId();let a;if(e[0]!==s){const D=s?H_(s):Vs({});a=Or(D),e[0]=s,e[1]=a}else a=e[1];const c=a;let d;e[2]!==s?(d=s?W_(s):{},e[2]=s,e[3]=d):d=e[3];let u;e[4]!==c||e[5]!==d?(u={resolver:c,defaultValues:d,mode:"onChange"},e[4]=c,e[5]=d,e[6]=u):u=e[6];const h=Hi(u);let f;e[7]!==s?.arguments?(f=s?.arguments??[],e[7]=s?.arguments,e[8]=f):f=e[8];const m=f;let p;e[9]!==h||e[10]!==n||e[11]!==i?(p=async D=>{await n(D),i(null),h.reset()},e[9]=h,e[10]=n,e[11]=i,e[12]=p):p=e[12];const g=p;let _;e[13]!==h||e[14]!==i?(_=D=>{D||(h.reset(),i(null))},e[13]=h,e[14]=i,e[15]=_):_=e[15];const v=_;if(!s)return null;let x;e[16]!==s._meta||e[17]!==s.name||e[18]!==s.title?(x=s.title||eo(s.name,si(s._meta)),e[16]=s._meta,e[17]=s.name,e[18]=s.title,e[19]=x):x=e[19];let b;e[20]!==x?(b=r.jsx(Ts,{children:r.jsx("span",{className:"capitalize",children:x})}),e[20]=x,e[21]=b):b=e[21];let y;e[22]!==s.description?(y=s.description&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.description}),e[22]=s.description,e[23]=y):y=e[23];let C;e[24]!==y||e[25]!==b?(C=r.jsxs(Ds,{children:[b,y]}),e[24]=y,e[25]=b,e[26]=C):C=e[26];let j;e[27]!==h||e[28]!==g?(j=D=>{D.stopPropagation(),h.handleSubmit(g)(D)},e[27]=h,e[28]=g,e[29]=j):j=e[29];let w;if(e[30]!==m||e[31]!==h.control||e[32]!==h.formState.isSubmitting){let D;e[34]!==h.control||e[35]!==h.formState.isSubmitting?(D=P=>r.jsx(It,{control:h.control,name:P.name,render:$=>{const{field:z}=$;return r.jsxs(Rt,{children:[r.jsxs(rs,{className:"text-xs",children:[P.name,P.required?null:r.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),r.jsx(Tt,{children:r.jsx(bt,{...z,value:z.value??"",required:P.required,placeholder:P.description??"",className:"h-9",disabled:h.formState.isSubmitting})}),r.jsx(Dt,{})]})}},P.name),e[34]=h.control,e[35]=h.formState.isSubmitting,e[36]=D):D=e[36],w=m.map(D),e[30]=m,e[31]=h.control,e[32]=h.formState.isSubmitting,e[33]=w}else w=e[33];let V;e[37]!==v?(V=()=>v(!1),e[37]=v,e[38]=V):V=e[38];let k;e[39]!==h.formState.isSubmitting||e[40]!==V?(k=r.jsx(re,{type:"button",variant:"ghost",onClick:V,disabled:h.formState.isSubmitting,children:"Cancel"}),e[39]=h.formState.isSubmitting,e[40]=V,e[41]=k):k=e[41];const T=!h.formState.isValid||h.formState.isSubmitting;let I;e[42]!==h.formState.isSubmitting?(I=h.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(jr,{size:"xs"}),"Loading..."]}):"Use prompt",e[42]=h.formState.isSubmitting,e[43]=I):I=e[43];let A;e[44]!==o||e[45]!==T||e[46]!==I?(A=r.jsx(re,{type:"submit",form:o,disabled:T,children:I}),e[44]=o,e[45]=T,e[46]=I,e[47]=A):A=e[47];let N;e[48]!==k||e[49]!==A?(N=r.jsxs(cl,{children:[k,A]}),e[48]=k,e[49]=A,e[50]=N):N=e[50];let E;e[51]!==o||e[52]!==j||e[53]!==w||e[54]!==N?(E=r.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:j,children:[w,N]}),e[51]=o,e[52]=j,e[53]=w,e[54]=N,e[55]=E):E=e[55];let R;e[56]!==h||e[57]!==E?(R=r.jsx(Pi,{...h,children:E}),e[56]=h,e[57]=E,e[58]=R):R=e[58];let M;e[59]!==C||e[60]!==R?(M=r.jsxs(ms,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[59]=C,e[60]=R,e[61]=M):M=e[61];let L;return e[62]!==v||e[63]!==M?(L=r.jsx(ps,{open:!0,onOpenChange:v,children:M}),e[62]=v,e[63]=M,e[64]=L):L=e[64],L}function U_(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}function K_(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const kc=3,wu="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",q_="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Vu(t){const e=B.c(46),{item:s,onSelect:i,isLoading:n,isDisabled:o,variant:a}=t,l=a===void 0?"pill":a,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const w=si(c._meta);d=c.title??eo(c.name,w),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const u=d,h=c.description||null;if(l==="card"){let w;e[4]!==i||e[5]!==c?(w=()=>i(c),e[4]=i,e[5]=c,e[6]=w):w=e[6];const V=o||n,k=n&&"bg-accent/40",T=(o||n)&&"cursor-not-allowed opacity-50";let I;e[7]!==k||e[8]!==T?(I=Y(q_,"hover:bg-accent/60 text-foreground",k,T),e[7]=k,e[8]=T,e[9]=I):I=e[9];let A;e[10]!==u?(A=r.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=A):A=e[11];let N;e[12]!==n?(N=n&&r.jsx(jr,{size:"xs"}),e[12]=n,e[13]=N):N=e[13];let E;e[14]!==A||e[15]!==N?(E=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[A,N]}),e[14]=A,e[15]=N,e[16]=E):E=e[16];let R;e[17]!==h?(R=h&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=R):R=e[18];let M;return e[19]!==E||e[20]!==R||e[21]!==w||e[22]!==V||e[23]!==I?(M=r.jsxs("button",{type:"button",onClick:w,disabled:V,className:I,children:[E,R]}),e[19]=E,e[20]=R,e[21]=w,e[22]=V,e[23]=I,e[24]=M):M=e[24],M}let f;e[25]!==i||e[26]!==c?(f=()=>i(c),e[25]=i,e[26]=c,e[27]=f):f=e[27];const m=o||n,p=n&&"bg-muted/50",g=(o||n)&&"cursor-not-allowed opacity-50";let _;e[28]!==p||e[29]!==g?(_=Y(wu,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=_):_=e[30];let v;e[31]!==u?(v=r.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=v):v=e[32];let x;e[33]!==n?(x=n&&r.jsx(jr,{size:"xs"}),e[33]=n,e[34]=x):x=e[34];let b;e[35]!==f||e[36]!==m||e[37]!==_||e[38]!==v||e[39]!==x?(b=r.jsx(tt,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:m,className:_,children:[v,x]})}),e[35]=f,e[36]=m,e[37]=_,e[38]=v,e[39]=x,e[40]=b):b=e[40];const y=h??u;let C;e[41]!==y?(C=r.jsx(st,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=C):C=e[42];let j;return e[43]!==b||e[44]!==C?(j=r.jsxs(it,{delayDuration:400,children:[b,C]}),e[43]=b,e[44]=C,e[45]=j):j=e[45],j}function G_(t){const e=B.c(41),{items:s,open:i,onOpenChange:n,onSelect:o,loadingPrompt:a}=t,[l,c]=S.useState(""),d=!!a;let u;e[0]!==s||e[1]!==l?(u=l.trim()?s.filter(V=>{const k=l.toLowerCase();return V.prompt.name.toLowerCase().includes(k)||(V.prompt.title??"").toLowerCase().includes(k)||(V.prompt.description??"").toLowerCase().includes(k)}):s,e[0]=s,e[1]=l,e[2]=u):u=e[2];const h=u,f=Rs();let m;e[3]!==h.length||e[4]!==l?(m=h.length===0&&r.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",l,"”"]}),e[3]=h.length,e[4]=l,e[5]=m):m=e[5];let p;if(e[6]!==h||e[7]!==d||e[8]!==a?.name||e[9]!==n||e[10]!==o){let V;e[12]!==d||e[13]!==a?.name||e[14]!==n||e[15]!==o?(V=k=>r.jsx(Vu,{item:k,variant:"card",onSelect:T=>{n(!1),o(T)},isLoading:a?.name===k.prompt.name,isDisabled:d&&a?.name!==k.prompt.name},k.prompt.name),e[12]=d,e[13]=a?.name,e[14]=n,e[15]=o,e[16]=V):V=e[16],p=h.map(V),e[6]=h,e[7]=d,e[8]=a?.name,e[9]=n,e[10]=o,e[11]=p}else p=e[11];let g;e[17]!==m||e[18]!==p?(g=r.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[m,p]})}),e[17]=m,e[18]=p,e[19]=g):g=e[19];const _=g;let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=V=>{V.key==="Escape"&&c("")},e[20]=v):v=e[20];let x;e[21]!==l?(x=r.jsx(Ih,{value:l,onChange:c,placeholder:"Search prompts...",onKeyDown:v}),e[21]=l,e[22]=x):x=e[22];const b=x;if(f){let V;e[23]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(so,{className:"sr-only",children:r.jsx(bi,{children:"All prompts"})}),e[23]=V):V=e[23];let k;e[24]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=k):k=e[24];let T;e[25]!==_||e[26]!==b?(T=r.jsxs(yi,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[V,k,b,_]}),e[25]=_,e[26]=b,e[27]=T):T=e[27];let I;return e[28]!==n||e[29]!==i||e[30]!==T?(I=r.jsx(Mi,{delayDuration:400,children:r.jsx(Si,{open:i,onOpenChange:n,children:T})}),e[28]=n,e[29]=i,e[30]=T,e[31]=I):I=e[31],I}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Ds,{className:"sr-only",children:r.jsx(Ts,{children:"All prompts"})}),e[32]=y):y=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=C):C=e[33];let j;e[34]!==_||e[35]!==b?(j=r.jsxs(ms,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,C,b,_]}),e[34]=_,e[35]=b,e[36]=j):j=e[36];let w;return e[37]!==n||e[38]!==i||e[39]!==j?(w=r.jsx(Mi,{delayDuration:400,children:r.jsx(ps,{open:i,onOpenChange:n,children:j})}),e[37]=n,e[38]=i,e[39]=j,e[40]=w):w=e[40],w}function Y_(t){const e=B.c(29),{items:s,onSelect:i,loadingPrompt:n,className:o}=t,[a,l]=S.useState(!1);if(s.length===0)return null;let c,d,u;if(e[0]!==s||e[1]!==n||e[2]!==i){const v=s.slice(0,kc);let x;e[6]!==s?(x=s.slice(kc),e[6]=s,e[7]=x):x=e[7],c=x,d=!!n;let b;e[8]!==d||e[9]!==n?.name||e[10]!==i?(b=y=>r.jsx(Vu,{item:y,onSelect:i,isLoading:n?.name===y.prompt.name,isDisabled:d&&n?.name!==y.prompt.name},y.prompt.name),e[8]=d,e[9]=n?.name,e[10]=i,e[11]=b):b=e[11],u=v.map(b),e[0]=s,e[1]=n,e[2]=i,e[3]=c,e[4]=d,e[5]=u}else c=e[3],d=e[4],u=e[5];const h=u;let f;e[12]!==o?(f=Y("w-full flex flex-wrap gap-2 justify-center",o),e[12]=o,e[13]=f):f=e[13];let m;e[14]!==c.length||e[15]!==d?(m=c.length>0&&r.jsxs("button",{type:"button",disabled:d,onClick:()=>l(!0),className:Y(wu,"hover:bg-muted/70 hover:text-foreground",d&&"opacity-50 cursor-not-allowed"),children:["+",c.length," more"]}),e[14]=c.length,e[15]=d,e[16]=m):m=e[16];let p;e[17]!==h||e[18]!==f||e[19]!==m?(p=r.jsxs("div",{className:f,children:[h,m]}),e[17]=h,e[18]=f,e[19]=m,e[20]=p):p=e[20];let g;e[21]!==s||e[22]!==n||e[23]!==a||e[24]!==i?(g=r.jsx(G_,{items:s,open:a,onOpenChange:l,onSelect:i,loadingPrompt:n}),e[21]=s,e[22]=n,e[23]=a,e[24]=i,e[25]=g):g=e[25];let _;return e[26]!==p||e[27]!==g?(_=r.jsxs(Mi,{delayDuration:400,children:[p,g]}),e[26]=p,e[27]=g,e[28]=_):_=e[28],_}function X_(){return null}function J_(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function Q_(t){const e=B.c(30),{connectionId:s}=t,{sendMessage:i}=Ui(),{tiptapDocRef:n}=ni(),{org:o}=ve();let a;e[0]!==s||e[1]!==o.id?(a={connectionId:s,orgId:o.id},e[0]=s,e[1]=o.id,e[2]=a):a=e[2];const l=Me(a);let c;e[3]!==l?(c={client:l,staleTime:6e4},e[3]=l,e[4]=c):c=e[4];const{data:d}=Rh(c);let u;e[5]!==d?.prompts?(u=d?.prompts??[],e[5]=d?.prompts,e[6]=u):u=e[6];const h=u;let f;e[7]!==h?(f=h.map(Z_),e[7]=h,e[8]=f):f=e[8];const m=f;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[9]=p):p=e[9];const[g,_]=S.useReducer(J_,p),[v,x]=S.useState(null);let b;e[10]!==l||e[11]!==i||e[12]!==n?(b=async(E,R)=>{if(!l){me.error("MCP client not available"),_({type:"RESET"});return}try{const M=await ul(l,E.name,R);_({type:"RESET"});const L=K_(n.current,{type:"paragraph",content:[Ip({id:E.name,name:al(E.name,si(E._meta)),metadata:M.messages,char:"/"})]});await i(L)}catch(M){console.error("[ice-breakers] Failed to fetch prompt:",M),me.error("Failed to load prompt. Please try again."),_({type:"RESET"})}},e[10]=l,e[11]=i,e[12]=n,e[13]=b):b=e[13];const y=b;let C;e[14]!==y?(C=async E=>{if(E.arguments&&E.arguments.length>0){_({type:"SELECT_PROMPT",prompt:E}),x(E);return}_({type:"START_LOADING",prompt:E}),await y(E)},e[14]=y,e[15]=C):C=e[15];const j=C;let w;e[16]!==v||e[17]!==y?(w=async E=>{v&&(_({type:"START_LOADING",prompt:v,arguments:E}),x(null),await y(v,E))},e[16]=v,e[17]=y,e[18]=w):w=e[18];const V=w;if(m.length===0)return null;const k=g.stage==="loading"?g.prompt:null;let T;e[19]!==j||e[20]!==m||e[21]!==k?(T=r.jsx(Y_,{items:m,onSelect:j,loadingPrompt:k}),e[19]=j,e[20]=m,e[21]=k,e[22]=T):T=e[22];let I;e[23]===Symbol.for("react.memo_cache_sentinel")?(I=()=>{x(null),_({type:"RESET"})},e[23]=I):I=e[23];let A;e[24]!==v||e[25]!==V?(A=r.jsx(Rl,{prompt:v,setPrompt:I,onSubmit:V}),e[24]=v,e[25]=V,e[26]=A):A=e[26];let N;return e[27]!==T||e[28]!==A?(N=r.jsxs(r.Fragment,{children:[T,A]}),e[27]=T,e[28]=A,e[29]=N):N=e[29],N}function Z_(t){return{prompt:t}}function ex(t){const e=B.c(13),{className:s}=t,{selectedVirtualMcp:i}=ni(),{org:n}=ve();let o;e[0]!==n.id?(o=io(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=o.id,l=i?.id??a;let c;e[2]!==s?(c=Y("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=l??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(X_,{}),e[4]=u):u=e[4];let h;e[5]!==l?(h=r.jsx(Q_,{connectionId:l}),e[5]=l,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=r.jsx(Cs,{fallback:null,children:r.jsx(S.Suspense,{fallback:u,children:h},d)}),e[7]=d,e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=r.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}function Cu(t){const e=B.c(21),{current:s,total:i,onPrev:n,onNext:o}=t;if(i<=1)return null;const a=s===0,l=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let c;e[0]!==l?(c=Y("p-0.5 rounded transition-colors",l),e[0]=l,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(xl,{size:14}),e[2]=d):d=e[2];let u;e[3]!==n||e[4]!==a||e[5]!==c?(u=r.jsx("button",{type:"button",onClick:n,disabled:a,className:c,"aria-label":"Previous question",children:d}),e[3]=n,e[4]=a,e[5]=c,e[6]=u):u=e[6];const h=s+1;let f;e[7]!==h||e[8]!==i?(f=r.jsxs("span",{className:"tabular-nums text-xs",children:[h," of ",i]}),e[7]=h,e[8]=i,e[9]=f):f=e[9];const m=s===i-1,p=s===i-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==p?(g=Y("p-0.5 rounded transition-colors",p),e[10]=p,e[11]=g):g=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(ro,{size:14}),e[12]=_):_=e[12];let v;e[13]!==o||e[14]!==g||e[15]!==m?(v=r.jsx("button",{type:"button",onClick:o,disabled:m,className:g,"aria-label":"Next question",children:_}),e[13]=o,e[14]=g,e[15]=m,e[16]=v):v=e[16];let x;return e[17]!==v||e[18]!==u||e[19]!==f?(x=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[u,f,v]}),e[17]=v,e[18]=u,e[19]=f,e[20]=x):x=e[20],x}function On(t){const e=B.c(18),{title:s,children:i,footerLeft:n,footerRight:o,className:a}=t,l=a??"border-border";let c;e[0]!==l?(c=Y("flex flex-col rounded-xl bg-background border shadow-md w-[calc(100%-16px)] max-w-[584px] mx-auto mb-[-16px]",l),e[0]=l,e[1]=c):c=e[1];let d;e[2]!==s?(d=r.jsx("div",{className:"flex items-center gap-2 p-4",children:r.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:s})}),e[2]=s,e[3]=d):d=e[3];let u;e[4]!==i?(u=r.jsx("div",{className:"overflow-clip pb-4",children:i}),e[4]=i,e[5]=u):u=e[5];let h;e[6]!==n?(h=r.jsx("div",{children:n}),e[6]=n,e[7]=h):h=e[7];let f;e[8]!==o?(f=r.jsx("div",{className:"flex items-center gap-2",children:o}),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==h||e[11]!==f?(m=r.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[h,f]})}),e[10]=h,e[11]=f,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==d||e[15]!==u||e[16]!==m?(p=r.jsxs("div",{className:c,children:[d,u,m]}),e[13]=c,e[14]=d,e[15]=u,e[16]=m,e[17]=p):p=e[17],p}const tx="User denied this tool call, give other alternatives.",sx=[{value:"readonly",label:"Ask before edit"},{value:"auto",label:"Auto approve"}];function ix(t){const e=B.c(9),{onYolo:s}=t,[i,n]=Wi();let o;e[0]!==s||e[1]!==i||e[2]!==n?(o=u=>{const h=u;n({...i,toolApprovalLevel:h}),h==="auto"&&s()},e[0]=s,e[1]=i,e[2]=n,e[3]=o):o=e[3];const a=o;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Zs,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:nx,children:r.jsx(ei,{})}),e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Js,{children:sx.map(rx)}),e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==i.toolApprovalLevel?(d=r.jsxs(Qs,{value:i.toolApprovalLevel,onValueChange:a,children:[l,c]}),e[6]=a,e[7]=i.toolApprovalLevel,e[8]=d):d=e[8],d}function rx(t){return r.jsx(Ft,{value:t.value,children:t.label},t.value)}function nx(t){return t.stopPropagation()}function ox(t){const e=B.c(5),{input:s}=t;if(s==null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=o):o=e[0],o}let i;try{let o;e[1]!==s?(o=JSON.stringify(s,null,2),e[1]=s,e[2]=o):o=e[2],i=o}catch{i=String(s)}let n;return e[3]!==i?(n=r.jsx("div",{className:"px-4",children:r.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:i})}),e[3]=i,e[4]=n):n=e[4],n}function ax(t){const e=B.c(42),{approvals:s,onRespond:i}=t,[n,o]=S.useState(0),a=Math.min(n,s.length-1),l=s[a];if(!l)return null;let c;e[0]!==l.approvalId||e[1]!==i?(c=()=>{i(l.approvalId,!1,tx)},e[0]=l.approvalId,e[1]=i,e[2]=c):c=e[2];const d=c;let u;e[3]!==l.approvalId||e[4]!==i?(u=()=>{i(l.approvalId,!0)},e[3]=l.approvalId,e[4]=i,e[5]=u):u=e[5];const h=u;let f;e[6]!==s||e[7]!==i?(f=()=>{for(const N of s)i(N.approvalId,!0)},e[6]=s,e[7]=i,e[8]=f):f=e[8];const m=f;let p;e[9]!==a?(p=()=>{a>0&&o(a-1)},e[9]=a,e[10]=p):p=e[10];const g=p;let _;e[11]!==s.length||e[12]!==a?(_=()=>{a<s.length-1&&o(a+1)},e[11]=s.length,e[12]=a,e[13]=_):_=e[13];const v=_;let x;e[14]!==m?(x=r.jsx(ix,{onYolo:m}),e[14]=m,e[15]=x):x=e[15];let b;e[16]!==s.length||e[17]!==v||e[18]!==g||e[19]!==a?(b=r.jsx(Cu,{current:a,total:s.length,onPrev:g,onNext:v}),e[16]=s.length,e[17]=v,e[18]=g,e[19]=a,e[20]=b):b=e[20];let y;e[21]!==x||e[22]!==b?(y=r.jsxs("div",{className:"flex items-center gap-2",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23];const C=y;let j;e[24]!==d?(j=r.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:d,children:"Deny"}),e[24]=d,e[25]=j):j=e[25];let w;e[26]!==s.length||e[27]!==m?(w=s.length>1&&r.jsx(re,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:m,children:"Accept All"}),e[26]=s.length,e[27]=m,e[28]=w):w=e[28];let V;e[29]!==h?(V=r.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:h,children:"Accept"}),e[29]=h,e[30]=V):V=e[30];let k;e[31]!==w||e[32]!==V||e[33]!==j?(k=r.jsxs(r.Fragment,{children:[j,w,V]}),e[31]=w,e[32]=V,e[33]=j,e[34]=k):k=e[34];const T=k;let I;e[35]!==l.input?(I=r.jsx(ox,{input:l.input}),e[35]=l.input,e[36]=I):I=e[36];let A;return e[37]!==l.friendlyName||e[38]!==C||e[39]!==T||e[40]!==I?(A=r.jsx(On,{title:l.friendlyName,footerLeft:C,footerRight:T,children:I}),e[37]=l.friendlyName,e[38]=C,e[39]=T,e[40]=I,e[41]=A):A=e[41],A}function lx(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[r.jsx(hg,{className:"size-5 text-muted-foreground shimmer"}),r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function cx(t){const e=B.c(4),{approvals:s,isStreaming:i,onRespond:n}=t;if(i&&s.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(lx,{}),e[0]=a):a=e[0],a}if(s.length===0)return null;let o;return e[1]!==s||e[2]!==n?(o=r.jsx(ax,{approvals:s,onRespond:n}),e[1]=s,e[2]=n,e[3]=o):o=e[3],o}function dx(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const i="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:i,friendlyName:Rp(Tp(i)),input:s.input})}return e}function hx(t){const e=B.c(15),{plan:s,onApprove:i,onDismiss:n}=t;let o;e[0]!==i||e[1]!==s.plan?(o=()=>{i(s.plan)},e[0]=i,e[1]=s.plan,e[2]=o):o=e[2];const a=o;let l;e[3]!==n?(l=r.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:n,children:"Keep iterating"}),e[3]=n,e[4]=l):l=e[4];let c;e[5]!==a?(c=r.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:a,children:"Let's go"}),e[5]=a,e[6]=c):c=e[6];let d;e[7]!==l||e[8]!==c?(d=r.jsxs(r.Fragment,{children:[l,c]}),e[7]=l,e[8]=c,e[9]=d):d=e[9];const u=d;let h;e[10]!==s.plan?(h=r.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:r.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:r.jsx(Dp,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[10]=s.plan,e[11]=h):h=e[11];let f;return e[12]!==u||e[13]!==h?(f=r.jsx(On,{title:"Implementation Plan",footerRight:u,className:"border-dashed border-purple-500",children:h}),e[12]=u,e[13]=h,e[14]=f):f=e[14],f}function ux(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[r.jsx(Jt,{className:"size-5 text-purple-500 shimmer"}),r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function fx(t){const e=B.c(7),{plans:s,isStreaming:i,onApprove:n,onDismiss:o}=t;if(i&&s.length===0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(ux,{}),e[0]=d):d=e[0],d}let a;e[1]!==s?(a=s.at(-1),e[1]=s,e[2]=a):a=e[2];const l=a;if(!l)return null;let c;return e[3]!==l||e[4]!==n||e[5]!==o?(c=r.jsx(hx,{plan:l,onApprove:n,onDismiss:o}),e[3]=l,e[4]=n,e[5]=o,e[6]=c):c=e[6],c}function mx(t){const e=[];for(const s of t)if("type"in s&&s.type==="tool-propose_plan"&&"state"in s&&s.state==="input-available"&&"toolCallId"in s&&"input"in s){const i=s.input;e.push({toolCallId:s.toolCallId,plan:i.plan,state:s.state})}return e}const Nc=Vs({response:Et().min(1,"Response is required")}),px=Vs({response:Et().min(1,"Please select or enter an option")}),gx=Vs({response:$m(["yes","no"])});function _x(t){switch(t.type){case"text":return Nc;case"choice":return px;case"confirm":return gx;default:return Nc}}function xx(t){const e={};for(const s of t)e[s.toolCallId]=_x(s.input);return Vs(e)}function vx(t){const e=B.c(6),{control:s,name:i,placeholder:n}=t;let o;e[0]!==n?(o=l=>{const{field:c}=l;return r.jsxs(Rt,{children:[r.jsx(Tt,{children:r.jsx("div",{className:"px-2",children:r.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(Bh,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...c,type:"text",placeholder:n||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),r.jsx(Dt,{})]})},e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==s||e[3]!==i||e[4]!==o?(a=r.jsx(It,{control:s,name:i,render:o}),e[2]=s,e[3]=i,e[4]=o,e[5]=a):a=e[5],a}function ju(t,e){const s=B.c(4);let i,n;s[0]!==t||s[1]!==e?(i=()=>{const o=a=>{const l=a.target.tagName;if(l==="INPUT"||l==="TEXTAREA"||a.metaKey||a.ctrlKey||a.altKey)return;const c=Number.parseInt(a.key,10);c>=1&&c<=t&&(a.preventDefault(),e(c-1))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},n=[t,e],s[0]=t,s[1]=e,s[2]=i,s[3]=n):(i=s[2],n=s[3]),S.useEffect(i,n)}function bx(t){const e=B.c(9),{control:s,name:i,options:n}=t,[o,a]=S.useState(!1),l=S.useRef(null),c=S.useRef(null);let d;if(e[0]!==n?(d=f=>{c.current?.onChange(n[f]??""),a(!1)},e[0]=n,e[1]=d):d=e[1],ju(n.length,d),n.length===0)return null;let u;e[2]!==o||e[3]!==n?(u=f=>{const{field:m}=f;c.current=m;const p=o||!!m.value&&!n.includes(m.value);return r.jsxs(Rt,{children:[r.jsx(Tt,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[n.map((g,_)=>{const v=m.value===g;return r.jsxs("button",{type:"button",onClick:()=>{m.onChange(g??""),a(!1)},className:Y("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",v&&"bg-accent/50",!v&&"hover:bg-accent/30"),"aria-label":`Select ${g}`,children:[r.jsx("span",{className:Y("flex items-center justify-center size-6 rounded-md text-sm shrink-0",v?"bg-chart-1 text-white":"bg-muted text-foreground"),children:_+1}),r.jsx("span",{className:"text-sm text-foreground truncate",children:g})]},`${_}-${g}`)}),r.jsxs("div",{className:Y("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),onClick:()=>{a(!0),n.includes(m.value)&&m.onChange(""),setTimeout(()=>l.current?.focus(),0)},children:[r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(Bh,{size:16,className:"text-muted-foreground"})}),p?r.jsx("input",{ref:l,type:"text",value:m.value,onChange:g=>m.onChange(g.target.value),placeholder:"Something else...",autoFocus:!0,"aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}):r.jsx("span",{className:"text-sm text-foreground/25",children:"Something else..."})]})]})}),r.jsx(Dt,{})]})},e[2]=o,e[3]=n,e[4]=u):u=e[4];let h;return e[5]!==s||e[6]!==i||e[7]!==u?(h=r.jsx(It,{control:s,name:i,render:u}),e[5]=s,e[6]=i,e[7]=u,e[8]=h):h=e[8],h}function yx(t){const e=B.c(6),{control:s,name:i}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["yes","no"],e[0]=n):n=e[0];const o=n,a=S.useRef(null);let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=u=>{a.current?.onChange(o[u]??"")},e[1]=l):l=e[1],ju(o.length,l);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=u=>{const{field:h}=u;return a.current=h,r.jsxs(Rt,{children:[r.jsx(Tt,{children:r.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:o.map(f=>{const m=h.value===f;return r.jsxs("button",{type:"button",onClick:()=>h.onChange(f),className:Y("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",m&&"bg-accent/50",!m&&"hover:bg-accent/30"),"aria-label":`Confirm ${f}`,children:[r.jsx("span",{className:Y("flex items-center justify-center size-6 rounded-md text-sm shrink-0",m?"bg-chart-1 text-white":"bg-muted text-foreground"),children:f==="yes"?1:2}),r.jsx("span",{className:"text-sm text-foreground capitalize",children:f})]},f)})})}),r.jsx(Dt,{})]})},e[2]=c):c=e[2];let d;return e[3]!==s||e[4]!==i?(d=r.jsx(It,{control:s,name:i,render:c}),e[3]=s,e[4]=i,e[5]=d):d=e[5],d}function Ac(t){const e=B.c(13),{input:s,control:i,name:n}=t;switch(s.type){case"text":{let o;return e[0]!==i||e[1]!==s.default||e[2]!==n?(o=r.jsx(vx,{control:i,name:n,placeholder:s.default}),e[0]=i,e[1]=s.default,e[2]=n,e[3]=o):o=e[3],o}case"choice":{let o;e[4]!==s.options?(o=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=o):o=e[5];const a=o;let l;return e[6]!==i||e[7]!==n||e[8]!==a?(l=r.jsx(bx,{control:i,name:n,options:a}),e[6]=i,e[7]=n,e[8]=a,e[9]=l):l=e[9],l}case"confirm":{let o;return e[10]!==i||e[11]!==n?(o=r.jsx(yx,{control:i,name:n}),e[10]=i,e[11]=n,e[12]=o):o=e[12],o}default:return null}}function Sx({parts:t,onSubmit:e}){const[s,i]=S.useState(t[0]?.toolCallId??""),n=xx(t.map(x=>({toolCallId:x.toolCallId,input:x.input}))),o=Hi({resolver:Or(n),defaultValues:Object.fromEntries(t.map(x=>[x.toolCallId,{response:""}]))}),a=o.watch(),l=t.findIndex(x=>x.toolCallId===s),c=!!a[s]?.response,d=t.every(x=>!!a[x.toolCallId]?.response),u=x=>{for(const b of t){const y=x[b.toolCallId]?.response;y&&e(b,y)}},h=x=>t.find(b=>!x[b.toolCallId]?.response&&b.toolCallId!==s)??null,f=()=>{const x=o.getValues();if(t.every(y=>!!x[y.toolCallId]?.response))o.handleSubmit(u)();else{const y=h(x);y&&i(y.toolCallId)}},m=()=>{o.setValue(`${s}.response`,"user has skip this question"),f()},p=()=>{if(l>0){const x=t[l-1];x&&i(x.toolCallId)}},g=()=>{if(l<t.length-1){const x=t[l+1];x&&i(x.toolCallId)}},_=r.jsxs(r.Fragment,{children:[r.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:m,className:"h-7",children:"Skip"}),r.jsx(re,{type:"button",size:"sm",disabled:!c,onClick:f,className:Y("h-7",c?"":"opacity-50"),children:d?"Submit":"Next"})]}),v=r.jsx(Cu,{current:l,total:t.length,onPrev:p,onNext:g});if(t.length===1){const x=t[0];return x?.input?r.jsx(Pi,{...o,children:r.jsx("form",{onSubmit:o.handleSubmit(u),autoComplete:"off",children:r.jsx(On,{title:x.input?.prompt??"Question",footerRight:_,children:r.jsx(Ac,{input:x.input,control:o.control,name:`${x.toolCallId}.response`})})})}):null}return r.jsx(Pi,{...o,children:r.jsx("form",{onSubmit:o.handleSubmit(u),autoComplete:"off",children:r.jsx(Th,{value:s,onValueChange:i,children:t.map(x=>r.jsx(yn,{value:x.toolCallId,className:"mt-0",children:r.jsx(On,{title:x.input?.prompt??"Question",footerLeft:v,footerRight:_,children:r.jsx(Ac,{input:x.input,control:o.control,name:`${x.toolCallId}.response`})})},x.toolCallId))})})})}function wx(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[r.jsx(Mg,{className:"size-5 text-muted-foreground shimmer"}),r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function ku(t){const e=B.c(6),{userAskParts:s,isStreaming:i,onSubmit:n}=t;let o;e[0]!==s?(o=s.filter(Vx),e[0]=s,e[1]=o):o=e[1];const a=o;if(i){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(wx,{}),e[2]=c):c=e[2],c}if(a.length===0)return null;let l;return e[3]!==n||e[4]!==a?(l=r.jsx(Sx,{parts:a,onSubmit:n}),e[3]=n,e[4]=a,e[5]=l):l=e[5],l}function Vx(t){return t.state==="input-available"}const Ec=new Map;function co(){const{org:t}=ve(),e=Me({connectionId:Ht,orgId:t.id}),s=bl(),i=s.find(_=>_.providerId==="deco"),{data:n,isLoading:o,refetch:a,isFetching:l}=Fi({queryKey:lt.aiProviderCredits(t.id,"deco"),enabled:!!i,staleTime:6e4,queryFn:async()=>{const _=await e.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return _?.isError?null:_.structuredContent??null}}),c=n?.balanceCents??null,d=c!=null?c/100:null,u=S.useRef(new Map);if(c!=null){const _=Ec.get(t.id);u.current.get(t.id)&&_!=null&&c>_&&ye("credits_topped_up_detected",{organization_id:t.id}),Ec.set(t.id,c),u.current.set(t.id,!0)}const h=!!i,f=c!=null&&c>0,m=c!=null&&c===0,p=c!=null&&c===200,g=s.length>0&&s.every(_=>_.providerId==="deco");return{hasDecoKey:h,decoKeyId:i?.id??null,balanceCents:c,balanceDollars:d,hasCredits:f,isZeroBalance:m,isInitialFreeCredit:p,hasOnlyDecoProvider:g,isLoading:o,isFetching:l,refetch:a}}function Cx(t){return t?t.message.startsWith("[CREDITS]"):!1}const jx={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},kx=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function Nu(t){const e=B.c(43),{onDismiss:s}=t,{org:i}=ve(),n=Ke(),{decoKeyId:o}=co();let a;e[0]!==i.id?(a={connectionId:Ht,orgId:i.id},e[0]=i.id,e[1]=a):a=e[1];const l=Me(a),[c,d]=S.useState(""),[u,h]=S.useState(!1),[f,m]=S.useState("usd"),p=f==="brl"?"R$":"$";let g,_;e[2]!==i.id?(g=()=>{ye("credits_exhausted_shown",{organization_id:i.id})},_=[i.id],e[2]=i.id,e[3]=g,e[4]=_):(g=e[3],_=e[4]),S.useEffect(g,_);let v;e[5]!==l||e[6]!==f?(v=async D=>{const P=await l.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:D,currency:f}});if(P?.isError)throw new Error(P.content?.[0]?.text??"Failed to get top-up URL");return P.structuredContent?.url},e[5]=l,e[6]=f,e[7]=v):v=e[7];let x;e[8]!==s?(x=D=>{D&&window.open(D,"_blank","noopener,noreferrer"),s?.()},e[8]=s,e[9]=x):x=e[9];let b;e[10]!==v||e[11]!==x?(b={mutationFn:v,onSuccess:x,onError:Ex},e[10]=v,e[11]=x,e[12]=b):b=e[12];const{mutate:y,isPending:C}=Br(b),j=parseFloat(c),w=!isNaN(j)&&j>=1;let V;e[13]!==s?(V=D=>!D&&s?.(),e[13]=s,e[14]=V):V=e[14];let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[15]=k):k=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:k.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[16]=T):T=e[16];let I;e[17]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[T,r.jsxs(Ds,{className:"relative gap-4",children:[r.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),r.jsxs("div",{children:[r.jsx(Ts,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),r.jsx(dl,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[17]=I):I=e[17];let A;e[18]!==f||e[19]!==p||e[20]!==c||e[21]!==j||e[22]!==o||e[23]!==w||e[24]!==C||e[25]!==u||e[26]!==y?(A=o&&r.jsxs("div",{className:"px-8 pt-5 pb-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(Qh,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:D=>{D&&m(D)},children:[r.jsx(Ln,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Ln,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsxs("div",{className:"rounded-xl border border-border p-5",children:[r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:jx[f].map(D=>{const{dollars:P,label:$}=D;return r.jsxs("button",{type:"button",disabled:C,onClick:()=>{y(P*100)},className:Y("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,P]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:$})]},P)})}),u?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(bt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:D=>d(D.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(re,{className:"h-10",disabled:!w||C,onClick:()=>{y(Math.round(j*100))},children:C?"Opening...":"Add"})]}):r.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>h(!0),children:"Enter custom amount"})]}),r.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:kx.map(Nx)})]}),e[18]=f,e[19]=p,e[20]=c,e[21]=j,e[22]=o,e[23]=w,e[24]=C,e[25]=u,e[26]=y,e[27]=A):A=e[27];let N;e[28]!==s?(N=r.jsx(re,{variant:"ghost",size:"sm",onClick:s,children:"Dismiss"}),e[28]=s,e[29]=N):N=e[29];let E;e[30]!==n||e[31]!==s||e[32]!==i.slug?(E=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{n({to:"/$org/settings/ai-providers",params:{org:i.slug}}),s?.()},children:"Manage providers"}),e[30]=n,e[31]=s,e[32]=i.slug,e[33]=E):E=e[33];let R;e[34]!==N||e[35]!==E?(R=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[N,E]}),e[34]=N,e[35]=E,e[36]=R):R=e[36];let M;e[37]!==A||e[38]!==R?(M=r.jsxs(ms,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Ax,children:[I,A,R]}),e[37]=A,e[38]=R,e[39]=M):M=e[39];let L;return e[40]!==M||e[41]!==V?(L=r.jsx(ps,{open:!0,onOpenChange:V,children:M}),e[40]=M,e[41]=V,e[42]=L):L=e[42],L}function Nx(t){return r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:r.jsx(Jt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),r.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Ax(t){return t.preventDefault()}function Ex(t){me.error(`Top-up failed: ${t.message}`)}const Ix={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function $n(t){const e=B.c(32),{variant:s,onDismiss:i}=t,n=s==="error",o=n?"Error occurred":"Response incomplete",a=n?t.error.message:Ix[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,l=n?"border-destructive/30 bg-destructive/5":"border-amber-500/30 bg-amber-500/5",c=n?"text-destructive":"text-amber-600 dark:text-amber-500",d=n?ri:yh;let u;e[0]!==l?(u=Y("flex items-start gap-2 px-3 py-2.5 rounded-lg border border-dashed text-sm w-full mb-2 shadow",l),e[0]=l,e[1]=u):u=e[1];let h;e[2]!==c?(h=Y("mt-0.5 shrink-0",c),e[2]=c,e[3]=h):h=e[3];let f;e[4]!==d?(f=r.jsx(d,{size:16}),e[4]=d,e[5]=f):f=e[5];let m;e[6]!==h||e[7]!==f?(m=r.jsx("div",{className:h,children:f}),e[6]=h,e[7]=f,e[8]=m):m=e[8];let p;e[9]!==c?(p=Y("text-xs mb-1 font-medium",c),e[9]=c,e[10]=p):p=e[10];let g;e[11]!==p||e[12]!==o?(g=r.jsx("div",{className:p,children:o}),e[11]=p,e[12]=o,e[13]=g):g=e[13];let _;e[14]!==a?(_=r.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground mb-2",children:a}),e[14]=a,e[15]=_):_=e[15];let v;e[16]!==n||e[17]!==t.onContinue||e[18]!==t.onFixInChat?(v=r.jsx("div",{className:"flex gap-2",children:n?r.jsxs(r.Fragment,{children:[r.jsx(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}),r.jsx(re,{size:"sm",variant:"outline",disabled:!0,className:"h-7 text-xs",children:"Report"})]}):r.jsx(re,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"})}),e[16]=n,e[17]=t.onContinue,e[18]=t.onFixInChat,e[19]=v):v=e[19];let x;e[20]!==g||e[21]!==_||e[22]!==v?(x=r.jsxs("div",{className:"flex-1 min-w-0",children:[g,_,v]}),e[20]=g,e[21]=_,e[22]=v,e[23]=x):x=e[23];let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(fi,{size:14}),e[24]=b):b=e[24];let y;e[25]!==i?(y=r.jsx("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Dismiss",children:b}),e[25]=i,e[26]=y):y=e[26];let C;return e[27]!==u||e[28]!==y||e[29]!==m||e[30]!==x?(C=r.jsx("div",{className:"px-0.5",children:r.jsxs("div",{className:u,children:[m,x,y]})}),e[27]=u,e[28]=y,e[29]=m,e[30]=x,e[31]=C):C=e[31],C}function ho(){const t=B.c(41),{error:e,clearError:s,finishReason:i,clearFinishReason:n,messages:o,isStreaming:a,isWaitingForApprovals:l,addToolOutput:c,addToolApprovalResponse:d,sendMessage:u}=Ui(),[h,f]=Wi(),{virtualMcpId:m,createTaskWithMessage:p}=es();let g,_,v,x;if(t[0]!==o){const R=o.at(-1);x=R?.role==="assistant"?R.parts.filter(Dx):null,g=x?.filter(Tx)?.length,_=R?.role==="assistant"?mx(R.parts):[],v=R?.role==="assistant"?dx(R.parts):[],t[0]=o,t[1]=g,t[2]=_,t[3]=v,t[4]=x}else g=t[1],_=t[2],v=t[3],x=t[4];const b=v;let y;t[5]!==e||t[6]!==u?(y=()=>{if(e){const M={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};u(M)}},t[5]=e,t[6]=u,t[7]=y):y=t[7];const C=y;let j;t[8]!==u?(j=()=>{u({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[8]=u,t[9]=j):j=t[9];const w=j;let V;t[10]!==c?(V=(R,M)=>{c({tool:"user_ask",toolCallId:R.toolCallId,output:{response:M}})},t[10]=c,t[11]=V):V=t[11];const k=V;let T;t[12]!==p||t[13]!==h||t[14]!==f||t[15]!==m?(T=R=>{f({...h,toolApprovalLevel:"auto"}),p({virtualMcpId:m,message:{parts:[{type:"text",text:`Implement this plan:
|
|
3
3
|
|
|
4
4
|
${R}`}]}})},t[12]=p,t[13]=h,t[14]=f,t[15]=m,t[16]=T):T=t[16];const I=T,A=Rx;let N;t[17]!==d?(N=(R,M,L)=>{d({id:R,approved:M,...L?{reason:L}:{}})},t[17]=d,t[18]=N):N=t[18];const E=N;if(g){let R;return t[19]!==k||t[20]!==a||t[21]!==x?(R=r.jsx("div",{className:"absolute bottom-full left-0 right-0",children:r.jsx(ku,{userAskParts:x,isStreaming:a,onSubmit:k})}),t[19]=k,t[20]=a,t[21]=x,t[22]=R):R=t[22],R}if(_.length>0){let R;return t[23]!==I||t[24]!==a||t[25]!==_?(R=r.jsx("div",{className:"absolute bottom-full left-0 right-0",children:r.jsx(fx,{plans:_,isStreaming:a,onApprove:I,onDismiss:A})}),t[23]=I,t[24]=a,t[25]=_,t[26]=R):R=t[26],R}if(b.length>0||a&&l){let R;return t[27]!==E||t[28]!==a||t[29]!==b?(R=r.jsx("div",{className:"absolute bottom-full left-0 right-0",children:r.jsx(cx,{approvals:b,isStreaming:a,onRespond:E})}),t[27]=E,t[28]=a,t[29]=b,t[30]=R):R=t[30],R}if(!a&&e){if(Cx(e)){let M;return t[31]!==s?(M=r.jsx(Nu,{onDismiss:s}),t[31]=s,t[32]=M):M=t[32],M}let R;return t[33]!==s||t[34]!==e||t[35]!==C?(R=r.jsx("div",{className:"absolute bottom-full left-0 right-0 bg-background",children:r.jsx($n,{variant:"error",error:e,onDismiss:s,onFixInChat:C})}),t[33]=s,t[34]=e,t[35]=C,t[36]=R):R=t[36],R}if(!a&&i&&i!=="stop"&&!l){let R;return t[37]!==n||t[38]!==i||t[39]!==w?(R=r.jsx("div",{className:"absolute bottom-full left-0 right-0 bg-background",children:r.jsx($n,{variant:"warning",finishReason:i,onDismiss:n,onContinue:w})}),t[37]=n,t[38]=i,t[39]=w,t[40]=R):R=t[40],R}return null}function Rx(){document.querySelector("[data-chat-input]")?.focus()}function Tx(t){return t.state!=="output-available"}function Dx(t){return t.type==="tool-user_ask"}ho.Error=function(e){return r.jsx($n,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};ho.Warning=function(e){return r.jsx($n,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};ho.UserAskQuestion=ku;async function Tl(t,e,s,i){if(!no(e)){me.error("Selected model does not support file uploads");return}const n=10*1024*1024;if(s.size>n){me.error(`File "${s.name}" exceeds 10MB limit`);return}try{const o=new FileReader,a=new Promise((d,u)=>{o.onload=()=>{const h=o.result;if(typeof h!="string"){u(new Error("Failed to read file as data URL"));return}const f=h.includes(",")?h.split(",")[1]??h:h;d(f)},o.onerror=u});o.readAsDataURL(s);const l=await a,c={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:l};Mp(t,{from:i,to:i},c)}catch(o){console.error("Failed to process file:",o),me.error(`Failed to load file "${s.name}"`)}}function Mx(t){const e=B.c(7),{editor:s,selectedModel:i}=t,n=S.useRef(Lx);let o,a;e[0]!==s||e[1]!==i?(o=()=>{n.current=async(d,u)=>{await Tl(s,i,d,u)}},a=[s,i],e[0]=s,e[1]=i,e[2]=o,e[3]=a):(o=e[2],a=e[3]),S.useEffect(o,a);let l,c;return e[4]!==s?(l=()=>{if(s?.isDestroyed)return;const d=new na("fileDropHandler");s.state.plugins.find(f=>f.spec.key===d)&&s.unregisterPlugin(d);const h=new Qp({key:d,props:{handleDrop:(f,m,p,g)=>{if(g)return!1;const _=m.dataTransfer?.files;if(!_||_.length===0)return!1;m.preventDefault();const v=f.posAtCoords({left:m.clientX,top:m.clientY});if(!v)return!1;const x=Array.from(_),b=v.pos;for(const y of x)n.current?.(y,b);return!0},handlePaste:(f,m)=>{const p=m.clipboardData?.items;if(!p)return!1;const g=Array.from(p).filter(Px);if(g.length===0)return!1;m.preventDefault();const{from:_}=f.state.selection;for(const v of g){const x=v.getAsFile();x&&n.current?.(x,_)}return!0}}});return s.registerPlugin(h),()=>{s?.isDestroyed||s.unregisterPlugin(d)}},c=[s],e[4]=s,e[5]=l,e[6]=c):(l=e[5],c=e[6]),S.useEffect(l,c),null}function Px(t){return t.kind==="file"}function Lx(){return Promise.resolve()}function Bx(t){const e=B.c(20),{selectedModel:s,isStreaming:i,icon:n}=t,{editor:o}=to(),a=S.useRef(null);let l;e[0]!==s?(l=no(s),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]!==o||e[3]!==s?(d=async b=>{const y=b.target.files;if(!y||y.length===0||!o)return;const C=Array.from(y),{from:j}=o.state.selection,w=j;for(const V of C)await Tl(o,s,V,w);a.current&&(a.current.value="")},e[2]=o,e[3]=s,e[4]=d):d=e[4];const u=d;if(!o||!c)return null;let h;e[5]!==u||e[6]!==i?(h=r.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:u,disabled:i}),e[5]=u,e[6]=i,e[7]=h):h=e[7];const f=i||!c;let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a.current?.click(),e[8]=m):m=e[8];let p;e[9]!==n?(p=n??r.jsx(ug,{size:16}),e[9]=n,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=r.jsx(tt,{asChild:!0,children:r.jsx(re,{type:"button",variant:"ghost",size:"icon",className:"text-muted-foreground/75",disabled:f,onClick:m,children:p})}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(st,{side:"top",children:"Add file"}),e[14]=_):_=e[14];let v;e[15]!==g?(v=r.jsxs(it,{children:[g,_]}),e[15]=g,e[16]=v):v=e[16];let x;return e[17]!==h||e[18]!==v?(x=r.jsxs(r.Fragment,{children:[h,v]}),e[17]=h,e[18]=v,e[19]=x):x=e[19],x}var Ox=Zp;var $x=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ua=$x.join(","),Au=typeof Element>"u",Nr=Au?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,zn=!Au&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Fn=function(e,s){var i;s===void 0&&(s=!0);var n=e==null||(i=e.getAttribute)===null||i===void 0?void 0:i.call(e,"inert"),o=n===""||n==="true",a=o||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Fn(e.parentNode));return a},zx=function(e){var s,i=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return i===""||i==="true"},Fx=function(e,s,i){if(Fn(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(ua));return s&&Nr.call(e,ua)&&n.unshift(e),n=n.filter(i),n},fa=function(e,s,i){for(var n=[],o=Array.from(e);o.length;){var a=o.shift();if(!Fn(a,!1))if(a.tagName==="SLOT"){var l=a.assignedElements(),c=l.length?l:a.children,d=fa(c,!0,i);i.flatten?n.push.apply(n,d):n.push({scopeParent:a,candidates:d})}else{var u=Nr.call(a,ua);u&&i.filter(a)&&(s||!e.includes(a))&&n.push(a);var h=a.shadowRoot||typeof i.getShadowRoot=="function"&&i.getShadowRoot(a),f=!Fn(h,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(a));if(h&&f){var m=fa(h===!0?a.children:h.children,!0,i);i.flatten?n.push.apply(n,m):n.push({scopeParent:a,candidates:m})}else o.unshift.apply(o,a.children)}}return n},Eu=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Iu=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||zx(e))&&!Eu(e)?0:e.tabIndex},Hx=function(e,s){var i=Iu(e);return i<0&&s&&!Eu(e)?0:i},Wx=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},Ru=function(e){return e.tagName==="INPUT"},Ux=function(e){return Ru(e)&&e.type==="hidden"},Kx=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(i){return i.tagName==="SUMMARY"});return s},qx=function(e,s){for(var i=0;i<e.length;i++)if(e[i].checked&&e[i].form===s)return e[i]},Gx=function(e){if(!e.name)return!0;var s=e.form||zn(e),i=function(l){return s.querySelectorAll('input[type="radio"][name="'+l+'"]')},n;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")n=i(window.CSS.escape(e.name));else try{n=i(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var o=qx(n,e.form);return!o||o===e},Yx=function(e){return Ru(e)&&e.type==="radio"},Xx=function(e){return Yx(e)&&!Gx(e)},Jx=function(e){var s,i=e&&zn(e),n=(s=i)===null||s===void 0?void 0:s.host,o=!1;if(i&&i!==e){var a,l,c;for(o=!!((a=n)!==null&&a!==void 0&&(l=a.ownerDocument)!==null&&l!==void 0&&l.contains(n)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!o&&n;){var d,u,h;i=zn(n),n=(d=i)===null||d===void 0?void 0:d.host,o=!!((u=n)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(n))}}return o},Ic=function(e){var s=e.getBoundingClientRect(),i=s.width,n=s.height;return i===0&&n===0},Qx=function(e,s){var i=s.displayCheck,n=s.getShadowRoot;if(i==="full-native"&&"checkVisibility"in e){var o=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}if(getComputedStyle(e).visibility==="hidden")return!0;var a=Nr.call(e,"details>summary:first-of-type"),l=a?e.parentElement:e;if(Nr.call(l,"details:not([open]) *"))return!0;if(!i||i==="full"||i==="full-native"||i==="legacy-full"){if(typeof n=="function"){for(var c=e;e;){var d=e.parentElement,u=zn(e);if(d&&!d.shadowRoot&&n(d)===!0)return Ic(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(Jx(e))return!e.getClientRects().length;if(i!=="legacy-full")return!0}else if(i==="non-zero-area")return Ic(e);return!1},Zx=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var i=0;i<s.children.length;i++){var n=s.children.item(i);if(n.tagName==="LEGEND")return Nr.call(s,"fieldset[disabled] *")?!0:!n.contains(e)}return!0}s=s.parentElement}return!1},e1=function(e,s){return!(s.disabled||Ux(s)||Qx(s,e)||Kx(s)||Zx(s))},Rc=function(e,s){return!(Xx(s)||Iu(s)<0||!e1(e,s))},t1=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},Tu=function(e){var s=[],i=[];return e.forEach(function(n,o){var a=!!n.scopeParent,l=a?n.scopeParent:n,c=Hx(l,a),d=a?Tu(n.candidates):l;c===0?a?s.push.apply(s,d):s.push(l):i.push({documentOrder:o,tabIndex:c,item:n,isScope:a,content:d})}),i.sort(Wx).reduce(function(n,o){return o.isScope?n.push.apply(n,o.content):n.push(o.content),n},[]).concat(s)},Du=function(e,s){s=s||{};var i;return s.getShadowRoot?i=fa([e],s.includeContainer,{filter:Rc.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:t1}):i=Fx(e,s.includeContainer,Rc.bind(null,s)),Tu(i)};function s1(){return/apple/i.test(navigator.vendor)}const Tc="data-floating-ui-focusable";function i1(t){let e=t.activeElement;for(;((s=e)==null||(s=s.shadowRoot)==null?void 0:s.activeElement)!=null;){var s;e=e.shadowRoot.activeElement}return e}function ma(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&zm(s)){let i=e;for(;i;){if(t===i)return!0;i=i.parentNode||i.host}}return!1}function er(t){return"composedPath"in t?t.composedPath()[0]:t.target}function No(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const s=t;return s.target!=null&&e.contains(s.target)}function r1(t){return t.matches("html,body")}function Ar(t){return t?.ownerDocument||document}function n1(t){return t?t.hasAttribute(Tc)?t:t.querySelector("["+Tc+"]")||t:null}function jn(t,e,s){return s===void 0&&(s=!0),t.filter(n=>{var o;return n.parentId===e&&(!s||((o=n.context)==null?void 0:o.open))}).flatMap(n=>[n,...jn(t,n.id,s)])}function o1(t){return"nativeEvent"in t}var a1=typeof document<"u",l1=function(){},pi=a1?S.useLayoutEffect:l1;const c1={...Sh},d1=c1.useInsertionEffect,h1=d1||(t=>t());function Ei(t){const e=S.useRef(()=>{});return h1(()=>{e.current=t}),S.useCallback(function(){for(var s=arguments.length,i=new Array(s),n=0;n<s;n++)i[n]=arguments[n];return e.current==null?void 0:e.current(...i)},[])}const Mu=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Pu(t,e){const s=Du(t,Mu()),i=s.length;if(i===0)return;const n=i1(Ar(t)),o=s.indexOf(n),a=o===-1?e===1?0:i-1:o+e;return s[a]}function u1(t){return Pu(Ar(t).body,1)||t}function f1(t){return Pu(Ar(t).body,-1)||t}function Ao(t,e){const s=e||t.currentTarget,i=t.relatedTarget;return!i||!ma(s,i)}function m1(t){Du(t,Mu()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function Dc(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const i=s.dataset.tabindex;delete s.dataset.tabindex,i?s.setAttribute("tabindex",i):s.removeAttribute("tabindex")})}const p1="data-floating-ui-focusable",Mc="active",Pc="selected",g1={...Sh};let Lc=!1,_1=0;const Bc=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_1++;function x1(){const[t,e]=S.useState(()=>Lc?Bc():void 0);return pi(()=>{t==null&&e(Bc())},[]),S.useEffect(()=>{Lc=!0},[]),t}const v1=g1.useId,Dl=v1||x1;function b1(){const t=new Map;return{emit(e,s){var i;(i=t.get(e))==null||i.forEach(n=>n(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var i;(i=t.get(e))==null||i.delete(s)}}}const y1=S.createContext(null),S1=S.createContext(null),Lu=()=>{var t;return((t=S.useContext(y1))==null?void 0:t.id)||null},Bu=()=>S.useContext(S1);function Ml(t){return"data-floating-ui-"+t}const w1={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Oc=S.forwardRef(function(e,s){const[i,n]=S.useState();pi(()=>{s1()&&n("button")},[]);const o={ref:s,tabIndex:0,role:i,"aria-hidden":i?void 0:!0,[Ml("focus-guard")]:"",style:w1};return r.jsx("span",{...e,...o})}),V1={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ou=S.createContext(null),$c=Ml("portal");function C1(t){t===void 0&&(t={});const{id:e,root:s}=t,i=Dl(),n=k1(),[o,a]=S.useState(null),l=S.useRef(null);return pi(()=>()=>{o?.remove(),queueMicrotask(()=>{l.current=null})},[o]),pi(()=>{if(!i||l.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=i,d.setAttribute($c,""),c.appendChild(d),l.current=d,a(d)},[e,i]),pi(()=>{if(s===null||!i||l.current)return;let c=s||n?.portalNode;c&&!qm(c)&&(c=c.current),c=c||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,c.appendChild(d));const u=document.createElement("div");u.id=i,u.setAttribute($c,""),c=d||c,c.appendChild(u),l.current=u,a(u)},[e,s,i,n]),o}function j1(t){const{children:e,id:s,root:i,preserveTabOrder:n=!0}=t,o=C1({id:s,root:i}),[a,l]=S.useState(null),c=S.useRef(null),d=S.useRef(null),u=S.useRef(null),h=S.useRef(null),f=a?.modal,m=a?.open,p=!!a&&!a.modal&&a.open&&n&&!!(i||o);return S.useEffect(()=>{if(!o||!n||f)return;function g(_){o&&Ao(_)&&(_.type==="focusin"?Dc:m1)(o)}return o.addEventListener("focusin",g,!0),o.addEventListener("focusout",g,!0),()=>{o.removeEventListener("focusin",g,!0),o.removeEventListener("focusout",g,!0)}},[o,n,f]),S.useEffect(()=>{o&&(m||Dc(o))},[m,o]),r.jsxs(Ou.Provider,{value:S.useMemo(()=>({preserveTabOrder:n,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:o,setFocusManagerState:l}),[n,o]),children:[p&&o&&r.jsx(Oc,{"data-type":"outside",ref:c,onFocus:g=>{if(Ao(g,o)){var _;(_=u.current)==null||_.focus()}else{const v=a?a.domReference:null,x=f1(v);x?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:V1}),o&&ds.createPortal(e,o),p&&o&&r.jsx(Oc,{"data-type":"outside",ref:d,onFocus:g=>{if(Ao(g,o)){var _;(_=h.current)==null||_.focus()}else{const v=a?a.domReference:null,x=u1(v);x?.focus(),a?.closeOnFocusOut&&a?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const k1=()=>S.useContext(Ou),N1={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},A1={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},zc=t=>{var e,s;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(s=t?.outsidePress)!=null?s:!0}};function E1(t,e){e===void 0&&(e={});const{open:s,onOpenChange:i,elements:n,dataRef:o}=t,{enabled:a=!0,escapeKey:l=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=Bu(),_=Ei(typeof c=="function"?c:()=>!1),v=typeof c=="function"?_:c,x=S.useRef(!1),{escapeKey:b,outsidePress:y}=zc(m),{escapeKey:C,outsidePress:j}=zc(p),w=S.useRef(!1),V=Ei(E=>{var R;if(!s||!a||!l||E.key!=="Escape"||w.current)return;const M=(R=o.current.floatingContext)==null?void 0:R.nodeId,L=g?jn(g.nodesRef.current,M):[];if(!b&&(E.stopPropagation(),L.length>0)){let D=!0;if(L.forEach(P=>{var $;if(($=P.context)!=null&&$.open&&!P.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}i(!1,o1(E)?E.nativeEvent:E,"escape-key")}),k=Ei(E=>{var R;const M=()=>{var L;V(E),(L=er(E))==null||L.removeEventListener("keydown",M)};(R=er(E))==null||R.addEventListener("keydown",M)}),T=Ei(E=>{var R;const M=o.current.insideReactTree;o.current.insideReactTree=!1;const L=x.current;if(x.current=!1,d==="click"&&L||M||typeof v=="function"&&!v(E))return;const D=er(E),P="["+Ml("inert")+"]",$=Ar(n.floating).querySelectorAll(P);let z=ys(D)?D:null;for(;z&&!wo(z);){const G=Wm(z);if(wo(G)||!ys(G))break;z=G}if($.length&&ys(D)&&!r1(D)&&!ma(D,n.floating)&&Array.from($).every(G=>!ma(z,G)))return;if(Um(D)&&N){const G=wo(D),q=Km(D),H=/auto|scroll/,ee=G||H.test(q.overflowX),K=G||H.test(q.overflowY),U=ee&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,te=K&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,X=q.direction==="rtl",J=te&&(X?E.offsetX<=D.offsetWidth-D.clientWidth:E.offsetX>D.clientWidth),se=U&&E.offsetY>D.clientHeight;if(J||se)return}const O=(R=o.current.floatingContext)==null?void 0:R.nodeId,W=g&&jn(g.nodesRef.current,O).some(G=>{var q;return No(E,(q=G.context)==null?void 0:q.elements.floating)});if(No(E,n.floating)||No(E,n.domReference)||W)return;const F=g?jn(g.nodesRef.current,O):[];if(F.length>0){let G=!0;if(F.forEach(q=>{var H;if((H=q.context)!=null&&H.open&&!q.context.dataRef.current.__outsidePressBubbles){G=!1;return}}),!G)return}i(!1,E,"outside-press")}),I=Ei(E=>{var R;const M=()=>{var L;T(E),(L=er(E))==null||L.removeEventListener(d,M)};(R=er(E))==null||R.addEventListener(d,M)});S.useEffect(()=>{if(!s||!a)return;o.current.__escapeKeyBubbles=b,o.current.__outsidePressBubbles=y;let E=-1;function R($){i(!1,$,"ancestor-scroll")}function M(){window.clearTimeout(E),w.current=!0}function L(){E=window.setTimeout(()=>{w.current=!1},Hm()?5:0)}const D=Ar(n.floating);l&&(D.addEventListener("keydown",C?k:V,C),D.addEventListener("compositionstart",M),D.addEventListener("compositionend",L)),v&&D.addEventListener(d,j?I:T,j);let P=[];return f&&(ys(n.domReference)&&(P=So(n.domReference)),ys(n.floating)&&(P=P.concat(So(n.floating))),!ys(n.reference)&&n.reference&&n.reference.contextElement&&(P=P.concat(So(n.reference.contextElement)))),P=P.filter($=>{var z;return $!==((z=D.defaultView)==null?void 0:z.visualViewport)}),P.forEach($=>{$.addEventListener("scroll",R,{passive:!0})}),()=>{l&&(D.removeEventListener("keydown",C?k:V,C),D.removeEventListener("compositionstart",M),D.removeEventListener("compositionend",L)),v&&D.removeEventListener(d,j?I:T,j),P.forEach($=>{$.removeEventListener("scroll",R)}),window.clearTimeout(E)}},[o,n,l,v,d,s,i,f,a,b,y,V,C,k,T,j,I]),S.useEffect(()=>{o.current.insideReactTree=!1},[o,v,d]);const A=S.useMemo(()=>({onKeyDown:V,...u&&{[N1[h]]:E=>{i(!1,E.nativeEvent,"reference-press")},...h!=="click"&&{onClick(E){i(!1,E.nativeEvent,"reference-press")}}}}),[V,i,u,h]),N=S.useMemo(()=>{function E(R){R.button===0&&(x.current=!0)}return{onKeyDown:V,onMouseDown:E,onMouseUp:E,[A1[d]]:()=>{o.current.insideReactTree=!0}}},[V,d,o]);return S.useMemo(()=>a?{reference:A,floating:N}:{},[a,A,N])}function I1(t){const{open:e=!1,onOpenChange:s,elements:i}=t,n=Dl(),o=S.useRef({}),[a]=S.useState(()=>b1()),l=Lu()!=null,[c,d]=S.useState(i.reference),u=Ei((m,p,g)=>{o.current.openEvent=m?p:void 0,a.emit("openchange",{open:m,event:p,reason:g,nested:l}),s?.(m,p,g)}),h=S.useMemo(()=>({setPositionReference:d}),[]),f=S.useMemo(()=>({reference:c||i.reference||null,floating:i.floating||null,domReference:i.reference}),[c,i.reference,i.floating]);return S.useMemo(()=>({dataRef:o,open:e,onOpenChange:u,elements:f,events:a,floatingId:n,refs:h}),[e,u,f,a,n,h])}function R1(t){t===void 0&&(t={});const{nodeId:e}=t,s=I1({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||s,n=i.elements,[o,a]=S.useState(null),[l,c]=S.useState(null),u=n?.domReference||o,h=S.useRef(null),f=Bu();pi(()=>{u&&(h.current=u)},[u]);const m=Fm({...t,elements:{...n,...l&&{reference:l}}}),p=S.useCallback(b=>{const y=ys(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;c(y),m.refs.setReference(y)},[m.refs]),g=S.useCallback(b=>{(ys(b)||b===null)&&(h.current=b,a(b)),(ys(m.refs.reference.current)||m.refs.reference.current===null||b!==null&&!ys(b))&&m.refs.setReference(b)},[m.refs]),_=S.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),v=S.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),x=S.useMemo(()=>({...m,...i,refs:_,elements:v,nodeId:e}),[m,_,v,e,i]);return pi(()=>{i.dataRef.current.floatingContext=x;const b=f?.nodesRef.current.find(y=>y.id===e);b&&(b.context=x)}),S.useMemo(()=>({...m,context:x,refs:_,elements:v}),[m,_,v,x])}function Eo(t,e,s){const i=new Map,n=s==="item";let o=t;if(n&&t){const{[Mc]:a,[Pc]:l,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[p1]:""},...o,...e.map(a=>{const l=a?a[s]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((a,l)=>(l&&Object.entries(l).forEach(c=>{let[d,u]=c;if(!(n&&[Mc,Pc].includes(d)))if(d.indexOf("on")===0){if(i.has(d)||i.set(d,[]),typeof u=="function"){var h;(h=i.get(d))==null||h.push(u),a[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=i.get(d))==null?void 0:f.map(_=>_(...p)).find(_=>_!==void 0)}}}else a[d]=u}),a),{})}}function T1(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),s=t.map(l=>l?.floating),i=t.map(l=>l?.item),n=S.useCallback(l=>Eo(l,t,"reference"),e),o=S.useCallback(l=>Eo(l,t,"floating"),s),a=S.useCallback(l=>Eo(l,t,"item"),i);return S.useMemo(()=>({getReferenceProps:n,getFloatingProps:o,getItemProps:a}),[n,o,a])}const D1=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function M1(t,e){var s,i;e===void 0&&(e={});const{open:n,elements:o,floatingId:a}=t,{enabled:l=!0,role:c="dialog"}=e,d=Dl(),u=((s=o.domReference)==null?void 0:s.id)||d,h=S.useMemo(()=>{var x;return((x=n1(o.floating))==null?void 0:x.id)||a},[o.floating,a]),f=(i=D1.get(c))!=null?i:c,p=Lu()!=null,g=S.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:n?h:void 0}:{"aria-expanded":n?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":n?h:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[f,h,p,n,u,c]),_=S.useMemo(()=>{const x={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?x:{...x,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),v=S.useCallback(x=>{let{active:b,selected:y}=x;const C={role:"option",...b&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...C,"aria-selected":y}}return{}},[h,c]);return S.useMemo(()=>l?{reference:g,floating:_,item:v}:{},[l,g,_,v])}function P1(t){const e=B.c(26),{editor:s,query:i,items:n,onSelect:o,onClose:a}=t,[l,c]=S.useState(0),d=S.useRef(n),u=S.useRef(l),h=S.useRef(o),f=S.useRef(a),m=S.useDeferredValue(i);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{c(0)},e[0]=p):p=e[0];let g;e[1]!==m?(g=[m],e[1]=m,e[2]=g):g=e[2],S.useEffect(p,g);let _,v;e[3]!==n.length||e[4]!==l?(_=()=>{l>=n.length&&n.length>0&&c(0)},v=[n.length,l],e[3]=n.length,e[4]=l,e[5]=_,e[6]=v):(_=e[5],v=e[6]),S.useEffect(_,v);let x,b;e[7]!==n?(x=()=>{d.current=n},b=[n],e[7]=n,e[8]=x,e[9]=b):(x=e[8],b=e[9]),S.useEffect(x,b);let y,C;e[10]!==l?(y=()=>{u.current=l},C=[l],e[10]=l,e[11]=y,e[12]=C):(y=e[11],C=e[12]),S.useEffect(y,C);let j,w;e[13]!==o?(w=()=>{h.current=o},j=[o],e[13]=o,e[14]=j,e[15]=w):(j=e[14],w=e[15]),S.useEffect(w,j);let V,k;e[16]!==a?(V=()=>{f.current=a},k=[a],e[16]=a,e[17]=V,e[18]=k):(V=e[17],k=e[18]),S.useEffect(V,k);let T;e[19]!==s.isDestroyed||e[20]!==s.view.dom?(T=()=>{const E=s.view.dom;if(s?.isDestroyed||!E)return;const R=L=>{const D=d.current;if(!D.length)return!1;const P=()=>c(z=>(z+1)%D.length),$=()=>c(z=>(z-1+D.length)%D.length);switch(L.key){case"ArrowUp":return L.preventDefault(),$(),!0;case"ArrowDown":return L.preventDefault(),P(),!0;case"Tab":return L.preventDefault(),L.shiftKey?$():P(),!0;case"Home":return L.preventDefault(),c(0),!0;case"End":return L.preventDefault(),c(D.length-1),!0;case"Enter":{if(L.isComposing)return!1;L.preventDefault();const z=u.current;return z!==-1&&D[z]&&h.current?.(D[z],z),!0}case"Escape":return L.preventDefault(),f.current?.(),!0;default:return!1}},M=L=>{R(L)};return E.addEventListener("keydown",M,!0),()=>{E?.removeEventListener("keydown",M,!0)}},e[19]=s.isDestroyed,e[20]=s.view.dom,e[21]=T):T=e[21];let I;e[22]!==s?(I=[s],e[22]=s,e[23]=I):I=e[23],S.useEffect(T,I);const A=n.length?l:void 0;let N;return e[24]!==A?(N={selectedIndex:A,setSelectedIndex:c},e[24]=A,e[25]=N):N=e[25],N}function L1(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const $u=S.createContext(void 0);function zu(){const t=S.useContext($u);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function B1({editor:t,char:e,pluginKey:s,allow:i,onOpenChange:n}){const[o,a]=S.useReducer(L1,{open:!1,element:null,query:"",range:null,selectedItem:null}),l=S.useRef(n);return l.current=n,S.useEffect(()=>{if(t?.isDestroyed)return;const c=s instanceof na?s:new na(s);t.state.plugins.find(h=>h.spec.key===c)&&t.unregisterPlugin(c);const u=zg({pluginKey:c,editor:t,char:e,allow(h){const f=t.state.doc.resolve(h.range.from);for(let m=f.depth;m>0;m--)if(f.node(m).type.name==="image")return!1;return!(i&&!i(h))},command(){},render:()=>({onStart:h=>{a({type:"ON_START",payload:{element:h.decorationNode??null,query:h.query,range:h.range}}),l.current?.(!0)},onUpdate:h=>{a({type:"ON_UPDATE",payload:{element:h.decorationNode??null,query:h.query,range:h.range}})},onKeyDown:h=>h.event.key==="Escape"?(a({type:"ON_EXIT"}),!0):!1,onExit:()=>{a({type:"ON_EXIT"}),l.current?.(!1)}}),items:()=>[]});return t.registerPlugin(u),()=>{t?.isDestroyed||t.unregisterPlugin(c)}},[t,s,e,a,i]),{state:o,dispatch:a}}function O1({editor:t,queryKey:e,queryFn:s,onSelect:i}){const{state:n,dispatch:o}=zu(),a=S.useDeferredValue(n.query),{data:l}=wh({queryKey:lt.suggestionItems(e,n.open,a),queryFn:()=>n.open?s({query:a}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(h,f)=>{if(!(n.selectedItem!==null||!n.range)){o({type:"SET_SELECTED_ITEM",payload:h});try{const{view:m}=t,g=m.state.selection.$to.nodeAfter?.text?.startsWith(" "),_=n.range?{...n.range}:{from:0,to:0};g&&n.range&&(_.to+=1),await i({range:_,item:h})===!1?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:u}=P1({editor:t,query:a,items:l,onSelect:d,onClose:c});return{selectedItem:n.selectedItem,items:l,selectedIndex:u,close:c,onSelect:d}}function $1({children:t}){const{state:e,dispatch:s}=zu(),{open:i,element:n}=e,o=()=>{s({type:"ON_EXIT"})},{refs:a,floatingStyles:l,context:c}=R1({placement:"bottom-start",open:i,onOpenChange:f=>{f||o()},elements:{reference:n},middleware:[Gm(10),Ym(),Xm()],whileElementsMounted:Jm}),d=E1(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),u=M1(c,{role:"listbox"}),{getFloatingProps:h}=T1([d,u]);return i?r.jsx(j1,{children:r.jsx("div",{ref:a.setFloating,style:l,...h(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const z1=t=>{const e=B.c(29),{item:s,isSelected:i,onSelect:n,isLoading:o,ref:a}=t;let l;if(e[0]!==s){const j=si(s._meta);l=s.title||eo(s.name,j),e[0]=s,e[1]=l}else l=e[1];const c=l,d=s.description||null,u=s.icon,h=i&&"bg-accent text-accent-foreground",f=o&&"pointer-events-none opacity-50";let m;e[2]!==h||e[3]!==f?(m=Y("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",h,f),e[2]=h,e[3]=f,e[4]=m):m=e[4];let p;e[5]!==u||e[6]!==c?(p=u!==void 0&&r.jsx(zs,{icon:u,name:c,size:"xs",className:"mr-2"}),e[5]=u,e[6]=c,e[7]=p):p=e[7];let g;e[8]!==c?(g=r.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),e[8]=c,e[9]=g):g=e[9];let _;e[10]!==o?(_=o&&r.jsx(jr,{size:"xs"}),e[10]=o,e[11]=_):_=e[11];let v;e[12]!==g||e[13]!==_?(v=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,_]}),e[12]=g,e[13]=_,e[14]=v):v=e[14];let x;e[15]!==d?(x=d&&r.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=x):x=e[16];let b;e[17]!==v||e[18]!==x?(b=r.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[v,x]}),e[17]=v,e[18]=x,e[19]=b):b=e[19];let y;e[20]!==s.drillable?(y=s.drillable&&r.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=s.drillable,e[21]=y):y=e[21];let C;return e[22]!==n||e[23]!==a||e[24]!==b||e[25]!==y||e[26]!==m||e[27]!==p?(C=r.jsxs("div",{ref:a,onClick:n,className:m,children:[p,b,y]}),e[22]=n,e[23]=a,e[24]=b,e[25]=y,e[26]=m,e[27]=p,e[28]=C):C=e[28],C},F1=t=>{const e=B.c(18),{editor:s,queryKey:i,queryFn:n,onSelect:o}=t;let a;e[0]!==s||e[1]!==o||e[2]!==n||e[3]!==i?(a={editor:s,queryKey:i,queryFn:n,onSelect:o},e[0]=s,e[1]=o,e[2]=n,e[3]=i,e[4]=a):a=e[4];const{items:l,selectedIndex:c,onSelect:d,selectedItem:u}=O1(a);if(!l.length){let p;return e[5]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=p):p=e[5],p}let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[6]=h):h=e[6];let f;if(e[7]!==d||e[8]!==l||e[9]!==c||e[10]!==u?.name){let p;e[12]!==d||e[13]!==c||e[14]!==u?.name?(p=(g,_)=>r.jsx(z1,{item:g,isSelected:_===c,ref:_===c?U1:void 0,onSelect:()=>d(g,_),isLoading:u?.name===g.name},g.name),e[12]=d,e[13]=c,e[14]=u?.name,e[15]=p):p=e[15],f=l.map(p),e[7]=d,e[8]=l,e[9]=c,e[10]=u?.name,e[11]=f}else f=e[11];let m;return e[16]!==f?(m=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:h,children:r.jsx("div",{className:"p-1",children:f})}),e[16]=f,e[17]=m):m=e[17],m};function H1(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"p-1",children:[...Array(3)].map(W1)}),t[0]=e):e=t[0],e}function W1(t,e){return r.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[r.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),r.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Fu(t){const e=B.c(18),{editor:s,char:i,pluginKey:n,queryKey:o,queryFn:a,onSelect:l,allow:c,onOpenChange:d}=t;let u;e[0]!==c||e[1]!==i||e[2]!==s||e[3]!==d||e[4]!==n?(u={editor:s,char:i,pluginKey:n,allow:c,onOpenChange:d},e[0]=c,e[1]=i,e[2]=s,e[3]=d,e[4]=n,e[5]=u):u=e[5];const{state:h,dispatch:f}=B1(u);let m;e[6]!==f||e[7]!==h?(m={state:h,dispatch:f},e[6]=f,e[7]=h,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(H1,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==l||e[12]!==a||e[13]!==o?(g=r.jsx($1,{children:r.jsx(S.Suspense,{fallback:p,children:r.jsx(F1,{editor:s,queryKey:o,queryFn:a,onSelect:l})})}),e[10]=s,e[11]=l,e[12]=a,e[13]=o,e[14]=g):g=e[14];let _;return e[15]!==m||e[16]!==g?(_=r.jsx($u.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=_):_=e[17],_}function U1(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const K1=[{name:"agents",title:"Agents",description:"Mention an agent to hand off work",kind:"category",drillable:!0},{name:"resources",title:"Resources",description:"Attach a resource as context",kind:"category",drillable:!0}],q1=({editor:t,virtualMcpId:e})=>{const s=Mt(),{org:i}=ve(),n=oo(),o=Me({connectionId:e,orgId:i.id}),a=lt.virtualMcpResources(e,i.id),[l,c]=S.useState("categories"),d=S.useRef(l);d.current=l;const u=S.useRef(null),h=S.useRef(!1),f=["at-mention",i.id,e??"default",l],m=async({item:_,range:v})=>{if(ye("chat_picker_item_selected",{item_kind:_.kind,item_name:_.name}),_.kind!=="category"&&(h.current=!0),_.kind==="category")return c(_.name==="agents"?"agents":"resources"),!1;if(_.kind==="agent"&&_.agentId){Cr(t,v,{id:_.agentId,name:_.name,metadata:{agentId:_.agentId,title:_.name},char:"@"}),c("categories");return}if(_.kind==="resource"&&_.uri&&o){try{const x=await su(o,_.uri);Cr(t,v,{id:_.uri,name:_.uri,metadata:x.contents,char:"@"})}catch(x){console.error("[at-mention] Failed to fetch resource:",x),me.error("Failed to load resource. Please try again.")}c("categories");return}},p=async _=>{const{query:v}=_,x=d.current;if(x==="categories"){if(!v.trim())return K1;const C=v.toLowerCase(),j=n.filter(V=>V.status==="active"&&(!V.id||!Mn(V.id))&&V.id!==e&&(V.title.toLowerCase().includes(C)||V.description?.toLowerCase().includes(C))).map(V=>({name:V.title,title:V.title,description:V.description??void 0,icon:V.icon??null,kind:"agent",agentId:V.id})),w=await(async()=>{if(!o)return[];let V=s.getQueryData(a);return V||(V=await s.fetchQuery({queryKey:a,queryFn:()=>xr(o),staleTime:6e4})),(V?.resources??[]).filter(k=>k.uri.toLowerCase().includes(C)||k.name?.toLowerCase().includes(C)||k.description?.toLowerCase().includes(C)).map(k=>({name:k.name??k.uri,title:k.name,description:k.description,kind:"resource",uri:k.uri}))})();return[...j,...w]}if(x==="agents"){let C=n.filter(j=>j.status==="active"&&(!j.id||!Mn(j.id))&&j.id!==e);if(v.trim()){const j=v.toLowerCase();C=C.filter(w=>w.title.toLowerCase().includes(j)||w.description?.toLowerCase().includes(j))}return C.map(j=>({name:j.title,title:j.title,description:j.description??void 0,icon:j.icon??null,kind:"agent",agentId:j.id}))}if(!o)return[];let b=s.getQueryData(a);b?s.fetchQuery({queryKey:a,queryFn:()=>xr(o),staleTime:6e4}).catch(()=>{}):b=await s.fetchQuery({queryKey:a,queryFn:()=>xr(o),staleTime:6e4});let y=b?.resources??[];if(v.trim()){const C=v.toLowerCase();y=y.filter(j=>j.uri.toLowerCase().includes(C)||j.name?.toLowerCase().includes(C)||j.description?.toLowerCase().includes(C))}return y.map(C=>({name:C.name??C.uri,title:C.name,description:C.description,kind:"resource",uri:C.uri}))},g=_=>{_?(u.current=Date.now(),h.current=!1):(u.current,ye("chat_picker_closed",{outcome:h.current?"selected":"dismissed"}),u.current=null,c("categories"))};return r.jsx(Fu,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:f,queryFn:p,onSelect:m,onOpenChange:g})};function G1(t,e){const s=ts(t),i=Wr(),n=new Map(i.map(c=>[c.id,c])),o=(s?.connections??[]).map(c=>c.connection_id),{data:a}=Fi({queryKey:lt.promptConnectionMap(e,o),queryFn:async()=>{const c={};return await Promise.all(o.map(async d=>{try{const u=await ag({connectionId:d,orgId:e}),h=await Pn(u);for(const f of h.prompts)f.name in c||(c[f.name]=d)}catch{}})),c},staleTime:6e4,enabled:o.length>0}),l=new Map;for(const[c,d]of Object.entries(a??{})){const u=n.get(d);u&&l.set(c,u)}return l}async function Fc(t,e,s,i,n,o){try{const a=await ul(s,i,o);Cr(t,e,{id:i,name:al(i,n),metadata:a.messages,char:"/"})}catch(a){console.error("[slash] Failed to fetch prompt:",a),me.error("Failed to load prompt. Please try again.")}}async function Y1(t,e,s,i){try{const n=await su(s,i);Cr(t,e,{id:i,name:i,metadata:n.contents,char:"/"})}catch(n){console.error("[slash] Failed to fetch resource:",n),me.error("Failed to load resource. Please try again.")}}const X1=({editor:t,virtualMcpId:e})=>{const s=Mt(),{org:i}=ve(),n=Me({connectionId:e,orgId:i.id}),o=G1(e,i.id),a=S.useRef(o);a.current=o;const l=lt.virtualMcpPrompts(e,i.id),c=lt.virtualMcpResources(e,i.id),d=["slash-mention",i.id,e??"default"],[u,h]=S.useState(null),f=S.useRef(null),m=S.useRef(!1),p=async({item:x,range:b})=>{if(ye("chat_picker_item_selected",{item_kind:x.kind,item_name:x.name}),m.current=!0,!!n)if(x.kind==="prompt"){if(x.arguments&&x.arguments.length>0){h({range:b,item:x});return}const y=si(x._meta);await Fc(t,b,n,x.name,y)}else x.uri&&await Y1(t,b,n,x.uri)},g=async x=>{if(!u||!n)return;const{range:b,item:y}=u,C=si(y._meta);await Fc(t,b,n,y.name,C,x),h(null)},_=async x=>{const{query:b}=x;if(!n)return[];const[y,C]=await Promise.all([J1(s,l,n),Q1(s,c,n)]),j=b.trim().toLowerCase(),w=(y??[]).filter(k=>!j||k.name.toLowerCase().includes(j)||k.title?.toLowerCase().includes(j)||k.description?.toLowerCase().includes(j)).map(k=>({name:k.name,title:k.title,description:k.description,icon:a.current.get(k.name)?.icon??null,kind:"prompt",arguments:k.arguments,_meta:k._meta})),V=(C??[]).filter(k=>!j||k.uri.toLowerCase().includes(j)||k.name?.toLowerCase().includes(j)||k.description?.toLowerCase().includes(j)).map(k=>({name:k.name??k.uri,title:k.name,description:k.description,kind:"resource",uri:k.uri}));return[...w,...V]},v=u?.item.kind==="prompt"?{name:u.item.name,arguments:u.item.arguments,description:u.item.description}:null;return r.jsxs(r.Fragment,{children:[r.jsx(Fu,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:d,queryFn:_,onSelect:p,onOpenChange:x=>{x?(f.current=Date.now(),m.current=!1):(f.current,ye("chat_picker_closed",{outcome:m.current?"selected":"dismissed"}),f.current=null)}}),r.jsx(Rl,{prompt:v,setPrompt:()=>h(null),onSubmit:g})]})};async function J1(t,e,s){let i=t.getQueryData(e);return i?t.fetchQuery({queryKey:e,queryFn:()=>Pn(s),staleTime:6e4}).catch(()=>{}):i=await t.fetchQuery({queryKey:e,queryFn:()=>Pn(s),staleTime:6e4}),i?.prompts??[]}async function Q1(t,e,s){let i=t.getQueryData(e);return i?t.fetchQuery({queryKey:e,queryFn:()=>xr(s),staleTime:6e4}).catch(()=>{}):i=await t.fetchQuery({queryKey:e,queryFn:()=>xr(s),staleTime:6e4}),i?.resources??[]}function Z1(t){return[sg.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Ox.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),Pp,Lp]}function Hu({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:i=!1,placeholder:n,onSubmit:o,children:a}){const l=S.useRef(o),c=S.useRef(e),d=S.useRef(i),u=S.useRef(n),h=eg({extensions:Z1(u),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(f,m)=>m.key==="Enter"&&!m.shiftKey&&d.current?(m.preventDefault(),l.current?.(),!0):!1},onUpdate:({editor:f})=>{c.current(f?.getJSON())}});return S.useEffect(()=>{h?.setEditable(!s)},[h,s]),S.useEffect(()=>{l.current=o},[o]),S.useEffect(()=>{c.current=e},[e]),S.useEffect(()=>{d.current=i},[i]),S.useEffect(()=>{u.current=n},[n]),S.useEffect(()=>{if(h?.isDestroyed)return;const f=JSON.stringify(h?.getJSON()),m=JSON.stringify(t||{type:"doc",content:[]});f!==m&&h.commands.setContent(t||{type:"doc",content:[]})},[h,t]),r.jsx(tg.Provider,{value:{editor:h},children:a})}function Wu(t){const e=B.c(25),{disabled:s,virtualMcpId:i,showFileUploader:n,selectedModel:o,ref:a,className:l}=t,c=s===void 0?!1:s,d=n===void 0?!1:n,{editor:u}=to();let h,f;if(e[0]!==u?(h=()=>({focus:()=>{u?.commands.focus()},clear:()=>{u?.commands.clearContent(!0)},appendText:w=>{if(!u)return;const V=u.state.doc.textContent.trim()==="";u.commands.focus("end"),V||u.commands.insertContent(" "),u.commands.insertContent(w)},syncVoiceText:(w,V)=>{if(u&&(u.commands.setContent(w||{type:"doc",content:[]}),V)){u.commands.focus("end");const k=u.state.doc.textContent.trim().length>0;u.commands.insertContent(k?" "+V:V)}},restoreContent:w=>{u&&u.commands.setContent(w||{type:"doc",content:[]})}}),f=[u],e[0]=u,e[1]=h,e[2]=f):(h=e[1],f=e[2]),S.useImperativeHandle(a??null,h,f),!u)return null;const m=c&&"cursor-not-allowed opacity-70",p=c&&"[&_.ProseMirror]:cursor-not-allowed";let g;e[3]!==l||e[4]!==m||e[5]!==p?(g=Y("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",l,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",m,p),e[3]=l,e[4]=m,e[5]=p,e[6]=g):g=e[6];let _;e[7]!==u||e[8]!==g?(_=r.jsx(ig,{editor:u,className:g}),e[7]=u,e[8]=g,e[9]=_):_=e[9];const v=i??null;let x;e[10]!==u||e[11]!==v?(x=r.jsx(S.Suspense,{fallback:null,children:r.jsx(X1,{editor:u,virtualMcpId:v})}),e[10]=u,e[11]=v,e[12]=x):x=e[12];const b=i??null;let y;e[13]!==u||e[14]!==b?(y=r.jsx(S.Suspense,{fallback:null,children:r.jsx(q1,{editor:u,virtualMcpId:b})}),e[13]=u,e[14]=b,e[15]=y):y=e[15];let C;e[16]!==u||e[17]!==o||e[18]!==d?(C=d&&o?r.jsx(Mx,{editor:u,selectedModel:o}):null,e[16]=u,e[17]=o,e[18]=d,e[19]=C):C=e[19];let j;return e[20]!==x||e[21]!==y||e[22]!==C||e[23]!==_?(j=r.jsxs(r.Fragment,{children:[_,x,y,C]}),e[20]=x,e[21]=y,e[22]=C,e[23]=_,e[24]=j):j=e[24],j}function pa(t){const e=B.c(3),[s]=Wi();let i;return e[0]!==s.enableSounds||e[1]!==t?(i=()=>{s.enableSounds&&Xg(t.dataUri).catch(o=>{console.warn(`[sound] ${t.name} playback failed:`,o)})},e[0]=s.enableSounds,e[1]=t,e[2]=i):i=e[2],i}const ev={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},tv=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function sv(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1.5",children:tv.map(iv)}),t[0]=e):e=t[0],e}function iv(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function rv(t){const e=B.c(129),{disabled:s,onOpenConnections:i,virtualMcpId:n}=t,[o,a]=S.useState(!1),l=pa(ev),{org:c}=ve(),{editor:d}=to();let u;e[0]!==c.id||e[1]!==n?(u={connectionId:n,orgId:c.id},e[0]=c.id,e[1]=n,e[2]=u):u=e[2];const h=Me(u);let f;e[3]!==c.id||e[4]!==n?(f=lt.virtualMcpPrompts(n,c.id),e[3]=c.id,e[4]=n,e[5]=f):f=e[5];const m=f;let p;e[6]!==h?(p=()=>Pn(h),e[6]=h,e[7]=p):p=e[7];const g=o&&!!h;let _;e[8]!==m||e[9]!==p||e[10]!==g?(_={queryKey:m,queryFn:p,staleTime:6e4,enabled:g},e[8]=m,e[9]=p,e[10]=g,e[11]=_):_=e[11];const{data:v,isLoading:x}=Fi(_);let b;e[12]!==v?.prompts?(b=v?.prompts??[],e[12]=v?.prompts,e[13]=b):b=e[13];const y=b,[C,j]=S.useState(null),{credentialId:w,imageModel:V,setImageModel:k,deepResearchModel:T,setDeepResearchModel:I,chatMode:A,setChatMode:N,simpleModeEnabled:E}=ni(),R=A==="plan",[M,L]=S.useState(!1),[D,P]=S.useState(!1),{models:$,isLoading:z}=Zh(M||D?w??void 0:void 0);let O,W,F,G,q,H,ee,K,U,te,X,J,se;if(e[14]!==C||e[15]!==$||e[16]!==A||e[17]!==h||e[18]!==T||e[19]!==s||e[20]!==d||e[21]!==V||e[22]!==M||e[23]!==z||e[24]!==R||e[25]!==i||e[26]!==o||e[27]!==l||e[28]!==D||e[29]!==N||e[30]!==I||e[31]!==k||e[32]!==E){const Q=$.filter(ov),oe=$.filter(nv);let Se;e[46]!==A||e[47]!==R||e[48]!==l||e[49]!==N?(Se=()=>{l(),N(R?"default":"plan"),a(!1)},e[46]=A,e[47]=R,e[48]=l,e[49]=N,e[50]=Se):Se=e[50];const Ne=Se;let Be;e[51]!==i?(Be=()=>{i(),a(!1)},e[51]=i,e[52]=Be):Be=e[52],F=Be;let Oe;e[53]!==h||e[54]!==d?(Oe=async(xe,qt)=>{if(!d||!h)return;const Ot=si(xe._meta),ls={from:d.state.selection.from,to:d.state.selection.to};try{const Qi=await ul(h,xe.name,qt);Cr(d,ls,{id:xe.name,name:al(xe.name,Ot),metadata:Qi.messages,char:"/"})}catch{me.error("Failed to load prompt. Please try again.")}},e[53]=h,e[54]=d,e[55]=Oe):Oe=e[55];const He=Oe;let Je;e[56]!==He?(Je=async xe=>{a(!1);const qt=!!(xe.arguments&&xe.arguments.length>0);if(ye("chat_prompt_inserted",{prompt_name:xe.name}),qt){j(xe);return}await He(xe)},e[56]=He,e[57]=Je):Je=e[57],q=Je;let dt;e[58]!==C||e[59]!==He?(dt=async xe=>{C&&(await He(C,xe),j(null))},e[58]=C,e[59]=He,e[60]=dt):dt=e[60],G=dt;let ge;e[61]!==l||e[62]!==k?(ge=xe=>{l(),ye("chat_image_model_selected",{model_id:xe.modelId,model_title:xe.title,provider:xe.providerId??null}),k(xe),a(!1)},e[61]=l,e[62]=k,e[63]=ge):ge=e[63];const ke=ge;let Qe;e[64]!==l||e[65]!==I?(Qe=xe=>{l(),ye("chat_search_model_selected",{model_id:xe.modelId,model_title:xe.title,provider:xe.providerId??null}),I(xe),a(!1)},e[64]=l,e[65]=I,e[66]=Qe):Qe=e[66];const Ct=Qe;let Pe;e[67]!==A||e[68]!==l||e[69]!==N?(Pe=()=>{l(),N(A==="gen-image"?"default":"gen-image"),a(!1)},e[67]=A,e[68]=l,e[69]=N,e[70]=Pe):Pe=e[70];const Ut=Pe;let jt;e[71]!==A||e[72]!==l||e[73]!==N?(jt=()=>{l(),N(A==="web-search"?"default":"web-search"),a(!1)},e[71]=A,e[72]=l,e[73]=N,e[74]=jt):jt=e[74];const Ae=jt,Ie=A==="gen-image",qe=A==="web-search";W=js,K=o,e[75]!==A||e[76]!==o?(U=xe=>{a(xe)},e[75]=A,e[76]=o,e[77]=U):U=e[77];let Kt,_t;e[78]===Symbol.for("react.memo_cache_sentinel")?(Kt=r.jsx(Oh,{size:14}),_t=r.jsx("span",{className:"hidden sm:inline",children:"Tools"}),e[78]=Kt,e[79]=_t):(Kt=e[78],_t=e[79]),e[80]!==s?(te=r.jsx(ks,{asChild:!0,children:r.jsxs(re,{type:"button",variant:"ghost",size:"default",disabled:s,className:"text-muted-foreground hover:text-foreground",children:[Kt,_t]})}),e[80]=s,e[81]=te):te=e[81],O=Ns,X="start",J="w-52 p-1.5";const xt=R&&"text-violet-600 dark:text-violet-400";let vt;e[82]!==xt?(vt=Y(xt),e[82]=xt,e[83]=vt):vt=e[83];const _s=R&&"text-violet-500";let $e;e[84]!==_s?($e=Y(_s),e[84]=_s,e[85]=$e):$e=e[85];let kt;e[86]!==$e?(kt=r.jsx(Gh,{size:16,className:$e}),e[86]=$e,e[87]=kt):kt=e[87];let Nt;e[88]===Symbol.for("react.memo_cache_sentinel")?(Nt=r.jsx("span",{className:"flex-1",children:"Plan mode"}),e[88]=Nt):Nt=e[88];let wt;e[89]!==R?(wt=R&&r.jsx("span",{className:"text-xs text-violet-500 font-medium",children:"On"}),e[89]=R,e[90]=wt):wt=e[90],e[91]!==Ne||e[92]!==vt||e[93]!==kt||e[94]!==wt?(se=r.jsxs(ot,{onClick:Ne,className:vt,children:[kt,Nt,wt]}),e[91]=Ne,e[92]=vt,e[93]=kt,e[94]=wt,e[95]=se):se=e[95],H=E?r.jsxs(ot,{onClick:Ut,className:Y(Ie&&"text-pink-600 dark:text-pink-400"),children:[r.jsx(la,{size:16,className:Y(Ie&&"text-pink-500")}),r.jsx("span",{className:"flex-1",children:"Create image"}),Ie&&r.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}):r.jsxs(Sn,{open:M,onOpenChange:L,children:[r.jsxs("div",{className:"flex items-center rounded-lg",children:[r.jsxs(ot,{onClick:Ut,disabled:!V,className:Y("flex-1 rounded-r-none pr-1",Ie&&"text-pink-600 dark:text-pink-400"),children:[r.jsx(la,{size:16,className:Y(Ie&&"text-pink-500")}),r.jsx("span",{className:"flex-1",children:"Create image"}),Ie&&r.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),r.jsx(lc,{className:Y("flex items-center justify-center rounded-r-lg rounded-l-none px-1.5 py-1.5 text-muted-foreground outline-hidden select-none","hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground","data-[state=open]:bg-accent data-[state=open]:text-accent-foreground"),children:r.jsx(kr,{size:14})})]}),r.jsx(wn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:z?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(Ee,{size:14,className:"animate-spin"}),"Loading models…"]}):Q.length===0?r.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No image models available"}):Q.map(xe=>{const qt=V?.modelId===xe.modelId,Ot=xc(xe),ls=xe.title.includes(": ")?xe.title.split(": ").slice(1).join(": "):xe.title;return r.jsxs(ot,{onClick:()=>ke(xe),className:"flex items-center gap-2",children:[r.jsx("img",{src:Ot,alt:"",className:"size-4 shrink-0 rounded-sm dark:bg-white dark:p-px"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:ls}),qt&&r.jsx(Jt,{size:14,className:"text-pink-500 shrink-0"})]},xe.modelId)})})]}),ee=E?r.jsxs(ot,{onClick:Ae,className:Y(qe&&"text-blue-600 dark:text-blue-400"),children:[r.jsx(Ti,{size:16,className:Y(qe&&"text-blue-500")}),r.jsx("span",{className:"flex-1",children:"Web search"}),qe&&r.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}):T&&r.jsxs(Sn,{open:D,onOpenChange:P,children:[r.jsxs("div",{className:"flex items-center rounded-lg",children:[r.jsxs(ot,{onClick:Ae,className:Y("flex-1 rounded-r-none pr-1",qe&&"text-blue-600 dark:text-blue-400"),children:[r.jsx(Ti,{size:16,className:Y(qe&&"text-blue-500")}),r.jsx("span",{className:"flex-1",children:"Web search"}),qe&&r.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),r.jsx(lc,{className:Y("flex items-center justify-center rounded-r-lg rounded-l-none px-1.5 py-1.5 text-muted-foreground outline-hidden select-none","hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground","data-[state=open]:bg-accent data-[state=open]:text-accent-foreground"),children:r.jsx(kr,{size:14})})]}),r.jsx(wn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:z?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(Ee,{size:14,className:"animate-spin"}),"Loading models…"]}):oe.map(xe=>{const qt=T?.modelId===xe.modelId,Ot=xc(xe),ls=xe.title.includes(": ")?xe.title.split(": ").slice(1).join(": "):xe.title;return r.jsxs(ot,{onClick:()=>Ct(xe),className:"flex items-center gap-2",children:[r.jsx("img",{src:Ot,alt:"",className:"size-4 shrink-0 rounded-sm dark:bg-white dark:p-px"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:ls}),qt&&r.jsx(Jt,{size:14,className:"text-blue-500 shrink-0"})]},xe.modelId)})})]}),e[14]=C,e[15]=$,e[16]=A,e[17]=h,e[18]=T,e[19]=s,e[20]=d,e[21]=V,e[22]=M,e[23]=z,e[24]=R,e[25]=i,e[26]=o,e[27]=l,e[28]=D,e[29]=N,e[30]=I,e[31]=k,e[32]=E,e[33]=O,e[34]=W,e[35]=F,e[36]=G,e[37]=q,e[38]=H,e[39]=ee,e[40]=K,e[41]=U,e[42]=te,e[43]=X,e[44]=J,e[45]=se}else O=e[33],W=e[34],F=e[35],G=e[36],q=e[37],H=e[38],ee=e[39],K=e[40],U=e[41],te=e[42],X=e[43],J=e[44],se=e[45];let he;e[96]===Symbol.for("react.memo_cache_sentinel")?(he=r.jsxs(Ph,{className:"gap-2",children:[r.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),r.jsx("span",{className:"flex-1",children:"Prompts"})]}),e[96]=he):he=e[96];let ce;e[97]!==q||e[98]!==x||e[99]!==y?(ce=x?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(Ee,{size:14,className:"animate-spin"}),"Loading prompts…"]}):y.length===0?r.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):y.map(Q=>r.jsxs(ot,{onClick:()=>q(Q),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:Q.title||eo(Q.name,si(Q._meta))}),Q.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:Q.description})]},Q.name)),e[97]=q,e[98]=x,e[99]=y,e[100]=ce):ce=e[100];let pe;e[101]!==ce?(pe=r.jsxs(Sn,{children:[he,r.jsx(wn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:ce})]}),e[101]=ce,e[102]=pe):pe=e[102];let ne,de;e[103]===Symbol.for("react.memo_cache_sentinel")?(ne=r.jsx(Pg,{size:16}),de=r.jsx("span",{className:"flex-1",children:"Connections"}),e[103]=ne,e[104]=de):(ne=e[103],de=e[104]);let fe;e[105]===Symbol.for("react.memo_cache_sentinel")?(fe=r.jsx(S.Suspense,{children:r.jsx(sv,{})}),e[105]=fe):fe=e[105];let ue;e[106]!==F?(ue=r.jsxs(ot,{onClick:F,children:[ne,de,fe]}),e[106]=F,e[107]=ue):ue=e[107];let ae;e[108]!==O||e[109]!==H||e[110]!==ee||e[111]!==pe||e[112]!==ue||e[113]!==X||e[114]!==J||e[115]!==se?(ae=r.jsxs(O,{align:X,className:J,children:[se,H,ee,pe,ue]}),e[108]=O,e[109]=H,e[110]=ee,e[111]=pe,e[112]=ue,e[113]=X,e[114]=J,e[115]=se,e[116]=ae):ae=e[116];let _e;e[117]!==W||e[118]!==K||e[119]!==U||e[120]!==te||e[121]!==ae?(_e=r.jsxs(W,{open:K,onOpenChange:U,children:[te,ae]}),e[117]=W,e[118]=K,e[119]=U,e[120]=te,e[121]=ae,e[122]=_e):_e=e[122];let Ce;e[123]!==C||e[124]!==G?(Ce=r.jsx(Rl,{prompt:C,setPrompt:j,onSubmit:G}),e[123]=C,e[124]=G,e[125]=Ce):Ce=e[125];let Te;return e[126]!==_e||e[127]!==Ce?(Te=r.jsxs(r.Fragment,{children:[_e,Ce]}),e[126]=_e,e[127]=Ce,e[128]=Te):Te=e[128],Te}function nv(t){const e=t.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("sonar")||e.includes("deepresearch")}function ov(t){return t.capabilities?.includes("image")}function av({open:t,onOpenChange:e,onCreated:s}){const{org:i}=ve(),{data:n}=St.useSession(),{stdioEnabled:o}=Qm(),a=Rs(),l=Sl(),c=nu(),u=ou(c,"").items,h=Hi({resolver:Or(Qg),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),f=h.watch("ui_type"),m=h.watch("connection_url"),p=h.watch("npx_package"),g=on({uiType:f,connectionUrl:m??"",npxPackage:p??""})??vc({uiType:f,connectionUrl:m??"",registryItems:u}),_=w=>{const V=w.trim();if(!V)return;const k=!!h.formState.dirtyFields.title,T=!!h.formState.dirtyFields.description,I=!!h.formState.dirtyFields.env_vars,A=E=>{if(E&&(!k&&!h.getValues("title").trim()&&E.title&&h.setValue("title",E.title,{shouldDirty:!1}),!T&&!(h.getValues("description")??"").trim()&&E.description&&h.setValue("description",E.description,{shouldDirty:!1}),!I&&E.envVarKeys?.length)){const R=h.getValues("env_vars")??[],M=new Set(R.map(D=>D.key)),L=E.envVarKeys.filter(D=>!M.has(D));L.length>0&&h.setValue("env_vars",[...R,...L.map(D=>({key:D,value:""}))],{shouldDirty:!0})}},N=e_(V);if(N&&o){h.setValue("ui_type","NPX",{shouldDirty:!0}),h.setValue("npx_package",N.packageName,{shouldDirty:!0}),h.setValue("connection_url","",{shouldDirty:!0}),h.setValue("connection_token",null,{shouldDirty:!0}),A(on({uiType:"NPX",npxPackage:N.packageName}));return}if(V.startsWith("http://")||V.startsWith("https://")){const E=f==="HTTP"||f==="SSE"||f==="Websocket"?f:"HTTP";h.setValue("ui_type",E,{shouldDirty:!0}),h.setValue("connection_url",V,{shouldDirty:!0}),A(on({uiType:E,connectionUrl:V})??vc({uiType:E,connectionUrl:V,registryItems:u}));return}f==="NPX"&&A(on({uiType:"NPX",npxPackage:V}))},v=w=>{w||h.reset(),e(w)},x=async w=>{let V,k=null,T=null,I=null;w.ui_type==="NPX"?(V="STDIO",k="",I=t_(w.npx_package||"",w.env_vars||[])):w.ui_type==="STDIO"?(V="STDIO",k="",I=s_(w.stdio_command||"",w.stdio_args||"",w.stdio_cwd,w.env_vars||[])):(V=w.ui_type,k=w.connection_url||"",T=w.connection_token||null);const A=lu("conn");try{await l.create.mutateAsync({id:A,title:w.title,description:w.description||null,connection_type:V,connection_url:k,connection_token:T,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:n?.user?.id||"system",organization_id:i.id,icon:w.icon??null,app_name:null,app_id:null,connection_headers:I,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),h.reset(),e(!1),s?.(A)}catch{me.error("Failed to create connection")}},b="Create Connection",y="Create a custom connection in your organization. Fill in the details below.",C=h.formState.isSubmitting?"Saving...":"Create Connection",j=r.jsxs("div",{className:"grid gap-4",children:[r.jsx(It,{control:h.control,name:"ui_type",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"Type *"}),r.jsxs(Qs,{value:w.value,onValueChange:w.onChange,children:[r.jsx(Tt,{children:r.jsx(Zs,{children:r.jsx(ei,{})})}),r.jsxs(Js,{children:[r.jsx(Ft,{value:"HTTP",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Ti,{className:"w-4 h-4"}),"HTTP"]})}),r.jsx(Ft,{value:"SSE",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Ti,{className:"w-4 h-4"}),"SSE"]})}),r.jsx(Ft,{value:"Websocket",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Ti,{className:"w-4 h-4"}),"Websocket"]})}),o&&r.jsxs(r.Fragment,{children:[r.jsx(Ft,{value:"NPX",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"w-4 h-4"}),"NPX Package"]})}),r.jsx(Ft,{value:"STDIO",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(fl,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),r.jsx(Dt,{})]})}),f==="NPX"&&r.jsx(It,{control:h.control,name:"npx_package",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"NPM Package *"}),r.jsx(Tt,{children:r.jsx(bt,{placeholder:"@perplexity-ai/mcp-server",...w,value:w.value??"",onPaste:V=>{const k=V.clipboardData.getData("text");k&&(V.preventDefault(),h.setValue("npx_package",k.trim(),{shouldDirty:!0}),_(k))},onBlur:V=>{_(V.target.value),w.onBlur()}})}),r.jsx(Dt,{})]})}),f==="STDIO"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[r.jsx(It,{control:h.control,name:"stdio_command",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"Command *"}),r.jsx(Tt,{children:r.jsx(bt,{placeholder:"node, bun, python...",...w,value:w.value??""})}),r.jsx(Dt,{})]})}),r.jsx(It,{control:h.control,name:"stdio_args",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"Arguments"}),r.jsx(Tt,{children:r.jsx(bt,{placeholder:"arg1 arg2 --flag value",...w,value:w.value??""})}),r.jsx(Dt,{})]})})]}),r.jsx(It,{control:h.control,name:"stdio_cwd",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"Working Directory"}),r.jsx(Tt,{children:r.jsx(bt,{placeholder:"/path/to/project (optional)",...w,value:w.value??""})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),r.jsx(Dt,{})]})})]}),(f==="NPX"||f==="STDIO")&&r.jsx(It,{control:h.control,name:"env_vars",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"Environment Variables"}),r.jsx(Tt,{children:r.jsx(Zg,{value:w.value??[],onChange:w.onChange})}),r.jsx(Dt,{})]})}),f!=="NPX"&&f!=="STDIO"&&r.jsxs(r.Fragment,{children:[r.jsx(It,{control:h.control,name:"connection_url",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"URL *"}),r.jsx(Tt,{children:r.jsx(bt,{placeholder:"https://example.com/mcp",...w,value:w.value??"",onPaste:V=>{const k=V.clipboardData.getData("text");k&&(V.preventDefault(),h.setValue("connection_url",k.trim(),{shouldDirty:!0}),_(k))},onBlur:V=>{_(V.target.value),w.onBlur()}})}),r.jsx(Dt,{})]})}),r.jsx(It,{control:h.control,name:"connection_token",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:g?.token?.label??"Token (optional)"}),r.jsx(Tt,{children:r.jsx(bt,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...w,value:w.value??""})}),g?.token?.helperText&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&r.jsxs(r.Fragment,{children:[" ","·"," ",r.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),r.jsx(Dt,{})]})})]}),r.jsx(It,{control:h.control,name:"title",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"Name *"}),r.jsx(Tt,{children:r.jsx(bt,{placeholder:"My Connection",...w})}),r.jsx(Dt,{})]})}),r.jsx(It,{control:h.control,name:"description",render:({field:w})=>r.jsxs(Rt,{children:[r.jsx(rs,{children:"Description"}),r.jsx(Tt,{children:r.jsx(ca,{placeholder:"A brief description of this connection",rows:3,...w,value:w.value??""})}),r.jsx(Dt,{})]})})]});return a?r.jsx(Si,{open:t,onOpenChange:v,children:r.jsxs(yi,{className:"max-h-[90vh]",children:[r.jsx(so,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"flex-1 text-left",children:[r.jsx(bi,{children:b}),r.jsx(rg,{className:"mt-1",children:y})]}),r.jsx(ng,{asChild:!0,children:r.jsx(re,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:r.jsx(ii,{size:16})})})]})}),r.jsx(Pi,{...h,children:r.jsxs("form",{onSubmit:h.handleSubmit(x),children:[r.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:j}),r.jsx(og,{children:r.jsx(re,{type:"submit",disabled:h.formState.isSubmitting,className:"w-full",children:C})})]})})]})}):r.jsx(ps,{open:t,onOpenChange:v,children:r.jsxs(ms,{className:"sm:max-w-[525px]",children:[r.jsxs(Ds,{children:[r.jsx(Ts,{children:b}),r.jsx(dl,{children:y})]}),r.jsx(Pi,{...h,children:r.jsxs("form",{onSubmit:h.handleSubmit(x),children:[r.jsx("div",{className:"py-4",children:j}),r.jsxs(cl,{children:[r.jsx(re,{type:"button",variant:"outline",onClick:()=>v(!1),children:"Cancel"}),r.jsx(re,{type:"submit",disabled:h.formState.isSubmitting,className:"min-w-40",children:C})]})]})})]})})}function lv(t){const e=B.c(79),{mode:s,agentId:i,addedConnectionIds:n,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:l,connectingItemId:c,search:d,onCreateConnection:u,onBrowseNavigate:h,defaultTab:f}=t,m=s===void 0?"add":s,p=f===void 0?"connected":f,{org:g}=ve(),_=S.useDeferredValue(d),v=d!==_;let x;e[0]!==_?(x=_.toLowerCase(),e[0]=_,e[1]=x):x=e[1];const b=x;let y;e[2]!==p?(y=ge=>ge??p,e[2]=p,e[3]=y):y=e[3];const[C,j]=nl(ol.connectionsTab(g.slug)+(p==="all"?":home-modal":":agent-modal"),y);let w;e[4]!==C||e[5]!==j?(w=ge=>{j(ge)},e[4]=C,e[5]=j,e[6]=w):w=e[6];const V=w;let k;e[7]!==g.id?(k={connectionId:Ht,orgId:g.id},e[7]=g.id,e[8]=k):k=e[8];const T=Me(k);let I,A,N;if(e[9]!==T||e[10]!==_||e[11]!==g.id){N=_?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:_.trim()},{field:["description"],operator:"contains",value:_.trim()}]}:void 0;const ge={...N&&{where:N},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},ke=JSON.stringify(ge);A=i_,I=lt.collectionListInfinite(T,g.id,"","CONNECTIONS",ke),e[9]=T,e[10]=_,e[11]=g.id,e[12]=I,e[13]=A,e[14]=N}else I=e[12],A=e[13],N=e[14];let E;e[15]!==T||e[16]!==N?(E=async ge=>{const{pageParam:ke}=ge,Qe=ke===void 0?0:ke;return(await T.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...N&&{where:N},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Qe}})).structuredContent},e[15]=T,e[16]=N,e[17]=E):E=e[17];let R;e[18]!==I||e[19]!==E?(R={queryKey:I,queryFn:E,initialPageParam:0,getNextPageParam:mv,staleTime:3e4},e[18]=I,e[19]=E,e[20]=R):R=e[20];const{data:M,fetchNextPage:L,hasNextPage:D,isFetchingNextPage:P}=A(R),$=M?.pages.flatMap(fv)??[],z=Jg($),O=new Set($.filter(uv).map(hv)),W=nu(),F=ou(W,_),G=bc(F.loadMore,F.hasMore,F.isLoadingMore),q=bc(L,D??!1,P),H=C==="all"||!!b,ee=H?F.items.filter(ge=>{const ke=c_(ge);return!(ke&&O.has(ke))}):[],K=ee.filter(dv),U=ee.filter(cv);let te;e[21]!==n?(te=ge=>ge.some(ke=>n.has(ke.id)),e[21]=n,e[22]=te):te=e[22];const X=te;let J;e[23]!==n||e[24]!==i||e[25]!==c||e[26]!==X||e[27]!==m||e[28]!==o||e[29]!==h||e[30]!==a?(J=(ge,ke,Qe,Ct,Pe)=>{const Ut=X(Pe),jt=Pe.find(Ie=>!n.has(Ie.id)),Ae=Pe[0];if(m==="browse"){const Ie=iu(Ae);return r.jsx(jo,{connection:{title:ke,icon:Qe,description:Pe.length>1?`${Pe.length} instances`:Ct??void 0},fallbackIcon:r.jsx(Vn,{}),headerActionsAlwaysVisible:!0,headerActions:r.jsxs(wc,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Jt,{size:11})," Connected"]}),onClick:()=>{ye("connection_browse_clicked",{app_name:Ae.app_name??null,connection_id:Ae.id,instances_count:Pe.length}),h?.(Ie)}},ge)}return r.jsx(jo,{connection:{title:ke,icon:Qe,description:Ct},fallbackIcon:r.jsx(Vn,{}),headerActionsAlwaysVisible:!0,headerActions:r.jsxs("div",{className:"flex items-center gap-1.5",children:[Ut&&r.jsxs(wc,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Jt,{size:11})," Added"]}),r.jsx(re,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:Ie=>{Ie.stopPropagation(),jt?(ye("connection_add_clicked",{app_name:Ae.app_name??null,connection_id:jt.id}),i&&ye("agent_connection_attached",{connection_id:jt.id,app_name:Ae.app_name??null}),o(jt.id)):(ye("connection_add_clicked",{app_name:Ae.app_name??null,base_connection_id:Ae.id}),a(Ae))},children:"Add"})]})},ge)},e[23]=n,e[24]=i,e[25]=c,e[26]=X,e[27]=m,e[28]=o,e[29]=h,e[30]=a,e[31]=J):J=e[31];const se=J;let he;e[32]!==c||e[33]!==m||e[34]!==l?(he=ge=>{const ke=ge._meta?.["mcp.mesh"],Qe=ke?.friendlyName||ke?.friendly_name||ge.server?.title||ge.title||ge.server?.name||ge.name||ge.id||"",Ct=ge.server?.description||ge.description||null,Pe=ge.server?.icons?.[0]?.src||h_(ge.server?.repository)||null;return r.jsx(jo,{connection:{title:Qe,description:Ct,icon:Pe},fallbackIcon:r.jsx(Vn,{}),headerActionsAlwaysVisible:!0,headerActions:r.jsx(re,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:c!==null,onClick:Ut=>{Ut.stopPropagation(),ye("connection_add_clicked",{registry_item_id:ge.id,app_name:ge._meta?.["mcp.mesh"]?.friendlyName||ge.server?.name||ge.name||null}),l(ge)},children:c===ge.id?r.jsx(Ee,{size:14,className:"animate-spin"}):m==="browse"?"Connect":"Add"})},`catalog-${ge.id}`)},e[32]=c,e[33]=m,e[34]=l,e[35]=he):he=e[35];const ce=he;let pe;e[36]!==C||e[37]!==V||e[38]!==u||e[39]!==b?(pe=!b&&r.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[r.jsx(au,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:C,onTabChange:ge=>V(ge)}),r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{u()},children:[r.jsx(Qt,{size:12}),"Custom Connection"]})]}),e[36]=C,e[37]=V,e[38]=u,e[39]=b,e[40]=pe):pe=e[40];const ne=v&&"opacity-50 pointer-events-none";let de;e[41]!==ne?(de=Y("flex-1 overflow-auto p-5 transition-opacity duration-150",ne),e[41]=ne,e[42]=de):de=e[42];const fe="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ue;e[43]!==se?(ue=ge=>{if(ge.type==="group")return se(ge.key,ge.title,ge.icon,null,ge.connections);const ke=ge.connection;return se(ke.id,ke.title,ke.icon,ke.description??null,[ke])},e[43]=se,e[44]=ue):ue=e[44];const ae=z.map(ue);let _e;e[45]!==q?(_e=r.jsx("div",{ref:q,className:"col-span-full h-1"}),e[45]=q,e[46]=_e):_e=e[46];let Ce;e[47]!==P?(Ce=P&&r.jsx("div",{className:"col-span-full flex justify-center py-6",children:r.jsx(Ee,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=P,e[48]=Ce):Ce=e[48];const Te=H&&K.length>0&&r.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[r.jsx(Lg,{size:13,className:"text-muted-foreground shrink-0"}),r.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),r.jsx("div",{className:"flex-1 h-px bg-border"})]}),Q=H&&K.map(ce),oe=H&&U.length>0&&r.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[r.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),r.jsx("div",{className:"flex-1 h-px bg-border"})]}),Se=H&&U.map(ce);let Ne;e[49]!==G||e[50]!==W||e[51]!==H?(Ne=H&&W.length>0&&r.jsx("div",{ref:G,className:"col-span-full h-1"}),e[49]=G,e[50]=W,e[51]=H,e[52]=Ne):Ne=e[52];let Be;e[53]!==F.isLoadingMore||e[54]!==H?(Be=H&&F.isLoadingMore&&r.jsx("div",{className:"col-span-full flex justify-center py-6",children:r.jsx(Ee,{size:24,className:"animate-spin text-muted-foreground"})}),e[53]=F.isLoadingMore,e[54]=H,e[55]=Be):Be=e[55];let Oe;e[56]!==ae||e[57]!==_e||e[58]!==Ce||e[59]!==Te||e[60]!==Q||e[61]!==oe||e[62]!==Se||e[63]!==Ne||e[64]!==Be?(Oe=r.jsxs("div",{className:fe,children:[ae,_e,Ce,Te,Q,oe,Se,Ne,Be]}),e[56]=ae,e[57]=_e,e[58]=Ce,e[59]=Te,e[60]=Q,e[61]=oe,e[62]=Se,e[63]=Ne,e[64]=Be,e[65]=Oe):Oe=e[65];let He;e[66]!==C||e[67]!==z.length||e[68]!==U||e[69]!==d||e[70]!==K?(He=z.length===0&&K.length===0&&U.length===0&&r.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:d?`No connections match "${d}"`:C==="connected"?"No connections yet":"No connections available"}),e[66]=C,e[67]=z.length,e[68]=U,e[69]=d,e[70]=K,e[71]=He):He=e[71];let Je;e[72]!==de||e[73]!==Oe||e[74]!==He?(Je=r.jsxs("div",{className:de,children:[Oe,He]}),e[72]=de,e[73]=Oe,e[74]=He,e[75]=Je):Je=e[75];let dt;return e[76]!==pe||e[77]!==Je?(dt=r.jsxs(r.Fragment,{children:[pe,Je]}),e[76]=pe,e[77]=Je,e[78]=dt):dt=e[78],dt}function cv(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function dv(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function hv(t){return t.app_name}function uv(t){return t.app_name}function fv(t){return t?.items??[]}function mv(t,e){if(t?.hasMore)return e.reduce(pv,0)}function pv(t,e){return t+(e?.items?.length??0)}function Pl({open:t,onOpenChange:e,defaultTab:s,initialSearch:i="",...n}){const o=n.mode??"add",a="agentId"in n?n.agentId:void 0,l="addedConnectionIds"in n?n.addedConnectionIds??new Set:new Set,c="onAdd"in n&&n.onAdd?n.onAdd:V=>{},d=(V,k,T)=>{},[u,h]=S.useState(null),[f,m]=S.useState(i),[p,g]=S.useState(!1),{org:_}=ve(),{data:v}=St.useSession(),x=Sl(),b=Mt(),y=Ke(),C=V=>{e(!1),y({to:"/$org/settings/connections/$appSlug",params:{org:_.slug,appSlug:V}})},j=async V=>{h(V.app_name??V.id);try{const T=`${V.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await x.create.mutateAsync({title:T,description:V.description??null,connection_type:V.connection_type,connection_url:V.connection_url??null,connection_token:null,icon:V.icon??null,app_name:V.app_name??null,app_id:V.app_id??null,connection_headers:V.connection_headers??null})).id,N=new URL(`/mcp/${A}`,window.location.origin),E=await pr({url:N.href,token:null});if(E.supportsOAuth&&!E.isAuthenticated){const{token:R,tokenInfo:M,error:L}=await vn({connectionId:A,scope:"offline_access"});if(L||!R){ye("connection_oauth_failed",{connection_id:A,flow:"clone",error:L??"no_token"}),me.error(`Authentication failed: ${L??"no token received"}`),await x.delete.mutateAsync(A);return}if(ye("connection_oauth_succeeded",{connection_id:A,flow:"clone"}),M)try{(await fetch(`/api/connections/${A}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:M.accessToken,refreshToken:M.refreshToken,expiresIn:M.expiresIn,scope:M.scope,clientId:M.clientId,clientSecret:M.clientSecret,tokenEndpoint:M.tokenEndpoint})})).ok?await x.update.mutateAsync({id:A,data:{}}):await x.update.mutateAsync({id:A,data:{connection_token:R}})}catch{await x.update.mutateAsync({id:A,data:{connection_token:R}})}else await x.update.mutateAsync({id:A,data:{connection_token:R}});await b.invalidateQueries({queryKey:lt.isMCPAuthenticated(N.href,null)})}d(A,V.app_name??null,"clone"),c(A)}catch(k){console.error("Failed to add connection:",k),me.error("Failed to add connection")}finally{h(null)}},w=async V=>{if(!(!_||!v?.user?.id)){h(V.id);try{const k=d_(V,_.id,v.user.id,{remoteIndex:0}),T=k.connection_type==="STDIO",I=!!k.connection_url,A=T&&k.connection_headers&&typeof k.connection_headers=="object"&&"command"in k.connection_headers;if(!I&&!A){me.error("This MCP Server cannot be connected: no connection method available"),h(null);return}const{id:N}=await x.create.mutateAsync(k),E=new URL(`/mcp/${N}`,window.location.origin),R=await pr({url:E.href,token:null});if(R.supportsOAuth&&!R.isAuthenticated){const{token:M,tokenInfo:L,error:D}=await vn({connectionId:N,scope:"offline_access"});if(D||!M){ye("connection_oauth_failed",{connection_id:N,flow:"connect_new",error:D??"no_token"}),me.error(`Authentication failed: ${D??"no token received"}`),d(N,k.app_name??null,"new"),c(N);return}if(ye("connection_oauth_succeeded",{connection_id:N,flow:"connect_new"}),L)try{(await fetch(`/api/connections/${N}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:L.accessToken,refreshToken:L.refreshToken,expiresIn:L.expiresIn,scope:L.scope,clientId:L.clientId,clientSecret:L.clientSecret,tokenEndpoint:L.tokenEndpoint})})).ok?await x.update.mutateAsync({id:N,data:{}}):await x.update.mutateAsync({id:N,data:{connection_token:M}})}catch{await x.update.mutateAsync({id:N,data:{connection_token:M}})}else await x.update.mutateAsync({id:N,data:{connection_token:M}});await b.invalidateQueries({queryKey:lt.isMCPAuthenticated(E.href,null)}),me.success("Connected and authenticated")}else me.success("Connected");d(N,k.app_name??null,"new"),c(N)}catch(k){console.error("Failed to connect:",k),me.error("Failed to connect")}finally{h(null)}}};return r.jsxs(ps,{open:t,onOpenChange:e,children:[r.jsxs(ms,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[r.jsx(Ds,{className:"px-6 pt-5 pb-0 shrink-0",children:r.jsx(Ts,{className:"text-base font-semibold",children:o==="browse"?"Connections":"Add Connection"})}),r.jsx("div",{className:"pt-3 shrink-0",children:r.jsx(Ih,{value:f,onChange:m,placeholder:"Search connections..."})}),r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:24,className:"animate-spin text-muted-foreground"})}),children:r.jsx(lv,{mode:o,agentId:a,addedConnectionIds:l,onAdd:c,onCloneAndAdd:j,onConnectAndAdd:w,connectingItemId:u,search:f,onCreateConnection:()=>g(!0),onBrowseNavigate:C,defaultTab:s})})]}),r.jsx(av,{open:p,onOpenChange:g,onCreated:async V=>{g(!1);const k=new URL(`/mcp/${V}`,window.location.origin),T=await pr({url:k.href,token:null});if(T.supportsOAuth&&!T.isAuthenticated){const{token:I,tokenInfo:A,error:N}=await vn({connectionId:V,scope:"offline_access"});if(N||!I){me.error(`Authentication failed: ${N??"no token received"}`),await x.delete.mutateAsync(V);return}if(A)try{(await fetch(`/api/connections/${V}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:A.accessToken,refreshToken:A.refreshToken,expiresIn:A.expiresIn,scope:A.scope,clientId:A.clientId,clientSecret:A.clientSecret,tokenEndpoint:A.tokenEndpoint})})).ok?await x.update.mutateAsync({id:V,data:{}}):await x.update.mutateAsync({id:V,data:{connection_token:I}})}catch{await x.update.mutateAsync({id:V,data:{connection_token:I}})}else await x.update.mutateAsync({id:V,data:{connection_token:I}});await b.invalidateQueries({queryKey:lt.isMCPAuthenticated(k.href,null)})}c(V),e(!1)}})]})}const gv=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function _v(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex items-center -space-x-1",children:gv.map(xv)}),t[0]=e):e=t[0],e}function xv(t){return r.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function vv(t){const e=B.c(6),{onClick:s}=t;let i,n,o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Y("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),n=r.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),o=r.jsx(_v,{}),a=r.jsx(Vl,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=i,e[1]=n,e[2]=o,e[3]=a):(i=e[0],n=e[1],o=e[2],a=e[3]);let l;return e[4]!==s?(l=r.jsxs("button",{type:"button",onClick:s,className:i,children:[n,o,a]}),e[4]=s,e[5]=l):l=e[5],l}const cr=48;function bv(){const t=B.c(9),[e,s]=S.useState("idle"),[i,n]=S.useState(""),[o,a]=S.useState(""),[l,c]=S.useState(wv),d=S.useRef(null),u=S.useRef(null),h=S.useRef(null),f=S.useRef(null),m=S.useRef(0),p=S.useRef(!1),g=S.useRef(""),_=S.useRef(""),v=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let x;t[0]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),u.current?.close().catch(Sv),f.current?.getTracks().forEach(yv),h.current=null,u.current=null,f.current=null},t[0]=x):x=t[0];const b=x;let y;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const I=A=>{f.current=A;const N=new AudioContext;u.current=N;const E=N.createMediaStreamSource(A),R=N.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,E.connect(R),h.current=R;const M=new Uint8Array(R.frequencyBinCount),L=()=>{if(!h.current)return;h.current.getByteFrequencyData(M);const D=[];for(let P=0;P<cr;P++){const $=Math.floor(P/cr*M.length);D.push(Math.max(.04,(M[$]??0)/255))}c(D),m.current=requestAnimationFrame(L)};L()};y=async()=>{const A=window.SpeechRecognition||window.webkitSpeechRecognition;if(!A){s("unsupported");return}let N;try{N=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{s("permission-denied");return}n(""),a(""),_.current="",g.current="",p.current=!0,s("recording"),I(N);const E=new A;d.current=E,E.interimResults=!0,E.continuous=!0,E.lang=navigator.language||"en-US",E.onresult=R=>{let M="",L="";for(let D=R.resultIndex;D<R.results.length;D++){const P=R.results[D],$=P?.[0]?.transcript??"";P?.isFinal?L=L+$:M=M+$}L&&(g.current=g.current+L,n(g.current)),_.current=M,a(M)},E.onend=()=>{if(p.current)try{E.start()}catch{}};try{E.start()}catch{s("idle")}},t[1]=y}else y=t[1];const C=y;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{p.current=!1,d.current?.stop(),b(),s("idle"),c(Array(cr).fill(.05)),a("");const I=(g.current+(_.current?" "+_.current:"")).trim();return n(""),g.current="",_.current="",I},t[2]=j):j=t[2];const w=j;let V;t[3]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{p.current=!1,d.current?.abort(),b(),s("idle"),n(""),a(""),c(Array(cr).fill(.05)),g.current="",_.current=""},t[3]=V):V=t[3];const k=V;let T;return t[4]!==o||t[5]!==e||t[6]!==i||t[7]!==l?(T={status:e,transcript:i,interimTranscript:o,waveformData:l,isSupported:v,startRecording:C,stopRecording:w,cancelRecording:k},t[4]=o,t[5]=e,t[6]=i,t[7]=l,t[8]=T):T=t[8],T}function yv(t){return t.stop()}function Sv(){}function wv(){return Array(cr).fill(.05)}function Vv(t){const e=B.c(4),{data:s}=t;let i;e[0]!==s?(i=s.map(Cv),e[0]=s,e[1]=i):i=e[1];let n;return e[2]!==i?(n=r.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:i}),e[2]=i,e[3]=n):n=e[3],n}function Cv(t,e){return r.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}const Io=[{value:"fast",label:"Fast",Icon:zh,description:"Quicker responses"},{value:"smart",label:"Smart",Icon:_l,description:"Balanced quality"},{value:"thinking",label:"Thinking",Icon:pg,description:"Deeper reasoning"}];function jv(t){const e=B.c(17),{tier:s,onSelect:i}=t;let n;e[0]!==s?(n=Io.find(m=>m.value===s)??Io[1],e[0]=s,e[1]=n):n=e[1];const o=n,a=o.Icon;let l;e[2]!==a?(l=r.jsx(a,{size:14}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==o.label?(c=r.jsx("span",{className:"hidden sm:inline",children:o.label}),e[4]=o.label,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==c?(d=r.jsx(ks,{asChild:!0,children:r.jsxs(re,{type:"button",variant:"ghost",size:"default",className:"text-muted-foreground hover:text-foreground",children:[l,c]})}),e[6]=l,e[7]=c,e[8]=d):d=e[8];let u;e[9]!==i||e[10]!==s?(u=Io.map(m=>{const{value:p,label:g,Icon:_,description:v}=m;return r.jsxs(ot,{onSelect:()=>i(p),children:[r.jsx(_,{size:16,className:"text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[r.jsx("span",{children:g}),r.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:v})]}),s===p&&r.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"On"})]},p)}),e[9]=i,e[10]=s,e[11]=u):u=e[11];let h;e[12]!==u?(h=r.jsx(Ns,{align:"end",className:"w-52 p-1.5",children:u}),e[12]=u,e[13]=h):h=e[13];let f;return e[14]!==d||e[15]!==h?(f=r.jsxs(js,{children:[d,h]}),e[14]=d,e[15]=h,e[16]=f):f=e[16],f}function kv(t){const e=B.c(4),{editor:s}=to(),[i,n]=S.useState(!1),o=S.useRef(0);let a,l;return e[0]!==s||e[1]!==t?(a=()=>{const c=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),o.current=o.current+1,n(!0))},d=f=>{f.preventDefault(),o.current=Math.max(0,o.current-1),o.current===0&&n(!1)},u=Nv,h=f=>{if(f.preventDefault(),o.current=0,n(!1),!s||!t||!no(t))return;const m=f.dataTransfer?.files;if(!m||m.length===0)return;const{from:p}=s.state.selection;for(const g of Array.from(m))Tl(s,t,g,p)};return window.addEventListener("dragenter",c),window.addEventListener("dragleave",d),window.addEventListener("dragover",u),window.addEventListener("drop",h),()=>{window.removeEventListener("dragenter",c),window.removeEventListener("dragleave",d),window.removeEventListener("dragover",u),window.removeEventListener("drop",h)}},l=[s,t],e[0]=s,e[1]=t,e[2]=a,e[3]=l):(a=e[2],l=e[3]),S.useEffect(a,l),i}function Nv(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function Av(t){const e=B.c(10),{selectedModel:s}=t,i=kv(s);let n;e[0]!==s?(n=no(s),e[0]=s,e[1]=n):n=e[1];const o=n,a=i?"opacity-100":"opacity-0 pointer-events-none",l=o?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let c;e[2]!==a||e[3]!==l?(c=Y("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",a,l),e[2]=a,e[3]=l,e[4]=c):c=e[4];let d;e[5]!==o?(d=o?r.jsxs(r.Fragment,{children:[r.jsx(Xh,{size:24}),r.jsx("span",{className:"text-sm font-medium",children:"Drop files here"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Yh,{size:24}),r.jsx("span",{className:"text-sm font-medium",children:"This model does not support files"})]}),e[5]=o,e[6]=d):d=e[6];let u;return e[7]!==c||e[8]!==d?(u=r.jsx("div",{className:c,children:d}),e[7]=c,e[8]=d,e[9]=u):u=e[9],u}function Ev({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const{messages:s,isStreaming:i,isRunInProgress:n,sendMessage:o,stop:a}=Ui(),{taskId:l,tasks:c}=es(),{selectedModel:d,selectedVirtualMcp:u,isModelsLoading:h,tiptapDocRef:f,imageModel:m,deepResearchModel:p,chatMode:g,setChatMode:_,simpleModeEnabled:v,simpleModeTier:x,setSimpleModeTier:b}=ni(),{data:y}=St.useSession(),C=y?.user?.id,{org:j}=ve(),w=io(j.id).id,V=pa(_c),[k,T]=S.useState(!1),I=bv(),A=S.useRef(void 0),N=async()=>{A.current=L,await I.startRecording(),I.status==="recording"||I.status==="unsupported"||I.status},E=()=>{const X=I.stopRecording();W.current?.syncVoiceText(A.current,X),W.current?.focus()},R=()=>{I.cancelRecording(),W.current?.restoreContent(A.current)};S.useEffect(()=>{if(I.status!=="recording")return;const X=(I.transcript+(I.interimTranscript?" "+I.interimTranscript:"")).trim();W.current?.syncVoiceText(A.current,X)},[I.transcript,I.interimTranscript,I.status]);const M=c.find(X=>X.id===l),[L,D]=S.useState(void 0),P=X=>{D(X),f.current=X},$=S.useRef(l);$.current!==l&&($.current=l,D(void 0),f.current=void 0);const O=[...s].reverse().find(X=>X.role==="assistant")?.metadata?.modelLimits?.contextWindow??d?.limits?.contextWindow,W=S.useRef(null),F=g==="plan";S.useEffect(()=>{const X=J=>{Dh(J)&&J.code==="KeyL"&&(J.preventDefault(),J.shiftKey&&_(g==="plan"?"default":"plan"),W.current?.focus())};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[g,_]);const G=Nh(s),q=[...s].reverse().find(X=>X.role==="assistant"&&X.metadata?.usage)?.metadata?.usage,H=q?.contextTokens??(q?.totalTokens??0)-(q?.reasoningTokens??0),ee=pa(_c),K=!i&&!!d&&!h&&!U_(L),U=i||n,te=X=>{X?.preventDefault(),i||n?a():K&&L&&(ye("chat_message_sent",{model_id:d?.modelId??null,model_provider:d?.providerId??null,virtual_mcp_id:u?.id??null}),ee(),o(L),P(void 0))};return C&&M?.created_by&&M.created_by!==C?r.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[r.jsx(Yh,{size:14,className:"shrink-0"}),r.jsx("span",{className:"text-sm",children:"Read only — you're viewing someone else's thread"})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex flex-col w-full justify-end",children:r.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&r.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),r.jsx(ho,{}),r.jsx(Hu,{tiptapDoc:L,setTiptapDoc:P,disabled:i||!d,enterToSubmit:!0,onSubmit:te,children:r.jsxs("form",{onSubmit:te,className:Y("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-background dark:bg-muted card-shadow"),children:[r.jsx(Av,{selectedModel:d}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(Wu,{ref:W,disabled:i||!d||I.status==="recording",virtualMcpId:u?.id??w,showFileUploader:!0,selectedModel:d})}),r.jsx("div",{className:"flex items-center justify-between p-2.5 gap-1",children:I.status==="recording"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsx(Vv,{data:I.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:R,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Cancel recording",children:r.jsx(fi,{size:16})}),r.jsx("button",{type:"button",onClick:E,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":"Use transcription",children:r.jsx(Jt,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 shrink-0",children:[r.jsx(Bx,{selectedModel:d,isStreaming:i,icon:r.jsx(Qt,{size:16})}),r.jsx(rv,{disabled:i,onOpenConnections:()=>{T(!0)},virtualMcpId:u?.id??w}),F&&r.jsxs("button",{type:"button",onClick:()=>{V(),_("default")},className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 group whitespace-nowrap animate-in fade-in duration-200",children:[r.jsx(Gh,{size:14,className:"shrink-0"}),"Plan mode",r.jsx(fi,{size:14,className:"shrink-0 hidden group-hover:block"})]}),g==="gen-image"&&m&&r.jsxs("button",{type:"button",onClick:()=>{V(),_("default")},className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 group whitespace-nowrap animate-in fade-in duration-200",children:[r.jsx(la,{size:14,className:"shrink-0"}),r.jsx("span",{className:"max-w-[120px] truncate",children:v?"Create image":m.title.includes(": ")?m.title.split(": ").slice(1).join(": "):m.title}),r.jsx(fi,{size:14,className:"shrink-0 hidden group-hover:block"})]}),g==="web-search"&&p&&r.jsxs("button",{type:"button",onClick:()=>{V(),_("default")},className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group whitespace-nowrap animate-in fade-in duration-200",children:[r.jsx(Ti,{size:14,className:"shrink-0"}),r.jsx("span",{className:"max-w-[120px] truncate",children:v?"Web search":p.title.includes(": ")?p.title.split(": ").slice(1).join(": "):p.title}),r.jsx(fi,{size:14,className:"shrink-0 hidden group-hover:block"})]}),O&&H>0&&r.jsx(Bp,{usage:G,totalTokens:H,contextWindow:O,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[v?r.jsx(jv,{tier:x,onSelect:b}):r.jsx(eu,{placeholder:"Model",variant:"borderless",className:"h-8 text-sm py-2 min-w-0"}),I.isSupported&&!i&&!n&&r.jsx(re,{type:"button",onClick:N,variant:"ghost",size:"icon",className:Y("size-8 rounded-lg transition-colors",I.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:I.status==="permission-denied"?"Microphone access denied — click to try again":"Voice input",children:r.jsx(fg,{size:18})}),r.jsx(re,{type:U?"button":"submit",onClick:X=>{U&&(X.preventDefault(),X.stopPropagation(),a())},variant:K||U?"default":"ghost",size:"icon",disabled:!K&&!U,className:Y("size-8 rounded-lg transition-all",!K&&!U&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:i?"Stop generating":n?"Cancel run":"Send message (Enter)",children:U?r.jsx(mg,{size:20}):r.jsx($h,{size:20})})]})]})})]})},l),e&&r.jsx(vv,{onClick:()=>{T(!0)}})]})}),r.jsx(Pl,{mode:"browse",open:k,onOpenChange:T,defaultTab:"all"})]})}const Iv={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]};function Uu(t){return`deco-credits-empty-dismissed:${t}`}function Rv(t){try{return localStorage.getItem(Uu(t))==="1"}catch{return!1}}function Tv(){const t=B.c(49),{org:e}=ve(),s=Ke(),{decoKeyId:i}=co();let n;t[0]!==e.id?(n={connectionId:Ht,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const o=Me(n),[a,l]=S.useState(!0),[c,d]=S.useState(""),[u,h]=S.useState(!1),[f,m]=S.useState("usd"),p=f==="brl"?"R$":"$";let g;t[2]!==e.id?(g=()=>{ye("credits_empty_state_dismissed",{organization_id:e.id}),l(!1);try{localStorage.setItem(Uu(e.id),"1")}catch{}},t[2]=e.id,t[3]=g):g=t[3];const _=g;let v,x;t[4]!==a||t[5]!==e.id?(v=()=>{a&&ye("credits_empty_state_shown",{organization_id:e.id})},x=[a,e.id],t[4]=a,t[5]=e.id,t[6]=v,t[7]=x):(v=t[6],x=t[7]),S.useEffect(v,x);let b;t[8]!==o||t[9]!==f?(b=async O=>{const W=await o.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:O,currency:f}});if(W?.isError)throw new Error(W.content?.[0]?.text??"Failed to get top-up URL");return W.structuredContent?.url},t[8]=o,t[9]=f,t[10]=b):b=t[10];let y;t[11]!==_?(y=O=>{O&&window.open(O,"_blank","noopener,noreferrer"),_()},t[11]=_,t[12]=y):y=t[12];let C;t[13]!==b||t[14]!==y?(C={mutationFn:b,onSuccess:y,onError:Mv},t[13]=b,t[14]=y,t[15]=C):C=t[15];const{mutate:j,isPending:w}=Br(C),V=parseFloat(c),k=!isNaN(V)&&V>=1;if(!a)return null;let T;t[16]!==_?(T=O=>!O&&_(),t[16]=_,t[17]=T):T=t[17];let I;t[18]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-amber-500/8 to-transparent pointer-events-none rounded-t-lg"}),t[18]=I):I=t[18];let A;t[19]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-100 dark:bg-amber-900/40 border border-amber-200/60 dark:border-amber-800/40 mx-auto",children:r.jsx(ml,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[19]=A):A=t[19];let N;t[20]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[I,r.jsxs(Ds,{className:"relative gap-3",children:[A,r.jsxs("div",{className:"text-center",children:[r.jsx(Ts,{className:"text-lg font-semibold",children:"This workspace has no credits"}),r.jsx(dl,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:"Your free credits were used in another workspace. Add credits to use AI here."})]})]})]}),t[20]=N):N=t[20];let E;t[21]!==f||t[22]!==p||t[23]!==c||t[24]!==V||t[25]!==i||t[26]!==k||t[27]!==w||t[28]!==u||t[29]!==j?(E=i&&r.jsxs("div",{className:"px-6 pb-5",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(Qh,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:O=>{O&&m(O)},children:[r.jsx(Ln,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Ln,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Iv[f].map(O=>{const{dollars:W,label:F}=O;return r.jsxs("button",{type:"button",disabled:w,onClick:()=>{j(W*100)},className:Y("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[r.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[p,W]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:F})]},W)})}),u?r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:p}),r.jsx(bt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:O=>d(O.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(re,{className:"h-10",disabled:!k||w,onClick:()=>{j(Math.round(V*100))},children:w?"Opening...":"Add"})]}):r.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>h(!0),children:"Enter custom amount"})]}),t[21]=f,t[22]=p,t[23]=c,t[24]=V,t[25]=i,t[26]=k,t[27]=w,t[28]=u,t[29]=j,t[30]=E):E=t[30];let R;t[31]!==_||t[32]!==s||t[33]!==e.slug?(R=()=>{s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),_()},t[31]=_,t[32]=s,t[33]=e.slug,t[34]=R):R=t[34];let M;t[35]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(ro,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[35]=M):M=t[35];let L;t[36]!==R?(L=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:R,children:["Use your own provider",M]}),t[36]=R,t[37]=L):L=t[37];let D;t[38]!==_?(D=r.jsx(re,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:_,children:"Skip for now"}),t[38]=_,t[39]=D):D=t[39];let P;t[40]!==L||t[41]!==D?(P=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[L,D]}),t[40]=L,t[41]=D,t[42]=P):P=t[42];let $;t[43]!==E||t[44]!==P?($=r.jsxs(ms,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Dv,children:[N,E,P]}),t[43]=E,t[44]=P,t[45]=$):$=t[45];let z;return t[46]!==$||t[47]!==T?(z=r.jsx(ps,{open:!0,onOpenChange:T,children:$}),t[46]=$,t[47]=T,t[48]=z):z=t[48],z}function Dv(t){return t.preventDefault()}function Mv(t){me.error(`Top-up failed: ${t.message}`)}function Pv(t){const e=B.c(6),{balanceDollars:s}=t;let i;e[0]!==s?(i=s.toFixed(2),e[0]=s,e[1]=i):i=e[1];const n=i;let o,a;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=Y("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-emerald-50 dark:bg-emerald-950/30","border border-emerald-200/60 dark:border-emerald-800/40","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=r.jsx(ml,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=o,e[3]=a):(o=e[2],a=e[3]);let l;return e[4]!==n?(l=r.jsxs("div",{className:o,children:[a,r.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",n," in credits to get started"]})]}),e[4]=n,e[5]=l):l=e[5],l}function Lv(){const t=B.c(8),{org:e}=ve(),s=Ke();let i;t[0]!==s||t[1]!==e.slug?(i=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=i):i=t[2];let n,o,a;t[3]===Symbol.for("react.memo_cache_sentinel")?(n=Y("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-amber-50 dark:bg-amber-950/30","border border-amber-200/60 dark:border-amber-800/40","hover:bg-amber-100/60 dark:hover:bg-amber-900/30","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),o=r.jsx(ri,{size:13,className:"text-amber-600 dark:text-amber-400"}),a=r.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:"No credits remaining · Add more"}),t[3]=n,t[4]=o,t[5]=a):(n=t[3],o=t[4],a=t[5]);let l;return t[6]!==i?(l=r.jsxs("button",{type:"button",onClick:i,className:n,children:[o,a]}),t[6]=i,t[7]=l):l=t[7],l}function Bv(t){const e=B.c(11),{className:s}=t;let i;e[0]!==s?(i=Y("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=i):i=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=n):n=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex items-center gap-3",children:[n,r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),r.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=o):o=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:r.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[o,r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),r.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=a):a=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[r.jsx(an,{align:"right",width:"w-3/4"}),r.jsx(an,{align:"left",width:"w-full",lines:3}),r.jsx(an,{align:"right",width:"w-2/3"}),r.jsx(an,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=l):l=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:r.jsx("div",{className:"relative flex-1",children:r.jsxs("div",{className:"space-y-2 p-2",children:[r.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),r.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=c):c=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center gap-1",children:r.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=d):d=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"px-4 py-4",children:r.jsx("div",{className:"mx-auto w-full max-w-2xl",children:r.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[c,r.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[d,r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),r.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=u):u=e[8];let h;return e[9]!==i?(h=r.jsxs("div",{className:i,children:[a,l,u]}),e[9]=i,e[10]=h):h=e[10],h}function an(t){const e=B.c(22),{align:s,width:i,lines:n}=t,o=i===void 0?"w-full":i,a=n===void 0?1:n,l=s==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==l?(c=Y("flex w-full gap-4 px-4 py-2",l),e[0]=l,e[1]=c):c=e[1];const d=s==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let u;e[2]!==d?(u=Y("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=h):h=e[4];const f=s==="right"?"bg-muted":"bg-transparent border border-border/40";let m;e[5]!==f||e[6]!==o?(m=Y("min-w-0 rounded-2xl p-4",f,o),e[5]=f,e[6]=o,e[7]=m):m=e[7];let p;e[8]!==a?(p=Array.from({length:a}),e[8]=a,e[9]=p):p=e[9];let g;e[10]!==a||e[11]!==p?(g=r.jsx("div",{className:"space-y-2",children:p.map((b,y)=>r.jsx("div",{className:Y("h-3 rounded bg-muted-foreground/20 animate-pulse",y===a-1?"w-3/4":"w-full"),style:{animationDelay:`${y*.1}s`}},y))}),e[10]=a,e[11]=p,e[12]=g):g=e[12];let _;e[13]!==g||e[14]!==m?(_=r.jsx("div",{className:m,children:g}),e[13]=g,e[14]=m,e[15]=_):_=e[15];let v;e[16]!==_||e[17]!==u?(v=r.jsxs("div",{className:u,children:[h,_]}),e[16]=_,e[17]=u,e[18]=v):v=e[18];let x;return e[19]!==v||e[20]!==c?(x=r.jsx("div",{className:c,children:v}),e[19]=v,e[20]=c,e[21]=x):x=e[21],x}function Ov(t){const e=B.c(5),{className:s,children:i}=t;let n;e[0]!==s?(n=Y("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=n):n=e[1];let o;return e[2]!==i||e[3]!==n?(o=r.jsx("div",{className:n,children:i}),e[2]=i,e[3]=n,e[4]=o):o=e[4],o}function $v(t){const e=B.c(5),{children:s,className:i}=t;let n;e[0]!==i?(n=Y("flex-1 min-h-0 overflow-y-auto isolate",i),e[0]=i,e[1]=n):n=e[1];let o;return e[2]!==s||e[3]!==n?(o=r.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=o):o=e[4],o}function zv(t){const e=B.c(2),{children:s}=t;let i;return e[0]!==s?(i=r.jsx("div",{className:"h-full w-full flex items-center justify-center max-w-2xl mx-auto",children:s}),e[0]=s,e[1]=i):i=e[1],i}function Fv(){const t=B.c(16),{messages:e,status:s}=Ui(),i=Op(e);let n;t[0]!==i?(n=i.at(-1),t[0]=i,t[1]=n):n=t[1];const o=n,a=s==="submitted"||s==="streaming";let l;if(t[2]!==a||t[3]!==o||t[4]!==i||t[5]!==e||t[6]!==s){const c=e.at(-1),d=!a&&c?.role==="assistant"&&c.parts.filter(Uv).some(Wv),u=!a&&c?.role==="assistant"&&c.parts.some(Hv);let h;if(t[8]!==i||t[9]!==s){let m;t[11]!==i.length||t[12]!==s?(m=(p,g)=>r.jsx(dc,{pair:p,isLastPair:!1,status:g===i.length-1?s:void 0},`pair-${p.user.id}`),t[11]=i.length,t[12]=s,t[13]=m):m=t[13],h=i.slice(0,-1).map(m),t[8]=i,t[9]=s,t[10]=h}else h=t[10];let f;t[14]!==h?(f=r.jsx("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:h}),t[14]=h,t[15]=f):f=t[15],l=r.jsxs("div",{className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",children:[f,o&&r.jsx("div",{className:Y("min-h-full min-w-0 max-w-2xl mx-auto w-full",(d||u)&&"pb-60"),children:r.jsx(dc,{pair:o,isLastPair:!0,status:s},`pair-${o?.user.id}`)})]}),t[2]=a,t[3]=o,t[4]=i,t[5]=e,t[6]=s,t[7]=l}else l=t[7];return l}function Hv(t){return"state"in t&&t.state==="approval-requested"}function Wv(t){return t.state==="input-available"}function Uv(t){return t.type==="tool-user_ask"}function Kv(t){const e=B.c(5),{children:s,className:i}=t;let n;e[0]!==i?(n=Y("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",i),e[0]=i,e[1]=n):n=e[1];let o;return e[2]!==s||e[3]!==n?(o=r.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=o):o=e[4],o}const De=Object.assign(Ov,{Main:$v,Messages:Fv,EmptyState:zv,Footer:Kv,Input:Ev,Provider:Np,ActiveTaskProvider:kp,Skeleton:Bv,IceBreakers:ex,NoAiProviderEmptyState:$g,CreditsEmptyState:Tv,CreditsEyebrow:Pv,NoCreditsEyebrow:Lv,CreditsExhaustedBanner:Nu}),qv=`You are an image generator agent. Every request of the user is somewhat related to creating, editing or varying an image. You have access to image generation tools
|
|
5
5
|
|
|
@@ -256,7 +256,7 @@ When given a research question or topic:
|
|
|
256
256
|
- Identify sources, patterns, gaps, and contradictions
|
|
257
257
|
- Deliver findings as clear, structured summaries with actionable insights
|
|
258
258
|
|
|
259
|
-
Approach every request with rigor and intellectual honesty. Always surface what is uncertain or debated, not just what is known.`,Qv=["Break any topic into key sub-questions and define scope","Synthesize information from multiple angles and sources","Distinguish facts, expert consensus, and contested claims","Identify gaps, contradictions, and emerging patterns","Deliver structured summaries with actionable insights"];function Wc(t){const e=B.c(7),{onRecruit:s,isRecruiting:i}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a Web Researcher agent that conducts thorough, rigorous research on any topic and delivers structured, actionable insights."}),e[0]=n):n=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=o):o=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsxs("div",{className:"space-y-2",children:[o,r.jsx("ul",{className:"space-y-1.5",children:Qv.map(Zv)})]}),e[2]=a):a=e[2];const l=i?"Setting up...":"Add Web Researcher";let c;return e[3]!==i||e[4]!==s||e[5]!==l?(c=r.jsxs("div",{className:"flex flex-col gap-6",children:[n,a,r.jsx(re,{onClick:s,disabled:i,className:"w-full cursor-pointer",children:l})]}),e[3]=i,e[4]=s,e[5]=l,e[6]=c):c=e[6],c}function Zv(t){return r.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[r.jsx("span",{className:"text-amber-500 mt-0.5 shrink-0",children:"+"}),t]},t)}function eb({open:t,onOpenChange:e,existingAgent:s}){const i=Rs(),n=lo(),o=yl(),[a,l]=S.useState(!1),c=Os.find(f=>f.id==="ai-research"),d=r.jsx(Ms,{icon:c.icon,name:c.title,size:"sm"}),u=async()=>{if(s){e(!1),n(s.id);return}l(!0);try{const f=await o.create.mutateAsync({title:c.title,description:"Systematic research and information synthesis assistant",icon:c.icon,status:"active",connections:[],metadata:{type:"ai-research",instructions:Jv}});ye("agent_recruit_confirmed",{template_id:"ai-research",agent_id:f.id}),e(!1),n(f.id)}catch(f){ye("agent_recruit_failed",{error:f instanceof Error?f.message:String(f)}),console.error("Failed to create Researcher agent:",f)}finally{l(!1)}},h=`Add ${c.title}`;return i?r.jsx(Si,{open:t,onOpenChange:e,children:r.jsxs(yi,{className:"h-[70dvh]",children:[r.jsx(so,{className:"px-4 pt-4 pb-4 shrink-0",children:r.jsxs("div",{className:"flex items-center gap-3",children:[d,r.jsx(bi,{className:"text-xl font-semibold",children:h})]})}),r.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:r.jsx(Wc,{onRecruit:u,isRecruiting:a})})]})}):r.jsx(ps,{open:t,onOpenChange:e,children:r.jsxs(ms,{className:"sm:max-w-[500px] p-8",children:[r.jsx(Ds,{className:"mb-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[d,r.jsx(Ts,{className:"text-xl font-semibold",children:h})]})}),r.jsx(Wc,{onRecruit:u,isRecruiting:a})]})})}function tb(t){try{const e=localStorage.getItem(`mesh:chat:recent-agents:${t}`);return e?JSON.parse(e):[]}catch{return[]}}function tr(t){const e=B.c(21),{agent:s,onSpecialClick:i,tracking:n}=t,{org:o}=ve(),a=Ke();let l;e[0]!==s.id||e[1]!==s.title||e[2]!==a||e[3]!==i||e[4]!==o||e[5]!==n.action||e[6]!==n.template_id||e[7]!==n.tile_kind?(l=()=>{if(ye("home_agent_tile_clicked",{template_id:n.template_id,agent_id:s.id,agent_title:s.title,tile_kind:n.tile_kind,action:n.action}),i)i();else{const g=crypto.randomUUID();a({to:"/$org/$taskId",params:{org:o.slug,taskId:g},search:{virtualmcpid:s.id}})}},e[0]=s.id,e[1]=s.title,e[2]=a,e[3]=i,e[4]=o,e[5]=n.action,e[6]=n.template_id,e[7]=n.tile_kind,e[8]=l):l=e[8];const c=l;let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=Y("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors","cursor-pointer","w-[100px] shrink-0","group"),e[9]=d):d=e[9];const u=`Select agent ${s.title}`;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(ao,{size:24}),e[10]=h):h=e[10];let f;e[11]!==s.icon||e[12]!==s.title?(f=r.jsx(Ms,{icon:s.icon,name:s.title,size:"md",fallbackIcon:h,className:"transition-transform group-hover:scale-110"}),e[11]=s.icon,e[12]=s.title,e[13]=f):f=e[13];let m;e[14]!==s.title?(m=r.jsx("p",{className:"text-xs sm:text-sm text-foreground text-center leading-tight line-clamp-2 break-words w-full",children:s.title}),e[14]=s.title,e[15]=m):m=e[15];let p;return e[16]!==c||e[17]!==u||e[18]!==f||e[19]!==m?(p=r.jsxs("button",{type:"button",onClick:c,className:d,"aria-label":u,children:[f,m]}),e[16]=c,e[17]=u,e[18]=f,e[19]=m,e[20]=p):p=e[20],p}function sb(){const t=B.c(8),e=Ke(),{org:s}=ve();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=Y("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors","cursor-pointer","w-[100px] shrink-0","group"),t[0]=i):i=t[0];let n;t[1]!==e||t[2]!==s.slug?(n=()=>{e({to:"/$org/settings/agents",params:{org:s.slug}})},t[1]=e,t[2]=s.slug,t[3]=n):n=t[3];let o,a;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("div",{className:"size-12 rounded-xl bg-accent flex items-center justify-center shrink-0 transition-transform group-hover:scale-110",children:r.jsx(Vl,{size:20,className:"text-foreground"})}),a=r.jsx("p",{className:"text-xs sm:text-sm text-foreground text-center leading-tight",children:"See all"}),t[4]=o,t[5]=a):(o=t[4],a=t[5]);let l;return t[6]!==n?(l=r.jsxs("button",{type:"button",className:i,"aria-label":"See all agents",onClick:n,children:[o,a]}),t[6]=n,t[7]=l):l=t[7],l}function ib(){const t=B.c(9);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={navigateOnCreate:!0},t[0]=e):e=t[0];const{createVirtualMCP:s,isCreating:i}=uu(e);let n;t[1]!==s?(n=()=>{s()},t[1]=s,t[2]=n):n=t[2];let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=Y("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors","cursor-pointer","w-[100px] shrink-0","group","disabled:opacity-50 disabled:cursor-not-allowed"),t[3]=o):o=t[3];let a,l;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"size-12 rounded-xl bg-background border-2 border-dashed border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-110",children:r.jsx(Qt,{size:20,className:"text-muted-foreground"})}),l=r.jsx("p",{className:"text-xs sm:text-sm text-foreground text-center leading-tight",children:"Create agent"}),t[4]=a,t[5]=l):(a=t[4],l=t[5]);let c;return t[6]!==i||t[7]!==n?(c=r.jsxs("button",{type:"button",onClick:n,disabled:i,className:o,"aria-label":"Create agent",children:[a,l]}),t[6]=i,t[7]=n,t[8]=c):c=t[8],c}function rb(){const t=B.c(95),e=oo(),{locator:s}=ve(),[i,n]=S.useState(!1),[o,a]=S.useState(!1),[l,c]=S.useState(!1),[d,u]=S.useState(!1),h=lo();let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=Os.find(cb),t[0]=f):f=t[0];const m=f;let p;t[1]===Symbol.for("react.memo_cache_sentinel")?(p=Os.find(lb),t[1]=p):p=t[1];const g=p;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=Os.find(ab),t[2]=_):_=t[2];const v=_;let x;t[3]===Symbol.for("react.memo_cache_sentinel")?(x=Os.find(ob),t[3]=x):x=t[3];const b=x;let y,C,j,w,V,k,T,I,A,N,E;if(t[4]!==s||t[5]!==h||t[6]!==e){const F=tb(s),G=e.filter(nb).sort((Q,oe)=>{const Se=F.indexOf(Q.id),Ne=F.indexOf(oe.id);return Se!==-1&&Ne!==-1?Se-Ne:Se!==-1?-1:Ne!==-1?1:new Date(oe.updated_at).getTime()-new Date(Q.updated_at).getTime()}).slice(0,4);let q;if(t[18]!==e){let Q;t[20]===Symbol.for("react.memo_cache_sentinel")?(Q=oe=>oe.id!==null&&(oe.metadata?.type===g.id||oe.title===g.title),t[20]=Q):Q=t[20],q=e.find(Q),t[18]=e,t[19]=q}else q=t[19];j=q;let H;if(t[21]!==e){let Q;t[23]===Symbol.for("react.memo_cache_sentinel")?(Q=oe=>oe.id!==null&&(oe.metadata?.type===v.id||oe.title===v.title),t[23]=Q):Q=t[23],H=e.find(Q),t[21]=e,t[22]=H}else H=t[22];y=H;let ee;if(t[24]!==e){let Q;t[26]===Symbol.for("react.memo_cache_sentinel")?(Q=oe=>oe.id!==null&&(oe.metadata?.type===b.id||oe.title===b.title),t[26]=Q):Q=t[26],ee=e.find(Q),t[24]=e,t[25]=ee}else ee=t[25];C=ee,w=G.length>0,V="w-full max-md:overflow-x-auto max-md:[scrollbar-width:none] max-md:[&::-webkit-scrollbar]:hidden",k="flex flex-wrap justify-center gap-1.5 max-md:flex-nowrap max-md:justify-start md:max-h-52 md:overflow-hidden",t[27]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(tr,{agent:m,onSpecialClick:()=>n(!0),tracking:{template_id:m.id,tile_kind:"template",action:"open_modal"}},m.id),t[27]=T):T=t[27];const K=j??g;let U;t[28]!==j||t[29]!==h?(U=j?()=>h(j.id):()=>a(!0),t[28]=j,t[29]=h,t[30]=U):U=t[30];const te=j?"existing":"template",X=j?"navigate":"open_modal";let J;t[31]!==te||t[32]!==X?(J={template_id:g.id,tile_kind:te,action:X},t[31]=te,t[32]=X,t[33]=J):J=t[33],t[34]!==K||t[35]!==U||t[36]!==J?(I=r.jsx(tr,{agent:K,onSpecialClick:U,tracking:J},g.id),t[34]=K,t[35]=U,t[36]=J,t[37]=I):I=t[37];const se=y??v;let he;t[38]!==y||t[39]!==h?(he=y?()=>h(y.id):()=>c(!0),t[38]=y,t[39]=h,t[40]=he):he=t[40];const ce=y?"existing":"template",pe=y?"navigate":"open_modal";let ne;t[41]!==ce||t[42]!==pe?(ne={template_id:v.id,tile_kind:ce,action:pe},t[41]=ce,t[42]=pe,t[43]=ne):ne=t[43],t[44]!==se||t[45]!==he||t[46]!==ne?(A=r.jsx(tr,{agent:se,onSpecialClick:he,tracking:ne},v.id),t[44]=se,t[45]=he,t[46]=ne,t[47]=A):A=t[47];const de=C??b;let fe;t[48]!==C||t[49]!==h?(fe=C?()=>h(C.id):()=>u(!0),t[48]=C,t[49]=h,t[50]=fe):fe=t[50];const ue=C?"existing":"template",ae=C?"navigate":"open_modal";let _e;t[51]!==ue||t[52]!==ae?(_e={template_id:b.id,tile_kind:ue,action:ae},t[51]=ue,t[52]=ae,t[53]=_e):_e=t[53],t[54]!==de||t[55]!==fe||t[56]!==_e?(N=r.jsx(tr,{agent:de,onSpecialClick:fe,tracking:_e},b.id),t[54]=de,t[55]=fe,t[56]=_e,t[57]=N):N=t[57];let Ce;t[58]!==y?.id||t[59]!==C?.id||t[60]!==j?.id?(Ce=Q=>Q.id!==j?.id&&Q.id!==y?.id&&Q.id!==C?.id,t[58]=y?.id,t[59]=C?.id,t[60]=j?.id,t[61]=Ce):Ce=t[61];let Te;t[62]!==h?(Te=Q=>r.jsx(tr,{agent:Q,onSpecialClick:()=>h(Q.id),tracking:{template_id:null,tile_kind:"recent",action:"navigate"}},Q.id??"default"),t[62]=h,t[63]=Te):Te=t[63],E=G.filter(Ce).map(Te),t[4]=s,t[5]=h,t[6]=e,t[7]=y,t[8]=C,t[9]=j,t[10]=w,t[11]=V,t[12]=k,t[13]=T,t[14]=I,t[15]=A,t[16]=N,t[17]=E}else y=t[7],C=t[8],j=t[9],w=t[10],V=t[11],k=t[12],T=t[13],I=t[14],A=t[15],N=t[16],E=t[17];let R;t[64]===Symbol.for("react.memo_cache_sentinel")?(R=r.jsx(ib,{}),t[64]=R):R=t[64];let M;t[65]!==w?(M=w&&r.jsx(sb,{}),t[65]=w,t[66]=M):M=t[66];let L;t[67]!==M||t[68]!==k||t[69]!==T||t[70]!==I||t[71]!==A||t[72]!==N||t[73]!==E?(L=r.jsxs("div",{className:k,children:[T,I,A,N,E,R,M]}),t[67]=M,t[68]=k,t[69]=T,t[70]=I,t[71]=A,t[72]=N,t[73]=E,t[74]=L):L=t[74];let D;t[75]!==V||t[76]!==L?(D=r.jsx("div",{className:V,children:L}),t[75]=V,t[76]=L,t[77]=D):D=t[77];let P;t[78]!==i?(P=r.jsx(Bn,{open:i,onOpenChange:n}),t[78]=i,t[79]=P):P=t[79];let $;t[80]!==o||t[81]!==j?($=r.jsx(cu,{open:o,onOpenChange:a,existingAgent:j}),t[80]=o,t[81]=j,t[82]=$):$=t[82];let z;t[83]!==l||t[84]!==y?(z=r.jsx(Xv,{open:l,onOpenChange:c,existingAgent:y}),t[83]=l,t[84]=y,t[85]=z):z=t[85];let O;t[86]!==d||t[87]!==C?(O=r.jsx(eb,{open:d,onOpenChange:u,existingAgent:C}),t[86]=d,t[87]=C,t[88]=O):O=t[88];let W;return t[89]!==D||t[90]!==P||t[91]!==$||t[92]!==z||t[93]!==O?(W=r.jsxs(r.Fragment,{children:[D,P,$,z,O]}),t[89]=D,t[90]=P,t[91]=$,t[92]=z,t[93]=O,t[94]=W):W=t[94],W}function nb(t){return t.id!==null&&!Mn(t.id)}function ob(t){return t.id==="ai-research"}function ab(t){return t.id==="ai-image"}function lb(t){return t.id==="site-diagnostics"}function cb(t){return t.id==="site-editor"}function db(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"w-full max-md:overflow-x-auto max-md:[scrollbar-width:none] max-md:[&::-webkit-scrollbar]:hidden",children:r.jsx("div",{className:"flex flex-wrap justify-center gap-1.5 max-md:flex-nowrap max-md:justify-start md:max-h-52 md:overflow-hidden",children:Array.from({length:7}).map(hb)})}),t[0]=e):e=t[0],e}function hb(t,e){return r.jsxs("div",{className:"flex flex-col items-center gap-3 p-2 w-[100px] shrink-0",children:[r.jsx(Bi,{className:"size-12 rounded-xl shrink-0"}),r.jsx(Bi,{className:"h-3 sm:h-4 w-full"})]},e)}function Uc(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(S.Suspense,{fallback:r.jsx(db,{}),children:r.jsx(rb,{})}),t[0]=e):e=t[0],e}function sr(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Kc(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function ub(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function fb(t){const e=B.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(mb),e[0]=s,e[1]=i):i=e[1];let n;return e[2]!==i?(n=r.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=n):n=e[3],n}function mb(t){return r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),r.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function pb(t){const e=B.c(30),{userTokens:s,assistantTokens:i,otherTokens:n}=t,o=s+i+n,a=o>0?s/o*100:0,l=o>0?i/o*100:0,c=o>0?n/o*100:0;let d;e[0]!==a?(d=a>0&&r.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=d):d=e[1];let u;e[2]!==l?(u=l>0&&r.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let h;e[4]!==c?(h=c>0&&r.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${c}%`}}),e[4]=c,e[5]=h):h=e[5];let f;e[6]!==d||e[7]!==u||e[8]!==h?(f=r.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[d,u,h]}),e[6]=d,e[7]=u,e[8]=h,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=m):m=e[10];let p;e[11]!==a?(p=a.toFixed(1),e[11]=a,e[12]=p):p=e[12];let g;e[13]!==p?(g=r.jsxs("div",{className:"flex items-center gap-1.5",children:[m,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",p,"%"]})]}),e[13]=p,e[14]=g):g=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=_):_=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let x;e[18]!==v?(x=r.jsxs("div",{className:"flex items-center gap-1.5",children:[_,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=x):x=e[19];let b;e[20]!==c||e[21]!==n?(b=n>0&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",c.toFixed(1),"%"]})]}),e[20]=c,e[21]=n,e[22]=b):b=e[22];let y;e[23]!==x||e[24]!==b||e[25]!==g?(y=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[g,x,b]}),e[23]=x,e[24]=b,e[25]=g,e[26]=y):y=e[26];let C;return e[27]!==y||e[28]!==f?(C=r.jsxs("div",{className:"flex flex-col gap-2",children:[f,y]}),e[27]=y,e[28]=f,e[29]=C):C=e[29],C}function gb(t){const e=B.c(19),{part:s}=t,i=s.input?.agent_id,n=ts(i),o=n?.title??"Subtask",a=n?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,c=s.state==="output-error",d=s.state==="approval-requested";let u;e[0]!==a||e[1]!==o?(u=r.jsx(Ms,{icon:a,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=o,e[2]=u):u=e[2];const h=c?"text-destructive":"text-foreground";let f;e[3]!==h?(f=Y("shrink-0 font-medium",h),e[3]=h,e[4]=f):f=e[4];let m;e[5]!==o||e[6]!==f?(m=r.jsx("span",{className:f,children:o}),e[5]=o,e[6]=f,e[7]=m):m=e[7];let p;e[8]!==s.input?(p=s.input?.prompt&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-muted-foreground/50",children:"·"}),r.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=p):p=e[9];let g;e[10]!==d||e[11]!==c||e[12]!==l?(g=r.jsx("span",{className:"ml-auto shrink-0",children:l?r.jsx(Ee,{size:12,className:"animate-spin text-muted-foreground"}):c?r.jsx(Bg,{size:12,className:"text-destructive"}):d?r.jsx(ri,{size:12,className:"text-warning"}):r.jsx(p_,{size:12,className:"text-emerald-500"})}),e[10]=d,e[11]=c,e[12]=l,e[13]=g):g=e[13];let _;return e[14]!==u||e[15]!==m||e[16]!==p||e[17]!==g?(_=r.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,m,p,g]}),e[14]=u,e[15]=m,e[16]=p,e[17]=g,e[18]=_):_=e[18],_}function _b(t){const e=B.c(58),{onClose:s,back:i,className:n}=t,[o,a]=S.useState(null),{messages:l}=Ui(),{tasks:c,taskId:d}=es(),{selectedModel:u,selectedVirtualMcp:h}=ni();let f,m,p,g,_,v,x,b;if(e[0]!==i||e[1]!==n||e[2]!==l||e[3]!==s||e[4]!==o?.id||e[5]!==u||e[6]!==h?.title||e[7]!==d||e[8]!==c){b=Symbol.for("react.early_return_sentinel");e:{let j;e[17]!==d?(j=J=>J.id===d,e[17]=d,e[18]=j):j=e[18];const w=c.find(j),V=Nh(l),k=[...l].reverse().find(jb),T=k?.metadata?.usage,I=k?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,A=T?.contextTokens??T?.totalTokens??0,N=I&&I>0?(A/I*100).toFixed(1):null,E=l;let R;e[19]!==E?(R=E.filter(Cb).reduce(Vb,0),e[19]=E,e[20]=R):R=e[20];const M=R,L=l;let D;e[21]!==L?(D=L.filter(wb).reduce(Sb,0),e[21]=L,e[22]=D):D=e[22];const P=D,$=Math.max(0,V.totalTokens-M-P),z=l[0],O=l.at(-1),W=z?.metadata?.created_at??w?.created_at,F=O?.metadata?.created_at??w?.updated_at,G=l.filter(yb),q=l.flatMap(vb),H=u?.modelId?ub(u.modelId):"—",ee=h?.title??"Decopilot",K=[{label:"Session",value:w?.title??"New chat"},{label:"Messages",value:G.length},{label:"Agent",value:ee},{label:"Model",value:H},{label:"Context Limit",value:I?sr(I):"—"},{label:"Session Tokens (billed)",value:V.totalTokens>0?sr(V.totalTokens):"0"},{label:"Usage",value:N!==null?`${N}%`:"—"},{label:"Input Tokens",value:V.inputTokens>0?sr(V.inputTokens):"0"},{label:"Output Tokens",value:V.outputTokens>0?sr(V.outputTokens):"0"},{label:"Reasoning Tokens",value:V.reasoningTokens>0?sr(V.reasoningTokens):"0"},{label:"Cost",value:V.cost>0?`$${V.cost<.001?V.cost.toFixed(6):V.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Kc(W)},{label:"Last Activity",value:Kc(F)}];if(!w&&G.length===0){let J;e[23]!==n?(J=Y("flex flex-col h-full w-full border-l border-border bg-background",n),e[23]=n,e[24]=J):J=e[24];let se;e[25]===Symbol.for("react.memo_cache_sentinel")?(se=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=se):se=e[25];let he;e[26]!==i?(he=i?r.jsx(aa,{size:14,className:"text-muted-foreground"}):r.jsx(ii,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=he):he=e[27];let ce;e[28]!==s||e[29]!==he?(ce=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[se,r.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:he})]}),e[28]=s,e[29]=he,e[30]=ce):ce=e[30];let pe;e[31]===Symbol.for("react.memo_cache_sentinel")?(pe=r.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:r.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=pe):pe=e[31];let ne;e[32]!==J||e[33]!==ce?(ne=r.jsxs("div",{className:J,children:[ce,pe]}),e[32]=J,e[33]=ce,e[34]=ne):ne=e[34],b=ne;break e}e[35]!==n?(v=Y("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",n),e[35]=n,e[36]=v):v=e[36];let U;e[37]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=U):U=e[37];let te;e[38]!==i?(te=i?r.jsx(aa,{size:14}):r.jsx(ii,{size:14}),e[38]=i,e[39]=te):te=e[39],e[40]!==s||e[41]!==te?(x=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[U,r.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:te})]}),e[40]=s,e[41]=te,e[42]=x):x=e[42],f="flex flex-col gap-8 p-6",m=q.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),r.jsx("div",{className:"flex flex-col gap-1",children:q.map(xb)})]}),p=r.jsx(fb,{items:K});let X;e[43]===Symbol.for("react.memo_cache_sentinel")?(X=r.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=X):X=e[43],e[44]!==P||e[45]!==$||e[46]!==M?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[X,r.jsx(pb,{userTokens:M,assistantTokens:P,otherTokens:$})]}),e[44]=P,e[45]=$,e[46]=M,e[47]=g):g=e[47],_=G.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),r.jsx("div",{className:"flex flex-col gap-1",children:G.map(J=>{const se=J.metadata?.created_at,he=o?.id===J.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(he?null:J),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:Y("shrink-0 font-medium",J.role==="user"?"text-chart-1":"text-chart-2"),children:J.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:J.id})]}),se&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(se).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),he&&r.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(J,null,2)})]},J.id)})})]})}e[0]=i,e[1]=n,e[2]=l,e[3]=s,e[4]=o?.id,e[5]=u,e[6]=h?.title,e[7]=d,e[8]=c,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=_,e[14]=v,e[15]=x,e[16]=b}else f=e[9],m=e[10],p=e[11],g=e[12],_=e[13],v=e[14],x=e[15],b=e[16];if(b!==Symbol.for("react.early_return_sentinel"))return b;let y;e[48]!==f||e[49]!==m||e[50]!==p||e[51]!==g||e[52]!==_?(y=r.jsxs("div",{className:f,children:[m,p,g,_]}),e[48]=f,e[49]=m,e[50]=p,e[51]=g,e[52]=_,e[53]=y):y=e[53];let C;return e[54]!==v||e[55]!==x||e[56]!==y?(C=r.jsxs("div",{className:v,children:[x,y]}),e[54]=v,e[55]=x,e[56]=y,e[57]=C):C=e[57],C}function xb(t,e){return r.jsx(gb,{part:t},e)}function vb(t){return(t.parts??[]).filter(bb)}function bb(t){return t.type==="tool-subtask"}function yb(t){return t.role!=="system"}function Sb(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function wb(t){return t.role==="assistant"}function Vb(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Cb(t){return t.role==="user"}function jb(t){return t.role==="assistant"&&t.metadata?.usage}function kb(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function Nb(t){const e=B.c(25),{orgId:s,userId:i,connectionId:n,vmMap:o,owner:a,repo:l,enabled:c}=t,d=c===void 0?!0:c,u=n??null;let h;e[0]!==s||e[1]!==u?(h={connectionId:u,orgId:s},e[0]=s,e[1]=u,e[2]=h):h=e[2];const f=Me(h);let m;e[3]!==a||e[4]!==l?(m={owner:a,repo:l},e[3]=a,e[4]=l,e[5]=m):m=e[5];const p=d&&!!n&&!!a&&!!l;let g;e[6]!==f||e[7]!==m||e[8]!==p?(g={client:f,toolName:"list_branches",toolArguments:m,enabled:p,staleTime:3e4,select:Rb},e[6]=f,e[7]=m,e[8]=p,e[9]=g):g=e[9];const{data:_,isLoading:v,isError:x}=wi(g);let b,y;e[10]!==i||e[11]!==o?(y=new Set(Object.keys(o?.[i]??{})),b=[...y].sort().map(Ib),e[10]=i,e[11]=o,e[12]=b,e[13]=y):(b=e[12],y=e[13]);const C=b;let j;if(e[14]!==_||e[15]!==y){const T=Array.isArray(_)?_:_?.branches??[];let I;e[17]!==y?(I=A=>!y.has(A.name),e[17]=y,e[18]=I):I=e[18],j=T.filter(Eb).filter(I).map(Ab),e[14]=_,e[15]=y,e[16]=j}else j=e[16];const w=j,V=Array.isArray(_)?null:_?.default_branch??null;let k;return e[19]!==V||e[20]!==x||e[21]!==v||e[22]!==w||e[23]!==C?(k={yours:C,others:w,defaultBase:V,isLoading:v,isError:x},e[19]=V,e[20]=x,e[21]=v,e[22]=w,e[23]=C,e[24]=k):k=e[24],k}function Ab(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Eb(t){return typeof t.name=="string"}function Ib(t){return{name:t,source:"yours"}}function Rb(t){return kb(t)}function Tb(t){const e=B.c(36),{orgId:s,userId:i,connectionId:n,owner:o,repo:a,vmMap:l,value:c,onChange:d}=t,[u,h]=S.useState(!1);let f;e[0]!==n||e[1]!==u||e[2]!==s||e[3]!==o||e[4]!==a||e[5]!==i||e[6]!==l?(f={orgId:s,userId:i,connectionId:n,vmMap:l,owner:o,repo:a,enabled:u},e[0]=n,e[1]=u,e[2]=s,e[3]=o,e[4]=a,e[5]=i,e[6]=l,e[7]=f):f=e[7];const{yours:m,others:p,isLoading:g,isError:_}=Nb(f);let v;e[8]!==d?(v=N=>{d(N),h(!1)},e[8]=d,e[9]=v):v=e[9];const x=v,b=c??"Select branch…";let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(gr,{className:"h-3.5 w-3.5"}),e[10]=y):y=e[10];let C;e[11]!==b?(C=r.jsx(oi,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[y,r.jsx("span",{className:"max-w-[200px] truncate",children:b})]})}),e[11]=b,e[12]=C):C=e[12];let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(o_,{placeholder:"Search branches…"}),e[13]=j):j=e[13];let w;e[14]!==_?(w=_&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[14]=_,e[15]=w):w=e[15];let V;e[16]!==_||e[17]!==g||e[18]!==p.length||e[19]!==m.length?(V=!_&&!g&&m.length===0&&p.length===0&&r.jsx(r_,{children:"No branches found."}),e[16]=_,e[17]=g,e[18]=p.length,e[19]=m.length,e[20]=V):V=e[20];let k;e[21]!==x||e[22]!==m?(k=m.length>0&&r.jsx(yc,{heading:"Your branches",children:m.map(N=>r.jsxs(Sc,{value:N.name,onSelect:()=>x(N.name),children:[r.jsx(gr,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"flex-1 truncate",children:N.name})]},N.name))}),e[21]=x,e[22]=m,e[23]=k):k=e[23];let T;e[24]!==p||e[25]!==x?(T=p.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(n_,{}),r.jsx(yc,{heading:"Other branches in repo",children:p.map(N=>r.jsxs(Sc,{value:N.name,onSelect:()=>x(N.name),children:[r.jsx(gr,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"flex-1 truncate",children:N.name}),N.author&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",N.author]})]},N.name))})]}),e[24]=p,e[25]=x,e[26]=T):T=e[26];let I;e[27]!==w||e[28]!==V||e[29]!==k||e[30]!==T?(I=r.jsx(ai,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:r.jsxs(a_,{children:[j,r.jsxs(l_,{children:[w,V,k,T]})]})}),e[27]=w,e[28]=V,e[29]=k,e[30]=T,e[31]=I):I=e[31];let A;return e[32]!==u||e[33]!==I||e[34]!==C?(A=r.jsxs(li,{open:u,onOpenChange:h,children:[C,I]}),e[32]=u,e[33]=I,e[34]=C,e[35]=A):A=e[35],A}const Db=["radial-gradient(ellipse 25% 220% at -5% 120%, rgba(165,149,255,0.35) 0%, transparent 100%)","radial-gradient(ellipse 25% 220% at 105% -20%, rgba(208,236,26,0.32) 0%, transparent 100%)"].join(", "),Mb="/decotexture.svg";function qc(t){const e=B.c(7),{onClick:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={backgroundImage:Db},e[0]=i):i=e[0];let n,o;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx("div",{className:"relative shrink-0 p-1.5 bg-[var(--brand-green-light)] rounded-lg border border-border",children:r.jsx(Ms,{icon:"/logos/deco%20logo.svg",name:"deco.cx",size:"xs",className:"border-0 rounded-none bg-transparent"})}),o=r.jsx("p",{className:"flex-1 relative text-sm font-medium text-foreground leading-none whitespace-nowrap",children:"Import your deco.cx site"}),e[1]=n,e[2]=o):(n=e[1],o=e[2]);let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("img",{src:Mb,alt:"","aria-hidden":!0,className:"absolute pointer-events-none",style:{width:"274.5px",height:"272.25px",left:"calc(50% + 145.5px)",top:"calc(50% + 40px)",transform:"translate(-50%, -50%)"}}),e[3]=a):a=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:"relative bg-background flex items-center justify-center size-8 rounded-md shrink-0",children:r.jsx(ro,{size:16,className:"text-foreground transition-transform group-hover:translate-x-0.5"})}),e[4]=l):l=e[4];let c;return e[5]!==s?(c=r.jsxs("button",{type:"button",onClick:s,className:"w-full relative flex items-center gap-4 px-4 py-4 rounded-lg border border-border bg-background overflow-hidden transition-colors text-left cursor-pointer group",style:i,children:[n,o,a,l]}),e[5]=s,e[6]=c):c=e[6],c}function Pb(){const t=B.c(5),{data:e}=St.useSession();let s;t[0]!==e?.user?.email?(s=lt.decoProfile(e?.user?.email),t[0]=e?.user?.email,t[1]=s):s=t[1];const i=!!e?.user?.email;let n;t[2]!==s||t[3]!==i?(n={queryKey:s,queryFn:Lb,enabled:i,staleTime:3e5},t[2]=s,t[3]=i,t[4]=n):n=t[4];const{data:o}=Fi(n);return o?.isDecoUser??!1}async function Lb(){const t=await fetch("/api/deco-sites/profile");return t.ok?t.json():{isDecoUser:!1}}function Bb(t){const e=B.c(56),{onOpenContextPanel:s}=t,{data:i}=St.useSession(),[n,o]=S.useState(!1),a=Pb(),l=Rs(),{hasDecoKey:c,isZeroBalance:d,isInitialFreeCredit:u,balanceDollars:h,hasOnlyDecoProvider:f}=co();let m;e[0]!==i?.user?.name?(m=i?.user?.name?.split(" ")[0]||"there",e[0]=i?.user?.name,e[1]=m):m=e[1];const p=m,g=c&&u&&h!=null,_=c&&d&&f;if(l){let N;e[2]!==h||e[3]!==g?(N=g&&r.jsx("div",{className:"mb-4",children:r.jsx(De.CreditsEyebrow,{balanceDollars:h})}),e[2]=h,e[3]=g,e[4]=N):N=e[4];let E;e[5]!==_?(E=_&&r.jsx("div",{className:"mb-4",children:r.jsx(De.NoCreditsEyebrow,{})}),e[5]=_,e[6]=E):E=e[6];let R;e[7]!==p?(R=r.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",p,"?"]}),e[7]=p,e[8]=R):R=e[8];let M;e[9]!==N||e[10]!==E||e[11]!==R?(M=r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center w-full",children:[N,E,R]}),e[9]=N,e[10]=E,e[11]=R,e[12]=M):M=e[12];let L;e[13]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Uc,{}),e[13]=L):L=e[13];let D;e[14]!==s?(D=r.jsxs("div",{className:"w-full flex flex-col gap-4 pb-4",children:[L,r.jsx(De.Input,{onOpenContextPanel:s,showConnectionsBanner:!0})]}),e[14]=s,e[15]=D):D=e[15];let P;e[16]!==a?(P=a&&r.jsx("div",{className:"w-full",children:r.jsx(qc,{onClick:()=>o(!0)})}),e[16]=a,e[17]=P):P=e[17];let $;e[18]!==M||e[19]!==D||e[20]!==P?($=r.jsxs("div",{className:"flex-1 relative flex flex-col items-center px-4",children:[M,D,P]}),e[18]=M,e[19]=D,e[20]=P,e[21]=$):$=e[21];let z;e[22]!==n?(z=r.jsx(Bn,{open:n,onOpenChange:o}),e[22]=n,e[23]=z):z=e[23];let O;return e[24]!==z||e[25]!==$?(O=r.jsxs(r.Fragment,{children:[$,z]}),e[24]=z,e[25]=$,e[26]=O):O=e[26],O}let v;e[27]!==h||e[28]!==g?(v=g&&r.jsx("div",{className:"mb-4",children:r.jsx(De.CreditsEyebrow,{balanceDollars:h})}),e[27]=h,e[28]=g,e[29]=v):v=e[29];let x;e[30]!==_?(x=_&&r.jsx("div",{className:"mb-4",children:r.jsx(De.NoCreditsEyebrow,{})}),e[30]=_,e[31]=x):x=e[31];let b;e[32]!==p?(b=r.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",p,"?"]}),e[32]=p,e[33]=b):b=e[33];let y;e[34]!==v||e[35]!==x||e[36]!==b?(y=r.jsxs("div",{className:"text-center mb-10",children:[v,x,b]}),e[34]=v,e[35]=x,e[36]=b,e[37]=y):y=e[37];let C;e[38]!==s?(C=r.jsx("div",{className:"w-full",children:r.jsx(De.Input,{onOpenContextPanel:s,showConnectionsBanner:!0})}),e[38]=s,e[39]=C):C=e[39];let j;e[40]!==y||e[41]!==C?(j=r.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[y,C]}),e[40]=y,e[41]=C,e[42]=j):j=e[42];let w;e[43]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx("div",{className:"w-full mt-10 mx-auto",children:r.jsx(Uc,{})}),e[43]=w):w=e[43];let V;e[44]!==j?(V=r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center w-full",children:[j,w]}),e[44]=j,e[45]=V):V=e[45];let k;e[46]!==a?(k=a&&r.jsx("div",{className:"absolute bottom-6 left-0 right-0 px-10",children:r.jsx("div",{className:"w-full max-w-[500px] mx-auto",children:r.jsx(qc,{onClick:()=>o(!0)})})}),e[46]=a,e[47]=k):k=e[47];let T;e[48]!==k||e[49]!==V?(T=r.jsxs("div",{className:"flex-1 relative flex flex-col items-center px-10",children:[V,k]}),e[48]=k,e[49]=V,e[50]=T):T=e[50];let I;e[51]!==n?(I=r.jsx(Bn,{open:n,onOpenChange:o}),e[51]=n,e[52]=I):I=e[52];let A;return e[53]!==T||e[54]!==I?(A=r.jsxs(r.Fragment,{children:[T,I]}),e[53]=T,e[54]=I,e[55]=A):A=e[55],A}function Ob(){const t=B.c(26),{org:e}=ve(),{selectedVirtualMcp:s}=ni(),{data:i}=St.useSession(),{currentBranch:n,setCurrentTaskBranch:o}=es();let a;t[0]!==e.id?(a=io(e.id),t[0]=e.id,t[1]=a):a=t[1];const c=s??a,d=ts(c.id),u=i?.user?.id??"",h=d?.metadata?.githubRepo??null,f=!!h?.connectionId&&!!u;let m;t[2]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(ao,{size:32}),t[2]=m):m=t[2];let p;t[3]!==c.icon||t[4]!==c.title?(p=r.jsx(Ms,{icon:c.icon,name:c.title,size:"lg",fallbackIcon:m,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=c.icon,t[4]=c.title,t[5]=p):p=t[5];let g;t[6]!==c.title?(g=r.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:c.title}),t[6]=c.title,t[7]=g):g=t[7];const _=c.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==_?(v=r.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:_}),t[8]=_,t[9]=v):v=t[9];let x;t[10]!==n||t[11]!==d?.metadata?.vmMap||t[12]!==h||t[13]!==e.id||t[14]!==o||t[15]!==f||t[16]!==u?(x=f&&r.jsx("div",{className:"mt-2",children:r.jsx(Tb,{orgId:e.id,userId:u,connectionId:h.connectionId,owner:h.owner,repo:h.name,vmMap:d?.metadata?.vmMap,value:n??void 0,onChange:o})}),t[10]=n,t[11]=d?.metadata?.vmMap,t[12]=h,t[13]=e.id,t[14]=o,t[15]=f,t[16]=u,t[17]=x):x=t[17];let b;t[18]!==p||t[19]!==g||t[20]!==v||t[21]!==x?(b=r.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[p,g,v,x]}),t[18]=p,t[19]=g,t[20]=v,t[21]=x,t[22]=b):b=t[22];let y;t[23]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("div",{className:"w-full max-w-3xl mx-auto",children:r.jsx(De.IceBreakers,{})}),t[23]=y):y=t[23];let C;return t[24]!==b?(C=r.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[b,y]}),t[24]=b,t[25]=C):C=t[25],C}function $b(t){const e=B.c(27),{variant:s}=t,{org:i}=ve(),n=bl(),{isChatEmpty:o}=Ui(),[a,l]=S.useState("chat"),c=co();if(n.length===0){let C;return e[0]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(De,{className:"animate-in fade-in-0 duration-200",children:r.jsx(De.Main,{className:"flex flex-col items-center",children:r.jsx(De.EmptyState,{children:r.jsx(De.NoAiProviderEmptyState,{})})})}),e[0]=C):C=e[0],C}let d;e[1]!==c.hasDecoKey||e[2]!==c.hasOnlyDecoProvider||e[3]!==c.isLoading||e[4]!==c.isZeroBalance||e[5]!==o||e[6]!==i?(d=c.hasDecoKey&&c.isZeroBalance&&c.hasOnlyDecoProvider&&!c.isLoading&&o&&!Rv(i.id),e[1]=c.hasDecoKey,e[2]=c.hasOnlyDecoProvider,e[3]=c.isLoading,e[4]=c.isZeroBalance,e[5]=o,e[6]=i,e[7]=d):d=e[7];const u=d;let h;e[8]!==u?(h=u&&r.jsx(De.CreditsEmptyState,{}),e[8]=u,e[9]=h):h=e[9];const f=a!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let m;e[10]!==f?(m=Y("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),e[10]=f,e[11]=m):m=e[11];let p;e[12]!==o||e[13]!==s?(p=o?s==="home"?r.jsx(Bb,{onOpenContextPanel:()=>l("context")}):r.jsxs(r.Fragment,{children:[r.jsx(De.Main,{children:r.jsx(Ob,{})}),r.jsx(De.Footer,{children:r.jsx(De.Input,{onOpenContextPanel:()=>l("context")})})]}):r.jsxs(r.Fragment,{children:[r.jsx(De.Main,{children:r.jsx(De.Messages,{})}),r.jsx(De.Footer,{children:r.jsx(De.Input,{onOpenContextPanel:()=>l("context")})})]}),e[12]=o,e[13]=s,e[14]=p):p=e[14];let g;e[15]!==m||e[16]!==p?(g=r.jsx("div",{className:m,children:p}),e[15]=m,e[16]=p,e[17]=g):g=e[17];const _=a==="context"?"opacity-100":"opacity-0 pointer-events-none";let v;e[18]!==_?(v=Y("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",_),e[18]=_,e[19]=v):v=e[19];let x;e[20]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(_b,{back:!0,onClose:()=>l("chat")}),e[20]=x):x=e[20];let b;e[21]!==v?(b=r.jsx("div",{className:v,children:x}),e[21]=v,e[22]=b):b=e[22];let y;return e[23]!==b||e[24]!==h||e[25]!==g?(y=r.jsxs(De,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[h,g,b]}),e[23]=b,e[24]=h,e[25]=g,e[26]=y):y=e[26],y}function Ku(t){const e=B.c(4),{variant:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(De.Skeleton,{}),e[0]=i):i=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(De.Skeleton,{}),e[1]=n):n=e[1];let o;return e[2]!==s?(o=r.jsx(Cs,{fallback:i,children:r.jsx(S.Suspense,{fallback:n,children:r.jsx($b,{variant:s})})}),e[2]=s,e[3]=o):o=e[3],o}function zb(){const t=B.c(6),{org:e,locator:s}=ve(),i=Mt();let n;t[0]!==s||t[1]!==i?(n=()=>{i.invalidateQueries({queryKey:lt.tasksPrefix(s)})},t[0]=s,t[1]=i,t[2]=n):n=t[2];let o;t[3]!==e.id||t[4]!==n?(o={orgId:e.id,onTaskStatus:n},t[3]=e.id,t[4]=n,t[5]=o):o=t[5],__(o)}function Fb(t){const e=B.c(8),{virtualMcpId:s,size:i,showAutomationBadge:n}=t,o=i===void 0?"sm":i;let a;e[0]!==o||e[1]!==s?(a=s?r.jsx(Hb,{virtualMcpId:s,size:o}):r.jsx(zs,{icon:null,name:"?",size:o}),e[0]=o,e[1]=s,e[2]=a):a=e[2];let l;e[3]!==n?(l=n&&r.jsx("span",{"aria-label":"Automation-triggered",className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:r.jsx($i,{size:10,className:"text-white"})}),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==a||e[6]!==l?(c=r.jsxs("div",{className:"relative shrink-0",children:[a,l]}),e[5]=a,e[6]=l,e[7]=c):c=e[7],c}function Hb(t){const e=B.c(6),{virtualMcpId:s,size:i}=t,n=ts(s);if(!n){let l;return e[0]!==i?(l=r.jsx(zs,{icon:null,name:"?",size:i}),e[0]=i,e[1]=l):l=e[1],l}const o=n.icon??null;let a;return e[2]!==n.title||e[3]!==i||e[4]!==o?(a=r.jsx(zs,{icon:o,name:n.title,size:i}),e[2]=n.title,e[3]=i,e[4]=o,e[5]=a):a=e[5],a}function Fs(t){const e=t?.metadata?.githubRepo;return e?.connectionId&&t?.connections?.some(i=>i.connection_id===e.connectionId)?e:null}function Wb(t){const e=B.c(42),{task:s,isActive:i,onClick:n,onArchive:o,showAutomationBadge:a}=t,l=$p(s.status),c=l.icon,d=ts(s.virtual_mcp_id);let u;e[0]!==d?(u=Fs(d),e[0]=d,e[1]=u):u=e[1];const h=u,f="button",m=0;let p;e[2]!==n?(p=$=>{$.target===$.currentTarget&&($.key==="Enter"||$.key===" ")&&($.preventDefault(),n())},e[2]=n,e[3]=p):p=e[3];const g=i?"bg-accent":"hover:bg-accent/60";let _;e[4]!==g?(_=Y("group/row flex items-center gap-3 px-2 py-1.5 rounded-md cursor-pointer transition-colors",g),e[4]=g,e[5]=_):_=e[5];let v;e[6]!==a||e[7]!==s.virtual_mcp_id?(v=r.jsx(Fb,{virtualMcpId:s.virtual_mcp_id,size:"sm",showAutomationBadge:a}),e[6]=a,e[7]=s.virtual_mcp_id,e[8]=v):v=e[8];const x=s.title||"Untitled task";let b;e[9]!==x?(b=r.jsx("div",{className:"text-sm text-foreground truncate",children:x}),e[9]=x,e[10]=b):b=e[10];let y;e[11]!==h||e[12]!==s.branch||e[13]!==s.updated_at?(y=s.updated_at&&r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground min-w-0",children:[s.branch?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"truncate font-mono",children:s.branch}),r.jsx("span",{className:"shrink-0",children:"·"})]}):h?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"truncate",children:[h.owner,"/",h.name]}),r.jsx("span",{className:"shrink-0",children:"·"})]}):null,r.jsx("span",{className:"shrink-0",children:zp(new Date(s.updated_at))})]}),e[11]=h,e[12]=s.branch,e[13]=s.updated_at,e[14]=y):y=e[14];let C;e[15]!==y||e[16]!==b?(C=r.jsxs("div",{className:"flex-1 min-w-0",children:[b,y]}),e[15]=y,e[16]=b,e[17]=C):C=e[17];const j="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",w="[grid-area:slot] flex size-7 items-center justify-center group-hover/row:invisible",V=l.label,k=14,T=Y(l.iconClassName,s.status==="in_progress"&&"animate-spin");let I;e[18]!==c||e[19]!==T?(I=r.jsx(c,{size:k,className:T}),e[18]=c,e[19]=T,e[20]=I):I=e[20];let A;e[21]!==l||e[22]!==I?(A=r.jsx("span",{className:w,"aria-label":V,children:I}),e[21]=l,e[22]=I,e[23]=A):A=e[23];let N;e[24]!==o?(N=$=>{$.stopPropagation(),o()},e[24]=o,e[25]=N):N=e[25];let E;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx(gg,{size:14}),e[26]=E):E=e[26];let R;e[27]!==N?(R=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":"Archive task",onClick:N,className:"[grid-area:slot] invisible group-hover/row:visible flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted",children:E})}),e[27]=N,e[28]=R):R=e[28];let M;e[29]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(st,{side:"right",children:"Archive"}),e[29]=M):M=e[29];let L;e[30]!==R?(L=r.jsxs(it,{children:[R,M]}),e[30]=R,e[31]=L):L=e[31];let D;e[32]!==A||e[33]!==L?(D=r.jsxs("div",{className:j,children:[A,L]}),e[32]=A,e[33]=L,e[34]=D):D=e[34];let P;return e[35]!==n||e[36]!==C||e[37]!==D||e[38]!==p||e[39]!==_||e[40]!==v?(P=r.jsxs("div",{role:f,tabIndex:m,onClick:n,onKeyDown:p,className:_,children:[v,C,D]}),e[35]=n,e[36]=C,e[37]=D,e[38]=p,e[39]=_,e[40]=v,e[41]=P):P=e[41],P}const qu={all:"All tasks",manual:"Chats",automation:"Automation"},Gu={all:"All members",mine:"Mine only"};function Ub(t){const e=B.c(57),{title:s,tasks:i,activeTaskId:n,onSelect:o,onArchive:a,onNew:l,showNewButton:c,showAutomationBadge:d,emptyLabel:u,currentUserId:h}=t,[f,m]=S.useState("all"),[p,g]=S.useState("mine");let _;e[0]!==h||e[1]!==p||e[2]!==i?(_=p==="mine"&&h?i.filter(G=>G.created_by===h):i,e[0]=h,e[1]=p,e[2]=i,e[3]=_):_=e[3];const v=_;let x;e[4]!==f||e[5]!==v?(x=f==="automation"?v.filter(Yb):f==="manual"?v.filter(Gb):v,e[4]=f,e[5]=v,e[6]=x):x=e[6];const b=x;let y;e[7]!==s?(y=r.jsx("span",{children:s}),e[7]=s,e[8]=y):y=e[8];let C;e[9]!==p?(C=r.jsx(ks,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":"Filter by member",className:"flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",children:p==="mine"?r.jsx(_g,{size:16}):r.jsx(ao,{size:16})})}),e[9]=p,e[10]=C):C=e[10];let j;e[11]!==p?(j=G=>{g(G)},e[11]=p,e[12]=j):j=e[12];let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=Object.keys(Gu),e[13]=w):w=e[13];let V;e[14]===Symbol.for("react.memo_cache_sentinel")?(V=w.map(qb),e[14]=V):V=e[14];let k;e[15]!==p||e[16]!==j?(k=r.jsx(Ns,{align:"end",children:r.jsx(hc,{value:p,onValueChange:j,children:V})}),e[15]=p,e[16]=j,e[17]=k):k=e[17];let T;e[18]!==C||e[19]!==k?(T=r.jsxs(js,{children:[C,k]}),e[18]=C,e[19]=k,e[20]=T):T=e[20];const I=f!=="all"&&"text-purple-500";let A;e[21]!==I?(A=Y("flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",I),e[21]=I,e[22]=A):A=e[22];let N;e[23]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(Og,{size:16}),e[23]=N):N=e[23];let E;e[24]!==A?(E=r.jsx(ks,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":"Filter tasks",className:A,children:N})}),e[24]=A,e[25]=E):E=e[25];let R;e[26]!==f?(R=G=>{m(G)},e[26]=f,e[27]=R):R=e[27];let M;e[28]===Symbol.for("react.memo_cache_sentinel")?(M=Object.keys(qu),e[28]=M):M=e[28];let L;e[29]===Symbol.for("react.memo_cache_sentinel")?(L=M.map(Kb),e[29]=L):L=e[29];let D;e[30]!==f||e[31]!==R?(D=r.jsx(Ns,{align:"end",children:r.jsx(hc,{value:f,onValueChange:R,children:L})}),e[30]=f,e[31]=R,e[32]=D):D=e[32];let P;e[33]!==E||e[34]!==D?(P=r.jsxs(js,{children:[E,D]}),e[33]=E,e[34]=D,e[35]=P):P=e[35];let $;e[36]!==l||e[37]!==c||e[38]!==s?($=c&&l&&r.jsx("button",{type:"button",onClick:()=>{l()},"aria-label":`New ${s.toLowerCase()}`,className:"flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",children:r.jsx(pl,{size:16})}),e[36]=l,e[37]=c,e[38]=s,e[39]=$):$=e[39];let z;e[40]!==P||e[41]!==$||e[42]!==T?(z=r.jsxs("div",{className:"flex items-center gap-0.5",children:[T,P,$]}),e[40]=P,e[41]=$,e[42]=T,e[43]=z):z=e[43];let O;e[44]!==z||e[45]!==y?(O=r.jsxs("div",{className:"pl-2 pr-1.5 h-7 flex items-center justify-between text-xs font-medium text-muted-foreground mb-1",children:[y,z]}),e[44]=z,e[45]=y,e[46]=O):O=e[46];let W;e[47]!==n||e[48]!==u||e[49]!==a||e[50]!==o||e[51]!==d||e[52]!==b?(W=b.length===0&&u?r.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground/70",children:u}):b.map(G=>r.jsx(Wb,{task:G,isActive:n===G.id,onClick:()=>{n!==G.id&&ye("tasks_panel_task_clicked",{thread_id:G.id,virtual_mcp_id:G.virtual_mcp_id??null,from_automation:!!G.fromAutomation}),o(G)},onArchive:()=>{ye("tasks_panel_task_archived",{thread_id:G.id,virtual_mcp_id:G.virtual_mcp_id??null}),a(G)},showAutomationBadge:d||G.fromAutomation},G.id)),e[47]=n,e[48]=u,e[49]=a,e[50]=o,e[51]=d,e[52]=b,e[53]=W):W=e[53];let F;return e[54]!==O||e[55]!==W?(F=r.jsxs("div",{className:"flex flex-col gap-0.5 mt-1",children:[O,W]}),e[54]=O,e[55]=W,e[56]=F):F=e[56],F}function Kb(t){return r.jsx(Lh,{value:t,children:qu[t]},t)}function qb(t){return r.jsx(Lh,{value:t,children:Gu[t]},t)}function Gb(t){return!t.fromAutomation}function Yb(t){return t.fromAutomation}function Xb(){const t=B.c(22);zb();const{data:e}=St.useSession(),s=e?.user?.id;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={owner:"me",status:"open",hasTrigger:!1},t[0]=i):i=t[0];const{tasks:n}=ia(i);let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o={owner:"all",status:"open",hasTrigger:!0},t[1]=o):o=t[1];const{tasks:a}=ia(o),{setTaskId:l,createNewTask:c}=zr();let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[2]=d):d=t[2];const u=$r(d),{locator:h,org:f}=ve(),m=Mt();let p;t[3]!==f.id?(p={connectionId:Ht,orgId:f.id},t[3]=f.id,t[4]=p):p=t[4];const g=Me(p),_=u.taskId??null;let v;t[5]!==a||t[6]!==n?(v=[...n,...a.map(Qb)].sort(Jb),t[5]=a,t[6]=n,t[7]=v):v=t[7];const x=v;let b;t[8]!==g||t[9]!==h||t[10]!==m?(b=async w=>{try{await Ap(g,w.id,{hidden:!0}),m.invalidateQueries({queryKey:lt.tasksPrefix(h)})}catch(V){const T=V;me.error(`Failed to archive task: ${T.message}`)}},t[8]=g,t[9]=h,t[10]=m,t[11]=b):b=t[11];const y=b;if(x.length===0){let w;return t[12]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx("div",{className:"h-full flex items-center justify-center p-4",children:r.jsx(Oi,{image:r.jsx(xg,{size:48,className:"text-muted-foreground"}),title:"No tasks yet",description:"Start a conversation to create your first task."})}),t[12]=w):w=t[12],w}let C;t[13]!==l?(C=w=>l(w.id,w.virtual_mcp_id),t[13]=l,t[14]=C):C=t[14];let j;return t[15]!==_||t[16]!==x||t[17]!==c||t[18]!==s||t[19]!==y||t[20]!==C?(j=r.jsx("div",{className:"flex flex-col h-full min-h-0 overflow-y-auto p-2 gap-3",children:r.jsx(Ub,{title:"Tasks",tasks:x,activeTaskId:_,onSelect:C,onArchive:y,onNew:c,showNewButton:!0,currentUserId:s})}),t[15]=_,t[16]=x,t[17]=c,t[18]=s,t[19]=y,t[20]=C,t[21]=j):j=t[21],j}function Jb(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function Qb(t){return{...t,fromAutomation:!0}}function Zb(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex flex-col h-full p-2 gap-1.5",children:Array.from({length:6}).map(e0)}),t[0]=e):e=t[0],e}function e0(t,e){return r.jsx("div",{className:"h-10 rounded-md bg-muted/60 animate-pulse"},e)}function Yu(){const t=B.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(De.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Cs,{fallback:e,children:r.jsx(S.Suspense,{fallback:r.jsx(Zb,{}),children:r.jsx(Xb,{})})}),t[1]=s):s=t[1],s}function Xu(){const t=B.c(77),{org:e}=ve(),s=Ke(),i=Vh(),{setTasksOpen:n,openTab:o}=zr(),a=e.slug,l=ve().project;let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[0]=c):c=t[0];const d=$r(c);let u;t[1]===Symbol.for("react.memo_cache_sentinel")?(u={strict:!1},t[1]=u):u=t[1];const h=vi(u),f=i.location.pathname;let m;t[2]!==l.enabledPlugins?(m=l.enabledPlugins??[],t[2]=l.enabledPlugins,t[3]=m):m=t[3];const p=m;let g;t[4]!==l.ui?(g=l.ui?.pinnedViews??[],t[4]=l.ui,t[5]=g):g=t[5];const _=g;let v,x,b,y;if(t[6]!==l.id||t[7]!==p||t[8]!==s||t[9]!==a||t[10]!==d.pluginId||t[11]!==d.taskId||t[12]!==h.virtualmcpid){let q;t[17]!==p?(q=se=>p.includes(se.pluginId),t[17]=p,t[18]=q):q=t[18];const H=Zm.filter(q),ee=h.virtualmcpid??l.id;x=!!h.virtualmcpid;const K=d.taskId??"",U=d.pluginId;let te;t[19]!==U?(te=se=>U===se,t[19]=U,t[20]=te):te=t[20],v=te;let X;t[21]!==K||t[22]!==s||t[23]!==a||t[24]!==ee?(X=se=>{const he=K||crypto.randomUUID();s({to:"/$org/$taskId/$pluginId",params:{org:a,taskId:he,pluginId:se},search:ce=>({...ce,virtualmcpid:ee})})},t[21]=K,t[22]=s,t[23]=a,t[24]=ee,t[25]=X):X=t[25],b=X;let J;t[26]!==v||t[27]!==b?(J=se=>({key:se.pluginId,label:se.label,icon:se.icon,isActive:v(se.pluginId),onClick:()=>b(se.pluginId)}),t[26]=v,t[27]=b,t[28]=J):J=t[28],y=H.map(J),t[6]=l.id,t[7]=p,t[8]=s,t[9]=a,t[10]=d.pluginId,t[11]=d.taskId,t[12]=h.virtualmcpid,t[13]=v,t[14]=x,t[15]=b,t[16]=y}else v=t[13],x=t[14],b=t[15],y=t[16];const C=y;let j;if(t[29]!==p||t[30]!==v||t[31]!==b){let q;t[33]!==p?(q=K=>p.includes(K.pluginId),t[33]=p,t[34]=q):q=t[34];const H=ep.filter(q);let ee;t[35]!==v||t[36]!==b?(ee=K=>({type:"group",group:{id:`${K.pluginId}-${K.id}`,label:K.label,items:K.items.map((U,te)=>({key:`${K.pluginId}-${K.id}-${te}`,label:U.label,icon:U.icon,isActive:v(K.pluginId),onClick:()=>b(K.pluginId)})),defaultExpanded:K.defaultExpanded??!0}}),t[35]=v,t[36]=b,t[37]=ee):ee=t[37],j=H.map(ee),t[29]=p,t[30]=v,t[31]=b,t[32]=j}else j=t[32];const w=j;let V;if(t[38]!==o||t[39]!==_){let q;t[41]!==o?(q=H=>{const ee=Fr(H.icon),K=ee.type==="icon"?Hr(ee.name):null;return{key:`app-${H.connectionId}-${H.toolName}`,label:H.label||H.toolName,icon:K?r.jsx(K,{size:16,className:"text-muted-foreground"}):ee.type==="url"?r.jsx("img",{src:ee.url,alt:"",className:"size-4 rounded"}):r.jsx(fu,{size:16,className:"text-muted-foreground"}),isActive:!1,onClick:()=>o(ra(H.connectionId,H.toolName))}},t[41]=o,t[42]=q):q=t[42],V=_.map(q),t[38]=o,t[39]=_,t[40]=V}else V=t[40];const k=V;let T;t[43]!==k?(T=k.length>0?{type:"group",group:{id:"apps",label:"Apps",items:k,defaultExpanded:!0}}:null,t[43]=k,t[44]=T):T=t[44];const I=T;let A;t[45]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(vg,{className:"size-4!"}),t[45]=A):A=t[45];const N=f===`/${a}`||f===`/${a}/`;let E;t[46]!==s||t[47]!==a||t[48]!==n?(E=()=>{n(!1),s({to:"/$org",params:{org:a}})},t[46]=s,t[47]=a,t[48]=n,t[49]=E):E=t[49];let R;t[50]!==E||t[51]!==N?(R={key:"home",label:"Home",icon:A,isActive:N,onClick:E},t[50]=E,t[51]=N,t[52]=R):R=t[52];const M=R;let L;t[53]!==p?(L=p.includes(tp),t[53]=p,t[54]=L):L=t[54];const D=L;let P;t[55]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(sp,{className:"size-4!"}),t[55]=P):P=t[55];let $;t[56]!==a||t[57]!==f?($=f.startsWith(`/${a}/settings/workflows`),t[56]=a,t[57]=f,t[58]=$):$=t[58];let z;t[59]!==s||t[60]!==a?(z=()=>s({to:"/$org/settings/workflows",params:{org:a}}),t[59]=s,t[60]=a,t[61]=z):z=t[61];let O;t[62]!==$||t[63]!==z?(O={key:"workflows",label:"Workflows",icon:P,isActive:$,onClick:z},t[62]=$,t[63]=z,t[64]=O):O=t[64];const W=O;let F;if(t[65]!==M||t[66]!==x||t[67]!==D||t[68]!==W){const q=[M];x&&D&&q.push(W),F={type:"items",items:q},t[65]=M,t[66]=x,t[67]=D,t[68]=W,t[69]=F}else F=t[69];let G;if(t[70]!==I||t[71]!==w||t[72]!==C||t[73]!==F){if(G=[F],C.length>0){let q;t[75]!==C?(q={type:"items",items:C},t[75]=C,t[76]=q):q=t[76],G.push(q)}w.length>0&&G.push(...w),I&&G.push(I),t[70]=I,t[71]=w,t[72]=C,t[73]=F,t[74]=G}else G=t[74];return G}function Ju(t){const e=B.c(3),{children:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex h-6 items-center",children:r.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=i):i=e[0];let n;return e[1]!==s?(n=r.jsxs(Ur,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[i,r.jsx(Kr,{children:r.jsx(gs,{className:"gap-0.5",children:s})})]}),e[1]=s,e[2]=n):n=e[2],n}function t0(){const t=B.c(7),s=xu().logo??vu,i=typeof s=="string"?s:s.light,n=typeof s=="string"?s:s.dark;let o;t[0]!==i?(o=r.jsx("img",{src:i,alt:"Logo",className:"size-6 object-contain dark:hidden"}),t[0]=i,t[1]=o):o=t[1];let a;t[2]!==n?(a=r.jsx("img",{src:n,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),t[2]=n,t[3]=a):a=t[3];let l;return t[4]!==o||t[5]!==a?(l=r.jsx(gu,{className:"flex items-center justify-center shrink-0 px-2 pb-0",children:r.jsxs("div",{className:"flex w-full aspect-square items-center justify-center",children:[o,a]})}),t[4]=o,t[5]=a,t[6]=l):l=t[6],l}function Qu(t){const e=B.c(15),{item:s}=t,{isMobile:i,setOpenMobile:n}=qr();let o;e[0]!==i||e[1]!==s||e[2]!==n?(o=()=>{ye("nav_item_clicked",{nav_key:s.key,nav_label:s.label,is_active:!!s.isActive}),s.onClick?.(),i&&n(!1)},e[0]=i,e[1]=s,e[2]=n,e[3]=o):o=e[3];const a=o,l=s.key,c=s.isActive&&"z-10";let d;e[4]!==c?(d=Y(c),e[4]=c,e[5]=d):d=e[5];let u;e[6]!==a||e[7]!==s.icon||e[8]!==s.isActive||e[9]!==s.label?(u=r.jsx(us,{onClick:a,isActive:s.isActive,tooltip:s.label,className:"bg-muted/75",children:s.icon}),e[6]=a,e[7]=s.icon,e[8]=s.isActive,e[9]=s.label,e[10]=u):u=e[10];let h;return e[11]!==s.key||e[12]!==d||e[13]!==u?(h=r.jsx(Zt,{className:d,children:u},l),e[11]=s.key,e[12]=d,e[13]=u,e[14]=h):h=e[14],h}function s0(t){const e=B.c(12),{section:s}=t;switch(s.type){case"divider":{let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(mu,{className:"my-2"}),e[0]=i):i=e[0],i}case"spacer":{let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex-1"}),e[1]=i):i=e[1],i}case"group":{const i=s.group.label,n=s.group.defaultExpanded;let o;e[2]!==s.group.items?(o=s.group.items.map(r0),e[2]=s.group.items,e[3]=o):o=e[3];let a;return e[4]!==s.group.defaultExpanded||e[5]!==s.group.label||e[6]!==o?(a=r.jsx(Ju,{label:i,defaultExpanded:n,children:o}),e[4]=s.group.defaultExpanded,e[5]=s.group.label,e[6]=o,e[7]=a):a=e[7],a}case"items":{let i;e[8]!==s.items?(i=s.items.map(i0),e[8]=s.items,e[9]=i):i=e[9];let n;return e[10]!==i?(n=r.jsx(Ur,{className:"pt-0 pr-0 pb-0 pl-0",children:r.jsx(Kr,{children:r.jsx(gs,{className:"gap-1.5",children:i})})}),e[10]=i,e[11]=n):n=e[11],n}}}function i0(t){return r.jsx(Qu,{item:t},t.key)}function r0(t){return r.jsx(Qu,{item:t},t.key)}function n0(t){const e=B.c(14),{sections:s,header:i,footer:n,additionalContent:o,variant:a,contentClassName:l}=t,c=a===void 0?"sidebar":a;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"h-10 shrink-0"}),children:r.jsx(t0,{})}),e[0]=d):d=e[0];let u;e[1]!==l?(u=Y("flex flex-col flex-1 px-2 py-2 gap-0",l),e[1]=l,e[2]=u):u=e[2];let h;e[3]!==s?(h=s.map(o0),e[3]=s,e[4]=h):h=e[4];let f;e[5]!==o||e[6]!==u||e[7]!==h?(f=r.jsxs(pu,{className:u,children:[h,o]}),e[5]=o,e[6]=u,e[7]=h,e[8]=f):f=e[8];let m;return e[9]!==n||e[10]!==i||e[11]!==f||e[12]!==c?(m=r.jsxs(x_,{variant:c,children:[d,i,f,n]}),e[9]=n,e[10]=i,e[11]=f,e[12]=c,e[13]=m):m=e[13],m}function o0(t,e){return r.jsx(s0,{section:t},e)}function Zu(t){const e=B.c(2);let s;return e[0]!==t?(s=r.jsx(n0,{...t}),e[0]=t,e[1]=s):s=e[1],s}Zu.Skeleton=function(){return r.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>r.jsx("div",{className:"w-full h-8",children:r.jsx(Bi,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function a0(){const t=B.c(7),s=xu().logo??vu,i=typeof s=="string"?s:s.light,n=typeof s=="string"?s:s.dark;let o;t[0]!==i?(o=r.jsx("img",{src:i,alt:"Logo",className:"size-6 object-contain dark:hidden"}),t[0]=i,t[1]=o):o=t[1];let a;t[2]!==n?(a=r.jsx("img",{src:n,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),t[2]=n,t[3]=a):a=t[3];let l;return t[4]!==o||t[5]!==a?(l=r.jsx(gu,{className:"flex items-center justify-center shrink-0 px-2 pb-0",children:r.jsxs("div",{className:"flex w-full aspect-square items-center justify-center",children:[o,a]})}),t[4]=o,t[5]=a,t[6]=l):l=t[6],l}function Gc(t){const e=B.c(15),{item:s,onClose:i}=t,n=s.isActive&&"z-10";let o;e[0]!==n?(o=Y(n),e[0]=n,e[1]=o):o=e[1];let a;e[2]!==s||e[3]!==i?(a=()=>{s.onClick?.(),i()},e[2]=s,e[3]=i,e[4]=a):a=e[4];let l;e[5]!==s.icon?(l=r.jsx("span",{className:"[&>svg]:size-8",children:s.icon}),e[5]=s.icon,e[6]=l):l=e[6];let c;e[7]!==s.isActive||e[8]!==s.label||e[9]!==a||e[10]!==l?(c=r.jsx(us,{onClick:a,isActive:s.isActive,tooltip:s.label,className:"bg-muted/75",children:l}),e[7]=s.isActive,e[8]=s.label,e[9]=a,e[10]=l,e[11]=c):c=e[11];let d;return e[12]!==o||e[13]!==c?(d=r.jsx(Zt,{className:o,children:c}),e[12]=o,e[13]=c,e[14]=d):d=e[14],d}function l0(t){const e=B.c(18),{section:s,onClose:i}=t;switch(s.type){case"divider":{let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(mu,{className:"my-2"}),e[0]=n):n=e[0],n}case"spacer":{let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx("div",{className:"flex-1"}),e[1]=n):n=e[1],n}case"group":{const n=s.group.label,o=s.group.defaultExpanded;let a;if(e[2]!==i||e[3]!==s.group.items){let c;e[5]!==i?(c=d=>r.jsx(Gc,{item:d,onClose:i},d.key),e[5]=i,e[6]=c):c=e[6],a=s.group.items.map(c),e[2]=i,e[3]=s.group.items,e[4]=a}else a=e[4];let l;return e[7]!==s.group.defaultExpanded||e[8]!==s.group.label||e[9]!==a?(l=r.jsx(Ju,{label:n,defaultExpanded:o,children:a}),e[7]=s.group.defaultExpanded,e[8]=s.group.label,e[9]=a,e[10]=l):l=e[10],l}case"items":{let n;if(e[11]!==i||e[12]!==s.items){let a;e[14]!==i?(a=l=>r.jsx(Gc,{item:l,onClose:i},l.key),e[14]=i,e[15]=a):a=e[15],n=s.items.map(a),e[11]=i,e[12]=s.items,e[13]=n}else n=e[13];let o;return e[16]!==n?(o=r.jsx(Ur,{className:"pt-0 pr-0 pb-0 pl-0",children:r.jsx(Kr,{children:r.jsx(gs,{className:"gap-1.5",children:n})})}),e[16]=n,e[17]=o):o=e[17],o}}}function c0(t){const e=B.c(12),{sections:s,onClose:i,footer:n,additionalContent:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"h-10 shrink-0"}),children:r.jsx(a0,{})}),e[0]=a):a=e[0];let l;if(e[1]!==i||e[2]!==s){let u;e[4]!==i?(u=(h,f)=>r.jsx(l0,{section:h,onClose:i},f),e[4]=i,e[5]=u):u=e[5],l=s.map(u),e[1]=i,e[2]=s,e[3]=l}else l=e[3];let c;e[6]!==o||e[7]!==l?(c=r.jsxs(pu,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[l,o]}),e[6]=o,e[7]=l,e[8]=c):c=e[8];let d;return e[9]!==n||e[10]!==c?(d=r.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[a,c,n]}),e[9]=n,e[10]=c,e[11]=d):d=e[11],d}function ef(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const d0=Vs({name:Et().min(2,"Organization name is required")});function h0(t){const e=B.c(41),{open:s,onOpenChange:i}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={resolver:Or(d0),defaultValues:{name:""}},e[0]=n):n=e[0];const o=Hi(n);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={mutationFn:f0,onSuccess:u0},e[1]=a):a=e[1];const l=Br(a),c=l.error instanceof Error?l.error.message:l.error?"Failed to create organization.":null;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsxs(kl,{children:[r.jsx(Nl,{children:"Create a new organization"}),r.jsx(Al,{children:"Set up a new organization to collaborate with others."})]}),e[2]=d):d=e[2];let u;if(e[3]!==l||e[4]!==o){let w;e[6]!==l?(w=V=>l.mutateAsync(V),e[6]=l,e[7]=w):w=e[7],u=o.handleSubmit(w),e[3]=l,e[4]=o,e[5]=u}else u=e[5];let h;e[8]!==o.formState.isSubmitting?(h=w=>{const{field:V}=w;return r.jsxs(Rt,{children:[r.jsx(rs,{children:"Organization Name"}),r.jsx(Tt,{children:r.jsx(bt,{...V,placeholder:"Acme Inc.",disabled:o.formState.isSubmitting})}),r.jsx(dg,{children:"The name of your company or organization"}),V.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",ef(V.value)]})]}),r.jsx(Dt,{})]})},e[8]=o.formState.isSubmitting,e[9]=h):h=e[9];let f;e[10]!==o.control||e[11]!==h?(f=r.jsx(It,{control:o.control,name:"name",render:h}),e[10]=o.control,e[11]=h,e[12]=f):f=e[12];let m;e[13]!==c?(m=c&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:c}),e[13]=c,e[14]=m):m=e[14];let p;e[15]!==l||e[16]!==o?(p=()=>{l.reset(),o.reset()},e[15]=l,e[16]=o,e[17]=p):p=e[17];let g;e[18]!==o.formState.isSubmitting||e[19]!==p?(g=r.jsx(Cl,{disabled:o.formState.isSubmitting,onClick:p,children:"Cancel"}),e[18]=o.formState.isSubmitting,e[19]=p,e[20]=g):g=e[20];const _=!o.formState.isValid||o.formState.isSubmitting;let v;e[21]!==o.formState.isSubmitting?(v=o.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(jr,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=o.formState.isSubmitting,e[22]=v):v=e[22];let x;e[23]!==_||e[24]!==v?(x=r.jsx(re,{type:"submit",variant:"default",disabled:_,children:v}),e[23]=_,e[24]=v,e[25]=x):x=e[25];let b;e[26]!==x||e[27]!==g?(b=r.jsxs(El,{children:[g,x]}),e[26]=x,e[27]=g,e[28]=b):b=e[28];let y;e[29]!==b||e[30]!==u||e[31]!==f||e[32]!==m?(y=r.jsxs("form",{className:"space-y-6",onSubmit:u,autoComplete:"off",children:[f,m,b]}),e[29]=b,e[30]=u,e[31]=f,e[32]=m,e[33]=y):y=e[33];let C;e[34]!==o||e[35]!==y?(C=r.jsxs(jl,{children:[d,r.jsx(Pi,{...o,children:y})]}),e[34]=o,e[35]=y,e[36]=C):C=e[36];let j;return e[37]!==i||e[38]!==s||e[39]!==C?(j=r.jsx(Il,{open:s,onOpenChange:i,children:C}),e[37]=i,e[38]=s,e[39]=C,e[40]=j):j=e[40],j}function u0(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function f0(t){const e=ef(t.name);if(!e)throw new Error("Organization slug is invalid");const s=await St.organization.create({name:t.name,slug:e});if(s?.error)throw new Error(s.error.message||"Failed to create organization");const i=s?.data?.slug??e;if(!i)throw new Error("Failed to create organization");return{orgSlug:i}}function ga(t){let e=0;for(let i=0;i<t.length;i++)e=t.charCodeAt(i)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function m0(t){const e=B.c(13),{org:s,size:i}=t,n=i===void 0?"sm":i,o=n==="xs"?"size-5":"size-6",a=n==="xs"?"text-[9px]":"text-xs";let l;e[0]!==o?(l=Y(o,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=o,e[1]=l):l=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:ga(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let d;e[5]!==s.logo||e[6]!==s.name||e[7]!==a?(d=s.logo?r.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):r.jsx("span",{className:Y("font-semibold leading-none",a),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=a,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==c||e[11]!==d?(u=r.jsx("div",{className:l,style:c,children:d}),e[9]=l,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function ln(t){const e=B.c(22),{item:s,onClose:i}=t;if(s.href){const c=s.external?"_blank":void 0,d=s.external?"noopener noreferrer":void 0;let u;e[0]!==s.icon?(u=r.jsx("span",{className:"shrink-0 text-muted-foreground",children:s.icon}),e[0]=s.icon,e[1]=u):u=e[1];let h;e[2]!==s.label?(h=r.jsx("span",{className:"flex-1",children:s.label}),e[2]=s.label,e[3]=h):h=e[3];let f;return e[4]!==s.href||e[5]!==i||e[6]!==c||e[7]!==d||e[8]!==u||e[9]!==h?(f=r.jsxs("a",{href:s.href,target:c,rel:d,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",onClick:i,children:[u,h]}),e[4]=s.href,e[5]=i,e[6]=c,e[7]=d,e[8]=u,e[9]=h,e[10]=f):f=e[10],f}let n;e[11]!==s||e[12]!==i?(n=()=>{s.onClick?.(),i()},e[11]=s,e[12]=i,e[13]=n):n=e[13];let o;e[14]!==s.icon?(o=r.jsx("span",{className:"shrink-0 text-muted-foreground",children:s.icon}),e[14]=s.icon,e[15]=o):o=e[15];let a;e[16]!==s.label?(a=r.jsx("span",{className:"flex-1",children:s.label}),e[16]=s.label,e[17]=a):a=e[17];let l;return e[18]!==n||e[19]!==o||e[20]!==a?(l=r.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",children:[o,a]}),e[18]=n,e[19]=o,e[20]=a,e[21]=l):l=e[21],l}function Yc(t){const e=B.c(16),{sortedOrgs:s,orgParam:i,onSelectOrg:n,onCreateOrg:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("span",{className:"text-sm font-medium text-muted-foreground/60",children:"Your Organizations"}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Qt,{size:16}),e[1]=l):l=e[1];let c;e[2]!==o?(c=r.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a,r.jsx("button",{type:"button",onClick:o,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:l})]}),e[2]=o,e[3]=c):c=e[3];let d;if(e[4]!==n||e[5]!==i||e[6]!==s){let f;e[8]!==n||e[9]!==i?(f=m=>r.jsxs("button",{type:"button",onClick:()=>n(m.slug),className:Y("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",m.slug===i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[r.jsx(m0,{org:m,size:"sm"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:m.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:m.slug})]}),m.slug===i&&r.jsx(Jt,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},m.id),e[8]=n,e[9]=i,e[10]=f):f=e[10],d=s.map(f),e[4]=n,e[5]=i,e[6]=s,e[7]=d}else d=e[7];let u;e[11]!==d?(u=r.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1",children:d}),e[11]=d,e[12]=u):u=e[12];let h;return e[13]!==c||e[14]!==u?(h=r.jsxs(r.Fragment,{children:[c,u]}),e[13]=c,e[14]=u,e[15]=h):h=e[15],h}function Xc(t){const e=B.c(142),{user:s,userImage:i,menuItems:n,signOutItem:o,themeOptions:a,preferences:l,setPreferences:c,sortedOrgs:d,orgParam:u,onSelectOrg:h,onCreateOrg:f,close:m,isMobile:p}=t;if(p){const K=s?.name??"U";let U;e[0]!==K||e[1]!==i?(U=r.jsx(Vc,{url:i,fallback:K,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=K,e[1]=i,e[2]=U):U=e[2];const te=s?.name??"User";let X;e[3]!==te?(X=r.jsx("p",{className:"text-sm font-medium truncate",children:te}),e[3]=te,e[4]=X):X=e[4];const J=s?.email;let se;e[5]!==J?(se=r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:J}),e[5]=J,e[6]=se):se=e[6];let he;e[7]!==X||e[8]!==se?(he=r.jsxs("div",{className:"flex-1 min-w-0",children:[X,se]}),e[7]=X,e[8]=se,e[9]=he):he=e[9];let ce;e[10]!==s?(ce=()=>{s?.id&&navigator.clipboard.writeText(s.id).then(x0)},e[10]=s,e[11]=ce):ce=e[11];let pe;e[12]===Symbol.for("react.memo_cache_sentinel")?(pe=r.jsx(Li,{size:14}),e[12]=pe):pe=e[12];let ne;e[13]!==ce?(ne=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",tabIndex:-1,onClick:ce,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:pe})}),e[13]=ce,e[14]=ne):ne=e[14];let de;e[15]===Symbol.for("react.memo_cache_sentinel")?(de=r.jsx(st,{side:"right",children:r.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=de):de=e[15];let fe;e[16]!==ne?(fe=r.jsx(Mi,{delayDuration:300,children:r.jsxs(it,{children:[ne,de]})}),e[16]=ne,e[17]=fe):fe=e[17];let ue;e[18]!==fe||e[19]!==U||e[20]!==he?(ue=r.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[U,he,fe]}),e[18]=fe,e[19]=U,e[20]=he,e[21]=ue):ue=e[21];let ae;e[22]!==f||e[23]!==h||e[24]!==u||e[25]!==d?(ae=r.jsx("div",{className:"border-b border-border pb-2",children:r.jsx(Yc,{sortedOrgs:d,orgParam:u,onSelectOrg:h,onCreateOrg:f})}),e[22]=f,e[23]=h,e[24]=u,e[25]=d,e[26]=ae):ae=e[26];let _e;if(e[27]!==m||e[28]!==n){let Pe;e[30]!==m?(Pe=Ut=>r.jsx(ln,{item:Ut,onClose:m},Ut.key),e[30]=m,e[31]=Pe):Pe=e[31],_e=n.map(Pe),e[27]=m,e[28]=n,e[29]=_e}else _e=e[29];let Ce;e[32]!==m||e[33]!==o?(Ce=r.jsx(ln,{item:o,onClose:m}),e[32]=m,e[33]=o,e[34]=Ce):Ce=e[34];let Te;e[35]!==_e||e[36]!==Ce?(Te=r.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[_e,Ce]}),e[35]=_e,e[36]=Ce,e[37]=Te):Te=e[37];let Q;e[38]!==ae||e[39]!==Te?(Q=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[ae,Te]}),e[38]=ae,e[39]=Te,e[40]=Q):Q=e[40];let oe;if(e[41]!==l.theme||e[42]!==c||e[43]!==a){let Pe;e[45]!==l.theme||e[46]!==c?(Pe=Ut=>{const{value:jt,icon:Ae,label:Ie}=Ut;return r.jsx("button",{type:"button","aria-label":Ie,onClick:()=>c(qe=>({...qe,theme:jt})),className:Y("size-8 rounded-md flex items-center justify-center transition-colors",l.theme===jt?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Ae},jt)},e[45]=l.theme,e[46]=c,e[47]=Pe):Pe=e[47],oe=a.map(Pe),e[41]=l.theme,e[42]=c,e[43]=a,e[44]=oe}else oe=e[44];let Se;e[48]!==oe?(Se=r.jsx("div",{className:"flex items-center gap-0.5",children:oe}),e[48]=oe,e[49]=Se):Se=e[49];const Ne=l.enableSounds?"Disable sounds":"Enable sounds";let Be;e[50]!==c?(Be=()=>c(_0),e[50]=c,e[51]=Be):Be=e[51];const Oe=l.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let He;e[52]!==Oe?(He=Y("size-8 rounded-md flex items-center justify-center transition-colors",Oe),e[52]=Oe,e[53]=He):He=e[53];let Je;e[54]!==l.enableSounds?(Je=l.enableSounds?r.jsx(uc,{size:14}):r.jsx(fc,{size:14}),e[54]=l.enableSounds,e[55]=Je):Je=e[55];let dt;e[56]!==Ne||e[57]!==Be||e[58]!==He||e[59]!==Je?(dt=r.jsx("button",{type:"button","aria-label":Ne,onClick:Be,className:He,children:Je}),e[56]=Ne,e[57]=Be,e[58]=He,e[59]=Je,e[60]=dt):dt=e[60];let ge;e[61]===Symbol.for("react.memo_cache_sentinel")?(ge=r.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","2.276.1"]}),e[61]=ge):ge=e[61];let ke;e[62]!==dt?(ke=r.jsxs("div",{className:"flex items-center gap-2",children:[dt,ge]}),e[62]=dt,e[63]=ke):ke=e[63];let Qe;e[64]!==Se||e[65]!==ke?(Qe=r.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[Se,ke]}),e[64]=Se,e[65]=ke,e[66]=Qe):Qe=e[66];let Ct;return e[67]!==ue||e[68]!==Q||e[69]!==Qe?(Ct=r.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[ue,Q,Qe]}),e[67]=ue,e[68]=Q,e[69]=Qe,e[70]=Ct):Ct=e[70],Ct}const g=s?.name??"U";let _;e[71]!==g||e[72]!==i?(_=r.jsx(Vc,{url:i,fallback:g,shape:"circle",size:"sm",className:"shrink-0"}),e[71]=g,e[72]=i,e[73]=_):_=e[73];const v=s?.name??"User";let x;e[74]!==v?(x=r.jsx("p",{className:"text-sm font-medium truncate",children:v}),e[74]=v,e[75]=x):x=e[75];const b=s?.email;let y;e[76]!==b?(y=r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b}),e[76]=b,e[77]=y):y=e[77];let C;e[78]!==x||e[79]!==y?(C=r.jsxs("div",{className:"flex-1 min-w-0",children:[x,y]}),e[78]=x,e[79]=y,e[80]=C):C=e[80];let j;e[81]!==s?(j=()=>{s?.id&&navigator.clipboard.writeText(s.id).then(g0)},e[81]=s,e[82]=j):j=e[82];let w;e[83]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Li,{size:14}),e[83]=w):w=e[83];let V;e[84]!==j?(V=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",tabIndex:-1,onClick:j,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:w})}),e[84]=j,e[85]=V):V=e[85];let k;e[86]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(st,{side:"right",children:r.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[86]=k):k=e[86];let T;e[87]!==V?(T=r.jsx(Mi,{delayDuration:300,children:r.jsxs(it,{children:[V,k]})}),e[87]=V,e[88]=T):T=e[88];let I;e[89]!==T||e[90]!==_||e[91]!==C?(I=r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 mx-1 mt-1",children:[_,C,T]}),e[89]=T,e[90]=_,e[91]=C,e[92]=I):I=e[92];let A;if(e[93]!==m||e[94]!==n){let K;e[96]!==m?(K=U=>r.jsx(ln,{item:U,onClose:m},U.key),e[96]=m,e[97]=K):K=e[97],A=n.map(K),e[93]=m,e[94]=n,e[95]=A}else A=e[95];let N;e[98]!==m||e[99]!==o?(N=r.jsx(ln,{item:o,onClose:m}),e[98]=m,e[99]=o,e[100]=N):N=e[100];let E;e[101]!==A||e[102]!==N?(E=r.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[A,N]}),e[101]=A,e[102]=N,e[103]=E):E=e[103];let R;if(e[104]!==l.theme||e[105]!==c||e[106]!==a){let K;e[108]!==l.theme||e[109]!==c?(K=U=>{const{value:te,icon:X,label:J}=U;return r.jsx("button",{type:"button","aria-label":J,onClick:()=>c(se=>({...se,theme:te})),className:Y("size-7 rounded-md flex items-center justify-center transition-colors",l.theme===te?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:X},te)},e[108]=l.theme,e[109]=c,e[110]=K):K=e[110],R=a.map(K),e[104]=l.theme,e[105]=c,e[106]=a,e[107]=R}else R=e[107];let M;e[111]!==R?(M=r.jsx("div",{className:"flex items-center gap-0.5",children:R}),e[111]=R,e[112]=M):M=e[112];const L=l.enableSounds?"Disable sounds":"Enable sounds";let D;e[113]!==c?(D=()=>c(p0),e[113]=c,e[114]=D):D=e[114];const P=l.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let $;e[115]!==P?($=Y("size-7 rounded-md flex items-center justify-center transition-colors",P),e[115]=P,e[116]=$):$=e[116];let z;e[117]!==l.enableSounds?(z=l.enableSounds?r.jsx(uc,{size:14}):r.jsx(fc,{size:14}),e[117]=l.enableSounds,e[118]=z):z=e[118];let O;e[119]!==L||e[120]!==D||e[121]!==$||e[122]!==z?(O=r.jsx("button",{type:"button","aria-label":L,onClick:D,className:$,children:z}),e[119]=L,e[120]=D,e[121]=$,e[122]=z,e[123]=O):O=e[123];let W;e[124]===Symbol.for("react.memo_cache_sentinel")?(W=r.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","2.276.1"]}),e[124]=W):W=e[124];let F;e[125]!==O?(F=r.jsxs("div",{className:"flex items-center gap-2",children:[O,W]}),e[125]=O,e[126]=F):F=e[126];let G;e[127]!==M||e[128]!==F?(G=r.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[M,F]}),e[127]=M,e[128]=F,e[129]=G):G=e[129];let q;e[130]!==I||e[131]!==E||e[132]!==G?(q=r.jsxs("div",{className:"w-60 shrink-0 flex flex-col border-r border-border bg-sidebar/75",children:[I,E,G]}),e[130]=I,e[131]=E,e[132]=G,e[133]=q):q=e[133];let H;e[134]!==f||e[135]!==h||e[136]!==u||e[137]!==d?(H=r.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:r.jsx(Yc,{sortedOrgs:d,orgParam:u,onSelectOrg:h,onCreateOrg:f})}),e[134]=f,e[135]=h,e[136]=u,e[137]=d,e[138]=H):H=e[138];let ee;return e[139]!==q||e[140]!==H?(ee=r.jsxs("div",{className:"flex min-h-[380px] w-full overflow-hidden",children:[q,H]}),e[139]=q,e[140]=H,e[141]=ee):ee=e[141],ee}function p0(t){return{...t,enableSounds:!t.enableSounds}}function g0(){me.success("User ID copied")}function _0(t){return{...t,enableSounds:!t.enableSounds}}function x0(){me.success("User ID copied")}function tf(){const t=B.c(50),{data:e}=St.useSession(),{data:s}=St.useListOrganizations(),i=Ke();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org",shouldThrow:!1},t[0]=n):n=t[0];const a=ip(n)?.params.org,[l,c]=Wi(),d=Rs(),[u,h]=S.useState(!1),[f,m]=S.useState(!1),p=e?.user,g=p?.image;let _;if(t[1]!==d||t[2]!==i||t[3]!==u||t[4]!==a||t[5]!==s||t[6]!==l||t[7]!==c||t[8]!==p||t[9]!==g){const b=s?.find(ee=>ee.slug===a);let y;if(t[11]!==a||t[12]!==s){let ee;t[14]!==a?(ee=(K,U)=>K.slug===a?-1:U.slug===a?1:K.name.localeCompare(U.name),t[14]=a,t[15]=ee):ee=t[15],y=[...s??[]].sort(ee),t[11]=a,t[12]=s,t[13]=y}else y=t[13];const C=y;let j;t[16]!==i?(j=ee=>{h(!1),i({to:"/$org",params:{org:ee}})},t[16]=i,t[17]=j):j=t[17];const w=j;let V;t[18]===Symbol.for("react.memo_cache_sentinel")?(V=()=>h(!1),t[18]=V):V=t[18];const k=V;let T;t[19]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(Gr,{size:16}),t[19]=T):T=t[19];let I;t[20]!==i||t[21]!==a?(I={key:"preferences",label:"Preferences",icon:T,onClick:()=>{i({to:"/$org/settings/profile",params:{org:a??""}})}},t[20]=i,t[21]=a,t[22]=I):I=t[22];let A;t[23]===Symbol.for("react.memo_cache_sentinel")?(A={key:"terms",label:"Terms of Use",icon:r.jsx(bg,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[23]=A):A=t[23];let N;t[24]===Symbol.for("react.memo_cache_sentinel")?(N={key:"privacy",label:"Privacy Policy",icon:r.jsx(yg,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[24]=N):N=t[24];let E;t[25]===Symbol.for("react.memo_cache_sentinel")?(E={key:"github",label:"decocms/studio",icon:r.jsx(rp,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[25]=E):E=t[25];let R;t[26]===Symbol.for("react.memo_cache_sentinel")?(R={key:"community",label:"Community",icon:r.jsx(ao,{size:16}),href:"https://decocms.com/discord",external:!0},t[26]=R):R=t[26];let M;t[27]===Symbol.for("react.memo_cache_sentinel")?(M={key:"homepage",label:"Homepage",icon:r.jsx(Jh,{size:16}),href:"https://decocms.com",external:!0},t[27]=M):M=t[27];let L;t[28]!==I?(L=[I,A,N,E,R,M],t[28]=I,t[29]=L):L=t[29];const D=L;let P;t[30]===Symbol.for("react.memo_cache_sentinel")?(P={key:"logout",label:"Sign out",icon:r.jsx(Ig,{size:16}),onClick:b0},t[30]=P):P=t[30];const $=P;let z;t[31]===Symbol.for("react.memo_cache_sentinel")?(z={value:"light",icon:r.jsx(C_,{size:14}),label:"Light theme"},t[31]=z):z=t[31];let O;t[32]===Symbol.for("react.memo_cache_sentinel")?(O={value:"dark",icon:r.jsx(j_,{size:14}),label:"Dark theme"},t[32]=O):O=t[32];let W;t[33]===Symbol.for("react.memo_cache_sentinel")?(W=[z,O,{value:"system",icon:r.jsx(k_,{size:14}),label:"System theme"}],t[33]=W):W=t[33];const F=W;let G;t[34]===Symbol.for("react.memo_cache_sentinel")?(G=()=>{h(!1),m(!0)},t[34]=G):G=t[34];let q;t[35]!==w||t[36]!==d||t[37]!==D||t[38]!==a||t[39]!==l||t[40]!==c||t[41]!==C||t[42]!==p||t[43]!==g?(q={user:p,userImage:g,menuItems:D,signOutItem:$,themeOptions:F,preferences:l,setPreferences:c,sortedOrgs:C,orgParam:a,onSelectOrg:w,onCreateOrg:G,close:k,isMobile:d},t[35]=w,t[36]=d,t[37]=D,t[38]=a,t[39]=l,t[40]=c,t[41]=C,t[42]=p,t[43]=g,t[44]=q):q=t[44];const H=q;_=d?r.jsxs(Si,{open:u,onOpenChange:h,direction:"bottom",children:[r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[r.jsx("div",{className:"shrink-0 size-5 rounded-md flex items-center justify-center border border-border/50 overflow-hidden",style:b?.logo?void 0:ga(b?.name??""),children:b?.logo?r.jsx("img",{src:b.logo,alt:"",className:"size-full object-cover"}):r.jsx("span",{className:"font-semibold leading-none text-[8px]",children:(b?.name??"?").slice(0,2).toUpperCase()})}),r.jsx("span",{className:"truncate",children:b?.name??"Account"})]}),r.jsxs(yi,{className:"h-[80dvh] p-0",children:[r.jsx(bi,{className:"sr-only",children:"Account"}),r.jsx(Xc,{...H})]})]}):r.jsxs(li,{open:u,onOpenChange:h,children:[r.jsx(oi,{asChild:!0,children:r.jsx(us,{tooltip:b?.name??"Account",className:"rounded-md",children:r.jsx("div",{className:"shrink-0 size-6 rounded-md flex items-center justify-center border border-border/50 overflow-hidden",style:b?.logo?void 0:ga(b?.name??""),children:b?.logo?r.jsx("img",{src:b.logo,alt:"",className:"size-full object-cover"}):r.jsx("span",{className:"font-semibold leading-none text-[9px]",children:(b?.name??"?").slice(0,2).toUpperCase()})})})}),r.jsx(ai,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[520px] p-0 flex max-h-[520px]",onCloseAutoFocus:v0,children:r.jsx(Xc,{...H})})]}),t[1]=d,t[2]=i,t[3]=u,t[4]=a,t[5]=s,t[6]=l,t[7]=c,t[8]=p,t[9]=g,t[10]=_}else _=t[10];let v;t[45]!==f?(v=r.jsx(h0,{open:f,onOpenChange:m}),t[45]=f,t[46]=v):v=t[46];let x;return t[47]!==_||t[48]!==v?(x=r.jsxs(r.Fragment,{children:[_,v]}),t[47]=_,t[48]=v,t[49]=x):x=t[49],x}function v0(t){return t.preventDefault()}function b0(){St.signOut()}function y0({invitation:t}){const[e,s]=S.useState(!1),[i,n]=S.useState(!1),o=Mt(),a=async()=>{s(!0);try{const c=await St.organization.acceptInvitation({invitationId:t.id});if(c.error)me.error(c.error.message),s(!1);else{const d=await St.organization.setActive({organizationId:t.organizationId});me.success("Invitation accepted!");const u=d?.data?.slug;window.location.href=u?`/${u}`:"/"}}catch{me.error("Failed to accept invitation"),s(!1)}},l=async()=>{n(!0);try{const c=await St.organization.rejectInvitation({invitationId:t.id});c.error?(me.error(c.error.message),n(!1)):(me.success("Invitation declined"),o.invalidateQueries())}catch{me.error("Failed to decline invitation"),n(!1)}};return r.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"You've been invited to join"}),r.jsx("p",{className:"text-sm font-medium truncate",children:t.organizationName??"Unknown organization"})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(re,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:a,disabled:e||i,"aria-label":"Accept invitation",children:r.jsx(Jt,{size:14})}),r.jsx(re,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:l,disabled:e||i,"aria-label":"Decline invitation",children:r.jsx(ii,{size:14})})]})]})}function S0(){const t=S.useContext(np),{data:e}=t.hooks.useListUserInvitations();return(e??[]).filter(i=>i.status==="pending"&&new Date(i.expiresAt)>new Date)}class w0 extends S.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,s){}render(){return this.state.hasError?null:this.props.children}}function V0(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function C0(){const t=B.c(19),e=Ke(),{org:s}=ve();let i;t[0]!==s.id?(i={connectionId:Ht,orgId:s.id},t[0]=s.id,t[1]=i):i=t[1];const n=Me(i);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o={providerId:"deco"},t[2]=o):o=t[2];let a;t[3]!==n?(a={client:n,toolName:"AI_PROVIDER_CREDITS",toolArguments:o,staleTime:6e4,select:j0},t[3]=n,t[4]=a):a=t[4];const{data:l,isPending:c,isError:d}=wi(a),u=l?.balanceCents!=null?l.balanceCents/100:null;let h;t[5]!==u||t[6]!==d||t[7]!==c?(h=c||d||u==null?"Credits":`Credits: $${u.toFixed(2)}`,t[5]=u,t[6]=d,t[7]=c,t[8]=h):h=t[8];const f=h;let m;t[9]!==u?(m=Y(u!=null&&V0(u)),t[9]=u,t[10]=m):m=t[10];let p;t[11]!==e||t[12]!==s.slug?(p=()=>e({to:"/$org/settings/ai-providers",params:{org:s.slug}}),t[11]=e,t[12]=s.slug,t[13]=p):p=t[13];let g;t[14]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx(ml,{size:24}),t[14]=g):g=t[14];let _;return t[15]!==m||t[16]!==p||t[17]!==f?(_=r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(us,{tooltip:f,className:m,onClick:p,children:g})})}),t[15]=m,t[16]=p,t[17]=f,t[18]=_):_=t[18],_}function j0(t){return t.structuredContent}function k0(){const t=B.c(1);if(!bl().some(N0))return null;let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(C0,{}),t[0]=i):i=t[0],i}function N0(t){return t.providerId==="deco"}function A0(){const t=B.c(3),[e,s]=S.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(us,{tooltip:"Connections",onClick:()=>{s(!0)},children:r.jsx(Rg,{size:24})})})}),t[0]=i):i=t[0];let n;return t[1]!==e?(n=r.jsxs(r.Fragment,{children:[i,r.jsx(Pl,{mode:"browse",open:e,onOpenChange:s,defaultTab:"all"})]}),t[1]=e,t[2]=n):n=t[2],n}function E0(){const t=B.c(11),e=S0();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(mc,{size:24}),t[0]=s):s=t[0];let i;t[1]!==e.length?(i=e.length>0&&r.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e.length,t[2]=i):i=t[2];let n;t[3]!==i?(n=r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(oi,{asChild:!0,children:r.jsxs(us,{tooltip:"Inbox",className:"relative",children:[s,i]})})})}),t[3]=i,t[4]=n):n=t[4];let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("div",{className:"px-4 py-3 border-b border-border shrink-0",children:r.jsx("h3",{className:"text-sm font-medium",children:"Inbox"})}),t[5]=o):o=t[5];let a;t[6]!==e?(a=r.jsxs(ai,{side:"right",align:"start",sideOffset:16,collisionPadding:16,className:"w-[min(400px,calc(100vw-2rem))] p-0 h-[min(650px,calc(100dvh-4rem))] flex flex-col",children:[o,e.length===0?r.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[r.jsx(mc,{size:24,className:"text-muted-foreground/50"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:"No invites pending"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Organization invitations will appear here"})]}):r.jsx("div",{className:"overflow-y-auto flex-1",children:e.map(I0)})]}),t[6]=e,t[7]=a):a=t[7];let l;return t[8]!==n||t[9]!==a?(l=r.jsxs(li,{children:[n,a]}),t[8]=n,t[9]=a,t[10]=l):l=t[10],l}function I0(t){return r.jsx(y0,{invitation:t},t.id)}function R0(){const t=B.c(6),e=Ke(),{org:s}=ve();let i;t[0]!==e||t[1]!==s.slug?(i=()=>e({to:"/$org/settings",params:{org:s.slug}}),t[0]=e,t[1]=s.slug,t[2]=i):i=t[2];let n;t[3]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(Gr,{size:24}),t[3]=n):n=t[3];let o;return t[4]!==i?(o=r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(us,{tooltip:"Settings",onClick:i,children:n})})}),t[4]=i,t[5]=o):o=t[5],o}function T0(){const t=B.c(5);let e,s,i,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(w0,{children:r.jsx(S.Suspense,{fallback:null,children:r.jsx(k0,{})})}),s=r.jsx(A0,{}),i=r.jsx(E0,{}),n=r.jsx(R0,{}),t[0]=e,t[1]=s,t[2]=i,t[3]=n):(e=t[0],s=t[1],i=t[2],n=t[3]);let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs(_u,{className:"px-2 pb-3 gap-1",children:[e,s,i,n,r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(tf,{})})})]}),t[4]=o):o=t[4],o}function D0(){const t=B.c(10),e=Ke(),{org:s}=ve(),{setOpenMobile:i}=qr();let n;t[0]!==e||t[1]!==s.slug||t[2]!==i?(n=()=>{e({to:"/$org/settings",params:{org:s.slug}}),i(!1)},t[0]=e,t[1]=s.slug,t[2]=i,t[3]=n):n=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(Gr,{}),t[4]=o):o=t[4];let a;t[5]!==n?(a=r.jsx(Zt,{children:r.jsx(us,{tooltip:"Settings",onClick:n,children:o})}),t[5]=n,t[6]=a):a=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Zt,{children:r.jsx(tf,{})}),t[7]=l):l=t[7];let c;return t[8]!==a?(c=r.jsx(_u,{children:r.jsxs(gs,{children:[a,l]})}),t[8]=a,t[9]=c):c=t[9],c}function M0(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return S.useMemo(()=>i=>{e.forEach(n=>n(i))},e)}const uo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ki(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Ll(t){return"nodeType"in t}function Wt(t){var e,s;return t?Ki(t)?t:Ll(t)&&(e=(s=t.ownerDocument)==null?void 0:s.defaultView)!=null?e:window:window}function Bl(t){const{Document:e}=Wt(t);return t instanceof e}function Xr(t){return Ki(t)?!1:t instanceof Wt(t).HTMLElement}function sf(t){return t instanceof Wt(t).SVGElement}function qi(t){return t?Ki(t)?t.document:Ll(t)?Bl(t)?t:Xr(t)||sf(t)?t.ownerDocument:document:document:document}const Es=uo?S.useLayoutEffect:S.useEffect;function Ol(t){const e=S.useRef(t);return Es(()=>{e.current=t}),S.useCallback(function(){for(var s=arguments.length,i=new Array(s),n=0;n<s;n++)i[n]=arguments[n];return e.current==null?void 0:e.current(...i)},[])}function P0(){const t=S.useRef(null),e=S.useCallback((i,n)=>{t.current=setInterval(i,n)},[]),s=S.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,s]}function Er(t,e){e===void 0&&(e=[t]);const s=S.useRef(t);return Es(()=>{s.current!==t&&(s.current=t)},e),s}function Jr(t,e){const s=S.useRef();return S.useMemo(()=>{const i=t(s.current);return s.current=i,i},[...e])}function Hn(t){const e=Ol(t),s=S.useRef(null),i=S.useCallback(n=>{n!==s.current&&e?.(n,s.current),s.current=n},[]);return[s,i]}function _a(t){const e=S.useRef();return S.useEffect(()=>{e.current=t},[t]),e.current}let Ro={};function Qr(t,e){return S.useMemo(()=>{if(e)return e;const s=Ro[t]==null?0:Ro[t]+1;return Ro[t]=s,t+"-"+s},[t,e])}function rf(t){return function(e){for(var s=arguments.length,i=new Array(s>1?s-1:0),n=1;n<s;n++)i[n-1]=arguments[n];return i.reduce((o,a)=>{const l=Object.entries(a);for(const[c,d]of l){const u=o[c];u!=null&&(o[c]=u+t*d)}return o},{...e})}}const Di=rf(1),Ir=rf(-1);function L0(t){return"clientX"in t&&"clientY"in t}function $l(t){if(!t)return!1;const{KeyboardEvent:e}=Wt(t.target);return e&&t instanceof e}function B0(t){if(!t)return!1;const{TouchEvent:e}=Wt(t.target);return e&&t instanceof e}function xa(t){if(B0(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:s}=t.touches[0];return{x:e,y:s}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:s}=t.changedTouches[0];return{x:e,y:s}}}return L0(t)?{x:t.clientX,y:t.clientY}:null}const Rr=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:s}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:s}=t;return"scaleX("+e+") scaleY("+s+")"}},Transform:{toString(t){if(t)return[Rr.Translate.toString(t),Rr.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:s,easing:i}=t;return e+" "+s+"ms "+i}}}),Jc="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function O0(t){return t.matches(Jc)?t:t.querySelector(Jc)}const $0={display:"none"};function z0(t){let{id:e,value:s}=t;return zt.createElement("div",{id:e,style:$0},s)}function F0(t){let{id:e,announcement:s,ariaLiveType:i="assertive"}=t;const n={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return zt.createElement("div",{id:e,style:n,role:"status","aria-live":i,"aria-atomic":!0},s)}function H0(){const[t,e]=S.useState("");return{announce:S.useCallback(i=>{i!=null&&e(i)},[]),announcement:t}}const nf=S.createContext(null);function W0(t){const e=S.useContext(nf);S.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function U0(){const[t]=S.useState(()=>new Set),e=S.useCallback(i=>(t.add(i),()=>t.delete(i)),[t]);return[S.useCallback(i=>{let{type:n,event:o}=i;t.forEach(a=>{var l;return(l=a[n])==null?void 0:l.call(a,o)})},[t]),e]}const K0={draggable:`
|
|
259
|
+
Approach every request with rigor and intellectual honesty. Always surface what is uncertain or debated, not just what is known.`,Qv=["Break any topic into key sub-questions and define scope","Synthesize information from multiple angles and sources","Distinguish facts, expert consensus, and contested claims","Identify gaps, contradictions, and emerging patterns","Deliver structured summaries with actionable insights"];function Wc(t){const e=B.c(7),{onRecruit:s,isRecruiting:i}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a Web Researcher agent that conducts thorough, rigorous research on any topic and delivers structured, actionable insights."}),e[0]=n):n=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=o):o=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsxs("div",{className:"space-y-2",children:[o,r.jsx("ul",{className:"space-y-1.5",children:Qv.map(Zv)})]}),e[2]=a):a=e[2];const l=i?"Setting up...":"Add Web Researcher";let c;return e[3]!==i||e[4]!==s||e[5]!==l?(c=r.jsxs("div",{className:"flex flex-col gap-6",children:[n,a,r.jsx(re,{onClick:s,disabled:i,className:"w-full cursor-pointer",children:l})]}),e[3]=i,e[4]=s,e[5]=l,e[6]=c):c=e[6],c}function Zv(t){return r.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[r.jsx("span",{className:"text-amber-500 mt-0.5 shrink-0",children:"+"}),t]},t)}function eb({open:t,onOpenChange:e,existingAgent:s}){const i=Rs(),n=lo(),o=yl(),[a,l]=S.useState(!1),c=Os.find(f=>f.id==="ai-research"),d=r.jsx(Ms,{icon:c.icon,name:c.title,size:"sm"}),u=async()=>{if(s){e(!1),n(s.id);return}l(!0);try{const f=await o.create.mutateAsync({title:c.title,description:"Systematic research and information synthesis assistant",icon:c.icon,status:"active",connections:[],metadata:{type:"ai-research",instructions:Jv}});ye("agent_recruit_confirmed",{template_id:"ai-research",agent_id:f.id}),e(!1),n(f.id)}catch(f){ye("agent_recruit_failed",{error:f instanceof Error?f.message:String(f)}),console.error("Failed to create Researcher agent:",f)}finally{l(!1)}},h=`Add ${c.title}`;return i?r.jsx(Si,{open:t,onOpenChange:e,children:r.jsxs(yi,{className:"h-[70dvh]",children:[r.jsx(so,{className:"px-4 pt-4 pb-4 shrink-0",children:r.jsxs("div",{className:"flex items-center gap-3",children:[d,r.jsx(bi,{className:"text-xl font-semibold",children:h})]})}),r.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:r.jsx(Wc,{onRecruit:u,isRecruiting:a})})]})}):r.jsx(ps,{open:t,onOpenChange:e,children:r.jsxs(ms,{className:"sm:max-w-[500px] p-8",children:[r.jsx(Ds,{className:"mb-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[d,r.jsx(Ts,{className:"text-xl font-semibold",children:h})]})}),r.jsx(Wc,{onRecruit:u,isRecruiting:a})]})})}function tb(t){try{const e=localStorage.getItem(`mesh:chat:recent-agents:${t}`);return e?JSON.parse(e):[]}catch{return[]}}function tr(t){const e=B.c(21),{agent:s,onSpecialClick:i,tracking:n}=t,{org:o}=ve(),a=Ke();let l;e[0]!==s.id||e[1]!==s.title||e[2]!==a||e[3]!==i||e[4]!==o||e[5]!==n.action||e[6]!==n.template_id||e[7]!==n.tile_kind?(l=()=>{if(ye("home_agent_tile_clicked",{template_id:n.template_id,agent_id:s.id,agent_title:s.title,tile_kind:n.tile_kind,action:n.action}),i)i();else{const g=crypto.randomUUID();a({to:"/$org/$taskId",params:{org:o.slug,taskId:g},search:{virtualmcpid:s.id}})}},e[0]=s.id,e[1]=s.title,e[2]=a,e[3]=i,e[4]=o,e[5]=n.action,e[6]=n.template_id,e[7]=n.tile_kind,e[8]=l):l=e[8];const c=l;let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=Y("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors","cursor-pointer","w-[100px] shrink-0","group"),e[9]=d):d=e[9];const u=`Select agent ${s.title}`;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(ao,{size:24}),e[10]=h):h=e[10];let f;e[11]!==s.icon||e[12]!==s.title?(f=r.jsx(Ms,{icon:s.icon,name:s.title,size:"md",fallbackIcon:h,className:"transition-transform group-hover:scale-110"}),e[11]=s.icon,e[12]=s.title,e[13]=f):f=e[13];let m;e[14]!==s.title?(m=r.jsx("p",{className:"text-xs sm:text-sm text-foreground text-center leading-tight line-clamp-2 break-words w-full",children:s.title}),e[14]=s.title,e[15]=m):m=e[15];let p;return e[16]!==c||e[17]!==u||e[18]!==f||e[19]!==m?(p=r.jsxs("button",{type:"button",onClick:c,className:d,"aria-label":u,children:[f,m]}),e[16]=c,e[17]=u,e[18]=f,e[19]=m,e[20]=p):p=e[20],p}function sb(){const t=B.c(8),e=Ke(),{org:s}=ve();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=Y("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors","cursor-pointer","w-[100px] shrink-0","group"),t[0]=i):i=t[0];let n;t[1]!==e||t[2]!==s.slug?(n=()=>{e({to:"/$org/settings/agents",params:{org:s.slug}})},t[1]=e,t[2]=s.slug,t[3]=n):n=t[3];let o,a;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("div",{className:"size-12 rounded-xl bg-accent flex items-center justify-center shrink-0 transition-transform group-hover:scale-110",children:r.jsx(Vl,{size:20,className:"text-foreground"})}),a=r.jsx("p",{className:"text-xs sm:text-sm text-foreground text-center leading-tight",children:"See all"}),t[4]=o,t[5]=a):(o=t[4],a=t[5]);let l;return t[6]!==n?(l=r.jsxs("button",{type:"button",className:i,"aria-label":"See all agents",onClick:n,children:[o,a]}),t[6]=n,t[7]=l):l=t[7],l}function ib(){const t=B.c(9);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={navigateOnCreate:!0},t[0]=e):e=t[0];const{createVirtualMCP:s,isCreating:i}=uu(e);let n;t[1]!==s?(n=()=>{s()},t[1]=s,t[2]=n):n=t[2];let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=Y("flex flex-col items-center gap-3 p-2 rounded-lg","transition-colors","cursor-pointer","w-[100px] shrink-0","group","disabled:opacity-50 disabled:cursor-not-allowed"),t[3]=o):o=t[3];let a,l;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"size-12 rounded-xl bg-background border-2 border-dashed border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-110",children:r.jsx(Qt,{size:20,className:"text-muted-foreground"})}),l=r.jsx("p",{className:"text-xs sm:text-sm text-foreground text-center leading-tight",children:"Create agent"}),t[4]=a,t[5]=l):(a=t[4],l=t[5]);let c;return t[6]!==i||t[7]!==n?(c=r.jsxs("button",{type:"button",onClick:n,disabled:i,className:o,"aria-label":"Create agent",children:[a,l]}),t[6]=i,t[7]=n,t[8]=c):c=t[8],c}function rb(){const t=B.c(95),e=oo(),{locator:s}=ve(),[i,n]=S.useState(!1),[o,a]=S.useState(!1),[l,c]=S.useState(!1),[d,u]=S.useState(!1),h=lo();let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=Os.find(cb),t[0]=f):f=t[0];const m=f;let p;t[1]===Symbol.for("react.memo_cache_sentinel")?(p=Os.find(lb),t[1]=p):p=t[1];const g=p;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=Os.find(ab),t[2]=_):_=t[2];const v=_;let x;t[3]===Symbol.for("react.memo_cache_sentinel")?(x=Os.find(ob),t[3]=x):x=t[3];const b=x;let y,C,j,w,V,k,T,I,A,N,E;if(t[4]!==s||t[5]!==h||t[6]!==e){const F=tb(s),G=e.filter(nb).sort((Q,oe)=>{const Se=F.indexOf(Q.id),Ne=F.indexOf(oe.id);return Se!==-1&&Ne!==-1?Se-Ne:Se!==-1?-1:Ne!==-1?1:new Date(oe.updated_at).getTime()-new Date(Q.updated_at).getTime()}).slice(0,4);let q;if(t[18]!==e){let Q;t[20]===Symbol.for("react.memo_cache_sentinel")?(Q=oe=>oe.id!==null&&(oe.metadata?.type===g.id||oe.title===g.title),t[20]=Q):Q=t[20],q=e.find(Q),t[18]=e,t[19]=q}else q=t[19];j=q;let H;if(t[21]!==e){let Q;t[23]===Symbol.for("react.memo_cache_sentinel")?(Q=oe=>oe.id!==null&&(oe.metadata?.type===v.id||oe.title===v.title),t[23]=Q):Q=t[23],H=e.find(Q),t[21]=e,t[22]=H}else H=t[22];y=H;let ee;if(t[24]!==e){let Q;t[26]===Symbol.for("react.memo_cache_sentinel")?(Q=oe=>oe.id!==null&&(oe.metadata?.type===b.id||oe.title===b.title),t[26]=Q):Q=t[26],ee=e.find(Q),t[24]=e,t[25]=ee}else ee=t[25];C=ee,w=G.length>0,V="w-full max-md:overflow-x-auto max-md:[scrollbar-width:none] max-md:[&::-webkit-scrollbar]:hidden",k="flex flex-wrap justify-center gap-1.5 max-md:flex-nowrap max-md:justify-start md:max-h-52 md:overflow-hidden",t[27]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(tr,{agent:m,onSpecialClick:()=>n(!0),tracking:{template_id:m.id,tile_kind:"template",action:"open_modal"}},m.id),t[27]=T):T=t[27];const K=j??g;let U;t[28]!==j||t[29]!==h?(U=j?()=>h(j.id):()=>a(!0),t[28]=j,t[29]=h,t[30]=U):U=t[30];const te=j?"existing":"template",X=j?"navigate":"open_modal";let J;t[31]!==te||t[32]!==X?(J={template_id:g.id,tile_kind:te,action:X},t[31]=te,t[32]=X,t[33]=J):J=t[33],t[34]!==K||t[35]!==U||t[36]!==J?(I=r.jsx(tr,{agent:K,onSpecialClick:U,tracking:J},g.id),t[34]=K,t[35]=U,t[36]=J,t[37]=I):I=t[37];const se=y??v;let he;t[38]!==y||t[39]!==h?(he=y?()=>h(y.id):()=>c(!0),t[38]=y,t[39]=h,t[40]=he):he=t[40];const ce=y?"existing":"template",pe=y?"navigate":"open_modal";let ne;t[41]!==ce||t[42]!==pe?(ne={template_id:v.id,tile_kind:ce,action:pe},t[41]=ce,t[42]=pe,t[43]=ne):ne=t[43],t[44]!==se||t[45]!==he||t[46]!==ne?(A=r.jsx(tr,{agent:se,onSpecialClick:he,tracking:ne},v.id),t[44]=se,t[45]=he,t[46]=ne,t[47]=A):A=t[47];const de=C??b;let fe;t[48]!==C||t[49]!==h?(fe=C?()=>h(C.id):()=>u(!0),t[48]=C,t[49]=h,t[50]=fe):fe=t[50];const ue=C?"existing":"template",ae=C?"navigate":"open_modal";let _e;t[51]!==ue||t[52]!==ae?(_e={template_id:b.id,tile_kind:ue,action:ae},t[51]=ue,t[52]=ae,t[53]=_e):_e=t[53],t[54]!==de||t[55]!==fe||t[56]!==_e?(N=r.jsx(tr,{agent:de,onSpecialClick:fe,tracking:_e},b.id),t[54]=de,t[55]=fe,t[56]=_e,t[57]=N):N=t[57];let Ce;t[58]!==y?.id||t[59]!==C?.id||t[60]!==j?.id?(Ce=Q=>Q.id!==j?.id&&Q.id!==y?.id&&Q.id!==C?.id,t[58]=y?.id,t[59]=C?.id,t[60]=j?.id,t[61]=Ce):Ce=t[61];let Te;t[62]!==h?(Te=Q=>r.jsx(tr,{agent:Q,onSpecialClick:()=>h(Q.id),tracking:{template_id:null,tile_kind:"recent",action:"navigate"}},Q.id??"default"),t[62]=h,t[63]=Te):Te=t[63],E=G.filter(Ce).map(Te),t[4]=s,t[5]=h,t[6]=e,t[7]=y,t[8]=C,t[9]=j,t[10]=w,t[11]=V,t[12]=k,t[13]=T,t[14]=I,t[15]=A,t[16]=N,t[17]=E}else y=t[7],C=t[8],j=t[9],w=t[10],V=t[11],k=t[12],T=t[13],I=t[14],A=t[15],N=t[16],E=t[17];let R;t[64]===Symbol.for("react.memo_cache_sentinel")?(R=r.jsx(ib,{}),t[64]=R):R=t[64];let M;t[65]!==w?(M=w&&r.jsx(sb,{}),t[65]=w,t[66]=M):M=t[66];let L;t[67]!==M||t[68]!==k||t[69]!==T||t[70]!==I||t[71]!==A||t[72]!==N||t[73]!==E?(L=r.jsxs("div",{className:k,children:[T,I,A,N,E,R,M]}),t[67]=M,t[68]=k,t[69]=T,t[70]=I,t[71]=A,t[72]=N,t[73]=E,t[74]=L):L=t[74];let D;t[75]!==V||t[76]!==L?(D=r.jsx("div",{className:V,children:L}),t[75]=V,t[76]=L,t[77]=D):D=t[77];let P;t[78]!==i?(P=r.jsx(Bn,{open:i,onOpenChange:n}),t[78]=i,t[79]=P):P=t[79];let $;t[80]!==o||t[81]!==j?($=r.jsx(cu,{open:o,onOpenChange:a,existingAgent:j}),t[80]=o,t[81]=j,t[82]=$):$=t[82];let z;t[83]!==l||t[84]!==y?(z=r.jsx(Xv,{open:l,onOpenChange:c,existingAgent:y}),t[83]=l,t[84]=y,t[85]=z):z=t[85];let O;t[86]!==d||t[87]!==C?(O=r.jsx(eb,{open:d,onOpenChange:u,existingAgent:C}),t[86]=d,t[87]=C,t[88]=O):O=t[88];let W;return t[89]!==D||t[90]!==P||t[91]!==$||t[92]!==z||t[93]!==O?(W=r.jsxs(r.Fragment,{children:[D,P,$,z,O]}),t[89]=D,t[90]=P,t[91]=$,t[92]=z,t[93]=O,t[94]=W):W=t[94],W}function nb(t){return t.id!==null&&!Mn(t.id)}function ob(t){return t.id==="ai-research"}function ab(t){return t.id==="ai-image"}function lb(t){return t.id==="site-diagnostics"}function cb(t){return t.id==="site-editor"}function db(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"w-full max-md:overflow-x-auto max-md:[scrollbar-width:none] max-md:[&::-webkit-scrollbar]:hidden",children:r.jsx("div",{className:"flex flex-wrap justify-center gap-1.5 max-md:flex-nowrap max-md:justify-start md:max-h-52 md:overflow-hidden",children:Array.from({length:7}).map(hb)})}),t[0]=e):e=t[0],e}function hb(t,e){return r.jsxs("div",{className:"flex flex-col items-center gap-3 p-2 w-[100px] shrink-0",children:[r.jsx(Bi,{className:"size-12 rounded-xl shrink-0"}),r.jsx(Bi,{className:"h-3 sm:h-4 w-full"})]},e)}function Uc(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(S.Suspense,{fallback:r.jsx(db,{}),children:r.jsx(rb,{})}),t[0]=e):e=t[0],e}function sr(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Kc(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function ub(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function fb(t){const e=B.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(mb),e[0]=s,e[1]=i):i=e[1];let n;return e[2]!==i?(n=r.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=n):n=e[3],n}function mb(t){return r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),r.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function pb(t){const e=B.c(30),{userTokens:s,assistantTokens:i,otherTokens:n}=t,o=s+i+n,a=o>0?s/o*100:0,l=o>0?i/o*100:0,c=o>0?n/o*100:0;let d;e[0]!==a?(d=a>0&&r.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=d):d=e[1];let u;e[2]!==l?(u=l>0&&r.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let h;e[4]!==c?(h=c>0&&r.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${c}%`}}),e[4]=c,e[5]=h):h=e[5];let f;e[6]!==d||e[7]!==u||e[8]!==h?(f=r.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[d,u,h]}),e[6]=d,e[7]=u,e[8]=h,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=m):m=e[10];let p;e[11]!==a?(p=a.toFixed(1),e[11]=a,e[12]=p):p=e[12];let g;e[13]!==p?(g=r.jsxs("div",{className:"flex items-center gap-1.5",children:[m,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",p,"%"]})]}),e[13]=p,e[14]=g):g=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=_):_=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let x;e[18]!==v?(x=r.jsxs("div",{className:"flex items-center gap-1.5",children:[_,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=x):x=e[19];let b;e[20]!==c||e[21]!==n?(b=n>0&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",c.toFixed(1),"%"]})]}),e[20]=c,e[21]=n,e[22]=b):b=e[22];let y;e[23]!==x||e[24]!==b||e[25]!==g?(y=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[g,x,b]}),e[23]=x,e[24]=b,e[25]=g,e[26]=y):y=e[26];let C;return e[27]!==y||e[28]!==f?(C=r.jsxs("div",{className:"flex flex-col gap-2",children:[f,y]}),e[27]=y,e[28]=f,e[29]=C):C=e[29],C}function gb(t){const e=B.c(19),{part:s}=t,i=s.input?.agent_id,n=ts(i),o=n?.title??"Subtask",a=n?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,c=s.state==="output-error",d=s.state==="approval-requested";let u;e[0]!==a||e[1]!==o?(u=r.jsx(Ms,{icon:a,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=o,e[2]=u):u=e[2];const h=c?"text-destructive":"text-foreground";let f;e[3]!==h?(f=Y("shrink-0 font-medium",h),e[3]=h,e[4]=f):f=e[4];let m;e[5]!==o||e[6]!==f?(m=r.jsx("span",{className:f,children:o}),e[5]=o,e[6]=f,e[7]=m):m=e[7];let p;e[8]!==s.input?(p=s.input?.prompt&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-muted-foreground/50",children:"·"}),r.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=p):p=e[9];let g;e[10]!==d||e[11]!==c||e[12]!==l?(g=r.jsx("span",{className:"ml-auto shrink-0",children:l?r.jsx(Ee,{size:12,className:"animate-spin text-muted-foreground"}):c?r.jsx(Bg,{size:12,className:"text-destructive"}):d?r.jsx(ri,{size:12,className:"text-warning"}):r.jsx(p_,{size:12,className:"text-emerald-500"})}),e[10]=d,e[11]=c,e[12]=l,e[13]=g):g=e[13];let _;return e[14]!==u||e[15]!==m||e[16]!==p||e[17]!==g?(_=r.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,m,p,g]}),e[14]=u,e[15]=m,e[16]=p,e[17]=g,e[18]=_):_=e[18],_}function _b(t){const e=B.c(58),{onClose:s,back:i,className:n}=t,[o,a]=S.useState(null),{messages:l}=Ui(),{tasks:c,taskId:d}=es(),{selectedModel:u,selectedVirtualMcp:h}=ni();let f,m,p,g,_,v,x,b;if(e[0]!==i||e[1]!==n||e[2]!==l||e[3]!==s||e[4]!==o?.id||e[5]!==u||e[6]!==h?.title||e[7]!==d||e[8]!==c){b=Symbol.for("react.early_return_sentinel");e:{let j;e[17]!==d?(j=J=>J.id===d,e[17]=d,e[18]=j):j=e[18];const w=c.find(j),V=Nh(l),k=[...l].reverse().find(jb),T=k?.metadata?.usage,I=k?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,A=T?.contextTokens??T?.totalTokens??0,N=I&&I>0?(A/I*100).toFixed(1):null,E=l;let R;e[19]!==E?(R=E.filter(Cb).reduce(Vb,0),e[19]=E,e[20]=R):R=e[20];const M=R,L=l;let D;e[21]!==L?(D=L.filter(wb).reduce(Sb,0),e[21]=L,e[22]=D):D=e[22];const P=D,$=Math.max(0,V.totalTokens-M-P),z=l[0],O=l.at(-1),W=z?.metadata?.created_at??w?.created_at,F=O?.metadata?.created_at??w?.updated_at,G=l.filter(yb),q=l.flatMap(vb),H=u?.modelId?ub(u.modelId):"—",ee=h?.title??"Decopilot",K=[{label:"Session",value:w?.title??"New chat"},{label:"Messages",value:G.length},{label:"Agent",value:ee},{label:"Model",value:H},{label:"Context Limit",value:I?sr(I):"—"},{label:"Session Tokens (billed)",value:V.totalTokens>0?sr(V.totalTokens):"0"},{label:"Usage",value:N!==null?`${N}%`:"—"},{label:"Input Tokens",value:V.inputTokens>0?sr(V.inputTokens):"0"},{label:"Output Tokens",value:V.outputTokens>0?sr(V.outputTokens):"0"},{label:"Reasoning Tokens",value:V.reasoningTokens>0?sr(V.reasoningTokens):"0"},{label:"Cost",value:V.cost>0?`$${V.cost<.001?V.cost.toFixed(6):V.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Kc(W)},{label:"Last Activity",value:Kc(F)}];if(!w&&G.length===0){let J;e[23]!==n?(J=Y("flex flex-col h-full w-full border-l border-border bg-background",n),e[23]=n,e[24]=J):J=e[24];let se;e[25]===Symbol.for("react.memo_cache_sentinel")?(se=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=se):se=e[25];let he;e[26]!==i?(he=i?r.jsx(aa,{size:14,className:"text-muted-foreground"}):r.jsx(ii,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=he):he=e[27];let ce;e[28]!==s||e[29]!==he?(ce=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[se,r.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:he})]}),e[28]=s,e[29]=he,e[30]=ce):ce=e[30];let pe;e[31]===Symbol.for("react.memo_cache_sentinel")?(pe=r.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:r.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=pe):pe=e[31];let ne;e[32]!==J||e[33]!==ce?(ne=r.jsxs("div",{className:J,children:[ce,pe]}),e[32]=J,e[33]=ce,e[34]=ne):ne=e[34],b=ne;break e}e[35]!==n?(v=Y("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",n),e[35]=n,e[36]=v):v=e[36];let U;e[37]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=U):U=e[37];let te;e[38]!==i?(te=i?r.jsx(aa,{size:14}):r.jsx(ii,{size:14}),e[38]=i,e[39]=te):te=e[39],e[40]!==s||e[41]!==te?(x=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[U,r.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:te})]}),e[40]=s,e[41]=te,e[42]=x):x=e[42],f="flex flex-col gap-8 p-6",m=q.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),r.jsx("div",{className:"flex flex-col gap-1",children:q.map(xb)})]}),p=r.jsx(fb,{items:K});let X;e[43]===Symbol.for("react.memo_cache_sentinel")?(X=r.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=X):X=e[43],e[44]!==P||e[45]!==$||e[46]!==M?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[X,r.jsx(pb,{userTokens:M,assistantTokens:P,otherTokens:$})]}),e[44]=P,e[45]=$,e[46]=M,e[47]=g):g=e[47],_=G.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),r.jsx("div",{className:"flex flex-col gap-1",children:G.map(J=>{const se=J.metadata?.created_at,he=o?.id===J.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(he?null:J),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:Y("shrink-0 font-medium",J.role==="user"?"text-chart-1":"text-chart-2"),children:J.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:J.id})]}),se&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(se).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),he&&r.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(J,null,2)})]},J.id)})})]})}e[0]=i,e[1]=n,e[2]=l,e[3]=s,e[4]=o?.id,e[5]=u,e[6]=h?.title,e[7]=d,e[8]=c,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=_,e[14]=v,e[15]=x,e[16]=b}else f=e[9],m=e[10],p=e[11],g=e[12],_=e[13],v=e[14],x=e[15],b=e[16];if(b!==Symbol.for("react.early_return_sentinel"))return b;let y;e[48]!==f||e[49]!==m||e[50]!==p||e[51]!==g||e[52]!==_?(y=r.jsxs("div",{className:f,children:[m,p,g,_]}),e[48]=f,e[49]=m,e[50]=p,e[51]=g,e[52]=_,e[53]=y):y=e[53];let C;return e[54]!==v||e[55]!==x||e[56]!==y?(C=r.jsxs("div",{className:v,children:[x,y]}),e[54]=v,e[55]=x,e[56]=y,e[57]=C):C=e[57],C}function xb(t,e){return r.jsx(gb,{part:t},e)}function vb(t){return(t.parts??[]).filter(bb)}function bb(t){return t.type==="tool-subtask"}function yb(t){return t.role!=="system"}function Sb(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function wb(t){return t.role==="assistant"}function Vb(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Cb(t){return t.role==="user"}function jb(t){return t.role==="assistant"&&t.metadata?.usage}function kb(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function Nb(t){const e=B.c(25),{orgId:s,userId:i,connectionId:n,vmMap:o,owner:a,repo:l,enabled:c}=t,d=c===void 0?!0:c,u=n??null;let h;e[0]!==s||e[1]!==u?(h={connectionId:u,orgId:s},e[0]=s,e[1]=u,e[2]=h):h=e[2];const f=Me(h);let m;e[3]!==a||e[4]!==l?(m={owner:a,repo:l},e[3]=a,e[4]=l,e[5]=m):m=e[5];const p=d&&!!n&&!!a&&!!l;let g;e[6]!==f||e[7]!==m||e[8]!==p?(g={client:f,toolName:"list_branches",toolArguments:m,enabled:p,staleTime:3e4,select:Rb},e[6]=f,e[7]=m,e[8]=p,e[9]=g):g=e[9];const{data:_,isLoading:v,isError:x}=wi(g);let b,y;e[10]!==i||e[11]!==o?(y=new Set(Object.keys(o?.[i]??{})),b=[...y].sort().map(Ib),e[10]=i,e[11]=o,e[12]=b,e[13]=y):(b=e[12],y=e[13]);const C=b;let j;if(e[14]!==_||e[15]!==y){const T=Array.isArray(_)?_:_?.branches??[];let I;e[17]!==y?(I=A=>!y.has(A.name),e[17]=y,e[18]=I):I=e[18],j=T.filter(Eb).filter(I).map(Ab),e[14]=_,e[15]=y,e[16]=j}else j=e[16];const w=j,V=Array.isArray(_)?null:_?.default_branch??null;let k;return e[19]!==V||e[20]!==x||e[21]!==v||e[22]!==w||e[23]!==C?(k={yours:C,others:w,defaultBase:V,isLoading:v,isError:x},e[19]=V,e[20]=x,e[21]=v,e[22]=w,e[23]=C,e[24]=k):k=e[24],k}function Ab(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Eb(t){return typeof t.name=="string"}function Ib(t){return{name:t,source:"yours"}}function Rb(t){return kb(t)}function Tb(t){const e=B.c(36),{orgId:s,userId:i,connectionId:n,owner:o,repo:a,vmMap:l,value:c,onChange:d}=t,[u,h]=S.useState(!1);let f;e[0]!==n||e[1]!==u||e[2]!==s||e[3]!==o||e[4]!==a||e[5]!==i||e[6]!==l?(f={orgId:s,userId:i,connectionId:n,vmMap:l,owner:o,repo:a,enabled:u},e[0]=n,e[1]=u,e[2]=s,e[3]=o,e[4]=a,e[5]=i,e[6]=l,e[7]=f):f=e[7];const{yours:m,others:p,isLoading:g,isError:_}=Nb(f);let v;e[8]!==d?(v=N=>{d(N),h(!1)},e[8]=d,e[9]=v):v=e[9];const x=v,b=c??"Select branch…";let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(gr,{className:"h-3.5 w-3.5"}),e[10]=y):y=e[10];let C;e[11]!==b?(C=r.jsx(oi,{asChild:!0,children:r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[y,r.jsx("span",{className:"max-w-[200px] truncate",children:b})]})}),e[11]=b,e[12]=C):C=e[12];let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(o_,{placeholder:"Search branches…"}),e[13]=j):j=e[13];let w;e[14]!==_?(w=_&&r.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[14]=_,e[15]=w):w=e[15];let V;e[16]!==_||e[17]!==g||e[18]!==p.length||e[19]!==m.length?(V=!_&&!g&&m.length===0&&p.length===0&&r.jsx(r_,{children:"No branches found."}),e[16]=_,e[17]=g,e[18]=p.length,e[19]=m.length,e[20]=V):V=e[20];let k;e[21]!==x||e[22]!==m?(k=m.length>0&&r.jsx(yc,{heading:"Your branches",children:m.map(N=>r.jsxs(Sc,{value:N.name,onSelect:()=>x(N.name),children:[r.jsx(gr,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"flex-1 truncate",children:N.name})]},N.name))}),e[21]=x,e[22]=m,e[23]=k):k=e[23];let T;e[24]!==p||e[25]!==x?(T=p.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(n_,{}),r.jsx(yc,{heading:"Other branches in repo",children:p.map(N=>r.jsxs(Sc,{value:N.name,onSelect:()=>x(N.name),children:[r.jsx(gr,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"flex-1 truncate",children:N.name}),N.author&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",N.author]})]},N.name))})]}),e[24]=p,e[25]=x,e[26]=T):T=e[26];let I;e[27]!==w||e[28]!==V||e[29]!==k||e[30]!==T?(I=r.jsx(ai,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:r.jsxs(a_,{children:[j,r.jsxs(l_,{children:[w,V,k,T]})]})}),e[27]=w,e[28]=V,e[29]=k,e[30]=T,e[31]=I):I=e[31];let A;return e[32]!==u||e[33]!==I||e[34]!==C?(A=r.jsxs(li,{open:u,onOpenChange:h,children:[C,I]}),e[32]=u,e[33]=I,e[34]=C,e[35]=A):A=e[35],A}const Db=["radial-gradient(ellipse 25% 220% at -5% 120%, rgba(165,149,255,0.35) 0%, transparent 100%)","radial-gradient(ellipse 25% 220% at 105% -20%, rgba(208,236,26,0.32) 0%, transparent 100%)"].join(", "),Mb="/decotexture.svg";function qc(t){const e=B.c(7),{onClick:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={backgroundImage:Db},e[0]=i):i=e[0];let n,o;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx("div",{className:"relative shrink-0 p-1.5 bg-[var(--brand-green-light)] rounded-lg border border-border",children:r.jsx(Ms,{icon:"/logos/deco%20logo.svg",name:"deco.cx",size:"xs",className:"border-0 rounded-none bg-transparent"})}),o=r.jsx("p",{className:"flex-1 relative text-sm font-medium text-foreground leading-none whitespace-nowrap",children:"Import your deco.cx site"}),e[1]=n,e[2]=o):(n=e[1],o=e[2]);let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("img",{src:Mb,alt:"","aria-hidden":!0,className:"absolute pointer-events-none",style:{width:"274.5px",height:"272.25px",left:"calc(50% + 145.5px)",top:"calc(50% + 40px)",transform:"translate(-50%, -50%)"}}),e[3]=a):a=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("div",{className:"relative bg-background flex items-center justify-center size-8 rounded-md shrink-0",children:r.jsx(ro,{size:16,className:"text-foreground transition-transform group-hover:translate-x-0.5"})}),e[4]=l):l=e[4];let c;return e[5]!==s?(c=r.jsxs("button",{type:"button",onClick:s,className:"w-full relative flex items-center gap-4 px-4 py-4 rounded-lg border border-border bg-background overflow-hidden transition-colors text-left cursor-pointer group",style:i,children:[n,o,a,l]}),e[5]=s,e[6]=c):c=e[6],c}function Pb(){const t=B.c(5),{data:e}=St.useSession();let s;t[0]!==e?.user?.email?(s=lt.decoProfile(e?.user?.email),t[0]=e?.user?.email,t[1]=s):s=t[1];const i=!!e?.user?.email;let n;t[2]!==s||t[3]!==i?(n={queryKey:s,queryFn:Lb,enabled:i,staleTime:3e5},t[2]=s,t[3]=i,t[4]=n):n=t[4];const{data:o}=Fi(n);return o?.isDecoUser??!1}async function Lb(){const t=await fetch("/api/deco-sites/profile");return t.ok?t.json():{isDecoUser:!1}}function Bb(t){const e=B.c(56),{onOpenContextPanel:s}=t,{data:i}=St.useSession(),[n,o]=S.useState(!1),a=Pb(),l=Rs(),{hasDecoKey:c,isZeroBalance:d,isInitialFreeCredit:u,balanceDollars:h,hasOnlyDecoProvider:f}=co();let m;e[0]!==i?.user?.name?(m=i?.user?.name?.split(" ")[0]||"there",e[0]=i?.user?.name,e[1]=m):m=e[1];const p=m,g=c&&u&&h!=null,_=c&&d&&f;if(l){let N;e[2]!==h||e[3]!==g?(N=g&&r.jsx("div",{className:"mb-4",children:r.jsx(De.CreditsEyebrow,{balanceDollars:h})}),e[2]=h,e[3]=g,e[4]=N):N=e[4];let E;e[5]!==_?(E=_&&r.jsx("div",{className:"mb-4",children:r.jsx(De.NoCreditsEyebrow,{})}),e[5]=_,e[6]=E):E=e[6];let R;e[7]!==p?(R=r.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",p,"?"]}),e[7]=p,e[8]=R):R=e[8];let M;e[9]!==N||e[10]!==E||e[11]!==R?(M=r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center w-full",children:[N,E,R]}),e[9]=N,e[10]=E,e[11]=R,e[12]=M):M=e[12];let L;e[13]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Uc,{}),e[13]=L):L=e[13];let D;e[14]!==s?(D=r.jsxs("div",{className:"w-full flex flex-col gap-4 pb-4",children:[L,r.jsx(De.Input,{onOpenContextPanel:s,showConnectionsBanner:!0})]}),e[14]=s,e[15]=D):D=e[15];let P;e[16]!==a?(P=a&&r.jsx("div",{className:"w-full",children:r.jsx(qc,{onClick:()=>o(!0)})}),e[16]=a,e[17]=P):P=e[17];let $;e[18]!==M||e[19]!==D||e[20]!==P?($=r.jsxs("div",{className:"flex-1 relative flex flex-col items-center px-4",children:[M,D,P]}),e[18]=M,e[19]=D,e[20]=P,e[21]=$):$=e[21];let z;e[22]!==n?(z=r.jsx(Bn,{open:n,onOpenChange:o}),e[22]=n,e[23]=z):z=e[23];let O;return e[24]!==z||e[25]!==$?(O=r.jsxs(r.Fragment,{children:[$,z]}),e[24]=z,e[25]=$,e[26]=O):O=e[26],O}let v;e[27]!==h||e[28]!==g?(v=g&&r.jsx("div",{className:"mb-4",children:r.jsx(De.CreditsEyebrow,{balanceDollars:h})}),e[27]=h,e[28]=g,e[29]=v):v=e[29];let x;e[30]!==_?(x=_&&r.jsx("div",{className:"mb-4",children:r.jsx(De.NoCreditsEyebrow,{})}),e[30]=_,e[31]=x):x=e[31];let b;e[32]!==p?(b=r.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",p,"?"]}),e[32]=p,e[33]=b):b=e[33];let y;e[34]!==v||e[35]!==x||e[36]!==b?(y=r.jsxs("div",{className:"text-center mb-10",children:[v,x,b]}),e[34]=v,e[35]=x,e[36]=b,e[37]=y):y=e[37];let C;e[38]!==s?(C=r.jsx("div",{className:"w-full",children:r.jsx(De.Input,{onOpenContextPanel:s,showConnectionsBanner:!0})}),e[38]=s,e[39]=C):C=e[39];let j;e[40]!==y||e[41]!==C?(j=r.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[y,C]}),e[40]=y,e[41]=C,e[42]=j):j=e[42];let w;e[43]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx("div",{className:"w-full mt-10 mx-auto",children:r.jsx(Uc,{})}),e[43]=w):w=e[43];let V;e[44]!==j?(V=r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center w-full",children:[j,w]}),e[44]=j,e[45]=V):V=e[45];let k;e[46]!==a?(k=a&&r.jsx("div",{className:"absolute bottom-6 left-0 right-0 px-10",children:r.jsx("div",{className:"w-full max-w-[500px] mx-auto",children:r.jsx(qc,{onClick:()=>o(!0)})})}),e[46]=a,e[47]=k):k=e[47];let T;e[48]!==k||e[49]!==V?(T=r.jsxs("div",{className:"flex-1 relative flex flex-col items-center px-10",children:[V,k]}),e[48]=k,e[49]=V,e[50]=T):T=e[50];let I;e[51]!==n?(I=r.jsx(Bn,{open:n,onOpenChange:o}),e[51]=n,e[52]=I):I=e[52];let A;return e[53]!==T||e[54]!==I?(A=r.jsxs(r.Fragment,{children:[T,I]}),e[53]=T,e[54]=I,e[55]=A):A=e[55],A}function Ob(){const t=B.c(26),{org:e}=ve(),{selectedVirtualMcp:s}=ni(),{data:i}=St.useSession(),{currentBranch:n,setCurrentTaskBranch:o}=es();let a;t[0]!==e.id?(a=io(e.id),t[0]=e.id,t[1]=a):a=t[1];const c=s??a,d=ts(c.id),u=i?.user?.id??"",h=d?.metadata?.githubRepo??null,f=!!h?.connectionId&&!!u;let m;t[2]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(ao,{size:32}),t[2]=m):m=t[2];let p;t[3]!==c.icon||t[4]!==c.title?(p=r.jsx(Ms,{icon:c.icon,name:c.title,size:"lg",fallbackIcon:m,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=c.icon,t[4]=c.title,t[5]=p):p=t[5];let g;t[6]!==c.title?(g=r.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:c.title}),t[6]=c.title,t[7]=g):g=t[7];const _=c.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==_?(v=r.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:_}),t[8]=_,t[9]=v):v=t[9];let x;t[10]!==n||t[11]!==d?.metadata?.vmMap||t[12]!==h||t[13]!==e.id||t[14]!==o||t[15]!==f||t[16]!==u?(x=f&&r.jsx("div",{className:"mt-2",children:r.jsx(Tb,{orgId:e.id,userId:u,connectionId:h.connectionId,owner:h.owner,repo:h.name,vmMap:d?.metadata?.vmMap,value:n??void 0,onChange:o})}),t[10]=n,t[11]=d?.metadata?.vmMap,t[12]=h,t[13]=e.id,t[14]=o,t[15]=f,t[16]=u,t[17]=x):x=t[17];let b;t[18]!==p||t[19]!==g||t[20]!==v||t[21]!==x?(b=r.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[p,g,v,x]}),t[18]=p,t[19]=g,t[20]=v,t[21]=x,t[22]=b):b=t[22];let y;t[23]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("div",{className:"w-full max-w-3xl mx-auto",children:r.jsx(De.IceBreakers,{})}),t[23]=y):y=t[23];let C;return t[24]!==b?(C=r.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[b,y]}),t[24]=b,t[25]=C):C=t[25],C}function $b(t){const e=B.c(27),{variant:s}=t,{org:i}=ve(),n=bl(),{isChatEmpty:o}=Ui(),[a,l]=S.useState("chat"),c=co();if(n.length===0){let C;return e[0]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(De,{className:"animate-in fade-in-0 duration-200",children:r.jsx(De.Main,{className:"flex flex-col items-center",children:r.jsx(De.EmptyState,{children:r.jsx(De.NoAiProviderEmptyState,{})})})}),e[0]=C):C=e[0],C}let d;e[1]!==c.hasDecoKey||e[2]!==c.hasOnlyDecoProvider||e[3]!==c.isLoading||e[4]!==c.isZeroBalance||e[5]!==o||e[6]!==i?(d=c.hasDecoKey&&c.isZeroBalance&&c.hasOnlyDecoProvider&&!c.isLoading&&o&&!Rv(i.id),e[1]=c.hasDecoKey,e[2]=c.hasOnlyDecoProvider,e[3]=c.isLoading,e[4]=c.isZeroBalance,e[5]=o,e[6]=i,e[7]=d):d=e[7];const u=d;let h;e[8]!==u?(h=u&&r.jsx(De.CreditsEmptyState,{}),e[8]=u,e[9]=h):h=e[9];const f=a!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let m;e[10]!==f?(m=Y("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),e[10]=f,e[11]=m):m=e[11];let p;e[12]!==o||e[13]!==s?(p=o?s==="home"?r.jsx(Bb,{onOpenContextPanel:()=>l("context")}):r.jsxs(r.Fragment,{children:[r.jsx(De.Main,{children:r.jsx(Ob,{})}),r.jsx(De.Footer,{children:r.jsx(De.Input,{onOpenContextPanel:()=>l("context")})})]}):r.jsxs(r.Fragment,{children:[r.jsx(De.Main,{children:r.jsx(De.Messages,{})}),r.jsx(De.Footer,{children:r.jsx(De.Input,{onOpenContextPanel:()=>l("context")})})]}),e[12]=o,e[13]=s,e[14]=p):p=e[14];let g;e[15]!==m||e[16]!==p?(g=r.jsx("div",{className:m,children:p}),e[15]=m,e[16]=p,e[17]=g):g=e[17];const _=a==="context"?"opacity-100":"opacity-0 pointer-events-none";let v;e[18]!==_?(v=Y("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",_),e[18]=_,e[19]=v):v=e[19];let x;e[20]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(_b,{back:!0,onClose:()=>l("chat")}),e[20]=x):x=e[20];let b;e[21]!==v?(b=r.jsx("div",{className:v,children:x}),e[21]=v,e[22]=b):b=e[22];let y;return e[23]!==b||e[24]!==h||e[25]!==g?(y=r.jsxs(De,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[h,g,b]}),e[23]=b,e[24]=h,e[25]=g,e[26]=y):y=e[26],y}function Ku(t){const e=B.c(4),{variant:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(De.Skeleton,{}),e[0]=i):i=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(De.Skeleton,{}),e[1]=n):n=e[1];let o;return e[2]!==s?(o=r.jsx(Cs,{fallback:i,children:r.jsx(S.Suspense,{fallback:n,children:r.jsx($b,{variant:s})})}),e[2]=s,e[3]=o):o=e[3],o}function zb(){const t=B.c(6),{org:e,locator:s}=ve(),i=Mt();let n;t[0]!==s||t[1]!==i?(n=()=>{i.invalidateQueries({queryKey:lt.tasksPrefix(s)})},t[0]=s,t[1]=i,t[2]=n):n=t[2];let o;t[3]!==e.id||t[4]!==n?(o={orgId:e.id,onTaskStatus:n},t[3]=e.id,t[4]=n,t[5]=o):o=t[5],__(o)}function Fb(t){const e=B.c(8),{virtualMcpId:s,size:i,showAutomationBadge:n}=t,o=i===void 0?"sm":i;let a;e[0]!==o||e[1]!==s?(a=s?r.jsx(Hb,{virtualMcpId:s,size:o}):r.jsx(zs,{icon:null,name:"?",size:o}),e[0]=o,e[1]=s,e[2]=a):a=e[2];let l;e[3]!==n?(l=n&&r.jsx("span",{"aria-label":"Automation-triggered",className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:r.jsx($i,{size:10,className:"text-white"})}),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==a||e[6]!==l?(c=r.jsxs("div",{className:"relative shrink-0",children:[a,l]}),e[5]=a,e[6]=l,e[7]=c):c=e[7],c}function Hb(t){const e=B.c(6),{virtualMcpId:s,size:i}=t,n=ts(s);if(!n){let l;return e[0]!==i?(l=r.jsx(zs,{icon:null,name:"?",size:i}),e[0]=i,e[1]=l):l=e[1],l}const o=n.icon??null;let a;return e[2]!==n.title||e[3]!==i||e[4]!==o?(a=r.jsx(zs,{icon:o,name:n.title,size:i}),e[2]=n.title,e[3]=i,e[4]=o,e[5]=a):a=e[5],a}function Fs(t){const e=t?.metadata?.githubRepo;return e?.connectionId&&t?.connections?.some(i=>i.connection_id===e.connectionId)?e:null}function Wb(t){const e=B.c(42),{task:s,isActive:i,onClick:n,onArchive:o,showAutomationBadge:a}=t,l=$p(s.status),c=l.icon,d=ts(s.virtual_mcp_id);let u;e[0]!==d?(u=Fs(d),e[0]=d,e[1]=u):u=e[1];const h=u,f="button",m=0;let p;e[2]!==n?(p=$=>{$.target===$.currentTarget&&($.key==="Enter"||$.key===" ")&&($.preventDefault(),n())},e[2]=n,e[3]=p):p=e[3];const g=i?"bg-accent":"hover:bg-accent/60";let _;e[4]!==g?(_=Y("group/row flex items-center gap-3 px-2 py-1.5 rounded-md cursor-pointer transition-colors",g),e[4]=g,e[5]=_):_=e[5];let v;e[6]!==a||e[7]!==s.virtual_mcp_id?(v=r.jsx(Fb,{virtualMcpId:s.virtual_mcp_id,size:"sm",showAutomationBadge:a}),e[6]=a,e[7]=s.virtual_mcp_id,e[8]=v):v=e[8];const x=s.title||"Untitled task";let b;e[9]!==x?(b=r.jsx("div",{className:"text-sm text-foreground truncate",children:x}),e[9]=x,e[10]=b):b=e[10];let y;e[11]!==h||e[12]!==s.branch||e[13]!==s.updated_at?(y=s.updated_at&&r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground min-w-0",children:[s.branch?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"truncate font-mono",children:s.branch}),r.jsx("span",{className:"shrink-0",children:"·"})]}):h?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"truncate",children:[h.owner,"/",h.name]}),r.jsx("span",{className:"shrink-0",children:"·"})]}):null,r.jsx("span",{className:"shrink-0",children:zp(new Date(s.updated_at))})]}),e[11]=h,e[12]=s.branch,e[13]=s.updated_at,e[14]=y):y=e[14];let C;e[15]!==y||e[16]!==b?(C=r.jsxs("div",{className:"flex-1 min-w-0",children:[b,y]}),e[15]=y,e[16]=b,e[17]=C):C=e[17];const j="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",w="[grid-area:slot] flex size-7 items-center justify-center group-hover/row:invisible",V=l.label,k=14,T=Y(l.iconClassName,s.status==="in_progress"&&"animate-spin");let I;e[18]!==c||e[19]!==T?(I=r.jsx(c,{size:k,className:T}),e[18]=c,e[19]=T,e[20]=I):I=e[20];let A;e[21]!==l||e[22]!==I?(A=r.jsx("span",{className:w,"aria-label":V,children:I}),e[21]=l,e[22]=I,e[23]=A):A=e[23];let N;e[24]!==o?(N=$=>{$.stopPropagation(),o()},e[24]=o,e[25]=N):N=e[25];let E;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx(gg,{size:14}),e[26]=E):E=e[26];let R;e[27]!==N?(R=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":"Archive task",onClick:N,className:"[grid-area:slot] invisible group-hover/row:visible flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted",children:E})}),e[27]=N,e[28]=R):R=e[28];let M;e[29]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(st,{side:"right",children:"Archive"}),e[29]=M):M=e[29];let L;e[30]!==R?(L=r.jsxs(it,{children:[R,M]}),e[30]=R,e[31]=L):L=e[31];let D;e[32]!==A||e[33]!==L?(D=r.jsxs("div",{className:j,children:[A,L]}),e[32]=A,e[33]=L,e[34]=D):D=e[34];let P;return e[35]!==n||e[36]!==C||e[37]!==D||e[38]!==p||e[39]!==_||e[40]!==v?(P=r.jsxs("div",{role:f,tabIndex:m,onClick:n,onKeyDown:p,className:_,children:[v,C,D]}),e[35]=n,e[36]=C,e[37]=D,e[38]=p,e[39]=_,e[40]=v,e[41]=P):P=e[41],P}const qu={all:"All tasks",manual:"Chats",automation:"Automation"},Gu={all:"All members",mine:"Mine only"};function Ub(t){const e=B.c(57),{title:s,tasks:i,activeTaskId:n,onSelect:o,onArchive:a,onNew:l,showNewButton:c,showAutomationBadge:d,emptyLabel:u,currentUserId:h}=t,[f,m]=S.useState("all"),[p,g]=S.useState("mine");let _;e[0]!==h||e[1]!==p||e[2]!==i?(_=p==="mine"&&h?i.filter(G=>G.created_by===h):i,e[0]=h,e[1]=p,e[2]=i,e[3]=_):_=e[3];const v=_;let x;e[4]!==f||e[5]!==v?(x=f==="automation"?v.filter(Yb):f==="manual"?v.filter(Gb):v,e[4]=f,e[5]=v,e[6]=x):x=e[6];const b=x;let y;e[7]!==s?(y=r.jsx("span",{children:s}),e[7]=s,e[8]=y):y=e[8];let C;e[9]!==p?(C=r.jsx(ks,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":"Filter by member",className:"flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",children:p==="mine"?r.jsx(_g,{size:16}):r.jsx(ao,{size:16})})}),e[9]=p,e[10]=C):C=e[10];let j;e[11]!==p?(j=G=>{g(G)},e[11]=p,e[12]=j):j=e[12];let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=Object.keys(Gu),e[13]=w):w=e[13];let V;e[14]===Symbol.for("react.memo_cache_sentinel")?(V=w.map(qb),e[14]=V):V=e[14];let k;e[15]!==p||e[16]!==j?(k=r.jsx(Ns,{align:"end",children:r.jsx(hc,{value:p,onValueChange:j,children:V})}),e[15]=p,e[16]=j,e[17]=k):k=e[17];let T;e[18]!==C||e[19]!==k?(T=r.jsxs(js,{children:[C,k]}),e[18]=C,e[19]=k,e[20]=T):T=e[20];const I=f!=="all"&&"text-purple-500";let A;e[21]!==I?(A=Y("flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",I),e[21]=I,e[22]=A):A=e[22];let N;e[23]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(Og,{size:16}),e[23]=N):N=e[23];let E;e[24]!==A?(E=r.jsx(ks,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":"Filter tasks",className:A,children:N})}),e[24]=A,e[25]=E):E=e[25];let R;e[26]!==f?(R=G=>{m(G)},e[26]=f,e[27]=R):R=e[27];let M;e[28]===Symbol.for("react.memo_cache_sentinel")?(M=Object.keys(qu),e[28]=M):M=e[28];let L;e[29]===Symbol.for("react.memo_cache_sentinel")?(L=M.map(Kb),e[29]=L):L=e[29];let D;e[30]!==f||e[31]!==R?(D=r.jsx(Ns,{align:"end",children:r.jsx(hc,{value:f,onValueChange:R,children:L})}),e[30]=f,e[31]=R,e[32]=D):D=e[32];let P;e[33]!==E||e[34]!==D?(P=r.jsxs(js,{children:[E,D]}),e[33]=E,e[34]=D,e[35]=P):P=e[35];let $;e[36]!==l||e[37]!==c||e[38]!==s?($=c&&l&&r.jsx("button",{type:"button",onClick:()=>{l()},"aria-label":`New ${s.toLowerCase()}`,className:"flex size-8 items-center justify-center rounded-md hover:bg-muted hover:text-foreground",children:r.jsx(pl,{size:16})}),e[36]=l,e[37]=c,e[38]=s,e[39]=$):$=e[39];let z;e[40]!==P||e[41]!==$||e[42]!==T?(z=r.jsxs("div",{className:"flex items-center gap-0.5",children:[T,P,$]}),e[40]=P,e[41]=$,e[42]=T,e[43]=z):z=e[43];let O;e[44]!==z||e[45]!==y?(O=r.jsxs("div",{className:"pl-2 pr-1.5 h-7 flex items-center justify-between text-xs font-medium text-muted-foreground mb-1",children:[y,z]}),e[44]=z,e[45]=y,e[46]=O):O=e[46];let W;e[47]!==n||e[48]!==u||e[49]!==a||e[50]!==o||e[51]!==d||e[52]!==b?(W=b.length===0&&u?r.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground/70",children:u}):b.map(G=>r.jsx(Wb,{task:G,isActive:n===G.id,onClick:()=>{n!==G.id&&ye("tasks_panel_task_clicked",{thread_id:G.id,virtual_mcp_id:G.virtual_mcp_id??null,from_automation:!!G.fromAutomation}),o(G)},onArchive:()=>{ye("tasks_panel_task_archived",{thread_id:G.id,virtual_mcp_id:G.virtual_mcp_id??null}),a(G)},showAutomationBadge:d||G.fromAutomation},G.id)),e[47]=n,e[48]=u,e[49]=a,e[50]=o,e[51]=d,e[52]=b,e[53]=W):W=e[53];let F;return e[54]!==O||e[55]!==W?(F=r.jsxs("div",{className:"flex flex-col gap-0.5 mt-1",children:[O,W]}),e[54]=O,e[55]=W,e[56]=F):F=e[56],F}function Kb(t){return r.jsx(Lh,{value:t,children:qu[t]},t)}function qb(t){return r.jsx(Lh,{value:t,children:Gu[t]},t)}function Gb(t){return!t.fromAutomation}function Yb(t){return t.fromAutomation}function Xb(){const t=B.c(22);zb();const{data:e}=St.useSession(),s=e?.user?.id;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={owner:"me",status:"open",hasTrigger:!1},t[0]=i):i=t[0];const{tasks:n}=ia(i);let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o={owner:"all",status:"open",hasTrigger:!0},t[1]=o):o=t[1];const{tasks:a}=ia(o),{setTaskId:l,createNewTask:c}=zr();let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[2]=d):d=t[2];const u=$r(d),{locator:h,org:f}=ve(),m=Mt();let p;t[3]!==f.id?(p={connectionId:Ht,orgId:f.id},t[3]=f.id,t[4]=p):p=t[4];const g=Me(p),_=u.taskId??null;let v;t[5]!==a||t[6]!==n?(v=[...n,...a.map(Qb)].sort(Jb),t[5]=a,t[6]=n,t[7]=v):v=t[7];const x=v;let b;t[8]!==g||t[9]!==h||t[10]!==m?(b=async w=>{try{await Ap(g,w.id,{hidden:!0}),m.invalidateQueries({queryKey:lt.tasksPrefix(h)})}catch(V){const T=V;me.error(`Failed to archive task: ${T.message}`)}},t[8]=g,t[9]=h,t[10]=m,t[11]=b):b=t[11];const y=b;if(x.length===0){let w;return t[12]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx("div",{className:"h-full flex items-center justify-center p-4",children:r.jsx(Oi,{image:r.jsx(xg,{size:48,className:"text-muted-foreground"}),title:"No tasks yet",description:"Start a conversation to create your first task."})}),t[12]=w):w=t[12],w}let C;t[13]!==l?(C=w=>l(w.id,w.virtual_mcp_id),t[13]=l,t[14]=C):C=t[14];let j;return t[15]!==_||t[16]!==x||t[17]!==c||t[18]!==s||t[19]!==y||t[20]!==C?(j=r.jsx("div",{className:"flex flex-col h-full min-h-0 overflow-y-auto p-2 gap-3",children:r.jsx(Ub,{title:"Tasks",tasks:x,activeTaskId:_,onSelect:C,onArchive:y,onNew:c,showNewButton:!0,currentUserId:s})}),t[15]=_,t[16]=x,t[17]=c,t[18]=s,t[19]=y,t[20]=C,t[21]=j):j=t[21],j}function Jb(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function Qb(t){return{...t,fromAutomation:!0}}function Zb(){const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"flex flex-col h-full p-2 gap-1.5",children:Array.from({length:6}).map(e0)}),t[0]=e):e=t[0],e}function e0(t,e){return r.jsx("div",{className:"h-10 rounded-md bg-muted/60 animate-pulse"},e)}function Yu(){const t=B.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(De.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Cs,{fallback:e,children:r.jsx(S.Suspense,{fallback:r.jsx(Zb,{}),children:r.jsx(Xb,{})})}),t[1]=s):s=t[1],s}function Xu(){const t=B.c(77),{org:e}=ve(),s=Ke(),i=Vh(),{setTasksOpen:n,openTab:o}=zr(),a=e.slug,l=ve().project;let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[0]=c):c=t[0];const d=$r(c);let u;t[1]===Symbol.for("react.memo_cache_sentinel")?(u={strict:!1},t[1]=u):u=t[1];const h=vi(u),f=i.location.pathname;let m;t[2]!==l.enabledPlugins?(m=l.enabledPlugins??[],t[2]=l.enabledPlugins,t[3]=m):m=t[3];const p=m;let g;t[4]!==l.ui?(g=l.ui?.pinnedViews??[],t[4]=l.ui,t[5]=g):g=t[5];const _=g;let v,x,b,y;if(t[6]!==l.id||t[7]!==p||t[8]!==s||t[9]!==a||t[10]!==d.pluginId||t[11]!==d.taskId||t[12]!==h.virtualmcpid){let q;t[17]!==p?(q=se=>p.includes(se.pluginId),t[17]=p,t[18]=q):q=t[18];const H=Zm.filter(q),ee=h.virtualmcpid??l.id;x=!!h.virtualmcpid;const K=d.taskId??"",U=d.pluginId;let te;t[19]!==U?(te=se=>U===se,t[19]=U,t[20]=te):te=t[20],v=te;let X;t[21]!==K||t[22]!==s||t[23]!==a||t[24]!==ee?(X=se=>{const he=K||crypto.randomUUID();s({to:"/$org/$taskId/$pluginId",params:{org:a,taskId:he,pluginId:se},search:ce=>({...ce,virtualmcpid:ee})})},t[21]=K,t[22]=s,t[23]=a,t[24]=ee,t[25]=X):X=t[25],b=X;let J;t[26]!==v||t[27]!==b?(J=se=>({key:se.pluginId,label:se.label,icon:se.icon,isActive:v(se.pluginId),onClick:()=>b(se.pluginId)}),t[26]=v,t[27]=b,t[28]=J):J=t[28],y=H.map(J),t[6]=l.id,t[7]=p,t[8]=s,t[9]=a,t[10]=d.pluginId,t[11]=d.taskId,t[12]=h.virtualmcpid,t[13]=v,t[14]=x,t[15]=b,t[16]=y}else v=t[13],x=t[14],b=t[15],y=t[16];const C=y;let j;if(t[29]!==p||t[30]!==v||t[31]!==b){let q;t[33]!==p?(q=K=>p.includes(K.pluginId),t[33]=p,t[34]=q):q=t[34];const H=ep.filter(q);let ee;t[35]!==v||t[36]!==b?(ee=K=>({type:"group",group:{id:`${K.pluginId}-${K.id}`,label:K.label,items:K.items.map((U,te)=>({key:`${K.pluginId}-${K.id}-${te}`,label:U.label,icon:U.icon,isActive:v(K.pluginId),onClick:()=>b(K.pluginId)})),defaultExpanded:K.defaultExpanded??!0}}),t[35]=v,t[36]=b,t[37]=ee):ee=t[37],j=H.map(ee),t[29]=p,t[30]=v,t[31]=b,t[32]=j}else j=t[32];const w=j;let V;if(t[38]!==o||t[39]!==_){let q;t[41]!==o?(q=H=>{const ee=Fr(H.icon),K=ee.type==="icon"?Hr(ee.name):null;return{key:`app-${H.connectionId}-${H.toolName}`,label:H.label||H.toolName,icon:K?r.jsx(K,{size:16,className:"text-muted-foreground"}):ee.type==="url"?r.jsx("img",{src:ee.url,alt:"",className:"size-4 rounded"}):r.jsx(fu,{size:16,className:"text-muted-foreground"}),isActive:!1,onClick:()=>o(ra(H.connectionId,H.toolName))}},t[41]=o,t[42]=q):q=t[42],V=_.map(q),t[38]=o,t[39]=_,t[40]=V}else V=t[40];const k=V;let T;t[43]!==k?(T=k.length>0?{type:"group",group:{id:"apps",label:"Apps",items:k,defaultExpanded:!0}}:null,t[43]=k,t[44]=T):T=t[44];const I=T;let A;t[45]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(vg,{className:"size-4!"}),t[45]=A):A=t[45];const N=f===`/${a}`||f===`/${a}/`;let E;t[46]!==s||t[47]!==a||t[48]!==n?(E=()=>{n(!1),s({to:"/$org",params:{org:a}})},t[46]=s,t[47]=a,t[48]=n,t[49]=E):E=t[49];let R;t[50]!==E||t[51]!==N?(R={key:"home",label:"Home",icon:A,isActive:N,onClick:E},t[50]=E,t[51]=N,t[52]=R):R=t[52];const M=R;let L;t[53]!==p?(L=p.includes(tp),t[53]=p,t[54]=L):L=t[54];const D=L;let P;t[55]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(sp,{className:"size-4!"}),t[55]=P):P=t[55];let $;t[56]!==a||t[57]!==f?($=f.startsWith(`/${a}/settings/workflows`),t[56]=a,t[57]=f,t[58]=$):$=t[58];let z;t[59]!==s||t[60]!==a?(z=()=>s({to:"/$org/settings/workflows",params:{org:a}}),t[59]=s,t[60]=a,t[61]=z):z=t[61];let O;t[62]!==$||t[63]!==z?(O={key:"workflows",label:"Workflows",icon:P,isActive:$,onClick:z},t[62]=$,t[63]=z,t[64]=O):O=t[64];const W=O;let F;if(t[65]!==M||t[66]!==x||t[67]!==D||t[68]!==W){const q=[M];x&&D&&q.push(W),F={type:"items",items:q},t[65]=M,t[66]=x,t[67]=D,t[68]=W,t[69]=F}else F=t[69];let G;if(t[70]!==I||t[71]!==w||t[72]!==C||t[73]!==F){if(G=[F],C.length>0){let q;t[75]!==C?(q={type:"items",items:C},t[75]=C,t[76]=q):q=t[76],G.push(q)}w.length>0&&G.push(...w),I&&G.push(I),t[70]=I,t[71]=w,t[72]=C,t[73]=F,t[74]=G}else G=t[74];return G}function Ju(t){const e=B.c(3),{children:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex h-6 items-center",children:r.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=i):i=e[0];let n;return e[1]!==s?(n=r.jsxs(Ur,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[i,r.jsx(Kr,{children:r.jsx(gs,{className:"gap-0.5",children:s})})]}),e[1]=s,e[2]=n):n=e[2],n}function t0(){const t=B.c(7),s=xu().logo??vu,i=typeof s=="string"?s:s.light,n=typeof s=="string"?s:s.dark;let o;t[0]!==i?(o=r.jsx("img",{src:i,alt:"Logo",className:"size-6 object-contain dark:hidden"}),t[0]=i,t[1]=o):o=t[1];let a;t[2]!==n?(a=r.jsx("img",{src:n,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),t[2]=n,t[3]=a):a=t[3];let l;return t[4]!==o||t[5]!==a?(l=r.jsx(gu,{className:"flex items-center justify-center shrink-0 px-2 pb-0",children:r.jsxs("div",{className:"flex w-full aspect-square items-center justify-center",children:[o,a]})}),t[4]=o,t[5]=a,t[6]=l):l=t[6],l}function Qu(t){const e=B.c(15),{item:s}=t,{isMobile:i,setOpenMobile:n}=qr();let o;e[0]!==i||e[1]!==s||e[2]!==n?(o=()=>{ye("nav_item_clicked",{nav_key:s.key,nav_label:s.label,is_active:!!s.isActive}),s.onClick?.(),i&&n(!1)},e[0]=i,e[1]=s,e[2]=n,e[3]=o):o=e[3];const a=o,l=s.key,c=s.isActive&&"z-10";let d;e[4]!==c?(d=Y(c),e[4]=c,e[5]=d):d=e[5];let u;e[6]!==a||e[7]!==s.icon||e[8]!==s.isActive||e[9]!==s.label?(u=r.jsx(us,{onClick:a,isActive:s.isActive,tooltip:s.label,className:"bg-muted/75",children:s.icon}),e[6]=a,e[7]=s.icon,e[8]=s.isActive,e[9]=s.label,e[10]=u):u=e[10];let h;return e[11]!==s.key||e[12]!==d||e[13]!==u?(h=r.jsx(Zt,{className:d,children:u},l),e[11]=s.key,e[12]=d,e[13]=u,e[14]=h):h=e[14],h}function s0(t){const e=B.c(12),{section:s}=t;switch(s.type){case"divider":{let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(mu,{className:"my-2"}),e[0]=i):i=e[0],i}case"spacer":{let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex-1"}),e[1]=i):i=e[1],i}case"group":{const i=s.group.label,n=s.group.defaultExpanded;let o;e[2]!==s.group.items?(o=s.group.items.map(r0),e[2]=s.group.items,e[3]=o):o=e[3];let a;return e[4]!==s.group.defaultExpanded||e[5]!==s.group.label||e[6]!==o?(a=r.jsx(Ju,{label:i,defaultExpanded:n,children:o}),e[4]=s.group.defaultExpanded,e[5]=s.group.label,e[6]=o,e[7]=a):a=e[7],a}case"items":{let i;e[8]!==s.items?(i=s.items.map(i0),e[8]=s.items,e[9]=i):i=e[9];let n;return e[10]!==i?(n=r.jsx(Ur,{className:"pt-0 pr-0 pb-0 pl-0",children:r.jsx(Kr,{children:r.jsx(gs,{className:"gap-1.5",children:i})})}),e[10]=i,e[11]=n):n=e[11],n}}}function i0(t){return r.jsx(Qu,{item:t},t.key)}function r0(t){return r.jsx(Qu,{item:t},t.key)}function n0(t){const e=B.c(14),{sections:s,header:i,footer:n,additionalContent:o,variant:a,contentClassName:l}=t,c=a===void 0?"sidebar":a;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"h-10 shrink-0"}),children:r.jsx(t0,{})}),e[0]=d):d=e[0];let u;e[1]!==l?(u=Y("flex flex-col flex-1 px-2 py-2 gap-0",l),e[1]=l,e[2]=u):u=e[2];let h;e[3]!==s?(h=s.map(o0),e[3]=s,e[4]=h):h=e[4];let f;e[5]!==o||e[6]!==u||e[7]!==h?(f=r.jsxs(pu,{className:u,children:[h,o]}),e[5]=o,e[6]=u,e[7]=h,e[8]=f):f=e[8];let m;return e[9]!==n||e[10]!==i||e[11]!==f||e[12]!==c?(m=r.jsxs(x_,{variant:c,children:[d,i,f,n]}),e[9]=n,e[10]=i,e[11]=f,e[12]=c,e[13]=m):m=e[13],m}function o0(t,e){return r.jsx(s0,{section:t},e)}function Zu(t){const e=B.c(2);let s;return e[0]!==t?(s=r.jsx(n0,{...t}),e[0]=t,e[1]=s):s=e[1],s}Zu.Skeleton=function(){return r.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>r.jsx("div",{className:"w-full h-8",children:r.jsx(Bi,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function a0(){const t=B.c(7),s=xu().logo??vu,i=typeof s=="string"?s:s.light,n=typeof s=="string"?s:s.dark;let o;t[0]!==i?(o=r.jsx("img",{src:i,alt:"Logo",className:"size-6 object-contain dark:hidden"}),t[0]=i,t[1]=o):o=t[1];let a;t[2]!==n?(a=r.jsx("img",{src:n,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),t[2]=n,t[3]=a):a=t[3];let l;return t[4]!==o||t[5]!==a?(l=r.jsx(gu,{className:"flex items-center justify-center shrink-0 px-2 pb-0",children:r.jsxs("div",{className:"flex w-full aspect-square items-center justify-center",children:[o,a]})}),t[4]=o,t[5]=a,t[6]=l):l=t[6],l}function Gc(t){const e=B.c(15),{item:s,onClose:i}=t,n=s.isActive&&"z-10";let o;e[0]!==n?(o=Y(n),e[0]=n,e[1]=o):o=e[1];let a;e[2]!==s||e[3]!==i?(a=()=>{s.onClick?.(),i()},e[2]=s,e[3]=i,e[4]=a):a=e[4];let l;e[5]!==s.icon?(l=r.jsx("span",{className:"[&>svg]:size-8",children:s.icon}),e[5]=s.icon,e[6]=l):l=e[6];let c;e[7]!==s.isActive||e[8]!==s.label||e[9]!==a||e[10]!==l?(c=r.jsx(us,{onClick:a,isActive:s.isActive,tooltip:s.label,className:"bg-muted/75",children:l}),e[7]=s.isActive,e[8]=s.label,e[9]=a,e[10]=l,e[11]=c):c=e[11];let d;return e[12]!==o||e[13]!==c?(d=r.jsx(Zt,{className:o,children:c}),e[12]=o,e[13]=c,e[14]=d):d=e[14],d}function l0(t){const e=B.c(18),{section:s,onClose:i}=t;switch(s.type){case"divider":{let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(mu,{className:"my-2"}),e[0]=n):n=e[0],n}case"spacer":{let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx("div",{className:"flex-1"}),e[1]=n):n=e[1],n}case"group":{const n=s.group.label,o=s.group.defaultExpanded;let a;if(e[2]!==i||e[3]!==s.group.items){let c;e[5]!==i?(c=d=>r.jsx(Gc,{item:d,onClose:i},d.key),e[5]=i,e[6]=c):c=e[6],a=s.group.items.map(c),e[2]=i,e[3]=s.group.items,e[4]=a}else a=e[4];let l;return e[7]!==s.group.defaultExpanded||e[8]!==s.group.label||e[9]!==a?(l=r.jsx(Ju,{label:n,defaultExpanded:o,children:a}),e[7]=s.group.defaultExpanded,e[8]=s.group.label,e[9]=a,e[10]=l):l=e[10],l}case"items":{let n;if(e[11]!==i||e[12]!==s.items){let a;e[14]!==i?(a=l=>r.jsx(Gc,{item:l,onClose:i},l.key),e[14]=i,e[15]=a):a=e[15],n=s.items.map(a),e[11]=i,e[12]=s.items,e[13]=n}else n=e[13];let o;return e[16]!==n?(o=r.jsx(Ur,{className:"pt-0 pr-0 pb-0 pl-0",children:r.jsx(Kr,{children:r.jsx(gs,{className:"gap-1.5",children:n})})}),e[16]=n,e[17]=o):o=e[17],o}}}function c0(t){const e=B.c(12),{sections:s,onClose:i,footer:n,additionalContent:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"h-10 shrink-0"}),children:r.jsx(a0,{})}),e[0]=a):a=e[0];let l;if(e[1]!==i||e[2]!==s){let u;e[4]!==i?(u=(h,f)=>r.jsx(l0,{section:h,onClose:i},f),e[4]=i,e[5]=u):u=e[5],l=s.map(u),e[1]=i,e[2]=s,e[3]=l}else l=e[3];let c;e[6]!==o||e[7]!==l?(c=r.jsxs(pu,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[l,o]}),e[6]=o,e[7]=l,e[8]=c):c=e[8];let d;return e[9]!==n||e[10]!==c?(d=r.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[a,c,n]}),e[9]=n,e[10]=c,e[11]=d):d=e[11],d}function ef(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const d0=Vs({name:Et().min(2,"Organization name is required")});function h0(t){const e=B.c(41),{open:s,onOpenChange:i}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={resolver:Or(d0),defaultValues:{name:""}},e[0]=n):n=e[0];const o=Hi(n);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={mutationFn:f0,onSuccess:u0},e[1]=a):a=e[1];const l=Br(a),c=l.error instanceof Error?l.error.message:l.error?"Failed to create organization.":null;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsxs(kl,{children:[r.jsx(Nl,{children:"Create a new organization"}),r.jsx(Al,{children:"Set up a new organization to collaborate with others."})]}),e[2]=d):d=e[2];let u;if(e[3]!==l||e[4]!==o){let w;e[6]!==l?(w=V=>l.mutateAsync(V),e[6]=l,e[7]=w):w=e[7],u=o.handleSubmit(w),e[3]=l,e[4]=o,e[5]=u}else u=e[5];let h;e[8]!==o.formState.isSubmitting?(h=w=>{const{field:V}=w;return r.jsxs(Rt,{children:[r.jsx(rs,{children:"Organization Name"}),r.jsx(Tt,{children:r.jsx(bt,{...V,placeholder:"Acme Inc.",disabled:o.formState.isSubmitting})}),r.jsx(dg,{children:"The name of your company or organization"}),V.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",ef(V.value)]})]}),r.jsx(Dt,{})]})},e[8]=o.formState.isSubmitting,e[9]=h):h=e[9];let f;e[10]!==o.control||e[11]!==h?(f=r.jsx(It,{control:o.control,name:"name",render:h}),e[10]=o.control,e[11]=h,e[12]=f):f=e[12];let m;e[13]!==c?(m=c&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:c}),e[13]=c,e[14]=m):m=e[14];let p;e[15]!==l||e[16]!==o?(p=()=>{l.reset(),o.reset()},e[15]=l,e[16]=o,e[17]=p):p=e[17];let g;e[18]!==o.formState.isSubmitting||e[19]!==p?(g=r.jsx(Cl,{disabled:o.formState.isSubmitting,onClick:p,children:"Cancel"}),e[18]=o.formState.isSubmitting,e[19]=p,e[20]=g):g=e[20];const _=!o.formState.isValid||o.formState.isSubmitting;let v;e[21]!==o.formState.isSubmitting?(v=o.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(jr,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=o.formState.isSubmitting,e[22]=v):v=e[22];let x;e[23]!==_||e[24]!==v?(x=r.jsx(re,{type:"submit",variant:"default",disabled:_,children:v}),e[23]=_,e[24]=v,e[25]=x):x=e[25];let b;e[26]!==x||e[27]!==g?(b=r.jsxs(El,{children:[g,x]}),e[26]=x,e[27]=g,e[28]=b):b=e[28];let y;e[29]!==b||e[30]!==u||e[31]!==f||e[32]!==m?(y=r.jsxs("form",{className:"space-y-6",onSubmit:u,autoComplete:"off",children:[f,m,b]}),e[29]=b,e[30]=u,e[31]=f,e[32]=m,e[33]=y):y=e[33];let C;e[34]!==o||e[35]!==y?(C=r.jsxs(jl,{children:[d,r.jsx(Pi,{...o,children:y})]}),e[34]=o,e[35]=y,e[36]=C):C=e[36];let j;return e[37]!==i||e[38]!==s||e[39]!==C?(j=r.jsx(Il,{open:s,onOpenChange:i,children:C}),e[37]=i,e[38]=s,e[39]=C,e[40]=j):j=e[40],j}function u0(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function f0(t){const e=ef(t.name);if(!e)throw new Error("Organization slug is invalid");const s=await St.organization.create({name:t.name,slug:e});if(s?.error)throw new Error(s.error.message||"Failed to create organization");const i=s?.data?.slug??e;if(!i)throw new Error("Failed to create organization");return{orgSlug:i}}function ga(t){let e=0;for(let i=0;i<t.length;i++)e=t.charCodeAt(i)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function m0(t){const e=B.c(13),{org:s,size:i}=t,n=i===void 0?"sm":i,o=n==="xs"?"size-5":"size-6",a=n==="xs"?"text-[9px]":"text-xs";let l;e[0]!==o?(l=Y(o,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=o,e[1]=l):l=e[1];let c;e[2]!==s.logo||e[3]!==s.name?(c=s.logo?void 0:ga(s.name),e[2]=s.logo,e[3]=s.name,e[4]=c):c=e[4];let d;e[5]!==s.logo||e[6]!==s.name||e[7]!==a?(d=s.logo?r.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):r.jsx("span",{className:Y("font-semibold leading-none",a),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=a,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==c||e[11]!==d?(u=r.jsx("div",{className:l,style:c,children:d}),e[9]=l,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function ln(t){const e=B.c(22),{item:s,onClose:i}=t;if(s.href){const c=s.external?"_blank":void 0,d=s.external?"noopener noreferrer":void 0;let u;e[0]!==s.icon?(u=r.jsx("span",{className:"shrink-0 text-muted-foreground",children:s.icon}),e[0]=s.icon,e[1]=u):u=e[1];let h;e[2]!==s.label?(h=r.jsx("span",{className:"flex-1",children:s.label}),e[2]=s.label,e[3]=h):h=e[3];let f;return e[4]!==s.href||e[5]!==i||e[6]!==c||e[7]!==d||e[8]!==u||e[9]!==h?(f=r.jsxs("a",{href:s.href,target:c,rel:d,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",onClick:i,children:[u,h]}),e[4]=s.href,e[5]=i,e[6]=c,e[7]=d,e[8]=u,e[9]=h,e[10]=f):f=e[10],f}let n;e[11]!==s||e[12]!==i?(n=()=>{s.onClick?.(),i()},e[11]=s,e[12]=i,e[13]=n):n=e[13];let o;e[14]!==s.icon?(o=r.jsx("span",{className:"shrink-0 text-muted-foreground",children:s.icon}),e[14]=s.icon,e[15]=o):o=e[15];let a;e[16]!==s.label?(a=r.jsx("span",{className:"flex-1",children:s.label}),e[16]=s.label,e[17]=a):a=e[17];let l;return e[18]!==n||e[19]!==o||e[20]!==a?(l=r.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",children:[o,a]}),e[18]=n,e[19]=o,e[20]=a,e[21]=l):l=e[21],l}function Yc(t){const e=B.c(16),{sortedOrgs:s,orgParam:i,onSelectOrg:n,onCreateOrg:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("span",{className:"text-sm font-medium text-muted-foreground/60",children:"Your Organizations"}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Qt,{size:16}),e[1]=l):l=e[1];let c;e[2]!==o?(c=r.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a,r.jsx("button",{type:"button",onClick:o,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:l})]}),e[2]=o,e[3]=c):c=e[3];let d;if(e[4]!==n||e[5]!==i||e[6]!==s){let f;e[8]!==n||e[9]!==i?(f=m=>r.jsxs("button",{type:"button",onClick:()=>n(m.slug),className:Y("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",m.slug===i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[r.jsx(m0,{org:m,size:"sm"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:m.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:m.slug})]}),m.slug===i&&r.jsx(Jt,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},m.id),e[8]=n,e[9]=i,e[10]=f):f=e[10],d=s.map(f),e[4]=n,e[5]=i,e[6]=s,e[7]=d}else d=e[7];let u;e[11]!==d?(u=r.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1",children:d}),e[11]=d,e[12]=u):u=e[12];let h;return e[13]!==c||e[14]!==u?(h=r.jsxs(r.Fragment,{children:[c,u]}),e[13]=c,e[14]=u,e[15]=h):h=e[15],h}function Xc(t){const e=B.c(142),{user:s,userImage:i,menuItems:n,signOutItem:o,themeOptions:a,preferences:l,setPreferences:c,sortedOrgs:d,orgParam:u,onSelectOrg:h,onCreateOrg:f,close:m,isMobile:p}=t;if(p){const K=s?.name??"U";let U;e[0]!==K||e[1]!==i?(U=r.jsx(Vc,{url:i,fallback:K,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=K,e[1]=i,e[2]=U):U=e[2];const te=s?.name??"User";let X;e[3]!==te?(X=r.jsx("p",{className:"text-sm font-medium truncate",children:te}),e[3]=te,e[4]=X):X=e[4];const J=s?.email;let se;e[5]!==J?(se=r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:J}),e[5]=J,e[6]=se):se=e[6];let he;e[7]!==X||e[8]!==se?(he=r.jsxs("div",{className:"flex-1 min-w-0",children:[X,se]}),e[7]=X,e[8]=se,e[9]=he):he=e[9];let ce;e[10]!==s?(ce=()=>{s?.id&&navigator.clipboard.writeText(s.id).then(x0)},e[10]=s,e[11]=ce):ce=e[11];let pe;e[12]===Symbol.for("react.memo_cache_sentinel")?(pe=r.jsx(Li,{size:14}),e[12]=pe):pe=e[12];let ne;e[13]!==ce?(ne=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",tabIndex:-1,onClick:ce,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:pe})}),e[13]=ce,e[14]=ne):ne=e[14];let de;e[15]===Symbol.for("react.memo_cache_sentinel")?(de=r.jsx(st,{side:"right",children:r.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=de):de=e[15];let fe;e[16]!==ne?(fe=r.jsx(Mi,{delayDuration:300,children:r.jsxs(it,{children:[ne,de]})}),e[16]=ne,e[17]=fe):fe=e[17];let ue;e[18]!==fe||e[19]!==U||e[20]!==he?(ue=r.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[U,he,fe]}),e[18]=fe,e[19]=U,e[20]=he,e[21]=ue):ue=e[21];let ae;e[22]!==f||e[23]!==h||e[24]!==u||e[25]!==d?(ae=r.jsx("div",{className:"border-b border-border pb-2",children:r.jsx(Yc,{sortedOrgs:d,orgParam:u,onSelectOrg:h,onCreateOrg:f})}),e[22]=f,e[23]=h,e[24]=u,e[25]=d,e[26]=ae):ae=e[26];let _e;if(e[27]!==m||e[28]!==n){let Pe;e[30]!==m?(Pe=Ut=>r.jsx(ln,{item:Ut,onClose:m},Ut.key),e[30]=m,e[31]=Pe):Pe=e[31],_e=n.map(Pe),e[27]=m,e[28]=n,e[29]=_e}else _e=e[29];let Ce;e[32]!==m||e[33]!==o?(Ce=r.jsx(ln,{item:o,onClose:m}),e[32]=m,e[33]=o,e[34]=Ce):Ce=e[34];let Te;e[35]!==_e||e[36]!==Ce?(Te=r.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[_e,Ce]}),e[35]=_e,e[36]=Ce,e[37]=Te):Te=e[37];let Q;e[38]!==ae||e[39]!==Te?(Q=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[ae,Te]}),e[38]=ae,e[39]=Te,e[40]=Q):Q=e[40];let oe;if(e[41]!==l.theme||e[42]!==c||e[43]!==a){let Pe;e[45]!==l.theme||e[46]!==c?(Pe=Ut=>{const{value:jt,icon:Ae,label:Ie}=Ut;return r.jsx("button",{type:"button","aria-label":Ie,onClick:()=>c(qe=>({...qe,theme:jt})),className:Y("size-8 rounded-md flex items-center justify-center transition-colors",l.theme===jt?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Ae},jt)},e[45]=l.theme,e[46]=c,e[47]=Pe):Pe=e[47],oe=a.map(Pe),e[41]=l.theme,e[42]=c,e[43]=a,e[44]=oe}else oe=e[44];let Se;e[48]!==oe?(Se=r.jsx("div",{className:"flex items-center gap-0.5",children:oe}),e[48]=oe,e[49]=Se):Se=e[49];const Ne=l.enableSounds?"Disable sounds":"Enable sounds";let Be;e[50]!==c?(Be=()=>c(_0),e[50]=c,e[51]=Be):Be=e[51];const Oe=l.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let He;e[52]!==Oe?(He=Y("size-8 rounded-md flex items-center justify-center transition-colors",Oe),e[52]=Oe,e[53]=He):He=e[53];let Je;e[54]!==l.enableSounds?(Je=l.enableSounds?r.jsx(uc,{size:14}):r.jsx(fc,{size:14}),e[54]=l.enableSounds,e[55]=Je):Je=e[55];let dt;e[56]!==Ne||e[57]!==Be||e[58]!==He||e[59]!==Je?(dt=r.jsx("button",{type:"button","aria-label":Ne,onClick:Be,className:He,children:Je}),e[56]=Ne,e[57]=Be,e[58]=He,e[59]=Je,e[60]=dt):dt=e[60];let ge;e[61]===Symbol.for("react.memo_cache_sentinel")?(ge=r.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","2.276.2"]}),e[61]=ge):ge=e[61];let ke;e[62]!==dt?(ke=r.jsxs("div",{className:"flex items-center gap-2",children:[dt,ge]}),e[62]=dt,e[63]=ke):ke=e[63];let Qe;e[64]!==Se||e[65]!==ke?(Qe=r.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[Se,ke]}),e[64]=Se,e[65]=ke,e[66]=Qe):Qe=e[66];let Ct;return e[67]!==ue||e[68]!==Q||e[69]!==Qe?(Ct=r.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[ue,Q,Qe]}),e[67]=ue,e[68]=Q,e[69]=Qe,e[70]=Ct):Ct=e[70],Ct}const g=s?.name??"U";let _;e[71]!==g||e[72]!==i?(_=r.jsx(Vc,{url:i,fallback:g,shape:"circle",size:"sm",className:"shrink-0"}),e[71]=g,e[72]=i,e[73]=_):_=e[73];const v=s?.name??"User";let x;e[74]!==v?(x=r.jsx("p",{className:"text-sm font-medium truncate",children:v}),e[74]=v,e[75]=x):x=e[75];const b=s?.email;let y;e[76]!==b?(y=r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b}),e[76]=b,e[77]=y):y=e[77];let C;e[78]!==x||e[79]!==y?(C=r.jsxs("div",{className:"flex-1 min-w-0",children:[x,y]}),e[78]=x,e[79]=y,e[80]=C):C=e[80];let j;e[81]!==s?(j=()=>{s?.id&&navigator.clipboard.writeText(s.id).then(g0)},e[81]=s,e[82]=j):j=e[82];let w;e[83]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Li,{size:14}),e[83]=w):w=e[83];let V;e[84]!==j?(V=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",tabIndex:-1,onClick:j,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:w})}),e[84]=j,e[85]=V):V=e[85];let k;e[86]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(st,{side:"right",children:r.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[86]=k):k=e[86];let T;e[87]!==V?(T=r.jsx(Mi,{delayDuration:300,children:r.jsxs(it,{children:[V,k]})}),e[87]=V,e[88]=T):T=e[88];let I;e[89]!==T||e[90]!==_||e[91]!==C?(I=r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 mx-1 mt-1",children:[_,C,T]}),e[89]=T,e[90]=_,e[91]=C,e[92]=I):I=e[92];let A;if(e[93]!==m||e[94]!==n){let K;e[96]!==m?(K=U=>r.jsx(ln,{item:U,onClose:m},U.key),e[96]=m,e[97]=K):K=e[97],A=n.map(K),e[93]=m,e[94]=n,e[95]=A}else A=e[95];let N;e[98]!==m||e[99]!==o?(N=r.jsx(ln,{item:o,onClose:m}),e[98]=m,e[99]=o,e[100]=N):N=e[100];let E;e[101]!==A||e[102]!==N?(E=r.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[A,N]}),e[101]=A,e[102]=N,e[103]=E):E=e[103];let R;if(e[104]!==l.theme||e[105]!==c||e[106]!==a){let K;e[108]!==l.theme||e[109]!==c?(K=U=>{const{value:te,icon:X,label:J}=U;return r.jsx("button",{type:"button","aria-label":J,onClick:()=>c(se=>({...se,theme:te})),className:Y("size-7 rounded-md flex items-center justify-center transition-colors",l.theme===te?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:X},te)},e[108]=l.theme,e[109]=c,e[110]=K):K=e[110],R=a.map(K),e[104]=l.theme,e[105]=c,e[106]=a,e[107]=R}else R=e[107];let M;e[111]!==R?(M=r.jsx("div",{className:"flex items-center gap-0.5",children:R}),e[111]=R,e[112]=M):M=e[112];const L=l.enableSounds?"Disable sounds":"Enable sounds";let D;e[113]!==c?(D=()=>c(p0),e[113]=c,e[114]=D):D=e[114];const P=l.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let $;e[115]!==P?($=Y("size-7 rounded-md flex items-center justify-center transition-colors",P),e[115]=P,e[116]=$):$=e[116];let z;e[117]!==l.enableSounds?(z=l.enableSounds?r.jsx(uc,{size:14}):r.jsx(fc,{size:14}),e[117]=l.enableSounds,e[118]=z):z=e[118];let O;e[119]!==L||e[120]!==D||e[121]!==$||e[122]!==z?(O=r.jsx("button",{type:"button","aria-label":L,onClick:D,className:$,children:z}),e[119]=L,e[120]=D,e[121]=$,e[122]=z,e[123]=O):O=e[123];let W;e[124]===Symbol.for("react.memo_cache_sentinel")?(W=r.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","2.276.2"]}),e[124]=W):W=e[124];let F;e[125]!==O?(F=r.jsxs("div",{className:"flex items-center gap-2",children:[O,W]}),e[125]=O,e[126]=F):F=e[126];let G;e[127]!==M||e[128]!==F?(G=r.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[M,F]}),e[127]=M,e[128]=F,e[129]=G):G=e[129];let q;e[130]!==I||e[131]!==E||e[132]!==G?(q=r.jsxs("div",{className:"w-60 shrink-0 flex flex-col border-r border-border bg-sidebar/75",children:[I,E,G]}),e[130]=I,e[131]=E,e[132]=G,e[133]=q):q=e[133];let H;e[134]!==f||e[135]!==h||e[136]!==u||e[137]!==d?(H=r.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 overflow-hidden",children:r.jsx(Yc,{sortedOrgs:d,orgParam:u,onSelectOrg:h,onCreateOrg:f})}),e[134]=f,e[135]=h,e[136]=u,e[137]=d,e[138]=H):H=e[138];let ee;return e[139]!==q||e[140]!==H?(ee=r.jsxs("div",{className:"flex min-h-[380px] w-full overflow-hidden",children:[q,H]}),e[139]=q,e[140]=H,e[141]=ee):ee=e[141],ee}function p0(t){return{...t,enableSounds:!t.enableSounds}}function g0(){me.success("User ID copied")}function _0(t){return{...t,enableSounds:!t.enableSounds}}function x0(){me.success("User ID copied")}function tf(){const t=B.c(50),{data:e}=St.useSession(),{data:s}=St.useListOrganizations(),i=Ke();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org",shouldThrow:!1},t[0]=n):n=t[0];const a=ip(n)?.params.org,[l,c]=Wi(),d=Rs(),[u,h]=S.useState(!1),[f,m]=S.useState(!1),p=e?.user,g=p?.image;let _;if(t[1]!==d||t[2]!==i||t[3]!==u||t[4]!==a||t[5]!==s||t[6]!==l||t[7]!==c||t[8]!==p||t[9]!==g){const b=s?.find(ee=>ee.slug===a);let y;if(t[11]!==a||t[12]!==s){let ee;t[14]!==a?(ee=(K,U)=>K.slug===a?-1:U.slug===a?1:K.name.localeCompare(U.name),t[14]=a,t[15]=ee):ee=t[15],y=[...s??[]].sort(ee),t[11]=a,t[12]=s,t[13]=y}else y=t[13];const C=y;let j;t[16]!==i?(j=ee=>{h(!1),i({to:"/$org",params:{org:ee}})},t[16]=i,t[17]=j):j=t[17];const w=j;let V;t[18]===Symbol.for("react.memo_cache_sentinel")?(V=()=>h(!1),t[18]=V):V=t[18];const k=V;let T;t[19]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(Gr,{size:16}),t[19]=T):T=t[19];let I;t[20]!==i||t[21]!==a?(I={key:"preferences",label:"Preferences",icon:T,onClick:()=>{i({to:"/$org/settings/profile",params:{org:a??""}})}},t[20]=i,t[21]=a,t[22]=I):I=t[22];let A;t[23]===Symbol.for("react.memo_cache_sentinel")?(A={key:"terms",label:"Terms of Use",icon:r.jsx(bg,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[23]=A):A=t[23];let N;t[24]===Symbol.for("react.memo_cache_sentinel")?(N={key:"privacy",label:"Privacy Policy",icon:r.jsx(yg,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[24]=N):N=t[24];let E;t[25]===Symbol.for("react.memo_cache_sentinel")?(E={key:"github",label:"decocms/studio",icon:r.jsx(rp,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[25]=E):E=t[25];let R;t[26]===Symbol.for("react.memo_cache_sentinel")?(R={key:"community",label:"Community",icon:r.jsx(ao,{size:16}),href:"https://decocms.com/discord",external:!0},t[26]=R):R=t[26];let M;t[27]===Symbol.for("react.memo_cache_sentinel")?(M={key:"homepage",label:"Homepage",icon:r.jsx(Jh,{size:16}),href:"https://decocms.com",external:!0},t[27]=M):M=t[27];let L;t[28]!==I?(L=[I,A,N,E,R,M],t[28]=I,t[29]=L):L=t[29];const D=L;let P;t[30]===Symbol.for("react.memo_cache_sentinel")?(P={key:"logout",label:"Sign out",icon:r.jsx(Ig,{size:16}),onClick:b0},t[30]=P):P=t[30];const $=P;let z;t[31]===Symbol.for("react.memo_cache_sentinel")?(z={value:"light",icon:r.jsx(C_,{size:14}),label:"Light theme"},t[31]=z):z=t[31];let O;t[32]===Symbol.for("react.memo_cache_sentinel")?(O={value:"dark",icon:r.jsx(j_,{size:14}),label:"Dark theme"},t[32]=O):O=t[32];let W;t[33]===Symbol.for("react.memo_cache_sentinel")?(W=[z,O,{value:"system",icon:r.jsx(k_,{size:14}),label:"System theme"}],t[33]=W):W=t[33];const F=W;let G;t[34]===Symbol.for("react.memo_cache_sentinel")?(G=()=>{h(!1),m(!0)},t[34]=G):G=t[34];let q;t[35]!==w||t[36]!==d||t[37]!==D||t[38]!==a||t[39]!==l||t[40]!==c||t[41]!==C||t[42]!==p||t[43]!==g?(q={user:p,userImage:g,menuItems:D,signOutItem:$,themeOptions:F,preferences:l,setPreferences:c,sortedOrgs:C,orgParam:a,onSelectOrg:w,onCreateOrg:G,close:k,isMobile:d},t[35]=w,t[36]=d,t[37]=D,t[38]=a,t[39]=l,t[40]=c,t[41]=C,t[42]=p,t[43]=g,t[44]=q):q=t[44];const H=q;_=d?r.jsxs(Si,{open:u,onOpenChange:h,direction:"bottom",children:[r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[r.jsx("div",{className:"shrink-0 size-5 rounded-md flex items-center justify-center border border-border/50 overflow-hidden",style:b?.logo?void 0:ga(b?.name??""),children:b?.logo?r.jsx("img",{src:b.logo,alt:"",className:"size-full object-cover"}):r.jsx("span",{className:"font-semibold leading-none text-[8px]",children:(b?.name??"?").slice(0,2).toUpperCase()})}),r.jsx("span",{className:"truncate",children:b?.name??"Account"})]}),r.jsxs(yi,{className:"h-[80dvh] p-0",children:[r.jsx(bi,{className:"sr-only",children:"Account"}),r.jsx(Xc,{...H})]})]}):r.jsxs(li,{open:u,onOpenChange:h,children:[r.jsx(oi,{asChild:!0,children:r.jsx(us,{tooltip:b?.name??"Account",className:"rounded-md",children:r.jsx("div",{className:"shrink-0 size-6 rounded-md flex items-center justify-center border border-border/50 overflow-hidden",style:b?.logo?void 0:ga(b?.name??""),children:b?.logo?r.jsx("img",{src:b.logo,alt:"",className:"size-full object-cover"}):r.jsx("span",{className:"font-semibold leading-none text-[9px]",children:(b?.name??"?").slice(0,2).toUpperCase()})})})}),r.jsx(ai,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[520px] p-0 flex max-h-[520px]",onCloseAutoFocus:v0,children:r.jsx(Xc,{...H})})]}),t[1]=d,t[2]=i,t[3]=u,t[4]=a,t[5]=s,t[6]=l,t[7]=c,t[8]=p,t[9]=g,t[10]=_}else _=t[10];let v;t[45]!==f?(v=r.jsx(h0,{open:f,onOpenChange:m}),t[45]=f,t[46]=v):v=t[46];let x;return t[47]!==_||t[48]!==v?(x=r.jsxs(r.Fragment,{children:[_,v]}),t[47]=_,t[48]=v,t[49]=x):x=t[49],x}function v0(t){return t.preventDefault()}function b0(){St.signOut()}function y0({invitation:t}){const[e,s]=S.useState(!1),[i,n]=S.useState(!1),o=Mt(),a=async()=>{s(!0);try{const c=await St.organization.acceptInvitation({invitationId:t.id});if(c.error)me.error(c.error.message),s(!1);else{const d=await St.organization.setActive({organizationId:t.organizationId});me.success("Invitation accepted!");const u=d?.data?.slug;window.location.href=u?`/${u}`:"/"}}catch{me.error("Failed to accept invitation"),s(!1)}},l=async()=>{n(!0);try{const c=await St.organization.rejectInvitation({invitationId:t.id});c.error?(me.error(c.error.message),n(!1)):(me.success("Invitation declined"),o.invalidateQueries())}catch{me.error("Failed to decline invitation"),n(!1)}};return r.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"You've been invited to join"}),r.jsx("p",{className:"text-sm font-medium truncate",children:t.organizationName??"Unknown organization"})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(re,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:a,disabled:e||i,"aria-label":"Accept invitation",children:r.jsx(Jt,{size:14})}),r.jsx(re,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:l,disabled:e||i,"aria-label":"Decline invitation",children:r.jsx(ii,{size:14})})]})]})}function S0(){const t=S.useContext(np),{data:e}=t.hooks.useListUserInvitations();return(e??[]).filter(i=>i.status==="pending"&&new Date(i.expiresAt)>new Date)}class w0 extends S.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,s){}render(){return this.state.hasError?null:this.props.children}}function V0(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function C0(){const t=B.c(19),e=Ke(),{org:s}=ve();let i;t[0]!==s.id?(i={connectionId:Ht,orgId:s.id},t[0]=s.id,t[1]=i):i=t[1];const n=Me(i);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o={providerId:"deco"},t[2]=o):o=t[2];let a;t[3]!==n?(a={client:n,toolName:"AI_PROVIDER_CREDITS",toolArguments:o,staleTime:6e4,select:j0},t[3]=n,t[4]=a):a=t[4];const{data:l,isPending:c,isError:d}=wi(a),u=l?.balanceCents!=null?l.balanceCents/100:null;let h;t[5]!==u||t[6]!==d||t[7]!==c?(h=c||d||u==null?"Credits":`Credits: $${u.toFixed(2)}`,t[5]=u,t[6]=d,t[7]=c,t[8]=h):h=t[8];const f=h;let m;t[9]!==u?(m=Y(u!=null&&V0(u)),t[9]=u,t[10]=m):m=t[10];let p;t[11]!==e||t[12]!==s.slug?(p=()=>e({to:"/$org/settings/ai-providers",params:{org:s.slug}}),t[11]=e,t[12]=s.slug,t[13]=p):p=t[13];let g;t[14]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx(ml,{size:24}),t[14]=g):g=t[14];let _;return t[15]!==m||t[16]!==p||t[17]!==f?(_=r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(us,{tooltip:f,className:m,onClick:p,children:g})})}),t[15]=m,t[16]=p,t[17]=f,t[18]=_):_=t[18],_}function j0(t){return t.structuredContent}function k0(){const t=B.c(1);if(!bl().some(N0))return null;let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(C0,{}),t[0]=i):i=t[0],i}function N0(t){return t.providerId==="deco"}function A0(){const t=B.c(3),[e,s]=S.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(us,{tooltip:"Connections",onClick:()=>{s(!0)},children:r.jsx(Rg,{size:24})})})}),t[0]=i):i=t[0];let n;return t[1]!==e?(n=r.jsxs(r.Fragment,{children:[i,r.jsx(Pl,{mode:"browse",open:e,onOpenChange:s,defaultTab:"all"})]}),t[1]=e,t[2]=n):n=t[2],n}function E0(){const t=B.c(11),e=S0();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(mc,{size:24}),t[0]=s):s=t[0];let i;t[1]!==e.length?(i=e.length>0&&r.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e.length,t[2]=i):i=t[2];let n;t[3]!==i?(n=r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(oi,{asChild:!0,children:r.jsxs(us,{tooltip:"Inbox",className:"relative",children:[s,i]})})})}),t[3]=i,t[4]=n):n=t[4];let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("div",{className:"px-4 py-3 border-b border-border shrink-0",children:r.jsx("h3",{className:"text-sm font-medium",children:"Inbox"})}),t[5]=o):o=t[5];let a;t[6]!==e?(a=r.jsxs(ai,{side:"right",align:"start",sideOffset:16,collisionPadding:16,className:"w-[min(400px,calc(100vw-2rem))] p-0 h-[min(650px,calc(100dvh-4rem))] flex flex-col",children:[o,e.length===0?r.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[r.jsx(mc,{size:24,className:"text-muted-foreground/50"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:"No invites pending"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Organization invitations will appear here"})]}):r.jsx("div",{className:"overflow-y-auto flex-1",children:e.map(I0)})]}),t[6]=e,t[7]=a):a=t[7];let l;return t[8]!==n||t[9]!==a?(l=r.jsxs(li,{children:[n,a]}),t[8]=n,t[9]=a,t[10]=l):l=t[10],l}function I0(t){return r.jsx(y0,{invitation:t},t.id)}function R0(){const t=B.c(6),e=Ke(),{org:s}=ve();let i;t[0]!==e||t[1]!==s.slug?(i=()=>e({to:"/$org/settings",params:{org:s.slug}}),t[0]=e,t[1]=s.slug,t[2]=i):i=t[2];let n;t[3]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(Gr,{size:24}),t[3]=n):n=t[3];let o;return t[4]!==i?(o=r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(us,{tooltip:"Settings",onClick:i,children:n})})}),t[4]=i,t[5]=o):o=t[5],o}function T0(){const t=B.c(5);let e,s,i,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(w0,{children:r.jsx(S.Suspense,{fallback:null,children:r.jsx(k0,{})})}),s=r.jsx(A0,{}),i=r.jsx(E0,{}),n=r.jsx(R0,{}),t[0]=e,t[1]=s,t[2]=i,t[3]=n):(e=t[0],s=t[1],i=t[2],n=t[3]);let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs(_u,{className:"px-2 pb-3 gap-1",children:[e,s,i,n,r.jsx(gs,{children:r.jsx(Zt,{children:r.jsx(tf,{})})})]}),t[4]=o):o=t[4],o}function D0(){const t=B.c(10),e=Ke(),{org:s}=ve(),{setOpenMobile:i}=qr();let n;t[0]!==e||t[1]!==s.slug||t[2]!==i?(n=()=>{e({to:"/$org/settings",params:{org:s.slug}}),i(!1)},t[0]=e,t[1]=s.slug,t[2]=i,t[3]=n):n=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(Gr,{}),t[4]=o):o=t[4];let a;t[5]!==n?(a=r.jsx(Zt,{children:r.jsx(us,{tooltip:"Settings",onClick:n,children:o})}),t[5]=n,t[6]=a):a=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Zt,{children:r.jsx(tf,{})}),t[7]=l):l=t[7];let c;return t[8]!==a?(c=r.jsx(_u,{children:r.jsxs(gs,{children:[a,l]})}),t[8]=a,t[9]=c):c=t[9],c}function M0(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return S.useMemo(()=>i=>{e.forEach(n=>n(i))},e)}const uo=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ki(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Ll(t){return"nodeType"in t}function Wt(t){var e,s;return t?Ki(t)?t:Ll(t)&&(e=(s=t.ownerDocument)==null?void 0:s.defaultView)!=null?e:window:window}function Bl(t){const{Document:e}=Wt(t);return t instanceof e}function Xr(t){return Ki(t)?!1:t instanceof Wt(t).HTMLElement}function sf(t){return t instanceof Wt(t).SVGElement}function qi(t){return t?Ki(t)?t.document:Ll(t)?Bl(t)?t:Xr(t)||sf(t)?t.ownerDocument:document:document:document}const Es=uo?S.useLayoutEffect:S.useEffect;function Ol(t){const e=S.useRef(t);return Es(()=>{e.current=t}),S.useCallback(function(){for(var s=arguments.length,i=new Array(s),n=0;n<s;n++)i[n]=arguments[n];return e.current==null?void 0:e.current(...i)},[])}function P0(){const t=S.useRef(null),e=S.useCallback((i,n)=>{t.current=setInterval(i,n)},[]),s=S.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,s]}function Er(t,e){e===void 0&&(e=[t]);const s=S.useRef(t);return Es(()=>{s.current!==t&&(s.current=t)},e),s}function Jr(t,e){const s=S.useRef();return S.useMemo(()=>{const i=t(s.current);return s.current=i,i},[...e])}function Hn(t){const e=Ol(t),s=S.useRef(null),i=S.useCallback(n=>{n!==s.current&&e?.(n,s.current),s.current=n},[]);return[s,i]}function _a(t){const e=S.useRef();return S.useEffect(()=>{e.current=t},[t]),e.current}let Ro={};function Qr(t,e){return S.useMemo(()=>{if(e)return e;const s=Ro[t]==null?0:Ro[t]+1;return Ro[t]=s,t+"-"+s},[t,e])}function rf(t){return function(e){for(var s=arguments.length,i=new Array(s>1?s-1:0),n=1;n<s;n++)i[n-1]=arguments[n];return i.reduce((o,a)=>{const l=Object.entries(a);for(const[c,d]of l){const u=o[c];u!=null&&(o[c]=u+t*d)}return o},{...e})}}const Di=rf(1),Ir=rf(-1);function L0(t){return"clientX"in t&&"clientY"in t}function $l(t){if(!t)return!1;const{KeyboardEvent:e}=Wt(t.target);return e&&t instanceof e}function B0(t){if(!t)return!1;const{TouchEvent:e}=Wt(t.target);return e&&t instanceof e}function xa(t){if(B0(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:s}=t.touches[0];return{x:e,y:s}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:s}=t.changedTouches[0];return{x:e,y:s}}}return L0(t)?{x:t.clientX,y:t.clientY}:null}const Rr=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:s}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:s}=t;return"scaleX("+e+") scaleY("+s+")"}},Transform:{toString(t){if(t)return[Rr.Translate.toString(t),Rr.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:s,easing:i}=t;return e+" "+s+"ms "+i}}}),Jc="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function O0(t){return t.matches(Jc)?t:t.querySelector(Jc)}const $0={display:"none"};function z0(t){let{id:e,value:s}=t;return zt.createElement("div",{id:e,style:$0},s)}function F0(t){let{id:e,announcement:s,ariaLiveType:i="assertive"}=t;const n={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return zt.createElement("div",{id:e,style:n,role:"status","aria-live":i,"aria-atomic":!0},s)}function H0(){const[t,e]=S.useState("");return{announce:S.useCallback(i=>{i!=null&&e(i)},[]),announcement:t}}const nf=S.createContext(null);function W0(t){const e=S.useContext(nf);S.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function U0(){const[t]=S.useState(()=>new Set),e=S.useCallback(i=>(t.add(i),()=>t.delete(i)),[t]);return[S.useCallback(i=>{let{type:n,event:o}=i;t.forEach(a=>{var l;return(l=a[n])==null?void 0:l.call(a,o)})},[t]),e]}const K0={draggable:`
|
|
260
260
|
To pick up a draggable item, press the space bar.
|
|
261
261
|
While dragging, use the arrow keys to move the item.
|
|
262
262
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -447,4 +447,4 @@ ${Q}
|
|
|
447
447
|
|
|
448
448
|
<message>
|
|
449
449
|
${de}
|
|
450
|
-
</message>`}]}}))},L=e.models?.credentialId||m||"",D=e.models?.thinking?.id||p?.modelId||"",P=Hi({defaultValues:{name:e.name,active:e.active,credential_id:L,model_id:D}}),$=P.watch("active"),z=P.watch("credential_id"),O=P.watch("model_id"),{models:W,isLoading:F}=Zh(z||void 0),G=W.find(ne=>ne.modelId===O)??null,q=S.useRef(null),H=S.useRef(new Set),ee=S.useRef(0),K=S.useRef(null),U=3e4,te=()=>{K.current&&(clearTimeout(K.current),K.current=null),q.current!==null&&(ye("automation_updated",{fields:Array.from(H.current),save_count:ee.current,edit_duration_ms:Date.now()-q.current}),q.current=null,H.current=new Set,ee.current=0)},X=async()=>{if(!(Object.keys(P.formState.dirtyFields).length>0)&&!R.current)return!0;const de=Object.keys(P.formState.dirtyFields),fe=R.current;R.current=!1;const ue=P.getValues();try{const ae=ue.credential_id&&ue.model_id?ue.credential_id:"",_e=ue.credential_id&&ue.model_id?ue.model_id:"",Ce={id:t,name:ue.name,active:ue.active,agent:{id:o},models:{credentialId:ae,thinking:{id:_e}},messages:Ep(b),temperature:0};await l.mutateAsync(Ce),q.current===null&&(q.current=Date.now());for(const Te of de)H.current.add(Te);return fe&&H.current.add("messages"),ee.current+=1,K.current&&clearTimeout(K.current),K.current=setTimeout(te,U),P.reset({...ue,credential_id:ae,model_id:_e}),!0}catch{return R.current=!0,!1}},J=()=>{E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{X()},1e3)},se=async()=>(E.current&&clearTimeout(E.current),X()),he=ne=>{if(y(ne),!N.current){N.current=!0;return}R.current=!0,J()},ce=S.useRef(!1);ce.current||(ce.current=!0,P.watch(()=>{J()}));const pe=async()=>{const ne=await se();if(te(),!ne)return;if(!b){me.error("No instructions configured for this automation");return}G&&z&&f({...G,keyId:z}),v({..._,toolApprovalLevel:"auto"});const de=cc(b);h({message:{tiptapDoc:b,parts:de},virtualMcpId:o||void 0})};return r.jsxs(r.Fragment,{children:[i&&r.jsx("div",{className:"flex items-center pb-4 shrink-0",children:r.jsxs(re,{variant:"ghost",size:"sm",onClick:i,children:[r.jsx(xl,{size:14}),"Back to list"]})}),r.jsxs("div",{className:"flex flex-col gap-8",children:[r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(bt,{...P.register("name"),placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}}),n&&r.jsx(re,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:r.jsx(ha,{size:14})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ai,{control:P.control,name:"active",render:({field:ne})=>r.jsx(da,{checked:ne.value,onCheckedChange:de=>{ne.onChange(de),setTimeout(()=>se(),0)},className:"cursor-pointer"})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:$?"Active":"Inactive"}),r.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),r.jsx(T_,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),r.jsxs("div",{className:"flex flex-col gap-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),r.jsx(m5,{automationId:t,open:C,onOpenChange:j,onCustomSelect:()=>{V(!0),A(!1),T("")},onEventSelect:()=>{A(!0),V(!1)}})]}),e.triggers.length===0&&!w?r.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",r.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>j(!0),children:"Add a starter"})," ","to get going."]})}):r.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(ne=>r.jsx(p5,{trigger:ne,automationId:t,connectionName:ne.connection_id?u.get(ne.connection_id):void 0},ne.id))}),w&&r.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[r.jsx(_r,{size:14,className:"text-muted-foreground shrink-0"}),r.jsx("input",{type:"text",value:k,onChange:ne=>T(ne.target.value),onBlur:async()=>{const ne=k.trim();if(!(!ne||!Vr(ne)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:ne}),ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),me.success("Starter added"),V(!1),T("")}catch{me.error("Failed to add starter")}},onKeyDown:async ne=>{const de=k.trim();ne.key==="Enter"&&de&&Vr(de)&&ne.target.blur(),ne.key==="Escape"&&(V(!1),T(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!Vr(k)&&r.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),c.isPending&&r.jsx(Ee,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),r.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{V(!1),T("")},children:r.jsx(ii,{size:13})})]}),I&&r.jsx(S.Suspense,{fallback:r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[r.jsx(Ee,{size:13,className:"animate-spin text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:r.jsx(_5,{automationId:t,onDone:()=>A(!1)})})]}),r.jsxs("div",{className:"flex flex-col gap-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:!b,onClick:M,children:[r.jsx(_l,{size:13}),"Improve"]})]}),r.jsx(Hu,{tiptapDoc:b,setTiptapDoc:he,placeholder:"What should this automation do?",children:r.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[r.jsx(Wu,{virtualMcpId:o||null,className:"max-h-[45vh]"}),r.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[r.jsx(eu,{model:G,isLoading:F,credentialId:z||null,onCredentialChange:ne=>{P.setValue("credential_id",ne??"",{shouldDirty:!0}),P.setValue("model_id","",{shouldDirty:!0})},onModelChange:ne=>P.setValue("model_id",ne.modelId,{shouldDirty:!0}),placeholder:"Model"}),r.jsxs(it,{children:[r.jsx(tt,{asChild:!0,children:r.jsxs(re,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:pe,disabled:!o,children:[r.jsx($h,{size:16}),"Test"]})}),r.jsx(st,{children:"Test Automation"})]})]})]})})]})]})]})}function S5(t){const e=B.c(6),{tabId:s,virtualMcpId:i}=t;let n;e[0]!==s?(n=Ah(s),e[0]=s,e[1]=n):n=e[1];const o=n;if(!o)return null;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let l;return e[3]!==o.id||e[4]!==i?(l=r.jsx(hs,{children:r.jsx(hs.Content,{children:r.jsx(hs.Body,{children:r.jsx(S.Suspense,{fallback:a,children:r.jsx(w5,{id:o.id,virtualMcpId:i})})})})}),e[3]=o.id,e[4]=i,e[5]=l):l=e[5],l}function w5(t){const e=B.c(9),{id:s,virtualMcpId:i}=t,n=Ke(),{data:o,isLoading:a}=M_(s);let l;e[0]!==n?(l=()=>n({to:".",search:V5,replace:!0}),e[0]=n,e[1]=l):l=e[1];const c=l;if(a){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=u):u=e[2],u}if(!o){let u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=u):u=e[3],u}let d;return e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==i?(d=r.jsx(y5,{automationId:s,automation:o,virtualMcpId:i,onBack:c}),e[4]=o,e[5]=s,e[6]=c,e[7]=i,e[8]=d):d=e[8],d}function V5(t){return{...t,main:"automations"}}function C5(t){const e=B.c(19),{virtualMcpId:s}=t,i=Ke(),{data:n}=P_(s),o=n===void 0?[]:n,{create:a}=Yr(),[l,c]=S.useState(""),d=l.toLowerCase(),u=o.filter(k=>k.name.toLowerCase().includes(d));let h;e[0]!==i?(h=k=>i({to:".",search:T=>({...T,main:"automation:"+k}),replace:!0}),e[0]=i,e[1]=h):h=e[1];const f=h,m=async()=>{if(a.isPending)return;ye("automation_new_clicked",{existing_count:o.length});const k=await a.mutateAsync(B_(s));f(k.id)},p=hs,g=hs,_=hs;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(Qt,{size:14}),e[2]=v):v=e[2];let x;e[3]!==a.isPending||e[4]!==m?(x=r.jsx(hs.Title,{actions:r.jsxs(re,{size:"sm",onClick:m,disabled:a.isPending,children:[v,"New automation"]}),children:"Automations"}),e[3]=a.isPending,e[4]=m,e[5]=x):x=e[5];const b=o.length>0&&r.jsx(O_,{value:l,onChange:c,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let y;e[6]!==x||e[7]!==b?(y=r.jsxs("div",{className:"flex flex-col gap-6",children:[x,b]}),e[6]=x,e[7]=b,e[8]=y):y=e[8];const C=o.length===0?r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx(Oi,{image:r.jsx($i,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:r.jsxs(re,{size:"sm",onClick:m,disabled:a.isPending,children:[r.jsx(Qt,{size:14}),"New automation"]})})}):u.length===0?r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx(Oi,{image:r.jsx($i,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):r.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(k=>r.jsx(L_,{automation:k,onClick:()=>f(k.id)},k.id))});let j;e[9]!==_.Body||e[10]!==y||e[11]!==C?(j=r.jsxs(_.Body,{children:[y,C]}),e[9]=_.Body,e[10]=y,e[11]=C,e[12]=j):j=e[12];let w;e[13]!==j||e[14]!==g.Content?(w=r.jsx(g.Content,{children:j}),e[13]=j,e[14]=g.Content,e[15]=w):w=e[15];let V;return e[16]!==p||e[17]!==w?(V=r.jsx(p,{children:w}),e[16]=p,e[17]=w,e[18]=V):V=e[18],V}function j5(t){const e=B.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let n;return e[1]!==s?(n=r.jsx(S.Suspense,{fallback:i,children:r.jsx(C5,{virtualMcpId:s})}),e[1]=s,e[2]=n):n=e[2],n}const mh=S.lazy(()=>Cp(()=>import("./project-app-view-DOiFaagj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])).then(t=>({default:t.AppViewContent})));function k5(t){const e=B.c(35),{taskId:s,virtualMcpId:i}=t;let n;e[0]!==s||e[1]!==i?(n={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=n):n=e[2];const{activeTab:o,layoutTabs:a,automationTabParsed:l}=$f(n);if(Gp(o)){let m;return e[3]!==i?(m=r.jsx(_d,{virtualMcpId:i}),e[3]=i,e[4]=m):m=e[4],m}if(o==="git"){let m;return e[5]!==i?(m=r.jsx(fV,{virtualMcpId:i}),e[5]=i,e[6]=m):m=e[6],m}if(o==="automations"){let m;return e[7]!==i?(m=r.jsx(j5,{virtualMcpId:i}),e[7]=i,e[8]=m):m=e[8],m}if(o==="env"){let m;return e[9]!==i?(m=r.jsx(l5,{virtualMcpId:i}),e[9]=i,e[10]=m):m=e[10],m}if(o==="preview"){let m;return e[11]!==i?(m=r.jsx(WV,{virtualMcpId:i}),e[11]=i,e[12]=m):m=e[12],m}if(l){let m;return e[13]!==o||e[14]!==i?(m=r.jsx(S5,{tabId:o,virtualMcpId:i}),e[13]=o,e[14]=i,e[15]=m):m=e[15],m}let c;e[16]!==o?(c=Yp(o),e[16]=o,e[17]=c):c=e[17];const d=c;if(d){let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[18]=m):m=e[18];let p;return e[19]!==o||e[20]!==d.connectionId||e[21]!==d.toolName?(p=r.jsx(S.Suspense,{fallback:m,children:r.jsx(mh,{connectionId:d.connectionId,toolName:d.toolName},o)}),e[19]=o,e[20]=d.connectionId,e[21]=d.toolName,e[22]=p):p=e[22],p}let u;if(e[23]!==o||e[24]!==a){let m;e[26]!==o?(m=p=>p.id===o,e[26]=o,e[27]=m):m=e[27],u=a.find(m),e[23]=o,e[24]=a,e[25]=u}else u=e[25];const h=u;if(h){let m;e[28]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[28]=m):m=e[28];let p;return e[29]!==o||e[30]!==h.id||e[31]!==h.view.appId?(p=r.jsx(S.Suspense,{fallback:m,children:r.jsx(mh,{connectionId:h.view.appId,toolName:h.id},o)}),e[29]=o,e[30]=h.id,e[31]=h.view.appId,e[32]=p):p=e[32],p}let f;return e[33]!==i?(f=r.jsx(_d,{virtualMcpId:i}),e[33]=i,e[34]=f):f=e[34],f}function N5(t){const e=B.c(7),{children:s,defaultSize:i}=t,[,n]=S.useTransition();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=ol.decoChatPanelWidth(),e[0]=o):o=e[0];const[a,l]=nl(o,45),c=i>0&&i<100?a:i;let d;e[1]!==l?(d=f=>n(()=>{f>0&&f<100&&l(f)}),e[1]=l,e[2]=d):d=e[2];const u=d;let h;return e[3]!==s||e[4]!==c||e[5]!==u?(h=r.jsx(tu,{defaultSize:c,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=c,e[5]=u,e[6]=h):h=e[6],h}function A5(t){const e=B.c(31),{virtualMcpId:s,taskId:i,chatOpen:n,mainOpen:o,variant:a,chatContent:l}=t;let c;e[0]!==n||e[1]!==o?(c=ud(n,o),e[0]=n,e[1]=o,e[2]=c):c=e[2];const d=c;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=ol.decoChatPanelWidth(),e[3]=u):u=e[3];const[h]=nl(u,45),f=S.useRef(null);let m,p;e[4]!==n||e[5]!==o||e[6]!==h?(m=()=>{const I=f.current;if(!I)return;const A=ud(n,o),N=A.chat>0&&A.chat<100?h:A.chat,E=A.chat>0&&A.chat<100?100-h:A.main;I.setLayout([N,E])},p=[n,o,h],e[4]=n,e[5]=o,e[6]=h,e[7]=m,e[8]=p):(m=e[7],p=e[8]),S.useEffect(m,p);const g=`${s}-${i}`;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_={overflow:"visible"},e[9]=_):_=e[9];let v;e[10]!==l||e[11]!==a?(v=l??r.jsx(Ku,{variant:a}),e[10]=l,e[11]=a,e[12]=v):v=e[12];let x;e[13]!==v?(x=r.jsx("div",{className:"h-full p-0.5 pt-0.25",children:r.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:v})}),e[13]=v,e[14]=x):x=e[14];let b;e[15]!==d.chat||e[16]!==x?(b=r.jsx(N5,{defaultSize:d.chat,children:x}),e[15]=d.chat,e[16]=x,e[17]=b):b=e[17];let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Kg,{className:"bg-sidebar"}),e[18]=y):y=e[18];const C=d.main;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j={overflow:"visible"},e[19]=j):j=e[19];let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=Y("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[20]=w):w=e[20];let V;e[21]!==i||e[22]!==s?(V=r.jsx("div",{className:"h-full p-0.5 pt-0.25",children:r.jsx("div",{className:w,children:r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:r.jsx(k5,{taskId:i,virtualMcpId:s})})})}),e[21]=i,e[22]=s,e[23]=V):V=e[23];let k;e[24]!==d.main||e[25]!==V?(k=r.jsx(tu,{className:"min-w-0 flex flex-col",order:2,defaultSize:C,style:j,collapsible:!0,collapsedSize:0,minSize:20,children:V}),e[24]=d.main,e[25]=V,e[26]=k):k=e[26];let T;return e[27]!==k||e[28]!==g||e[29]!==b?(T=r.jsxs(qg,{ref:f,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:_,children:[b,y,k]},g),e[27]=k,e[28]=g,e[29]=b,e[30]=T):T=e[30],T}const ta="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",ph="bg-sidebar-accent text-sidebar-foreground",sa="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function E5(t){const e=B.c(38),{isDecopilot:s,chatOpen:i,toggleChat:n,onNewTask:o}=t,{tasksOpen:a,toggleTasks:l}=Bf(),c=!!o;let d;e[0]!==a||e[1]!==l?(d=()=>{l()},e[0]=a,e[1]=l,e[2]=d):d=e[2];const u=a?ph:sa;let h;e[3]!==u?(h=Y(ta,u),e[3]=u,e[4]=h):h=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Eg,{size:16}),e[5]=f):f=e[5];let m;e[6]!==d||e[7]!==h||e[8]!==a?(m=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",onClick:d,"aria-pressed":a,className:h,children:f})}),e[6]=d,e[7]=h,e[8]=a,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(st,{side:"bottom",children:"Tasks"}),e[10]=p):p=e[10];let g;e[11]!==m?(g=r.jsxs(it,{delayDuration:300,children:[m,p]}),e[11]=m,e[12]=g):g=e[12];let _;e[13]!==i||e[14]!==s||e[15]!==n?(_=!s&&r.jsxs(it,{delayDuration:300,children:[r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",onClick:()=>{n()},"aria-pressed":i,className:Y(ta,i?ph:sa),children:r.jsx(Ag,{size:16})})}),r.jsx(st,{side:"bottom",children:"Chat"})]}),e[13]=i,e[14]=s,e[15]=n,e[16]=_):_=e[16];const v=c?"grid-cols-[1fr]":"grid-cols-[0fr]";let x;e[17]!==v?(x=Y("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",v),e[17]=v,e[18]=x):x=e[18];const b=!c,y=c?0:-1,C=!c,j=c?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let w;e[19]!==j?(w=Y(ta,sa,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",j),e[19]=j,e[20]=w):w=e[20];let V;e[21]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(pl,{size:16}),e[21]=V):V=e[21];let k;e[22]!==o||e[23]!==b||e[24]!==y||e[25]!==C||e[26]!==w?(k=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",onClick:o,disabled:b,tabIndex:y,"aria-hidden":C,className:w,children:V})}),e[22]=o,e[23]=b,e[24]=y,e[25]=C,e[26]=w,e[27]=k):k=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(st,{side:"bottom",children:"New task"}),e[28]=T):T=e[28];let I;e[29]!==k?(I=r.jsx("div",{className:"overflow-hidden",children:r.jsxs(it,{delayDuration:300,children:[k,T]})}),e[29]=k,e[30]=I):I=e[30];let A;e[31]!==x||e[32]!==I?(A=r.jsx("div",{className:x,children:I}),e[31]=x,e[32]=I,e[33]=A):A=e[33];let N;return e[34]!==A||e[35]!==g||e[36]!==_?(N=r.jsxs(r.Fragment,{children:[g,_,A]}),e[34]=A,e[35]=g,e[36]=_,e[37]=N):N=e[37],N}function I5(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),n=t.slice(s);if(e==null)return{visible:i,overflow:n};if(i.some(h=>h.id===e))return{visible:i,overflow:n};const a=n.findIndex(h=>h.id===e);if(a===-1)return{visible:i,overflow:n};const l=i[i.length-1],c=n[a],d=[...i.slice(0,-1),c],u=[l,...n.slice(0,a),...n.slice(a+1)];return{visible:d,overflow:u}}function R5(t){const e=B.c(13),{title:s,icon:i,active:n,onClick:o}=t,a=n?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=Y("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==i?(c=r.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:r.jsx(T5,{icon:i})}),e[2]=i,e[3]=c):c=e[3];let d;e[4]!==s?(d=r.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=d):d=e[5];let u;return e[6]!==n||e[7]!==o||e[8]!==l||e[9]!==c||e[10]!==d||e[11]!==s?(u=r.jsxs("button",{type:"button",onClick:o,"aria-pressed":n,"aria-label":s,className:l,children:[c,d]}),e[6]=n,e[7]=o,e[8]=l,e[9]=c,e[10]=d,e[11]=s,e[12]=u):u=e[12],u}function T5(t){const e=B.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:n}=s;let o;return e[0]!==n?(o=r.jsx(n,{className:"size-4"}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="url"){let n;return e[2]!==s.src?(n=r.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=n):n=e[3],n}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(qh,{className:"size-4"}),e[4]=i):i=e[4],i}function D5(t){const e=B.c(13),{overflow:s,onSelect:i}=t,[n,o]=S.useState(!1);let a;e[0]!==i?(a=f=>{o(!1),i(f)},e[0]=i,e[1]=a):a=e[1];const l=a;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(oi,{asChild:!0,children:r.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:r.jsx(Wh,{className:"size-4"})})}),e[2]=c):c=e[2];let d;if(e[3]!==l||e[4]!==s){let f;e[6]!==l?(f=m=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l(m.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[r.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:r.jsx(M5,{icon:m.icon})}),r.jsx("span",{className:"truncate",children:m.title})]})},m.id),e[6]=l,e[7]=f):f=e[7],d=s.map(f),e[3]=l,e[4]=s,e[5]=d}else d=e[5];let u;e[8]!==d?(u=r.jsx(ai,{align:"end",className:"w-56 p-1",children:r.jsx("ul",{className:"flex flex-col",children:d})}),e[8]=d,e[9]=u):u=e[9];let h;return e[10]!==n||e[11]!==u?(h=r.jsxs(li,{open:n,onOpenChange:o,children:[c,u]}),e[10]=n,e[11]=u,e[12]=h):h=e[12],h}function M5(t){const e=B.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:n}=s;let o;return e[0]!==n?(o=r.jsx(n,{className:"size-4"}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="url"){let n;return e[2]!==s.src?(n=r.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=n):n=e[3],n}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(qh,{className:"size-4"}),e[4]=i):i=e[4],i}const P5=6;function L5(t){const e=B.c(20),{virtualMcpId:s,taskId:i}=t,n=Ke();let o;e[0]!==i||e[1]!==s?(o={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=o):o=e[2];const{tabs:a,activeTab:l,mainOpen:c,setActiveTab:d}=$f(o);let u,h,f,m;if(e[3]!==l||e[4]!==c||e[5]!==n||e[6]!==d||e[7]!==a||e[8]!==s){const _=Xp({activeTab:l,mainOpen:c}),v=j=>j.id==="automations"?_:c&&j.id===l,b=a.find(j=>v(j))?.id??null,{visible:y,overflow:C}=I5(a,b,P5);h=C,u=j=>{const w=a.find(V=>V.id===j);if(ye("main_panel_tab_clicked",{tab_kind:w?.kind??null}),j==="automations"){const V=Jp({activeTab:l,mainOpen:c});n({to:".",search:k=>({...k,main:V}),replace:!0});return}d(j)},f="flex items-center min-w-0 ml-auto gap-0.5",m=y.map(j=>r.jsx(R5,{title:j.title,icon:j.icon,active:v(j),onClick:()=>u(j.id)},j.id)),e[3]=l,e[4]=c,e[5]=n,e[6]=d,e[7]=a,e[8]=s,e[9]=u,e[10]=h,e[11]=f,e[12]=m}else u=e[9],h=e[10],f=e[11],m=e[12];let p;e[13]!==u||e[14]!==h?(p=h.length>0&&r.jsx(D5,{overflow:h,onSelect:u}),e[13]=u,e[14]=h,e[15]=p):p=e[15];let g;return e[16]!==f||e[17]!==m||e[18]!==p?(g=r.jsxs("div",{className:f,children:[m,p]}),e[16]=f,e[17]=m,e[18]=p,e[19]=g):g=e[19],g}function B5(t){const e=B.c(12);let s,i,n,o;e[0]!==t?({className:s,orientation:n,decorative:o,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=n,e[4]=o):(s=e[1],i=e[2],n=e[3],o=e[4]);const a=n===void 0?"horizontal":n,l=o===void 0?!0:o;let c;e[5]!==s?(c=Y("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=c):c=e[6];let d;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==c?(d=r.jsx(jp,{"data-slot":"separator-root",decorative:l,orientation:a,className:c,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=c,e[11]=d):d=e[11],d}function O5(t){const e=B.c(20),{prNumber:s,disabled:i,send:n}=t;let o;e[0]!==s||e[1]!==n?(o=()=>n(sV({prNumber:s})),e[0]=s,e[1]=n,e[2]=o):o=e[2];const a=o;let l;e[3]!==s||e[4]!==n?(l=()=>n(tV({prNumber:s})),e[3]=s,e[4]=n,e[5]=l):l=e[5];const c=l;let d;e[6]!==i||e[7]!==a?(d=r.jsx(re,{size:"sm",className:"rounded-r-none border-r border-primary-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=d):d=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(kr,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let h;e[10]!==i?(h=r.jsx(ks,{asChild:!0,children:r.jsx(re,{size:"sm",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=h):h=e[11];let f;e[12]!==c?(f=r.jsx(Ns,{align:"end",children:r.jsx(ot,{onClick:c,children:"Review"})}),e[12]=c,e[13]=f):f=e[13];let m;e[14]!==h||e[15]!==f?(m=r.jsxs(js,{children:[h,f]}),e[14]=h,e[15]=f,e[16]=m):m=e[16];let p;return e[17]!==d||e[18]!==m?(p=r.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[d,m]}),e[17]=d,e[18]=m,e[19]=p):p=e[19],p}const $5=new Set(["failure","timed_out","cancelled","action_required"]);function z5(t){return t.status==="completed"&&$5.has(t.conclusion)}function F5(t){return t.status==="queued"||t.status==="in_progress"}function H5(t){const{branchStatus:e,pr:s,checks:i,reviews:n}=t;if(!e)return null;if(e.workingTreeDirty||e.unpushed>0)return{label:"Save changes",action:"commit-and-push"};if(s?.merged)return!!e.headSha&&!!s.headSha&&e.headSha!==s.headSha?{label:"Submit for review",action:"create-pr"}:null;if(e.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen"};if(!s)return{label:"Submit for review",action:"create-pr"};if((n?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase"};const l=i.filter(z5).map(c=>c.name);return l.length>0?{label:"Fix tests",action:"fix-checks",meta:{failingChecks:l}}:i.some(F5)?{label:"Running tests…",disabled:!0}:n?.draft?{label:"Mark ready",action:"mark-ready"}:(n?.unresolvedConversations??0)>0?{label:"Address feedback",action:"resolve-comments"}:n?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0}:{label:"Publish",action:"merge-split"}}return null}function W5(){return Yi().branchStatus}const U5=6e4,K5=3e4;function q5(t){const e=B.c(11);let s;e[0]!==t.connectionId||e[1]!==t.orgId?(s={connectionId:t.connectionId,orgId:t.orgId},e[0]=t.connectionId,e[1]=t.orgId,e[2]=s):s=e[2];const i=Me(s),n=t.prNumber??0;let o;e[3]!==t.owner||e[4]!==t.repo||e[5]!==n?(o={method:"get",owner:t.owner,repo:t.repo,pullNumber:n},e[3]=t.owner,e[4]=t.repo,e[5]=n,e[6]=o):o=e[6];const a=!!t.prNumber;let l;return e[7]!==i||e[8]!==o||e[9]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:o,enabled:a,refetchInterval:U5,refetchIntervalInBackground:!1,staleTime:K5,select:G5},e[7]=i,e[8]=o,e[9]=a,e[10]=l):l=e[10],wi(l)}function G5(t){const e=Zr(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),n=Number(e.review_comments??0),o=s==="blocked"&&n>0?n:0;return{draft:i,mergeableState:s,unresolvedConversations:o,missingRequiredApprovals:s==="blocked"&&o===0}}function Y5(t){const e=B.c(38),{virtualMcpId:s}=t,{org:i}=ve(),n=ts(s),{currentBranch:o}=es(),a=Zn(),l=n?.metadata?.githubRepo??null,c=W5(),d=l?.connectionId??"",u=l?.owner??"",h=l?.name??"",f=o??null;let m;e[0]!==i.id||e[1]!==d||e[2]!==u||e[3]!==h||e[4]!==f?(m={orgId:i.id,connectionId:d,owner:u,repo:h,branch:f},e[0]=i.id,e[1]=d,e[2]=u,e[3]=h,e[4]=f,e[5]=m):m=e[5];const g=Ff(m).data??null,_=l?.connectionId??"",v=l?.owner??"",x=l?.name??"",b=g&&g.state==="open"?g.number:null;let y;e[6]!==i.id||e[7]!==_||e[8]!==v||e[9]!==x||e[10]!==b?(y={orgId:i.id,connectionId:_,owner:v,repo:x,prNumber:b},e[6]=i.id,e[7]=_,e[8]=v,e[9]=x,e[10]=b,e[11]=y):y=e[11];const C=Wf(y),j=l?.connectionId??"",w=l?.owner??"",V=l?.name??"",k=g&&g.state==="open"?g.number:null;let T;e[12]!==i.id||e[13]!==j||e[14]!==w||e[15]!==V||e[16]!==k?(T={orgId:i.id,connectionId:j,owner:w,repo:V,prNumber:k},e[12]=i.id,e[13]=j,e[14]=w,e[15]=V,e[16]=k,e[17]=T):T=e[17];const I=q5(T);if(!l?.connectionId||!o)return null;let A;e[18]!==c||e[19]!==C.data||e[20]!==g||e[21]!==I.data?(A=H5({branchStatus:c,pr:g,checks:C.data??[],reviews:I.data??null}),e[18]=c,e[19]=C.data,e[20]=g,e[21]=I.data,e[22]=A):A=e[22];const N=A;if(!N)return null;let E;e[23]!==a?(E=O=>a.sendMessage({parts:[{type:"text",text:O}]}),e[23]=a,e[24]=E):E=e[24];const R=E,M=a.isStreaming;let L;e[25]!==o||e[26]!==N||e[27]!==M||e[28]!==g||e[29]!==R?(L=O=>{if(!M)switch(O){case"commit-and-push":{R(qw({branch:o}));return}case"create-pr":{R(Gw({branch:o}));return}case"reopen":{g&&R(Yw({prNumber:g.number}));return}case"rebase":{R(Xw({branch:o}));return}case"fix-checks":{g&&R(Qw({prNumber:g.number,failingChecks:N.meta?.failingChecks??[]}));return}case"mark-ready":{g&&R(Zw({prNumber:g.number}));return}case"resolve-comments":{g&&R(eV({prNumber:g.number}));return}case"merge-split":return}},e[25]=o,e[26]=N,e[27]=M,e[28]=g,e[29]=R,e[30]=L):L=e[30];const D=L;let P;e[31]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(B5,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[31]=P):P=e[31];const $=g?.number;let z;return e[32]!==N||e[33]!==M||e[34]!==D||e[35]!==R||e[36]!==$?(z=r.jsxs(r.Fragment,{children:[P,r.jsx(X5,{button:N,isStreaming:M,onActivate:D,prNumber:$,send:R})]}),e[32]=N,e[33]=M,e[34]=D,e[35]=R,e[36]=$,e[37]=z):z=e[37],z}function X5(t){const e=B.c(18),{button:s,isStreaming:i}=t,n=!!s.disabled||i,o=i?"Chat is running":null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==n||e[1]!==t.prNumber||e[2]!==t.send?(u=r.jsx(O5,{prNumber:t.prNumber,disabled:n,send:t.send}),e[0]=n,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let h;return e[4]!==u||e[5]!==o?(h=r.jsx(gh,{label:o,children:u}),e[4]=u,e[5]=o,e[6]=h):h=e[6],h}const a=s.disabled?"outline":"default";let l;e[7]!==s.action||e[8]!==t?(l=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=l):l=e[9];let c;e[10]!==s.label||e[11]!==n||e[12]!==a||e[13]!==l?(c=r.jsx(re,{size:"sm",variant:a,disabled:n,onClick:l,children:s.label}),e[10]=s.label,e[11]=n,e[12]=a,e[13]=l,e[14]=c):c=e[14];let d;return e[15]!==c||e[16]!==o?(d=r.jsx(gh,{label:o,children:c}),e[15]=c,e[16]=o,e[17]=d):d=e[17],d}function gh(t){const e=B.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=r.jsx(r.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let n;e[2]!==i?(n=r.jsx(tt,{asChild:!0,children:r.jsx("span",{children:i})}),e[2]=i,e[3]=n):n=e[3];let o;e[4]!==s?(o=r.jsx(st,{children:s}),e[4]=s,e[5]=o):o=e[5];let a;return e[6]!==n||e[7]!==o?(a=r.jsx(Mi,{children:r.jsxs(it,{children:[n,o]})}),e[6]=n,e[7]=o,e[8]=a):a=e[8],a}function J5(t){const e=B.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let o;return e[0]!==s.id?(o=r.jsx(ze.Right,{children:r.jsx(Y5,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=o):o=e[1],o}const Ii=S.createContext(null);function ac(){return S.use(Ii)}function _h(t){const e=B.c(8),{children:s,variant:i}=t,{taskId:n}=es();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=o):o=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(De.Skeleton,{}),e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==i?(l=s??r.jsx(Ku,{variant:i}),e[2]=s,e[3]=i,e[4]=l):l=e[4];let c;return e[5]!==l||e[6]!==n?(c=r.jsx(Cs,{fallback:o,children:r.jsx(S.Suspense,{fallback:a,children:r.jsx(De.ActiveTaskProvider,{taskId:n,children:l})})}),e[5]=l,e[6]=n,e[7]=c):c=e[7],c}function xh(t){const e=B.c(3),{onNewTaskRef:s,createNewTask:i}=t;let n;return e[0]!==i||e[1]!==s?(n=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=n):n=e[2],S.useLayoutEffect(n),null}function Q5(t){const e=B.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Tg,{size:20}),e[0]=i):i=e[0];let n;return e[1]!==s?(n=r.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:r.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=n):n=e[2],n}function vh(t){const e=B.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:n,children:o}=t,{org:a}=ve(),{currentBranch:l}=es(),{data:c}=St.useSession(),d=c?.user?.id,u=d&&l?n?.[d]?.[l]??null:null;let h;e[0]!==u?(h=u?.previewUrl?u.previewUrl.replace(/\/$/,""):null,e[0]=u,e[1]=h):h=e[1];const f=h;let m;e[2]!==a.id?(m={connectionId:Ht,orgId:a.id},e[2]=a.id,e[3]=m):m=e[3];const p=Me(m),{mutate:g}=ql(p);let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[4]=_):_=e[4];const v=S.useRef(_);let x,b;e[5]!==l||e[6]!==i||e[7]!==g||e[8]!==d||e[9]!==s||e[10]!==n?(x=()=>{i&&d&&l&&(n?.[d]?.[l]||v.current.has(l)||(v.current.add(l),g({virtualMcpId:s,branch:l},{onError:Z5})))},b=[i,d,l,n,s,g],e[5]=l,e[6]=i,e[7]=g,e[8]=d,e[9]=s,e[10]=n,e[11]=x,e[12]=b):(x=e[11],b=e[12]),S.useEffect(x,b);let y;return e[13]!==o||e[14]!==f?(y=r.jsx(NV,{daemonBaseUrl:f,children:o}),e[13]=o,e[14]=f,e[15]=y):y=e[15],y}function Z5(t){console.error("[auto-start-vm] failed:",t)}function bh(){const t=B.c(106),e=Rs(),s=Ke(),{org:i}=ve(),n=AS()?.tasksOpen??!1;N_(i.id);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const a=$r(o),l=a.org??"";let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[1]=c):c=t[1];const d=vi(c);let u;t[2]!==i.id||t[3]!==d.virtualmcpid?(u=d.virtualmcpid??io(i.id).id,t[2]=i.id,t[3]=d.virtualmcpid,t[4]=u):u=t[4];const h=u;let f;t[5]!==i.id?(f=hl(i.id),t[5]=i.id,t[6]=f):f=t[6];const m=h===f,p=!m,g=F_(a.taskId??"",h),_=ts(h),v=_?.metadata?.ui?.layout??null;let x;t[7]!==v?(x=v?{defaultMainView:v.defaultMainView??null,chatDefaultOpen:v.chatDefaultOpen??null}:null,t[7]=v,t[8]=x):x=t[8];const b=x;let y;t[9]!==_?(y=_&&Fs(_),t[9]=_,t[10]=y):y=t[10];const C=!!y;let j;t[11]!==p||t[12]!==l||t[13]!==h?(j={virtualMcpId:h,orgSlug:l,isAgentRoute:p},t[11]=p,t[12]=l,t[13]=h,t[14]=j):j=t[14];const w=jS(b,j),{setOpenMobile:V,openMobile:k}=qr(),T=V,I=S.useRef(null);let A,N;t[15]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{const K=U=>{Dh(U)&&U.shiftKey&&U.code==="KeyS"&&!U.repeat&&(U.preventDefault(),I.current?.())};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},N=[],t[15]=A,t[16]=N):(A=t[15],N=t[16]),S.useEffect(A,N);const E=h;let R;t[17]!==_||t[18]!==h?(R={virtualMcpId:h,entity:_},t[17]=_,t[18]=h,t[19]=R):R=t[19];const M=R;if(g.status==="creating"||g.status==="loading"){let K;t[20]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[r.jsx(Ee,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[20]=K):K=t[20];let U;return t[21]!==M?(U=r.jsx(Ii,{value:M,children:K}),t[21]=M,t[22]=U):U=t[22],U}if(g.status==="error"){let K;t[23]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[23]=K):K=t[23];let U;t[24]!==g.error.message?(U=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[K,r.jsx("div",{className:"text-muted-foreground",children:g.error.message})]})}),t[24]=g.error.message,t[25]=U):U=t[25];let te;return t[26]!==M||t[27]!==U?(te=r.jsx(Ii,{value:M,children:U}),t[26]=M,t[27]=U,t[28]=te):te=t[28],te}if(!_){let K;t[29]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx(ri,{size:48,className:"text-muted-foreground"}),t[29]=K):K=t[29];const U=`The agent "${h}" does not exist in this organization.`;let te;t[30]!==s||t[31]!==l?(te=r.jsx(re,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[30]=s,t[31]=l,t[32]=te):te=t[32];let X;t[33]!==U||t[34]!==te?(X=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:r.jsx(Oi,{image:K,title:"Agent not found",description:U,actions:te})})}),t[33]=U,t[34]=te,t[35]=X):X=t[35];let J;return t[36]!==M||t[37]!==X?(J=r.jsx(Ii,{value:M,children:X}),t[36]=M,t[37]=X,t[38]=J):J=t[38],J}if(e){let K;t[39]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx(S_,{className:"sr-only",children:"Navigation"}),t[39]=K):K=t[39];let U;t[40]!==T?(U=r.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:r.jsx(vS,{onClose:()=>T(!1)})}),t[40]=T,t[41]=U):U=t[41];let te;t[42]===Symbol.for("react.memo_cache_sentinel")?(te=r.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:r.jsx(Yu,{})}),t[42]=te):te=t[42];let X;t[43]!==U?(X=r.jsxs(w_,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[K,r.jsxs("div",{className:"flex h-full",children:[U,te]})]}),t[43]=U,t[44]=X):X=t[44];let J;t[45]!==k||t[46]!==T||t[47]!==X?(J=r.jsx(V_,{open:k,onOpenChange:T,children:X}),t[45]=k,t[46]=T,t[47]=X,t[48]=J):J=t[48];const se=J,he=_?.metadata?.vmMap;let ce;t[49]!==w.createNewTask?(ce=r.jsx(xh,{onNewTaskRef:I,createNewTask:w.createNewTask}),t[49]=w.createNewTask,t[50]=ce):ce=t[50];let pe;t[51]!==T?(pe=r.jsx(Q5,{onOpenSidebar:()=>T(!0)}),t[51]=T,t[52]=pe):pe=t[52];const ne=m?"home":void 0;let de;t[53]!==ne?(de=r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:r.jsx(_h,{variant:ne})}),t[53]=ne,t[54]=de):de=t[54];let fe;t[55]!==C||t[56]!==se||t[57]!==he||t[58]!==ce||t[59]!==pe||t[60]!==de||t[61]!==h?(fe=r.jsxs(vh,{virtualMcpId:h,hasActiveGithubRepo:C,vmMap:he,children:[ce,pe,de,se]}),t[55]=C,t[56]=se,t[57]=he,t[58]=ce,t[59]=pe,t[60]=de,t[61]=h,t[62]=fe):fe=t[62];let ue;t[63]!==E||t[64]!==fe?(ue=r.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:r.jsx(De.Provider,{virtualMcpId:E,children:fe},E)}),t[63]=E,t[64]=fe,t[65]=ue):ue=t[65];let ae;return t[66]!==M||t[67]!==ue?(ae=r.jsx(Ii,{value:M,children:ue}),t[66]=M,t[67]=ue,t[68]=ae):ae=t[68],ae}const L=n?void 0:w.createNewTask;let D;t[69]!==m||t[70]!==w.chatOpen||t[71]!==w.toggleChat||t[72]!==L?(D=r.jsx(ze.Toggles,{children:r.jsx(E5,{isDecopilot:m,chatOpen:w.chatOpen,toggleChat:w.toggleChat,onNewTask:L})}),t[69]=m,t[70]=w.chatOpen,t[71]=w.toggleChat,t[72]=L,t[73]=D):D=t[73];let P;t[74]!==m||t[75]!==w.taskId||t[76]!==h?(P=!m&&r.jsx(ze.Tabs,{children:r.jsx(L5,{virtualMcpId:h,taskId:w.taskId})}),t[74]=m,t[75]=w.taskId,t[76]=h,t[77]=P):P=t[77];const $=_?.metadata?.vmMap;let z;t[78]!==_||t[79]!==m?(z=!m&&r.jsx(J5,{virtualMcp:_}),t[78]=_,t[79]=m,t[80]=z):z=t[80];let O;t[81]!==w.createNewTask?(O=r.jsx(xh,{onNewTaskRef:I,createNewTask:w.createNewTask}),t[81]=w.createNewTask,t[82]=O):O=t[82];const W=m?"home":void 0;let F;t[83]!==W?(F=r.jsx(_h,{variant:W}),t[83]=W,t[84]=F):F=t[84];let G;t[85]!==w.chatOpen||t[86]!==w.mainOpen||t[87]!==w.taskId||t[88]!==F||t[89]!==h?(G=r.jsx(A5,{virtualMcpId:h,taskId:w.taskId,chatOpen:w.chatOpen,mainOpen:w.mainOpen,chatContent:F}),t[85]=w.chatOpen,t[86]=w.mainOpen,t[87]=w.taskId,t[88]=F,t[89]=h,t[90]=G):G=t[90];let q;t[91]!==C||t[92]!==$||t[93]!==z||t[94]!==O||t[95]!==G||t[96]!==h?(q=r.jsxs(vh,{virtualMcpId:h,hasActiveGithubRepo:C,vmMap:$,children:[z,O,G]}),t[91]=C,t[92]=$,t[93]=z,t[94]=O,t[95]=G,t[96]=h,t[97]=q):q=t[97];let H;t[98]!==E||t[99]!==P||t[100]!==q?(H=r.jsxs(De.Provider,{virtualMcpId:E,children:[P,q]},E),t[98]=E,t[99]=P,t[100]=q,t[101]=H):H=t[101];let ee;return t[102]!==M||t[103]!==D||t[104]!==H?(ee=r.jsxs(Ii,{value:M,children:[D,H]}),t[102]=M,t[103]=D,t[104]=H,t[105]=ee):ee=t[105],ee}function G4(){const t=B.c(5),e=Rs();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={"--sidebar-width-icon":"3.5rem"},t[0]=s):s=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(xS,{}),t[1]=i):i=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n={background:"transparent",containerType:"inline-size"},t[2]=n):n=t[2];let o;return t[3]!==e?(o=r.jsx(v_,{defaultOpen:!1,children:r.jsx("div",{className:"flex flex-col h-dvh overflow-hidden",children:r.jsxs(b_,{className:"flex-1 bg-sidebar",style:s,children:[i,r.jsx(y_,{className:"flex flex-col",style:n,children:e?r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),children:r.jsx(bh,{})}):r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),children:r.jsx(kS,{children:r.jsxs(ze,{children:[r.jsxs(ze.Header,{children:[r.jsxs(ze.LeftColumn,{children:[r.jsx(ze.Nav,{}),r.jsx(ze.TogglesSlot,{})]}),r.jsx(ze.CenterSlot,{}),r.jsxs(ze.RightColumn,{children:[r.jsx(ze.TabsSlot,{}),r.jsx(ze.RightSlot,{})]})]}),r.jsxs("div",{className:"flex-1 min-h-0 flex flex-row",children:[r.jsx(KS,{}),r.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),children:r.jsx(bh,{})})})]})]})})})})]})})}),t[3]=e,t[4]=o):o=t[4],o}export{G4 as default,ac as useInsetContext};
|
|
450
|
+
</message>`}]}}))},L=e.models?.credentialId||m||"",D=e.models?.thinking?.id||p?.modelId||"",P=Hi({defaultValues:{name:e.name,active:e.active,credential_id:L,model_id:D}}),$=P.watch("active"),z=P.watch("credential_id"),O=P.watch("model_id"),{models:W,isLoading:F}=Zh(z||void 0),G=W.find(ne=>ne.modelId===O)??null,q=S.useRef(null),H=S.useRef(new Set),ee=S.useRef(0),K=S.useRef(null),U=3e4,te=()=>{K.current&&(clearTimeout(K.current),K.current=null),q.current!==null&&(ye("automation_updated",{fields:Array.from(H.current),save_count:ee.current,edit_duration_ms:Date.now()-q.current}),q.current=null,H.current=new Set,ee.current=0)},X=async()=>{if(!(Object.keys(P.formState.dirtyFields).length>0)&&!R.current)return!0;const de=Object.keys(P.formState.dirtyFields),fe=R.current;R.current=!1;const ue=P.getValues();try{const ae=ue.credential_id&&ue.model_id?ue.credential_id:"",_e=ue.credential_id&&ue.model_id?ue.model_id:"",Ce={id:t,name:ue.name,active:ue.active,agent:{id:o},models:{credentialId:ae,thinking:{id:_e}},messages:Ep(b),temperature:0};await l.mutateAsync(Ce),q.current===null&&(q.current=Date.now());for(const Te of de)H.current.add(Te);return fe&&H.current.add("messages"),ee.current+=1,K.current&&clearTimeout(K.current),K.current=setTimeout(te,U),P.reset({...ue,credential_id:ae,model_id:_e}),!0}catch{return R.current=!0,!1}},J=()=>{E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{X()},1e3)},se=async()=>(E.current&&clearTimeout(E.current),X()),he=ne=>{if(y(ne),!N.current){N.current=!0;return}R.current=!0,J()},ce=S.useRef(!1);ce.current||(ce.current=!0,P.watch(()=>{J()}));const pe=async()=>{const ne=await se();if(te(),!ne)return;if(!b){me.error("No instructions configured for this automation");return}G&&z&&f({...G,keyId:z}),v({..._,toolApprovalLevel:"auto"});const de=cc(b);h({message:{tiptapDoc:b,parts:de},virtualMcpId:o||void 0})};return r.jsxs(r.Fragment,{children:[i&&r.jsx("div",{className:"flex items-center pb-4 shrink-0",children:r.jsxs(re,{variant:"ghost",size:"sm",onClick:i,children:[r.jsx(xl,{size:14}),"Back to list"]})}),r.jsxs("div",{className:"flex flex-col gap-8",children:[r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(bt,{...P.register("name"),placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}}),n&&r.jsx(re,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:r.jsx(ha,{size:14})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ai,{control:P.control,name:"active",render:({field:ne})=>r.jsx(da,{checked:ne.value,onCheckedChange:de=>{ne.onChange(de),setTimeout(()=>se(),0)},className:"cursor-pointer"})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:$?"Active":"Inactive"}),r.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),r.jsx(T_,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),r.jsxs("div",{className:"flex flex-col gap-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),r.jsx(m5,{automationId:t,open:C,onOpenChange:j,onCustomSelect:()=>{V(!0),A(!1),T("")},onEventSelect:()=>{A(!0),V(!1)}})]}),e.triggers.length===0&&!w?r.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",r.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>j(!0),children:"Add a starter"})," ","to get going."]})}):r.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(ne=>r.jsx(p5,{trigger:ne,automationId:t,connectionName:ne.connection_id?u.get(ne.connection_id):void 0},ne.id))}),w&&r.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[r.jsx(_r,{size:14,className:"text-muted-foreground shrink-0"}),r.jsx("input",{type:"text",value:k,onChange:ne=>T(ne.target.value),onBlur:async()=>{const ne=k.trim();if(!(!ne||!Vr(ne)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:ne}),ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),me.success("Starter added"),V(!1),T("")}catch{me.error("Failed to add starter")}},onKeyDown:async ne=>{const de=k.trim();ne.key==="Enter"&&de&&Vr(de)&&ne.target.blur(),ne.key==="Escape"&&(V(!1),T(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!Vr(k)&&r.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),c.isPending&&r.jsx(Ee,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),r.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{V(!1),T("")},children:r.jsx(ii,{size:13})})]}),I&&r.jsx(S.Suspense,{fallback:r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[r.jsx(Ee,{size:13,className:"animate-spin text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:r.jsx(_5,{automationId:t,onDone:()=>A(!1)})})]}),r.jsxs("div",{className:"flex flex-col gap-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),r.jsxs(re,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:!b,onClick:M,children:[r.jsx(_l,{size:13}),"Improve"]})]}),r.jsx(Hu,{tiptapDoc:b,setTiptapDoc:he,placeholder:"What should this automation do?",children:r.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[r.jsx(Wu,{virtualMcpId:o||null,className:"max-h-[45vh]"}),r.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[r.jsx(eu,{model:G,isLoading:F,credentialId:z||null,onCredentialChange:ne=>{P.setValue("credential_id",ne??"",{shouldDirty:!0}),P.setValue("model_id","",{shouldDirty:!0})},onModelChange:ne=>P.setValue("model_id",ne.modelId,{shouldDirty:!0}),placeholder:"Model"}),r.jsxs(it,{children:[r.jsx(tt,{asChild:!0,children:r.jsxs(re,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:pe,disabled:!o,children:[r.jsx($h,{size:16}),"Test"]})}),r.jsx(st,{children:"Test Automation"})]})]})]})})]})]})]})}function S5(t){const e=B.c(6),{tabId:s,virtualMcpId:i}=t;let n;e[0]!==s?(n=Ah(s),e[0]=s,e[1]=n):n=e[1];const o=n;if(!o)return null;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let l;return e[3]!==o.id||e[4]!==i?(l=r.jsx(hs,{children:r.jsx(hs.Content,{children:r.jsx(hs.Body,{children:r.jsx(S.Suspense,{fallback:a,children:r.jsx(w5,{id:o.id,virtualMcpId:i})})})})}),e[3]=o.id,e[4]=i,e[5]=l):l=e[5],l}function w5(t){const e=B.c(9),{id:s,virtualMcpId:i}=t,n=Ke(),{data:o,isLoading:a}=M_(s);let l;e[0]!==n?(l=()=>n({to:".",search:V5,replace:!0}),e[0]=n,e[1]=l):l=e[1];const c=l;if(a){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=u):u=e[2],u}if(!o){let u;return e[3]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=u):u=e[3],u}let d;return e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==i?(d=r.jsx(y5,{automationId:s,automation:o,virtualMcpId:i,onBack:c}),e[4]=o,e[5]=s,e[6]=c,e[7]=i,e[8]=d):d=e[8],d}function V5(t){return{...t,main:"automations"}}function C5(t){const e=B.c(19),{virtualMcpId:s}=t,i=Ke(),{data:n}=P_(s),o=n===void 0?[]:n,{create:a}=Yr(),[l,c]=S.useState(""),d=l.toLowerCase(),u=o.filter(k=>k.name.toLowerCase().includes(d));let h;e[0]!==i?(h=k=>i({to:".",search:T=>({...T,main:"automation:"+k}),replace:!0}),e[0]=i,e[1]=h):h=e[1];const f=h,m=async()=>{if(a.isPending)return;ye("automation_new_clicked",{existing_count:o.length});const k=await a.mutateAsync(B_(s));f(k.id)},p=hs,g=hs,_=hs;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(Qt,{size:14}),e[2]=v):v=e[2];let x;e[3]!==a.isPending||e[4]!==m?(x=r.jsx(hs.Title,{actions:r.jsxs(re,{size:"sm",onClick:m,disabled:a.isPending,children:[v,"New automation"]}),children:"Automations"}),e[3]=a.isPending,e[4]=m,e[5]=x):x=e[5];const b=o.length>0&&r.jsx(O_,{value:l,onChange:c,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let y;e[6]!==x||e[7]!==b?(y=r.jsxs("div",{className:"flex flex-col gap-6",children:[x,b]}),e[6]=x,e[7]=b,e[8]=y):y=e[8];const C=o.length===0?r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx(Oi,{image:r.jsx($i,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:r.jsxs(re,{size:"sm",onClick:m,disabled:a.isPending,children:[r.jsx(Qt,{size:14}),"New automation"]})})}):u.length===0?r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx(Oi,{image:r.jsx($i,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):r.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(k=>r.jsx(L_,{automation:k,onClick:()=>f(k.id)},k.id))});let j;e[9]!==_.Body||e[10]!==y||e[11]!==C?(j=r.jsxs(_.Body,{children:[y,C]}),e[9]=_.Body,e[10]=y,e[11]=C,e[12]=j):j=e[12];let w;e[13]!==j||e[14]!==g.Content?(w=r.jsx(g.Content,{children:j}),e[13]=j,e[14]=g.Content,e[15]=w):w=e[15];let V;return e[16]!==p||e[17]!==w?(V=r.jsx(p,{children:w}),e[16]=p,e[17]=w,e[18]=V):V=e[18],V}function j5(t){const e=B.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let n;return e[1]!==s?(n=r.jsx(S.Suspense,{fallback:i,children:r.jsx(C5,{virtualMcpId:s})}),e[1]=s,e[2]=n):n=e[2],n}const mh=S.lazy(()=>Cp(()=>import("./project-app-view-DveHsLbW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])).then(t=>({default:t.AppViewContent})));function k5(t){const e=B.c(35),{taskId:s,virtualMcpId:i}=t;let n;e[0]!==s||e[1]!==i?(n={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=n):n=e[2];const{activeTab:o,layoutTabs:a,automationTabParsed:l}=$f(n);if(Gp(o)){let m;return e[3]!==i?(m=r.jsx(_d,{virtualMcpId:i}),e[3]=i,e[4]=m):m=e[4],m}if(o==="git"){let m;return e[5]!==i?(m=r.jsx(fV,{virtualMcpId:i}),e[5]=i,e[6]=m):m=e[6],m}if(o==="automations"){let m;return e[7]!==i?(m=r.jsx(j5,{virtualMcpId:i}),e[7]=i,e[8]=m):m=e[8],m}if(o==="env"){let m;return e[9]!==i?(m=r.jsx(l5,{virtualMcpId:i}),e[9]=i,e[10]=m):m=e[10],m}if(o==="preview"){let m;return e[11]!==i?(m=r.jsx(WV,{virtualMcpId:i}),e[11]=i,e[12]=m):m=e[12],m}if(l){let m;return e[13]!==o||e[14]!==i?(m=r.jsx(S5,{tabId:o,virtualMcpId:i}),e[13]=o,e[14]=i,e[15]=m):m=e[15],m}let c;e[16]!==o?(c=Yp(o),e[16]=o,e[17]=c):c=e[17];const d=c;if(d){let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[18]=m):m=e[18];let p;return e[19]!==o||e[20]!==d.connectionId||e[21]!==d.toolName?(p=r.jsx(S.Suspense,{fallback:m,children:r.jsx(mh,{connectionId:d.connectionId,toolName:d.toolName},o)}),e[19]=o,e[20]=d.connectionId,e[21]=d.toolName,e[22]=p):p=e[22],p}let u;if(e[23]!==o||e[24]!==a){let m;e[26]!==o?(m=p=>p.id===o,e[26]=o,e[27]=m):m=e[27],u=a.find(m),e[23]=o,e[24]=a,e[25]=u}else u=e[25];const h=u;if(h){let m;e[28]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),e[28]=m):m=e[28];let p;return e[29]!==o||e[30]!==h.id||e[31]!==h.view.appId?(p=r.jsx(S.Suspense,{fallback:m,children:r.jsx(mh,{connectionId:h.view.appId,toolName:h.id},o)}),e[29]=o,e[30]=h.id,e[31]=h.view.appId,e[32]=p):p=e[32],p}let f;return e[33]!==i?(f=r.jsx(_d,{virtualMcpId:i}),e[33]=i,e[34]=f):f=e[34],f}function N5(t){const e=B.c(7),{children:s,defaultSize:i}=t,[,n]=S.useTransition();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=ol.decoChatPanelWidth(),e[0]=o):o=e[0];const[a,l]=nl(o,45),c=i>0&&i<100?a:i;let d;e[1]!==l?(d=f=>n(()=>{f>0&&f<100&&l(f)}),e[1]=l,e[2]=d):d=e[2];const u=d;let h;return e[3]!==s||e[4]!==c||e[5]!==u?(h=r.jsx(tu,{defaultSize:c,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=c,e[5]=u,e[6]=h):h=e[6],h}function A5(t){const e=B.c(31),{virtualMcpId:s,taskId:i,chatOpen:n,mainOpen:o,variant:a,chatContent:l}=t;let c;e[0]!==n||e[1]!==o?(c=ud(n,o),e[0]=n,e[1]=o,e[2]=c):c=e[2];const d=c;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=ol.decoChatPanelWidth(),e[3]=u):u=e[3];const[h]=nl(u,45),f=S.useRef(null);let m,p;e[4]!==n||e[5]!==o||e[6]!==h?(m=()=>{const I=f.current;if(!I)return;const A=ud(n,o),N=A.chat>0&&A.chat<100?h:A.chat,E=A.chat>0&&A.chat<100?100-h:A.main;I.setLayout([N,E])},p=[n,o,h],e[4]=n,e[5]=o,e[6]=h,e[7]=m,e[8]=p):(m=e[7],p=e[8]),S.useEffect(m,p);const g=`${s}-${i}`;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_={overflow:"visible"},e[9]=_):_=e[9];let v;e[10]!==l||e[11]!==a?(v=l??r.jsx(Ku,{variant:a}),e[10]=l,e[11]=a,e[12]=v):v=e[12];let x;e[13]!==v?(x=r.jsx("div",{className:"h-full p-0.5 pt-0.25",children:r.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:v})}),e[13]=v,e[14]=x):x=e[14];let b;e[15]!==d.chat||e[16]!==x?(b=r.jsx(N5,{defaultSize:d.chat,children:x}),e[15]=d.chat,e[16]=x,e[17]=b):b=e[17];let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Kg,{className:"bg-sidebar"}),e[18]=y):y=e[18];const C=d.main;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j={overflow:"visible"},e[19]=j):j=e[19];let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=Y("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[20]=w):w=e[20];let V;e[21]!==i||e[22]!==s?(V=r.jsx("div",{className:"h-full p-0.5 pt-0.25",children:r.jsx("div",{className:w,children:r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:r.jsx(k5,{taskId:i,virtualMcpId:s})})})}),e[21]=i,e[22]=s,e[23]=V):V=e[23];let k;e[24]!==d.main||e[25]!==V?(k=r.jsx(tu,{className:"min-w-0 flex flex-col",order:2,defaultSize:C,style:j,collapsible:!0,collapsedSize:0,minSize:20,children:V}),e[24]=d.main,e[25]=V,e[26]=k):k=e[26];let T;return e[27]!==k||e[28]!==g||e[29]!==b?(T=r.jsxs(qg,{ref:f,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:_,children:[b,y,k]},g),e[27]=k,e[28]=g,e[29]=b,e[30]=T):T=e[30],T}const ta="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",ph="bg-sidebar-accent text-sidebar-foreground",sa="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function E5(t){const e=B.c(38),{isDecopilot:s,chatOpen:i,toggleChat:n,onNewTask:o}=t,{tasksOpen:a,toggleTasks:l}=Bf(),c=!!o;let d;e[0]!==a||e[1]!==l?(d=()=>{l()},e[0]=a,e[1]=l,e[2]=d):d=e[2];const u=a?ph:sa;let h;e[3]!==u?(h=Y(ta,u),e[3]=u,e[4]=h):h=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Eg,{size:16}),e[5]=f):f=e[5];let m;e[6]!==d||e[7]!==h||e[8]!==a?(m=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",onClick:d,"aria-pressed":a,className:h,children:f})}),e[6]=d,e[7]=h,e[8]=a,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(st,{side:"bottom",children:"Tasks"}),e[10]=p):p=e[10];let g;e[11]!==m?(g=r.jsxs(it,{delayDuration:300,children:[m,p]}),e[11]=m,e[12]=g):g=e[12];let _;e[13]!==i||e[14]!==s||e[15]!==n?(_=!s&&r.jsxs(it,{delayDuration:300,children:[r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",onClick:()=>{n()},"aria-pressed":i,className:Y(ta,i?ph:sa),children:r.jsx(Ag,{size:16})})}),r.jsx(st,{side:"bottom",children:"Chat"})]}),e[13]=i,e[14]=s,e[15]=n,e[16]=_):_=e[16];const v=c?"grid-cols-[1fr]":"grid-cols-[0fr]";let x;e[17]!==v?(x=Y("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",v),e[17]=v,e[18]=x):x=e[18];const b=!c,y=c?0:-1,C=!c,j=c?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let w;e[19]!==j?(w=Y(ta,sa,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",j),e[19]=j,e[20]=w):w=e[20];let V;e[21]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(pl,{size:16}),e[21]=V):V=e[21];let k;e[22]!==o||e[23]!==b||e[24]!==y||e[25]!==C||e[26]!==w?(k=r.jsx(tt,{asChild:!0,children:r.jsx("button",{type:"button",onClick:o,disabled:b,tabIndex:y,"aria-hidden":C,className:w,children:V})}),e[22]=o,e[23]=b,e[24]=y,e[25]=C,e[26]=w,e[27]=k):k=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(st,{side:"bottom",children:"New task"}),e[28]=T):T=e[28];let I;e[29]!==k?(I=r.jsx("div",{className:"overflow-hidden",children:r.jsxs(it,{delayDuration:300,children:[k,T]})}),e[29]=k,e[30]=I):I=e[30];let A;e[31]!==x||e[32]!==I?(A=r.jsx("div",{className:x,children:I}),e[31]=x,e[32]=I,e[33]=A):A=e[33];let N;return e[34]!==A||e[35]!==g||e[36]!==_?(N=r.jsxs(r.Fragment,{children:[g,_,A]}),e[34]=A,e[35]=g,e[36]=_,e[37]=N):N=e[37],N}function I5(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),n=t.slice(s);if(e==null)return{visible:i,overflow:n};if(i.some(h=>h.id===e))return{visible:i,overflow:n};const a=n.findIndex(h=>h.id===e);if(a===-1)return{visible:i,overflow:n};const l=i[i.length-1],c=n[a],d=[...i.slice(0,-1),c],u=[l,...n.slice(0,a),...n.slice(a+1)];return{visible:d,overflow:u}}function R5(t){const e=B.c(13),{title:s,icon:i,active:n,onClick:o}=t,a=n?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=Y("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==i?(c=r.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:r.jsx(T5,{icon:i})}),e[2]=i,e[3]=c):c=e[3];let d;e[4]!==s?(d=r.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=d):d=e[5];let u;return e[6]!==n||e[7]!==o||e[8]!==l||e[9]!==c||e[10]!==d||e[11]!==s?(u=r.jsxs("button",{type:"button",onClick:o,"aria-pressed":n,"aria-label":s,className:l,children:[c,d]}),e[6]=n,e[7]=o,e[8]=l,e[9]=c,e[10]=d,e[11]=s,e[12]=u):u=e[12],u}function T5(t){const e=B.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:n}=s;let o;return e[0]!==n?(o=r.jsx(n,{className:"size-4"}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="url"){let n;return e[2]!==s.src?(n=r.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=n):n=e[3],n}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(qh,{className:"size-4"}),e[4]=i):i=e[4],i}function D5(t){const e=B.c(13),{overflow:s,onSelect:i}=t,[n,o]=S.useState(!1);let a;e[0]!==i?(a=f=>{o(!1),i(f)},e[0]=i,e[1]=a):a=e[1];const l=a;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(oi,{asChild:!0,children:r.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:r.jsx(Wh,{className:"size-4"})})}),e[2]=c):c=e[2];let d;if(e[3]!==l||e[4]!==s){let f;e[6]!==l?(f=m=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l(m.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[r.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:r.jsx(M5,{icon:m.icon})}),r.jsx("span",{className:"truncate",children:m.title})]})},m.id),e[6]=l,e[7]=f):f=e[7],d=s.map(f),e[3]=l,e[4]=s,e[5]=d}else d=e[5];let u;e[8]!==d?(u=r.jsx(ai,{align:"end",className:"w-56 p-1",children:r.jsx("ul",{className:"flex flex-col",children:d})}),e[8]=d,e[9]=u):u=e[9];let h;return e[10]!==n||e[11]!==u?(h=r.jsxs(li,{open:n,onOpenChange:o,children:[c,u]}),e[10]=n,e[11]=u,e[12]=h):h=e[12],h}function M5(t){const e=B.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:n}=s;let o;return e[0]!==n?(o=r.jsx(n,{className:"size-4"}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="url"){let n;return e[2]!==s.src?(n=r.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=n):n=e[3],n}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(qh,{className:"size-4"}),e[4]=i):i=e[4],i}const P5=6;function L5(t){const e=B.c(20),{virtualMcpId:s,taskId:i}=t,n=Ke();let o;e[0]!==i||e[1]!==s?(o={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=o):o=e[2];const{tabs:a,activeTab:l,mainOpen:c,setActiveTab:d}=$f(o);let u,h,f,m;if(e[3]!==l||e[4]!==c||e[5]!==n||e[6]!==d||e[7]!==a||e[8]!==s){const _=Xp({activeTab:l,mainOpen:c}),v=j=>j.id==="automations"?_:c&&j.id===l,b=a.find(j=>v(j))?.id??null,{visible:y,overflow:C}=I5(a,b,P5);h=C,u=j=>{const w=a.find(V=>V.id===j);if(ye("main_panel_tab_clicked",{tab_kind:w?.kind??null}),j==="automations"){const V=Jp({activeTab:l,mainOpen:c});n({to:".",search:k=>({...k,main:V}),replace:!0});return}d(j)},f="flex items-center min-w-0 ml-auto gap-0.5",m=y.map(j=>r.jsx(R5,{title:j.title,icon:j.icon,active:v(j),onClick:()=>u(j.id)},j.id)),e[3]=l,e[4]=c,e[5]=n,e[6]=d,e[7]=a,e[8]=s,e[9]=u,e[10]=h,e[11]=f,e[12]=m}else u=e[9],h=e[10],f=e[11],m=e[12];let p;e[13]!==u||e[14]!==h?(p=h.length>0&&r.jsx(D5,{overflow:h,onSelect:u}),e[13]=u,e[14]=h,e[15]=p):p=e[15];let g;return e[16]!==f||e[17]!==m||e[18]!==p?(g=r.jsxs("div",{className:f,children:[m,p]}),e[16]=f,e[17]=m,e[18]=p,e[19]=g):g=e[19],g}function B5(t){const e=B.c(12);let s,i,n,o;e[0]!==t?({className:s,orientation:n,decorative:o,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=n,e[4]=o):(s=e[1],i=e[2],n=e[3],o=e[4]);const a=n===void 0?"horizontal":n,l=o===void 0?!0:o;let c;e[5]!==s?(c=Y("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=c):c=e[6];let d;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==c?(d=r.jsx(jp,{"data-slot":"separator-root",decorative:l,orientation:a,className:c,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=c,e[11]=d):d=e[11],d}function O5(t){const e=B.c(20),{prNumber:s,disabled:i,send:n}=t;let o;e[0]!==s||e[1]!==n?(o=()=>n(sV({prNumber:s})),e[0]=s,e[1]=n,e[2]=o):o=e[2];const a=o;let l;e[3]!==s||e[4]!==n?(l=()=>n(tV({prNumber:s})),e[3]=s,e[4]=n,e[5]=l):l=e[5];const c=l;let d;e[6]!==i||e[7]!==a?(d=r.jsx(re,{size:"sm",className:"rounded-r-none border-r border-primary-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=d):d=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(kr,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let h;e[10]!==i?(h=r.jsx(ks,{asChild:!0,children:r.jsx(re,{size:"sm",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=h):h=e[11];let f;e[12]!==c?(f=r.jsx(Ns,{align:"end",children:r.jsx(ot,{onClick:c,children:"Review"})}),e[12]=c,e[13]=f):f=e[13];let m;e[14]!==h||e[15]!==f?(m=r.jsxs(js,{children:[h,f]}),e[14]=h,e[15]=f,e[16]=m):m=e[16];let p;return e[17]!==d||e[18]!==m?(p=r.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[d,m]}),e[17]=d,e[18]=m,e[19]=p):p=e[19],p}const $5=new Set(["failure","timed_out","cancelled","action_required"]);function z5(t){return t.status==="completed"&&$5.has(t.conclusion)}function F5(t){return t.status==="queued"||t.status==="in_progress"}function H5(t){const{branchStatus:e,pr:s,checks:i,reviews:n}=t;if(!e)return null;if(e.workingTreeDirty||e.unpushed>0)return{label:"Save changes",action:"commit-and-push"};if(s?.merged)return!!e.headSha&&!!s.headSha&&e.headSha!==s.headSha?{label:"Submit for review",action:"create-pr"}:null;if(e.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen"};if(!s)return{label:"Submit for review",action:"create-pr"};if((n?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase"};const l=i.filter(z5).map(c=>c.name);return l.length>0?{label:"Fix tests",action:"fix-checks",meta:{failingChecks:l}}:i.some(F5)?{label:"Running tests…",disabled:!0}:n?.draft?{label:"Mark ready",action:"mark-ready"}:(n?.unresolvedConversations??0)>0?{label:"Address feedback",action:"resolve-comments"}:n?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0}:{label:"Publish",action:"merge-split"}}return null}function W5(){return Yi().branchStatus}const U5=6e4,K5=3e4;function q5(t){const e=B.c(11);let s;e[0]!==t.connectionId||e[1]!==t.orgId?(s={connectionId:t.connectionId,orgId:t.orgId},e[0]=t.connectionId,e[1]=t.orgId,e[2]=s):s=e[2];const i=Me(s),n=t.prNumber??0;let o;e[3]!==t.owner||e[4]!==t.repo||e[5]!==n?(o={method:"get",owner:t.owner,repo:t.repo,pullNumber:n},e[3]=t.owner,e[4]=t.repo,e[5]=n,e[6]=o):o=e[6];const a=!!t.prNumber;let l;return e[7]!==i||e[8]!==o||e[9]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:o,enabled:a,refetchInterval:U5,refetchIntervalInBackground:!1,staleTime:K5,select:G5},e[7]=i,e[8]=o,e[9]=a,e[10]=l):l=e[10],wi(l)}function G5(t){const e=Zr(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),n=Number(e.review_comments??0),o=s==="blocked"&&n>0?n:0;return{draft:i,mergeableState:s,unresolvedConversations:o,missingRequiredApprovals:s==="blocked"&&o===0}}function Y5(t){const e=B.c(38),{virtualMcpId:s}=t,{org:i}=ve(),n=ts(s),{currentBranch:o}=es(),a=Zn(),l=n?.metadata?.githubRepo??null,c=W5(),d=l?.connectionId??"",u=l?.owner??"",h=l?.name??"",f=o??null;let m;e[0]!==i.id||e[1]!==d||e[2]!==u||e[3]!==h||e[4]!==f?(m={orgId:i.id,connectionId:d,owner:u,repo:h,branch:f},e[0]=i.id,e[1]=d,e[2]=u,e[3]=h,e[4]=f,e[5]=m):m=e[5];const g=Ff(m).data??null,_=l?.connectionId??"",v=l?.owner??"",x=l?.name??"",b=g&&g.state==="open"?g.number:null;let y;e[6]!==i.id||e[7]!==_||e[8]!==v||e[9]!==x||e[10]!==b?(y={orgId:i.id,connectionId:_,owner:v,repo:x,prNumber:b},e[6]=i.id,e[7]=_,e[8]=v,e[9]=x,e[10]=b,e[11]=y):y=e[11];const C=Wf(y),j=l?.connectionId??"",w=l?.owner??"",V=l?.name??"",k=g&&g.state==="open"?g.number:null;let T;e[12]!==i.id||e[13]!==j||e[14]!==w||e[15]!==V||e[16]!==k?(T={orgId:i.id,connectionId:j,owner:w,repo:V,prNumber:k},e[12]=i.id,e[13]=j,e[14]=w,e[15]=V,e[16]=k,e[17]=T):T=e[17];const I=q5(T);if(!l?.connectionId||!o)return null;let A;e[18]!==c||e[19]!==C.data||e[20]!==g||e[21]!==I.data?(A=H5({branchStatus:c,pr:g,checks:C.data??[],reviews:I.data??null}),e[18]=c,e[19]=C.data,e[20]=g,e[21]=I.data,e[22]=A):A=e[22];const N=A;if(!N)return null;let E;e[23]!==a?(E=O=>a.sendMessage({parts:[{type:"text",text:O}]}),e[23]=a,e[24]=E):E=e[24];const R=E,M=a.isStreaming;let L;e[25]!==o||e[26]!==N||e[27]!==M||e[28]!==g||e[29]!==R?(L=O=>{if(!M)switch(O){case"commit-and-push":{R(qw({branch:o}));return}case"create-pr":{R(Gw({branch:o}));return}case"reopen":{g&&R(Yw({prNumber:g.number}));return}case"rebase":{R(Xw({branch:o}));return}case"fix-checks":{g&&R(Qw({prNumber:g.number,failingChecks:N.meta?.failingChecks??[]}));return}case"mark-ready":{g&&R(Zw({prNumber:g.number}));return}case"resolve-comments":{g&&R(eV({prNumber:g.number}));return}case"merge-split":return}},e[25]=o,e[26]=N,e[27]=M,e[28]=g,e[29]=R,e[30]=L):L=e[30];const D=L;let P;e[31]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(B5,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[31]=P):P=e[31];const $=g?.number;let z;return e[32]!==N||e[33]!==M||e[34]!==D||e[35]!==R||e[36]!==$?(z=r.jsxs(r.Fragment,{children:[P,r.jsx(X5,{button:N,isStreaming:M,onActivate:D,prNumber:$,send:R})]}),e[32]=N,e[33]=M,e[34]=D,e[35]=R,e[36]=$,e[37]=z):z=e[37],z}function X5(t){const e=B.c(18),{button:s,isStreaming:i}=t,n=!!s.disabled||i,o=i?"Chat is running":null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==n||e[1]!==t.prNumber||e[2]!==t.send?(u=r.jsx(O5,{prNumber:t.prNumber,disabled:n,send:t.send}),e[0]=n,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let h;return e[4]!==u||e[5]!==o?(h=r.jsx(gh,{label:o,children:u}),e[4]=u,e[5]=o,e[6]=h):h=e[6],h}const a=s.disabled?"outline":"default";let l;e[7]!==s.action||e[8]!==t?(l=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=l):l=e[9];let c;e[10]!==s.label||e[11]!==n||e[12]!==a||e[13]!==l?(c=r.jsx(re,{size:"sm",variant:a,disabled:n,onClick:l,children:s.label}),e[10]=s.label,e[11]=n,e[12]=a,e[13]=l,e[14]=c):c=e[14];let d;return e[15]!==c||e[16]!==o?(d=r.jsx(gh,{label:o,children:c}),e[15]=c,e[16]=o,e[17]=d):d=e[17],d}function gh(t){const e=B.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=r.jsx(r.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let n;e[2]!==i?(n=r.jsx(tt,{asChild:!0,children:r.jsx("span",{children:i})}),e[2]=i,e[3]=n):n=e[3];let o;e[4]!==s?(o=r.jsx(st,{children:s}),e[4]=s,e[5]=o):o=e[5];let a;return e[6]!==n||e[7]!==o?(a=r.jsx(Mi,{children:r.jsxs(it,{children:[n,o]})}),e[6]=n,e[7]=o,e[8]=a):a=e[8],a}function J5(t){const e=B.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let o;return e[0]!==s.id?(o=r.jsx(ze.Right,{children:r.jsx(Y5,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=o):o=e[1],o}const Ii=S.createContext(null);function ac(){return S.use(Ii)}function _h(t){const e=B.c(8),{children:s,variant:i}=t,{taskId:n}=es();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=o):o=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(De.Skeleton,{}),e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==i?(l=s??r.jsx(Ku,{variant:i}),e[2]=s,e[3]=i,e[4]=l):l=e[4];let c;return e[5]!==l||e[6]!==n?(c=r.jsx(Cs,{fallback:o,children:r.jsx(S.Suspense,{fallback:a,children:r.jsx(De.ActiveTaskProvider,{taskId:n,children:l})})}),e[5]=l,e[6]=n,e[7]=c):c=e[7],c}function xh(t){const e=B.c(3),{onNewTaskRef:s,createNewTask:i}=t;let n;return e[0]!==i||e[1]!==s?(n=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=n):n=e[2],S.useLayoutEffect(n),null}function Q5(t){const e=B.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Tg,{size:20}),e[0]=i):i=e[0];let n;return e[1]!==s?(n=r.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:r.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=n):n=e[2],n}function vh(t){const e=B.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:n,children:o}=t,{org:a}=ve(),{currentBranch:l}=es(),{data:c}=St.useSession(),d=c?.user?.id,u=d&&l?n?.[d]?.[l]??null:null;let h;e[0]!==u?(h=u?.previewUrl?u.previewUrl.replace(/\/$/,""):null,e[0]=u,e[1]=h):h=e[1];const f=h;let m;e[2]!==a.id?(m={connectionId:Ht,orgId:a.id},e[2]=a.id,e[3]=m):m=e[3];const p=Me(m),{mutate:g}=ql(p);let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[4]=_):_=e[4];const v=S.useRef(_);let x,b;e[5]!==l||e[6]!==i||e[7]!==g||e[8]!==d||e[9]!==s||e[10]!==n?(x=()=>{i&&d&&l&&(n?.[d]?.[l]||v.current.has(l)||(v.current.add(l),g({virtualMcpId:s,branch:l},{onError:Z5})))},b=[i,d,l,n,s,g],e[5]=l,e[6]=i,e[7]=g,e[8]=d,e[9]=s,e[10]=n,e[11]=x,e[12]=b):(x=e[11],b=e[12]),S.useEffect(x,b);let y;return e[13]!==o||e[14]!==f?(y=r.jsx(NV,{daemonBaseUrl:f,children:o}),e[13]=o,e[14]=f,e[15]=y):y=e[15],y}function Z5(t){console.error("[auto-start-vm] failed:",t)}function bh(){const t=B.c(106),e=Rs(),s=Ke(),{org:i}=ve(),n=AS()?.tasksOpen??!1;N_(i.id);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const a=$r(o),l=a.org??"";let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[1]=c):c=t[1];const d=vi(c);let u;t[2]!==i.id||t[3]!==d.virtualmcpid?(u=d.virtualmcpid??io(i.id).id,t[2]=i.id,t[3]=d.virtualmcpid,t[4]=u):u=t[4];const h=u;let f;t[5]!==i.id?(f=hl(i.id),t[5]=i.id,t[6]=f):f=t[6];const m=h===f,p=!m,g=F_(a.taskId??"",h),_=ts(h),v=_?.metadata?.ui?.layout??null;let x;t[7]!==v?(x=v?{defaultMainView:v.defaultMainView??null,chatDefaultOpen:v.chatDefaultOpen??null}:null,t[7]=v,t[8]=x):x=t[8];const b=x;let y;t[9]!==_?(y=_&&Fs(_),t[9]=_,t[10]=y):y=t[10];const C=!!y;let j;t[11]!==p||t[12]!==l||t[13]!==h?(j={virtualMcpId:h,orgSlug:l,isAgentRoute:p},t[11]=p,t[12]=l,t[13]=h,t[14]=j):j=t[14];const w=jS(b,j),{setOpenMobile:V,openMobile:k}=qr(),T=V,I=S.useRef(null);let A,N;t[15]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{const K=U=>{Dh(U)&&U.shiftKey&&U.code==="KeyS"&&!U.repeat&&(U.preventDefault(),I.current?.())};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},N=[],t[15]=A,t[16]=N):(A=t[15],N=t[16]),S.useEffect(A,N);const E=h;let R;t[17]!==_||t[18]!==h?(R={virtualMcpId:h,entity:_},t[17]=_,t[18]=h,t[19]=R):R=t[19];const M=R;if(g.status==="creating"||g.status==="loading"){let K;t[20]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[r.jsx(Ee,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[20]=K):K=t[20];let U;return t[21]!==M?(U=r.jsx(Ii,{value:M,children:K}),t[21]=M,t[22]=U):U=t[22],U}if(g.status==="error"){let K;t[23]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[23]=K):K=t[23];let U;t[24]!==g.error.message?(U=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[K,r.jsx("div",{className:"text-muted-foreground",children:g.error.message})]})}),t[24]=g.error.message,t[25]=U):U=t[25];let te;return t[26]!==M||t[27]!==U?(te=r.jsx(Ii,{value:M,children:U}),t[26]=M,t[27]=U,t[28]=te):te=t[28],te}if(!_){let K;t[29]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx(ri,{size:48,className:"text-muted-foreground"}),t[29]=K):K=t[29];const U=`The agent "${h}" does not exist in this organization.`;let te;t[30]!==s||t[31]!==l?(te=r.jsx(re,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[30]=s,t[31]=l,t[32]=te):te=t[32];let X;t[33]!==U||t[34]!==te?(X=r.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:r.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:r.jsx(Oi,{image:K,title:"Agent not found",description:U,actions:te})})}),t[33]=U,t[34]=te,t[35]=X):X=t[35];let J;return t[36]!==M||t[37]!==X?(J=r.jsx(Ii,{value:M,children:X}),t[36]=M,t[37]=X,t[38]=J):J=t[38],J}if(e){let K;t[39]===Symbol.for("react.memo_cache_sentinel")?(K=r.jsx(S_,{className:"sr-only",children:"Navigation"}),t[39]=K):K=t[39];let U;t[40]!==T?(U=r.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:r.jsx(vS,{onClose:()=>T(!1)})}),t[40]=T,t[41]=U):U=t[41];let te;t[42]===Symbol.for("react.memo_cache_sentinel")?(te=r.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:r.jsx(Yu,{})}),t[42]=te):te=t[42];let X;t[43]!==U?(X=r.jsxs(w_,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[K,r.jsxs("div",{className:"flex h-full",children:[U,te]})]}),t[43]=U,t[44]=X):X=t[44];let J;t[45]!==k||t[46]!==T||t[47]!==X?(J=r.jsx(V_,{open:k,onOpenChange:T,children:X}),t[45]=k,t[46]=T,t[47]=X,t[48]=J):J=t[48];const se=J,he=_?.metadata?.vmMap;let ce;t[49]!==w.createNewTask?(ce=r.jsx(xh,{onNewTaskRef:I,createNewTask:w.createNewTask}),t[49]=w.createNewTask,t[50]=ce):ce=t[50];let pe;t[51]!==T?(pe=r.jsx(Q5,{onOpenSidebar:()=>T(!0)}),t[51]=T,t[52]=pe):pe=t[52];const ne=m?"home":void 0;let de;t[53]!==ne?(de=r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:r.jsx(_h,{variant:ne})}),t[53]=ne,t[54]=de):de=t[54];let fe;t[55]!==C||t[56]!==se||t[57]!==he||t[58]!==ce||t[59]!==pe||t[60]!==de||t[61]!==h?(fe=r.jsxs(vh,{virtualMcpId:h,hasActiveGithubRepo:C,vmMap:he,children:[ce,pe,de,se]}),t[55]=C,t[56]=se,t[57]=he,t[58]=ce,t[59]=pe,t[60]=de,t[61]=h,t[62]=fe):fe=t[62];let ue;t[63]!==E||t[64]!==fe?(ue=r.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:r.jsx(De.Provider,{virtualMcpId:E,children:fe},E)}),t[63]=E,t[64]=fe,t[65]=ue):ue=t[65];let ae;return t[66]!==M||t[67]!==ue?(ae=r.jsx(Ii,{value:M,children:ue}),t[66]=M,t[67]=ue,t[68]=ae):ae=t[68],ae}const L=n?void 0:w.createNewTask;let D;t[69]!==m||t[70]!==w.chatOpen||t[71]!==w.toggleChat||t[72]!==L?(D=r.jsx(ze.Toggles,{children:r.jsx(E5,{isDecopilot:m,chatOpen:w.chatOpen,toggleChat:w.toggleChat,onNewTask:L})}),t[69]=m,t[70]=w.chatOpen,t[71]=w.toggleChat,t[72]=L,t[73]=D):D=t[73];let P;t[74]!==m||t[75]!==w.taskId||t[76]!==h?(P=!m&&r.jsx(ze.Tabs,{children:r.jsx(L5,{virtualMcpId:h,taskId:w.taskId})}),t[74]=m,t[75]=w.taskId,t[76]=h,t[77]=P):P=t[77];const $=_?.metadata?.vmMap;let z;t[78]!==_||t[79]!==m?(z=!m&&r.jsx(J5,{virtualMcp:_}),t[78]=_,t[79]=m,t[80]=z):z=t[80];let O;t[81]!==w.createNewTask?(O=r.jsx(xh,{onNewTaskRef:I,createNewTask:w.createNewTask}),t[81]=w.createNewTask,t[82]=O):O=t[82];const W=m?"home":void 0;let F;t[83]!==W?(F=r.jsx(_h,{variant:W}),t[83]=W,t[84]=F):F=t[84];let G;t[85]!==w.chatOpen||t[86]!==w.mainOpen||t[87]!==w.taskId||t[88]!==F||t[89]!==h?(G=r.jsx(A5,{virtualMcpId:h,taskId:w.taskId,chatOpen:w.chatOpen,mainOpen:w.mainOpen,chatContent:F}),t[85]=w.chatOpen,t[86]=w.mainOpen,t[87]=w.taskId,t[88]=F,t[89]=h,t[90]=G):G=t[90];let q;t[91]!==C||t[92]!==$||t[93]!==z||t[94]!==O||t[95]!==G||t[96]!==h?(q=r.jsxs(vh,{virtualMcpId:h,hasActiveGithubRepo:C,vmMap:$,children:[z,O,G]}),t[91]=C,t[92]=$,t[93]=z,t[94]=O,t[95]=G,t[96]=h,t[97]=q):q=t[97];let H;t[98]!==E||t[99]!==P||t[100]!==q?(H=r.jsxs(De.Provider,{virtualMcpId:E,children:[P,q]},E),t[98]=E,t[99]=P,t[100]=q,t[101]=H):H=t[101];let ee;return t[102]!==M||t[103]!==D||t[104]!==H?(ee=r.jsxs(Ii,{value:M,children:[D,H]}),t[102]=M,t[103]=D,t[104]=H,t[105]=ee):ee=t[105],ee}function G4(){const t=B.c(5),e=Rs();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={"--sidebar-width-icon":"3.5rem"},t[0]=s):s=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(xS,{}),t[1]=i):i=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n={background:"transparent",containerType:"inline-size"},t[2]=n):n=t[2];let o;return t[3]!==e?(o=r.jsx(v_,{defaultOpen:!1,children:r.jsx("div",{className:"flex flex-col h-dvh overflow-hidden",children:r.jsxs(b_,{className:"flex-1 bg-sidebar",style:s,children:[i,r.jsx(y_,{className:"flex flex-col",style:n,children:e?r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),children:r.jsx(bh,{})}):r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),children:r.jsx(kS,{children:r.jsxs(ze,{children:[r.jsxs(ze.Header,{children:[r.jsxs(ze.LeftColumn,{children:[r.jsx(ze.Nav,{}),r.jsx(ze.TogglesSlot,{})]}),r.jsx(ze.CenterSlot,{}),r.jsxs(ze.RightColumn,{children:[r.jsx(ze.TabsSlot,{}),r.jsx(ze.RightSlot,{})]})]}),r.jsxs("div",{className:"flex-1 min-h-0 flex flex-row",children:[r.jsx(KS,{}),r.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:r.jsx(S.Suspense,{fallback:r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(Ee,{size:20,className:"animate-spin text-muted-foreground"})}),children:r.jsx(bh,{})})})]})]})})})})]})})}),t[3]=e,t[4]=o):o=t[4],o}export{G4 as default,ac as useInsetContext};
|