decocms 4.286.4 → 4.286.6
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-CjPPe_Es.js → AlertCircle-DvlMJzvH.js} +1 -1
- package/dist/client/assets/{AreaChart-z-wKOY4Q.js → AreaChart-Co3sUl8Q.js} +1 -1
- package/dist/client/assets/{ArrowLeft-xVEL6Xri.js → ArrowLeft-RTJfGYqO.js} +1 -1
- package/dist/client/assets/{ArrowUp-B504DwzE.js → ArrowUp-C9GXuzBP.js} +1 -1
- package/dist/client/assets/{Check-D-tWl3Ph.js → Check-Bcnwcxbs.js} +1 -1
- package/dist/client/assets/{CheckCircle-1al5Y-iY.js → CheckCircle-CpE2gFL2.js} +1 -1
- package/dist/client/assets/{ChevronDown-B_ixPCTO.js → ChevronDown-CYG4QSfS.js} +1 -1
- package/dist/client/assets/{ChevronRight-C3-hRZ4f.js → ChevronRight-CpQ-XGWn.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-BhgvMMhD.js → ChevronSelectorVertical-CD6IG3xp.js} +1 -1
- package/dist/client/assets/{ChevronUp-CcbaTGNZ.js → ChevronUp-DmLHjlB8.js} +1 -1
- package/dist/client/assets/{Circle-BAeolOWX.js → Circle-DquOefUY.js} +1 -1
- package/dist/client/assets/{Copy01-neaxsIAM.js → Copy01-D1fa_vNZ.js} +1 -1
- package/dist/client/assets/{CreditCard01-ww7LUBF4.js → CreditCard01-CzXoH2_E.js} +1 -1
- package/dist/client/assets/{DotsVertical-CWvHeX6p.js → DotsVertical-CKqcdQY1.js} +1 -1
- package/dist/client/assets/{Download01-Cpj3pMZO.js → Download01-uHHa4lEe.js} +1 -1
- package/dist/client/assets/{Eye-DZppzI4K.js → Eye-DQbrUXqj.js} +1 -1
- package/dist/client/assets/{FilterLines-BoU3nKXE.js → FilterLines-FKz5JmaU.js} +1 -1
- package/dist/client/assets/{Flag01-Cks7Hcsj.js → Flag01-C7lX_ovT.js} +1 -1
- package/dist/client/assets/{Globe01-Blrb9QCE.js → Globe01-DUNAdl96.js} +1 -1
- package/dist/client/assets/{Globe04-nqeXJchO.js → Globe04-C8-Iz5Ob.js} +1 -1
- package/dist/client/assets/{HardDrive-AUMHLymc.js → HardDrive-CNNOA8X1.js} +1 -1
- package/dist/client/assets/{Key01-CBfmNloZ.js → Key01-CtlUEn-O.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CSXhEw69.js → LinkExternal01-CYW5qBle.js} +1 -1
- package/dist/client/assets/{LockUnlocked01-Dp6LUDzs.js → LockUnlocked01-Camlq0iF.js} +1 -1
- package/dist/client/assets/{LogOut01-BwKRFWiv.js → LogOut01-C4vxkvjg.js} +1 -1
- package/dist/client/assets/{Monitor01-BmwzRY8Z.js → Monitor01-BztQffJ4.js} +1 -1
- package/dist/client/assets/{Palette-B_zZgvh3.js → Palette-7eulFGyg.js} +1 -1
- package/dist/client/assets/{Play-d1wMPqu_.js → Play-BBuTt-ww.js} +1 -1
- package/dist/client/assets/{Plus-CS3JRZHD.js → Plus-CNy9dH9H.js} +1 -1
- package/dist/client/assets/{SearchLg-Bgx75S-8.js → SearchLg-C50f6-iX.js} +1 -1
- package/dist/client/assets/{SearchMd-Bhs-AY-t.js → SearchMd-6NHlIJV9.js} +1 -1
- package/dist/client/assets/{Settings02-1WpCazPC.js → Settings02-Coch6I-s.js} +1 -1
- package/dist/client/assets/{Share07-C_MGXbKu.js → Share07-CxOQdduI.js} +1 -1
- package/dist/client/assets/{Shield01-hY2vXu_p.js → Shield01-Bx4JHFe_.js} +1 -1
- package/dist/client/assets/{Stars01-DrSh3zMF.js → Stars01-BN2vePFs.js} +1 -1
- package/dist/client/assets/{Stars02-BnPoIjHT.js → Stars02-C-goK6F_.js} +1 -1
- package/dist/client/assets/{Sun-BW56eukD.js → Sun-DrW-cZzP.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-l1VxUcA6.js → SwitchHorizontal01-DfXXgPLT.js} +1 -1
- package/dist/client/assets/{Tag01-B7UGGBpr.js → Tag01-B6hNMJxH.js} +1 -1
- package/dist/client/assets/{ThumbsUp-CzeOya0s.js → ThumbsUp-Cd4kv7sI.js} +1 -1
- package/dist/client/assets/{Tool01-dqpaqZjV.js → Tool01-CS1WVbOe.js} +1 -1
- package/dist/client/assets/{Tool02-y2Kt_Mle.js → Tool02-jZCjY4_C.js} +1 -1
- package/dist/client/assets/{Trash01-DXi7qmjb.js → Trash01-Ctsi28Hg.js} +1 -1
- package/dist/client/assets/{TrendUp01-DlR3MMdY.js → TrendUp01-C_nOGhfv.js} +1 -1
- package/dist/client/assets/{Upload01-zXZzID1Z.js → Upload01-BEuKNUVM.js} +1 -1
- package/dist/client/assets/{User01-D5qvxe7_.js → User01-Ds6h02_-.js} +1 -1
- package/dist/client/assets/{UserSquare-BCsy6lPT.js → UserSquare-DVKafobf.js} +1 -1
- package/dist/client/assets/{Users01-BNl3O1xq.js → Users01-bpQBejCA.js} +1 -1
- package/dist/client/assets/{Users03-D4uJ1x7m.js → Users03-DlfmNcXb.js} +1 -1
- package/dist/client/assets/{XCircle-DP3o1KVc.js → XCircle-BWzp7_v9.js} +1 -1
- package/dist/client/assets/{XClose-DcJ8LsPY.js → XClose-BEkgs57b.js} +1 -1
- package/dist/client/assets/{YAxis-Bh0QJVqk.js → YAxis-D_jomfKr.js} +1 -1
- package/dist/client/assets/{Zap-QaC6OykZ.js → Zap-CxJvVyr1.js} +1 -1
- package/dist/client/assets/{ZapSquare-rS3NzNGE.js → ZapSquare-Cx2KzeH8.js} +1 -1
- package/dist/client/assets/{access-gate-Cxk9l6b9.js → access-gate-PCzEBWJ5.js} +1 -1
- package/dist/client/assets/{agent-icon-CQ4qTxJT.js → agent-icon-C0NUu0Dv.js} +1 -1
- package/dist/client/assets/{agents-list-BF8Sxquk.js → agents-list-id6I8nWX.js} +1 -1
- package/dist/client/assets/{ai-providers-0lVVwipt.js → ai-providers-C9LSA8l7.js} +1 -1
- package/dist/client/assets/{alert-dialog-C2gjYbmU.js → alert-dialog-B2L8zdte.js} +1 -1
- package/dist/client/assets/{alert-Di8wV19j.js → alert-rPfc5Gbc.js} +1 -1
- package/dist/client/assets/{api-keys-D-qkBRR0.js → api-keys-B5ah8-3a.js} +1 -1
- package/dist/client/assets/{app-editor-Dq0blITG.js → app-editor-DekxMnA4.js} +1 -1
- package/dist/client/assets/{auth-CR0_WHnM.js → auth-CyHwgdwm.js} +1 -1
- package/dist/client/assets/{auth-catchall-QvGPbVjd.js → auth-catchall-op8dXn2Q.js} +1 -1
- package/dist/client/assets/{auth-entry-CWY4gCWi.js → auth-entry-BoRsB15C.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DzhkGA45.js → auth-split-layout-CFEAFbWe.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DePShlsb.js → authenticate-and-persist-oauth-PAJ6c4DM.js} +1 -1
- package/dist/client/assets/{automation-list-row-Cj-qk1co.js → automation-list-row-z1ftMX8t.js} +1 -1
- package/dist/client/assets/{automation-runs-DGZfbF0y.js → automation-runs-BxtzDNBD.js} +1 -1
- package/dist/client/assets/{automations-CUtamPLl.js → automations-B75sZtqk.js} +1 -1
- package/dist/client/assets/{avatar-gygO8t0k.js → avatar-vk7RnokO.js} +1 -1
- package/dist/client/assets/{badge-CagNBc4U.js → badge-CkLXXL_T.js} +1 -1
- package/dist/client/assets/{block-document-CpLnMzDW.js → block-document-C4o6tCSR.js} +1 -1
- package/dist/client/assets/{breadcrumb-BLJkl04u.js → breadcrumb-C9h26hV1.js} +1 -1
- package/dist/client/assets/{buckets-CQX7ELNp.js → buckets--2vuTKGA.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-pYKTv68z.js → bulk-category-panel-vm5kaf3N.js} +1 -1
- package/dist/client/assets/{capability-load-error-BbaDF84A.js → capability-load-error-C9xZENFM.js} +1 -1
- package/dist/client/assets/{cards-2NqNY4R9.js → cards-DQZf9oFU.js} +1 -1
- package/dist/client/assets/{category-editor-Cw-qgPeh.js → category-editor-CLzVrD3c.js} +1 -1
- package/dist/client/assets/{chart-DNRpbEQG.js → chart-D5ReNvVa.js} +1 -1
- package/dist/client/assets/{chat-context-DdGr3_g8.js → chat-context-Blvo4ZaA.js} +1 -1
- package/dist/client/assets/{checkbox-CvS4qhxI.js → checkbox-359BBv51.js} +1 -1
- package/dist/client/assets/{choose-editor-CRVToY1R.js → choose-editor-Bi6bQVoz.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BxxY4YVS.js → cli-auth-success-BGMSslSY.js} +1 -1
- package/dist/client/assets/{collection-detail-DBFBDjmC.js → collection-detail-D3XTvjYX.js} +1 -1
- package/dist/client/assets/{collection-display-button-BeDXWwQw.js → collection-display-button-D7WXGP5-.js} +1 -1
- package/dist/client/assets/{collection-search-D3XcAdbv.js → collection-search-CmlhAF0q.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DXgYFbn3.js → collection-table-wrapper-CtTEf-hj.js} +1 -1
- package/dist/client/assets/{collection-tabs-DqgsWWuc.js → collection-tabs-CQJ6FTtv.js} +1 -1
- package/dist/client/assets/{command-98mCceOP.js → command-B54aL3fS.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-COoKJya8.js → commerce-onboarding-9F-L-Nkc.js} +1 -1
- package/dist/client/assets/{config-DY6hf3s8.js → config-BktrQTTP.js} +1 -1
- package/dist/client/assets/{connect-DP6XodOs.js → connect-BQ2Cd4U6.js} +1 -1
- package/dist/client/assets/{connection-BFaWbm0C.js → connection-BtMCcF76.js} +1 -1
- package/dist/client/assets/{connection-card-Cv0RsJJ_.js → connection-card-jdfVPdle.js} +1 -1
- package/dist/client/assets/{connection-detail-Dqb7DdBc.js → connection-detail-BDIsUsQx.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Df8e763X.js → connection-form-helpers-w35YzYkJ.js} +1 -1
- package/dist/client/assets/{connections-D5Ay3kJB.js → connections-DfQlN_PP.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-DVw1gZjG.js → decopilot-sse-pool-D4oSA7X3.js} +1 -1
- package/dist/client/assets/{dialog-BuvuvAYC.js → dialog-BPAi9RC3.js} +1 -1
- package/dist/client/assets/{domain-settings-DSbKp6qA.js → domain-settings-B0ct-HDu.js} +1 -1
- package/dist/client/assets/{drawer-DmEn61SS.js → drawer-Rb3VMach.js} +1 -1
- package/dist/client/assets/{dropdown-menu-Czbd_AJy.js → dropdown-menu-DrLVp347.js} +1 -1
- package/dist/client/assets/{empty-state-_lAZnBi4.js → empty-state-B2wH44TC.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CW9bBZne.js → extract-connection-data-Bdjb5ZXD.js} +1 -1
- package/dist/client/assets/{file-explorer-BbAtNM55.js → file-explorer-6_ZvOUKC.js} +1 -1
- package/dist/client/assets/{file-type-icon-BSfc7Wfg.js → file-type-icon-Hqh-VGqi.js} +1 -1
- package/dist/client/assets/{form-CHh_Bz9U.js → form-BEmxbAzw.js} +1 -1
- package/dist/client/assets/{general-Bwm-UhNq.js → general-BAt-Pp2H.js} +1 -1
- package/dist/client/assets/{github-icon-C4IsZh8Y.js → github-icon-DHRjGJq9.js} +1 -1
- package/dist/client/assets/{github-repo-picker-C9RaVBvS.js → github-repo-picker-BfQZfVQf.js} +1 -1
- package/dist/client/assets/{hooks-BBdeXd44.js → hooks-OOuw421f.js} +2 -2
- package/dist/client/assets/{index-C9hnclQJ.js → index-BL8fuaSm.js} +1 -1
- package/dist/client/assets/{index-4kWhKkvd.js → index-BV64OjK_.js} +1 -1
- package/dist/client/assets/{index-D297vbs1.js → index-CQOEZYxM.js} +1 -1
- package/dist/client/assets/{index-Bn1REJqN.js → index-D0lcxq-X.js} +1 -1
- package/dist/client/assets/{index-BqGmkqxx.js → index-D7uXKn4l.js} +1 -1
- package/dist/client/assets/{index-2iYjeWO7.js → index-DPGUtnwt.js} +4 -4
- package/dist/client/assets/index-REjt-P-r.js +1 -0
- package/dist/client/assets/{index-C5_rudyt.js → index-Y_1Y556f.js} +6 -6
- package/dist/client/assets/{index-DINrMtim.js → index-_ej3dgt5.js} +1 -1
- package/dist/client/assets/{index-redirect-DulA9_vk.js → index-redirect-CcT9RVhJ.js} +1 -1
- package/dist/client/assets/{index-DmDieVAU.js → index-u2QXPqsz.js} +1 -1
- package/dist/client/assets/{infra-billing-BhAeXe1T.js → infra-billing-bdrx4pLm.js} +1 -1
- package/dist/client/assets/{input-D8Zm47Jt.js → input-DKMZUsZA.js} +1 -1
- package/dist/client/assets/{integration-icon-DF5D8dzf.js → integration-icon-CRsthFhv.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-DIFWrpMK.js → invite-member-dialog-xUE-gU0C.js} +1 -1
- package/dist/client/assets/{label-BXmVgc4R.js → label-BU9Jjv7s.js} +1 -1
- package/dist/client/assets/{layout-C2umEqat.js → layout-Be_9QfZ8.js} +1 -1
- package/dist/client/assets/{login-BA5Gn4nV.js → login-Qn_MjIG7.js} +1 -1
- package/dist/client/assets/{mcp-oauth-EIjqmOGW.js → mcp-oauth-DTLy_4G_.js} +1 -1
- package/dist/client/assets/{members-WEbYgK-E.js → members-DWhY3Kne.js} +1 -1
- package/dist/client/assets/{monaco-editor-CLceT9Kc.js → monaco-editor-uC0FBK2U.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-C1J4-yvD.js → monitoring-stats-row-BDgA_2Ej.js} +1 -1
- package/dist/client/assets/{multi-select-8nHOrqP6.js → multi-select-BQqJKDNj.js} +1 -1
- package/dist/client/assets/{oauth-callback-B1gi_QXh.js → oauth-callback-2vMri_0x.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BR3jc69B.js → oauth-callback-ai-provider-RZWFAs_V.js} +1 -1
- package/dist/client/assets/{onboarding-CJb7w2u2.js → onboarding-BNWf6TW3.js} +1 -1
- package/dist/client/assets/{org-layout-9As--daQ.js → org-layout-BDGMLzCE.js} +1 -1
- package/dist/client/assets/{organization-choice-Dk9tfw5m.js → organization-choice-CdvpiUH2.js} +1 -1
- package/dist/client/assets/{orgs-D04LOh9A.js → orgs-B2aDDMEf.js} +1 -1
- package/dist/client/assets/{page-seo-form-CPmgmD8Q.js → page-seo-form-B68YJZBJ.js} +1 -1
- package/dist/client/assets/{popover-pV1E5Yae.js → popover-C0it1EeO.js} +1 -1
- package/dist/client/assets/{post-calendar-BskyHDPL.js → post-calendar-B523IrUM.js} +1 -1
- package/dist/client/assets/{post-editor--Zt9kpwk.js → post-editor-eYS6wget.js} +1 -1
- package/dist/client/assets/{primitives-RaFkl2kw.js → primitives-DeoLy5zL.js} +1 -1
- package/dist/client/assets/{profile-DZM1TgC_.js → profile-U8XK2VXm.js} +1 -1
- package/dist/client/assets/{project-app-view-D9hKZwXZ.js → project-app-view-Dh8z705d.js} +1 -1
- package/dist/client/assets/{prompts-BC28h6-t.js → prompts-Dt_lXCbL.js} +1 -1
- package/dist/client/assets/record-editor-DtcqJs15.js +1 -0
- package/dist/client/assets/redirect-editor-CHSAyTcV.js +1 -0
- package/dist/client/assets/registry-TR-vIGxU.js +2 -0
- package/dist/client/assets/{registry-layout-CDi54rAy.js → registry-layout-CoVnvVUV.js} +1 -1
- package/dist/client/assets/{reports-BM4wctLR.js → reports-CybfHSA0.js} +1 -1
- package/dist/client/assets/{require-capability-B6_CSUE8.js → require-capability-BMInjTpq.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CPH_QLZq.js → required-auth-layout-D1yWxUhZ.js} +1 -1
- package/dist/client/assets/{reset-password-CKTbNXE2.js → reset-password-DNNEbFuR.js} +1 -1
- package/dist/client/assets/{review-settings-CvDMhhLj.js → review-settings-CmCAUMRs.js} +1 -1
- package/dist/client/assets/{roles-BBbgP0OS.js → roles-D2xRYUv0.js} +1 -1
- package/dist/client/assets/{scroll-area-CrW7xE2P.js → scroll-area-B4T29_7m.js} +1 -1
- package/dist/client/assets/{search-input-CUhyYijt.js → search-input-Cs87u1XL.js} +1 -1
- package/dist/client/assets/{secrets-BS5YBU3b.js → secrets-B-ggfMua.js} +1 -1
- package/dist/client/assets/{sections-editor-B1dtTQTT.js → sections-editor-BZXQsXK6.js} +1 -1
- package/dist/client/assets/{select-BvLYuOCD.js → select-BY51Huw5.js} +1 -1
- package/dist/client/assets/{select-model-DSpI71RT.js → select-model-BzQbpsB5.js} +1 -1
- package/dist/client/assets/{self-tool-result-C15mzmUL.js → self-tool-result-CEMUyQFk.js} +1 -1
- package/dist/client/assets/{seo-editor-Drt9uDgy.js → seo-editor-X38ED2ap.js} +1 -1
- package/dist/client/assets/{settings-layout-Dw0kRTPi.js → settings-layout-CG0_SslF.js} +1 -1
- package/dist/client/assets/{shell-controls-DUuG6V04.js → shell-controls-D5GbCcfG.js} +1 -1
- package/dist/client/assets/{shell-layout-DEm7qxZk.js → shell-layout-4pJEKgjG.js} +1 -1
- package/dist/client/assets/{spinner-Wicci2m_.js → spinner-BaYSIBAI.js} +1 -1
- package/dist/client/assets/{sso-Dc5dEHUK.js → sso-x3mSKdeE.js} +1 -1
- package/dist/client/assets/{store-DbIF8Srw.js → store-pp1mNlyT.js} +1 -1
- package/dist/client/assets/store-registry-DyRwz3yf.js +2 -0
- package/dist/client/assets/{super-agent-icon-DqHrlyQ5.js → super-agent-icon-ChHyJxMq.js} +1 -1
- package/dist/client/assets/{switch-Bgl3Wxgz.js → switch-CL_wNuTg.js} +1 -1
- package/dist/client/assets/{synced-repos-CxD3U_ap.js → synced-repos-CNbFWEV0.js} +1 -1
- package/dist/client/assets/{tab-id-B343rgJA.js → tab-id-BJhTpcjb.js} +1 -1
- package/dist/client/assets/{table-DQye_KJa.js → table-Ch68zFSa.js} +1 -1
- package/dist/client/assets/{tabs-BD0mG09G.js → tabs-C_f6Viy6.js} +1 -1
- package/dist/client/assets/{task-board-BrhfV0Xn.js → task-board-DJY41XW8.js} +1 -1
- package/dist/client/assets/{task-filters-D8uPSMj4.js → task-filters-CM9aziD7.js} +1 -1
- package/dist/client/assets/{tasks-BccmO9V1.js → tasks-qIzDm87v.js} +1 -1
- package/dist/client/assets/{textarea-f884xv9A.js → textarea-CtFZfz7M.js} +1 -1
- package/dist/client/assets/{toggle-group-Bha-KoNy.js → toggle-group-CGVC-CKF.js} +1 -1
- package/dist/client/assets/{toolbar-BK5xyxK4.js → toolbar-BuFg3wIL.js} +1 -1
- package/dist/client/assets/{track-BdMpnoYO.js → track-B8lap1At.js} +1 -1
- package/dist/client/assets/{types-Dlbctr00.js → types-DoWTNUch.js} +1 -1
- package/dist/client/assets/{use-ai-providers-ApFi-RQM.js → use-ai-providers-X5gQ6Frj.js} +1 -1
- package/dist/client/assets/{use-api-keys-JXVd1lCZ.js → use-api-keys-FrDLuz54.js} +1 -1
- package/dist/client/assets/{use-automations-Cleu9yjO.js → use-automations-C3qK2rmP.js} +1 -1
- package/dist/client/assets/{use-autosave-BNILGimX.js → use-autosave-D0w2JlYV.js} +1 -1
- package/dist/client/assets/{use-commerce-diagnostic-whzF46SQ.js → use-commerce-diagnostic-E_UCqtaW.js} +1 -1
- package/dist/client/assets/{use-connection-C6hvABLD.js → use-connection-QgnscFuw.js} +1 -1
- package/dist/client/assets/{use-copy-C-tpPcSH.js → use-copy-D9URxb5f.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BYzHv7h6.js → use-create-virtual-mcp-DiYvnCBd.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-upXMLcwd.js → use-debounced-autosave-BGhJv3cs.js} +1 -1
- package/dist/client/assets/{use-debounced-value-BZvqBs8z.js → use-debounced-value-C3rowxeM.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-uN4mE2mp.js → use-decopilot-events-CU_83DHk.js} +1 -1
- package/dist/client/assets/{use-delete-connection-DdhDmPIr.js → use-delete-connection-C1KY0rKH.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-b1b5Xb8Z.js → use-deployment-admin-CwbH87x9.js} +1 -1
- package/dist/client/assets/{use-file-configs-BTbQBv0E.js → use-file-configs-Ox49dnE1.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-ngbg-f4B.js → use-infinite-scroll-DC-w6br5.js} +1 -1
- package/dist/client/assets/{use-join-requests-BCF9SiKI.js → use-join-requests-ZsGlaroJ.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-WmUL9ybR.js → use-mcp-auth-status-BuxyzgKj.js} +1 -1
- package/dist/client/assets/{use-mcp-client-DjvuKLjH.js → use-mcp-client-BNj8WwX8.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CxRnxARj.js → use-mcp-tools-6tuJyt0H.js} +1 -1
- package/dist/client/assets/{use-members-DYGPMjBz.js → use-members-Bg_K3VT6.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-zMgG6J1K.js → use-navigate-to-agent-DT_1GDH5.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CDziQeOJ.js → use-org-auth-client-YSRXYZJk.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-BJjI7-Fw.js → use-org-repo-syncs-hB2RbIfF.js} +1 -1
- package/dist/client/assets/{use-org-sso-DucjgbBl.js → use-org-sso-CRtwFqcf.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DwfEId2H.js → use-organization-roles-DNf6aAuP.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DjpZoScC.js → use-organization-settings-D_NMX4QF.js} +1 -1
- package/dist/client/assets/{use-registry-connections-25RcS4jV.js → use-registry-connections-BlS_T8ii.js} +1 -1
- package/dist/client/assets/{use-secrets-enFOK9gr.js → use-secrets-DF0Rg5Ke.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-MCctBdnO.js → use-section-preview-base-Qgv1PNdK.js} +1 -1
- package/dist/client/assets/{use-status-sounds-Dks597jZ.js → use-status-sounds-DZu3oH6T.js} +1 -1
- package/dist/client/assets/{use-tags-CPkOatUi.js → use-tags-NRFc9Kma.js} +1 -1
- package/dist/client/assets/{use-view-mode-DmoKnHoh.js → use-view-mode-6EqQcurT.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CcIco7Kt.js → use-virtual-mcp-ClsybENf.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BSIOCSh6.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-BkFkcqA-.js +1 -0
- package/dist/client/assets/{users-D_1RV0_X.js → users-BSDqATBn.js} +1 -1
- package/dist/client/assets/{variant-calendar-CK-1Nkq7.js → variant-calendar-DFnlHYZD.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-B-svGARb.js → view-mode-toggle-CPKFOFja.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/server.js +2 -2
- package/package.json +1 -1
- package/dist/client/assets/index-B5o3n9Kb.js +0 -1
- package/dist/client/assets/record-editor-BK6RtSPc.js +0 -1
- package/dist/client/assets/redirect-editor-BMHZJK5a.js +0 -1
- package/dist/client/assets/registry-C-Y3lVMm.js +0 -2
- package/dist/client/assets/store-registry-B6ZdpEm_.js +0 -2
- package/dist/client/assets/useInfiniteQuery-C4QcHYKZ.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CwmI6XzH.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-
|
|
2
|
-
import{p as as,r as P,ai as yC,aj as _C,ak as Rt,al as js,am as rr,an as Ee,ao as dr,ap as du,aq as LC,ar as bi,as as wC,at as nm,au as ny,c as z,H as Fe,n as ie,j as r,E as Ws,b as re,t as ge,aa as Dr,a5 as zo,a8 as He,a9 as Ke,ab as We,av as Is,I as Kp,B as he,aw as Wp,ax as iy,x as Ti,ay as Ds,az as ul,aA as ux,d as Yt,ac as ys,e as Rs,q as Je,aB as SC,D as Fr,aC as kC,aD as ry,aE as jC,aF as Wi,aG as W9,aH as _n,aI as CC,aJ as q9,aK as NC,aL as TC,aM as VC,aN as AC,z as pf,K as Qe,aO as PC,aP as EC,aQ as DC,aR as RC,aS as oy,aT as qd,o as Pt,k as lt,a as In,C as Vu,aU as uu,u as ur,f as gf,R as xf,aV as qp,aW as IC,L as MC,a3 as ly,aX as vh,aY as hl,Y as bt,aZ as ay,a_ as cy,a$ as Dn,P as vi,b0 as Nt,s as dy,b1 as uy,b2 as $C,b3 as hy,b4 as fy,b5 as my,b6 as py,b7 as gy,b8 as xy,b9 as by,ba as vy,bb as yy,bc as _y,bd as Ly,be as wy,bf as Sy,bg as jn,N as ky,bh as OC,bi as jy,bj as BC,bk as zC,bl as Cy,bm as FC,bn as UC,bo as HC,bp as KC,bq as WC,br as Ny,bs as qC,bt as GC,ah as YC}from"./index-2iYjeWO7.js";import{i as bf,n as JC}from"./ArrowUp-B504DwzE.js";import{u as Il,a as ui,b as Ts,c as un,d as Ty,s as QC,e as XC,f as ZC,g as eN,h as tN,i as sN,j as nN,k as Gp,l as Vy,A as iN,m as rN,n as oN,t as lN,o as aN,p as vf,q as is,r as Lc,H as hu,v as fu,w as Ja,x as Ay,y as Py,z as cN,B as dN}from"./chat-context-DdGr3_g8.js";import{c as yf,s as Bc,g as er,P as mu,d as Yp,t as _l,a as uN,M as hN,i as fN,b as or,e as _f,f as mN,D as pN,h as gN,j as xN,k as wc,l as bN,m as vN,u as Lf,E as yN,n as Au,o as _N,F as LN,p as wf,q as Sf,r as Ey,S as wN,v as SN,w as kN,x as jN,y as hx,z as CN,A as Dy,O as NN,B as fx,C as Gi,G as TN,T as Ry,H as G9,I as Pd,J as VN,K as AN,L as Iy,N as PN,Q as Vi,R as EN,U as DN,V as My,W as yr,X as RN,Y as ud,Z as IN,_ as Jp,$ as Qp,a0 as kf,a1 as Xp,a2 as MN,a3 as $N,a4 as ON,a5 as BN,a6 as zN,a7 as FN,a8 as Fo,a9 as jf,aa as $y,ab as Oy,ac as By,ad as UN,ae as HN,af as zy,ag as KN,ah as WN,ai as qN,aj as GN,ak as YN,al as JN,am as QN,an as XN,ao as ZN}from"./automation-runs-DGZfbF0y.js";import{S as Sc}from"./spinner-Wicci2m_.js";import{a as os,b as Kt,d as Bt,e as zt,h as kn,c as qn,i as Fy}from"./dialog-BuvuvAYC.js";import{c as eT,b as Zp,a as e2,D as t2,d as tT}from"./drawer-DmEn61SS.js";import{C as sT}from"./collection-search-D3XcAdbv.js";import{u as Gt,a as nT,m as iT}from"./use-mcp-client-DjvuKLjH.js";import{a as Uo,i as yh,S as Ho,b as rT,g as _h,c as Uy,d as mx,R as oT,e as lT,W as aT,C as cT}from"./constants-dLUUoWH7.js";import{u as Hy,g as Pu,l as im,C as dT,a as uT,b as hT}from"./chart-DNRpbEQG.js";import{t as _s}from"./ChevronDown-B_ixPCTO.js";import{t as fT,z as mT,a as zc,b as s2,u as n2,c as i2}from"./hooks-BBdeXd44.js";import{K as pT,i as Ky,u as Ko,a as Wy,m as gT,f as xT}from"./shell-layout-DEm7qxZk.js";import{a as Ms,u as Fc,b as r2,c as bT}from"./use-virtual-mcp-CcIco7Kt.js";import{w as qy,A as vT,r as ac,b as yT,p as Gy,f as Lh,c as Yy,d as Jy,e as Qy,g as _T,F as LT,h as wT,j as ST,k as kT,l as jT,m as CT,O as NT,n as TT,o as VT}from"./tab-id-B343rgJA.js";import{r as Xy,d as Zy,a as o2,p as AT,b as PT,s as ET}from"./session-runtime-wVXsCwcJ.js";import{i as Wo,b as l2,a as DT}from"./XCircle-DP3o1KVc.js";import{f as e6,g as a2,h as Ml,j as t6,n as s6,A as ai,k as n6,l as kc,s as Rr,m as i6,o as qo,p as RT,q as IT,c as r6,r as rm,u as Uc,v as x0,w as MT,x as yi,y as ri,z as $T,B as o6,d as OT,C as Cf,D as $l,E as BT,F as c2,G as l6,H as a6,I as om,J as Y9,K as px,L as Nf,M as zT,N as FT,O as UT,P as HT,Q as KT,R as d2,S as c6,T as Gn,U as u2,V as h2,W as d6,X as u6,Y as h6,Z as WT,_ as f2,$ as qT,a0 as gx,a1 as GT,a2 as YT,t as f6,a3 as yo,a4 as Eu,a5 as JT,i as Tf,a6 as QT,a7 as XT,a8 as ZT,a9 as eV,aa as tV,ab as sV,ac as _o,ad as xx,ae as m6,af as nV,ag as iV,ah as rV,ai as jc,aj as m2,ak as oV,al as bx,am as lV,an as aV,ao as cV,ap as p6,aq as dV,ar as uV,as as hV,at as fV,au as mV,av as pV,aw as gV,ax as xV,ay as g6,az as x6,aA as bV,aB as vV,aC as yV,aD as _V,aE as LV,aF as wV}from"./agent-icon-CQ4qTxJT.js";import{i as qt}from"./Check-D-tWl3Ph.js";import{a as _i,i as SV,b as p2,c as g2}from"./Tool01-dqpaqZjV.js";import{i as Yn}from"./Upload01-zXZzID1Z.js";import{i as bn}from"./AlertCircle-CjPPe_Es.js";import{a as dn}from"./Copy01-neaxsIAM.js";import{F as lm,a as x2,b as b2,c as v2,d as b6}from"./form-CHh_Bz9U.js";import{d as It,S as ps,a as gs,b as Ns,c as xs}from"./select-BvLYuOCD.js";import{t as Vf,a as y2,i as Af}from"./ThumbsUp-CzeOya0s.js";import{i as Pf}from"./ArrowLeft-xVEL6Xri.js";import{T as gl,a as Hc,b as tr,c as Du}from"./tabs-BD0mG09G.js";import{t as am}from"./Tool02-y2Kt_Mle.js";import{T as Ef,a as Cc}from"./toggle-group-Bha-KoNy.js";import{I as gt}from"./input-D8Zm47Jt.js";import{u as _2,b as L2,c as v6,g as kV,h as jV,C as w2,a as CV,N as NV}from"./use-commerce-diagnostic-whzF46SQ.js";import{u as y6,M as TV,a as VV,m as Df,i as AV,g as _6,b as PV,N as EV,c as DV}from"./select-model-DSpI71RT.js";import{s as Li}from"./XClose-DcJ8LsPY.js";import{a as ms,b as bs,P as vs,c as RV}from"./popover-pV1E5Yae.js";import{t as Ar}from"./Stars01-DrSh3zMF.js";import{b as IV,a as Rf,c as L6,d as w6,u as S2,e as S6}from"./use-organization-settings-DjpZoScC.js";import{u as If,a as MV}from"./use-ai-providers-ApFi-RQM.js";import{g as k2,c as Kc,d as k6,a as sn,r as j6,f as $V,e as OV}from"./agent-capabilities-B52k7xCe.js";import{f as BV,a as zV,u as pu,b as Wc,c as C6,d as FV,e as j2,g as Ll,h as N6,i as C2,j as UV,k as N2,l as T2,m as HV,p as KV,n as WV,o as qV,q as GV,r as YV,F as Ru,t as T6,s as JV,v as V6,S as QV,B as XV,w as A6,x as ZV,R as eA}from"./cards-2NqNY4R9.js";import{c as Xt,D as Zt,b as es,a as Xe,d as Yi,e as Ji,f as Qi,g as cm,h as fc,i as Pr,j as hd}from"./dropdown-menu-Czbd_AJy.js";import{s as Ht}from"./Plus-CS3JRZHD.js";import{p as tA,q as sA}from"./question-004-sINsf4GQ.js";import{A as Bs}from"./avatar-gygO8t0k.js";import{u as P6,a as Iu}from"./use-members-DYGPMjBz.js";import{i as nn}from"./ChevronRight-C3-hRZ4f.js";import{u as qc}from"./use-is-desktop-app-BNujXJc_.js";import{i as hi}from"./CheckCircle-1al5Y-iY.js";import{I as Ai}from"./integration-icon-DF5D8dzf.js";import{e as Mu}from"./backoff-CrEUbyZT.js";import{u as nA}from"./use-status-sounds-Dks597jZ.js";import{E as Co}from"./empty-state-_lAZnBi4.js";import{T as go,a as iA}from"./toolbar-BK5xyxK4.js";import{b as E6,n as D6}from"./ZapSquare-rS3NzNGE.js";import{i as No,a as rA}from"./Share07-C_MGXbKu.js";import{i as Mn}from"./Globe01-Blrb9QCE.js";import{i as R6}from"./Monitor01-BmwzRY8Z.js";import{u as ci,a as V2,b as A2}from"./use-connection-C6hvABLD.js";import{u as I6,a as P2,b as M6}from"./use-mcp-tools-CxRnxARj.js";import{g as Mf,M as oA}from"./types-Dlbctr00.js";import{F as lr}from"./file-type-icon-BSfc7Wfg.js";import{d as E2,c as D2,b as lA}from"./TrendUp01-DlR3MMdY.js";import{u as R2,a as $6}from"./use-file-configs-BTbQBv0E.js";import{n as Nc}from"./Download01-Cpj3pMZO.js";import{n as xn}from"./LinkExternal01-CSXhEw69.js";import{w as vx,M as $u,F as aA}from"./monaco-editor-CLceT9Kc.js";import{i as $f}from"./Key01-CBfmNloZ.js";import{p as cA,f as dA}from"./pt-BR-CLy76QW2.js";import{g as uA,e as hA}from"./extract-connection-data-CW9bBZne.js";import{a as fA,i as yx}from"./mcp-oauth-EIjqmOGW.js";import{A as To,a as Vo,b as Ao,c as Po,d as Eo,e as Do,f as Ro,g as Io}from"./alert-dialog-C2gjYbmU.js";import{T as Ir}from"./textarea-f884xv9A.js";import{i as wl}from"./Play-d1wMPqu_.js";import{s as rn}from"./Trash01-DXi7qmjb.js";import{u as wh}from"./use-debounced-autosave-upXMLcwd.js";import{S as Go}from"./scroll-area-CrW7xE2P.js";import{i as gu}from"./SearchMd-Bhs-AY-t.js";import{C as Gc}from"./checkbox-CvS4qhxI.js";import{S as Of}from"./search-input-CUhyYijt.js";import{C as O6}from"./collection-tabs-DqgsWWuc.js";import{T as B6,u as z6}from"./use-mcp-auth-status-WmUL9ybR.js";import{n as mA}from"./LockUnlocked01-Dp6LUDzs.js";import{g as pA,s as F6}from"./connection-slug-eyAPH6o3.js";import{a as gA,i as xA}from"./Settings02-1WpCazPC.js";import{L as Ut}from"./label-BXmVgc4R.js";import{S as Mr}from"./switch-Bgl3Wxgz.js";import{d as Yc}from"./delay-CnY5UFtP.js";import{G as Jn}from"./github-icon-C4IsZh8Y.js";import{G as I2,u as bA}from"./github-repo-picker-C9RaVBvS.js";import{s as U6}from"./User01-D5qvxe7_.js";import{t as M2}from"./Users01-BNl3O1xq.js";import{u as H6,a as K6}from"./use-secrets-enFOK9gr.js";import{a as Ol}from"./format-time-BnbuEtat.js";import{f as W6,g as vA,l as q6,a as yA}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as _A}from"./authenticate-and-persist-oauth-DePShlsb.js";import{X as LA,A as wA,a as SA}from"./AreaChart-z-wKOY4Q.js";import{i as Bf,a as G6,b as $2,n as Bl}from"./Tag01-B7UGGBpr.js";import{s as zf}from"./Flag01-Cks7Hcsj.js";import{S as sr,t as Y6}from"./super-agent-icon-DqHrlyQ5.js";import{u as J6,a as Q6,b as X6,r as kA,T as jA,c as CA,E as NA,t as TA}from"./task-filters-D8uPSMj4.js";import{t as Ou,S as ii,s as Z6,m as e8,T as xo,a as t8,P as Wn,b as Ff,f as VA,i as AA,r as s8,l as PA,c as EA,d as DA,e as RA,g as IA,h as _x,j as MA,H as $A,k as OA}from"./config-DY6hf3s8.js";import{B as BA,a as zA,b as Lx,c as FA,d as UA,e as HA}from"./breadcrumb-BLJkl04u.js";import{u as J9}from"./use-copy-C-tpPcSH.js";import{i as O2,a as KA,c as WA,b as qA}from"./UserSquare-BCsy6lPT.js";import{R as GA,a as YA,S as ks,D as JA,i as n8,n as QA,b as XA}from"./task-board-BrhfV0Xn.js";import{i as B2,c as i8}from"./SwitchHorizontal01-l1VxUcA6.js";import{C as hr,a as Pi,b as Ei,c as di,d as Cs,e as qs,f as ZA,g as wx}from"./command-98mCceOP.js";import{g as En}from"./get-initials-D-f_fDFw.js";import{u as eP}from"./use-org-auth-client-CDziQeOJ.js";import{u as z2,a as tP,b as sP}from"./use-tags-CPkOatUi.js";import{i as Uf}from"./ChevronSelectorVertical-BhgvMMhD.js";import{i as Hf}from"./SearchLg-Bgx75S-8.js";import{u as dm,a as nP,c as iP,p as r8,b as rP,s as um,n as oP}from"./self-tool-result-C15mzmUL.js";import{a as hm}from"./Palette-B_zZgvh3.js";import{s as Bu}from"./Eye-DZppzI4K.js";import{i as F2}from"./DotsVertical-CWvHeX6p.js";import{u as Kf}from"./use-debounced-value-BZvqBs8z.js";import{u as o8}from"./useInfiniteQuery-C4QcHYKZ.js";import{i as l8}from"./FilterLines-BoU3nKXE.js";import{i as wi}from"./Zap-QaC6OykZ.js";import{B as lP}from"./badge-CagNBc4U.js";import{u as zu,a as aP,b as cP,c as dP,d as uP}from"./use-automations-Cleu9yjO.js";import{s as Gd,n as hP}from"./Stars02-BnPoIjHT.js";import{A as fP}from"./automation-list-row-Cj-qk1co.js";import{t as mP}from"./site-error--i37Vnuw.js";import{u as pP,a as gP}from"./use-org-repo-syncs-BJjI7-Fw.js";import{n as a8}from"./ChevronUp-CcbaTGNZ.js";function c8(t,e){const s=as(e);return xP({filters:{...t,status:"pending"}},s).length}function Sx(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function xP(t={},e){const s=as(e).getMutationCache(),n=P.useRef(t),i=P.useRef(null);return i.current===null&&(i.current=Sx(s,t)),P.useEffect(()=>{n.current=t}),P.useSyncExternalStore(P.useCallback(o=>s.subscribe(()=>{const l=yC(i.current,Sx(s,n.current));i.current!==l&&(i.current=l,_C.schedule(o))}),[s]),()=>i.current,()=>i.current)}const Ed=Rt({connection_id:Ee().describe("Connection ID"),selected_tools:js(Ee()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:js(Ee()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:js(Ee()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),d8=Ed.extend({selected_tools:Ed.shape.selected_tools.optional(),selected_resources:Ed.shape.selected_resources.optional(),selected_prompts:Ed.shape.selected_prompts.optional()}),bP=Rt({connectionId:Ee(),toolName:Ee(),label:Ee(),icon:Ee().nullable().optional()}),vP=Rt({id:Ee().describe("Stable id; used as React key and ?tab= value"),title:Ee().describe("Tab label"),icon:Ee().optional().describe("Optional lucide icon name"),view:Rt({type:nm("ext-app"),appId:Ee(),args:du(Ee(),ny()).optional()})}),u8=dr(["off","manual","auto"]),yP=Rt({defaultMainView:Rt({type:Ee(),id:Ee().optional(),toolName:Ee().optional()}).nullable().optional(),chatDefaultOpen:rr().nullable().optional(),cmsDefaultOpen:rr().nullable().optional(),cms:u8.nullable().optional().describe("How this agent offers content editing. Absent falls back to cmsDefaultOpen."),tabs:js(vP).optional()});function Fu(t){return t?.cms?t.cms:t?.cmsDefaultOpen?"auto":"manual"}function _P(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"preview"}}:{}}}const kx=Rt({tileId:Ee().optional(),connectionId:Ee().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Ee().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Ee().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:du(Ee(),ny()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:bi().int().positive().optional(),maxHeight:bi().int().positive().optional()}),U2=Rt({banner:Ee().nullable().optional(),bannerColor:Ee().nullable().optional(),icon:Ee().nullable().optional(),themeColor:Ee().nullable().optional(),pinnedViews:js(bP).nullable().optional(),layout:yP.nullable().optional(),homeTile:kx.nullable().optional(),homeTiles:js(kx).nullable().optional(),homePrompts:js(Ee()).nullable().optional()});function Tc(t){const e=t?.homeTiles;if(Array.isArray(e)&&e.length>0)return e;const s=t?.homeTile;return s?[s]:[]}const Uu=/^[A-Za-z_][A-Za-z0-9_]*$/,jx=Ee().min(1).regex(Uu,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),LP=wC("kind",[Rt({key:jx,kind:nm("literal"),value:Ee()}),Rt({key:jx,kind:nm("secret"),secretId:Ee().min(1)})]),H2=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,wP=Rt({host:Ee().min(1).regex(H2).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Ee().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),K2=Rt({selected:Ee().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Ee().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Ee().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:js(LP).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:js(wP).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),W2=Rt({url:Ee().describe("GitHub repository URL"),owner:Ee().describe("Repository owner"),name:Ee().describe("Repository name"),installationId:bi().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Ee().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),SP=dr(["agent-sandbox","local-api"]),kP={sandboxHandle:Ee().describe("Provider-specific handle"),previewUrl:Ee().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Ee().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:bi().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Rt({packageManager:Ee().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Ee().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Ee().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},h8=Rt(kP);function jP(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,i]of Object.entries(e))if(!(!i||typeof i!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=h8.parse(i)}catch{}return s}const CP=du(Ee().describe("userId"),du(Ee().describe("branch"),LC(SP,h8))),NP=Rt({id:Ee().describe("Stable identifier for this knowledge file"),name:Ee().describe("File name shown in the UI"),kind:dr(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Ee().describe("Org filesystem (Library) volume the file lives in"),path:Ee().describe("Path within the volume"),url:Ee().describe("Same-origin URL to read the file (display/download)"),contentType:Ee().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:bi().nullable().optional().describe("File size in bytes"),addedAt:Ee().describe("ISO timestamp when the file was attached")}),q2=js(NP).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),TP=dr(["smart","code-review","open"]),G2=TP.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),Y2=rr().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),J2=Ee().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),VP=Rt({id:Ee().describe("Unique identifier"),title:Ee().describe("Human-readable name"),description:Ee().nullable().describe("Description"),icon:Ee().nullable().describe("Icon URL"),created_at:Ee().describe("Creation timestamp"),updated_at:Ee().describe("Last update timestamp"),created_by:Ee().describe("User ID who created this item"),updated_by:Ee().optional().describe("User ID who last updated this item"),organization_id:Ee().describe("Organization ID this item belongs to"),status:dr(["active","inactive"]).describe("Current status"),pinned:rr().describe("Whether this space is pinned to the sidebar"),metadata:Rt({instructions:Ee().nullable().describe("Instructions also used as system prompt"),enabled_plugins:js(Ee()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:js(Ee()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ee().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:U2.nullable().optional().describe("UI customization settings"),githubRepo:W2.nullable().optional().describe("Linked GitHub repository"),runtime:K2.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:CP.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:q2,siteSlug:Ee().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:G2,previewServerUrl:J2,productionUrl:Ee().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:rr().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Y2}).loose().describe("Metadata"),connections:js(Ed).describe("Connections with their selected tools, resources, and prompts")}),f8=Rt({title:Ee().min(1).max(120).describe("Short label shown on the chip"),description:Ee().max(280).optional().describe("One-line subtitle shown under the title"),text:Ee().min(1).describe("The message sent to the agent when the prompt is clicked")});Rt({title:Ee().min(1).max(255).describe("Name for the virtual MCP"),description:Ee().nullable().optional().describe("Optional description"),icon:Ee().nullish().describe("Optional icon URL"),status:dr(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:rr().optional().default(!1).describe("Pin to sidebar"),metadata:Rt({instructions:Ee().nullable().optional().describe("MCP server instructions"),enabled_plugins:js(Ee()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:js(Ee()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ee().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:U2.nullable().optional().describe("UI customization settings"),githubRepo:W2.nullable().optional().describe("Linked GitHub repository"),runtime:K2.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:q2,siteSlug:Ee().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:G2,previewServerUrl:J2,productionUrl:Ee().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:rr().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Y2}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:js(d8).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:js(f8).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Rt({title:Ee().min(1).max(255).optional().describe("New name"),description:Ee().nullable().optional().describe("New description (null to clear)"),icon:Ee().nullish().describe("New icon URL"),status:dr(["active","inactive"]).optional().describe("New status"),pinned:rr().optional().describe("Pin/unpin from sidebar"),metadata:Rt({instructions:Ee().nullable().optional().describe("MCP server instructions"),enabled_plugins:js(Ee()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:js(Ee()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ee().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:U2.nullable().optional().describe("UI customization settings"),githubRepo:W2.nullable().optional().describe("Linked GitHub repository"),runtime:K2.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:q2,siteSlug:Ee().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:G2,previewServerUrl:J2,productionUrl:Ee().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:rr().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Y2}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:js(d8).optional().describe("New connections (replaces existing)"),prompts:js(f8).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});const Cx=3,m8="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",AP="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function p8(t){const e=z.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:o,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const k=er(c._meta);d=c.title??Yp(c.name,k),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(a==="card"){let k;e[4]!==n||e[5]!==c?(k=()=>n(c),e[4]=n,e[5]=c,e[6]=k):k=e[6];const w=o||i,j=i&&"bg-accent/40",N=(o||i)&&"cursor-not-allowed opacity-50";let T;e[7]!==j||e[8]!==N?(T=ie(AP,"hover:bg-accent/60 text-foreground",j,N),e[7]=j,e[8]=N,e[9]=T):T=e[9];let C;e[10]!==u?(C=r.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=C):C=e[11];let V;e[12]!==i?(V=i&&r.jsx(Sc,{size:"xs"}),e[12]=i,e[13]=V):V=e[13];let A;e[14]!==C||e[15]!==V?(A=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C,V]}),e[14]=C,e[15]=V,e[16]=A):A=e[16];let E;e[17]!==h?(E=h&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=E):E=e[18];let D;return e[19]!==A||e[20]!==E||e[21]!==k||e[22]!==w||e[23]!==T?(D=r.jsxs("button",{type:"button",onClick:k,disabled:w,className:T,children:[A,E]}),e[19]=A,e[20]=E,e[21]=k,e[22]=w,e[23]=T,e[24]=D):D=e[24],D}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=o||i,p=i&&"bg-muted/50",g=(o||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ie(m8,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==u?(b=r.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&r.jsx(Sc,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let L;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(L=r.jsx(He,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=L):L=e[40];const _=h??u;let y;e[41]!==_?(y=r.jsx(Ke,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:_})}),e[41]=_,e[42]=y):y=e[42];let S;return e[43]!==L||e[44]!==y?(S=r.jsxs(We,{delayDuration:400,children:[L,y]}),e[43]=L,e[44]=y,e[45]=S):S=e[45],S}function PP(t){const e=z.c(61),{items:s,open:n,onOpenChange:i,onSelect:o,loadingPrompt:l}=t,a=re(),[c,d]=P.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(C=>{const V=c.toLowerCase();return C.prompt.name.toLowerCase().includes(V)||(C.prompt.title??"").toLowerCase().includes(V)||(C.prompt.description??"").toLowerCase().includes(V)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=zo();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&r.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==u||e[9]!==l?.name||e[10]!==i||e[11]!==o){let C;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==o?(C=V=>r.jsx(p8,{item:V,variant:"card",onSelect:A=>{i(!1),o(A)},isLoading:l?.name===V.prompt.name,isDisabled:u&&l?.name!==V.prompt.name},V.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=o,e[17]=C):C=e[17],g=f.map(C),e[7]=f,e[8]=u,e[9]=l?.name,e[10]=i,e[11]=o,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=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:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==a?(v=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=v):v=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=C=>{C.key==="Escape"&&d("")},e[23]=L):L=e[23];let _;e[24]!==c||e[25]!==v?(_=r.jsx(sT,{value:c,onChange:d,placeholder:v,onKeyDown:L}),e[24]=c,e[25]=v,e[26]=_):_=e[26];const y=_;if(m){let C;e[27]!==a?(C=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=C):C=e[28];let V;e[29]!==C?(V=r.jsx(eT,{className:"sr-only",children:r.jsx(Zp,{children:C})}),e[29]=C,e[30]=V):V=e[30];let A;e[31]!==a?(A=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=A):A=e[32];let E;e[33]!==A?(E=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:A})}),e[33]=A,e[34]=E):E=e[34];let D;e[35]!==b||e[36]!==y||e[37]!==E||e[38]!==V?(D=r.jsxs(e2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[V,E,y,b]}),e[35]=b,e[36]=y,e[37]=E,e[38]=V,e[39]=D):D=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==D?(I=r.jsx(Dr,{delayDuration:400,children:r.jsx(t2,{open:n,onOpenChange:i,children:D})}),e[40]=i,e[41]=n,e[42]=D,e[43]=I):I=e[43],I}let S;e[44]!==a?(S=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=S):S=e[45];let k;e[46]!==S?(k=r.jsx(os,{className:"sr-only",children:r.jsx(Kt,{children:S})}),e[46]=S,e[47]=k):k=e[47];let w;e[48]!==a?(w=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=w):w=e[49];let j;e[50]!==w?(j=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:w})}),e[50]=w,e[51]=j):j=e[51];let N;e[52]!==b||e[53]!==y||e[54]!==j||e[55]!==k?(N=r.jsxs(Bt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[k,j,y,b]}),e[52]=b,e[53]=y,e[54]=j,e[55]=k,e[56]=N):N=e[56];let T;return e[57]!==i||e[58]!==n||e[59]!==N?(T=r.jsx(Dr,{delayDuration:400,children:r.jsx(zt,{open:n,onOpenChange:i,children:N})}),e[57]=i,e[58]=n,e[59]=N,e[60]=T):T=e[60],T}function EP(t){const e=z.c(30),{items:s,onSelect:n,loadingPrompt:i,className:o}=t,l=re(),[a,c]=P.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,Cx),v=s.slice(Cx),L=!!i;let _;e[10]!==L||e[11]!==i?.name||e[12]!==n?(_=S=>r.jsx(p8,{item:S,onSelect:n,isLoading:i?.name===S.prompt.name,isDisabled:L&&i?.name!==S.prompt.name},S.prompt.name),e[10]=L,e[11]=i?.name,e[12]=n,e[13]=_):_=e[13];const y=b.map(_);d=Dr,m=400,e[14]!==o?(u=ie("w-full flex flex-wrap gap-2 justify-center",o),e[14]=o,e[15]=u):u=e[15],h=y,f=v.length>0&&r.jsx("button",{type:"button",disabled:L,onClick:()=>c(!0),className:ie(m8,"hover:bg-muted/70 hover:text-foreground",L&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=o,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=u,e[7]=h,e[8]=f,e[9]=m}else d=e[5],u=e[6],h=e[7],f=e[8],m=e[9];let p;e[16]!==u||e[17]!==h||e[18]!==f?(p=r.jsxs("div",{className:u,children:[h,f]}),e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=r.jsx(PP,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=r.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function DP(){return null}function RP(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 IP(t){const e=z.c(31),{connectionId:s}=t,n=re(),{sendMessage:i}=ui(),{org:o}=Fe();let l;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(l={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=l):l=e[3];const a=Gt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=Hy(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const h=u;let f;e[8]!==h?(f=h.map(MP),e[8]=h,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=P.useReducer(RP,p),[b,v]=P.useState(null);let L;e[11]!==a||e[12]!==i||e[13]!==n?(L=async(A,E)=>{if(!a){ge.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const D=await Pu(a,A.name,E);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[yf({id:A.name,name:Bc(A.name,er(A._meta)),metadata:D.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(I)}catch(D){console.error("[ice-breakers] Failed to fetch prompt:",D),ge.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=L):L=e[14];const _=L;let y;e[15]!==_?(y=async A=>{if(A.arguments&&A.arguments.length>0){x({type:"SELECT_PROMPT",prompt:A}),v(A);return}x({type:"START_LOADING",prompt:A}),await _(A)},e[15]=_,e[16]=y):y=e[16];const S=y;let k;e[17]!==b||e[18]!==_?(k=async A=>{b&&(x({type:"START_LOADING",prompt:b,arguments:A}),v(null),await _(b,A))},e[17]=b,e[18]=_,e[19]=k):k=e[19];const w=k;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let N;e[20]!==S||e[21]!==m||e[22]!==j?(N=r.jsx(EP,{items:m,onSelect:S,loadingPrompt:j}),e[20]=S,e[21]=m,e[22]=j,e[23]=N):N=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v(null),x({type:"RESET"})},e[24]=T):T=e[24];let C;e[25]!==b||e[26]!==w?(C=r.jsx(mu,{prompt:b,setPrompt:T,onSubmit:w}),e[25]=b,e[26]=w,e[27]=C):C=e[27];let V;return e[28]!==N||e[29]!==C?(V=r.jsxs(r.Fragment,{children:[N,C]}),e[28]=N,e[29]=C,e[30]=V):V=e[30],V}function MP(t){return{prompt:t}}function $P(t){const e=z.c(13),{className:s}=t,{selectedVirtualMcp:n}=Il(),{org:i}=Fe();let o;e[0]!==i.id?(o=Uo(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=o.id,a=n?.id??l;let c;e[2]!==s?(c=ie("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(DP,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=r.jsx(IP,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=r.jsx(Ws,{fallback:null,children:r.jsx(P.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}const Q9="cubic-bezier(0.645, 0.045, 0.355, 1)",OP=44,BP={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},zP={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},FP={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Mo(t){const e=z.c(69),{icon:s,label:n,count:i,title:o,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=re(),[p,g]=P.useState(d),[x,b]=P.useState(!1);let v;e[0]!==h?(v=()=>{b(!0),h?.()},e[0]=h,e[1]=v):v=e[1];const L=v;if(x)return null;const _=zP[f],y=BP[f];let S;e[2]!==_||e[3]!==y?(S=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",_,y),e[2]=_,e[3]=y,e[4]=S):S=e[4];let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=()=>g(UP),e[5]=k):k=e[5];const w=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let N;e[6]!==w||e[7]!==j?(N=ie("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",w,j),e[6]=w,e[7]=j,e[8]=N):N=e[8];const T=FP[f];let C;e[9]!==T?(C=ie("shrink-0",T),e[9]=T,e[10]=C):C=e[10];let V;e[11]!==s||e[12]!==C?(V=r.jsx("span",{className:C,children:s}),e[11]=s,e[12]=C,e[13]=V):V=e[13];let A;e[14]!==n?(A=r.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=A):A=e[15];let E;e[16]!==i?(E=i?r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=E):E=e[17];const D=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==D?(I=r.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:r.jsx(_s,{size:16,style:{transform:D,transition:`transform 180ms ${Q9}`}})}),e[18]=D,e[19]=I):I=e[19];let R;e[20]!==m?(R=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=R):R=e[21];let $;e[22]!==m?($=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=$):$=e[23];let B,M;e[24]!==L?(B=Q=>{Q.stopPropagation(),L()},M=Q=>{(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),Q.stopPropagation(),L())},e[24]=L,e[25]=B,e[26]=M):(B=e[25],M=e[26]);let O;e[27]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(Is,{size:16}),e[27]=O):O=e[27];let F;e[28]!==R||e[29]!==$||e[30]!==B||e[31]!==M?(F=r.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":R,title:$,onClick:B,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:O}),e[28]=R,e[29]=$,e[30]=B,e[31]=M,e[32]=F):F=e[32];let U;e[33]!==p||e[34]!==V||e[35]!==A||e[36]!==E||e[37]!==I||e[38]!==F||e[39]!==N?(U=r.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:k,className:N,children:[V,A,E,I,F]}),e[33]=p,e[34]=V,e[35]=A,e[36]=E,e[37]=I,e[38]=F,e[39]=N,e[40]=U):U=e[40];const K=p?"1fr":"0fr";let q;e[41]!==K?(q={display:"grid",gridTemplateRows:K,transition:`grid-template-rows 180ms ${Q9}`},e[41]=K,e[42]=q):q=e[42];let W;e[43]===Symbol.for("react.memo_cache_sentinel")?(W={overflow:"hidden",minHeight:0},e[43]=W):W=e[43];const G=p?1:0;let Y;e[44]!==G?(Y={opacity:G,transition:`opacity 120ms ${Q9}`,maxHeight:"60vh"},e[44]=G,e[45]=Y):Y=e[45];let ee;e[46]!==o?(ee=o?r.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:r.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:o})}):r.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=o,e[47]=ee):ee=e[47];let ne;e[48]!==c||e[49]!==o?(ne=c?r.jsx("div",{className:ie("pb-4",!o&&"pt-4"),children:c}):null,e[48]=c,e[49]=o,e[50]=ne):ne=e[50];let oe;e[51]!==ee||e[52]!==ne?(oe=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[ee,ne]}),e[51]=ee,e[52]=ne,e[53]=oe):oe=e[53];let Z;e[54]!==l||e[55]!==a?(Z=l||a?r.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{children:l}),r.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=Z):Z=e[56];let J;e[57]!==Y||e[58]!==oe||e[59]!==Z?(J=r.jsx("div",{style:W,children:r.jsxs("div",{className:"flex flex-col",style:Y,children:[oe,Z]})}),e[57]=Y,e[58]=oe,e[59]=Z,e[60]=J):J=e[60];let H;e[61]!==q||e[62]!==J?(H=r.jsx("div",{"data-testid":"collapsible-highlight-body",style:q,children:J}),e[61]=q,e[62]=J,e[63]=H):H=e[63];let se;return e[64]!==U||e[65]!==H||e[66]!==S||e[67]!==f?(se=r.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:S,children:[U,H]}),e[64]=U,e[65]=H,e[66]=S,e[67]=f,e[68]=se):se=e[68],se}function UP(t){return!t}const HP=Rt({content:Ee().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:dr(["pending","in_progress","completed"]),activeForm:Ee().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),g8=Rt({todos:js(HP)}),KP="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";fT({description:KP,inputSchema:mT(g8),execute:async({todos:t})=>({ok:!0,count:t.length})});const WP="tool-todo_write",qP=new Set(["input-available","output-available"]);function GP(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let i=n.length-1;i>=0;i--){const o=n[i];if(o.type!==WP||typeof o.state!="string"||!qP.has(o.state))continue;const l=g8.safeParse(o.input);if(l.success)return l.data.todos}}return[]}function x8(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 n="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:n,friendlyName:_l(uN(n)),input:s.input})}return e}function b8(t){return t.at(-1)}function v8(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function YP(t){return t?t.message.startsWith("[CREDITS]"):!1}const JP="[SUBSCRIPTION_REQUIRED]";function y8(t){return t?.message.startsWith(JP)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const QP={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function XP(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=t;if(!i&&s&&YP(s))return{...QP,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(_=>_.type==="tool-user_ask").filter(_=>_.state!=="output-available").length,h=v8(a),f=x8(c),m=GP(e),p=i?null:y8(s),g=!i&&!!s&&!p,x=f.length>0||i&&o,b=h.length>0,L=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:L,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function _8(){const t=z.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=ui(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==o||t[2]!==e||t[3]!==l||t[4]!==a?(c=XP({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:o}),t[0]=i,t[1]=o,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function ZP(){const t=_8();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function L8(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)}const eE="__home__";function Q2(t,e){return Kp.chatDraft(t,e)}function tE(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function w8(t,e,s,n,i){const o=Q2(e,s);if(L8(n)){t.removeItem(o);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(o,a)}catch(c){if(nE(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function Nx(t,e,s){const n=Q2(e,s),i=t.getItem(n),o=tE(i);return i!==null&&o===null&&t.removeItem(n),o}function sE(t,e,s){t.removeItem(Q2(e,s))}function nE(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Cn(t){const e=z.c(14),s=Ms(t),n=Ts(),i=s?.metadata,o=n?.activeTask,l=o?.metadata?.runtime;let a;e[0]!==l?(a=AT(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!o&&!o.partial,u=o?.metadata;let h;e[2]!==i||e[3]!==u?(h=Xy(u,i),e[2]=i,e[3]=u,e[4]=h):h=e[4];const f=!!c||d&&!!s;let m;e[5]!==i?(m=Zy(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=o2(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:h,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function iE(t){const e=z.c(30),{current:s,total:n,onPrev:i,onNext:o}=t,l=re();if(n<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=ie("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==l?(u=l("chat.pagination.previousLabel"),e[2]=l,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Pf,{size:14}),e[4]=h):h=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u?(f=r.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":u,children:h}),e[5]=i,e[6]=a,e[7]=d,e[8]=u,e[9]=f):f=e[9];const m=s+1;let p;e[10]!==l||e[11]!==m||e[12]!==n?(p=l("chat.pagination.counter",{current:m,total:n}),e[10]=l,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=r.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let v;e[16]!==b?(v=ie("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let L;e[18]!==l?(L=l("chat.pagination.nextLabel"),e[18]=l,e[19]=L):L=e[19];let _;e[20]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(Wo,{size:14}),e[20]=_):_=e[20];let y;e[21]!==o||e[22]!==x||e[23]!==v||e[24]!==L?(y=r.jsx("button",{type:"button",onClick:o,disabled:x,className:v,"aria-label":L,children:_}),e[21]=o,e[22]=x,e[23]=v,e[24]=L,e[25]=y):y=e[25];let S;return e[26]!==y||e[27]!==f||e[28]!==g?(S=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,y]}),e[26]=y,e[27]=f,e[28]=g,e[29]=S):S=e[29],S}function S8(t){const e=z.c(8),{currentIndex:s,total:n,onPrev:i,onNext:o,extraLeft:l}=t;let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a=r.jsx(iE,{current:s,total:n,onPrev:i,onNext:o}),e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=r.jsxs("div",{className:"flex items-center gap-2",children:[a,l]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function rE(t){const e=z.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:o,submitLabel:l,nextLabel:a}=t,u=n?l===void 0?"Submit":l:a===void 0?"Next":a,h=n?s:!i,f=h?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==h||e[1]!==o?(m=()=>{h||o()},e[0]=h,e[1]=o,e[2]=m):m=e[2];const p=h&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ie("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==h||e[6]!==u||e[7]!==m||e[8]!==g?(x=r.jsx(he,{type:"button",size:"sm","aria-disabled":h,onClick:m,className:g,children:u}),e[5]=h,e[6]=u,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!f)return b;let v;e[10]!==b?(v=r.jsx(He,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let L;e[12]!==f?(L=r.jsx(Ke,{children:f}),e[12]=f,e[13]=L):L=e[13];let _;return e[14]!==v||e[15]!==L?(_=r.jsxs(We,{children:[v,L]}),e[14]=v,e[15]=L,e[16]=_):_=e[16],_}function k8(t,e,s){return t.findIndex(n=>e(n)===s)}function Tx(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function Vx(t,e,s,n,i){if(t.length===0)return null;const o=k8(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(o+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function oE(t){return!t.isStreaming&&t.allAnswered}function j8(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:o,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,u]=P.useState(c),[h,f]=P.useState(!1),m=Wp({resolver:iy(n),defaultValues:i}),p=m.watch(),g=k8(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),v=Tx(e,s,p,l),L=oE({isStreaming:o,allAnswered:v}),_=()=>{if(g>0){const T=e[g-1];T&&u(s(T))}},y=()=>{if(g>=0&&g<e.length-1){const T=e[g+1];T&&u(s(T))}},S=()=>{const T=m.getValues(),C=Vx(e,s,T,l,d);C&&u(C)},k=()=>{m.handleSubmit(T=>{const C=T;for(const V of e)a(V,C[s(V)])})()},w=P.useRef(k);w.current=k;const j=()=>{L&&(f(!1),w.current())},N=()=>{const T=m.getValues();if(Tx(e,s,T,l)){if(o){f(!0);return}f(!1),w.current()}else{const C=Vx(e,s,T,l,d);C&&u(C)}};return P.useEffect(()=>{if(h&&!o){if(!v){f(!1);return}f(!1),w.current()}},[h,o,v]),{form:m,activeKey:d,setActiveKey:u,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:L,goPrev:_,goNext:y,advanceToNextUnanswered:S,submit:j,submitOrAdvance:N}}const C8="chat.approval.defaultDenyReason";function N8(t){const e=z.c(36),{onYolo:s}=t,n=re(),[i,o]=Ti();let l,a,c,d,u,h,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n){const _=ul.find(k=>k.value===i.toolApprovalLevel)??ul[0];let y;e[13]!==s||e[14]!==i||e[15]!==o?(y=k=>{const w=k,j=i.toolApprovalLevel??"readonly";o({...i,toolApprovalLevel:w}),w==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=o,e[16]=y):y=e[16];const S=y;c=ps,m=i.toolApprovalLevel,p=S,a=gs,u="xs",h="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=lE,l=Ns,d=n(_.shortKey),e[0]=s,e[1]=i,e[2]=o,e[3]=n,e[4]=l,e[5]=a,e[6]=c,e[7]=d,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],u=e[8],h=e[9],f=e[10],m=e[11],p=e[12];let g;e[17]!==l||e[18]!==d?(g=r.jsx(l,{children:d}),e[17]=l,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==u||e[22]!==h||e[23]!==f||e[24]!==g?(x=r.jsx(a,{size:u,className:h,onClick:f,children:g}),e[20]=a,e[21]=u,e[22]=h,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=ul.map(_=>r.jsx(It,{value:_.value,children:n(_.labelKey)},_.value)),e[26]=n,e[27]=b):b=e[27];let v;e[28]!==b?(v=r.jsx(xs,{children:b}),e[28]=b,e[29]=v):v=e[29];let L;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(L=r.jsxs(c,{value:m,onValueChange:p,children:[x,v]}),e[30]=c,e[31]=v,e[32]=m,e[33]=p,e[34]=x,e[35]=L):L=e[35],L}function lE(t){return t.stopPropagation()}function T8(t){const e=z.c(8),{input:s}=t,n=re();if(s==null){let l;e[0]!==n?(l=n("chat.approval.noInput"),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=r.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}let i;try{let l;e[4]!==s?(l=JSON.stringify(s,null,2),e[4]=s,e[5]=l):l=e[5],i=l}catch{i=String(s)}let o;return e[6]!==i?(o=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[6]=i,e[7]=o):o=e[7],o}function aE(t){const e=z.c(38),{approval:s,onRespond:n}=t,i=re(),[o]=Ti(),l=o.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(C8),l),e[0]=s.approvalId,e[1]=l,e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.approvalId||e[6]!==l||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,l),e[5]=s.approvalId,e[6]=l,e[7]=n,e[8]=d):d=e[8];const u=d;let h;e[9]!==s.approvalId||e[10]!==n?(h=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=h):h=e[11];const f=h;let m;e[12]!==f?(m=r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(N8,{onYolo:f})}),e[12]=f,e[13]=m):m=e[13];const p=m;let g;e[14]!==i?(g=i("chat.approval.denyButton"),e[14]=i,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=r.jsx(he,{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:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==i?(b=i("chat.approval.acceptButton"),e[19]=i,e[20]=b):b=e[20];let v;e[21]!==u||e[22]!==b?(v=r.jsx(he,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:b}),e[21]=u,e[22]=b,e[23]=v):v=e[23];let L;e[24]!==x||e[25]!==v?(L=r.jsxs(r.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=L):L=e[26];const _=L;let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Vf,{size:14}),e[27]=y):y=e[27];let S;e[28]!==i?(S=i("chat.approval.needsApproval"),e[28]=i,e[29]=S):S=e[29];let k;e[30]!==s.input?(k=r.jsx(T8,{input:s.input}),e[30]=s.input,e[31]=k):k=e[31];let w;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==_||e[35]!==S||e[36]!==k?(w=r.jsx(Mo,{icon:y,label:S,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:_,children:k}),e[32]=s.friendlyName,e[33]=p,e[34]=_,e[35]=S,e[36]=k,e[37]=w):w=e[37],w}const cE=du(Ee(),Rt({approved:rr().optional(),levelOverride:dr(["auto","readonly"]).optional()}));function dE(t){const e=z.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,o=re(),[l]=Ti(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(fE)),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==a||e[3]!==i||e[4]!==o?(u=(C,V)=>{const A=V;typeof A?.approved=="boolean"&&i(C.approvalId,A.approved,A.approved===!1?o(C8):void 0,A.levelOverride??a)},e[2]=a,e[3]=i,e[4]=o,e[5]=u):u=e[5];let h;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==u?(h={parts:s,partKey:hE,schema:cE,defaultValues:d,isStreaming:n,hasAnswer:uE,onSubmit:u},e[6]=s,e[7]=d,e[8]=n,e[9]=u,e[10]=h):h=e[10];const f=j8(h);let m;e[11]!==s||e[12]!==f?(m=C=>{f.form.reset(Object.fromEntries(s.map(V=>[V.approvalId,{approved:!0,levelOverride:C}]))),f.submitOrAdvance()},e[11]=s,e[12]=f,e[13]=m):m=e[13];const p=m,g=f.currentPart,x=f.form;let b;e[14]!==f?(b=C=>{C.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(Vf,{size:14}),e[16]=v):v=e[16];let L;e[17]!==s.length||e[18]!==o?(L=o("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=o,e[19]=L):L=e[19];const _=g?.friendlyName??"";let y;e[20]!==p?(y=r.jsx(N8,{onYolo:p}),e[20]=p,e[21]=y):y=e[21];let S;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==y?(S=r.jsx(S8,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:y}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=y,e[27]=S):S=e[27];let k;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(k=g?r.jsx(mE,{approvalId:g.approvalId,control:f.form.control,onChange:f.submitOrAdvance}):null,e[28]=g,e[29]=f.form.control,e[30]=f.submitOrAdvance,e[31]=k):k=e[31];let w;e[32]!==g?(w=g?r.jsx(T8,{input:g.input}):null,e[32]=g,e[33]=w):w=e[33];let j;e[34]!==S||e[35]!==k||e[36]!==w||e[37]!==L||e[38]!==_?(j=r.jsx(Mo,{icon:v,label:L,title:_,defaultExpanded:!0,footerLeft:S,footerRight:k,children:w}),e[34]=S,e[35]=k,e[36]=w,e[37]=L,e[38]=_,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==b?(N=r.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=N):N=e[42];let T;return e[43]!==f.form||e[44]!==N?(T=r.jsx(lm,{...x,children:N}),e[43]=f.form,e[44]=N,e[45]=T):T=e[45],T}function uE(t){return typeof t?.approved=="boolean"}function hE(t){return t.approvalId}function fE(t){return[t.approvalId,{approved:void 0}]}function mE(t){const e=z.c(7),{approvalId:s,control:n,onChange:i}=t,o=re(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==o?(a=d=>{const{field:u}=d,h=u.value===!0,f=u.value===!1;return r.jsxs(r.Fragment,{children:[r.jsx(he,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),i()},"aria-pressed":f,children:o("chat.approval.denyButton")}),r.jsx(he,{type:"button",variant:h?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),i()},"aria-pressed":h,children:o("chat.approval.acceptButton")})]})},e[0]=i,e[1]=o,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=r.jsx(Ds,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function pE(){const t=z.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Vf,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=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-[640px] mx-auto mb-2",children:[s,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function gE(t){const e=z.c(8),{approvals:s,isStreaming:n,onRespond:i}=t;if(n&&s.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(pE,{}),e[0]=l):l=e[0],l}if(s.length===0)return null;if(s.length===1){const l=s[0];if(!l)return null;let a;return e[1]!==i||e[2]!==l?(a=r.jsx(aE,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let o;return e[4]!==s||e[5]!==n||e[6]!==i?(o=r.jsx(dE,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=o):o=e[7],o}function xE(t){const e=z.c(28),{plan:s,onApprove:n,onDismiss:i}=t,o=re();let l;e[0]!==n||e[1]!==s.plan?(l=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=l):l=e[2];const a=l;let c;e[3]!==o?(c=o("chat.proposePlan.keepIterating"),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=r.jsx(he,{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:i,children:c}),e[5]=i,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==o?(u=o("chat.proposePlan.letsGo"),e[8]=o,e[9]=u):u=e[9];let h;e[10]!==a||e[11]!==u?(h=r.jsx(he,{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:u}),e[10]=a,e[11]=u,e[12]=h):h=e[12];let f;e[13]!==d||e[14]!==h?(f=r.jsxs(r.Fragment,{children:[d,h]}),e[13]=d,e[14]=h,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(e6,{size:14}),e[16]=p):p=e[16];let g;e[17]!==o?(g=o("chat.proposePlan.planReady"),e[17]=o,e[18]=g):g=e[18];let x;e[19]!==o?(x=o("chat.proposePlan.implementationPlan"),e[19]=o,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=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(hN,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let v;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(v=r.jsx(Mo,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=v):v=e[27],v}function bE(t){const e=z.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let o;e[0]!==s?(o=b8(s),e[0]=s,e[1]=o):o=e[1];const l=o;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=r.jsx(xE,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function V8(t){return t?"response"in t?t.response:t.option??t.draft:""}const Ax=Rt({response:Ee().min(1,"Response is required")}),vE=Rt({option:Ee().nullable(),draft:Ee()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),yE=Rt({response:dr(["yes","no"])});function _E(t){switch(t.type){case"text":return Ax;case"choice":return vE;case"confirm":return yE;default:return Ax}}function LE(t){const e={};for(const s of t)e[s.toolCallId]=_E(s.input);return Rt(e)}function wE(t){const e=z.c(7),{control:s,name:n,placeholder:i}=t,o=re();let l;e[0]!==i||e[1]!==o?(l=c=>{const{field:d}=c,u=d.value??"";return r.jsxs(x2,{children:[r.jsx(b2,{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(a2,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...d,value:u,type:"text",placeholder:i||o("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":o("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),r.jsx(v2,{})]})},e[0]=i,e[1]=o,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=r.jsx(b6,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function A8(t,e){const s=z.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const o=l=>{const a=l.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const c=Number.parseInt(l.key,10);c>=1&&c<=t&&(l.preventDefault(),e(c-1))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),P.useEffect(n,i)}function SE(t){const e=z.c(51),{control:s,name:n,options:i}=t,o=re(),l=`${n}.option`;let a;e[0]!==s||e[1]!==l?(a={control:s,name:l,defaultValue:null},e[0]=s,e[1]=l,e[2]=a):a=e[2];const{field:c}=ux(a),d=`${n}.draft`;let u;e[3]!==s||e[4]!==d?(u={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=u):u=e[5];const{field:h}=ux(u),f=c.value,m=h.value??"";let p;if(e[6]!==c||e[7]!==i?(p=D=>{const I=i[D];I!=null&&c.onChange(I)},e[6]=c,e[7]=i,e[8]=p):p=e[8],A8(i.length,p),i.length===0)return null;const g=f===null;let x;e[9]!==o?(x=o("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=o,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==i||e[14]!==o){let D;e[16]!==c||e[17]!==f||e[18]!==o?(D=(I,R)=>{const $=f===I;return r.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:ie("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",$&&"bg-accent/50",!$&&"hover:bg-accent/30"),"aria-label":o("chat.userAskQuestion.selectOption",{option:I}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",$?"bg-chart-1 text-white":"bg-muted text-foreground"),children:R+1}),r.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:I})]},`${R}-${I}`)},e[16]=c,e[17]=f,e[18]=o,e[19]=D):D=e[19],b=i.map(D),e[11]=c,e[12]=f,e[13]=i,e[14]=o,e[15]=b}else b=e[15];const v=g&&"bg-accent/50",L=!g&&"hover:bg-accent/30";let _;e[20]!==v||e[21]!==L?(_=ie("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,L),e[20]=v,e[21]=L,e[22]=_):_=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(a2,{size:16,className:"text-muted-foreground"})}),e[23]=y):y=e[23];const S=g?m:"";let k;e[24]!==h||e[25]!==c||e[26]!==f?(k=D=>{h.onChange(D.target.value),f!==null&&c.onChange(null)},e[24]=h,e[25]=c,e[26]=f,e[27]=k):k=e[27];let w;e[28]!==c||e[29]!==f?(w=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=w):w=e[30];let j;e[31]!==o?(j=o("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=o,e[32]=j):j=e[32];let N;e[33]!==o?(N=o("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=o,e[34]=N):N=e[34];let T;e[35]!==S||e[36]!==k||e[37]!==w||e[38]!==j||e[39]!==N?(T=r.jsx("input",{type:"text",value:S,onChange:k,onFocus:w,placeholder:j,"aria-label":N,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=S,e[36]=k,e[37]=w,e[38]=j,e[39]=N,e[40]=T):T=e[40];let C;e[41]!==_||e[42]!==T?(C=r.jsxs("label",{className:_,children:[y,T]}),e[41]=_,e[42]=T,e[43]=C):C=e[43];let V;e[44]!==C||e[45]!==x||e[46]!==b?(V=r.jsx(b2,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,C]})}),e[44]=C,e[45]=x,e[46]=b,e[47]=V):V=e[47];let A;e[48]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(v2,{}),e[48]=A):A=e[48];let E;return e[49]!==V?(E=r.jsxs(x2,{children:[V,A]}),e[49]=V,e[50]=E):E=e[50],E}function kE(t){const e=z.c(8),{control:s,name:n}=t,i=re();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const l=o,a=P.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h=>{a.current?.onChange(l[h]??"")},e[1]=c):c=e[1],A8(l.length,c);let d;e[2]!==i?(d=h=>{const{field:f}=h;return a.current=f,r.jsxs(x2,{children:[r.jsx(b2,{children:r.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":i("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:l.map(m=>{const p=f.value===m;return r.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:ie("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.confirmValue",{value:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),r.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),r.jsx(v2,{})]})},e[2]=i,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==n||e[6]!==d?(u=r.jsx(b6,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=u):u=e[7],u}function Px(t){const e=z.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const o=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==o?(l=r.jsx(wE,{control:n,name:o,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=o,e[3]=l):l=e[3],l}case"choice":{let o;e[4]!==s.options?(o=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=o):o=e[5];const l=o;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=r.jsx(SE,{control:n,name:i,options:l}),e[6]=n,e[7]=l,e[8]=i,e[9]=a):a=e[9],a}case"confirm":{const o=`${i}.response`;let l;return e[10]!==n||e[11]!==o?(l=r.jsx(kE,{control:n,name:o}),e[10]=n,e[11]=o,e[12]=l):l=e[12],l}default:return null}}function jE(t){const e=z.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=LE(s.map(VE)),e[0]=s,e[1]=o):o=e[1];const l=o;let a;e[2]!==s?(a=Object.fromEntries(s.map(TE)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(M,O)=>{const F=V8(O);F&&i(M,F)},e[4]=i,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(u={parts:s,partKey:NE,schema:l,defaultValues:c,isStreaming:n,hasAnswer:CE,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=u):u=e[11];const h=j8(u),f=h.currentPart,m=re();let p;e[12]!==f||e[13]!==h||e[14]!==m?(p=()=>{const M=f;if(!M)return;const O=m("chat.userAskQuestion.skipMessage"),F=M.toolCallId;M.input?.type==="choice"?(h.form.setValue(`${F}.option`,null),h.form.setValue(`${F}.draft`,O)):h.form.setValue(`${F}.response`,O),h.advanceToNextUnanswered()},e[12]=f,e[13]=h,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==h.currentIndex||e[17]!==h.goNext||e[18]!==h.goPrev||e[19]!==s.length?(x=r.jsx(S8,{currentIndex:h.currentIndex,total:s.length,onPrev:h.goPrev,onNext:h.goNext}),e[16]=h.currentIndex,e[17]=h.goNext,e[18]=h.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let v;e[21]!==m?(v=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=v):v=e[22];let L;e[23]!==g||e[24]!==v?(L=r.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=L):L=e[25];let _;e[26]!==h.isAllAnswered||e[27]!==h.isCurrentAnswered||e[28]!==h.submitOrAdvance||e[29]!==n?(_=r.jsx(rE,{isStreaming:n,isAllAnswered:h.isAllAnswered,isCurrentAnswered:h.isCurrentAnswered,onAdvanceOrSubmit:h.submitOrAdvance}),e[26]=h.isAllAnswered,e[27]=h.isCurrentAnswered,e[28]=h.submitOrAdvance,e[29]=n,e[30]=_):_=e[30];let y;e[31]!==L||e[32]!==_?(y=r.jsxs(r.Fragment,{children:[L,_]}),e[31]=L,e[32]=_,e[33]=y):y=e[33];const S=y;if(s.length===1){const M=s[0];if(!M?.input)return null;const O=h.form;let F;e[34]!==h?(F=oe=>{oe.preventDefault(),h.submit()},e[34]=h,e[35]=F):F=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(am,{size:14}),e[36]=U):U=e[36];let K;e[37]!==m?(K=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=K):K=e[38];let q;e[39]!==M.input?.prompt||e[40]!==m?(q=M.input?.prompt??m("chat.userAskQuestion.question"),e[39]=M.input?.prompt,e[40]=m,e[41]=q):q=e[41];const W=M.input;let G;e[42]!==h.form.control||e[43]!==M.toolCallId||e[44]!==W?(G=r.jsx(Px,{input:W,control:h.form.control,toolCallId:M.toolCallId}),e[42]=h.form.control,e[43]=M.toolCallId,e[44]=W,e[45]=G):G=e[45];let Y;e[46]!==S||e[47]!==K||e[48]!==q||e[49]!==G?(Y=r.jsx(Mo,{icon:U,label:K,title:q,defaultExpanded:!0,footerRight:S,children:G}),e[46]=S,e[47]=K,e[48]=q,e[49]=G,e[50]=Y):Y=e[50];let ee;e[51]!==F||e[52]!==Y?(ee=r.jsx("form",{onSubmit:F,autoComplete:"off",children:Y}),e[51]=F,e[52]=Y,e[53]=ee):ee=e[53];let ne;return e[54]!==h.form||e[55]!==ee?(ne=r.jsx(lm,{...O,children:ee}),e[54]=h.form,e[55]=ee,e[56]=ne):ne=e[56],ne}const k=h.form;let w;e[57]!==h?(w=M=>{M.preventDefault(),h.submit()},e[57]=h,e[58]=w):w=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(am,{size:14}),e[59]=j):j=e[59];let N;e[60]!==m?(N=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=N):N=e[61];const T=h.currentIndex+1;let C;e[62]!==s.length||e[63]!==m||e[64]!==T?(C=m("chat.userAskQuestion.questionCount",{current:T,total:s.length}),e[62]=s.length,e[63]=m,e[64]=T,e[65]=C):C=e[65];let V;e[66]!==f?.input?.prompt||e[67]!==m?(V=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=V):V=e[68];const A=h.activeKey,E=h.setActiveKey;let D;if(e[69]!==h.form||e[70]!==s){let M;e[72]!==h.form?(M=O=>r.jsx(gl,{value:O.toolCallId,className:"mt-0",children:r.jsx(Px,{input:O.input,control:h.form.control,toolCallId:O.toolCallId})},O.toolCallId),e[72]=h.form,e[73]=M):M=e[73],D=s.map(M),e[69]=h.form,e[70]=s,e[71]=D}else D=e[71];let I;e[74]!==h.activeKey||e[75]!==h.setActiveKey||e[76]!==D?(I=r.jsx(Hc,{value:A,onValueChange:E,children:D}),e[74]=h.activeKey,e[75]=h.setActiveKey,e[76]=D,e[77]=I):I=e[77];let R;e[78]!==b||e[79]!==S||e[80]!==N||e[81]!==C||e[82]!==V||e[83]!==I?(R=r.jsx(Mo,{icon:j,label:N,count:C,title:V,defaultExpanded:!0,footerLeft:b,footerRight:S,children:I}),e[78]=b,e[79]=S,e[80]=N,e[81]=C,e[82]=V,e[83]=I,e[84]=R):R=e[84];let $;e[85]!==w||e[86]!==R?($=r.jsx("form",{onSubmit:w,autoComplete:"off",children:R}),e[85]=w,e[86]=R,e[87]=$):$=e[87];let B;return e[88]!==h.form||e[89]!==$?(B=r.jsx(lm,{...k,children:$}),e[88]=h.form,e[89]=$,e[90]=B):B=e[90],B}function CE(t){return!!V8(t)}function NE(t){return t.toolCallId}function TE(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function VE(t){return{toolCallId:t.toolCallId,input:t.input}}function AE(){const t=z.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(am,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=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-[640px] mx-auto mb-2",children:[s,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function P8(t){const e=z.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=s.filter(PE),e[0]=s,e[1]=o):o=e[1];const l=o;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(AE,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=r.jsx(jE,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function PE(t){return t.state==="input-available"}function EE(t){const e=t.filter(o=>o.status==="in_progress"),s=t.filter(o=>o.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function DE(t){const e=z.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=EE(s),e[0]=s,e[1]=n):n=e[1];const i=n;let o;e[2]!==i.icon?(o=r.jsx($E,{status:i.icon}),e[2]=i.icon,e[3]=o):o=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(RE),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=r.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==o||e[11]!==d?(u=r.jsx(Mo,{icon:o,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=o,e[11]=d,e[12]=u):u=e[12],u}function RE(t,e){return r.jsx(IE,{todo:t},e)}function IE(t){const e=z.c(14),{todo:s}=t,n=s.status==="completed",o=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=r.jsx(ME,{status:s.status}),e[0]=s.status,e[1]=l):l=e[1];const a=n&&"text-muted-foreground";let c;e[2]!==a?(c=ie("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",u=n?"width 300ms ease 200ms":"width 150ms ease";let h;e[4]!==d||e[5]!==u?(h=r.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:u}}),e[4]=d,e[5]=u,e[6]=h):h=e[6];let f;e[7]!==o||e[8]!==c||e[9]!==h?(f=r.jsxs("span",{className:c,children:[o,h]}),e[7]=o,e[8]=c,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==l||e[12]!==f?(m=r.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,f]}),e[11]=l,e[12]=f,e[13]=m):m=e[13],m}function ME(t){const e=z.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("svg",{viewBox:"0 0 21 21",children:r.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=o):o=e[0];let l;return e[1]!==n||e[2]!==i?(l=r.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:o}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function $E(t){const e=z.c(13),{status:s}=t,n=re();if(s==="completed"){let l;e[0]!==n?(l=n("chat.todoStatus.completed"),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:r.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=r.jsx("span",{"aria-label":l,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:a}),e[3]=l,e[4]=c):c=e[4],c}if(s==="in_progress"){let l;e[5]!==n?(l=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=l):l=e[6];let a;return e[7]!==l?(a=r.jsx("span",{"aria-label":l,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=l,e[8]=a):a=e[8],a}let i;e[9]!==n?(i=n("chat.todoStatus.pending"),e[9]=n,e[10]=i):i=e[10];let o;return e[11]!==i?(o=r.jsx("span",{"aria-label":i,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=i,e[12]=o):o=e[12],o}const OE={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},BE=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function E8(t){const e=z.c(65),{onDismiss:s}=t,{org:n}=Fe(),i=Yt(),{decoKeyId:o}=_2(),l=ys(),a=re(),[c,d]=P.useState(""),[u,h]=P.useState(!1),[f,m]=P.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Je("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),P.useEffect(g,x);let b;e[3]!==f||e[4]!==l?(b=async W=>{const{url:G}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:W,currency:f});return G},e[3]=f,e[4]=l,e[5]=b):b=e[5];let v;e[6]!==s?(v=W=>{W&&window.open(W,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=v):v=e[7];let L;e[8]!==a?(L=W=>{ge.error(a("chat.creditsExhaustedBanner.topupError",{error:W.message}))},e[8]=a,e[9]=L):L=e[9];let _;e[10]!==b||e[11]!==v||e[12]!==L?(_={mutationFn:b,onSuccess:v,onError:L},e[10]=b,e[11]=v,e[12]=L,e[13]=_):_=e[13];const{mutate:y,isPending:S}=Rs(_),k=parseFloat(c),w=!isNaN(k)&&k>=1;let j;e[14]!==s?(j=W=>!W&&s?.(),e[14]=s,e[15]=j):j=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=["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[16]=N):N=e[16];let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:N.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=T):T=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=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"}),e[18]=C):C=e[18];let V;e[19]!==a?(V=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=V):V=e[20];let A;e[21]!==V?(A=r.jsx(Kt,{className:"text-xl font-semibold tracking-tight",children:V}),e[21]=V,e[22]=A):A=e[22];let E;e[23]!==a?(E=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=E):E=e[24];let D;e[25]!==E?(D=r.jsx(kn,{className:"mt-1.5 text-sm leading-relaxed",children:E}),e[25]=E,e[26]=D):D=e[26];let I;e[27]!==A||e[28]!==D?(I=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[T,r.jsxs(os,{className:"relative gap-4",children:[C,r.jsxs("div",{children:[A,D]})]})]}),e[27]=A,e[28]=D,e[29]=I):I=e[29];let R;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==k||e[34]!==o||e[35]!==w||e[36]!==S||e[37]!==u||e[38]!==a||e[39]!==y?(R=o&&r.jsxs("div",{className:"px-8 pt-5 pb-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(Ef,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:W=>{W&&m(W)},children:[r.jsx(Cc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Cc,{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:OE[f].map(W=>{const{dollars:G,labelKey:Y}=W;return r.jsxs("button",{type:"button",disabled:S,onClick:()=>{Je("credits_topup_clicked",{amount_cents:G*100,currency:f,tier_label:Y,source:"exhausted_banner"}),y(G*100)},className:ie("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,G]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:a(Y)})]},G)})}),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(gt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:W=>d(W.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(he,{className:"h-10",disabled:!w||S,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(k*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),y(Math.round(k*100))},children:a(S?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.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:a("chat.creditsExhaustedBanner.enterCustom")})]}),r.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:BE.map(W=>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(qt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),r.jsx("span",{className:"text-sm text-foreground/80",children:a(W)})]},W))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=k,e[34]=o,e[35]=w,e[36]=S,e[37]=u,e[38]=a,e[39]=y,e[40]=R):R=e[40];let $;e[41]!==a?($=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=$):$=e[42];let B;e[43]!==s||e[44]!==$?(B=r.jsx(he,{variant:"ghost",size:"sm",onClick:s,children:$}),e[43]=s,e[44]=$,e[45]=B):B=e[45];let M;e[46]!==i||e[47]!==s||e[48]!==n.slug?(M=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=M):M=e[49];let O;e[50]!==a?(O=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=O):O=e[51];let F;e[52]!==M||e[53]!==O?(F=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:M,children:O}),e[52]=M,e[53]=O,e[54]=F):F=e[54];let U;e[55]!==B||e[56]!==F?(U=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[B,F]}),e[55]=B,e[56]=F,e[57]=U):U=e[57];let K;e[58]!==I||e[59]!==R||e[60]!==U?(K=r.jsxs(Bt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:zE,children:[I,R,U]}),e[58]=I,e[59]=R,e[60]=U,e[61]=K):K=e[61];let q;return e[62]!==K||e[63]!==j?(q=r.jsx(zt,{open:!0,onOpenChange:j,children:K}),e[62]=K,e[63]=j,e[64]=q):q=e[64],q}function zE(t){return t.preventDefault()}const FE={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function UE(t){const e=z.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,o=re(),{label:l,title:a}=FE[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Ml,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==o?(d=o(l),e[1]=l,e[2]=o,e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==a?(u=o(a),e[4]=o,e[5]=a,e[6]=u):u=e[6];let h;e[7]!==s||e[8]!==i||e[9]!==o?(h=s==="trial_exhausted"?r.jsx(he,{size:"sm",onClick:i,className:"h-7 text-xs",children:o("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=o,e[10]=h):h=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==u||e[14]!==h?(f=r.jsx(Mo,{icon:c,label:d,title:u,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:h}),e[11]=n,e[12]=d,e[13]=u,e[14]=h,e[15]=f):f=e[15],f}function HE(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),i=/failed to fetch|networkerror|load failed|offline/i.test(e),o=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,a=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(a){const c=a[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:o?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const KE={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function Sh(t){const e=z.c(29),s=re(),{variant:n,onDismiss:i}=t,o=n==="error";let l;e[0]!==o||e[1]!==s?(l=s(o?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=o,e[1]=s,e[2]=l):l=e[2];const a=l,c=o?bn:Fr;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const v=KE[t.finishReason];return v?s(v):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const u=d;let h;e[8]!==o||e[9]!==u?(h=o?HE(u):{summary:u,rawDetails:null},e[8]=o,e[9]=u,e[10]=h):h=e[10];const{summary:f,rawDetails:m}=h;let p;e[11]!==c?(p=r.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==o||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=o?r.jsx(he,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):r.jsx(he,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=o,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?r.jsxs("details",{className:"group mx-4",children:[r.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[r.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m4.5 3 3 3-3 3"})}),r.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),r.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),r.jsxs("div",{className:"relative mt-2",children:[r.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>ge.success(s("chat.highlight.copiedToClipboard"))).catch(()=>ge.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:r.jsx(dn,{className:"size-3.5"})}),r.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==a||e[22]!==i||e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=r.jsx(Mo,{icon:p,label:a,title:f,defaultExpanded:!0,variant:n,onClose:i,footerRight:g,children:x}),e[21]=a,e[22]=i,e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function Wf(){const t=z.c(73),e=re(),{error:s,clearError:n,finishReason:i,clearFinishReason:o,messages:l,isStreaming:a,submit:c,sendMessage:d}=ui(),[u,h]=Ti(),{virtualMcpId:f,createTaskWithMessage:m}=un(),{chatMode:p,simpleModeTier:g}=Il(),{mutate:x}=y6("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const v=b;let L;t[2]!==p||t[3]!==g||t[4]!==f?(L=ce=>({tier:g,mode:p,toolApprovalLevel:ce,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=L):L=t[5];const _=L;let y;t[6]!==u.toolApprovalLevel?(y=u.toolApprovalLevel??SC(),t[6]=u.toolApprovalLevel,t[7]=y):y=t[7];const S=y,k=l.at(-1),w=k?.role==="assistant"?k.parts:[],j=w.filter(YE),N=v8(w),T=x8(w);let C;t[8]!==s||t[9]!==d||t[10]!==e?(C=()=>{if(s){const te={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(te)}},t[8]=s,t[9]=d,t[10]=e,t[11]=C):C=t[11];const V=C;let A;t[12]!==d||t[13]!==e?(A=()=>{const ce={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(ce)},t[12]=d,t[13]=e,t[14]=A):A=t[14];const E=A;let D;t[15]!==_||t[16]!==S||t[17]!==c?(D=(ce,te)=>{c({kind:"toolOutput",toolCallId:ce.toolCallId,output:{response:te}},_(S))},t[15]=_,t[16]=S,t[17]=c,t[18]=D):D=t[18];const I=D;let R;t[19]!==m||t[20]!==u||t[21]!==h||t[22]!==e||t[23]!==f?(R=ce=>{h({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:ce})}]}})},t[19]=m,t[20]=u,t[21]=h,t[22]=e,t[23]=f,t[24]=R):R=t[24];const $=R,B=GE;let M;t[25]!==_||t[26]!==c?(M=(ce,te,le,ue)=>{c({kind:"approval",approvalId:ce,approved:te,...le?{reason:le}:{}},_(ue))},t[25]=_,t[26]=c,t[27]=M):M=t[27];const O=M,F=_8();if(F.isCreditExhausted){let ce;return t[28]!==n?(ce=r.jsx(E8,{onDismiss:n}),t[28]=n,t[29]=ce):ce=t[29],ce}const{showError:U,showWarning:K,hasApprovals:q}=F,W=j.map(qE).join("|"),G=b8(N)?.toolCallId??"",Y=T.map(WE).join("|");let ee;t[30]!==F.todos?(ee=r.jsx(DE,{todos:F.todos}),t[30]=F.todos,t[31]=ee):ee=t[31];let ne;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==v?(ne=F.subscriptionErrorKind&&r.jsx(UE,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=v,t[35]=ne):ne=t[35];let oe;t[36]!==n||t[37]!==s||t[38]!==V||t[39]!==U?(oe=U&&r.jsx(Sh,{variant:"error",error:s,onDismiss:n,onFixInChat:V}),t[36]=n,t[37]=s,t[38]=V,t[39]=U,t[40]=oe):oe=t[40];let Z;t[41]!==o||t[42]!==i||t[43]!==E||t[44]!==K?(Z=K&&r.jsx(Sh,{variant:"warning",finishReason:i,onDismiss:o,onContinue:E}),t[41]=o,t[42]=i,t[43]=E,t[44]=K,t[45]=Z):Z=t[45];let J;t[46]!==Y||t[47]!==O||t[48]!==q||t[49]!==a||t[50]!==T?(J=q&&r.jsx(gE,{approvals:T,isStreaming:a,onRespond:O},Y),t[46]=Y,t[47]=O,t[48]=q,t[49]=a,t[50]=T,t[51]=J):J=t[51];let H;t[52]!==F.hasPlans||t[53]!==$||t[54]!==B||t[55]!==a||t[56]!==N||t[57]!==G?(H=F.hasPlans&&r.jsx(bE,{plans:N,isStreaming:a,onApprove:$,onDismiss:B},G),t[52]=F.hasPlans,t[53]=$,t[54]=B,t[55]=a,t[56]=N,t[57]=G,t[58]=H):H=t[58];let se;t[59]!==F.isWaitingForUserInput||t[60]!==I||t[61]!==a||t[62]!==W||t[63]!==j?(se=F.isWaitingForUserInput&&r.jsx(P8,{userAskParts:j,isStreaming:a,onSubmit:I},W),t[59]=F.isWaitingForUserInput,t[60]=I,t[61]=a,t[62]=W,t[63]=j,t[64]=se):se=t[64];let Q;return t[65]!==oe||t[66]!==Z||t[67]!==J||t[68]!==H||t[69]!==se||t[70]!==ee||t[71]!==ne?(Q=r.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[ee,ne,oe,Z,J,H,se]}),t[65]=oe,t[66]=Z,t[67]=J,t[68]=H,t[69]=se,t[70]=ee,t[71]=ne,t[72]=Q):Q=t[72],Q}function WE(t){return t.approvalId}function qE(t){return t.toolCallId}function GE(){document.querySelector("[data-chat-input]")?.focus()}function YE(t){return t.type==="tool-user_ask"}Wf.Error=function(e){return r.jsx(Sh,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Wf.Warning=function(e){return r.jsx(Sh,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Wf.UserAskQuestion=P8;function JE(t){const e=z.c(20),{taskId:s}=t,n=re(),i=Ty(s),o=QC(i),l=XC(),{stop:a,removeLocalMessage:c}=ui();if(o.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let u;e[2]!==a?(u=()=>{a()},e[2]=a,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(bf,{size:14}),e[4]=h):h=e[4];let f;e[5]!==d||e[6]!==u?(f=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:u,children:h})}),e[5]=d,e[6]=u,e[7]=f):f=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=r.jsx(Ke,{side:"top",children:r.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=r.jsxs(We,{delayDuration:400,children:[f,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==l||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,v)=>r.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[r.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:v+1}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{l.cancel(s,b.messageId).then(L=>{L&&(ZC(s,b.messageId),c(b.messageId))})},children:r.jsx(Li,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],r.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[r.jsx("span",{children:n(o.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:o.length})}),g]}),o.map(x)]})}function QE(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const XE={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function ZE(t){const e=z.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:o,onPick:l,onReset:a,onClose:c}=t,d=re(),u=If(),h=new Set(u.map(eD)),f=eN([i,n,o],h),m=f?.keyId??null,[p,g]=P.useState(m??u[0]?.id??null),x=u.some(R=>R.id===p)?p:m??u[0]?.id??null,b=x?u.find(R=>R.id===x):null,v="flex h-[70vh] max-h-[460px] w-full flex-col",L=XE[s];let _;e[0]!==d||e[1]!==L?(_=d(L),e[0]=d,e[1]=L,e[2]=_):_=e[2];let y;e[3]!==_?(y=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:_}),e[3]=_,e[4]=y):y=e[4];let S;e[5]!==a||e[6]!==d||e[7]!==i?(S=i&&r.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=a,e[6]=d,e[7]=i,e[8]=S):S=e[8];let k;e[9]!==y||e[10]!==S?(k=r.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[y,S]}),e[9]=y,e[10]=S,e[11]=k):k=e[11];const w="flex-1 min-h-0",j=P.Suspense;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(VV,{}),e[12]=N):N=e[12];const T=TV,C=!0,V=QE(m?f:null,b?.providerId??"deco");let A;e[13]!==x||e[14]!==l||e[15]!==g?(A=R=>{const $=R.keyId??x??"";g($),l({keyId:$,modelId:R.modelId,title:R.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=A):A=e[16];let E;e[17]!==T||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==V||e[22]!==A?(E=r.jsx(T,{compact:C,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:V,onModelChange:A}),e[17]=T,e[18]=x,e[19]=c,e[20]=g,e[21]=V,e[22]=A,e[23]=E):E=e[23];let D;e[24]!==j||e[25]!==E||e[26]!==N?(D=r.jsx("div",{className:w,children:r.jsx(j,{fallback:N,children:E})}),e[24]=j,e[25]=E,e[26]=N,e[27]=D):D=e[27];let I;return e[28]!==D||e[29]!==k?(I=r.jsxs("div",{className:v,children:[k,D]}),e[28]=D,e[29]=k,e[30]=I):I=e[30],I}function eD(t){return t.id}const tD=["fast","smart","thinking"];function D8(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const sD={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function nD(t){const e=z.c(28),{tier:s,pillIcon:n,groups:i}=t,o=re();let l;e[0]!==o?(l=D8(o),e[0]=o,e[1]=l):l=e[1];const a=l,[c,d]=P.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=w=>{w.onSelect(),d(!1)},e[2]=u):u=e[2];const h=u,f=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=a[s];let x;e[5]!==g?(x=r.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(_s,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let v;e[8]!==n||e[9]!==f||e[10]!==x?(v=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink",children:r.jsx(ms,{asChild:!0,children:r.jsxs(he,{type:"button",variant:"ghost",size:"default","aria-label":f,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=f,e[10]=x,e[11]=v):v=e[11];let L;e[12]!==f?(L=r.jsx(Ke,{children:f}),e[12]=f,e[13]=L):L=e[13];let _;e[14]!==v||e[15]!==L?(_=r.jsxs(We,{children:[v,L]}),e[14]=v,e[15]=L,e[16]=_):_=e[16];let y;if(e[17]!==i||e[18]!==o){let w;e[20]!==o?(w=j=>r.jsx("div",{className:"flex flex-col",children:j.rows.map(N=>r.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[r.jsxs("button",{type:"button",role:"menuitem","aria-label":N.title,onClick:()=>h(N),className:ie("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",N.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[N.icon&&r.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:N.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm",children:N.title}),N.subtitle&&r.jsx("div",{className:"text-xs text-muted-foreground",children:N.subtitle})]}),N.active&&r.jsx("span",{title:o("chat.tierTrigger.selected"),children:r.jsx(qt,{size:14,className:"text-foreground mt-0.5"})})]}),N.modelOverride&&r.jsx(rD,{label:N.title,render:N.modelOverride})]},N.key))},j.key),e[20]=o,e[21]=w):w=e[21],y=i.map(w),e[17]=i,e[18]=o,e[19]=y}else y=e[19];let S;e[22]!==y?(S=r.jsx(bs,{align:"end",className:"p-1 w-64",onOpenAutoFocus:iD,children:r.jsx("div",{role:"menu",className:"flex flex-col",children:y})}),e[22]=y,e[23]=S):S=e[23];let k;return e[24]!==c||e[25]!==_||e[26]!==S?(k=r.jsxs(vs,{open:c,onOpenChange:d,children:[_,S]}),e[24]=c,e[25]=_,e[26]=S,e[27]=k):k=e[27],k}function iD(t){return t.preventDefault()}function rD(t){const e=z.c(38),{label:s,render:n}=t,i=re(),o=zo(),[l,a]=P.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!1),e[0]=c):c=e[0];const d=c;let u;e[1]!==s||e[2]!==i?(u=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=u):u=e[3];const h=l&&"opacity-100";let f;e[4]!==h?(f=ie("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",h),e[4]=h,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(y2,{size:14}),e[6]=m):m=e[6];let p;e[7]!==u||e[8]!==f?(p=r.jsx("button",{type:"button","aria-label":u,className:f,children:m}),e[7]=u,e[8]=f,e[9]=p):p=e[9];const g=p;if(o){let _;e[10]!==g?(_=r.jsx(tT,{asChild:!0,children:g}),e[10]=g,e[11]=_):_=e[11];let y;e[12]!==s||e[13]!==i?(y=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=y):y=e[14];let S;e[15]!==y?(S=r.jsx(Zp,{className:"sr-only",children:y}),e[15]=y,e[16]=S):S=e[16];let k;e[17]!==l||e[18]!==n?(k=l&&n(d),e[17]=l,e[18]=n,e[19]=k):k=e[19];let w;e[20]!==k||e[21]!==S?(w=r.jsxs(e2,{className:"p-0 flex flex-col max-h-[95vh]",children:[S,k]}),e[20]=k,e[21]=S,e[22]=w):w=e[22];let j;return e[23]!==l||e[24]!==w||e[25]!==_?(j=r.jsxs(t2,{open:l,onOpenChange:a,children:[_,w]}),e[23]=l,e[24]=w,e[25]=_,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=r.jsx(ms,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==l||e[30]!==n?(b=l&&n(d),e[29]=l,e[30]=n,e[31]=b):b=e[31];let v;e[32]!==b?(v=r.jsx(bs,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=v):v=e[33];let L;return e[34]!==l||e[35]!==x||e[36]!==v?(L=r.jsxs(vs,{open:l,onOpenChange:a,children:[x,v]}),e[34]=l,e[35]=x,e[36]=v,e[37]=L):L=e[37],L}function Ex(t){return t==="fast"?r.jsx(Ml,{size:16}):t==="thinking"?r.jsx(t6,{size:16}):r.jsx(Ar,{size:16})}function oD(t){const e=z.c(13),s=nN();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const u=s.tiers[d];return u?u.title??u.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const i=n;let o;e[3]!==i?(o=i("fast"),e[3]=i,e[4]=o):o=e[4];let l;e[5]!==i?(l=i("smart"),e[5]=i,e[6]=l):l=e[6];let a;e[7]!==i?(a=i("thinking"),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==o||e[10]!==l||e[11]!==a?(c={fast:o,smart:l,thinking:a},e[9]=o,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function lD(){const t=z.c(22),e=re(),{simpleModeTier:s,setSimpleModeTier:n}=Il(),i=IV(),o=If(),l=MV(o),a=oD(l),{data:c,error:d}=tN();let u;t[0]!==c?(u=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=u):u=t[1];const h=u,f=sN();let m,p;if(t[2]!==l||t[3]!==i||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==a||t[8]!==f||t[9]!==h||t[10]!==d){const L=D8(e);m="decopilot",p=tD.map(_=>{const y=a[_],S=h.tiers[_];return{key:`decopilot-${_}`,icon:Ex(_),title:L[_],subtitle:y??e(sD[_]),active:s===_,onSelect:()=>n(_),modelOverride:k=>r.jsxs(r.Fragment,{children:[d&&r.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),r.jsx(ZE,{tier:_,orgSlot:i.tiers[_],userSlot:S,autoSlot:l.chat[_],onClose:k,onPick:w=>f.mutate({tier:_,slot:w}),onReset:()=>f.mutate({tier:_,slot:null})},`${_}:${S?.keyId??"org"}:${S?.modelId??""}`)]})}}),t[2]=l,t[3]=i,t[4]=n,t[5]=e,t[6]=s,t[7]=a,t[8]=f,t[9]=h,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=Ex(s),t[16]=s,t[17]=b):b=t[17];let v;return t[18]!==x||t[19]!==b||t[20]!==s?(v=r.jsx(nD,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function X2(t,e,s,n,i,o){if(!Df(e)){ge.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!AV(l,e)){const c=_6(e).parts.map(u=>o(u)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):ge.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){ge.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((f,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;f(g)},c.onerror=m});c.readAsDataURL(s);const u=await d,h={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:u};fN(t,{from:n,to:n},h)}catch(c){console.error("Failed to process file:",c),ge.error(`Failed to load file "${s.name}"`)}}function aD(t){const e=z.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,o=re(),l=P.useRef(dD);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==o?(a=()=>{l.current=async(h,f)=>{await X2(s,n,h,f,i,o)}},c=[s,n,i,o],e[0]=s,e[1]=i,e[2]=n,e[3]=o,e[4]=a,e[5]=c):(a=e[4],c=e[5]),P.useEffect(a,c);let d,u;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const h=new or("fileDropHandler");s.state.plugins.find(p=>p.spec.key===h)&&s.unregisterPlugin(h);const m=new _f({key:h,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const v=g.dataTransfer?.files;if(!v||v.length===0)return!1;g.preventDefault();const L=p.posAtCoords({left:g.clientX,top:g.clientY});if(!L)return!1;const _=Array.from(v);return(async()=>{let y=L.pos;for(const S of _)await l.current?.(S,y),y=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(cD);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const L of b){const _=L.getAsFile();_&&(await l.current?.(_,v),v=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(h)}},u=[s],e[6]=s,e[7]=d,e[8]=u):(d=e[7],u=e[8]),P.useEffect(d,u),null}function cD(t){return t.kind==="file"}function dD(){return Promise.resolve()}function uD(t){const e=z.c(43),{info:s,onClose:n}=t,i=re(),o=s!==null;let l;e[0]!==n?(l=C=>!C&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:r.jsx(Fr,{size:18})}),e[4]=d):d=e[4];let u;e[5]!==i?(u=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=r.jsx(Kt,{className:"text-xl font-semibold tracking-tight",children:u}),e[7]=u,e[8]=h):h=e[8];const f=s?.fileName;let m;e[9]!==f?(m=r.jsxs("span",{className:"font-medium text-foreground",children:["“",f,"”"]}),e[9]=f,e[10]=m):m=e[10];let p;e[11]!==i?(p=i("chat.uploader.cantAttachToChat"),e[11]=i,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=r.jsxs(kn,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==h?(x=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,r.jsxs(os,{className:"relative gap-4",children:[d,r.jsxs("div",{children:[h,g]})]})]}),e[16]=g,e[17]=h,e[18]=x):x=e[18];const b=s?.modelName??"";let v;e[19]!==i||e[20]!==b?(v=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=v):v=e[21];let L;e[22]!==v?(L=r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=L):L=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(s6,{size:14,className:"text-muted-foreground"}),e[24]=_):_=e[24];const y=s?.accepted;let S;e[25]!==y?(S=r.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[_,r.jsx("span",{className:"capitalize",children:y})]}),e[25]=y,e[26]=S):S=e[26];let k;e[27]!==L||e[28]!==S?(k=r.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:r.jsxs("div",{className:"rounded-xl border border-border p-4",children:[L,S]})}),e[27]=L,e[28]=S,e[29]=k):k=e[29];let w;e[30]!==i?(w=i("chat.uploader.gotIt"),e[30]=i,e[31]=w):w=e[31];let j;e[32]!==n||e[33]!==w?(j=r.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:r.jsx(he,{onClick:n,children:w})}),e[32]=n,e[33]=w,e[34]=j):j=e[34];let N;e[35]!==x||e[36]!==k||e[37]!==j?(N=r.jsxs(Bt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:hD,children:[x,k,j]}),e[35]=x,e[36]=k,e[37]=j,e[38]=N):N=e[38];let T;return e[39]!==o||e[40]!==l||e[41]!==N?(T=r.jsx(zt,{open:o,onOpenChange:l,children:N}),e[39]=o,e[40]=l,e[41]=N,e[42]=T):T=e[42],T}function hD(t){return t.preventDefault()}function fD(){const t=z.c(3),[e,s]=P.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=i):i=t[2],i}var Z2=mN;var mD=["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] *)"],fm=mD.join(","),R8=typeof Element>"u",xu=R8?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,kh=!R8&&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},jh=function(e,s){var n;s===void 0&&(s=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),o=i===""||i==="true",l=o||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):jh(e.parentNode));return l},pD=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},gD=function(e,s,n){if(jh(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(fm));return s&&xu.call(e,fm)&&i.unshift(e),i=i.filter(n),i},mm=function(e,s,n){for(var i=[],o=Array.from(e);o.length;){var l=o.shift();if(!jh(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=mm(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var u=xu.call(l,fm);u&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var h=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!jh(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(h&&f){var m=mm(h===!0?l.children:h.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else o.unshift.apply(o,l.children)}}return i},I8=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},M8=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||pD(e))&&!I8(e)?0:e.tabIndex},xD=function(e,s){var n=M8(e);return n<0&&s&&!I8(e)?0:n},bD=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},$8=function(e){return e.tagName==="INPUT"},vD=function(e){return $8(e)&&e.type==="hidden"},yD=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},_D=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},LD=function(e){if(!e.name)return!0;var s=e.form||kh(e),n=function(a){return s.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(l){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",l.message),!1}var o=_D(i,e.form);return!o||o===e},wD=function(e){return $8(e)&&e.type==="radio"},SD=function(e){return wD(e)&&!LD(e)},kD=function(e){var s,n=e&&kh(e),i=(s=n)===null||s===void 0?void 0:s.host,o=!1;if(n&&n!==e){var l,a,c;for(o=!!((l=i)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!o&&i;){var d,u,h;n=kh(i),i=(d=n)===null||d===void 0?void 0:d.host,o=!!((u=i)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return o},Dx=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},jD=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="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 l=xu.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(xu.call(a,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var d=e.parentElement,u=kh(e);if(d&&!d.shadowRoot&&i(d)===!0)return Dx(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(kD(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Dx(e);return!1},CD=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var i=s.children.item(n);if(i.tagName==="LEGEND")return xu.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},ND=function(e,s){return!(s.disabled||vD(s)||jD(s,e)||yD(s)||CD(s))},Rx=function(e,s){return!(SD(s)||M8(s)<0||!ND(e,s))},TD=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},O8=function(e){var s=[],n=[];return e.forEach(function(i,o){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=xD(a,l),d=l?O8(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:o,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(bD).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(s)},B8=function(e,s){s=s||{};var n;return s.getShadowRoot?n=mm([e],s.includeContainer,{filter:Rx.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:TD}):n=gD(e,s.includeContainer,Rx.bind(null,s)),O8(n)};function VD(){return/apple/i.test(navigator.vendor)}const Ix="data-floating-ui-focusable";function AD(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 pm(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&kC(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function fd(t){return"composedPath"in t?t.composedPath()[0]:t.target}function X9(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 PD(t){return t.matches("html,body")}function bu(t){return t?.ownerDocument||document}function ED(t){return t?t.hasAttribute(Ix)?t:t.querySelector("["+Ix+"]")||t:null}function rh(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var o;return i.parentId===e&&(!s||((o=i.context)==null?void 0:o.open))}).flatMap(i=>[i,...rh(t,i.id,s)])}function DD(t){return"nativeEvent"in t}var RD=typeof document<"u",ID=function(){},xl=RD?P.useLayoutEffect:ID;const MD={...ry},$D=MD.useInsertionEffect,OD=$D||(t=>t());function ic(t){const e=P.useRef(()=>{});return OD(()=>{e.current=t}),P.useCallback(function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const z8=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function F8(t,e){const s=B8(t,z8()),n=s.length;if(n===0)return;const i=AD(bu(t)),o=s.indexOf(i),l=o===-1?e===1?0:n-1:o+e;return s[l]}function BD(t){return F8(bu(t).body,1)||t}function zD(t){return F8(bu(t).body,-1)||t}function Z9(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!pm(s,n)}function FD(t){B8(t,z8()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function Mx(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const UD="data-floating-ui-focusable",$x="active",Ox="selected",HD={...ry};let Bx=!1,KD=0;const zx=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+KD++;function WD(){const[t,e]=P.useState(()=>Bx?zx():void 0);return xl(()=>{t==null&&e(zx())},[]),P.useEffect(()=>{Bx=!0},[]),t}const qD=HD.useId,eg=qD||WD;function GD(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(i=>i(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const YD=P.createContext(null),JD=P.createContext(null),U8=()=>{var t;return((t=P.useContext(YD))==null?void 0:t.id)||null},H8=()=>P.useContext(JD);function tg(t){return"data-floating-ui-"+t}const QD={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},Fx=P.forwardRef(function(e,s){const[n,i]=P.useState();xl(()=>{VD()&&i("button")},[]);const o={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[tg("focus-guard")]:"",style:QD};return r.jsx("span",{...e,...o})}),XD={clipPath:"inset(50%)",position:"fixed",top:0,left:0},K8=P.createContext(null),Ux=tg("portal");function ZD(t){t===void 0&&(t={});const{id:e,root:s}=t,n=eg(),i=tR(),[o,l]=P.useState(null),a=P.useRef(null);return xl(()=>()=>{o?.remove(),queueMicrotask(()=>{a.current=null})},[o]),xl(()=>{if(!n||a.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(Ux,""),c.appendChild(d),a.current=d,l(d)},[e,n]),xl(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!AC(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=n,u.setAttribute(Ux,""),c=d||c,c.appendChild(u),a.current=u,l(u)},[e,s,n,i]),o}function eR(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,o=ZD({id:s,root:n}),[l,a]=P.useState(null),c=P.useRef(null),d=P.useRef(null),u=P.useRef(null),h=P.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||o);return P.useEffect(()=>{if(!o||!i||f)return;function g(x){o&&Z9(x)&&(x.type==="focusin"?Mx:FD)(o)}return o.addEventListener("focusin",g,!0),o.addEventListener("focusout",g,!0),()=>{o.removeEventListener("focusin",g,!0),o.removeEventListener("focusout",g,!0)}},[o,i,f]),P.useEffect(()=>{o&&(m||Mx(o))},[m,o]),r.jsxs(K8.Provider,{value:P.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:o,setFocusManagerState:a}),[i,o]),children:[p&&o&&r.jsx(Fx,{"data-type":"outside",ref:c,onFocus:g=>{if(Z9(g,o)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,v=zD(b);v?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:XD}),o&&_n.createPortal(e,o),p&&o&&r.jsx(Fx,{"data-type":"outside",ref:d,onFocus:g=>{if(Z9(g,o)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,v=BD(b);v?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const tR=()=>P.useContext(K8),sR={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},nR={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Hx=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 iR(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:o}=t,{enabled:l=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=H8(),x=ic(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=P.useRef(!1),{escapeKey:L,outsidePress:_}=Hx(m),{escapeKey:y,outsidePress:S}=Hx(p),k=P.useRef(!1),w=ic(A=>{var E;if(!s||!l||!a||A.key!=="Escape"||k.current)return;const D=(E=o.current.floatingContext)==null?void 0:E.nodeId,I=g?rh(g.nodesRef.current,D):[];if(!L&&(A.stopPropagation(),I.length>0)){let R=!0;if(I.forEach($=>{var B;if((B=$.context)!=null&&B.open&&!$.context.dataRef.current.__escapeKeyBubbles){R=!1;return}}),!R)return}n(!1,DD(A)?A.nativeEvent:A,"escape-key")}),j=ic(A=>{var E;const D=()=>{var I;w(A),(I=fd(A))==null||I.removeEventListener("keydown",D)};(E=fd(A))==null||E.addEventListener("keydown",D)}),N=ic(A=>{var E;const D=o.current.insideReactTree;o.current.insideReactTree=!1;const I=v.current;if(v.current=!1,d==="click"&&I||D||typeof b=="function"&&!b(A))return;const R=fd(A),$="["+tg("inert")+"]",B=bu(i.floating).querySelectorAll($);let M=Wi(R)?R:null;for(;M&&!q9(M);){const K=NC(M);if(q9(K)||!Wi(K))break;M=K}if(B.length&&Wi(R)&&!PD(R)&&!pm(R,i.floating)&&Array.from(B).every(K=>!pm(M,K)))return;if(TC(R)&&V){const K=q9(R),q=VC(R),W=/auto|scroll/,G=K||W.test(q.overflowX),Y=K||W.test(q.overflowY),ee=G&&R.clientWidth>0&&R.scrollWidth>R.clientWidth,ne=Y&&R.clientHeight>0&&R.scrollHeight>R.clientHeight,oe=q.direction==="rtl",Z=ne&&(oe?A.offsetX<=R.offsetWidth-R.clientWidth:A.offsetX>R.clientWidth),J=ee&&A.offsetY>R.clientHeight;if(Z||J)return}const O=(E=o.current.floatingContext)==null?void 0:E.nodeId,F=g&&rh(g.nodesRef.current,O).some(K=>{var q;return X9(A,(q=K.context)==null?void 0:q.elements.floating)});if(X9(A,i.floating)||X9(A,i.domReference)||F)return;const U=g?rh(g.nodesRef.current,O):[];if(U.length>0){let K=!0;if(U.forEach(q=>{var W;if((W=q.context)!=null&&W.open&&!q.context.dataRef.current.__outsidePressBubbles){K=!1;return}}),!K)return}n(!1,A,"outside-press")}),T=ic(A=>{var E;const D=()=>{var I;N(A),(I=fd(A))==null||I.removeEventListener(d,D)};(E=fd(A))==null||E.addEventListener(d,D)});P.useEffect(()=>{if(!s||!l)return;o.current.__escapeKeyBubbles=L,o.current.__outsidePressBubbles=_;let A=-1;function E(B){n(!1,B,"ancestor-scroll")}function D(){window.clearTimeout(A),k.current=!0}function I(){A=window.setTimeout(()=>{k.current=!1},CC()?5:0)}const R=bu(i.floating);a&&(R.addEventListener("keydown",y?j:w,y),R.addEventListener("compositionstart",D),R.addEventListener("compositionend",I)),b&&R.addEventListener(d,S?T:N,S);let $=[];return f&&(Wi(i.domReference)&&($=W9(i.domReference)),Wi(i.floating)&&($=$.concat(W9(i.floating))),!Wi(i.reference)&&i.reference&&i.reference.contextElement&&($=$.concat(W9(i.reference.contextElement)))),$=$.filter(B=>{var M;return B!==((M=R.defaultView)==null?void 0:M.visualViewport)}),$.forEach(B=>{B.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(R.removeEventListener("keydown",y?j:w,y),R.removeEventListener("compositionstart",D),R.removeEventListener("compositionend",I)),b&&R.removeEventListener(d,S?T:N,S),$.forEach(B=>{B.removeEventListener("scroll",E)}),window.clearTimeout(A)}},[o,i,a,b,d,s,n,f,l,L,_,w,y,j,N,S,T]),P.useEffect(()=>{o.current.insideReactTree=!1},[o,b,d]);const C=P.useMemo(()=>({onKeyDown:w,...u&&{[sR[h]]:A=>{n(!1,A.nativeEvent,"reference-press")},...h!=="click"&&{onClick(A){n(!1,A.nativeEvent,"reference-press")}}}}),[w,n,u,h]),V=P.useMemo(()=>{function A(E){E.button===0&&(v.current=!0)}return{onKeyDown:w,onMouseDown:A,onMouseUp:A,[nR[d]]:()=>{o.current.insideReactTree=!0}}},[w,d,o]);return P.useMemo(()=>l?{reference:C,floating:V}:{},[l,C,V])}function rR(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=eg(),o=P.useRef({}),[l]=P.useState(()=>GD()),a=U8()!=null,[c,d]=P.useState(n.reference),u=ic((m,p,g)=>{o.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),h=P.useMemo(()=>({setPositionReference:d}),[]),f=P.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return P.useMemo(()=>({dataRef:o,open:e,onOpenChange:u,elements:f,events:l,floatingId:i,refs:h}),[e,u,f,l,i,h])}function oR(t){t===void 0&&(t={});const{nodeId:e}=t,s=rR({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[o,l]=P.useState(null),[a,c]=P.useState(null),u=i?.domReference||o,h=P.useRef(null),f=H8();xl(()=>{u&&(h.current=u)},[u]);const m=jC({...t,elements:{...i,...a&&{reference:a}}}),p=P.useCallback(L=>{const _=Wi(L)?{getBoundingClientRect:()=>L.getBoundingClientRect(),getClientRects:()=>L.getClientRects(),contextElement:L}:L;c(_),m.refs.setReference(_)},[m.refs]),g=P.useCallback(L=>{(Wi(L)||L===null)&&(h.current=L,l(L)),(Wi(m.refs.reference.current)||m.refs.reference.current===null||L!==null&&!Wi(L))&&m.refs.setReference(L)},[m.refs]),x=P.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),b=P.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=P.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return xl(()=>{n.dataRef.current.floatingContext=v;const L=f?.nodesRef.current.find(_=>_.id===e);L&&(L.context=v)}),P.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function e1(t,e,s){const n=new Map,i=s==="item";let o=t;if(i&&t){const{[$x]:l,[Ox]:a,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[UD]:""},...o,...e.map(l=>{const a=l?l[s]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((l,a)=>(a&&Object.entries(a).forEach(c=>{let[d,u]=c;if(!(i&&[$x,Ox].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof u=="function"){var h;(h=n.get(d))==null||h.push(u),l[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=n.get(d))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else l[d]=u}),l),{})}}function lR(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),s=t.map(a=>a?.floating),n=t.map(a=>a?.item),i=P.useCallback(a=>e1(a,t,"reference"),e),o=P.useCallback(a=>e1(a,t,"floating"),s),l=P.useCallback(a=>e1(a,t,"item"),n);return P.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const aR=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function cR(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:o,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=eg(),u=((s=o.domReference)==null?void 0:s.id)||d,h=P.useMemo(()=>{var v;return((v=ED(o.floating))==null?void 0:v.id)||l},[o.floating,l]),f=(n=aR.get(c))!=null?n:c,p=U8()!=null,g=P.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?h:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?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,i,u,c]),x=P.useMemo(()=>{const v={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),b=P.useCallback(v=>{let{active:L,selected:_}=v;const y={role:"option",...L&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...y,"aria-selected":_}}return{}},[h,c]);return P.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function dR(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:a}=t,c=n&&!i,d=xN(s),u=new RegExp(`\\s${d}$`),h=l?"^":"",f=i?"":d,m=c?new RegExp(`${h}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${h}(?:^)?${d}[^\\s${f}]*`,"gm"),p=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const g=a.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),v=new RegExp(`^[${o?.join("")}\0]?$`).test(b);if(o!==null&&!v)return null;const L=g+x.index;let _=L+x[0].length;return c&&u.test(p.slice(_-1,_+1))&&(x[0]+=" ",_+=1),L<a.pos&&_>=a.pos?{range:{from:L,to:_},query:x[0].slice(s.length),text:x[0]}:null}var W8=new or("suggestion");function q8({pluginKey:t=W8,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:h=()=>null,items:f=()=>[],render:m=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=dR,shouldShow:x}){let b;const v=m?.(),L=()=>{const k=e.state.selection.$anchor.pos,w=e.view.coordsAtPos(k),{top:j,right:N,bottom:T,left:C}=w;try{return new DOMRect(C,j,N-C,T-j)}catch{return null}},_=(k,w)=>w?()=>{const j=t.getState(e.state),N=j?.decorationId,T=k.dom.querySelector(`[data-decoration-id="${N}"]`);return T?.getBoundingClientRect()||null}:L;function y(k,w){var j;try{const T=t.getState(k.state),C=T?.decorationId?k.dom.querySelector(`[data-decoration-id="${T.decorationId}"]`):null,V={editor:e,range:T?.range||{from:0,to:0},query:T?.query||null,text:T?.text||null,items:[],command:A=>h({editor:e,range:T?.range||{from:0,to:0},props:A}),decorationNode:C,clientRect:_(k,C)};(j=v?.onExit)==null||j.call(v,V)}catch{}const N=k.state.tr.setMeta(w,{exit:!0});k.dispatch(N)}const S=new _f({key:t,view(){return{update:async(k,w)=>{var j,N,T,C,V,A,E;const D=(j=this.key)==null?void 0:j.getState(w),I=(N=this.key)==null?void 0:N.getState(k.state),R=D.active&&I.active&&D.range.from!==I.range.from,$=!D.active&&I.active,B=D.active&&!I.active,M=!$&&!B&&D.query!==I.query,O=$||R&&M,F=M||R,U=B||R&&M;if(!O&&!F&&!U)return;const K=U&&!O?D:I,q=k.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);b={editor:e,range:K.range,query:K.query,text:K.text,items:[],command:W=>h({editor:e,range:K.range,props:W}),decorationNode:q,clientRect:_(k,q)},O&&((T=v?.onBeforeStart)==null||T.call(v,b)),F&&((C=v?.onBeforeUpdate)==null||C.call(v,b)),(F||O)&&(b.items=await f({editor:e,query:K.query})),U&&((V=v?.onExit)==null||V.call(v,b)),F&&((A=v?.onUpdate)==null||A.call(v,b)),O&&((E=v?.onStart)==null||E.call(v,b))},destroy:()=>{var k;b&&((k=v?.onExit)==null||k.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(k,w,j,N){const{isEditable:T}=e,{composing:C}=e.view,{selection:V}=k,{empty:A,from:E}=V,D={...w},I=k.getMeta(t);if(I&&I.exit)return D.active=!1,D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null,D;if(D.composing=C,T&&(A||e.view.composing)){(E<w.range.from||E>w.range.to)&&!C&&!w.composing&&(D.active=!1);const R=g({char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:V.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;R&&p({editor:e,state:N,range:R.range,isActive:w.active})&&(!x||x({editor:e,range:R.range,query:R.query,text:R.text,transaction:k}))?(D.active=!0,D.decorationId=w.decorationId?w.decorationId:$,D.range=R.range,D.query=R.query,D.text=R.text):D.active=!1}else D.active=!1;return D.active||(D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null),D}},props:{handleKeyDown(k,w){var j,N,T,C;const{active:V,range:A}=S.getState(k.state);if(!V)return!1;if(w.key==="Escape"||w.key==="Esc"){const D=S.getState(k.state),I=(j=b?.decorationNode)!=null?j:null,R=I??(D?.decorationId?k.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`):null);if(((N=v?.onKeyDown)==null?void 0:N.call(v,{view:k,event:w,range:D.range}))||!1)return!0;const B={editor:e,range:D.range,query:D.query,text:D.text,items:[],command:M=>h({editor:e,range:D.range,props:M}),decorationNode:R,clientRect:R?()=>R.getBoundingClientRect()||null:null};return(T=v?.onExit)==null||T.call(v,B),y(k,t),!0}return((C=v?.onKeyDown)==null?void 0:C.call(v,{view:k,event:w,range:A}))||!1},decorations(k){const{active:w,range:j,decorationId:N,query:T}=S.getState(k);if(!w)return null;const C=!T?.length,V=[c];return C&&V.push(u),pN.create(k.doc,[gN.inline(j.from,j.to,{nodeName:a,class:V.join(" "),"data-decoration-id":N,"data-decoration-content":d})])}}});return S}function G8(t,e=W8){const s=t.state.tr.setMeta(e,{exit:!0});t.dispatch(s)}var uR=q8;function hR(t){const e=z.c(24),{editor:s,query:n,items:i,onSelect:o,onClose:l}=t,[a,c]=P.useState(0),d=P.useRef(i),u=P.useRef(a),h=P.useRef(o),f=P.useRef(l),m=P.useDeferredValue(n);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],P.useEffect(p,g);let x,b;e[3]!==i.length||e[4]!==a?(x=()=>{a>=i.length&&i.length>0&&c(0)},b=[i.length,a],e[3]=i.length,e[4]=a,e[5]=x,e[6]=b):(x=e[5],b=e[6]),P.useEffect(x,b);let v,L;e[7]!==i?(v=()=>{d.current=i},L=[i],e[7]=i,e[8]=v,e[9]=L):(v=e[8],L=e[9]),P.useEffect(v,L);let _,y;e[10]!==a?(_=()=>{u.current=a},y=[a],e[10]=a,e[11]=_,e[12]=y):(_=e[11],y=e[12]),P.useEffect(_,y);let S,k;e[13]!==o?(k=()=>{h.current=o},S=[o],e[13]=o,e[14]=S,e[15]=k):(S=e[14],k=e[15]),P.useEffect(k,S);let w,j;e[16]!==l?(w=()=>{f.current=l},j=[l],e[16]=l,e[17]=w,e[18]=j):(w=e[17],j=e[18]),P.useEffect(w,j);let N,T;e[19]!==s?(N=()=>{if(s?.isDestroyed)return;let A;try{A=s.view.dom}catch{return}if(!A)return;const E=I=>{const R=d.current;if(!R.length)return!1;const $=()=>c(M=>(M+1)%R.length),B=()=>c(M=>(M-1+R.length)%R.length);switch(I.key){case"ArrowUp":return I.preventDefault(),B(),!0;case"ArrowDown":return I.preventDefault(),$(),!0;case"Tab":return I.preventDefault(),I.shiftKey?B():$(),!0;case"Home":return I.preventDefault(),c(0),!0;case"End":return I.preventDefault(),c(R.length-1),!0;case"Enter":{if(I.isComposing)return!1;I.preventDefault();const M=u.current;return M!==-1&&R[M]&&h.current?.(R[M],M),!0}case"Escape":return I.preventDefault(),f.current?.(),!0;default:return!1}},D=I=>{E(I)};return A.addEventListener("keydown",D,!0),()=>{A?.removeEventListener("keydown",D,!0)}},T=[s],e[19]=s,e[20]=N,e[21]=T):(N=e[20],T=e[21]),P.useEffect(N,T);const C=i.length?a:void 0;let V;return e[22]!==C?(V={selectedIndex:C,setSelectedIndex:c},e[22]=C,e[23]=V):V=e[23],V}function fR(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 Y8=P.createContext(void 0);function J8(){const t=P.useContext(Y8);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function mR(t){const e=z.c(16),{editor:s,char:n,pluginKey:i,allow:o,onOpenChange:l}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[c,d]=P.useReducer(fR,a);let u;e[1]!==l?(u=g=>{l?.(g)},e[1]=l,e[2]=u):u=e[2];const h=P.useEffectEvent(u);let f;e[3]!==n||e[4]!==o||e[5]!==s||e[6]!==h||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof or?i:new or(i);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=q8({pluginKey:g,editor:s,char:n,allow(v){const L=s.state.doc.resolve(v.range.from);for(let _=L.depth;_>0;_--)if(L.node(_).type.name==="image")return!1;return!(o&&!o(v))},command(){},render:()=>({onStart:v=>{d({type:"ON_START",payload:{element:v.decorationNode??null,query:v.query,range:v.range}}),h(!0)},onUpdate:v=>{d({type:"ON_UPDATE",payload:{element:v.decorationNode??null,query:v.query,range:v.range}})},onKeyDown:v=>v.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),h(!1)}}),items:pR});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=o,e[5]=s,e[6]=h,e[7]=i,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==o||e[11]!==s||e[12]!==i?(m=[s,i,n,d,o],e[9]=n,e[10]=o,e[11]=s,e[12]=i,e[13]=m):m=e[13],P.useEffect(f,m);let p;return e[14]!==c?(p={state:c,dispatch:d},e[14]=c,e[15]=p):p=e[15],p}function pR(){return[]}function gR({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:o}=J8(),l=P.useDeferredValue(i.query),{data:a}=pf({queryKey:Qe.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(h,f)=>{if(!(i.selectedItem!==null||!i.range)){o({type:"SET_SELECTED_ITEM",payload:h});try{const{view:m}=t,g=m.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=i.range?{...i.range}:{from:0,to:0};g&&i.range&&(x.to+=1),await n({range:x,item:h})===!1?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:u}=hR({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:u,close:c,onSelect:d}}function xR({children:t}){const{state:e,dispatch:s}=J8(),{open:n,element:i}=e,o=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=oR({placement:"bottom-start",open:n,onOpenChange:f=>{f||o()},elements:{reference:i},middleware:[PC(10),EC(),DC()],whileElementsMounted:RC}),d=iR(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),u=cR(c,{role:"listbox"}),{getFloatingProps:h}=lR([d,u]);return n?r.jsx(eR,{children:r.jsx("div",{ref:l.setFloating,style:a,...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 bR=t=>{const e=z.c(29),{item:s,isSelected:n,onSelect:i,isLoading:o,ref:l}=t;let a;if(e[0]!==s){const S=er(s._meta);a=s.title||Yp(s.name,S),e[0]=s,e[1]=a}else a=e[1];const c=a,d=s.description||null,u=s.icon,h=n&&"bg-accent text-accent-foreground",f=o&&"pointer-events-none opacity-50";let m;e[2]!==h||e[3]!==f?(m=ie("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(ai,{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 x;e[10]!==o?(x=o&&r.jsx(Sc,{size:"xs"}),e[10]=o,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,x]}),e[12]=g,e[13]=x,e[14]=b):b=e[14];let v;e[15]!==d?(v=d&&r.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=v):v=e[16];let L;e[17]!==b||e[18]!==v?(L=r.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,v]}),e[17]=b,e[18]=v,e[19]=L):L=e[19];let _;e[20]!==s.drillable?(_=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]=_):_=e[21];let y;return e[22]!==i||e[23]!==l||e[24]!==L||e[25]!==_||e[26]!==m||e[27]!==p?(y=r.jsxs("div",{ref:l,onClick:i,className:m,children:[p,L,_]}),e[22]=i,e[23]=l,e[24]=L,e[25]=_,e[26]=m,e[27]=p,e[28]=y):y=e[28],y},vR=t=>{const e=z.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:o}=t,l=re();let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a={editor:s,queryKey:n,queryFn:i,onSelect:o},e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];const{items:c,selectedIndex:d,onSelect:u,selectedItem:h}=gR(a);if(!c.length){let g;e[5]!==l?(g=l("chat.mention.noItemsFound"),e[5]=l,e[6]=g):g=e[6];let x;return e[7]!==g?(x=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:g}),e[7]=g,e[8]=x):x=e[8],x}let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[9]=f):f=e[9];let m;if(e[10]!==u||e[11]!==c||e[12]!==d||e[13]!==h?.name){let g;e[15]!==u||e[16]!==d||e[17]!==h?.name?(g=(x,b)=>r.jsx(bR,{item:x,isSelected:b===d,ref:b===d?LR:void 0,onSelect:()=>u(x,b),isLoading:h?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=u,e[16]=d,e[17]=h?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=u,e[11]=c,e[12]=d,e[13]=h?.name,e[14]=m}else m=e[14];let p;return e[19]!==m?(p=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:f,children:r.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function yR(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"p-1",children:[...Array(3)].map(_R)}),t[0]=e):e=t[0],e}function _R(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 Q8(t){const e=z.c(18),{editor:s,char:n,pluginKey:i,queryKey:o,queryFn:l,onSelect:a,allow:c,onOpenChange:d}=t;let u;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==i?(u={editor:s,char:n,pluginKey:i,allow:c,onOpenChange:d},e[0]=c,e[1]=n,e[2]=s,e[3]=d,e[4]=i,e[5]=u):u=e[5];const{state:h,dispatch:f}=mR(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(yR,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==o?(g=r.jsx(xR,{children:r.jsx(P.Suspense,{fallback:p,children:r.jsx(vR,{editor:s,queryKey:o,queryFn:l,onSelect:a})})}),e[10]=s,e[11]=a,e[12]=l,e[13]=o,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=r.jsx(Y8.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function LR(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const wR=t=>{const e=z.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,o=re(),l=as(),{org:a}=Fe(),c=Fc();let d;e[0]!==c?(d=k2(c),e[0]=c,e[1]=d):d=e[1];const u=d;let h;e[2]!==a.id||e[3]!==a.slug||e[4]!==n?(h={connectionId:n,orgId:a.id,orgSlug:a.slug},e[2]=a.id,e[3]=a.slug,e[4]=n,e[5]=h):h=e[5];const f=Gt(h);let m;e[6]!==a.id||e[7]!==n?(m=Qe.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=P.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=P.useEffectEvent(b),L=P.useRef(null),_=P.useRef(!1),y=n??"default";let S;e[11]!==g||e[12]!==a.id||e[13]!==y?(S=["at-mention",a.id,y,g],e[11]=g,e[12]=a.id,e[13]=y,e[14]=S):S=e[14];const k=S;let w;e[15]!==o?(w=o("chat.mentionAt.agentsTitle"),e[15]=o,e[16]=w):w=e[16];let j;e[17]!==o?(j=o("chat.mentionAt.agentsDescription"),e[17]=o,e[18]=j):j=e[18];let N;e[19]!==w||e[20]!==j?(N={name:"agents",title:w,description:j,kind:"category",drillable:!0},e[19]=w,e[20]=j,e[21]=N):N=e[21];let T;e[22]!==o?(T=o("chat.mentionAt.resourcesTitle"),e[22]=o,e[23]=T):T=e[23];let C;e[24]!==o?(C=o("chat.mentionAt.resourcesDescription"),e[24]=o,e[25]=C):C=e[25];let V;e[26]!==T||e[27]!==C?(V={name:"resources",title:T,description:C,kind:"category",drillable:!0},e[26]=T,e[27]=C,e[28]=V):V=e[28];let A;e[29]!==V||e[30]!==N?(A=[N,V],e[29]=V,e[30]=N,e[31]=A):A=e[31];const E=A;let D;e[32]!==f||e[33]!==s||e[34]!==o?(D=async F=>{const{item:U,range:K}=F;if(Je("chat_picker_item_selected",{picker:"@",item_kind:U.kind,item_name:U.name}),U.kind!=="category"&&(_.current=!0),U.kind==="category")return x(U.name==="agents"?"agents":"resources"),!1;if(U.kind==="agent"&&U.agentId){wc(s,K,{id:U.agentId,name:U.name,metadata:{agentId:U.agentId,title:U.name},char:"@"}),x("categories");return}if(U.kind==="resource"&&U.uri&&f){try{const q=await oy(f,U.uri);wc(s,K,{id:U.uri,name:U.uri,metadata:q.contents,char:"@"})}catch(q){console.error("[at-mention] Failed to fetch resource:",q),ge.error(o("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=f,e[33]=s,e[34]=o,e[35]=D):D=e[35];const I=D;let R;e[36]!==c||e[37]!==E||e[38]!==f||e[39]!==u||e[40]!==v||e[41]!==l||e[42]!==p||e[43]!==n?(R=async F=>{const{query:U}=F,K=v();if(K==="categories"){if(!U.trim())return E;const G=U.toLowerCase(),Y=c.filter(ne=>ne.status==="active"&&(!ne.id||!yh(ne.id))&&!u.has(ne.id)&&ne.id!==n&&(ne.title.toLowerCase().includes(G)||ne.description?.toLowerCase().includes(G))).map(SR),ee=await(async()=>{if(!f)return[];let ne=l.getQueryData(p);return ne||(ne=await l.fetchQuery({queryKey:p,queryFn:()=>qd(f),staleTime:6e4})),(ne?.resources??[]).filter(oe=>oe.uri.toLowerCase().includes(G)||oe.name?.toLowerCase().includes(G)||oe.description?.toLowerCase().includes(G)).map(kR)})();return[...Y,...ee]}if(K==="agents"){let G=c.filter(Y=>Y.status==="active"&&(!Y.id||!yh(Y.id))&&!u.has(Y.id)&&Y.id!==n);if(U.trim()){const Y=U.toLowerCase();G=G.filter(ee=>ee.title.toLowerCase().includes(Y)||ee.description?.toLowerCase().includes(Y))}return G.map(jR)}if(!f)return[];let q=l.getQueryData(p);q?l.fetchQuery({queryKey:p,queryFn:()=>qd(f),staleTime:6e4}).catch(CR):q=await l.fetchQuery({queryKey:p,queryFn:()=>qd(f),staleTime:6e4});let W=q?.resources??[];if(U.trim()){const G=U.toLowerCase();W=W.filter(Y=>Y.uri.toLowerCase().includes(G)||Y.name?.toLowerCase().includes(G)||Y.description?.toLowerCase().includes(G))}return W.map(NR)},e[36]=c,e[37]=E,e[38]=f,e[39]=u,e[40]=v,e[41]=l,e[42]=p,e[43]=n,e[44]=R):R=e[44];const $=R;let B;e[45]!==i?(B=F=>{if(i&&(i.current=F),F)L.current=Date.now(),_.current=!1,Je("chat_picker_opened",{picker:"@"});else{const U=L.current;Je("chat_picker_closed",{picker:"@",outcome:_.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),L.current=null,x("categories")}},e[45]=i,e[46]=B):B=e[46];const M=B;let O;return e[47]!==s||e[48]!==$||e[49]!==I||e[50]!==M||e[51]!==k?(O=r.jsx(Q8,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:k,queryFn:$,onSelect:I,onOpenChange:M}),e[47]=s,e[48]=$,e[49]=I,e[50]=M,e[51]=k,e[52]=O):O=e[52],O};function SR(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function kR(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function jR(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function CR(){}function NR(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function Kx(t,e,s,n,i,o,l){try{const a=await Pu(s,n,o);wc(t,e,{id:n,name:Bc(n,i),metadata:a.messages,char:"/",kind:"prompt",args:o})}catch(a){console.error("[slash] Failed to fetch prompt:",a),ge.error(l.t("chat.mentionSlash.failedLoadPrompt"))}}async function TR(t,e,s,n,i){try{const o=await oy(s,n);wc(t,e,{id:n,name:n,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),ge.error(i.t("chat.mentionSlash.failedLoadResource"))}}async function VR(t,e,s,n,i){try{const{files:o,omittedPaths:l}=await BV(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:o,omittedPaths:l};wc(t,e,{id:n.id,name:n.name,metadata:a,char:"/",kind:"skill"})}catch(o){console.error("[slash] Failed to fetch skill:",o),ge.error(i.t("chat.mentionSlash.failedLoadSkill"))}}const AR=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=re(),i=as(),{org:o}=Fe(),l=Gt({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=Qe.virtualMcpPrompts(e,o.id),c=Qe.virtualMcpResources(e,o.id),d=Qe.slashSkills(o.id),u=["slash-mention",o.id,e??"default"],[h,f]=P.useState(null),[m,p]=P.useState(null),g=bN(t);g&&(g.onEditChip=async k=>{if(l)try{const j=(await Wx(i,a,l)).find(N=>N.name===k.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...k,prompt:j})}catch(w){console.error("[slash] Failed to load prompt for editing:",w),ge.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=P.useRef(null),b=P.useRef(!1),v=async({item:k,range:w})=>{if(Je("chat_picker_item_selected",{picker:"/",item_kind:k.kind,item_name:k.name}),b.current=!0,!!l)if(k.kind==="prompt"){if(k.arguments&&k.arguments.length>0){f({range:w,item:k});return}const j=er(k._meta);await Kx(t,w,l,k.name,j,void 0,{t:n})}else k.kind==="skill"?k.skill&&await VR(t,w,o.slug,k.skill,{t:n}):k.uri&&await TR(t,w,l,k.uri,{t:n})},L=async k=>{if(!h||!l)return;const{range:w,item:j}=h,N=er(j._meta);await Kx(t,w,l,j.name,N,k,{t:n}),f(null)},_=async k=>{if(!(!m||!l)){if(!vN(t,m.pos,m.promptId)){ge.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const w=await Pu(l,m.promptId,k),j=er(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,yf({id:m.promptId,name:Bc(m.promptId,j),metadata:w.messages,char:"/",kind:"prompt",args:k})).run(),Je("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(w){console.error("[slash] Failed to update prompt:",w),ge.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},y=async k=>{const{query:w}=k;if(!l)return[];const[j,N,T]=await Promise.all([Wx(i,a,l),ER(i,c,l),PR(i,d,o.slug)]),C=w.trim().toLowerCase(),V=(j??[]).filter(D=>!C||D.name.toLowerCase().includes(C)||D.title?.toLowerCase().includes(C)||D.description?.toLowerCase().includes(C)).map(D=>({name:D.name,title:D.title,description:D.description,kind:"prompt",arguments:D.arguments,_meta:D._meta})),A=(N??[]).filter(D=>!C||D.uri.toLowerCase().includes(C)||D.name?.toLowerCase().includes(C)||D.description?.toLowerCase().includes(C)).map(D=>({name:D.name??D.uri,title:D.name,description:D.description,kind:"resource",uri:D.uri})),E=(T??[]).filter(D=>!C||D.name.toLowerCase().includes(C)||D.id.toLowerCase().includes(C)||D.description?.toLowerCase().includes(C)).map(D=>({name:D.name,title:D.name,description:D.description??void 0,kind:"skill",skill:D}));return[...V,...A,...E]},S=h?.item.kind==="prompt"?{name:h.item.name,title:h.item.title,arguments:h.item.arguments,description:h.item.description,_meta:h.item._meta}:null;return r.jsxs(r.Fragment,{children:[r.jsx(Q8,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:y,onSelect:v,onOpenChange:k=>{if(s&&(s.current=k),k)x.current=Date.now(),b.current=!1,Je("chat_picker_opened",{picker:"/"});else{const w=x.current;Je("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:w?Date.now()-w:null}),x.current=null}}}),r.jsx(mu,{prompt:S,setPrompt:()=>f(null),onSubmit:L}),r.jsx(mu,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:_,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function Wx(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>im(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>im(s),staleTime:6e4}),n?.prompts??[]}async function PR(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>zV(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function ER(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>qd(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>qd(s),staleTime:6e4}),n?.resources??[]}const X8="Ask anything, / for prompts & skills, @ for agents & resources...";function DR(t){return[wf.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Z2.configure({placeholder:()=>t.current??X8,showOnlyWhenEditable:!1}),_N,LN]}function Z8({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:o,suggestionOpenRef:l,children:a}){const c=P.useRef(o),d=P.useRef(e),u=P.useRef(n),h=P.useRef(i),f=Lf({extensions:DR(h),content:t||"",editorProps:{attributes:{"data-chat-input":"true",role:"textbox","aria-multiline":"true","aria-label":i??X8,class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,p)=>p.key==="Enter"&&!p.shiftKey&&u.current&&!l?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return P.useEffect(()=>{f?.setEditable(!s)},[f,s]),P.useEffect(()=>{c.current=o},[o]),P.useEffect(()=>{d.current=e},[e]),P.useEffect(()=>{u.current=n},[n]),P.useEffect(()=>{h.current=i},[i]),P.useEffect(()=>{if(!f||f.isDestroyed)return;const m=JSON.stringify(f.getJSON()),p=JSON.stringify(t||{type:"doc",content:[]});m!==p&&f.commands.setContent(t||{type:"doc",content:[]})},[f,t]),r.jsx(yN.Provider,{value:{editor:f},children:a})}function e7(t){const e=z.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:o,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,u=s===void 0?!1:s,h=i===void 0?!1:i,{editor:f}=Au();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const N=f.state.doc.textContent.trim()==="";f.commands.focus("end"),N||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,N)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),N)){f.commands.focus("end");const T=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:T?" "+N:N})}},restoreContent:j=>{f&&f.commands.setContent(j||{type:"doc",content:[]})}}),p=[f],e[0]=f,e[1]=m,e[2]=p):(m=e[1],p=e[2]),P.useImperativeHandle(c??null,m,p),!f)return null;const g=u&&"cursor-not-allowed opacity-70",x=u&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=ie("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.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","[&_.ProseMirror_p.is-editor-empty:first-child::before]:w-full","[&_.ProseMirror_p.is-editor-empty:first-child::before]:break-words",g,x),e[3]=d,e[4]=g,e[5]=x,e[6]=b):b=e[6];let v;e[7]!==f||e[8]!==b?(v=r.jsx(Sf,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const L=n??null;let _;e[10]!==f||e[11]!==a||e[12]!==L?(_=r.jsx(P.Suspense,{fallback:null,children:r.jsx(AR,{editor:f,virtualMcpId:L,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=L,e[13]=_):_=e[13];const y=n??null;let S;e[14]!==f||e[15]!==a||e[16]!==y?(S=r.jsx(P.Suspense,{fallback:null,children:r.jsx(wR,{editor:f,virtualMcpId:y,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=y,e[17]=S):S=e[17];let k;e[18]!==u||e[19]!==f||e[20]!==l||e[21]!==o||e[22]!==h?(k=h&&o&&!u?r.jsx(aD,{editor:f,selectedModel:o,onUnsupportedFile:l}):null,e[18]=u,e[19]=f,e[20]=l,e[21]=o,e[22]=h,e[23]=k):k=e[23];let w;return e[24]!==_||e[25]!==S||e[26]!==k||e[27]!==v?(w=r.jsxs(r.Fragment,{children:[v,_,S,k]}),e[24]=_,e[25]=S,e[26]=k,e[27]=v,e[28]=w):w=e[28],w}function t7(t){const e=z.c(3),[s]=Ti();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&tA(t.dataUri).catch(o=>{console.warn(`[sound] ${t.name} playback failed:`,o)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const RR={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"},IR=pT.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),MR=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function $R(){const t=z.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:MR.map(OR)}),t[0]=e):e=t[0],e}function OR(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 BR({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:o}){const l=re(),[a,c]=P.useState(!1),d=t7(RR),{org:u}=Fe(),{editor:h}=Au(),f=P.useRef(null),m=Df(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async W=>{const G=W.target.files;if(!G||G.length===0||!h)return;const Y=Array.from(G);try{let ee=h.state.selection.from;for(const ne of Y)await X2(h,n??null,ne,ee,o,l),ee=h.state.selection.to}finally{f.current&&(f.current.value="")}},x=Gt({connectionId:s,orgId:u.id,orgSlug:u.slug}),b=Qe.virtualMcpPrompts(s,u.id),{data:v,isLoading:L}=Pt({queryKey:b,queryFn:()=>im(x),staleTime:6e4,enabled:a&&!!x}),_=v?.prompts??[],[y,S]=P.useState(null),{chatMode:k,setChatMode:w}=Il(),[j,N]=Ti(),T=ul.find(W=>W.value===j.toolApprovalLevel)??ul[0],C=l(T.shortKey),V=W=>{const G=ul.find(Y=>Y.value===W);if(G){if(G.value===j.toolApprovalLevel){c(!1);return}d(),Je("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:G.value,source:"tools_popover"}),N({...j,toolApprovalLevel:G.value}),c(!1)}},A=k==="plan",E=()=>{d();const W=A?"default":"plan";Je("chat_mode_changed",{from_mode:k,to_mode:W,source:"tools_popover"}),w(W),c(!1)},D=()=>{e(),c(!1)},I=async(W,G)=>{if(!h||!x)return;const Y=er(W._meta),ee={from:h.state.selection.from,to:h.state.selection.to};try{const ne=await Pu(x,W.name,G);wc(h,ee,{id:W.name,name:Bc(W.name,Y),metadata:ne.messages,char:"/",kind:"prompt",args:G})}catch{ge.error(l("chat.toolsPopover.failedLoadPrompt"))}},R=async W=>{c(!1);const G=!!(W.arguments&&W.arguments.length>0);if(Je("chat_prompt_inserted",{prompt_name:W.name,with_arguments:G}),G){S(W);return}await I(W)},$=async W=>{y&&(await I(y,W),S(null))},B=()=>{d();const W=k==="gen-image"?"default":"gen-image";Je("chat_mode_changed",{from_mode:k,to_mode:W,source:"tools_popover"}),w(W),c(!1)},M=()=>{d();const W=k==="web-search"?"default":"web-search";Je("chat_mode_changed",{from_mode:k,to_mode:W,source:"tools_popover"}),w(W),c(!1)},O=()=>{d();const W=k==="deep-research"?"default":"deep-research";Je("chat_mode_changed",{from_mode:k,to_mode:W,source:"tools_popover"}),w(W),c(!1)},F=k==="gen-image",U=k==="web-search",K=k==="deep-research",q=r.jsx("input",{ref:f,type:"file",multiple:!0,accept:PV(n??null),className:"hidden",onChange:g,disabled:i});return r.jsxs(r.Fragment,{children:[q,r.jsxs(Xt,{open:a,onOpenChange:W=>{W&&!a&&Je("chat_tools_popover_opened",{chat_mode:k}),c(W)},children:[r.jsx(Zt,{asChild:!0,children:r.jsxs(he,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[r.jsx(n6,{size:14}),r.jsx("span",{className:ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:l("chat.toolsPopover.tools")})]})}),r.jsxs(es,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?r.jsxs(Xe,{onClick:p,disabled:i,children:[r.jsx(Ht,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsxs(Xe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:W=>W.preventDefault(),children:[r.jsx(Ht,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),r.jsx(Ke,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),r.jsxs(Xe,{onClick:E,className:ie(A&&"text-special"),children:[r.jsx(kc,{size:16,className:ie(A&&"text-special")}),r.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),r.jsx("span",{className:ie("text-xs text-muted-foreground",A&&"text-special font-medium"),children:IR})]}),r.jsxs(Xe,{onClick:B,className:ie(F&&"text-special"),children:[r.jsx(_i,{size:16,className:ie(F&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),F&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Xe,{onClick:M,className:ie(U&&"text-special"),children:[r.jsx(Rr,{size:16,className:ie(U&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.webSearch")}),U&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Xe,{onClick:O,className:ie(K&&"text-special"),children:[r.jsx(i6,{size:16,className:ie(K&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.deepResearch")}),K&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Yi,{children:[r.jsxs(Ji,{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:l("chat.toolsPopover.prompts")})]}),r.jsx(Qi,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:L?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(lt,{size:14,className:"animate-spin"}),l("chat.toolsPopover.loadingPrompts")]}):_.length===0?r.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:l("chat.toolsPopover.noPromptsAvailable")}):_.map(W=>r.jsxs(Xe,{onClick:()=>R(W),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:W.title||Yp(W.name,er(W._meta))}),W.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:W.description})]},W.name))})]}),r.jsxs(Yi,{children:[r.jsxs(Ji,{className:"gap-2",children:[r.jsx(Vf,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:C})]}),r.jsx(Qi,{className:"w-48 p-1.5",children:r.jsx(cm,{value:j.toolApprovalLevel,onValueChange:V,children:ul.map(W=>r.jsx(fc,{value:W.value,children:l(W.labelKey)},W.value))})})]}),r.jsxs(Xe,{onClick:D,children:[r.jsx(l2,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),r.jsx(P.Suspense,{children:r.jsx($R,{})})]})]})]}),r.jsx(mu,{prompt:y,setPrompt:S,onSubmit:$})]})}const zR=[{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 FR(){const t=z.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:zR.map(UR)}),t[0]=e):e=t[0],e}function UR(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 HR(t){const e=z.c(10),{onClick:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ie("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("chat.connectionsBanner.description"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:o}),e[3]=o,e[4]=l):l=e[4];let a,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(FR,{}),c=r.jsx(nn,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=a,e[6]=c):(a=e[5],c=e[6]);let d;return e[7]!==s||e[8]!==l?(d=r.jsxs("button",{type:"button",onClick:s,className:i,children:[l,a,c]}),e[7]=s,e[8]=l,e[9]=d):d=e[9],d}const Dd=48;function KR(){const t=z.c(9),[e,s]=P.useState("idle"),[n,i]=P.useState(""),[o,l]=P.useState(""),[a,c]=P.useState(GR),d=P.useRef(null),u=P.useRef(null),h=P.useRef(null),f=P.useRef(null),m=P.useRef(0),p=P.useRef(!1),g=P.useRef(""),x=P.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let v;t[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),u.current?.close().catch(qR),f.current?.getTracks().forEach(WR),h.current=null,u.current=null,f.current=null},t[0]=v):v=t[0];const L=v;let _;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const T=C=>{f.current=C;const V=new AudioContext;u.current=V;const A=V.createMediaStreamSource(C),E=V.createAnalyser();E.fftSize=128,E.smoothingTimeConstant=.8,A.connect(E),h.current=E;const D=new Uint8Array(E.frequencyBinCount),I=()=>{if(!h.current)return;h.current.getByteFrequencyData(D);const R=[];for(let $=0;$<Dd;$++){const B=Math.floor($/Dd*D.length);R.push(Math.max(.04,(D[B]??0)/255))}c(R),m.current=requestAnimationFrame(I)};I()};_=async()=>{const C=window.SpeechRecognition||window.webkitSpeechRecognition;if(!C)return s("unsupported"),"unsupported";let V;try{V=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}i(""),l(""),x.current="",g.current="",p.current=!0,s("recording"),T(V);const A=new C;d.current=A,A.interimResults=!0,A.continuous=!0,A.lang=navigator.language||"en-US",A.onresult=E=>{if(d.current!==A)return;let D="",I="";for(let R=E.resultIndex;R<E.results.length;R++){const $=E.results[R],B=$?.[0]?.transcript??"";$?.isFinal?I=I+B:D=D+B}I&&(g.current=g.current+I,i(g.current)),x.current=D,l(D)},A.onerror=E=>{d.current===A&&E.error!=="no-speech"&&(p.current=!1,d.current=null,L(),s(E.error==="not-allowed"?"permission-denied":"idle"))},A.onend=()=>{if(d.current===A&&p.current)try{A.start()}catch{}};try{A.start()}catch{return p.current=!1,d.current=null,L(),s("idle"),"idle"}return"recording"},t[1]=_}else _=t[1];const y=_;let S;t[2]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{p.current=!1,d.current?.stop(),L(),s("idle"),c(Array(Dd).fill(.05)),l("");const T=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",T},t[2]=S):S=t[2];const k=S;let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p.current=!1,d.current?.abort(),L(),s("idle"),i(""),l(""),c(Array(Dd).fill(.05)),g.current="",x.current=""},t[3]=w):w=t[3];const j=w;let N;return t[4]!==o||t[5]!==e||t[6]!==n||t[7]!==a?(N={status:e,transcript:n,interimTranscript:o,waveformData:a,isSupported:b,startRecording:y,stopRecording:k,cancelRecording:j},t[4]=o,t[5]=e,t[6]=n,t[7]=a,t[8]=N):N=t[8],N}function WR(t){return t.stop()}function qR(){}function GR(){return Array(Dd).fill(.05)}function YR(t){const e=z.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(JR),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:n}),e[2]=n,e[3]=i):i=e[3],i}function JR(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)}function QR(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function b0(t){const e=z.c(7),{message:s,icon:n}=t;let i;e[0]!==n?(i=n??r.jsx(Vu,{size:14,className:"shrink-0"}),e[0]=n,e[1]=i):i=e[1];const o=s??"";let l;e[2]!==o?(l=r.jsx("span",{className:"text-sm",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=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:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function XR(t,e,s){const n=z.c(7),{editor:i}=Au(),o=re(),[l,a]=P.useState(!1),c=P.useRef(0);let d,u;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==o?(d=()=>{const h=g=>{g.dataTransfer?.types.includes("Files")&&(g.preventDefault(),c.current=c.current+1,a(!0))},f=g=>{g.preventDefault(),c.current=Math.max(0,c.current-1),c.current===0&&a(!1)},m=ZR,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!Df(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let v=i.state.selection.from;for(const L of b)await X2(i,t,L,v,e,o),v=i.state.selection.to})()};return window.addEventListener("dragenter",h),window.addEventListener("dragleave",f),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",h),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},u=[i,t,e,o,s],n[0]=s,n[1]=i,n[2]=e,n[3]=t,n[4]=o,n[5]=d,n[6]=u):(d=n[5],u=n[6]),P.useEffect(d,u),l}function ZR(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function eI(t){const e=z.c(14),{selectedModel:s}=t,n=re();let i,o,l;if(e[0]!==s||e[1]!==n){const{parts:d}=_6(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Yn,{size:24}),e[5]=l):l=e[5],i="text-sm font-medium";let u;e[6]!==n?(u=h=>n(h),e[6]=n,e[7]=u):u=e[7],o=n("chat.input.dropFilesHere",{fileTypes:d.map(u).join(", ")}),e[0]=s,e[1]=n,e[2]=i,e[3]=o,e[4]=l}else i=e[2],o=e[3],l=e[4];let a;e[8]!==i||e[9]!==o?(a=r.jsx("span",{className:i,children:o}),e[8]=i,e[9]=o,e[10]=a):a=e[10];let c;return e[11]!==l||e[12]!==a?(c=r.jsxs(r.Fragment,{children:[l,a]}),e[11]=l,e[12]=a,e[13]=c):c=e[13],c}function tI(){const t=z.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Vu,{size:24}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=r.jsxs(r.Fragment,{children:[s,r.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function sI(t){const e=z.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,o=XR(s,n,i);let l;e[0]!==s?(l=Df(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o?"opacity-100":"opacity-0 pointer-events-none",d=a?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let u;e[2]!==c||e[3]!==d?(u=ie("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=u):u=e[4];let h;e[5]!==s||e[6]!==a?(h=a?r.jsx(eI,{selectedModel:s}):r.jsx(tI,{}),e[5]=s,e[6]=a,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function v0(t){const e=z.c(14),{onClick:s,label:n,icon:i,colorClass:o,maxWidthClass:l}=t;let a;e[0]!==o?(a=ie("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",o),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==l?(c=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",l),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==n||e[5]!==c?(d=r.jsx("span",{className:c,children:n}),e[4]=n,e[5]=c,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(Is,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=u):u=e[7];let h;return e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==a||e[12]!==d?(h=r.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:a,children:[i,d,u]}),e[8]=i,e[9]=n,e[10]=s,e[11]=a,e[12]=d,e[13]=h):h=e[13],h}function nI(){const t=z.c(6),e=Yt(),{org:s,locator:n}=Fe(),{create:i}=zc();let o;return t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(o=async l=>{const{tiptapDoc:a,virtualMcp:c}=l,d=crypto.randomUUID(),u=c?.id??Uo(s.id).id;qy(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:u})}catch{}const h={virtualmcpid:u,autosend:vT};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:h})},t[0]=i,t[1]=n,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=o):o=t[5],o}function iI({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=re(),n=Gp(),i=Ts(),o=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",u=d||eE,h=nI(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:L,setChatMode:_}=Il(),{data:y}=In.useSession(),S=y?.user?.id,{org:k,locator:w}=Fe(),j=Uo(k.id).id,N=Ms(m?.id),T=Cn(N?.id).runtime==="cms",C=t7(sA),[V,A]=P.useState(!1),{unsupportedFile:E,onUnsupportedFile:D,clearUnsupportedFile:I}=fD(),R=KR(),$=P.useRef(void 0),B=async()=>{$.current=ne;const _e=await R.startRecording();Je("chat_voice_started",{thread_id:d,outcome:_e==="recording"?"started":_e==="unsupported"?"unsupported":_e==="permission-denied"?"permission_denied":"unknown"})},M=()=>{Je("chat_voice_confirmed",{thread_id:d});const _e=R.stopRecording();Q.current?.syncVoiceText($.current,_e),Q.current?.focus()},O=()=>{Je("chat_voice_cancelled",{thread_id:d}),R.cancelRecording(),Q.current?.restoreContent($.current)};P.useEffect(()=>{if(R.status!=="recording")return;const _e=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();Q.current?.syncVoiceText($.current,_e)},[R.transcript,R.interimTranscript,R.status]);const F=i?.activeTask??null,U=F?.created_by,K=!!(S&&U&&U!==S),{data:q}=P6({enabled:K}),W=(q?.data?.members??[]).find(_e=>_e.userId===U),G=W?.user?.name??W?.user?.email?.split("@")[0]??null,Y=qc(),ee=Vy({isDesktopApp:Y,harnessId:F?.harness_id}),[ne,oe]=P.useState(()=>Nx(sessionStorage,w,u)??void 0),Z=_e=>{oe(_e),g.current=_e,w8(sessionStorage,w,u,_e,{onQuotaExceeded:({docSizeBytes:Pe})=>{Je("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:Pe}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},J=P.useRef(d);if(J.current!==d){J.current=d;const _e=Nx(sessionStorage,w,u)??void 0;oe(_e),g.current=_e}const se=[...o].reverse().find(_e=>_e.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,Q=P.useRef(null),ce=P.useRef(!1),te=L==="plan",le=_e=>{C(),Je("chat_mode_changed",{from_mode:_e,to_mode:"default",source:"pill_dismiss"}),_("default")};P.useEffect(()=>{const _e=Pe=>{Ky(Pe)&&Pe.code==="KeyL"&&(Pe.preventDefault(),Pe.shiftKey&&_(L==="plan"?"default":"plan"),Q.current?.focus())};return document.addEventListener("keydown",_e),()=>document.removeEventListener("keydown",_e)},[L,_]);const ue=Ey(o),ae=[...o].reverse().find(_e=>_e.role==="assistant"&&_e.metadata?.usage)?.metadata?.usage?.contextTokens??0,de=!p&&!L8(ne),X=QR({hasDraft:de,isStreaming:l,isRunInProgress:a}),pe=X==="send",ye=X==="stop",we=_e=>{if(_e?.preventDefault(),X==="send"&&ne){if(Je("chat_message_sent",{thread_id:d||null,mode:L,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:_e?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){ge.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(ne)}else h({tiptapDoc:ne,virtualMcp:m});sE(sessionStorage,w,u),Z(void 0)}else X==="stop"&&(Je("chat_message_stopped",{thread_id:d}),c())};if(K)return r.jsx(b0,{message:G?s("chat.input.readOnlyOthersChatNamed",{name:G}):s("chat.input.readOnlyOthersChat"),icon:G?r.jsx(Bs,{shape:"circle",size:"2xs",url:W?.user?.image??void 0,fallback:G.slice(0,2).toUpperCase()}):void 0});if(F?.metadata?.read_only)return r.jsx(b0,{message:s("chat.input.readOnlyThread")});if(ee)return r.jsx(b0,{message:s("chat.input.codingAgentRequiresDesktop")});if(T){if(!i)return r.jsx(b0,{message:s("chat.input.fastPreviewUnavailable")});const _e=()=>{const Pe=i.createTask({runtime:"sandbox"});Je("coding_session_started",{thread_id:Pe})};return r.jsxs("button",{type:"button",onClick:_e,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[r.jsx(qo,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.fastPreview.startCodingSession")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.fastPreview.chatNeedsSession")})]}),r.jsx(Wo,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return 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"}),n&&i&&r.jsx(Wf,{}),n&&i&&d?r.jsx(JE,{taskId:d}):null,r.jsx(Z8,{tiptapDoc:ne,setTiptapDoc:Z,disabled:R.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:we,suggestionOpenRef:ce,children:r.jsxs("form",{onSubmit:we,className:ie("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[r.jsx(sI,{selectedModel:f,onUnsupportedFile:D,disabled:R.status==="recording"}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(e7,{ref:Q,disabled:R.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:D,suggestionOpenRef:ce})}),r.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:R.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(YR,{data:R.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:O,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":s("chat.input.cancelRecording"),children:r.jsx(Is,{size:16})}),r.jsx("button",{type:"button",onClick:M,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":s("chat.input.useTranscription"),children:r.jsx(qt,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(BR,{disabled:!1,onOpenConnections:()=>{Je("connections_dialog_opened",{source:"tools_popover",mode:"add"}),A(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:D}),te&&r.jsx(v0,{onClick:()=>le("plan"),label:s("chat.input.planMode"),icon:r.jsx(kc,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),L==="gen-image"&&x&&r.jsx(v0,{onClick:()=>le("gen-image"),label:s("chat.input.createImage"),icon:r.jsx(_i,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),L==="web-search"&&b&&r.jsx(v0,{onClick:()=>le("web-search"),label:s("chat.input.webSearch"),icon:r.jsx(Rr,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),L==="deep-research"&&v&&r.jsx(v0,{onClick:()=>le("deep-research"),label:s("chat.input.deepResearch"),icon:r.jsx(i6,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),se&&ae>0&&r.jsx(wN,{usage:ue,totalTokens:ae,contextWindow:se,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(lD,{}),R.isSupported&&r.jsx(he,{type:"button",onClick:B,disabled:!1,variant:"ghost",size:"icon",className:ie("size-8 rounded-lg transition-colors",R.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:R.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":R.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:r.jsx(RT,{size:18})}),r.jsx(he,{type:ye?"button":"submit",onClick:_e=>{ye&&(_e.preventDefault(),_e.stopPropagation(),c())},variant:pe||ye?"default":"ghost",size:"icon",disabled:!pe&&!ye,className:ie("size-8 rounded-lg transition-all",!pe&&!ye&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(X==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(X==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:ye?r.jsx(IT,{size:20}):r.jsx(bf,{size:20})})]})]})})]})},d),e&&r.jsx(HR,{onClick:()=>{Je("connections_banner_clicked",{source:"home_chat_input"}),Je("connections_dialog_opened",{source:"home_banner",mode:"add"}),A(!0)}})]})}),r.jsx(L2,{mode:"browse",open:V,onOpenChange:A,defaultTab:"all"}),r.jsx(uD,{info:E,onClose:I})]})}function rI(t){let e=0;for(const s of t)for(const n of s.parts??[]){const i=n;i.type==="tool-load_repo"&&i.state==="output-available"&&i.output?.success===!0&&e++}return e}function oI(){const t=z.c(8),e=Yt(),s=s2(),n=Gp()?.messages??[],i=Ts()?.taskId??null;let o;t[0]!==n?(o=rI(n),t[0]=n,t[1]=o):o=t[1];const l=o,a=P.useRef(null),c=P.useRef(null);let d,u;t[2]!==l||t[3]!==s||t[4]!==e||t[5]!==i?(d=()=>{if(!l||!i)return;const h=`${i}:${l}`;c.current!==h&&(c.current=h,s?.refreshThreadMetadata(i)),a.current!==i&&(a.current=i,e({to:".",search:lI,replace:!0}))},u=[l,i,e,s],t[2]=l,t[3]=s,t[4]=e,t[5]=i,t[6]=d,t[7]=u):(d=t[6],u=t[7]),P.useEffect(d,u)}function lI(t){return{...t,main:"preview"}}const aI={usd:[{dollars:10,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:20,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.bestValueLabel"}],brl:[{dollars:50,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:500,labelKey:"chat.creditsEmptyState.bestValueLabel"}]};function s7(t){return`deco-credits-empty-dismissed:${t}`}function cI(t){try{return localStorage.getItem(s7(t))==="1"}catch{return!1}}function dI(){const t=z.c(68),e=re(),{org:s}=Fe(),n=Yt(),{decoKeyId:i}=_2(),o=ys(),[l,a]=P.useState(!0),[c,d]=P.useState(""),[u,h]=P.useState(!1),[f,m]=P.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{Je("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(s7(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,v;t[2]!==l||t[3]!==s.id?(b=()=>{l&&Je("credits_empty_state_shown",{organization_id:s.id})},v=[l,s.id],t[2]=l,t[3]=s.id,t[4]=b,t[5]=v):(b=t[4],v=t[5]),P.useEffect(b,v);let L;t[6]!==f||t[7]!==o?(L=async Y=>{const{url:ee}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:Y,currency:f});return ee},t[6]=f,t[7]=o,t[8]=L):L=t[8];let _;t[9]!==x?(_=Y=>{Y&&window.open(Y,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=_):_=t[10];let y;t[11]!==e?(y=Y=>{ge.error(e("chat.creditsEmptyState.topUpFailed",{message:Y.message}))},t[11]=e,t[12]=y):y=t[12];let S;t[13]!==L||t[14]!==_||t[15]!==y?(S={mutationFn:L,onSuccess:_,onError:y},t[13]=L,t[14]=_,t[15]=y,t[16]=S):S=t[16];const{mutate:k,isPending:w}=Rs(S),j=parseFloat(c),N=!isNaN(j)&&j>=1;if(!l)return null;let T;t[17]!==x?(T=Y=>!Y&&x(),t[17]=x,t[18]=T):T=t[18];let C;t[19]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=C):C=t[19];let V;t[20]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(r6,{size:20,className:"text-warning"})}),t[20]=V):V=t[20];let A;t[21]!==e?(A=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=A):A=t[22];let E;t[23]!==A?(E=r.jsx(Kt,{className:"text-lg font-semibold",children:A}),t[23]=A,t[24]=E):E=t[24];let D;t[25]!==e?(D=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=D):D=t[26];let I;t[27]!==D?(I=r.jsx(kn,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:D}),t[27]=D,t[28]=I):I=t[28];let R;t[29]!==E||t[30]!==I?(R=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[C,r.jsxs(os,{className:"relative gap-3",children:[V,r.jsxs("div",{className:"text-center",children:[E,I]})]})]}),t[29]=E,t[30]=I,t[31]=R):R=t[31];let $;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==N||t[38]!==w||t[39]!==u||t[40]!==e||t[41]!==k?($=i&&r.jsxs("div",{className:"px-6 pb-5",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(Ef,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:Y=>{Y&&m(Y)},children:[r.jsx(Cc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Cc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:aI[f].map(Y=>{const{dollars:ee,labelKey:ne}=Y;return r.jsxs("button",{type:"button",disabled:w,onClick:()=>{Je("credits_topup_clicked",{amount_cents:ee*100,currency:f,tier_label:ne,source:"empty_state"}),k(ee*100)},className:ie("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,ee]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e(ne)})]},ee)})}),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(gt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:Y=>d(Y.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(he,{className:"h-10",disabled:!N||w,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),k(Math.round(j*100))},children:e(w?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.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:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=f,t[33]=p,t[34]=c,t[35]=j,t[36]=i,t[37]=N,t[38]=w,t[39]=u,t[40]=e,t[41]=k,t[42]=$):$=t[42];let B;t[43]!==x||t[44]!==n||t[45]!==s.slug?(B=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=B):B=t[46];let M;t[47]!==e?(M=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=M):M=t[48];let O;t[49]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(Wo,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=O):O=t[49];let F;t[50]!==B||t[51]!==M?(F=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:B,children:[M,O]}),t[50]=B,t[51]=M,t[52]=F):F=t[52];let U;t[53]!==e?(U=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=U):U=t[54];let K;t[55]!==x||t[56]!==U?(K=r.jsx(he,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:U}),t[55]=x,t[56]=U,t[57]=K):K=t[57];let q;t[58]!==F||t[59]!==K?(q=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,K]}),t[58]=F,t[59]=K,t[60]=q):q=t[60];let W;t[61]!==R||t[62]!==$||t[63]!==q?(W=r.jsxs(Bt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:uI,children:[R,$,q]}),t[61]=R,t[62]=$,t[63]=q,t[64]=W):W=t[64];let G;return t[65]!==W||t[66]!==T?(G=r.jsx(zt,{open:!0,onOpenChange:T,children:W}),t[65]=W,t[66]=T,t[67]=G):G=t[67],G}function uI(t){return t.preventDefault()}function hI(t){const e=z.c(6),{balanceDollars:s}=t;let n;e[0]!==s?(n=s.toFixed(2),e[0]=s,e[1]=n):n=e[1];const i=n;let o,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=r.jsx(r6,{size:13,className:"text-success"}),e[2]=o,e[3]=l):(o=e[2],l=e[3]);let a;return e[4]!==i?(a=r.jsxs("div",{className:o,children:[l,r.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",i," in credits to get started"]})]}),e[4]=i,e[5]=a):a=e[5],a}function fI(){const t=z.c(8),{org:e}=Fe(),s=Yt();let n;t[0]!==s||t[1]!==e.slug?(n=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=n):n=t[2];let i,o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),o=r.jsx(bn,{size:13,className:"text-warning"}),l=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=i,t[4]=o,t[5]=l):(i=t[3],o=t[4],l=t[5]);let a;return t[6]!==n?(a=r.jsxs("button",{type:"button",onClick:n,className:i,children:[o,l]}),t[6]=n,t[7]=a):a=t[7],a}function mI(t){const e=z.c(11),{className:s}=t;let n;e[0]!==s?(n=ie("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex items-center gap-3",children:[i,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 l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=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]=l):l=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=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(y0,{align:"right",width:"w-3/4"}),r.jsx(y0,{align:"left",width:"w-full",lines:3}),r.jsx(y0,{align:"right",width:"w-2/3"}),r.jsx(y0,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=a):a=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]!==n?(h=r.jsxs("div",{className:n,children:[l,a,u]}),e[9]=n,e[10]=h):h=e[10],h}function y0(t){const e=z.c(22),{align:s,width:n,lines:i}=t,o=n===void 0?"w-full":n,l=i===void 0?1:i,a=s==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==a?(c=ie("flex w-full gap-4 px-4 py-2",a),e[0]=a,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=ie("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=ie("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]!==l?(p=Array.from({length:l}),e[8]=l,e[9]=p):p=e[9];let g;e[10]!==l||e[11]!==p?(g=r.jsx("div",{className:"space-y-2",children:p.map((L,_)=>r.jsx("div",{className:ie("h-3 rounded bg-muted-foreground/20 animate-pulse",_===l-1?"w-3/4":"w-full"),style:{animationDelay:`${_*.1}s`}},_))}),e[10]=l,e[11]=p,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==m?(x=r.jsx("div",{className:m,children:g}),e[13]=g,e[14]=m,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==u?(b=r.jsxs("div",{className:u,children:[h,x]}),e[16]=x,e[17]=u,e[18]=b):b=e[18];let v;return e[19]!==b||e[20]!==c?(v=r.jsx("div",{className:c,children:b}),e[19]=b,e[20]=c,e[21]=v):v=e[21],v}function pI(t){const e=z.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:i,isFetchingOlder:o,fetchOlderMessages:l}=t;let a,c;e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==s||e[4]!==n?(a=()=>{const d=n.current,u=s.current;if(!d||!u||!i)return;const h=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||o||!i)return;const p=u.scrollHeight,g=u.scrollTop;await l(),requestAnimationFrame(()=>{const x=u.scrollHeight;u.scrollTop=g+(x-p)})},{root:u,rootMargin:"200px 0px 0px 0px"});return h.observe(d),()=>h.disconnect()},c=[s,n,i,o,l],e[0]=l,e[1]=i,e[2]=o,e[3]=s,e[4]=n,e[5]=a,e[6]=c):(a=e[5],c=e[6]),P.useEffect(a,c)}function gI(t){const e=z.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=ie("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=r.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function xI(t){const e=z.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}function bI(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:s}),e[0]=s,e[1]=n):n=e[1],n}function vI(){const t=re(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o}=ui(),{taskId:l}=un();oI();const a=Ty(l??""),c=oN(a),d=c.size===0?e:e.filter(v=>!c.has(v.id)),u=SN(d),h=u.at(-1),m=ZP()*OP+16,p=P.useRef(null),g=P.useRef(null);pI({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o});const x=kN({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return r.jsx(jN,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:m},children:r.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),i&&r.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),u.slice(0,-1).map((v,L)=>r.jsx(hx,{pair:v,isLastPair:!1,status:L===u.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),h&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(hx,{pair:h,isLastPair:!0,status:s},`pair-${h.user?.id??h.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(he,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 rounded-full shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:m+8},onClick:()=>{x.scrollToBottom()},children:r.jsx(JC,{size:14})})]})})}function yI(t){const e=z.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}const hs=Object.assign(gI,{Main:xI,Messages:vI,EmptyState:bI,Footer:yI,Input:iI,Provider:rN,ActiveTaskProvider:iN,Skeleton:mI,IceBreakers:$P,NoAiProviderEmptyState:EV,CreditsEmptyState:dI,CreditsEyebrow:hI,NoCreditsEyebrow:fI,CreditsExhaustedBanner:E8});function _I({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function LI(){const t=z.c(3),e=If(),n=Ts()?.isThreadLocked??!1,i=e.length>0;let o;return t[0]!==n||t[1]!==i?(o=_I({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=o):o=t[2],o}function md(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function t1(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 wI(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function SI(t){const e=z.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(kI),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:n}),e[2]=n,e[3]=i):i=e[3],i}function kI(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 jI(t){const e=z.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,o=re(),l=s+n+i,a=l>0?s/l*100:0,c=l>0?n/l*100:0,d=l>0?i/l*100:0;let u;e[0]!==a?(u=a>0&&r.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==c?(h=c>0&&r.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=h):h=e[3];let f;e[4]!==d?(f=d>0&&r.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${d}%`}}),e[4]=d,e[5]=f):f=e[5];let m;e[6]!==u||e[7]!==h||e[8]!==f?(m=r.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[u,h,f]}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=p):p=e[10];let g;e[11]!==o||e[12]!==a?(g=o("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=o,e[12]=a,e[13]=g):g=e[13];let x;e[14]!==g?(x=r.jsxs("div",{className:"flex items-center gap-1.5",children:[p,r.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e[14]=g,e[15]=x):x=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let v;e[17]!==c||e[18]!==o?(v=o("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=o,e[19]=v):v=e[19];let L;e[20]!==v?(L=r.jsxs("div",{className:"flex items-center gap-1.5",children:[b,r.jsx("span",{className:"text-xs text-muted-foreground",children:v})]}),e[20]=v,e[21]=L):L=e[21];let _;e[22]!==d||e[23]!==i||e[24]!==o?(_=i>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.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=i,e[24]=o,e[25]=_):_=e[25];let y;e[26]!==L||e[27]!==_||e[28]!==x?(y=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,L,_]}),e[26]=L,e[27]=_,e[28]=x,e[29]=y):y=e[29];let S;return e[30]!==y||e[31]!==m?(S=r.jsxs("div",{className:"flex flex-col gap-2",children:[m,y]}),e[30]=y,e[31]=m,e[32]=S):S=e[32],S}function CI(t){const e=z.c(14),{agentId:s,isError:n}=t,i=Ms(s),o=re();let l;e[0]!==i?.title||e[1]!==o?(l=i?.title??o("chat.subtask.subtaskNoun"),e[0]=i?.title,e[1]=o,e[2]=l):l=e[2];const a=l,c=i?.icon??null;let d;e[3]!==c||e[4]!==a?(d=r.jsx(Ai,{icon:c,name:a,size:"xs",className:"size-6 rounded-md shrink-0"}),e[3]=c,e[4]=a,e[5]=d):d=e[5];const u=n?"text-destructive":"text-foreground";let h;e[6]!==u?(h=ie("shrink-0 font-medium",u),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==a||e[9]!==h?(f=r.jsx("span",{className:h,children:a}),e[8]=a,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==d||e[12]!==f?(m=r.jsxs(r.Fragment,{children:[d,f]}),e[11]=d,e[12]=f,e[13]=m):m=e[13],m}function NI(t){const e=z.c(12),{isError:s}=t,n=re();let i;e[0]!==n?(i=n("chat.contextPanel.subtask"),e[0]=n,e[1]=i):i=e[1];const o=i;let l;e[2]!==o?(l=r.jsx(Ai,{icon:null,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=o,e[3]=l):l=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=ie("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==o||e[7]!==c?(d=r.jsx("span",{className:c,children:o}),e[6]=o,e[7]=c,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==d?(u=r.jsxs(r.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u}function TI(t){const e=z.c(18),{part:s}=t,n=s.input?.agent_id,i=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",l=s.state==="approval-requested";let a;e[0]!==o?(a=r.jsx(NI,{isError:o}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?(c=r.jsx(CI,{agentId:n,isError:o}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let d;e[5]!==a||e[6]!==c?(d=r.jsx(P.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==s.input?(u=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]=u):u=e[9];let h;e[10]!==l||e[11]!==o||e[12]!==i?(h=r.jsx("span",{className:"ml-auto shrink-0",children:i?r.jsx(lt,{size:12,className:"animate-spin text-muted-foreground"}):o?r.jsx(DT,{size:12,className:"text-destructive"}):l?r.jsx(bn,{size:12,className:"text-warning"}):r.jsx(hi,{size:12,className:"text-success"})}),e[10]=l,e[11]=o,e[12]=i,e[13]=h):h=e[13];let f;return e[14]!==d||e[15]!==u||e[16]!==h?(f=r.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,u,h]}),e[14]=d,e[15]=u,e[16]=h,e[17]=f):f=e[17],f}function VI(t){const e=z.c(78),{onClose:s,back:n,className:i}=t,o=re(),[l,a]=P.useState(null),{messages:c}=ui(),{activeTask:d}=un(),{selectedModel:u,selectedVirtualMcp:h}=Il();let f,m,p,g,x,b,v,L;if(e[0]!==d||e[1]!==n||e[2]!==i||e[3]!==c||e[4]!==s||e[5]!==l?.id||e[6]!==u||e[7]!==h?.title||e[8]!==o){L=Symbol.for("react.early_return_sentinel");e:{const S=Ey(c),k=[...c].reverse().find(zI),w=k?.metadata?.usage,j=k?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,N=w?.contextTokens??0,T=j&&j>0?(N/j*100).toFixed(1):null,C=c;let V;e[17]!==C?(V=C.filter(BI).reduce(OI,0),e[17]=C,e[18]=V):V=e[18];const A=V,E=c;let D;e[19]!==E?(D=E.filter($I).reduce(MI,0),e[19]=E,e[20]=D):D=e[20];const I=D,R=Math.max(0,S.totalTokens-A-I),$=c[0],B=c.at(-1),M=$?.metadata?.created_at??d?.created_at,O=B?.metadata?.created_at??d?.updated_at,F=c.filter(II),U=c.flatMap(DI),K=u?.modelId?wI(u.modelId):"—",q=h?.title??"Super Agent",W=[{label:o("chat.contextPanel.sessionLabel"),value:d?.title??o("chat.contextPanel.newChat")},{label:o("chat.contextPanel.messagesLabel"),value:F.length},{label:o("chat.contextPanel.agentLabel"),value:q},{label:o("chat.contextPanel.modelLabel"),value:K},{label:o("chat.contextPanel.contextLimitLabel"),value:j?md(j):"—"},{label:o("chat.contextPanel.sessionTokensLabel"),value:S.totalTokens>0?md(S.totalTokens):"0"},{label:o("chat.contextPanel.usageLabel"),value:T!==null?`${T}%`:"—"},{label:o("chat.contextPanel.inputTokensLabel"),value:S.inputTokens>0?md(S.inputTokens):"0"},{label:o("chat.contextPanel.outputTokensLabel"),value:S.outputTokens>0?md(S.outputTokens):"0"},{label:o("chat.contextPanel.reasoningTokensLabel"),value:S.reasoningTokens>0?md(S.reasoningTokens):"0"},{label:o("chat.contextPanel.costLabel"),value:S.cost>0?`$${S.cost<.001?S.cost.toFixed(6):S.cost.toFixed(4)}`:"$0.00"},{label:o("chat.contextPanel.sessionCreatedLabel"),value:t1(M)},{label:o("chat.contextPanel.lastActivityLabel"),value:t1(O)}];if(!d&&F.length===0){let H;e[21]!==i?(H=ie("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=H):H=e[22];let se;e[23]!==o?(se=o("chat.contextPanel.title"),e[23]=o,e[24]=se):se=e[24];let Q;e[25]!==se?(Q=r.jsx("span",{className:"text-sm font-medium text-foreground",children:se}),e[25]=se,e[26]=Q):Q=e[26];let ce;e[27]!==n?(ce=n?r.jsx(rm,{size:14,className:"text-muted-foreground"}):r.jsx(Li,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=ce):ce=e[28];let te;e[29]!==s||e[30]!==ce?(te=r.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ce}),e[29]=s,e[30]=ce,e[31]=te):te=e[31];let le;e[32]!==Q||e[33]!==te?(le=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[Q,te]}),e[32]=Q,e[33]=te,e[34]=le):le=e[34];let ue;e[35]!==o?(ue=o("chat.contextPanel.emptyState"),e[35]=o,e[36]=ue):ue=e[36];let fe;e[37]!==ue?(fe=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:ue})}),e[37]=ue,e[38]=fe):fe=e[38];let ae;e[39]!==H||e[40]!==le||e[41]!==fe?(ae=r.jsxs("div",{className:H,children:[le,fe]}),e[39]=H,e[40]=le,e[41]=fe,e[42]=ae):ae=e[42],L=ae;break e}e[43]!==i?(b=ie("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",i),e[43]=i,e[44]=b):b=e[44];let G;e[45]!==o?(G=o("chat.contextPanel.title"),e[45]=o,e[46]=G):G=e[46];let Y;e[47]!==G?(Y=r.jsx("span",{className:"text-sm font-medium text-foreground",children:G}),e[47]=G,e[48]=Y):Y=e[48];let ee;e[49]!==n?(ee=n?r.jsx(rm,{size:14}):r.jsx(Li,{size:14}),e[49]=n,e[50]=ee):ee=e[50];let ne;e[51]!==s||e[52]!==ee?(ne=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:ee}),e[51]=s,e[52]=ee,e[53]=ne):ne=e[53],e[54]!==Y||e[55]!==ne?(v=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[Y,ne]}),e[54]=Y,e[55]=ne,e[56]=v):v=e[56],f="flex flex-col gap-8 p-6",m=U.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.subtasksSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:U.map(EI)})]}),p=r.jsx(SI,{items:W});let oe;e[57]!==o?(oe=o("chat.contextPanel.contextBreakdownSection"),e[57]=o,e[58]=oe):oe=e[58];let Z;e[59]!==oe?(Z=r.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[59]=oe,e[60]=Z):Z=e[60];let J;e[61]!==I||e[62]!==R||e[63]!==A?(J=r.jsx(jI,{userTokens:A,assistantTokens:I,otherTokens:R}),e[61]=I,e[62]=R,e[63]=A,e[64]=J):J=e[64],e[65]!==Z||e[66]!==J?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[Z,J]}),e[65]=Z,e[66]=J,e[67]=g):g=e[67],x=F.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.rawMessagesSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:F.map(H=>{const se=H.metadata?.created_at,Q=l?.id===H.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(Q?null:H),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:ie("shrink-0 font-medium",H.role==="user"?"text-chart-1":"text-chart-2"),children:H.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:H.id})]}),se&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:t1(se)})]}),Q&&r.jsxs(r.Fragment,{children:[H.role==="assistant"&&(()=>{const ce=H.metadata?._request;if(!ce)return null;const te=ce.systemSections??[],le=Math.max(1,...te.map(PI)),ue=te.reduce(AI,0);return r.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-foreground",children:o("chat.contextPanel.requestLabel")}),r.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[ce.activeTools??0," / ",ce.tools??0," ",o("chat.contextPanel.toolsActive")]})]}),te.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"text-muted-foreground",children:[o("chat.contextPanel.systemPromptLabel")," ",r.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ue/4).toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),te.map((fe,ae)=>{const de=fe.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ae}`,X=fe.chars/le*100,pe=Math.round(fe.chars/4);return r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-mono text-foreground truncate",children:de}),r.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",pe.toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),r.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${X}%`}})})]},ae)})]})]})})(),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(H,null,2)})]})]},H.id)})})]})}e[0]=d,e[1]=n,e[2]=i,e[3]=c,e[4]=s,e[5]=l?.id,e[6]=u,e[7]=h?.title,e[8]=o,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=v,e[16]=L}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],L=e[16];if(L!==Symbol.for("react.early_return_sentinel"))return L;let _;e[68]!==f||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(_=r.jsxs("div",{className:f,children:[m,p,g,x]}),e[68]=f,e[69]=m,e[70]=p,e[71]=g,e[72]=x,e[73]=_):_=e[73];let y;return e[74]!==b||e[75]!==v||e[76]!==_?(y=r.jsxs("div",{className:b,children:[v,_]}),e[74]=b,e[75]=v,e[76]=_,e[77]=y):y=e[77],y}function AI(t,e){return t+e.chars}function PI(t){return t.chars}function EI(t,e){return r.jsx(TI,{part:t},e)}function DI(t){return(t.parts??[]).filter(RI)}function RI(t){return t.type==="tool-subtask"}function II(t){return t.role!=="system"}function MI(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function $I(t){return t.role==="assistant"}function OI(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function BI(t){return t.role==="user"}function zI(t){return t.role==="assistant"&&t.metadata?.usage}function FI(t){const e=z.c(21),{onOpenContextPanel:s}=t,{org:n}=Fe(),{selectedVirtualMcp:i}=Il();let o;e[0]!==n.id?(o=Uo(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=i??o,d=Ms(a.id)??a,u=d.title??"Super Agent",h=d.icon??null,f=d.description??null;let m;e[2]!==h||e[3]!==u?(m=r.jsx(ai,{icon:h,name:u,size:"lg"}),e[2]=h,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==u?(p=r.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:u}),e[5]=u,e[6]=p):p=e[6];let g;e[7]!==f?(g=f?r.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-balance",children:f}):null,e[7]=f,e[8]=g):g=e[8];let x;e[9]!==p||e[10]!==g?(x=r.jsxs("div",{className:"space-y-1.5",children:[p,g]}),e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==m||e[13]!==x?(b=r.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-4 px-6 text-center overflow-hidden",children:[m,x]}),e[12]=m,e[13]=x,e[14]=b):b=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(hs.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let L;e[16]!==s?(L=r.jsxs(hs.Footer,{children:[v,r.jsx(hs.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=L):L=e[17];let _;return e[18]!==b||e[19]!==L?(_=r.jsxs(r.Fragment,{children:[b,L]}),e[18]=b,e[19]=L,e[20]=_):_=e[20],_}function qx(t){const e=z.c(17),{outputs:s,collapsed:n,onToggle:i,variant:o}=t,l=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let a;e[0]!==l?(a=ie(l),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=c):c=e[2];const d=n&&"-rotate-90";let u;e[3]!==d?(u=ie("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==u?(h=r.jsx(_s,{className:u}),e[5]=u,e[6]=h):h=e[6];let f;e[7]!==i||e[8]!==h?(f=r.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[c,h]}),e[7]=i,e[8]=h,e[9]=f):f=e[9];let m;e[10]!==n||e[11]!==s?(m=!n&&r.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(UI)}),e[10]=n,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==a||e[14]!==f||e[15]!==m?(p=r.jsxs("div",{className:a,children:[f,m]}),e[13]=a,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function UI(t){return r.jsx(NN,{file:t},t.key)}function HI(){const t=z.c(13),e=Ts()?.taskId??null,s=CN();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=Dy(e,n),[o,l]=P.useState(!1),[a,c]=P.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(WI),t[2]=d):d=t[2];let u;t[3]!==o||t[4]!==i?(u=r.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:r.jsx(qx,{variant:"card",outputs:i,collapsed:o,onToggle:d})}),t[3]=o,t[4]=i,t[5]=u):u=t[5];let h;t[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(KI),t[6]=h):h=t[6];let f;t[7]!==a||t[8]!==i?(f=r.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:r.jsx(qx,{variant:"bar",outputs:i,collapsed:a,onToggle:h})}),t[7]=a,t[8]=i,t[9]=f):f=t[9];let m;return t[10]!==u||t[11]!==f?(m=r.jsxs(r.Fragment,{children:[u,f]}),t[10]=u,t[11]=f,t[12]=m):m=t[12],m}function KI(t){return!t}function WI(t){return!t}function qI(){const t=z.c(31),{org:e}=Fe(),s=Ts(),{isChatEmpty:n}=ui(),[i,o]=P.useState("chat"),l=_2(),a=LI(),{runtime:c}=Cn(s?.virtualMcpId);if(a&&c!=="cms"){let N;return t[0]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(hs,{className:"animate-in fade-in-0 duration-200",children:r.jsx(hs.Main,{className:"flex flex-col items-center",children:r.jsx(hs.EmptyState,{children:r.jsx(hs.NoAiProviderEmptyState,{})})})}),t[0]=N):N=t[0],N}let u;t[1]!==l.hasDecoKey||t[2]!==l.hasOnlyDecoProvider||t[3]!==l.isLoading||t[4]!==l.isZeroBalance||t[5]!==n||t[6]!==e?(u=l.hasDecoKey&&l.isZeroBalance&&l.hasOnlyDecoProvider&&!l.isLoading&&n&&!cI(e.id),t[1]=l.hasDecoKey,t[2]=l.hasOnlyDecoProvider,t[3]=l.isLoading,t[4]=l.isZeroBalance,t[5]=n,t[6]=e,t[7]=u):u=t[7];const h=u;let f;t[8]!==h?(f=h&&r.jsx(hs.CreditsEmptyState,{}),t[8]=h,t[9]=f):f=t[9];const m=i!=="chat"?!0:void 0,p=i!=="chat",g=i!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[10]!==g?(x=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",g),t[10]=g,t[11]=x):x=t[11];let b;t[12]!==n||t[13]!==c?(b=n&&c!=="cms"?r.jsx(FI,{onOpenContextPanel:()=>o("context")}):r.jsxs(r.Fragment,{children:[r.jsxs(hs.Main,{className:"relative flex flex-col overflow-hidden @container",children:[r.jsx(HI,{}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(hs.Messages,{})})]}),r.jsx(hs.Footer,{children:r.jsx(hs.Input,{onOpenContextPanel:()=>o("context")})})]}),t[12]=n,t[13]=c,t[14]=b):b=t[14];let v;t[15]!==m||t[16]!==p||t[17]!==x||t[18]!==b?(v=r.jsx("div",{inert:m,"aria-hidden":p,className:x,children:b}),t[15]=m,t[16]=p,t[17]=x,t[18]=b,t[19]=v):v=t[19];const L=i!=="context"?!0:void 0,_=i!=="context",y=i==="context"?"opacity-100":"opacity-0 pointer-events-none";let S;t[20]!==y?(S=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",y),t[20]=y,t[21]=S):S=t[21];let k;t[22]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(VI,{back:!0,onClose:()=>o("chat")}),t[22]=k):k=t[22];let w;t[23]!==S||t[24]!==L||t[25]!==_?(w=r.jsx("div",{inert:L,"aria-hidden":_,className:S,children:k}),t[23]=S,t[24]=L,t[25]=_,t[26]=w):w=t[26];let j;return t[27]!==f||t[28]!==w||t[29]!==v?(j=r.jsxs(hs,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[f,v,w]}),t[27]=f,t[28]=w,t[29]=v,t[30]=j):j=t[30],j}function n7(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(hs.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Ws,{fallback:e,children:r.jsx(P.Suspense,{fallback:r.jsx(hs.Skeleton,{}),children:r.jsx(qI,{})})}),t[1]=s):s=t[1],s}function GI(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function sg(t){return t?.name||t?.email?.split("@")[0]||void 0}function qf(t){const e=GI(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function YI(t,e,s){const n=await t.callTool({name:e,arguments:s});if(n.isError){const i=n.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(i)}return n}const i7=["SANDBOX_START"],_0=new Map,JI=t=>`${t.virtualMcpId}::${t.branch??""}`,QI=t=>t.message.includes("retry shortly"),s1=new Set,gm={mark:(t,e)=>s1.add(`${t}::${e}`),clear:(t,e)=>s1.delete(`${t}::${e}`),isStopped:(t,e)=>s1.has(`${t}::${e}`)};function r7(t,e){const s=as();return Rs({mutationKey:i7,retry:(n,i)=>QI(i)&&n<6,retryDelay:n=>Mu(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&gm.clear(n.virtualMcpId,n.branch);const i=JI(n),o=_0.get(i);if(o)return o;const l=(async()=>(await YI(t,"SANDBOX_START",n)).structuredContent)();_0.set(i,l);try{return await l}finally{_0.get(i)===l&&_0.delete(i)}},onSuccess:()=>{uu(s),e?.onStarted?.()}})}function XI(t,e){const s=z.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:i7,predicate:o=>{if(!t)return!1;const l=o.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],c8(n)>0}function Gx(t,e){return+(e.sidePanel!==null)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanel!==null:e.mainOpen}function ZI(t){return t.sidePanel!==null||t.mainOpen?t:{...t,sidePanel:"chat"}}function eM(t){const e=t.mainParamValue===0?"0":t.mainParamValue,s=t.entityMetadata?.defaultMainView??null,n=s==null||s.type==="chat",i=t.mainParamPresent?e!=="0":!n,o=n||t.entityMetadata?.chatDefaultOpen?"chat":null,l=t.sidePanelParamPresent?t.sidePanelParamValue===0?null:t.sidePanelParamValue??null:o;return ZI({sidePanel:l,mainOpen:i})}function n1(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanel===t.sidePanel?Gx("side",e)?{sidepanel:0}:null:{sidepanel:t.sidePanel};case"toggleMain":return e.mainOpen?Gx("main",e)?{main:0}:null:{main:t.openMainValue};case"openSidePanel":return e.sidePanel===t.sidePanel?null:{sidepanel:t.sidePanel}}}function tM(t){return t.sidePanel!==null&&t.mainOpen?{side:33,main:67}:t.sidePanel!==null?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function sM(t){const{sidePanel:e,mainOpen:s}=t.visibility;return e!==null&&(t.sidePanelParamPresent||!s)?e:s?"main":"chat"}function nM(t,e){return t==="main"?{sidepanel:0,main:e}:{sidepanel:t,main:0}}function iM(t,e){const s=Yt(),n=ur({strict:!1}),i=gf({strict:!1}),{create:o}=zc(),{threads:l}=n2(),{virtualMcpId:a,orgSlug:c,isAgentRoute:d}=e,u=n.main===0?"0":n.main,{sidePanel:h,mainOpen:f}=eM({entityMetadata:t,mainParamPresent:n.main!==void 0,mainParamValue:u,sidePanelParamPresent:n.sidepanel!==void 0,sidePanelParamValue:n.sidepanel}),m={sidePanel:h,mainOpen:f},p=P.useRef(crypto.randomUUID()),g=i.taskId??p.current,x="/$org/$taskId",b=T=>({org:c,taskId:T}),v=d?{virtualmcpid:a}:{},L=(T,C)=>{s({to:x,params:b(g),search:V=>({...V,...T}),replace:C?.replace??!1})},_=(T,C)=>{s({to:x,params:b(T),search:V=>{const A={};return C?A.virtualmcpid=C:d&&(A.virtualmcpid=a),A}})},y=()=>{const T=n1({type:"toggleMain",openMainValue:ac(t)},m);T&&L(T,{replace:!0})},S=T=>{const C=n1({type:"toggleSidePanel",sidePanel:T},m);C&&L(C,{replace:!0})},k=T=>{const C=u&&u!=="0"?u:ac(t);L(nM(T,C),{replace:!0})},w=T=>{const C=n1({type:"openSidePanel",sidePanel:T},m);C&&L(C,{replace:!0})},j=async()=>{const T=crypto.randomUUID(),C=l.find(V=>V.id===g)?.branch??null;try{await o({id:T,virtual_mcp_id:a,...C?{branch:C}:{}})}catch{}s({to:x,params:b(T),search:V=>({...v})})},N=T=>{L({main:T==="0"?0:T},{replace:!0})};return{taskId:g,sidePanel:h,mainOpen:f,mainParam:u,sidePanelParamPresent:n.sidepanel!==void 0,setTaskId:_,toggleMain:y,toggleSidePanel:S,setMobileSurface:k,openSidePanel:w,createNewTask:j,openTab:N}}function rM(t){const e=z.c(10),{org:s}=Fe(),n=s2(),{data:i}=In.useSession(),o=i?.user?.id,l=t?.id??null,a=!!t&&!!o&&!!t.created_by&&t.created_by!==o;let c;e[0]!==s.id||e[1]!==l?(c=Qe.viewedThreadMetadataRefresh(s.id,l??""),e[0]=s.id,e[1]=l,e[2]=c):c=e[2];const d=!!n&&!!l&&a;let u;e[3]!==n||e[4]!==l?(u=async()=>(await n?.refreshThreadMetadata(l??""),!0),e[3]=n,e[4]=l,e[5]=u):u=e[5];let h;e[6]!==c||e[7]!==d||e[8]!==u?(h={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:u},e[6]=c,e[7]=d,e[8]=u,e[9]=h):h=e[9],Pt(h)}function oM(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function lM(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function aM(t){return t/100*window.innerHeight}function cM(t){return t/100*window.innerWidth}function dM(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function Rd({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,o]=dM(s);switch(o){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=lM(e,i);break}case"em":{n=oM(e,i);break}case"vh":{n=aM(i);break}case"vw":{n=cM(i);break}}return n}function Ln(t){return parseFloat(t.toFixed(3))}function Vc({group:t}){const{orientation:e,panels:s}=t;return s.reduce((n,i)=>(n+=e==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,n),0)}function xm(t){const{panels:e}=t,s=Vc({group:t});return s===0?e.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):e.map(n=>{const{element:i,panelConstraints:o}=n;let l=0;if(o.collapsedSize!==void 0){const u=Rd({groupSize:s,panelElement:i,styleProp:o.collapsedSize});l=Ln(u/s*100)}let a;if(o.defaultSize!==void 0){const u=Rd({groupSize:s,panelElement:i,styleProp:o.defaultSize});a=Ln(u/s*100)}let c=0;if(o.minSize!==void 0){const u=Rd({groupSize:s,panelElement:i,styleProp:o.minSize});c=Ln(u/s*100)}let d=100;if(o.maxSize!==void 0){const u=Rd({groupSize:s,panelElement:i,styleProp:o.maxSize});d=Ln(u/s*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Qt(t,e="Assertion error"){if(!t)throw Error(e)}function bm(t,e){return Array.from(e).sort(t==="horizontal"?uM:hM)}function uM(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function hM(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function o7(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function l7(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function fM({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let i,o=Number.MAX_VALUE;for(const l of e){const{x:a,y:c}=l7(n,l),d=t==="horizontal"?a:c;d<o&&(o=d,i=l)}return Qt(i,"No rect found"),i}let L0;function mM(){return L0===void 0&&(typeof matchMedia=="function"?L0=!!matchMedia("(pointer:coarse)").matches:L0=!1),L0}function a7(t){const{element:e,orientation:s,panels:n,separators:i}=t,o=bm(s,Array.from(e.children).filter(o7).map(p=>({element:p}))).map(({element:p})=>p),l=[];let a=!1,c=!1,d=-1,u=-1,h=0,f,m=[];{let p=-1;for(const g of o)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(h++,d===-1&&(d=p),u=p))}if(h>1){let p=-1;for(const g of o)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(f){const b=f.element.getBoundingClientRect(),v=g.getBoundingClientRect();let L;if(c){const _=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),y=s==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(m.length){case 0:{L=[_,y];break}case 1:{const S=m[0],k=fM({orientation:s,rects:[b,v],targetRect:S.element.getBoundingClientRect()});L=[S,k===b?y:_];break}default:{L=m;break}}}else m.length?L=m:L=[s==="horizontal"?new DOMRect(b.right,v.top,v.left-b.right,v.height):new DOMRect(v.left,b.bottom,v.width,v.top-b.bottom)];for(const _ of L){let y="width"in _?_:_.element.getBoundingClientRect();const S=mM()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(y.width<S){const w=S-y.width;y=new DOMRect(y.x-w/2,y.y,y.width+w,y.height)}if(y.height<S){const w=S-y.height;y=new DOMRect(y.x,y.y-w/2,y.width,y.height+w)}const k=p<=d||p>u;!a&&!k&&l.push({group:t,groupSize:Vc({group:t}),panels:[f,x],separator:"width"in _?void 0:_,rect:y}),a=!1}}c=!1,f=x,m=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const x=i.find(b=>b.element===g);x?m.push(x):(f=void 0,m=[])}else c=!0}return l}let c7=class{#e={};addListener(e,s){const n=this.#e[e];return n===void 0?this.#e[e]=[s]:n.includes(s)||n.push(s),()=>{this.removeListener(e,s)}}emit(e,s){const n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,s);else{let i=!1,o=null;const l=Array.from(n);for(let a=0;a<l.length;a++){const c=l[a];try{c.call(null,s)}catch(d){o===null&&(i=!0,o=d)}}if(i)throw o}}removeAllListeners(){this.#e={}}removeListener(e,s){const n=this.#e[e];if(n!==void 0){const i=n.indexOf(s);i>=0&&n.splice(i,1)}}},mc={cursorFlags:0,state:"inactive"};const ng=new c7;function Sl(){return mc}function pM(t){return ng.addListener("change",t)}function gM(t){const e=mc,s={...mc};s.cursorFlags=t,mc=s,ng.emit("change",{prev:e,next:s})}function pc(t){const e=mc;mc=t,ng.emit("change",{prev:e,next:t})}const xM=t=>t,i1=()=>{},d7=1,u7=2,h7=4,f7=8,Yx=3,Jx=12;let w0;function Qx(){return w0===void 0&&(w0=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(w0=!0)),w0}function bM({cursorFlags:t,groups:e,state:s}){let n=0,i=0;switch(s){case"active":case"hover":e.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(!(n===0&&i===0)){switch(s){case"active":{if(t&&Qx()){const o=(t&d7)!==0,l=(t&u7)!==0,a=(t&h7)!==0,c=(t&f7)!==0;if(o)return a?"se-resize":c?"ne-resize":"e-resize";if(l)return a?"sw-resize":c?"nw-resize":"w-resize";if(a)return"s-resize";if(c)return"n-resize"}break}}return Qx()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const Xx=new WeakMap;function ig(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=Xx.get(t)??{};s===void 0&&(s=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&(Object.isExtensible(t.adoptedStyleSheets)?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]));const n=Sl();switch(n.state){case"active":case"hover":{const i=bM({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(l=>l.group),state:n.state}),o=`*, *:hover {cursor: ${i} !important; }`;if(e===o)return;e=o,i?s.cssRules.length===0?s.insertRule(o):s.replaceSync(o):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}Xx.set(t,{prevStyle:e,styleSheet:s})}let Xi=new Map;const m7=new c7;function vM(t){Xi=new Map(Xi),Xi.delete(t)}function Zx(t,e){for(const[s]of Xi)if(s.id===t)return s}function Lo(t,e){for(const[s,n]of Xi)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function zl(){return Xi}function rg(t,e){return m7.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function $r(t,e,s){const n=Xi.get(t);Xi=new Map(Xi),Xi.set(t,e),m7.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function p7(t){const e=Sl();let s=!1;return e.state==="active"&&(pc({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(ig(t),s=!0,e.hitRegions.forEach(n=>{const i=Lo(n.group.id,!0);$r(n.group,i,{isUserInteraction:!0})}))),s}function e4(t){t.defaultPrevented||p7(t.currentTarget)}function yM(t,e,s){let n,i={x:1/0,y:1/0};for(const o of e){const l=l7(s,o.rect);switch(t){case"horizontal":{l.x<=i.x&&(n=o,i=l);break}case"vertical":{l.y<=i.y&&(n=o,i=l);break}}}return n?{distance:i,hitRegion:n}:void 0}function _M(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function LM(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:n4(t),b:n4(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Qt(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:s4(t4(s.a)),b:s4(t4(s.b))};if(i.a===i.b){const o=n.childNodes,l={a:s.a.at(-1),b:s.b.at(-1)};let a=o.length;for(;a--;){const c=o[a];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(i.a-i.b)}const wM=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function SM(t){const e=getComputedStyle(g7(t)??t).display;return e==="flex"||e==="inline-flex"}function kM(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||SM(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||wM.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function t4(t){let e=t.length;for(;e--;){const s=t[e];if(Qt(s,"Missing node"),kM(s))return s}return null}function s4(t){return t&&Number(getComputedStyle(t).zIndex)||0}function n4(t){const e=[];for(;t;)e.push(t),t=g7(t);return e}function g7(t){const{parentNode:e}=t;return _M(e)?e.host:e}function jM(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function CM({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!o7(s)||s.contains(t)||t.contains(s))return!0;if(LM(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(jM(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function og(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const o=a7(i),l=yM(i.orientation,o,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&CM({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function NM(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!=e[s])return!1;return!0}function gn(t,e,s=0){return Math.abs(Ln(t)-Ln(e))<=s}function Ki(t,e){return gn(t,e)?0:t>e?1:-1}function cc({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:i=0,collapsible:o,disabled:l,maxSize:a=100,minSize:c=0}=e;if(l&&!t)return s;if(Ki(n,c)<0)if(o){const d=(i+c)/2;Ki(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=Ln(n),n}function vu({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:o}){if(gn(t,0))return e;const l=o==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[u,h]=n;Qt(u!=null,"Invalid first pivot index"),Qt(h!=null,"Invalid second pivot index");let f=0;switch(o){case"keyboard":{{const g=t<0?h:u,x=s[g];Qt(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:L=0}=x;if(v){const _=a[g];if(Qt(_!=null,`Previous layout not found for panel index ${g}`),gn(_,b)){const y=L-_;Ki(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const g=t<0?u:h,x=s[g];Qt(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:L=0}=x;if(v){const _=a[g];if(Qt(_!=null,`Previous layout not found for panel index ${g}`),gn(_,L)){const y=_-b;Ki(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}break}default:{const g=t<0?h:u,x=s[g];Qt(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:v,collapsedSize:L,minSize:_}=x;if(v&&Ki(b,_)<0)if(t>0){const y=_-L,S=y/2,k=b+t;Ki(k,_)<0&&(t=Ki(t,S)<=0?0:y)}else{const y=_-L,S=100-y/2,k=b-t;Ki(k,_)<0&&(t=Ki(100+t,S)>0?0:-y)}break}}{const g=t<0?1:-1;let x=t<0?h:u,b=0;for(;;){const L=a[x];Qt(L!=null,`Previous layout not found for panel index ${x}`);const _=cc({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:L,size:100})-L;if(b+=_,x+=g,x<0||x>=s.length)break}const v=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-v:v}{let g=t<0?u:h;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Qt(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,L=cc({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:v});if(!gn(b,L)&&(f+=b-L,d[g]=L,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(NM(c,d))return i;{const g=t<0?h:u,x=a[g];Qt(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=cc({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!gn(v,b)){let L=b-v,_=t<0?h:u;for(;_>=0&&_<s.length;){const y=d[_];Qt(y!=null,`Previous layout not found for panel index ${_}`);const S=y+L,k=cc({overrideDisabledPanels:l,panelConstraints:s[_],prevSize:y,size:S});if(gn(y,k)||(L-=k-y,d[_]=k),gn(L,0))break;t>0?_--:_++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!gn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function kl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Ki(t[s],e[s])!==0)return!1;return!0}function jl({layout:t,panelConstraints:e}){const s=Object.values(t),n=[...s],i=n.reduce((a,c)=>a+c,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!gn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Qt(c!=null,`No layout data found for index ${a}`);const d=100/i*c;n[a]=d}let o=0;for(let a=0;a<e.length;a++){const c=s[a];Qt(c!=null,`No layout data found for index ${a}`);const d=n[a];Qt(d!=null,`No layout data found for index ${a}`);const u=cc({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=u&&(o+=d-u,n[a]=u)}if(!gn(o,0))for(let a=0;a<e.length;a++){const c=n[a];Qt(c!=null,`No layout data found for index ${a}`);const d=c+o,u=cc({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==u&&(o-=u-c,n[a]=u,gn(o,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function x7({groupId:t,panelId:e}){const s=()=>{const c=zl();for(const[d,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:f,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:d,groupSize:m,layout:f,separatorToPanels:p};throw Error(`Group ${t} not found`)},n=()=>{const c=s().derivedPanelConstraints.find(d=>d.panelId===e);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${e}`)},i=()=>{const c=s().group.panels.find(d=>d.id===e);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},o=()=>{const c=s().layout[e];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},l=({nextSize:c,panels:d,prevLayout:u,derivedPanelConstraints:h})=>{const f=o(),m=d.findIndex(x=>x.id===e),p=m===0,g=m===d.length-1;if(g&&c<f&&(p||d.slice(0,m).every((x,b)=>{const v=h[b];return v?.collapsible&&gn(v.collapsedSize,u[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+u[v.id],0);return{...u,[e]:Ln(100-x)}}return vu({delta:g?f-c:c-f,initialLayout:u,panelConstraints:h,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:u,trigger:"imperative-api"})},a=c=>{const d=o();if(c===d)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:f,groupSize:m,layout:p,separatorToPanels:g}=s(),x=l({nextSize:c,panels:f.panels,prevLayout:p,derivedPanelConstraints:h}),b=jl({layout:x,panelConstraints:h});kl(p,b)||$r(f,{defaultLayoutDeferred:u,derivedPanelConstraints:h,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:u}=i(),h=o();c&&h!==d&&(u.expandToSize=h,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:u}=n(),{mutableValues:h}=i(),f=o();if(c&&f===d){let m=h.expandToSize??u;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=o(),{element:u}=i(),h=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:d,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),u=o();return c&&gn(d,u)},resize:c=>{const{group:d}=s(),{element:u}=i(),h=Vc({group:d}),f=Rd({groupSize:h,panelElement:u,styleProp:c}),m=Ln(f/h*100);a(m)}}}function i4(t){if(t.defaultPrevented)return;const e=zl();og(t,e).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const n=s.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(n){const i=n.panelConstraints.defaultSize,o=x7({groupId:s.group.id,panelId:n.id});o&&i!==void 0&&(o.resize(i),t.preventDefault())}}})}function oh(t){const e=zl();for(const[s]of e)if(s.separators.some(n=>n.element===t))return s;throw Error("Could not find parent Group for separator element")}function b7({groupId:t}){const e=()=>{const s=zl();for(const[n,i]of s)if(n.id===t)return{group:n,...i};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:n}=e();return s?{}:n},setLayout(s){const{defaultLayoutDeferred:n,derivedPanelConstraints:i,group:o,groupSize:l,layout:a,separatorToPanels:c}=e(),d=jl({layout:s,panelConstraints:i});return n?a:(kl(a,d)||$r(o,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function sl(t,e){const s=oh(t),n=Lo(s.id,!0),i=s.separators.find(u=>u.element===t);Qt(i,"Matching separator not found");const o=n.separatorToPanels.get(i);Qt(o,"Matching panels not found");const l=o.map(u=>s.panels.indexOf(u)),a=b7({groupId:s.id}).getLayout(),c=vu({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=jl({layout:c,panelConstraints:n.derivedPanelConstraints});kl(a,d)||$r(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function r4(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=oh(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&sl(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&sl(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&sl(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&sl(e,-5);break}case"End":{t.preventDefault(),sl(e,100);break}case"Enter":{t.preventDefault();const n=oh(e),i=Lo(n.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Qt(c,"Matching separator not found");const d=a.get(c);Qt(d,"Matching panels not found");const u=d[0],h=o.find(f=>f.panelId===u.id);if(Qt(h,"Panel metadata not found"),h.collapsible){const f=l[u.id],m=h.collapsedSize===f?n.mutableState.expandedPanelSizes[u.id]??h.minSize:h.collapsedSize;sl(e,m-f)}break}case"F6":{t.preventDefault();const n=oh(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Qt(i!==null,"Index not found");const o=t.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[o].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),sl(e,-100);break}}}function o4(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=zl(),s=og(t,e),n=new Map;let i=!1;s.forEach(o=>{o.separator&&(i||(i=!0,o.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=e.get(o.group);l&&n.set(o.group,l.layout)}),pc({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function v7({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:o,prevCursorFlags:l}){let a=0;s.forEach(d=>{const{group:u,groupSize:h}=d,{orientation:f,panels:m}=u,{disableCursor:p}=u.mutableState;let g=0;o?f==="horizontal"?g=(e.clientX-o.x)/h*100:g=(e.clientY-o.y)/h*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(u),b=i.get(u);if(!x||!b)return;const{defaultLayoutDeferred:v,derivedPanelConstraints:L,groupSize:_,layout:y,separatorToPanels:S}=b;if(L&&y&&S){const k=vu({delta:g,initialLayout:x,panelConstraints:L,pivotIndices:d.panels.map(w=>m.indexOf(w)),prevLayout:y,trigger:"mouse-or-touch"});if(kl(k,y)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?d7:u7;break}case"vertical":{a|=g<0?h7:f7;break}}}else $r(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:L,groupSize:_,layout:k,separatorToPanels:S})}});let c=0;e.movementX===0?c|=l&Yx:c|=a&Yx,e.movementY===0?c|=l&Jx:c|=a&Jx,gM(c),ig(t)}function l4(t){const e=zl(),s=Sl();s.state==="active"&&v7({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function a4(t){if(t.defaultPrevented)return;const e=Sl(),s=zl();switch(e.state){case"active":{if(t.buttons===0){pc({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=Lo(n.group.id,!0);$r(n.group,i,{isUserInteraction:!0})});return}for(const n of e.hitRegions)if(n.separator){const{element:i}=n.separator;i.hasPointerCapture?.(t.pointerId)||i.setPointerCapture?.(t.pointerId)}v7({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=og(t,s);n.length===0?e.state!=="inactive"&&pc({cursorFlags:0,state:"inactive"}):pc({cursorFlags:0,hitRegions:n,state:"hover"}),ig(t.currentTarget);break}}}function c4(t){t.relatedTarget instanceof HTMLIFrameElement&&Sl().state==="hover"&&pc({cursorFlags:0,state:"inactive"})}function d4(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||p7(t.currentTarget)&&t.preventDefault()}function u4(t){let e=0,s=0;const n={};for(const o of t)if(o.defaultSize!==void 0){e++;const l=Ln(o.defaultSize);s+=l,n[o.panelId]=l}else n[o.panelId]=void 0;const i=t.length-e;if(i!==0){const o=Ln((100-s)/i);for(const l of t)l.defaultSize===void 0&&(n[l.panelId]=o)}return n}function TM(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const i=Vc({group:t}),o=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:Ln(o/i*100),inPixels:o};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function VM(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function AM({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let i=0,o=0,l=!1;const a=new Map,c=[];for(const h of t.panels){const f=n[h.id]??0;if(h.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){l=!0;const m=f/100*s,p=Ln(m/e*100);a.set(h.id,p),i+=p}else c.push(h.id),o+=f}if(!l||c.length===0)return n;const d=100-i,u={...n};if(a.forEach((h,f)=>{u[f]=h}),o>0)for(const h of c){const f=n[h]??0;u[h]=Ln(f/o*d)}else{const h=Ln(d/c.length);for(const f of c)u[f]=h}return u}function PM(t,e){const s=t.map(i=>i.id),n=Object.keys(e);if(s.length!==n.length)return!1;for(const i of s)if(!n.includes(i))return!1;return!0}const Qa=new Map;function EM(t){let e=!0;Qt(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,i=new Set,o=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const v=Vc({group:t});if(v===0)return;const L=Lo(t.id);if(!L)return;const _=xm(t),y=L.defaultLayoutDeferred?u4(_):L.layout,S=AM({group:t,nextGroupSize:v,prevGroupSize:L.groupSize,prevLayout:y}),k=jl({layout:S,panelConstraints:_});if(!L.defaultLayoutDeferred&&kl(L.layout,k)&&VM(L.derivedPanelConstraints,_)&&L.groupSize===v)return;$r(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:_,groupSize:v,layout:k,separatorToPanels:L.separatorToPanels})}}else TM(t,b,x)}});o.observe(t.element),t.panels.forEach(p=>{Qt(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&o.observe(p.element)});const l=Vc({group:t}),a=xm(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(PM(t.panels,d)||(d=void 0));const u=t.mutableState.layouts[c]??d??u4(a),h=jl({layout:u,panelConstraints:a}),f=t.element.ownerDocument;Qa.set(f,(Qa.get(f)??0)+1);const m=new Map;return a7(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),$r(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:h,separatorToPanels:m}),t.separators.forEach(p=>{Qt(!i.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),i.add(p.id),p.element.addEventListener("keydown",r4)}),Qa.get(f)===1&&(f.addEventListener("contextmenu",e4,!0),f.addEventListener("dblclick",i4,!0),f.addEventListener("pointerdown",o4,!0),f.addEventListener("pointerleave",l4),f.addEventListener("pointermove",a4),f.addEventListener("pointerout",c4),f.addEventListener("pointerup",d4,!0)),function(){e=!1,Qa.set(f,Math.max(0,(Qa.get(f)??0)-1)),vM(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",r4)}),Qa.get(f)||(f.removeEventListener("contextmenu",e4,!0),f.removeEventListener("dblclick",i4,!0),f.removeEventListener("pointerdown",o4,!0),f.removeEventListener("pointerleave",l4),f.removeEventListener("pointermove",a4),f.removeEventListener("pointerout",c4),f.removeEventListener("pointerup",d4,!0)),o.disconnect()}}function DM(){const[t,e]=P.useState({}),s=P.useCallback(()=>e({}),[]);return[t,s]}function lg(t){const e=P.useId();return`${t??e}`}const Fl=typeof window<"u"?P.useLayoutEffect:P.useEffect;function Yd(t){const e=P.useRef(t);return Fl(()=>{e.current=t},[t]),P.useCallback((...s)=>e.current?.(...s),[e])}function ag(...t){return Yd(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function cg(t){const e=P.useRef({...t});return Fl(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const y7=P.createContext(null);function RM(t,e){const s=P.useRef({getLayout:()=>({}),setLayout:xM});P.useImperativeHandle(e,()=>s.current,[]),Fl(()=>{Object.assign(s.current,b7({groupId:t}))})}function _7({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:o,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:u="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...m}){const p=P.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Yd(T=>{kl(p.current.onLayoutChange,T)||(p.current.onLayoutChange=T,c?.(T))}),x=Yd((T,C)=>{kl(p.current.onLayoutChanged,T)||(p.current.onLayoutChanged=T,d?.(T,{isUserInteraction:C}))}),b=lg(a),v=P.useRef(null),[L,_]=DM(),y=P.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),S=ag(v,o);RM(b,l);const k=Yd((T,C)=>{const V=Sl(),A=Zx(T),E=Lo(T);if(E){let D=!1;return V.state==="active"&&(D=V.hitRegions.some(I=>I.group===A)),{flexGrow:E.layout[C]??1,pointerEvents:D?"none":void 0}}if(s?.[C])return{flexGrow:s?.[C]}}),w=cg({defaultLayout:s,disableCursor:n}),j=P.useMemo(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:k,id:b,orientation:u,registerPanel:T=>{const C=y.current;return C.panels=bm(u,[...C.panels,T]),_(),()=>{C.panels=C.panels.filter(V=>V!==T),_()}},registerSeparator:T=>{const C=y.current;return C.separators=bm(u,[...C.separators,T]),_(),()=>{C.separators=C.separators.filter(V=>V!==T),_()}},updatePanelProps:(T,{disabled:C})=>{const V=y.current.panels.find(D=>D.id===T);V&&(V.panelConstraints.disabled=C);const A=Zx(b),E=Lo(b);A&&E&&$r(A,{...E,derivedPanelConstraints:xm(A)})},updateSeparatorProps:(T,{disabled:C,disableDoubleClick:V})=>{const A=y.current.separators.find(E=>E.id===T);A&&(A.disabled=C,A.disableDoubleClick=V)}}),[k,b,_,u,w]),N=P.useRef(null);return Fl(()=>{const T=v.current;if(T===null)return;const C=y.current;let V;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===C.panels.length){V={};for(const B of C.panels){const M=w.defaultLayout[B.id];M!==void 0&&(V[B.id]=M)}}const A={disabled:!!i,element:T,id:b,mutableState:{defaultLayout:V,disableCursor:!!w.disableCursor,expandedPanelSizes:y.current.lastExpandedPanelSizes,layouts:y.current.layouts},orientation:u,panels:C.panels,resizeTargetMinimumSize:C.resizeTargetMinimumSize,separators:C.separators};N.current=A;const E=EM(A),{defaultLayoutDeferred:D,derivedPanelConstraints:I,layout:R}=Lo(A.id,!0);!D&&I.length>0&&(g(R),x(R,!1));const $=rg(b,B=>{const{defaultLayoutDeferred:M,derivedPanelConstraints:O,layout:F}=B.next;if(M||O.length===0)return;const U=A.panels.map(({id:q})=>q).join(",");A.mutableState.layouts[U]=F,O.forEach(q=>{if(q.collapsible){const{layout:W}=B.prev??{};if(W){const G=gn(q.collapsedSize,F[q.panelId]),Y=gn(q.collapsedSize,W[q.panelId]);G&&!Y&&(A.mutableState.expandedPanelSizes[q.panelId]=W[q.panelId])}}});const K=Sl().state!=="active";g(F),K&&x(F,B.isUserInteraction)});return()=>{N.current=null,E(),$()}},[i,b,x,g,u,L,w]),P.useEffect(()=>{const T=N.current;T&&(T.mutableState.defaultLayout=s,T.mutableState.disableCursor=!!n)}),r.jsx(y7.Provider,{value:j,children:r.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:S,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:t})})}_7.displayName="Group";function dg(){const t=P.useContext(y7);return Qt(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function IM(t,e){const{id:s}=dg(),n=P.useRef({collapse:i1,expand:i1,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:i1});P.useImperativeHandle(e,()=>n.current,[]),Fl(()=>{Object.assign(n.current,x7({groupId:s,panelId:t}))})}function L7({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:i,disabled:o,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:c,maxSize:d="100%",minSize:u="0%",onResize:h,panelRef:f,style:m,...p}){const g=!!c,x=lg(c),b=cg({disabled:o}),v=P.useRef(null),L=ag(v,l),{getPanelStyles:_,id:y,orientation:S,registerPanel:k,updatePanelProps:w}=dg(),j=h!==null,N=Yd((A,E,D)=>{h?.(A,c,D)});Fl(()=>{const A=v.current;if(A!==null){const E={element:A,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?N:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:u}};return k(E)}},[a,s,n,i,j,x,g,d,u,N,k,b]),P.useEffect(()=>{w(x,{disabled:o})},[o,x,w]),IM(x,f);const T=()=>{const A=_(y,x);if(A)return JSON.stringify(A)},C=P.useSyncExternalStore(A=>rg(y,A),T,T);let V;return C?V=JSON.parse(C):i!==void 0?V={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:V={flexGrow:1},r.jsx("div",{...p,"data-disabled":o||void 0,"data-panel":!0,"data-testid":x,id:x,ref:L,style:{...MM,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...V},children:r.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:S==="horizontal"?"pan-y":"pan-x"},children:t})})}L7.displayName="Panel";const MM={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function $M({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let i,o;const l=t[s],a=e.find(c=>c.panelId===s);if(a){const c=a.maxSize,d=a.collapsible?a.collapsedSize:a.minSize,u=[n,n+1];o=jl({layout:vu({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s],i=jl({layout:vu({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:o,valueNow:l}}function w7({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:o,style:l,...a}){const c=lg(o),d=cg({disabled:s,disableDoubleClick:n}),[u,h]=P.useState({}),[f,m]=P.useState("inactive"),[p,g]=P.useState(!1),x=P.useRef(null),b=ag(x,i),{disableCursor:v,id:L,orientation:_,registerSeparator:y,updateSeparatorProps:S}=dg(),k=_==="horizontal"?"vertical":"horizontal";Fl(()=>{const N=x.current;if(N!==null){const T={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:N,id:c},C=y(T),V=pM(E=>{m(E.next.state!=="inactive"&&E.next.hitRegions.some(D=>D.separator===T)?E.next.state:"inactive")}),A=rg(L,E=>{const{derivedPanelConstraints:D,layout:I,separatorToPanels:R}=E.next,$=R.get(T);if($){const B=$[0],M=$.indexOf(B);h($M({layout:I,panelConstraints:D,panelId:B.id,panelIndex:M}))}});return()=>{V(),A(),C()}}},[L,c,y,d]),P.useEffect(()=>{S(c,{disabled:s,disableDoubleClick:n})},[s,n,c,S]);let w;s&&!v&&(w="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,r.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":s||void 0,"aria-orientation":k,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:t,className:e,"data-separator":j,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:w,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}w7.displayName="Separator";function S7(t){const e=z.c(10);let s,n,i;e[0]!==t?({className:s,ref:i,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==s?(o=ie("flex h-full w-full",s),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==n||e[7]!==i||e[8]!==o?(l=r.jsx(_7,{groupRef:i,"data-slot":"resizable-panel-group",className:o,...n}),e[6]=n,e[7]=i,e[8]=o,e[9]=l):l=e[9],l}function Ch(t){const e=z.c(10);let s,n,i;e[0]!==t?({ref:n,style:i,...s}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==i?(o={overflow:"hidden",...i},e[4]=i,e[5]=o):o=e[5];let l;return e[6]!==s||e[7]!==n||e[8]!==o?(l=r.jsx(L7,{panelRef:n,"data-slot":"resizable-panel",style:o,...s}),e[6]=s,e[7]=n,e[8]=o,e[9]=l):l=e[9],l}function k7(t){const e=z.c(12);let s,n,i;e[0]!==t?({withHandle:i,className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==s?(o=ie("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",s),e[4]=s,e[5]=o):o=e[5];let l;e[6]!==i?(l=i&&r.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:r.jsx(Uc,{className:"size-2.5"})}),e[6]=i,e[7]=l):l=e[7];let a;return e[8]!==n||e[9]!==o||e[10]!==l?(a=r.jsx(w7,{"data-slot":"resizable-handle",className:o,...n,children:l}),e[8]=n,e[9]=o,e[10]=l,e[11]=a):a=e[11],a}function h4(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function OM(t,e){const s=z.c(8);let n;s[0]!==e?(n=c=>h4(c,e),s[0]=e,s[1]=n):n=s[1];const[i,o]=xf(t,n);let l;s[2]!==e||s[3]!==i?(l=h4(i,e),s[2]=e,s[3]=i,s[4]=l):l=s[4];let a;return s[5]!==o||s[6]!==l?(a=[l,o],s[5]=o,s[6]=l,s[7]=a):a=s[7],a}const BM=33;function zM(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Kp.sidePanelWidth(),t[0]=e):e=t[0],OM(e,BM)}function vm(){const t=z.c(3),[e,s]=P.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let o;return t[1]!==e?(o=[e,i],t[1]=e,t[2]=o):o=t[2],o}function j7(t){if(!t||typeof t!="object")return null;const e=t;return e.isError?e.content?.find(n=>n.type==="text")?.text?.trim()||"GitHub MCP tool returned an error":null}function ug(t){const e=j7(t);if(e)throw new Error(e)}function FM(t){try{return JSON.parse(t)}catch{return null}}function UM(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,n=s?FM(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function Hu(t){const e=UM(t);return e===null?null:e}function C7(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function HM(t){if(!t||typeof t!="object")return null;const e=t.content?.find(i=>i.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],n=C7(s);return!n||!s?null:{number:n,htmlUrl:s}}function f4(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const m4=/[\r\n<>]/,KM=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Ku(t){const e=t?.userName?.trim();if(!e||m4.test(e))return null;const s=t?.userEmail?.trim();return!s||m4.test(s)?{userName:e}:KM.test(s)?{userName:e,userEmail:s}:{userName:e}}function WM(t){return t.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-BZXQsXK6.js","assets/index-DPGUtnwt.js","assets/index-Phl0yjiP.css","assets/chat-context-Blvo4ZaA.js","assets/tab-id-BJhTpcjb.js","assets/dialog-BPAi9RC3.js","assets/Check-Bcnwcxbs.js","assets/Copy01-D1fa_vNZ.js","assets/Download01-uHHa4lEe.js","assets/session-runtime-wVXsCwcJ.js","assets/hooks-OOuw421f.js","assets/use-mcp-client-BNj8WwX8.js","assets/constants-dLUUoWH7.js","assets/auth-CyHwgdwm.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-D4oSA7X3.js","assets/task-board-DJY41XW8.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-ClsybENf.js","assets/use-ai-providers-X5gQ6Frj.js","assets/use-decopilot-events-CU_83DHk.js","assets/use-organization-settings-D_NMX4QF.js","assets/ChevronDown-CYG4QSfS.js","assets/agent-icon-C0NUu0Dv.js","assets/AlertCircle-DvlMJzvH.js","assets/ThumbsUp-Cd4kv7sI.js","assets/Tool01-CS1WVbOe.js","assets/ArrowUp-C9GXuzBP.js","assets/ArrowLeft-RTJfGYqO.js","assets/Tool02-jZCjY4_C.js","assets/XCircle-BWzp7_v9.js","assets/TrendUp01-C_nOGhfv.js","assets/ZapSquare-Cx2KzeH8.js","assets/Users03-DlfmNcXb.js","assets/Tag01-B6hNMJxH.js","assets/CheckCircle-CpE2gFL2.js","assets/ChevronRight-CpQ-XGWn.js","assets/ChevronSelectorVertical-CD6IG3xp.js","assets/ChevronUp-DmLHjlB8.js","assets/Circle-DquOefUY.js","assets/Stars02-C-goK6F_.js","assets/UserSquare-DVKafobf.js","assets/CreditCard01-CzXoH2_E.js","assets/DotsVertical-CKqcdQY1.js","assets/Settings02-Coch6I-s.js","assets/Eye-DQbrUXqj.js","assets/FilterLines-FKz5JmaU.js","assets/Flag01-C7lX_ovT.js","assets/Share07-CxOQdduI.js","assets/Globe01-DUNAdl96.js","assets/Globe04-C8-Iz5Ob.js","assets/SwitchHorizontal01-DfXXgPLT.js","assets/HardDrive-CNNOA8X1.js","assets/Key01-CtlUEn-O.js","assets/LinkExternal01-CYW5qBle.js","assets/LockUnlocked01-Camlq0iF.js","assets/LogOut01-C4vxkvjg.js","assets/Monitor01-BztQffJ4.js","assets/Sun-DrW-cZzP.js","assets/Palette-7eulFGyg.js","assets/Play-BBuTt-ww.js","assets/Plus-CNy9dH9H.js","assets/SearchLg-C50f6-iX.js","assets/SearchMd-6NHlIJV9.js","assets/Shield01-Bx4JHFe_.js","assets/Stars01-BN2vePFs.js","assets/Trash01-Ctsi28Hg.js","assets/Upload01-BEuKNUVM.js","assets/User01-Ds6h02_-.js","assets/Users01-bpQBejCA.js","assets/XClose-BEkgs57b.js","assets/Zap-CxJvVyr1.js","assets/scroll-area-B4T29_7m.js","assets/select-BY51Huw5.js","assets/input-DKMZUsZA.js","assets/dropdown-menu-DrLVp347.js","assets/page-seo-form-B68YJZBJ.js","assets/label-BU9Jjv7s.js","assets/switch-CL_wNuTg.js","assets/use-section-preview-base-Qgv1PNdK.js","assets/automation-runs-BxtzDNBD.js","assets/useInfiniteQuery-BSIOCSh6.js","assets/use-infinite-scroll-DC-w6br5.js","assets/use-connection-QgnscFuw.js","assets/table-Ch68zFSa.js","assets/empty-state-B2wH44TC.js","assets/use-members-Bg_K3VT6.js","assets/use-org-auth-client-YSRXYZJk.js","assets/use-automations-C3qK2rmP.js","assets/useSuspenseInfiniteQuery-BkFkcqA-.js","assets/avatar-vk7RnokO.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-D9URxb5f.js","assets/monaco-editor-uC0FBK2U.js","assets/spinner-BaYSIBAI.js","assets/types-DoWTNUch.js","assets/shell-layout-4pJEKgjG.js","assets/required-auth-layout-D1yWxUhZ.js","assets/use-org-sso-CRtwFqcf.js","assets/integration-icon-CRsthFhv.js","assets/use-navigate-to-agent-DT_1GDH5.js","assets/reusable-new-chat-CzvRy4Pe.js","assets/chart-D5ReNvVa.js","assets/index-D0lcxq-X.js","assets/form-BEmxbAzw.js","assets/file-type-icon-Hqh-VGqi.js","assets/drawer-Rb3VMach.js","assets/collection-search-CmlhAF0q.js","assets/tabs-C_f6Viy6.js","assets/toggle-group-CGVC-CKF.js","assets/use-commerce-diagnostic-E_UCqtaW.js","assets/popover-C0it1EeO.js","assets/self-tool-result-CEMUyQFk.js","assets/alert-dialog-B2L8zdte.js","assets/extract-connection-data-Bdjb5ZXD.js","assets/metadata-dUsYcpuu.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-C3rowxeM.js","assets/authenticate-and-persist-oauth-PAJ6c4DM.js","assets/mcp-oauth-DTLy_4G_.js","assets/track-B8lap1At.js","assets/toolbar-BuFg3wIL.js","assets/github-icon-DHRjGJq9.js","assets/github-repo-picker-BfQZfVQf.js","assets/use-mcp-tools-6tuJyt0H.js","assets/agent-capabilities-B52k7xCe.js","assets/connection-card-jdfVPdle.js","assets/use-registry-connections-BlS_T8ii.js","assets/retry-CErkP7V6.js","assets/connection-slug-eyAPH6o3.js","assets/textarea-CtFZfz7M.js","assets/connection-form-helpers-w35YzYkJ.js","assets/collection-tabs-CQJ6FTtv.js","assets/badge-CkLXXL_T.js","assets/select-model-BzQbpsB5.js","assets/checkbox-359BBv51.js","assets/ai-providers-logos-DD3qZ33J.js","assets/cards-DQZf9oFU.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-DZu3oH6T.js","assets/use-file-configs-Ox49dnE1.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-BGhJv3cs.js","assets/search-input-Cs87u1XL.js","assets/use-mcp-auth-status-BuxyzgKj.js","assets/use-secrets-DF0Rg5Ke.js","assets/AreaChart-Co3sUl8Q.js","assets/super-agent-icon-ChHyJxMq.js","assets/task-filters-CM9aziD7.js","assets/command-B54aL3fS.js","assets/index-D7uXKn4l.js","assets/get-initials-D-f_fDFw.js","assets/config-BktrQTTP.js","assets/breadcrumb-C9h26hV1.js","assets/use-tags-NRFc9Kma.js","assets/automation-list-row-z1ftMX8t.js","assets/site-error--i37Vnuw.js","assets/use-org-repo-syncs-hB2RbIfF.js","assets/file-explorer-6_ZvOUKC.js","assets/app-editor-DekxMnA4.js","assets/post-editor-eYS6wget.js","assets/multi-select-BQqJKDNj.js","assets/block-document-C4o6tCSR.js","assets/primitives-DeoLy5zL.js","assets/use-autosave-D0w2JlYV.js","assets/record-editor-DtcqJs15.js","assets/category-editor-CLzVrD3c.js","assets/bulk-category-panel-vm5kaf3N.js","assets/index-u2QXPqsz.js","assets/seo-editor-X38ED2ap.js","assets/variant-calendar-DFnlHYZD.js","assets/view-mode-toggle-CPKFOFja.js","assets/post-calendar-B523IrUM.js","assets/alert-rPfc5Gbc.js","assets/redirect-editor-CHSAyTcV.js","assets/project-app-view-Dh8z705d.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{p as as,r as P,ai as yC,aj as _C,ak as Rt,al as js,am as rr,an as Ee,ao as dr,ap as du,aq as LC,ar as bi,as as wC,at as nm,au as ny,c as z,H as Fe,n as ie,j as r,E as Ws,b as re,t as ge,aa as Dr,a5 as zo,a8 as He,a9 as Ke,ab as We,av as Is,I as Kp,B as he,aw as Wp,ax as iy,x as Ti,ay as Ds,az as ul,aA as ux,d as Yt,ac as ys,e as Rs,q as Je,aB as SC,D as Fr,aC as kC,aD as ry,aE as jC,aF as Wi,aG as W9,aH as _n,aI as CC,aJ as q9,aK as NC,aL as TC,aM as VC,aN as AC,z as pf,K as Qe,aO as PC,aP as EC,aQ as DC,aR as RC,aS as oy,aT as qd,o as Pt,k as lt,a as In,C as Vu,aU as uu,u as ur,f as gf,R as xf,aV as qp,aW as IC,L as MC,a3 as ly,aX as vh,aY as hl,Y as bt,aZ as ay,a_ as cy,a$ as Dn,P as vi,b0 as Nt,s as dy,b1 as uy,b2 as $C,b3 as hy,b4 as fy,b5 as my,b6 as py,b7 as gy,b8 as xy,b9 as by,ba as vy,bb as yy,bc as _y,bd as Ly,be as wy,bf as Sy,bg as jn,N as ky,bh as OC,bi as jy,bj as BC,bk as zC,bl as Cy,bm as FC,bn as UC,bo as HC,bp as KC,bq as WC,br as Ny,bs as qC,bt as GC,ah as YC}from"./index-DPGUtnwt.js";import{i as bf,n as JC}from"./ArrowUp-C9GXuzBP.js";import{u as Il,a as ui,b as Ts,c as un,d as Ty,s as QC,e as XC,f as ZC,g as eN,h as tN,i as sN,j as nN,k as Gp,l as Vy,A as iN,m as rN,n as oN,t as lN,o as aN,p as vf,q as is,r as Lc,H as hu,v as fu,w as Ja,x as Ay,y as Py,z as cN,B as dN}from"./chat-context-Blvo4ZaA.js";import{c as yf,s as Bc,g as er,P as mu,d as Yp,t as _l,a as uN,M as hN,i as fN,b as or,e as _f,f as mN,D as pN,h as gN,j as xN,k as wc,l as bN,m as vN,u as Lf,E as yN,n as Au,o as _N,F as LN,p as wf,q as Sf,r as Ey,S as wN,v as SN,w as kN,x as jN,y as hx,z as CN,A as Dy,O as NN,B as fx,C as Gi,G as TN,T as Ry,H as G9,I as Pd,J as VN,K as AN,L as Iy,N as PN,Q as Vi,R as EN,U as DN,V as My,W as yr,X as RN,Y as ud,Z as IN,_ as Jp,$ as Qp,a0 as kf,a1 as Xp,a2 as MN,a3 as $N,a4 as ON,a5 as BN,a6 as zN,a7 as FN,a8 as Fo,a9 as jf,aa as $y,ab as Oy,ac as By,ad as UN,ae as HN,af as zy,ag as KN,ah as WN,ai as qN,aj as GN,ak as YN,al as JN,am as QN,an as XN,ao as ZN}from"./automation-runs-BxtzDNBD.js";import{S as Sc}from"./spinner-BaYSIBAI.js";import{a as os,b as Kt,d as Bt,e as zt,h as kn,c as qn,i as Fy}from"./dialog-BPAi9RC3.js";import{c as eT,b as Zp,a as e2,D as t2,d as tT}from"./drawer-Rb3VMach.js";import{C as sT}from"./collection-search-CmlhAF0q.js";import{u as Gt,a as nT,m as iT}from"./use-mcp-client-BNj8WwX8.js";import{a as Uo,i as yh,S as Ho,b as rT,g as _h,c as Uy,d as mx,R as oT,e as lT,W as aT,C as cT}from"./constants-dLUUoWH7.js";import{u as Hy,g as Pu,l as im,C as dT,a as uT,b as hT}from"./chart-D5ReNvVa.js";import{t as _s}from"./ChevronDown-CYG4QSfS.js";import{t as fT,z as mT,a as zc,b as s2,u as n2,c as i2}from"./hooks-OOuw421f.js";import{K as pT,i as Ky,u as Ko,a as Wy,m as gT,f as xT}from"./shell-layout-4pJEKgjG.js";import{a as Ms,u as Fc,b as r2,c as bT}from"./use-virtual-mcp-ClsybENf.js";import{w as qy,A as vT,r as ac,b as yT,p as Gy,f as Lh,c as Yy,d as Jy,e as Qy,g as _T,F as LT,h as wT,j as ST,k as kT,l as jT,m as CT,O as NT,n as TT,o as VT}from"./tab-id-BJhTpcjb.js";import{r as Xy,d as Zy,a as o2,p as AT,b as PT,s as ET}from"./session-runtime-wVXsCwcJ.js";import{i as Wo,b as l2,a as DT}from"./XCircle-BWzp7_v9.js";import{f as e6,g as a2,h as Ml,j as t6,n as s6,A as ai,k as n6,l as kc,s as Rr,m as i6,o as qo,p as RT,q as IT,c as r6,r as rm,u as Uc,v as x0,w as MT,x as yi,y as ri,z as $T,B as o6,d as OT,C as Cf,D as $l,E as BT,F as c2,G as l6,H as a6,I as om,J as Y9,K as px,L as Nf,M as zT,N as FT,O as UT,P as HT,Q as KT,R as d2,S as c6,T as Gn,U as u2,V as h2,W as d6,X as u6,Y as h6,Z as WT,_ as f2,$ as qT,a0 as gx,a1 as GT,a2 as YT,t as f6,a3 as yo,a4 as Eu,a5 as JT,i as Tf,a6 as QT,a7 as XT,a8 as ZT,a9 as eV,aa as tV,ab as sV,ac as _o,ad as xx,ae as m6,af as nV,ag as iV,ah as rV,ai as jc,aj as m2,ak as oV,al as bx,am as lV,an as aV,ao as cV,ap as p6,aq as dV,ar as uV,as as hV,at as fV,au as mV,av as pV,aw as gV,ax as xV,ay as g6,az as x6,aA as bV,aB as vV,aC as yV,aD as _V,aE as LV,aF as wV}from"./agent-icon-C0NUu0Dv.js";import{i as qt}from"./Check-Bcnwcxbs.js";import{a as _i,i as SV,b as p2,c as g2}from"./Tool01-CS1WVbOe.js";import{i as Yn}from"./Upload01-BEuKNUVM.js";import{i as bn}from"./AlertCircle-DvlMJzvH.js";import{a as dn}from"./Copy01-D1fa_vNZ.js";import{F as lm,a as x2,b as b2,c as v2,d as b6}from"./form-BEmxbAzw.js";import{d as It,S as ps,a as gs,b as Ns,c as xs}from"./select-BY51Huw5.js";import{t as Vf,a as y2,i as Af}from"./ThumbsUp-Cd4kv7sI.js";import{i as Pf}from"./ArrowLeft-RTJfGYqO.js";import{T as gl,a as Hc,b as tr,c as Du}from"./tabs-C_f6Viy6.js";import{t as am}from"./Tool02-jZCjY4_C.js";import{T as Ef,a as Cc}from"./toggle-group-CGVC-CKF.js";import{I as gt}from"./input-DKMZUsZA.js";import{u as _2,b as L2,c as v6,g as kV,h as jV,C as w2,a as CV,N as NV}from"./use-commerce-diagnostic-E_UCqtaW.js";import{u as y6,M as TV,a as VV,m as Df,i as AV,g as _6,b as PV,N as EV,c as DV}from"./select-model-BzQbpsB5.js";import{s as Li}from"./XClose-BEkgs57b.js";import{a as ms,b as bs,P as vs,c as RV}from"./popover-C0it1EeO.js";import{t as Ar}from"./Stars01-BN2vePFs.js";import{b as IV,a as Rf,c as L6,d as w6,u as S2,e as S6}from"./use-organization-settings-D_NMX4QF.js";import{u as If,a as MV}from"./use-ai-providers-X5gQ6Frj.js";import{g as k2,c as Kc,d as k6,a as sn,r as j6,f as $V,e as OV}from"./agent-capabilities-B52k7xCe.js";import{f as BV,a as zV,u as pu,b as Wc,c as C6,d as FV,e as j2,g as Ll,h as N6,i as C2,j as UV,k as N2,l as T2,m as HV,p as KV,n as WV,o as qV,q as GV,r as YV,F as Ru,t as T6,s as JV,v as V6,S as QV,B as XV,w as A6,x as ZV,R as eA}from"./cards-DQZf9oFU.js";import{c as Xt,D as Zt,b as es,a as Xe,d as Yi,e as Ji,f as Qi,g as cm,h as fc,i as Pr,j as hd}from"./dropdown-menu-DrLVp347.js";import{s as Ht}from"./Plus-CNy9dH9H.js";import{p as tA,q as sA}from"./question-004-sINsf4GQ.js";import{A as Bs}from"./avatar-vk7RnokO.js";import{u as P6,a as Iu}from"./use-members-Bg_K3VT6.js";import{i as nn}from"./ChevronRight-CpQ-XGWn.js";import{u as qc}from"./use-is-desktop-app-BNujXJc_.js";import{i as hi}from"./CheckCircle-CpE2gFL2.js";import{I as Ai}from"./integration-icon-CRsthFhv.js";import{e as Mu}from"./backoff-CrEUbyZT.js";import{u as nA}from"./use-status-sounds-DZu3oH6T.js";import{E as Co}from"./empty-state-B2wH44TC.js";import{T as go,a as iA}from"./toolbar-BuFg3wIL.js";import{b as E6,n as D6}from"./ZapSquare-Cx2KzeH8.js";import{i as No,a as rA}from"./Share07-CxOQdduI.js";import{i as Mn}from"./Globe01-DUNAdl96.js";import{i as R6}from"./Monitor01-BztQffJ4.js";import{u as ci,a as V2,b as A2}from"./use-connection-QgnscFuw.js";import{u as I6,a as P2,b as M6}from"./use-mcp-tools-6tuJyt0H.js";import{g as Mf,M as oA}from"./types-DoWTNUch.js";import{F as lr}from"./file-type-icon-Hqh-VGqi.js";import{d as E2,c as D2,b as lA}from"./TrendUp01-C_nOGhfv.js";import{u as R2,a as $6}from"./use-file-configs-Ox49dnE1.js";import{n as Nc}from"./Download01-uHHa4lEe.js";import{n as xn}from"./LinkExternal01-CYW5qBle.js";import{w as vx,M as $u,F as aA}from"./monaco-editor-uC0FBK2U.js";import{i as $f}from"./Key01-CtlUEn-O.js";import{p as cA,f as dA}from"./pt-BR-CLy76QW2.js";import{g as uA,e as hA}from"./extract-connection-data-Bdjb5ZXD.js";import{a as fA,i as yx}from"./mcp-oauth-DTLy_4G_.js";import{A as To,a as Vo,b as Ao,c as Po,d as Eo,e as Do,f as Ro,g as Io}from"./alert-dialog-B2L8zdte.js";import{T as Ir}from"./textarea-CtFZfz7M.js";import{i as wl}from"./Play-BBuTt-ww.js";import{s as rn}from"./Trash01-Ctsi28Hg.js";import{u as wh}from"./use-debounced-autosave-BGhJv3cs.js";import{S as Go}from"./scroll-area-B4T29_7m.js";import{i as gu}from"./SearchMd-6NHlIJV9.js";import{C as Gc}from"./checkbox-359BBv51.js";import{S as Of}from"./search-input-Cs87u1XL.js";import{C as O6}from"./collection-tabs-CQJ6FTtv.js";import{T as B6,u as z6}from"./use-mcp-auth-status-BuxyzgKj.js";import{n as mA}from"./LockUnlocked01-Camlq0iF.js";import{g as pA,s as F6}from"./connection-slug-eyAPH6o3.js";import{a as gA,i as xA}from"./Settings02-Coch6I-s.js";import{L as Ut}from"./label-BU9Jjv7s.js";import{S as Mr}from"./switch-CL_wNuTg.js";import{d as Yc}from"./delay-CnY5UFtP.js";import{G as Jn}from"./github-icon-DHRjGJq9.js";import{G as I2,u as bA}from"./github-repo-picker-BfQZfVQf.js";import{s as U6}from"./User01-Ds6h02_-.js";import{t as M2}from"./Users01-bpQBejCA.js";import{u as H6,a as K6}from"./use-secrets-DF0Rg5Ke.js";import{a as Ol}from"./format-time-BnbuEtat.js";import{f as W6,g as vA,l as q6,a as yA}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as _A}from"./authenticate-and-persist-oauth-PAJ6c4DM.js";import{X as LA,A as wA,a as SA}from"./AreaChart-Co3sUl8Q.js";import{i as Bf,a as G6,b as $2,n as Bl}from"./Tag01-B6hNMJxH.js";import{s as zf}from"./Flag01-C7lX_ovT.js";import{S as sr,t as Y6}from"./super-agent-icon-ChHyJxMq.js";import{u as J6,a as Q6,b as X6,r as kA,T as jA,c as CA,E as NA,t as TA}from"./task-filters-CM9aziD7.js";import{t as Ou,S as ii,s as Z6,m as e8,T as xo,a as t8,P as Wn,b as Ff,f as VA,i as AA,r as s8,l as PA,c as EA,d as DA,e as RA,g as IA,h as _x,j as MA,H as $A,k as OA}from"./config-BktrQTTP.js";import{B as BA,a as zA,b as Lx,c as FA,d as UA,e as HA}from"./breadcrumb-C9h26hV1.js";import{u as J9}from"./use-copy-D9URxb5f.js";import{i as O2,a as KA,c as WA,b as qA}from"./UserSquare-DVKafobf.js";import{R as GA,a as YA,S as ks,D as JA,i as n8,n as QA,b as XA}from"./task-board-DJY41XW8.js";import{i as B2,c as i8}from"./SwitchHorizontal01-DfXXgPLT.js";import{C as hr,a as Pi,b as Ei,c as di,d as Cs,e as qs,f as ZA,g as wx}from"./command-B54aL3fS.js";import{g as En}from"./get-initials-D-f_fDFw.js";import{u as eP}from"./use-org-auth-client-YSRXYZJk.js";import{u as z2,a as tP,b as sP}from"./use-tags-NRFc9Kma.js";import{i as Uf}from"./ChevronSelectorVertical-CD6IG3xp.js";import{i as Hf}from"./SearchLg-C50f6-iX.js";import{u as dm,a as nP,c as iP,p as r8,b as rP,s as um,n as oP}from"./self-tool-result-CEMUyQFk.js";import{a as hm}from"./Palette-7eulFGyg.js";import{s as Bu}from"./Eye-DQbrUXqj.js";import{i as F2}from"./DotsVertical-CKqcdQY1.js";import{u as Kf}from"./use-debounced-value-C3rowxeM.js";import{u as o8}from"./useInfiniteQuery-BSIOCSh6.js";import{i as l8}from"./FilterLines-FKz5JmaU.js";import{i as wi}from"./Zap-CxJvVyr1.js";import{B as lP}from"./badge-CkLXXL_T.js";import{u as zu,a as aP,b as cP,c as dP,d as uP}from"./use-automations-C3qK2rmP.js";import{s as Gd,n as hP}from"./Stars02-C-goK6F_.js";import{A as fP}from"./automation-list-row-z1ftMX8t.js";import{t as mP}from"./site-error--i37Vnuw.js";import{u as pP,a as gP}from"./use-org-repo-syncs-hB2RbIfF.js";import{n as a8}from"./ChevronUp-DmLHjlB8.js";function c8(t,e){const s=as(e);return xP({filters:{...t,status:"pending"}},s).length}function Sx(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function xP(t={},e){const s=as(e).getMutationCache(),n=P.useRef(t),i=P.useRef(null);return i.current===null&&(i.current=Sx(s,t)),P.useEffect(()=>{n.current=t}),P.useSyncExternalStore(P.useCallback(o=>s.subscribe(()=>{const l=yC(i.current,Sx(s,n.current));i.current!==l&&(i.current=l,_C.schedule(o))}),[s]),()=>i.current,()=>i.current)}const Ed=Rt({connection_id:Ee().describe("Connection ID"),selected_tools:js(Ee()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:js(Ee()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:js(Ee()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),d8=Ed.extend({selected_tools:Ed.shape.selected_tools.optional(),selected_resources:Ed.shape.selected_resources.optional(),selected_prompts:Ed.shape.selected_prompts.optional()}),bP=Rt({connectionId:Ee(),toolName:Ee(),label:Ee(),icon:Ee().nullable().optional()}),vP=Rt({id:Ee().describe("Stable id; used as React key and ?tab= value"),title:Ee().describe("Tab label"),icon:Ee().optional().describe("Optional lucide icon name"),view:Rt({type:nm("ext-app"),appId:Ee(),args:du(Ee(),ny()).optional()})}),u8=dr(["off","manual","auto"]),yP=Rt({defaultMainView:Rt({type:Ee(),id:Ee().optional(),toolName:Ee().optional()}).nullable().optional(),chatDefaultOpen:rr().nullable().optional(),cmsDefaultOpen:rr().nullable().optional(),cms:u8.nullable().optional().describe("How this agent offers content editing. Absent falls back to cmsDefaultOpen."),tabs:js(vP).optional()});function Fu(t){return t?.cms?t.cms:t?.cmsDefaultOpen?"auto":"manual"}function _P(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"preview"}}:{}}}const kx=Rt({tileId:Ee().optional(),connectionId:Ee().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Ee().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Ee().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:du(Ee(),ny()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:bi().int().positive().optional(),maxHeight:bi().int().positive().optional()}),U2=Rt({banner:Ee().nullable().optional(),bannerColor:Ee().nullable().optional(),icon:Ee().nullable().optional(),themeColor:Ee().nullable().optional(),pinnedViews:js(bP).nullable().optional(),layout:yP.nullable().optional(),homeTile:kx.nullable().optional(),homeTiles:js(kx).nullable().optional(),homePrompts:js(Ee()).nullable().optional()});function Tc(t){const e=t?.homeTiles;if(Array.isArray(e)&&e.length>0)return e;const s=t?.homeTile;return s?[s]:[]}const Uu=/^[A-Za-z_][A-Za-z0-9_]*$/,jx=Ee().min(1).regex(Uu,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),LP=wC("kind",[Rt({key:jx,kind:nm("literal"),value:Ee()}),Rt({key:jx,kind:nm("secret"),secretId:Ee().min(1)})]),H2=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,wP=Rt({host:Ee().min(1).regex(H2).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Ee().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),K2=Rt({selected:Ee().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Ee().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Ee().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:js(LP).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:js(wP).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),W2=Rt({url:Ee().describe("GitHub repository URL"),owner:Ee().describe("Repository owner"),name:Ee().describe("Repository name"),installationId:bi().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Ee().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),SP=dr(["agent-sandbox","local-api"]),kP={sandboxHandle:Ee().describe("Provider-specific handle"),previewUrl:Ee().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Ee().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:bi().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Rt({packageManager:Ee().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Ee().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Ee().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},h8=Rt(kP);function jP(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,i]of Object.entries(e))if(!(!i||typeof i!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=h8.parse(i)}catch{}return s}const CP=du(Ee().describe("userId"),du(Ee().describe("branch"),LC(SP,h8))),NP=Rt({id:Ee().describe("Stable identifier for this knowledge file"),name:Ee().describe("File name shown in the UI"),kind:dr(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Ee().describe("Org filesystem (Library) volume the file lives in"),path:Ee().describe("Path within the volume"),url:Ee().describe("Same-origin URL to read the file (display/download)"),contentType:Ee().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:bi().nullable().optional().describe("File size in bytes"),addedAt:Ee().describe("ISO timestamp when the file was attached")}),q2=js(NP).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),TP=dr(["smart","code-review","open"]),G2=TP.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),Y2=rr().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),J2=Ee().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),VP=Rt({id:Ee().describe("Unique identifier"),title:Ee().describe("Human-readable name"),description:Ee().nullable().describe("Description"),icon:Ee().nullable().describe("Icon URL"),created_at:Ee().describe("Creation timestamp"),updated_at:Ee().describe("Last update timestamp"),created_by:Ee().describe("User ID who created this item"),updated_by:Ee().optional().describe("User ID who last updated this item"),organization_id:Ee().describe("Organization ID this item belongs to"),status:dr(["active","inactive"]).describe("Current status"),pinned:rr().describe("Whether this space is pinned to the sidebar"),metadata:Rt({instructions:Ee().nullable().describe("Instructions also used as system prompt"),enabled_plugins:js(Ee()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:js(Ee()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ee().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:U2.nullable().optional().describe("UI customization settings"),githubRepo:W2.nullable().optional().describe("Linked GitHub repository"),runtime:K2.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:CP.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:q2,siteSlug:Ee().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:G2,previewServerUrl:J2,productionUrl:Ee().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:rr().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Y2}).loose().describe("Metadata"),connections:js(Ed).describe("Connections with their selected tools, resources, and prompts")}),f8=Rt({title:Ee().min(1).max(120).describe("Short label shown on the chip"),description:Ee().max(280).optional().describe("One-line subtitle shown under the title"),text:Ee().min(1).describe("The message sent to the agent when the prompt is clicked")});Rt({title:Ee().min(1).max(255).describe("Name for the virtual MCP"),description:Ee().nullable().optional().describe("Optional description"),icon:Ee().nullish().describe("Optional icon URL"),status:dr(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:rr().optional().default(!1).describe("Pin to sidebar"),metadata:Rt({instructions:Ee().nullable().optional().describe("MCP server instructions"),enabled_plugins:js(Ee()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:js(Ee()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ee().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:U2.nullable().optional().describe("UI customization settings"),githubRepo:W2.nullable().optional().describe("Linked GitHub repository"),runtime:K2.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:q2,siteSlug:Ee().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:G2,previewServerUrl:J2,productionUrl:Ee().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:rr().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Y2}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:js(d8).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:js(f8).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Rt({title:Ee().min(1).max(255).optional().describe("New name"),description:Ee().nullable().optional().describe("New description (null to clear)"),icon:Ee().nullish().describe("New icon URL"),status:dr(["active","inactive"]).optional().describe("New status"),pinned:rr().optional().describe("Pin/unpin from sidebar"),metadata:Rt({instructions:Ee().nullable().optional().describe("MCP server instructions"),enabled_plugins:js(Ee()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:js(Ee()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ee().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:U2.nullable().optional().describe("UI customization settings"),githubRepo:W2.nullable().optional().describe("Linked GitHub repository"),runtime:K2.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:q2,siteSlug:Ee().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:G2,previewServerUrl:J2,productionUrl:Ee().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:rr().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Y2}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:js(d8).optional().describe("New connections (replaces existing)"),prompts:js(f8).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});const Cx=3,m8="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",AP="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function p8(t){const e=z.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:o,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const k=er(c._meta);d=c.title??Yp(c.name,k),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(a==="card"){let k;e[4]!==n||e[5]!==c?(k=()=>n(c),e[4]=n,e[5]=c,e[6]=k):k=e[6];const w=o||i,j=i&&"bg-accent/40",N=(o||i)&&"cursor-not-allowed opacity-50";let T;e[7]!==j||e[8]!==N?(T=ie(AP,"hover:bg-accent/60 text-foreground",j,N),e[7]=j,e[8]=N,e[9]=T):T=e[9];let C;e[10]!==u?(C=r.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=C):C=e[11];let V;e[12]!==i?(V=i&&r.jsx(Sc,{size:"xs"}),e[12]=i,e[13]=V):V=e[13];let A;e[14]!==C||e[15]!==V?(A=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C,V]}),e[14]=C,e[15]=V,e[16]=A):A=e[16];let E;e[17]!==h?(E=h&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=E):E=e[18];let D;return e[19]!==A||e[20]!==E||e[21]!==k||e[22]!==w||e[23]!==T?(D=r.jsxs("button",{type:"button",onClick:k,disabled:w,className:T,children:[A,E]}),e[19]=A,e[20]=E,e[21]=k,e[22]=w,e[23]=T,e[24]=D):D=e[24],D}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=o||i,p=i&&"bg-muted/50",g=(o||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=ie(m8,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==u?(b=r.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&r.jsx(Sc,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let L;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(L=r.jsx(He,{asChild:!0,children:r.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=L):L=e[40];const _=h??u;let y;e[41]!==_?(y=r.jsx(Ke,{side:"top",className:"max-w-xs",children:r.jsx("p",{className:"text-xs",children:_})}),e[41]=_,e[42]=y):y=e[42];let S;return e[43]!==L||e[44]!==y?(S=r.jsxs(We,{delayDuration:400,children:[L,y]}),e[43]=L,e[44]=y,e[45]=S):S=e[45],S}function PP(t){const e=z.c(61),{items:s,open:n,onOpenChange:i,onSelect:o,loadingPrompt:l}=t,a=re(),[c,d]=P.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(C=>{const V=c.toLowerCase();return C.prompt.name.toLowerCase().includes(V)||(C.prompt.title??"").toLowerCase().includes(V)||(C.prompt.description??"").toLowerCase().includes(V)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=zo();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&r.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==u||e[9]!==l?.name||e[10]!==i||e[11]!==o){let C;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==o?(C=V=>r.jsx(p8,{item:V,variant:"card",onSelect:A=>{i(!1),o(A)},isLoading:l?.name===V.prompt.name,isDisabled:u&&l?.name!==V.prompt.name},V.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=o,e[17]=C):C=e[17],g=f.map(C),e[7]=f,e[8]=u,e[9]=l?.name,e[10]=i,e[11]=o,e[12]=g}else g=e[12];let x;e[18]!==p||e[19]!==g?(x=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:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==a?(v=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=v):v=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=C=>{C.key==="Escape"&&d("")},e[23]=L):L=e[23];let _;e[24]!==c||e[25]!==v?(_=r.jsx(sT,{value:c,onChange:d,placeholder:v,onKeyDown:L}),e[24]=c,e[25]=v,e[26]=_):_=e[26];const y=_;if(m){let C;e[27]!==a?(C=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=C):C=e[28];let V;e[29]!==C?(V=r.jsx(eT,{className:"sr-only",children:r.jsx(Zp,{children:C})}),e[29]=C,e[30]=V):V=e[30];let A;e[31]!==a?(A=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=A):A=e[32];let E;e[33]!==A?(E=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:A})}),e[33]=A,e[34]=E):E=e[34];let D;e[35]!==b||e[36]!==y||e[37]!==E||e[38]!==V?(D=r.jsxs(e2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[V,E,y,b]}),e[35]=b,e[36]=y,e[37]=E,e[38]=V,e[39]=D):D=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==D?(I=r.jsx(Dr,{delayDuration:400,children:r.jsx(t2,{open:n,onOpenChange:i,children:D})}),e[40]=i,e[41]=n,e[42]=D,e[43]=I):I=e[43],I}let S;e[44]!==a?(S=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=S):S=e[45];let k;e[46]!==S?(k=r.jsx(os,{className:"sr-only",children:r.jsx(Kt,{children:S})}),e[46]=S,e[47]=k):k=e[47];let w;e[48]!==a?(w=a("chat.iceBreakers.promptsLabel"),e[48]=a,e[49]=w):w=e[49];let j;e[50]!==w?(j=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:w})}),e[50]=w,e[51]=j):j=e[51];let N;e[52]!==b||e[53]!==y||e[54]!==j||e[55]!==k?(N=r.jsxs(Bt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[k,j,y,b]}),e[52]=b,e[53]=y,e[54]=j,e[55]=k,e[56]=N):N=e[56];let T;return e[57]!==i||e[58]!==n||e[59]!==N?(T=r.jsx(Dr,{delayDuration:400,children:r.jsx(zt,{open:n,onOpenChange:i,children:N})}),e[57]=i,e[58]=n,e[59]=N,e[60]=T):T=e[60],T}function EP(t){const e=z.c(30),{items:s,onSelect:n,loadingPrompt:i,className:o}=t,l=re(),[a,c]=P.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,Cx),v=s.slice(Cx),L=!!i;let _;e[10]!==L||e[11]!==i?.name||e[12]!==n?(_=S=>r.jsx(p8,{item:S,onSelect:n,isLoading:i?.name===S.prompt.name,isDisabled:L&&i?.name!==S.prompt.name},S.prompt.name),e[10]=L,e[11]=i?.name,e[12]=n,e[13]=_):_=e[13];const y=b.map(_);d=Dr,m=400,e[14]!==o?(u=ie("w-full flex flex-wrap gap-2 justify-center",o),e[14]=o,e[15]=u):u=e[15],h=y,f=v.length>0&&r.jsx("button",{type:"button",disabled:L,onClick:()=>c(!0),className:ie(m8,"hover:bg-muted/70 hover:text-foreground",L&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=o,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=u,e[7]=h,e[8]=f,e[9]=m}else d=e[5],u=e[6],h=e[7],f=e[8],m=e[9];let p;e[16]!==u||e[17]!==h||e[18]!==f?(p=r.jsxs("div",{className:u,children:[h,f]}),e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=r.jsx(PP,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=r.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function DP(){return null}function RP(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 IP(t){const e=z.c(31),{connectionId:s}=t,n=re(),{sendMessage:i}=ui(),{org:o}=Fe();let l;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(l={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=l):l=e[3];const a=Gt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=Hy(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const h=u;let f;e[8]!==h?(f=h.map(MP),e[8]=h,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=P.useReducer(RP,p),[b,v]=P.useState(null);let L;e[11]!==a||e[12]!==i||e[13]!==n?(L=async(A,E)=>{if(!a){ge.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const D=await Pu(a,A.name,E);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[yf({id:A.name,name:Bc(A.name,er(A._meta)),metadata:D.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(I)}catch(D){console.error("[ice-breakers] Failed to fetch prompt:",D),ge.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=L):L=e[14];const _=L;let y;e[15]!==_?(y=async A=>{if(A.arguments&&A.arguments.length>0){x({type:"SELECT_PROMPT",prompt:A}),v(A);return}x({type:"START_LOADING",prompt:A}),await _(A)},e[15]=_,e[16]=y):y=e[16];const S=y;let k;e[17]!==b||e[18]!==_?(k=async A=>{b&&(x({type:"START_LOADING",prompt:b,arguments:A}),v(null),await _(b,A))},e[17]=b,e[18]=_,e[19]=k):k=e[19];const w=k;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let N;e[20]!==S||e[21]!==m||e[22]!==j?(N=r.jsx(EP,{items:m,onSelect:S,loadingPrompt:j}),e[20]=S,e[21]=m,e[22]=j,e[23]=N):N=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v(null),x({type:"RESET"})},e[24]=T):T=e[24];let C;e[25]!==b||e[26]!==w?(C=r.jsx(mu,{prompt:b,setPrompt:T,onSubmit:w}),e[25]=b,e[26]=w,e[27]=C):C=e[27];let V;return e[28]!==N||e[29]!==C?(V=r.jsxs(r.Fragment,{children:[N,C]}),e[28]=N,e[29]=C,e[30]=V):V=e[30],V}function MP(t){return{prompt:t}}function $P(t){const e=z.c(13),{className:s}=t,{selectedVirtualMcp:n}=Il(),{org:i}=Fe();let o;e[0]!==i.id?(o=Uo(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=o.id,a=n?.id??l;let c;e[2]!==s?(c=ie("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(DP,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=r.jsx(IP,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=r.jsx(Ws,{fallback:null,children:r.jsx(P.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}const Q9="cubic-bezier(0.645, 0.045, 0.355, 1)",OP=44,BP={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},zP={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},FP={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Mo(t){const e=z.c(69),{icon:s,label:n,count:i,title:o,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=re(),[p,g]=P.useState(d),[x,b]=P.useState(!1);let v;e[0]!==h?(v=()=>{b(!0),h?.()},e[0]=h,e[1]=v):v=e[1];const L=v;if(x)return null;const _=zP[f],y=BP[f];let S;e[2]!==_||e[3]!==y?(S=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",_,y),e[2]=_,e[3]=y,e[4]=S):S=e[4];let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=()=>g(UP),e[5]=k):k=e[5];const w=p&&"rounded-b-none",j=!p&&"rounded-b-xl";let N;e[6]!==w||e[7]!==j?(N=ie("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",w,j),e[6]=w,e[7]=j,e[8]=N):N=e[8];const T=FP[f];let C;e[9]!==T?(C=ie("shrink-0",T),e[9]=T,e[10]=C):C=e[10];let V;e[11]!==s||e[12]!==C?(V=r.jsx("span",{className:C,children:s}),e[11]=s,e[12]=C,e[13]=V):V=e[13];let A;e[14]!==n?(A=r.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=A):A=e[15];let E;e[16]!==i?(E=i?r.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=E):E=e[17];const D=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==D?(I=r.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:r.jsx(_s,{size:16,style:{transform:D,transition:`transform 180ms ${Q9}`}})}),e[18]=D,e[19]=I):I=e[19];let R;e[20]!==m?(R=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=R):R=e[21];let $;e[22]!==m?($=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=$):$=e[23];let B,M;e[24]!==L?(B=Q=>{Q.stopPropagation(),L()},M=Q=>{(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),Q.stopPropagation(),L())},e[24]=L,e[25]=B,e[26]=M):(B=e[25],M=e[26]);let O;e[27]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(Is,{size:16}),e[27]=O):O=e[27];let F;e[28]!==R||e[29]!==$||e[30]!==B||e[31]!==M?(F=r.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":R,title:$,onClick:B,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:O}),e[28]=R,e[29]=$,e[30]=B,e[31]=M,e[32]=F):F=e[32];let U;e[33]!==p||e[34]!==V||e[35]!==A||e[36]!==E||e[37]!==I||e[38]!==F||e[39]!==N?(U=r.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:k,className:N,children:[V,A,E,I,F]}),e[33]=p,e[34]=V,e[35]=A,e[36]=E,e[37]=I,e[38]=F,e[39]=N,e[40]=U):U=e[40];const K=p?"1fr":"0fr";let q;e[41]!==K?(q={display:"grid",gridTemplateRows:K,transition:`grid-template-rows 180ms ${Q9}`},e[41]=K,e[42]=q):q=e[42];let W;e[43]===Symbol.for("react.memo_cache_sentinel")?(W={overflow:"hidden",minHeight:0},e[43]=W):W=e[43];const G=p?1:0;let Y;e[44]!==G?(Y={opacity:G,transition:`opacity 120ms ${Q9}`,maxHeight:"60vh"},e[44]=G,e[45]=Y):Y=e[45];let ee;e[46]!==o?(ee=o?r.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:r.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:o})}):r.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=o,e[47]=ee):ee=e[47];let ne;e[48]!==c||e[49]!==o?(ne=c?r.jsx("div",{className:ie("pb-4",!o&&"pt-4"),children:c}):null,e[48]=c,e[49]=o,e[50]=ne):ne=e[50];let oe;e[51]!==ee||e[52]!==ne?(oe=r.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[ee,ne]}),e[51]=ee,e[52]=ne,e[53]=oe):oe=e[53];let Z;e[54]!==l||e[55]!==a?(Z=l||a?r.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{children:l}),r.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=Z):Z=e[56];let J;e[57]!==Y||e[58]!==oe||e[59]!==Z?(J=r.jsx("div",{style:W,children:r.jsxs("div",{className:"flex flex-col",style:Y,children:[oe,Z]})}),e[57]=Y,e[58]=oe,e[59]=Z,e[60]=J):J=e[60];let H;e[61]!==q||e[62]!==J?(H=r.jsx("div",{"data-testid":"collapsible-highlight-body",style:q,children:J}),e[61]=q,e[62]=J,e[63]=H):H=e[63];let se;return e[64]!==U||e[65]!==H||e[66]!==S||e[67]!==f?(se=r.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:S,children:[U,H]}),e[64]=U,e[65]=H,e[66]=S,e[67]=f,e[68]=se):se=e[68],se}function UP(t){return!t}const HP=Rt({content:Ee().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:dr(["pending","in_progress","completed"]),activeForm:Ee().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),g8=Rt({todos:js(HP)}),KP="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";fT({description:KP,inputSchema:mT(g8),execute:async({todos:t})=>({ok:!0,count:t.length})});const WP="tool-todo_write",qP=new Set(["input-available","output-available"]);function GP(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let i=n.length-1;i>=0;i--){const o=n[i];if(o.type!==WP||typeof o.state!="string"||!qP.has(o.state))continue;const l=g8.safeParse(o.input);if(l.success)return l.data.todos}}return[]}function x8(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 n="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:n,friendlyName:_l(uN(n)),input:s.input})}return e}function b8(t){return t.at(-1)}function v8(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function YP(t){return t?t.message.startsWith("[CREDITS]"):!1}const JP="[SUBSCRIPTION_REQUIRED]";function y8(t){return t?.message.startsWith(JP)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const QP={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function XP(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=t;if(!i&&s&&YP(s))return{...QP,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(_=>_.type==="tool-user_ask").filter(_=>_.state!=="output-available").length,h=v8(a),f=x8(c),m=GP(e),p=i?null:y8(s),g=!i&&!!s&&!p,x=f.length>0||i&&o,b=h.length>0,L=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:L,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function _8(){const t=z.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:o}=ui(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==o||t[2]!==e||t[3]!==l||t[4]!==a?(c=XP({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:o}),t[0]=i,t[1]=o,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function ZP(){const t=_8();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function L8(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)}const eE="__home__";function Q2(t,e){return Kp.chatDraft(t,e)}function tE(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function w8(t,e,s,n,i){const o=Q2(e,s);if(L8(n)){t.removeItem(o);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(o,a)}catch(c){if(nE(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function Nx(t,e,s){const n=Q2(e,s),i=t.getItem(n),o=tE(i);return i!==null&&o===null&&t.removeItem(n),o}function sE(t,e,s){t.removeItem(Q2(e,s))}function nE(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Cn(t){const e=z.c(14),s=Ms(t),n=Ts(),i=s?.metadata,o=n?.activeTask,l=o?.metadata?.runtime;let a;e[0]!==l?(a=AT(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!o&&!o.partial,u=o?.metadata;let h;e[2]!==i||e[3]!==u?(h=Xy(u,i),e[2]=i,e[3]=u,e[4]=h):h=e[4];const f=!!c||d&&!!s;let m;e[5]!==i?(m=Zy(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=o2(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:h,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function iE(t){const e=z.c(30),{current:s,total:n,onPrev:i,onNext:o}=t,l=re();if(n<=1)return null;const a=s===0,c=s===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let d;e[0]!==c?(d=ie("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==l?(u=l("chat.pagination.previousLabel"),e[2]=l,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(Pf,{size:14}),e[4]=h):h=e[4];let f;e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u?(f=r.jsx("button",{type:"button",onClick:i,disabled:a,className:d,"aria-label":u,children:h}),e[5]=i,e[6]=a,e[7]=d,e[8]=u,e[9]=f):f=e[9];const m=s+1;let p;e[10]!==l||e[11]!==m||e[12]!==n?(p=l("chat.pagination.counter",{current:m,total:n}),e[10]=l,e[11]=m,e[12]=n,e[13]=p):p=e[13];let g;e[14]!==p?(g=r.jsx("span",{className:"tabular-nums text-xs",children:p}),e[14]=p,e[15]=g):g=e[15];const x=s===n-1,b=s===n-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let v;e[16]!==b?(v=ie("p-0.5 rounded transition-colors",b),e[16]=b,e[17]=v):v=e[17];let L;e[18]!==l?(L=l("chat.pagination.nextLabel"),e[18]=l,e[19]=L):L=e[19];let _;e[20]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(Wo,{size:14}),e[20]=_):_=e[20];let y;e[21]!==o||e[22]!==x||e[23]!==v||e[24]!==L?(y=r.jsx("button",{type:"button",onClick:o,disabled:x,className:v,"aria-label":L,children:_}),e[21]=o,e[22]=x,e[23]=v,e[24]=L,e[25]=y):y=e[25];let S;return e[26]!==y||e[27]!==f||e[28]!==g?(S=r.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[f,g,y]}),e[26]=y,e[27]=f,e[28]=g,e[29]=S):S=e[29],S}function S8(t){const e=z.c(8),{currentIndex:s,total:n,onPrev:i,onNext:o,extraLeft:l}=t;let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a=r.jsx(iE,{current:s,total:n,onPrev:i,onNext:o}),e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==l||e[6]!==a?(c=r.jsxs("div",{className:"flex items-center gap-2",children:[a,l]}),e[5]=l,e[6]=a,e[7]=c):c=e[7],c}function rE(t){const e=z.c(17),{isStreaming:s,isAllAnswered:n,isCurrentAnswered:i,onAdvanceOrSubmit:o,submitLabel:l,nextLabel:a}=t,u=n?l===void 0?"Submit":l:a===void 0?"Next":a,h=n?s:!i,f=h?n?"Waiting for the assistant to finish…":"Answer this item to continue":null;let m;e[0]!==h||e[1]!==o?(m=()=>{h||o()},e[0]=h,e[1]=o,e[2]=m):m=e[2];const p=h&&"opacity-50 cursor-not-allowed";let g;e[3]!==p?(g=ie("h-7 px-2.5 text-xs",p),e[3]=p,e[4]=g):g=e[4];let x;e[5]!==h||e[6]!==u||e[7]!==m||e[8]!==g?(x=r.jsx(he,{type:"button",size:"sm","aria-disabled":h,onClick:m,className:g,children:u}),e[5]=h,e[6]=u,e[7]=m,e[8]=g,e[9]=x):x=e[9];const b=x;if(!f)return b;let v;e[10]!==b?(v=r.jsx(He,{asChild:!0,children:b}),e[10]=b,e[11]=v):v=e[11];let L;e[12]!==f?(L=r.jsx(Ke,{children:f}),e[12]=f,e[13]=L):L=e[13];let _;return e[14]!==v||e[15]!==L?(_=r.jsxs(We,{children:[v,L]}),e[14]=v,e[15]=L,e[16]=_):_=e[16],_}function k8(t,e,s){return t.findIndex(n=>e(n)===s)}function Tx(t,e,s,n){return t.length===0?!1:t.every(i=>n(s[e(i)]))}function Vx(t,e,s,n,i){if(t.length===0)return null;const o=k8(t,e,i);for(let l=1;l<=t.length;l++){const a=t[(o+l)%t.length];if(!a)continue;const c=e(a);if(c!==i&&!n(s[c]))return c}return null}function oE(t){return!t.isStreaming&&t.allAnswered}function j8(t){const{parts:e,partKey:s,schema:n,defaultValues:i,isStreaming:o,hasAnswer:l,onSubmit:a}=t,c=e[0]?s(e[0]):"",[d,u]=P.useState(c),[h,f]=P.useState(!1),m=Wp({resolver:iy(n),defaultValues:i}),p=m.watch(),g=k8(e,s,d),x=g>=0?e[g]:void 0,b=l(p[d]),v=Tx(e,s,p,l),L=oE({isStreaming:o,allAnswered:v}),_=()=>{if(g>0){const T=e[g-1];T&&u(s(T))}},y=()=>{if(g>=0&&g<e.length-1){const T=e[g+1];T&&u(s(T))}},S=()=>{const T=m.getValues(),C=Vx(e,s,T,l,d);C&&u(C)},k=()=>{m.handleSubmit(T=>{const C=T;for(const V of e)a(V,C[s(V)])})()},w=P.useRef(k);w.current=k;const j=()=>{L&&(f(!1),w.current())},N=()=>{const T=m.getValues();if(Tx(e,s,T,l)){if(o){f(!0);return}f(!1),w.current()}else{const C=Vx(e,s,T,l,d);C&&u(C)}};return P.useEffect(()=>{if(h&&!o){if(!v){f(!1);return}f(!1),w.current()}},[h,o,v]),{form:m,activeKey:d,setActiveKey:u,currentIndex:g,currentPart:x,isCurrentAnswered:b,isAllAnswered:v,canSubmit:L,goPrev:_,goNext:y,advanceToNextUnanswered:S,submit:j,submitOrAdvance:N}}const C8="chat.approval.defaultDenyReason";function N8(t){const e=z.c(36),{onYolo:s}=t,n=re(),[i,o]=Ti();let l,a,c,d,u,h,f,m,p;if(e[0]!==s||e[1]!==i||e[2]!==o||e[3]!==n){const _=ul.find(k=>k.value===i.toolApprovalLevel)??ul[0];let y;e[13]!==s||e[14]!==i||e[15]!==o?(y=k=>{const w=k,j=i.toolApprovalLevel??"readonly";o({...i,toolApprovalLevel:w}),w==="auto"&&s(j)},e[13]=s,e[14]=i,e[15]=o,e[16]=y):y=e[16];const S=y;c=ps,m=i.toolApprovalLevel,p=S,a=gs,u="xs",h="text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",f=lE,l=Ns,d=n(_.shortKey),e[0]=s,e[1]=i,e[2]=o,e[3]=n,e[4]=l,e[5]=a,e[6]=c,e[7]=d,e[8]=u,e[9]=h,e[10]=f,e[11]=m,e[12]=p}else l=e[4],a=e[5],c=e[6],d=e[7],u=e[8],h=e[9],f=e[10],m=e[11],p=e[12];let g;e[17]!==l||e[18]!==d?(g=r.jsx(l,{children:d}),e[17]=l,e[18]=d,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==u||e[22]!==h||e[23]!==f||e[24]!==g?(x=r.jsx(a,{size:u,className:h,onClick:f,children:g}),e[20]=a,e[21]=u,e[22]=h,e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==n?(b=ul.map(_=>r.jsx(It,{value:_.value,children:n(_.labelKey)},_.value)),e[26]=n,e[27]=b):b=e[27];let v;e[28]!==b?(v=r.jsx(xs,{children:b}),e[28]=b,e[29]=v):v=e[29];let L;return e[30]!==c||e[31]!==v||e[32]!==m||e[33]!==p||e[34]!==x?(L=r.jsxs(c,{value:m,onValueChange:p,children:[x,v]}),e[30]=c,e[31]=v,e[32]=m,e[33]=p,e[34]=x,e[35]=L):L=e[35],L}function lE(t){return t.stopPropagation()}function T8(t){const e=z.c(8),{input:s}=t,n=re();if(s==null){let l;e[0]!==n?(l=n("chat.approval.noInput"),e[0]=n,e[1]=l):l=e[1];let a;return e[2]!==l?(a=r.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:l}),e[2]=l,e[3]=a):a=e[3],a}let i;try{let l;e[4]!==s?(l=JSON.stringify(s,null,2),e[4]=s,e[5]=l):l=e[5],i=l}catch{i=String(s)}let o;return e[6]!==i?(o=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[6]=i,e[7]=o):o=e[7],o}function aE(t){const e=z.c(38),{approval:s,onRespond:n}=t,i=re(),[o]=Ti(),l=o.toolApprovalLevel??"readonly";let a;e[0]!==s.approvalId||e[1]!==l||e[2]!==n||e[3]!==i?(a=()=>n(s.approvalId,!1,i(C8),l),e[0]=s.approvalId,e[1]=l,e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;e[5]!==s.approvalId||e[6]!==l||e[7]!==n?(d=()=>n(s.approvalId,!0,void 0,l),e[5]=s.approvalId,e[6]=l,e[7]=n,e[8]=d):d=e[8];const u=d;let h;e[9]!==s.approvalId||e[10]!==n?(h=j=>n(s.approvalId,!0,void 0,j),e[9]=s.approvalId,e[10]=n,e[11]=h):h=e[11];const f=h;let m;e[12]!==f?(m=r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(N8,{onYolo:f})}),e[12]=f,e[13]=m):m=e[13];const p=m;let g;e[14]!==i?(g=i("chat.approval.denyButton"),e[14]=i,e[15]=g):g=e[15];let x;e[16]!==c||e[17]!==g?(x=r.jsx(he,{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:c,children:g}),e[16]=c,e[17]=g,e[18]=x):x=e[18];let b;e[19]!==i?(b=i("chat.approval.acceptButton"),e[19]=i,e[20]=b):b=e[20];let v;e[21]!==u||e[22]!==b?(v=r.jsx(he,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:b}),e[21]=u,e[22]=b,e[23]=v):v=e[23];let L;e[24]!==x||e[25]!==v?(L=r.jsxs(r.Fragment,{children:[x,v]}),e[24]=x,e[25]=v,e[26]=L):L=e[26];const _=L;let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Vf,{size:14}),e[27]=y):y=e[27];let S;e[28]!==i?(S=i("chat.approval.needsApproval"),e[28]=i,e[29]=S):S=e[29];let k;e[30]!==s.input?(k=r.jsx(T8,{input:s.input}),e[30]=s.input,e[31]=k):k=e[31];let w;return e[32]!==s.friendlyName||e[33]!==p||e[34]!==_||e[35]!==S||e[36]!==k?(w=r.jsx(Mo,{icon:y,label:S,title:s.friendlyName,defaultExpanded:!0,footerLeft:p,footerRight:_,children:k}),e[32]=s.friendlyName,e[33]=p,e[34]=_,e[35]=S,e[36]=k,e[37]=w):w=e[37],w}const cE=du(Ee(),Rt({approved:rr().optional(),levelOverride:dr(["auto","readonly"]).optional()}));function dE(t){const e=z.c(46),{approvals:s,isStreaming:n,onRespond:i}=t,o=re(),[l]=Ti(),a=l.toolApprovalLevel??"readonly";let c;e[0]!==s?(c=Object.fromEntries(s.map(fE)),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==a||e[3]!==i||e[4]!==o?(u=(C,V)=>{const A=V;typeof A?.approved=="boolean"&&i(C.approvalId,A.approved,A.approved===!1?o(C8):void 0,A.levelOverride??a)},e[2]=a,e[3]=i,e[4]=o,e[5]=u):u=e[5];let h;e[6]!==s||e[7]!==d||e[8]!==n||e[9]!==u?(h={parts:s,partKey:hE,schema:cE,defaultValues:d,isStreaming:n,hasAnswer:uE,onSubmit:u},e[6]=s,e[7]=d,e[8]=n,e[9]=u,e[10]=h):h=e[10];const f=j8(h);let m;e[11]!==s||e[12]!==f?(m=C=>{f.form.reset(Object.fromEntries(s.map(V=>[V.approvalId,{approved:!0,levelOverride:C}]))),f.submitOrAdvance()},e[11]=s,e[12]=f,e[13]=m):m=e[13];const p=m,g=f.currentPart,x=f.form;let b;e[14]!==f?(b=C=>{C.preventDefault(),f.submit()},e[14]=f,e[15]=b):b=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(Vf,{size:14}),e[16]=v):v=e[16];let L;e[17]!==s.length||e[18]!==o?(L=o("chat.approval.batchedLabel",{count:s.length}),e[17]=s.length,e[18]=o,e[19]=L):L=e[19];const _=g?.friendlyName??"";let y;e[20]!==p?(y=r.jsx(N8,{onYolo:p}),e[20]=p,e[21]=y):y=e[21];let S;e[22]!==s.length||e[23]!==f.currentIndex||e[24]!==f.goNext||e[25]!==f.goPrev||e[26]!==y?(S=r.jsx(S8,{currentIndex:f.currentIndex,total:s.length,onPrev:f.goPrev,onNext:f.goNext,extraLeft:y}),e[22]=s.length,e[23]=f.currentIndex,e[24]=f.goNext,e[25]=f.goPrev,e[26]=y,e[27]=S):S=e[27];let k;e[28]!==g||e[29]!==f.form.control||e[30]!==f.submitOrAdvance?(k=g?r.jsx(mE,{approvalId:g.approvalId,control:f.form.control,onChange:f.submitOrAdvance}):null,e[28]=g,e[29]=f.form.control,e[30]=f.submitOrAdvance,e[31]=k):k=e[31];let w;e[32]!==g?(w=g?r.jsx(T8,{input:g.input}):null,e[32]=g,e[33]=w):w=e[33];let j;e[34]!==S||e[35]!==k||e[36]!==w||e[37]!==L||e[38]!==_?(j=r.jsx(Mo,{icon:v,label:L,title:_,defaultExpanded:!0,footerLeft:S,footerRight:k,children:w}),e[34]=S,e[35]=k,e[36]=w,e[37]=L,e[38]=_,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==b?(N=r.jsx("form",{onSubmit:b,children:j}),e[40]=j,e[41]=b,e[42]=N):N=e[42];let T;return e[43]!==f.form||e[44]!==N?(T=r.jsx(lm,{...x,children:N}),e[43]=f.form,e[44]=N,e[45]=T):T=e[45],T}function uE(t){return typeof t?.approved=="boolean"}function hE(t){return t.approvalId}function fE(t){return[t.approvalId,{approved:void 0}]}function mE(t){const e=z.c(7),{approvalId:s,control:n,onChange:i}=t,o=re(),l=`${s}.approved`;let a;e[0]!==i||e[1]!==o?(a=d=>{const{field:u}=d,h=u.value===!0,f=u.value===!1;return r.jsxs(r.Fragment,{children:[r.jsx(he,{type:"button",variant:f?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),i()},"aria-pressed":f,children:o("chat.approval.denyButton")}),r.jsx(he,{type:"button",variant:h?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),i()},"aria-pressed":h,children:o("chat.approval.acceptButton")})]})},e[0]=i,e[1]=o,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==l||e[5]!==a?(c=r.jsx(Ds,{control:n,name:l,render:a}),e[3]=n,e[4]=l,e[5]=a,e[6]=c):c=e[6],c}function pE(){const t=z.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Vf,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.approval.preparingRequest"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=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-[640px] mx-auto mb-2",children:[s,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function gE(t){const e=z.c(8),{approvals:s,isStreaming:n,onRespond:i}=t;if(n&&s.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(pE,{}),e[0]=l):l=e[0],l}if(s.length===0)return null;if(s.length===1){const l=s[0];if(!l)return null;let a;return e[1]!==i||e[2]!==l?(a=r.jsx(aE,{approval:l,onRespond:i}),e[1]=i,e[2]=l,e[3]=a):a=e[3],a}let o;return e[4]!==s||e[5]!==n||e[6]!==i?(o=r.jsx(dE,{approvals:s,isStreaming:n,onRespond:i}),e[4]=s,e[5]=n,e[6]=i,e[7]=o):o=e[7],o}function xE(t){const e=z.c(28),{plan:s,onApprove:n,onDismiss:i}=t,o=re();let l;e[0]!==n||e[1]!==s.plan?(l=()=>{n(s.plan)},e[0]=n,e[1]=s.plan,e[2]=l):l=e[2];const a=l;let c;e[3]!==o?(c=o("chat.proposePlan.keepIterating"),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==c?(d=r.jsx(he,{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:i,children:c}),e[5]=i,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==o?(u=o("chat.proposePlan.letsGo"),e[8]=o,e[9]=u):u=e[9];let h;e[10]!==a||e[11]!==u?(h=r.jsx(he,{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:u}),e[10]=a,e[11]=u,e[12]=h):h=e[12];let f;e[13]!==d||e[14]!==h?(f=r.jsxs(r.Fragment,{children:[d,h]}),e[13]=d,e[14]=h,e[15]=f):f=e[15];const m=f;let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(e6,{size:14}),e[16]=p):p=e[16];let g;e[17]!==o?(g=o("chat.proposePlan.planReady"),e[17]=o,e[18]=g):g=e[18];let x;e[19]!==o?(x=o("chat.proposePlan.implementationPlan"),e[19]=o,e[20]=x):x=e[20];let b;e[21]!==s.plan?(b=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(hN,{id:"plan-preview",part:{type:"text",text:s.plan}})})}),e[21]=s.plan,e[22]=b):b=e[22];let v;return e[23]!==m||e[24]!==b||e[25]!==g||e[26]!==x?(v=r.jsx(Mo,{icon:p,label:g,title:x,defaultExpanded:!0,footerRight:m,children:b}),e[23]=m,e[24]=b,e[25]=g,e[26]=x,e[27]=v):v=e[27],v}function bE(t){const e=z.c(6),{plans:s,onApprove:n,onDismiss:i}=t;let o;e[0]!==s?(o=b8(s),e[0]=s,e[1]=o):o=e[1];const l=o;if(!l)return null;let a;return e[2]!==l||e[3]!==n||e[4]!==i?(a=r.jsx(xE,{plan:l,onApprove:n,onDismiss:i}),e[2]=l,e[3]=n,e[4]=i,e[5]=a):a=e[5],a}function V8(t){return t?"response"in t?t.response:t.option??t.draft:""}const Ax=Rt({response:Ee().min(1,"Response is required")}),vE=Rt({option:Ee().nullable(),draft:Ee()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),yE=Rt({response:dr(["yes","no"])});function _E(t){switch(t.type){case"text":return Ax;case"choice":return vE;case"confirm":return yE;default:return Ax}}function LE(t){const e={};for(const s of t)e[s.toolCallId]=_E(s.input);return Rt(e)}function wE(t){const e=z.c(7),{control:s,name:n,placeholder:i}=t,o=re();let l;e[0]!==i||e[1]!==o?(l=c=>{const{field:d}=c,u=d.value??"";return r.jsxs(x2,{children:[r.jsx(b2,{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(a2,{size:16,className:"text-muted-foreground"})}),r.jsx("input",{...d,value:u,type:"text",placeholder:i||o("chat.userAskQuestion.typeResponse"),autoFocus:!0,"aria-label":o("chat.userAskQuestion.textResponseInputAriaLabel"),className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),r.jsx(v2,{})]})},e[0]=i,e[1]=o,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==n||e[5]!==l?(a=r.jsx(b6,{control:s,name:n,render:l}),e[3]=s,e[4]=n,e[5]=l,e[6]=a):a=e[6],a}function A8(t,e){const s=z.c(4);let n,i;s[0]!==t||s[1]!==e?(n=()=>{const o=l=>{const a=l.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const c=Number.parseInt(l.key,10);c>=1&&c<=t&&(l.preventDefault(),e(c-1))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},i=[t,e],s[0]=t,s[1]=e,s[2]=n,s[3]=i):(n=s[2],i=s[3]),P.useEffect(n,i)}function SE(t){const e=z.c(51),{control:s,name:n,options:i}=t,o=re(),l=`${n}.option`;let a;e[0]!==s||e[1]!==l?(a={control:s,name:l,defaultValue:null},e[0]=s,e[1]=l,e[2]=a):a=e[2];const{field:c}=ux(a),d=`${n}.draft`;let u;e[3]!==s||e[4]!==d?(u={control:s,name:d,defaultValue:""},e[3]=s,e[4]=d,e[5]=u):u=e[5];const{field:h}=ux(u),f=c.value,m=h.value??"";let p;if(e[6]!==c||e[7]!==i?(p=D=>{const I=i[D];I!=null&&c.onChange(I)},e[6]=c,e[7]=i,e[8]=p):p=e[8],A8(i.length,p),i.length===0)return null;const g=f===null;let x;e[9]!==o?(x=o("chat.userAskQuestion.choiceOptionsAriaLabel"),e[9]=o,e[10]=x):x=e[10];let b;if(e[11]!==c||e[12]!==f||e[13]!==i||e[14]!==o){let D;e[16]!==c||e[17]!==f||e[18]!==o?(D=(I,R)=>{const $=f===I;return r.jsxs("button",{type:"button",onClick:()=>c.onChange(I),className:ie("flex items-start gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",$&&"bg-accent/50",!$&&"hover:bg-accent/30"),"aria-label":o("chat.userAskQuestion.selectOption",{option:I}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0 mt-0.5",$?"bg-chart-1 text-white":"bg-muted text-foreground"),children:R+1}),r.jsx("span",{className:"text-sm text-foreground min-w-0 break-words",children:I})]},`${R}-${I}`)},e[16]=c,e[17]=f,e[18]=o,e[19]=D):D=e[19],b=i.map(D),e[11]=c,e[12]=f,e[13]=i,e[14]=o,e[15]=b}else b=e[15];const v=g&&"bg-accent/50",L=!g&&"hover:bg-accent/30";let _;e[20]!==v||e[21]!==L?(_=ie("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",v,L),e[20]=v,e[21]=L,e[22]=_):_=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:r.jsx(a2,{size:16,className:"text-muted-foreground"})}),e[23]=y):y=e[23];const S=g?m:"";let k;e[24]!==h||e[25]!==c||e[26]!==f?(k=D=>{h.onChange(D.target.value),f!==null&&c.onChange(null)},e[24]=h,e[25]=c,e[26]=f,e[27]=k):k=e[27];let w;e[28]!==c||e[29]!==f?(w=()=>{f!==null&&c.onChange(null)},e[28]=c,e[29]=f,e[30]=w):w=e[30];let j;e[31]!==o?(j=o("chat.userAskQuestion.somethingElsePlaceholder"),e[31]=o,e[32]=j):j=e[32];let N;e[33]!==o?(N=o("chat.userAskQuestion.customChoiceInputAriaLabel"),e[33]=o,e[34]=N):N=e[34];let T;e[35]!==S||e[36]!==k||e[37]!==w||e[38]!==j||e[39]!==N?(T=r.jsx("input",{type:"text",value:S,onChange:k,onFocus:w,placeholder:j,"aria-label":N,className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[35]=S,e[36]=k,e[37]=w,e[38]=j,e[39]=N,e[40]=T):T=e[40];let C;e[41]!==_||e[42]!==T?(C=r.jsxs("label",{className:_,children:[y,T]}),e[41]=_,e[42]=T,e[43]=C):C=e[43];let V;e[44]!==C||e[45]!==x||e[46]!==b?(V=r.jsx(b2,{children:r.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":x,children:[b,C]})}),e[44]=C,e[45]=x,e[46]=b,e[47]=V):V=e[47];let A;e[48]===Symbol.for("react.memo_cache_sentinel")?(A=r.jsx(v2,{}),e[48]=A):A=e[48];let E;return e[49]!==V?(E=r.jsxs(x2,{children:[V,A]}),e[49]=V,e[50]=E):E=e[50],E}function kE(t){const e=z.c(8),{control:s,name:n}=t,i=re();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const l=o,a=P.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=h=>{a.current?.onChange(l[h]??"")},e[1]=c):c=e[1],A8(l.length,c);let d;e[2]!==i?(d=h=>{const{field:f}=h;return a.current=f,r.jsxs(x2,{children:[r.jsx(b2,{children:r.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":i("chat.userAskQuestion.confirmationOptionsAriaLabel"),children:l.map(m=>{const p=f.value===m;return r.jsxs("button",{type:"button",onClick:()=>f.onChange(m),className:ie("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",p&&"bg-accent/50",!p&&"hover:bg-accent/30"),"aria-label":i("chat.userAskQuestion.confirmValue",{value:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)}),children:[r.jsx("span",{className:ie("flex items-center justify-center size-6 rounded-md text-sm shrink-0",p?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),r.jsx("span",{className:"text-sm text-foreground capitalize",children:i(`chat.userAskQuestion.confirm${m==="yes"?"Yes":"No"}`)})]},m)})})}),r.jsx(v2,{})]})},e[2]=i,e[3]=d):d=e[3];let u;return e[4]!==s||e[5]!==n||e[6]!==d?(u=r.jsx(b6,{control:s,name:n,render:d}),e[4]=s,e[5]=n,e[6]=d,e[7]=u):u=e[7],u}function Px(t){const e=z.c(13),{input:s,control:n,toolCallId:i}=t;switch(s.type){case"text":{const o=`${i}.response`;let l;return e[0]!==n||e[1]!==s.default||e[2]!==o?(l=r.jsx(wE,{control:n,name:o,placeholder:s.default}),e[0]=n,e[1]=s.default,e[2]=o,e[3]=l):l=e[3],l}case"choice":{let o;e[4]!==s.options?(o=s.options?.filter(Boolean)??[],e[4]=s.options,e[5]=o):o=e[5];const l=o;let a;return e[6]!==n||e[7]!==l||e[8]!==i?(a=r.jsx(SE,{control:n,name:i,options:l}),e[6]=n,e[7]=l,e[8]=i,e[9]=a):a=e[9],a}case"confirm":{const o=`${i}.response`;let l;return e[10]!==n||e[11]!==o?(l=r.jsx(kE,{control:n,name:o}),e[10]=n,e[11]=o,e[12]=l):l=e[12],l}default:return null}}function jE(t){const e=z.c(91),{parts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=LE(s.map(VE)),e[0]=s,e[1]=o):o=e[1];const l=o;let a;e[2]!==s?(a=Object.fromEntries(s.map(TE)),e[2]=s,e[3]=a):a=e[3];const c=a;let d;e[4]!==i?(d=(M,O)=>{const F=V8(O);F&&i(M,F)},e[4]=i,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==n||e[8]!==s||e[9]!==l||e[10]!==d?(u={parts:s,partKey:NE,schema:l,defaultValues:c,isStreaming:n,hasAnswer:CE,onSubmit:d},e[6]=c,e[7]=n,e[8]=s,e[9]=l,e[10]=d,e[11]=u):u=e[11];const h=j8(u),f=h.currentPart,m=re();let p;e[12]!==f||e[13]!==h||e[14]!==m?(p=()=>{const M=f;if(!M)return;const O=m("chat.userAskQuestion.skipMessage"),F=M.toolCallId;M.input?.type==="choice"?(h.form.setValue(`${F}.option`,null),h.form.setValue(`${F}.draft`,O)):h.form.setValue(`${F}.response`,O),h.advanceToNextUnanswered()},e[12]=f,e[13]=h,e[14]=m,e[15]=p):p=e[15];const g=p;let x;e[16]!==h.currentIndex||e[17]!==h.goNext||e[18]!==h.goPrev||e[19]!==s.length?(x=r.jsx(S8,{currentIndex:h.currentIndex,total:s.length,onPrev:h.goPrev,onNext:h.goNext}),e[16]=h.currentIndex,e[17]=h.goNext,e[18]=h.goPrev,e[19]=s.length,e[20]=x):x=e[20];const b=x;let v;e[21]!==m?(v=m("chat.userAskQuestion.skip"),e[21]=m,e[22]=v):v=e[22];let L;e[23]!==g||e[24]!==v?(L=r.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:g,className:"h-7",children:v}),e[23]=g,e[24]=v,e[25]=L):L=e[25];let _;e[26]!==h.isAllAnswered||e[27]!==h.isCurrentAnswered||e[28]!==h.submitOrAdvance||e[29]!==n?(_=r.jsx(rE,{isStreaming:n,isAllAnswered:h.isAllAnswered,isCurrentAnswered:h.isCurrentAnswered,onAdvanceOrSubmit:h.submitOrAdvance}),e[26]=h.isAllAnswered,e[27]=h.isCurrentAnswered,e[28]=h.submitOrAdvance,e[29]=n,e[30]=_):_=e[30];let y;e[31]!==L||e[32]!==_?(y=r.jsxs(r.Fragment,{children:[L,_]}),e[31]=L,e[32]=_,e[33]=y):y=e[33];const S=y;if(s.length===1){const M=s[0];if(!M?.input)return null;const O=h.form;let F;e[34]!==h?(F=oe=>{oe.preventDefault(),h.submit()},e[34]=h,e[35]=F):F=e[35];let U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=r.jsx(am,{size:14}),e[36]=U):U=e[36];let K;e[37]!==m?(K=m("chat.userAskQuestion.questionPending"),e[37]=m,e[38]=K):K=e[38];let q;e[39]!==M.input?.prompt||e[40]!==m?(q=M.input?.prompt??m("chat.userAskQuestion.question"),e[39]=M.input?.prompt,e[40]=m,e[41]=q):q=e[41];const W=M.input;let G;e[42]!==h.form.control||e[43]!==M.toolCallId||e[44]!==W?(G=r.jsx(Px,{input:W,control:h.form.control,toolCallId:M.toolCallId}),e[42]=h.form.control,e[43]=M.toolCallId,e[44]=W,e[45]=G):G=e[45];let Y;e[46]!==S||e[47]!==K||e[48]!==q||e[49]!==G?(Y=r.jsx(Mo,{icon:U,label:K,title:q,defaultExpanded:!0,footerRight:S,children:G}),e[46]=S,e[47]=K,e[48]=q,e[49]=G,e[50]=Y):Y=e[50];let ee;e[51]!==F||e[52]!==Y?(ee=r.jsx("form",{onSubmit:F,autoComplete:"off",children:Y}),e[51]=F,e[52]=Y,e[53]=ee):ee=e[53];let ne;return e[54]!==h.form||e[55]!==ee?(ne=r.jsx(lm,{...O,children:ee}),e[54]=h.form,e[55]=ee,e[56]=ne):ne=e[56],ne}const k=h.form;let w;e[57]!==h?(w=M=>{M.preventDefault(),h.submit()},e[57]=h,e[58]=w):w=e[58];let j;e[59]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx(am,{size:14}),e[59]=j):j=e[59];let N;e[60]!==m?(N=m("chat.userAskQuestion.questionPending"),e[60]=m,e[61]=N):N=e[61];const T=h.currentIndex+1;let C;e[62]!==s.length||e[63]!==m||e[64]!==T?(C=m("chat.userAskQuestion.questionCount",{current:T,total:s.length}),e[62]=s.length,e[63]=m,e[64]=T,e[65]=C):C=e[65];let V;e[66]!==f?.input?.prompt||e[67]!==m?(V=f?.input?.prompt??m("chat.userAskQuestion.question"),e[66]=f?.input?.prompt,e[67]=m,e[68]=V):V=e[68];const A=h.activeKey,E=h.setActiveKey;let D;if(e[69]!==h.form||e[70]!==s){let M;e[72]!==h.form?(M=O=>r.jsx(gl,{value:O.toolCallId,className:"mt-0",children:r.jsx(Px,{input:O.input,control:h.form.control,toolCallId:O.toolCallId})},O.toolCallId),e[72]=h.form,e[73]=M):M=e[73],D=s.map(M),e[69]=h.form,e[70]=s,e[71]=D}else D=e[71];let I;e[74]!==h.activeKey||e[75]!==h.setActiveKey||e[76]!==D?(I=r.jsx(Hc,{value:A,onValueChange:E,children:D}),e[74]=h.activeKey,e[75]=h.setActiveKey,e[76]=D,e[77]=I):I=e[77];let R;e[78]!==b||e[79]!==S||e[80]!==N||e[81]!==C||e[82]!==V||e[83]!==I?(R=r.jsx(Mo,{icon:j,label:N,count:C,title:V,defaultExpanded:!0,footerLeft:b,footerRight:S,children:I}),e[78]=b,e[79]=S,e[80]=N,e[81]=C,e[82]=V,e[83]=I,e[84]=R):R=e[84];let $;e[85]!==w||e[86]!==R?($=r.jsx("form",{onSubmit:w,autoComplete:"off",children:R}),e[85]=w,e[86]=R,e[87]=$):$=e[87];let B;return e[88]!==h.form||e[89]!==$?(B=r.jsx(lm,{...k,children:$}),e[88]=h.form,e[89]=$,e[90]=B):B=e[90],B}function CE(t){return!!V8(t)}function NE(t){return t.toolCallId}function TE(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function VE(t){return{toolCallId:t.toolCallId,input:t.input}}function AE(){const t=z.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(am,{className:"size-5 text-muted-foreground shimmer"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.userAskQuestion.preparingQuestion"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=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-[640px] mx-auto mb-2",children:[s,r.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function P8(t){const e=z.c(7),{userAskParts:s,isStreaming:n,onSubmit:i}=t;let o;e[0]!==s?(o=s.filter(PE),e[0]=s,e[1]=o):o=e[1];const l=o;if(l.length===0){if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(AE,{}),e[2]=c):c=e[2],c}return null}let a;return e[3]!==n||e[4]!==i||e[5]!==l?(a=r.jsx(jE,{parts:l,isStreaming:n,onSubmit:i}),e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function PE(t){return t.state==="input-available"}function EE(t){const e=t.filter(o=>o.status==="in_progress"),s=t.filter(o=>o.status==="completed").length,n=t.length;if(n>0&&s===n)return{icon:"completed",activity:"All done",progress:`${n}/${n}`};const[i]=e;return i&&e.length===1?{icon:"in_progress",activity:i.activeForm,progress:`${s}/${n} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${s}/${n} done`}:s>0?{icon:"pending",activity:`${n-s} pending`,progress:`${s}/${n} done`}:{icon:"pending",activity:`${n} todos`,progress:"not started"}}function DE(t){const e=z.c(13),{todos:s}=t;if(s.length===0)return null;let n;e[0]!==s?(n=EE(s),e[0]=s,e[1]=n):n=e[1];const i=n;let o;e[2]!==i.icon?(o=r.jsx($E,{status:i.icon}),e[2]=i.icon,e[3]=o):o=e[3];const l=i.activity,a=i.progress;let c;e[4]!==s?(c=s.map(RE),e[4]=s,e[5]=c):c=e[5];let d;e[6]!==c?(d=r.jsx("ul",{"data-testid":"todos-list",className:"flex flex-col px-2 max-h-[40vh] overflow-y-auto",children:c}),e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==i.activity||e[9]!==i.progress||e[10]!==o||e[11]!==d?(u=r.jsx(Mo,{icon:o,label:l,count:a,defaultExpanded:!1,children:d}),e[8]=i.activity,e[9]=i.progress,e[10]=o,e[11]=d,e[12]=u):u=e[12],u}function RE(t,e){return r.jsx(IE,{todo:t},e)}function IE(t){const e=z.c(14),{todo:s}=t,n=s.status==="completed",o=s.status==="in_progress"?s.activeForm:s.content;let l;e[0]!==s.status?(l=r.jsx(ME,{status:s.status}),e[0]=s.status,e[1]=l):l=e[1];const a=n&&"text-muted-foreground";let c;e[2]!==a?(c=ie("relative text-sm leading-snug pt-px select-none",a),e[2]=a,e[3]=c):c=e[3];const d=n?"100%":"0%",u=n?"width 300ms ease 200ms":"width 150ms ease";let h;e[4]!==d||e[5]!==u?(h=r.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:u}}),e[4]=d,e[5]=u,e[6]=h):h=e[6];let f;e[7]!==o||e[8]!==c||e[9]!==h?(f=r.jsxs("span",{className:c,children:[o,h]}),e[7]=o,e[8]=c,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==l||e[12]!==f?(m=r.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,f]}),e[11]=l,e[12]=f,e[13]=m):m=e[13],m}function ME(t){const e=z.c(4),{status:s}=t,n=s==="completed"?"true":void 0,i=s==="in_progress"?"true":void 0;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx("svg",{viewBox:"0 0 21 21",children:r.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=o):o=e[0];let l;return e[1]!==n||e[2]!==i?(l=r.jsx("div",{className:"todo-cb mt-0.5","data-checked":n,"data-progress":i,"aria-hidden":"true",children:o}),e[1]=n,e[2]=i,e[3]=l):l=e[3],l}function $E(t){const e=z.c(13),{status:s}=t,n=re();if(s==="completed"){let l;e[0]!==n?(l=n("chat.todoStatus.completed"),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:r.jsx("path",{d:"M1 4l2.5 2.5L9 1"})}),e[2]=a):a=e[2];let c;return e[3]!==l?(c=r.jsx("span",{"aria-label":l,className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:a}),e[3]=l,e[4]=c):c=e[4],c}if(s==="in_progress"){let l;e[5]!==n?(l=n("chat.todoStatus.inProgress"),e[5]=n,e[6]=l):l=e[6];let a;return e[7]!==l?(a=r.jsx("span",{"aria-label":l,className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[7]=l,e[8]=a):a=e[8],a}let i;e[9]!==n?(i=n("chat.todoStatus.pending"),e[9]=n,e[10]=i):i=e[10];let o;return e[11]!==i?(o=r.jsx("span",{"aria-label":i,className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[11]=i,e[12]=o):o=e[12],o}const OE={usd:[{dollars:10,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:20,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}],brl:[{dollars:50,labelKey:"chat.creditsExhaustedBanner.tierStarter"},{dollars:100,labelKey:"chat.creditsExhaustedBanner.tierPopular"},{dollars:500,labelKey:"chat.creditsExhaustedBanner.tierBestValue"}]},BE=["chat.creditsExhaustedBanner.benefit1","chat.creditsExhaustedBanner.benefit2","chat.creditsExhaustedBanner.benefit3"];function E8(t){const e=z.c(65),{onDismiss:s}=t,{org:n}=Fe(),i=Yt(),{decoKeyId:o}=_2(),l=ys(),a=re(),[c,d]=P.useState(""),[u,h]=P.useState(!1),[f,m]=P.useState("usd"),p=f==="brl"?"R$":"$";let g,x;e[0]!==n.id?(g=()=>{Je("credits_exhausted_shown",{organization_id:n.id})},x=[n.id],e[0]=n.id,e[1]=g,e[2]=x):(g=e[1],x=e[2]),P.useEffect(g,x);let b;e[3]!==f||e[4]!==l?(b=async W=>{const{url:G}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:W,currency:f});return G},e[3]=f,e[4]=l,e[5]=b):b=e[5];let v;e[6]!==s?(v=W=>{W&&window.open(W,"_blank","noopener,noreferrer"),s?.()},e[6]=s,e[7]=v):v=e[7];let L;e[8]!==a?(L=W=>{ge.error(a("chat.creditsExhaustedBanner.topupError",{error:W.message}))},e[8]=a,e[9]=L):L=e[9];let _;e[10]!==b||e[11]!==v||e[12]!==L?(_={mutationFn:b,onSuccess:v,onError:L},e[10]=b,e[11]=v,e[12]=L,e[13]=_):_=e[13];const{mutate:y,isPending:S}=Rs(_),k=parseFloat(c),w=!isNaN(k)&&k>=1;let j;e[14]!==s?(j=W=>!W&&s?.(),e[14]=s,e[15]=j):j=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=["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[16]=N):N=e[16];let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:N.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=T):T=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=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"}),e[18]=C):C=e[18];let V;e[19]!==a?(V=a("chat.creditsExhaustedBanner.title"),e[19]=a,e[20]=V):V=e[20];let A;e[21]!==V?(A=r.jsx(Kt,{className:"text-xl font-semibold tracking-tight",children:V}),e[21]=V,e[22]=A):A=e[22];let E;e[23]!==a?(E=a("chat.creditsExhaustedBanner.description"),e[23]=a,e[24]=E):E=e[24];let D;e[25]!==E?(D=r.jsx(kn,{className:"mt-1.5 text-sm leading-relaxed",children:E}),e[25]=E,e[26]=D):D=e[26];let I;e[27]!==A||e[28]!==D?(I=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[T,r.jsxs(os,{className:"relative gap-4",children:[C,r.jsxs("div",{children:[A,D]})]})]}),e[27]=A,e[28]=D,e[29]=I):I=e[29];let R;e[30]!==f||e[31]!==p||e[32]!==c||e[33]!==k||e[34]!==o||e[35]!==w||e[36]!==S||e[37]!==u||e[38]!==a||e[39]!==y?(R=o&&r.jsxs("div",{className:"px-8 pt-5 pb-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(Ef,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:W=>{W&&m(W)},children:[r.jsx(Cc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Cc,{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:OE[f].map(W=>{const{dollars:G,labelKey:Y}=W;return r.jsxs("button",{type:"button",disabled:S,onClick:()=>{Je("credits_topup_clicked",{amount_cents:G*100,currency:f,tier_label:Y,source:"exhausted_banner"}),y(G*100)},className:ie("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,G]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:a(Y)})]},G)})}),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(gt,{type:"number",min:"1",step:"1",placeholder:a("chat.creditsExhaustedBanner.customPlaceholder"),value:c,onChange:W=>d(W.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(he,{className:"h-10",disabled:!w||S,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(k*100),currency:f,tier_label:"custom",source:"exhausted_banner"}),y(Math.round(k*100))},children:a(S?"chat.creditsExhaustedBanner.opening":"chat.creditsExhaustedBanner.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:a("chat.creditsExhaustedBanner.enterCustom")})]}),r.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:BE.map(W=>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(qt,{size:12,className:"text-[hsl(var(--chart-1))]"})}),r.jsx("span",{className:"text-sm text-foreground/80",children:a(W)})]},W))})]}),e[30]=f,e[31]=p,e[32]=c,e[33]=k,e[34]=o,e[35]=w,e[36]=S,e[37]=u,e[38]=a,e[39]=y,e[40]=R):R=e[40];let $;e[41]!==a?($=a("chat.creditsExhaustedBanner.dismiss"),e[41]=a,e[42]=$):$=e[42];let B;e[43]!==s||e[44]!==$?(B=r.jsx(he,{variant:"ghost",size:"sm",onClick:s,children:$}),e[43]=s,e[44]=$,e[45]=B):B=e[45];let M;e[46]!==i||e[47]!==s||e[48]!==n.slug?(M=()=>{i({to:"/$org/settings/ai-providers",params:{org:n.slug}}),s?.()},e[46]=i,e[47]=s,e[48]=n.slug,e[49]=M):M=e[49];let O;e[50]!==a?(O=a("chat.creditsExhaustedBanner.manageProviders"),e[50]=a,e[51]=O):O=e[51];let F;e[52]!==M||e[53]!==O?(F=r.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:M,children:O}),e[52]=M,e[53]=O,e[54]=F):F=e[54];let U;e[55]!==B||e[56]!==F?(U=r.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[B,F]}),e[55]=B,e[56]=F,e[57]=U):U=e[57];let K;e[58]!==I||e[59]!==R||e[60]!==U?(K=r.jsxs(Bt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:zE,children:[I,R,U]}),e[58]=I,e[59]=R,e[60]=U,e[61]=K):K=e[61];let q;return e[62]!==K||e[63]!==j?(q=r.jsx(zt,{open:!0,onOpenChange:j,children:K}),e[62]=K,e[63]=j,e[64]=q):q=e[64],q}function zE(t){return t.preventDefault()}const FE={trial_exhausted:{label:"chat.subscriptionLimit.trialLabel",title:"chat.subscriptionLimit.trialTitle"},monthly_exhausted:{label:"chat.subscriptionLimit.monthlyLabel",title:"chat.subscriptionLimit.monthlyTitle"},runs_exhausted:{label:"chat.subscriptionLimit.runsLabel",title:"chat.subscriptionLimit.runsTitle"}};function UE(t){const e=z.c(16),{kind:s,onDismiss:n,onSubscribe:i}=t,o=re(),{label:l,title:a}=FE[s];let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Ml,{size:14}),e[0]=c):c=e[0];let d;e[1]!==l||e[2]!==o?(d=o(l),e[1]=l,e[2]=o,e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==a?(u=o(a),e[4]=o,e[5]=a,e[6]=u):u=e[6];let h;e[7]!==s||e[8]!==i||e[9]!==o?(h=s==="trial_exhausted"?r.jsx(he,{size:"sm",onClick:i,className:"h-7 text-xs",children:o("chat.subscriptionLimit.subscribeButton")}):void 0,e[7]=s,e[8]=i,e[9]=o,e[10]=h):h=e[10];let f;return e[11]!==n||e[12]!==d||e[13]!==u||e[14]!==h?(f=r.jsx(Mo,{icon:c,label:d,title:u,defaultExpanded:!0,variant:"warning",onClose:n,footerRight:h}),e[11]=n,e[12]=d,e[13]=u,e[14]=h,e[15]=f):f=e[15],f}function HE(t){const e=t.trim(),s=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),n=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),i=/failed to fetch|networkerror|load failed|offline/i.test(e),o=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,a=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(a){const c=a[1]?.trim().replace(/\.$/,"");return{summary:c?`Your sandbox didn't finish starting up (${c}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return n||s&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:i?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:o?{summary:"That took longer than expected. Try again.",rawDetails:t}:s||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const KE={length:"chat.highlight.warningDescriptionLength","content-filter":"chat.highlight.warningDescriptionContentFilter","tool-calls":"chat.highlight.warningDescriptionToolCalls"};function Sh(t){const e=z.c(29),s=re(),{variant:n,onDismiss:i}=t,o=n==="error";let l;e[0]!==o||e[1]!==s?(l=s(o?"chat.highlight.errorOccurred":"chat.highlight.responseIncomplete"),e[0]=o,e[1]=s,e[2]=l):l=e[2];const a=l,c=o?bn:Fr;let d;e[3]!==t.error||e[4]!==t.finishReason||e[5]!==t.variant||e[6]!==s?(d=t.variant==="error"?t.error.message:(()=>{const v=KE[t.finishReason];return v?s(v):s("chat.highlight.responseStoppedUnexpectedly",{reason:t.finishReason})})(),e[3]=t.error,e[4]=t.finishReason,e[5]=t.variant,e[6]=s,e[7]=d):d=e[7];const u=d;let h;e[8]!==o||e[9]!==u?(h=o?HE(u):{summary:u,rawDetails:null},e[8]=o,e[9]=u,e[10]=h):h=e[10];const{summary:f,rawDetails:m}=h;let p;e[11]!==c?(p=r.jsx(c,{size:14}),e[11]=c,e[12]=p):p=e[12];let g;e[13]!==o||e[14]!==t.onContinue||e[15]!==t.onFixInChat||e[16]!==s?(g=o?r.jsx(he,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:s("chat.highlight.fixInChat")}):r.jsx(he,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:s("chat.highlight.continue")}),e[13]=o,e[14]=t.onContinue,e[15]=t.onFixInChat,e[16]=s,e[17]=g):g=e[17];let x;e[18]!==m||e[19]!==s?(x=m?r.jsxs("details",{className:"group mx-4",children:[r.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[r.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m4.5 3 3 3-3 3"})}),r.jsx("span",{className:"group-open:hidden",children:s("chat.highlight.showTechnicalDetails")}),r.jsx("span",{className:"hidden group-open:inline",children:s("chat.highlight.hideTechnicalDetails")})]}),r.jsxs("div",{className:"relative mt-2",children:[r.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(m).then(()=>ge.success(s("chat.highlight.copiedToClipboard"))).catch(()=>ge.error(s("chat.highlight.couldNotCopy")))},"aria-label":s("chat.highlight.copyErrorDetails"),title:s("chat.highlight.copy"),className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:r.jsx(dn,{className:"size-3.5"})}),r.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:m})]})]}):null,e[18]=m,e[19]=s,e[20]=x):x=e[20];let b;return e[21]!==a||e[22]!==i||e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x||e[27]!==n?(b=r.jsx(Mo,{icon:p,label:a,title:f,defaultExpanded:!0,variant:n,onClose:i,footerRight:g,children:x}),e[21]=a,e[22]=i,e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=n,e[28]=b):b=e[28],b}function Wf(){const t=z.c(73),e=re(),{error:s,clearError:n,finishReason:i,clearFinishReason:o,messages:l,isStreaming:a,submit:c,sendMessage:d}=ui(),[u,h]=Ti(),{virtualMcpId:f,createTaskWithMessage:m}=un(),{chatMode:p,simpleModeTier:g}=Il(),{mutate:x}=y6("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");let b;t[0]!==x?(b=()=>x(),t[0]=x,t[1]=b):b=t[1];const v=b;let L;t[2]!==p||t[3]!==g||t[4]!==f?(L=ce=>({tier:g,mode:p,toolApprovalLevel:ce,agent:f?{id:f}:void 0}),t[2]=p,t[3]=g,t[4]=f,t[5]=L):L=t[5];const _=L;let y;t[6]!==u.toolApprovalLevel?(y=u.toolApprovalLevel??SC(),t[6]=u.toolApprovalLevel,t[7]=y):y=t[7];const S=y,k=l.at(-1),w=k?.role==="assistant"?k.parts:[],j=w.filter(YE),N=v8(w),T=x8(w);let C;t[8]!==s||t[9]!==d||t[10]!==e?(C=()=>{if(s){const te={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.fixInChatMessage",{error:s.message})}]}]};d(te)}},t[8]=s,t[9]=d,t[10]=e,t[11]=C):C=t[11];const V=C;let A;t[12]!==d||t[13]!==e?(A=()=>{const ce={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e("chat.highlight.pleaseContinue")}]}]};d(ce)},t[12]=d,t[13]=e,t[14]=A):A=t[14];const E=A;let D;t[15]!==_||t[16]!==S||t[17]!==c?(D=(ce,te)=>{c({kind:"toolOutput",toolCallId:ce.toolCallId,output:{response:te}},_(S))},t[15]=_,t[16]=S,t[17]=c,t[18]=D):D=t[18];const I=D;let R;t[19]!==m||t[20]!==u||t[21]!==h||t[22]!==e||t[23]!==f?(R=ce=>{h({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:f,message:{parts:[{type:"text",text:e("chat.highlight.implementPlanMessage",{plan:ce})}]}})},t[19]=m,t[20]=u,t[21]=h,t[22]=e,t[23]=f,t[24]=R):R=t[24];const $=R,B=GE;let M;t[25]!==_||t[26]!==c?(M=(ce,te,le,ue)=>{c({kind:"approval",approvalId:ce,approved:te,...le?{reason:le}:{}},_(ue))},t[25]=_,t[26]=c,t[27]=M):M=t[27];const O=M,F=_8();if(F.isCreditExhausted){let ce;return t[28]!==n?(ce=r.jsx(E8,{onDismiss:n}),t[28]=n,t[29]=ce):ce=t[29],ce}const{showError:U,showWarning:K,hasApprovals:q}=F,W=j.map(qE).join("|"),G=b8(N)?.toolCallId??"",Y=T.map(WE).join("|");let ee;t[30]!==F.todos?(ee=r.jsx(DE,{todos:F.todos}),t[30]=F.todos,t[31]=ee):ee=t[31];let ne;t[32]!==n||t[33]!==F.subscriptionErrorKind||t[34]!==v?(ne=F.subscriptionErrorKind&&r.jsx(UE,{kind:F.subscriptionErrorKind,onDismiss:n,onSubscribe:v}),t[32]=n,t[33]=F.subscriptionErrorKind,t[34]=v,t[35]=ne):ne=t[35];let oe;t[36]!==n||t[37]!==s||t[38]!==V||t[39]!==U?(oe=U&&r.jsx(Sh,{variant:"error",error:s,onDismiss:n,onFixInChat:V}),t[36]=n,t[37]=s,t[38]=V,t[39]=U,t[40]=oe):oe=t[40];let Z;t[41]!==o||t[42]!==i||t[43]!==E||t[44]!==K?(Z=K&&r.jsx(Sh,{variant:"warning",finishReason:i,onDismiss:o,onContinue:E}),t[41]=o,t[42]=i,t[43]=E,t[44]=K,t[45]=Z):Z=t[45];let J;t[46]!==Y||t[47]!==O||t[48]!==q||t[49]!==a||t[50]!==T?(J=q&&r.jsx(gE,{approvals:T,isStreaming:a,onRespond:O},Y),t[46]=Y,t[47]=O,t[48]=q,t[49]=a,t[50]=T,t[51]=J):J=t[51];let H;t[52]!==F.hasPlans||t[53]!==$||t[54]!==B||t[55]!==a||t[56]!==N||t[57]!==G?(H=F.hasPlans&&r.jsx(bE,{plans:N,isStreaming:a,onApprove:$,onDismiss:B},G),t[52]=F.hasPlans,t[53]=$,t[54]=B,t[55]=a,t[56]=N,t[57]=G,t[58]=H):H=t[58];let se;t[59]!==F.isWaitingForUserInput||t[60]!==I||t[61]!==a||t[62]!==W||t[63]!==j?(se=F.isWaitingForUserInput&&r.jsx(P8,{userAskParts:j,isStreaming:a,onSubmit:I},W),t[59]=F.isWaitingForUserInput,t[60]=I,t[61]=a,t[62]=W,t[63]=j,t[64]=se):se=t[64];let Q;return t[65]!==oe||t[66]!==Z||t[67]!==J||t[68]!==H||t[69]!==se||t[70]!==ee||t[71]!==ne?(Q=r.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[ee,ne,oe,Z,J,H,se]}),t[65]=oe,t[66]=Z,t[67]=J,t[68]=H,t[69]=se,t[70]=ee,t[71]=ne,t[72]=Q):Q=t[72],Q}function WE(t){return t.approvalId}function qE(t){return t.toolCallId}function GE(){document.querySelector("[data-chat-input]")?.focus()}function YE(t){return t.type==="tool-user_ask"}Wf.Error=function(e){return r.jsx(Sh,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Wf.Warning=function(e){return r.jsx(Sh,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Wf.UserAskQuestion=P8;function JE(t){const e=z.c(20),{taskId:s}=t,n=re(),i=Ty(s),o=QC(i),l=XC(),{stop:a,removeLocalMessage:c}=ui();if(o.length===0)return null;let d;e[0]!==n?(d=n("chat.queueTray.sendNow"),e[0]=n,e[1]=d):d=e[1];let u;e[2]!==a?(u=()=>{a()},e[2]=a,e[3]=u):u=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(bf,{size:14}),e[4]=h):h=e[4];let f;e[5]!==d||e[6]!==u?(f=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm","aria-label":d,onClick:u,children:h})}),e[5]=d,e[6]=u,e[7]=f):f=e[7];let m;e[8]!==n?(m=n("chat.queueTray.sendNow"),e[8]=n,e[9]=m):m=e[9];let p;e[10]!==m?(p=r.jsx(Ke,{side:"top",children:r.jsx("p",{className:"text-xs",children:m})}),e[10]=m,e[11]=p):p=e[11];let g;e[12]!==f||e[13]!==p?(g=r.jsxs(We,{delayDuration:400,children:[f,p]}),e[12]=f,e[13]=p,e[14]=g):g=e[14];let x;return e[15]!==l||e[16]!==c||e[17]!==n||e[18]!==s?(x=(b,v)=>r.jsxs("div",{className:"group/queuerow flex items-center gap-2 px-3 py-1.5",children:[r.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground dark:bg-background",children:v+1}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.text}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/queuerow:opacity-100",children:r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",title:n("chat.queueTray.removeFromQueue"),"aria-label":n("chat.queueTray.removeFromQueue"),onClick:()=>{l.cancel(s,b.messageId).then(L=>{L&&(ZC(s,b.messageId),c(b.messageId))})},children:r.jsx(Li,{className:"size-3.5"})})})]},b.messageId),e[15]=l,e[16]=c,e[17]=n,e[18]=s,e[19]=x):x=e[19],r.jsxs("div",{className:"mb-1 overflow-hidden rounded-2xl border border-border bg-card dark:bg-muted",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border py-1.5 pr-2 pl-3 text-xs text-muted-foreground",children:[r.jsx("span",{children:n(o.length===1?"chat.queueTray.queuedMessage":"chat.queueTray.queuedMessages",{count:o.length})}),g]}),o.map(x)]})}function QE(t,e){return t?{modelId:t.modelId,title:t.title??t.modelId,keyId:t.keyId,providerId:e,description:null,logo:null,capabilities:[],limits:null,costs:null}:null}const XE={fast:"chat.tierTrigger.tierFast",smart:"chat.tierTrigger.tierSmart",thinking:"chat.tierTrigger.tierThinking"};function ZE(t){const e=z.c(31),{tier:s,orgSlot:n,userSlot:i,autoSlot:o,onPick:l,onReset:a,onClose:c}=t,d=re(),u=If(),h=new Set(u.map(eD)),f=eN([i,n,o],h),m=f?.keyId??null,[p,g]=P.useState(m??u[0]?.id??null),x=u.some(R=>R.id===p)?p:m??u[0]?.id??null,b=x?u.find(R=>R.id===x):null,v="flex h-[70vh] max-h-[460px] w-full flex-col",L=XE[s];let _;e[0]!==d||e[1]!==L?(_=d(L),e[0]=d,e[1]=L,e[2]=_):_=e[2];let y;e[3]!==_?(y=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:_}),e[3]=_,e[4]=y):y=e[4];let S;e[5]!==a||e[6]!==d||e[7]!==i?(S=i&&r.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent cursor-pointer",children:d("chat.modelPreferences.reset")}),e[5]=a,e[6]=d,e[7]=i,e[8]=S):S=e[8];let k;e[9]!==y||e[10]!==S?(k=r.jsxs("div",{className:"flex items-center justify-between px-3 h-8 shrink-0",children:[y,S]}),e[9]=y,e[10]=S,e[11]=k):k=e[11];const w="flex-1 min-h-0",j=P.Suspense;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(VV,{}),e[12]=N):N=e[12];const T=TV,C=!0,V=QE(m?f:null,b?.providerId??"deco");let A;e[13]!==x||e[14]!==l||e[15]!==g?(A=R=>{const $=R.keyId??x??"";g($),l({keyId:$,modelId:R.modelId,title:R.title})},e[13]=x,e[14]=l,e[15]=g,e[16]=A):A=e[16];let E;e[17]!==T||e[18]!==x||e[19]!==c||e[20]!==g||e[21]!==V||e[22]!==A?(E=r.jsx(T,{compact:C,onClose:c,credentialId:x,onCredentialChange:g,selectedModel:V,onModelChange:A}),e[17]=T,e[18]=x,e[19]=c,e[20]=g,e[21]=V,e[22]=A,e[23]=E):E=e[23];let D;e[24]!==j||e[25]!==E||e[26]!==N?(D=r.jsx("div",{className:w,children:r.jsx(j,{fallback:N,children:E})}),e[24]=j,e[25]=E,e[26]=N,e[27]=D):D=e[27];let I;return e[28]!==D||e[29]!==k?(I=r.jsxs("div",{className:v,children:[k,D]}),e[28]=D,e[29]=k,e[30]=I):I=e[30],I}function eD(t){return t.id}const tD=["fast","smart","thinking"];function D8(t){return{fast:t("chat.tierTrigger.tierFast"),smart:t("chat.tierTrigger.tierSmart"),thinking:t("chat.tierTrigger.tierThinking")}}const sD={fast:"chat.agentModels.quickerResponses",smart:"chat.agentModels.balancedQuality",thinking:"chat.agentModels.deeperReasoning"};function nD(t){const e=z.c(28),{tier:s,pillIcon:n,groups:i}=t,o=re();let l;e[0]!==o?(l=D8(o),e[0]=o,e[1]=l):l=e[1];const a=l,[c,d]=P.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=w=>{w.onSelect(),d(!1)},e[2]=u):u=e[2];const h=u,f=a[s];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[3]=m):m=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[4]=p):p=e[4];const g=a[s];let x;e[5]!==g?(x=r.jsx("span",{className:p,children:g}),e[5]=g,e[6]=x):x=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(_s,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[7]=b):b=e[7];let v;e[8]!==n||e[9]!==f||e[10]!==x?(v=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"inline-flex min-w-0 shrink",children:r.jsx(ms,{asChild:!0,children:r.jsxs(he,{type:"button",variant:"ghost",size:"default","aria-label":f,className:m,children:[n,x,b]})})})}),e[8]=n,e[9]=f,e[10]=x,e[11]=v):v=e[11];let L;e[12]!==f?(L=r.jsx(Ke,{children:f}),e[12]=f,e[13]=L):L=e[13];let _;e[14]!==v||e[15]!==L?(_=r.jsxs(We,{children:[v,L]}),e[14]=v,e[15]=L,e[16]=_):_=e[16];let y;if(e[17]!==i||e[18]!==o){let w;e[20]!==o?(w=j=>r.jsx("div",{className:"flex flex-col",children:j.rows.map(N=>r.jsxs("div",{className:"group/tier-row relative flex items-stretch rounded-md hover:bg-muted",children:[r.jsxs("button",{type:"button",role:"menuitem","aria-label":N.title,onClick:()=>h(N),className:ie("flex flex-1 min-w-0 items-start gap-2 px-2 py-1.5 text-left",N.modelOverride&&"pr-7 [@media(hover:hover)]:pr-2"),children:[N.icon&&r.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:N.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm",children:N.title}),N.subtitle&&r.jsx("div",{className:"text-xs text-muted-foreground",children:N.subtitle})]}),N.active&&r.jsx("span",{title:o("chat.tierTrigger.selected"),children:r.jsx(qt,{size:14,className:"text-foreground mt-0.5"})})]}),N.modelOverride&&r.jsx(rD,{label:N.title,render:N.modelOverride})]},N.key))},j.key),e[20]=o,e[21]=w):w=e[21],y=i.map(w),e[17]=i,e[18]=o,e[19]=y}else y=e[19];let S;e[22]!==y?(S=r.jsx(bs,{align:"end",className:"p-1 w-64",onOpenAutoFocus:iD,children:r.jsx("div",{role:"menu",className:"flex flex-col",children:y})}),e[22]=y,e[23]=S):S=e[23];let k;return e[24]!==c||e[25]!==_||e[26]!==S?(k=r.jsxs(vs,{open:c,onOpenChange:d,children:[_,S]}),e[24]=c,e[25]=_,e[26]=S,e[27]=k):k=e[27],k}function iD(t){return t.preventDefault()}function rD(t){const e=z.c(38),{label:s,render:n}=t,i=re(),o=zo(),[l,a]=P.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!1),e[0]=c):c=e[0];const d=c;let u;e[1]!==s||e[2]!==i?(u=i("chat.modelPreferences.customizeModel",{tier:s}),e[1]=s,e[2]=i,e[3]=u):u=e[3];const h=l&&"opacity-100";let f;e[4]!==h?(f=ie("absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center","size-6 rounded-md bg-background border border-border/60 shadow-sm","text-muted-foreground hover:text-foreground","opacity-100 [@media(hover:hover)]:opacity-0","[@media(hover:hover)]:group-hover/tier-row:opacity-100","[@media(hover:hover)]:group-focus-within/tier-row:opacity-100",h),e[4]=h,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(y2,{size:14}),e[6]=m):m=e[6];let p;e[7]!==u||e[8]!==f?(p=r.jsx("button",{type:"button","aria-label":u,className:f,children:m}),e[7]=u,e[8]=f,e[9]=p):p=e[9];const g=p;if(o){let _;e[10]!==g?(_=r.jsx(tT,{asChild:!0,children:g}),e[10]=g,e[11]=_):_=e[11];let y;e[12]!==s||e[13]!==i?(y=i("chat.modelPreferences.customizeModel",{tier:s}),e[12]=s,e[13]=i,e[14]=y):y=e[14];let S;e[15]!==y?(S=r.jsx(Zp,{className:"sr-only",children:y}),e[15]=y,e[16]=S):S=e[16];let k;e[17]!==l||e[18]!==n?(k=l&&n(d),e[17]=l,e[18]=n,e[19]=k):k=e[19];let w;e[20]!==k||e[21]!==S?(w=r.jsxs(e2,{className:"p-0 flex flex-col max-h-[95vh]",children:[S,k]}),e[20]=k,e[21]=S,e[22]=w):w=e[22];let j;return e[23]!==l||e[24]!==w||e[25]!==_?(j=r.jsxs(t2,{open:l,onOpenChange:a,children:[_,w]}),e[23]=l,e[24]=w,e[25]=_,e[26]=j):j=e[26],j}let x;e[27]!==g?(x=r.jsx(ms,{asChild:!0,children:g}),e[27]=g,e[28]=x):x=e[28];let b;e[29]!==l||e[30]!==n?(b=l&&n(d),e[29]=l,e[30]=n,e[31]=b):b=e[31];let v;e[32]!==b?(v=r.jsx(bs,{side:"right",align:"start",collisionPadding:12,className:"w-[min(22rem,calc(100vw-2rem))] p-0 overflow-hidden",children:b}),e[32]=b,e[33]=v):v=e[33];let L;return e[34]!==l||e[35]!==x||e[36]!==v?(L=r.jsxs(vs,{open:l,onOpenChange:a,children:[x,v]}),e[34]=l,e[35]=x,e[36]=v,e[37]=L):L=e[37],L}function Ex(t){return t==="fast"?r.jsx(Ml,{size:16}):t==="thinking"?r.jsx(t6,{size:16}):r.jsx(Ar,{size:16})}function oD(t){const e=z.c(13),s=nN();let n;e[0]!==t||e[1]!==s.tiers?(n=d=>{const u=s.tiers[d];return u?u.title??u.modelId:t.chat[d]?.title},e[0]=t,e[1]=s.tiers,e[2]=n):n=e[2];const i=n;let o;e[3]!==i?(o=i("fast"),e[3]=i,e[4]=o):o=e[4];let l;e[5]!==i?(l=i("smart"),e[5]=i,e[6]=l):l=e[6];let a;e[7]!==i?(a=i("thinking"),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==o||e[10]!==l||e[11]!==a?(c={fast:o,smart:l,thinking:a},e[9]=o,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function lD(){const t=z.c(22),e=re(),{simpleModeTier:s,setSimpleModeTier:n}=Il(),i=IV(),o=If(),l=MV(o),a=oD(l),{data:c,error:d}=tN();let u;t[0]!==c?(u=c===void 0?{tiers:{}}:c,t[0]=c,t[1]=u):u=t[1];const h=u,f=sN();let m,p;if(t[2]!==l||t[3]!==i||t[4]!==n||t[5]!==e||t[6]!==s||t[7]!==a||t[8]!==f||t[9]!==h||t[10]!==d){const L=D8(e);m="decopilot",p=tD.map(_=>{const y=a[_],S=h.tiers[_];return{key:`decopilot-${_}`,icon:Ex(_),title:L[_],subtitle:y??e(sD[_]),active:s===_,onSelect:()=>n(_),modelOverride:k=>r.jsxs(r.Fragment,{children:[d&&r.jsx("div",{className:"text-xs text-destructive p-3 pb-0",children:e("chat.modelPreferences.loadFailed")}),r.jsx(ZE,{tier:_,orgSlot:i.tiers[_],userSlot:S,autoSlot:l.chat[_],onClose:k,onPick:w=>f.mutate({tier:_,slot:w}),onReset:()=>f.mutate({tier:_,slot:null})},`${_}:${S?.keyId??"org"}:${S?.modelId??""}`)]})}}),t[2]=l,t[3]=i,t[4]=n,t[5]=e,t[6]=s,t[7]=a,t[8]=f,t[9]=h,t[10]=d,t[11]=m,t[12]=p}else m=t[11],p=t[12];let g;t[13]!==m||t[14]!==p?(g=[{key:m,rows:p}],t[13]=m,t[14]=p,t[15]=g):g=t[15];const x=g;let b;t[16]!==s?(b=Ex(s),t[16]=s,t[17]=b):b=t[17];let v;return t[18]!==x||t[19]!==b||t[20]!==s?(v=r.jsx(nD,{tier:s,pillIcon:b,groups:x}),t[18]=x,t[19]=b,t[20]=s,t[21]=v):v=t[21],v}async function X2(t,e,s,n,i,o){if(!Df(e)){ge.error("Selected model does not support file uploads");return}const l=s.type||"application/octet-stream";if(!AV(l,e)){const c=_6(e).parts.map(u=>o(u)).join(", "),d=e?.title??"This model";i?i({fileName:s.name,modelName:d,accepted:c}):ge.error(`"${s.name}" can't be attached`,{description:`${d} accepts ${c}.`});return}const a=10*1024*1024;if(s.size>a){ge.error(`File "${s.name}" exceeds 10MB limit`);return}try{const c=new FileReader,d=new Promise((f,m)=>{c.onload=()=>{const p=c.result;if(typeof p!="string"){m(new Error("Failed to read file as data URL"));return}const g=p.includes(",")?p.split(",")[1]??p:p;f(g)},c.onerror=m});c.readAsDataURL(s);const u=await d,h={id:crypto.randomUUID(),name:s.name,mimeType:s.type||"application/octet-stream",size:s.size,data:u};fN(t,{from:n,to:n},h)}catch(c){console.error("Failed to process file:",c),ge.error(`Failed to load file "${s.name}"`)}}function aD(t){const e=z.c(9),{editor:s,selectedModel:n,onUnsupportedFile:i}=t,o=re(),l=P.useRef(dD);let a,c;e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==o?(a=()=>{l.current=async(h,f)=>{await X2(s,n,h,f,i,o)}},c=[s,n,i,o],e[0]=s,e[1]=i,e[2]=n,e[3]=o,e[4]=a,e[5]=c):(a=e[4],c=e[5]),P.useEffect(a,c);let d,u;return e[6]!==s?(d=()=>{if(s?.isDestroyed)return;const h=new or("fileDropHandler");s.state.plugins.find(p=>p.spec.key===h)&&s.unregisterPlugin(h);const m=new _f({key:h,props:{handleDrop:(p,g,x,b)=>{if(b)return!1;const v=g.dataTransfer?.files;if(!v||v.length===0)return!1;g.preventDefault();const L=p.posAtCoords({left:g.clientX,top:g.clientY});if(!L)return!1;const _=Array.from(v);return(async()=>{let y=L.pos;for(const S of _)await l.current?.(S,y),y=p.state.selection.to})(),!0},handlePaste:(p,g)=>{const x=g.clipboardData?.items;if(!x)return!1;const b=Array.from(x).filter(cD);return b.length===0?!1:(g.preventDefault(),(async()=>{let v=p.state.selection.from;for(const L of b){const _=L.getAsFile();_&&(await l.current?.(_,v),v=p.state.selection.to)}})(),!0)}}});return s.registerPlugin(m),()=>{s?.isDestroyed||s.unregisterPlugin(h)}},u=[s],e[6]=s,e[7]=d,e[8]=u):(d=e[7],u=e[8]),P.useEffect(d,u),null}function cD(t){return t.kind==="file"}function dD(){return Promise.resolve()}function uD(t){const e=z.c(43),{info:s,onClose:n}=t,i=re(),o=s!==null;let l;e[0]!==n?(l=C=>!C&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=a):a=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:a.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-warning/15 text-warning",children:r.jsx(Fr,{size:18})}),e[4]=d):d=e[4];let u;e[5]!==i?(u=i("chat.uploader.fileTypeNotSupported"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=r.jsx(Kt,{className:"text-xl font-semibold tracking-tight",children:u}),e[7]=u,e[8]=h):h=e[8];const f=s?.fileName;let m;e[9]!==f?(m=r.jsxs("span",{className:"font-medium text-foreground",children:["“",f,"”"]}),e[9]=f,e[10]=m):m=e[10];let p;e[11]!==i?(p=i("chat.uploader.cantAttachToChat"),e[11]=i,e[12]=p):p=e[12];let g;e[13]!==p||e[14]!==m?(g=r.jsxs(kn,{className:"mt-1.5 text-sm leading-relaxed",children:[m," ",p]}),e[13]=p,e[14]=m,e[15]=g):g=e[15];let x;e[16]!==g||e[17]!==h?(x=r.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,r.jsxs(os,{className:"relative gap-4",children:[d,r.jsxs("div",{children:[h,g]})]})]}),e[16]=g,e[17]=h,e[18]=x):x=e[18];const b=s?.modelName??"";let v;e[19]!==i||e[20]!==b?(v=i("chat.uploader.accepts",{modelName:b}),e[19]=i,e[20]=b,e[21]=v):v=e[21];let L;e[22]!==v?(L=r.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:v}),e[22]=v,e[23]=L):L=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(s6,{size:14,className:"text-muted-foreground"}),e[24]=_):_=e[24];const y=s?.accepted;let S;e[25]!==y?(S=r.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[_,r.jsx("span",{className:"capitalize",children:y})]}),e[25]=y,e[26]=S):S=e[26];let k;e[27]!==L||e[28]!==S?(k=r.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:r.jsxs("div",{className:"rounded-xl border border-border p-4",children:[L,S]})}),e[27]=L,e[28]=S,e[29]=k):k=e[29];let w;e[30]!==i?(w=i("chat.uploader.gotIt"),e[30]=i,e[31]=w):w=e[31];let j;e[32]!==n||e[33]!==w?(j=r.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:r.jsx(he,{onClick:n,children:w})}),e[32]=n,e[33]=w,e[34]=j):j=e[34];let N;e[35]!==x||e[36]!==k||e[37]!==j?(N=r.jsxs(Bt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:hD,children:[x,k,j]}),e[35]=x,e[36]=k,e[37]=j,e[38]=N):N=e[38];let T;return e[39]!==o||e[40]!==l||e[41]!==N?(T=r.jsx(zt,{open:o,onOpenChange:l,children:N}),e[39]=o,e[40]=l,e[41]=N,e[42]=T):T=e[42],T}function hD(t){return t.preventDefault()}function fD(){const t=z.c(3),[e,s]=P.useState(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(null),t[0]=n):n=t[0];let i;return t[1]!==e?(i={unsupportedFile:e,onUnsupportedFile:s,clearUnsupportedFile:n},t[1]=e,t[2]=i):i=t[2],i}var Z2=mN;var mD=["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] *)"],fm=mD.join(","),R8=typeof Element>"u",xu=R8?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,kh=!R8&&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},jh=function(e,s){var n;s===void 0&&(s=!0);var i=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),o=i===""||i==="true",l=o||s&&e&&(typeof e.closest=="function"?e.closest("[inert]"):jh(e.parentNode));return l},pD=function(e){var s,n=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"contenteditable");return n===""||n==="true"},gD=function(e,s,n){if(jh(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(fm));return s&&xu.call(e,fm)&&i.unshift(e),i=i.filter(n),i},mm=function(e,s,n){for(var i=[],o=Array.from(e);o.length;){var l=o.shift();if(!jh(l,!1))if(l.tagName==="SLOT"){var a=l.assignedElements(),c=a.length?a:l.children,d=mm(c,!0,n);n.flatten?i.push.apply(i,d):i.push({scopeParent:l,candidates:d})}else{var u=xu.call(l,fm);u&&n.filter(l)&&(s||!e.includes(l))&&i.push(l);var h=l.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(l),f=!jh(h,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(l));if(h&&f){var m=mm(h===!0?l.children:h.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:l,candidates:m})}else o.unshift.apply(o,l.children)}}return i},I8=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},M8=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||pD(e))&&!I8(e)?0:e.tabIndex},xD=function(e,s){var n=M8(e);return n<0&&s&&!I8(e)?0:n},bD=function(e,s){return e.tabIndex===s.tabIndex?e.documentOrder-s.documentOrder:e.tabIndex-s.tabIndex},$8=function(e){return e.tagName==="INPUT"},vD=function(e){return $8(e)&&e.type==="hidden"},yD=function(e){var s=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return s},_D=function(e,s){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===s)return e[n]},LD=function(e){if(!e.name)return!0;var s=e.form||kh(e),n=function(a){return s.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(e.name));else try{i=n(e.name)}catch(l){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",l.message),!1}var o=_D(i,e.form);return!o||o===e},wD=function(e){return $8(e)&&e.type==="radio"},SD=function(e){return wD(e)&&!LD(e)},kD=function(e){var s,n=e&&kh(e),i=(s=n)===null||s===void 0?void 0:s.host,o=!1;if(n&&n!==e){var l,a,c;for(o=!!((l=i)!==null&&l!==void 0&&(a=l.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!o&&i;){var d,u,h;n=kh(i),i=(d=n)===null||d===void 0?void 0:d.host,o=!!((u=i)!==null&&u!==void 0&&(h=u.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return o},Dx=function(e){var s=e.getBoundingClientRect(),n=s.width,i=s.height;return n===0&&i===0},jD=function(e,s){var n=s.displayCheck,i=s.getShadowRoot;if(n==="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 l=xu.call(e,"details>summary:first-of-type"),a=l?e.parentElement:e;if(xu.call(a,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var d=e.parentElement,u=kh(e);if(d&&!d.shadowRoot&&i(d)===!0)return Dx(e);e.assignedSlot?e=e.assignedSlot:!d&&u!==e.ownerDocument?e=u.host:e=d}e=c}if(kD(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Dx(e);return!1},CD=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var s=e.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var n=0;n<s.children.length;n++){var i=s.children.item(n);if(i.tagName==="LEGEND")return xu.call(s,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}s=s.parentElement}return!1},ND=function(e,s){return!(s.disabled||vD(s)||jD(s,e)||yD(s)||CD(s))},Rx=function(e,s){return!(SD(s)||M8(s)<0||!ND(e,s))},TD=function(e){var s=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},O8=function(e){var s=[],n=[];return e.forEach(function(i,o){var l=!!i.scopeParent,a=l?i.scopeParent:i,c=xD(a,l),d=l?O8(i.candidates):a;c===0?l?s.push.apply(s,d):s.push(a):n.push({documentOrder:o,tabIndex:c,item:i,isScope:l,content:d})}),n.sort(bD).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(s)},B8=function(e,s){s=s||{};var n;return s.getShadowRoot?n=mm([e],s.includeContainer,{filter:Rx.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:TD}):n=gD(e,s.includeContainer,Rx.bind(null,s)),O8(n)};function VD(){return/apple/i.test(navigator.vendor)}const Ix="data-floating-ui-focusable";function AD(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 pm(t,e){if(!t||!e)return!1;const s=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(s&&kC(s)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}function fd(t){return"composedPath"in t?t.composedPath()[0]:t.target}function X9(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 PD(t){return t.matches("html,body")}function bu(t){return t?.ownerDocument||document}function ED(t){return t?t.hasAttribute(Ix)?t:t.querySelector("["+Ix+"]")||t:null}function rh(t,e,s){return s===void 0&&(s=!0),t.filter(i=>{var o;return i.parentId===e&&(!s||((o=i.context)==null?void 0:o.open))}).flatMap(i=>[i,...rh(t,i.id,s)])}function DD(t){return"nativeEvent"in t}var RD=typeof document<"u",ID=function(){},xl=RD?P.useLayoutEffect:ID;const MD={...ry},$D=MD.useInsertionEffect,OD=$D||(t=>t());function ic(t){const e=P.useRef(()=>{});return OD(()=>{e.current=t}),P.useCallback(function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}const z8=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function F8(t,e){const s=B8(t,z8()),n=s.length;if(n===0)return;const i=AD(bu(t)),o=s.indexOf(i),l=o===-1?e===1?0:n-1:o+e;return s[l]}function BD(t){return F8(bu(t).body,1)||t}function zD(t){return F8(bu(t).body,-1)||t}function Z9(t,e){const s=e||t.currentTarget,n=t.relatedTarget;return!n||!pm(s,n)}function FD(t){B8(t,z8()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function Mx(t){t.querySelectorAll("[data-tabindex]").forEach(s=>{const n=s.dataset.tabindex;delete s.dataset.tabindex,n?s.setAttribute("tabindex",n):s.removeAttribute("tabindex")})}const UD="data-floating-ui-focusable",$x="active",Ox="selected",HD={...ry};let Bx=!1,KD=0;const zx=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+KD++;function WD(){const[t,e]=P.useState(()=>Bx?zx():void 0);return xl(()=>{t==null&&e(zx())},[]),P.useEffect(()=>{Bx=!0},[]),t}const qD=HD.useId,eg=qD||WD;function GD(){const t=new Map;return{emit(e,s){var n;(n=t.get(e))==null||n.forEach(i=>i(s))},on(e,s){t.has(e)||t.set(e,new Set),t.get(e).add(s)},off(e,s){var n;(n=t.get(e))==null||n.delete(s)}}}const YD=P.createContext(null),JD=P.createContext(null),U8=()=>{var t;return((t=P.useContext(YD))==null?void 0:t.id)||null},H8=()=>P.useContext(JD);function tg(t){return"data-floating-ui-"+t}const QD={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},Fx=P.forwardRef(function(e,s){const[n,i]=P.useState();xl(()=>{VD()&&i("button")},[]);const o={ref:s,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[tg("focus-guard")]:"",style:QD};return r.jsx("span",{...e,...o})}),XD={clipPath:"inset(50%)",position:"fixed",top:0,left:0},K8=P.createContext(null),Ux=tg("portal");function ZD(t){t===void 0&&(t={});const{id:e,root:s}=t,n=eg(),i=tR(),[o,l]=P.useState(null),a=P.useRef(null);return xl(()=>()=>{o?.remove(),queueMicrotask(()=>{a.current=null})},[o]),xl(()=>{if(!n||a.current)return;const c=e?document.getElementById(e):null;if(!c)return;const d=document.createElement("div");d.id=n,d.setAttribute(Ux,""),c.appendChild(d),a.current=d,l(d)},[e,n]),xl(()=>{if(s===null||!n||a.current)return;let c=s||i?.portalNode;c&&!AC(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=n,u.setAttribute(Ux,""),c=d||c,c.appendChild(u),a.current=u,l(u)},[e,s,n,i]),o}function eR(t){const{children:e,id:s,root:n,preserveTabOrder:i=!0}=t,o=ZD({id:s,root:n}),[l,a]=P.useState(null),c=P.useRef(null),d=P.useRef(null),u=P.useRef(null),h=P.useRef(null),f=l?.modal,m=l?.open,p=!!l&&!l.modal&&l.open&&i&&!!(n||o);return P.useEffect(()=>{if(!o||!i||f)return;function g(x){o&&Z9(x)&&(x.type==="focusin"?Mx:FD)(o)}return o.addEventListener("focusin",g,!0),o.addEventListener("focusout",g,!0),()=>{o.removeEventListener("focusin",g,!0),o.removeEventListener("focusout",g,!0)}},[o,i,f]),P.useEffect(()=>{o&&(m||Mx(o))},[m,o]),r.jsxs(K8.Provider,{value:P.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:h,portalNode:o,setFocusManagerState:a}),[i,o]),children:[p&&o&&r.jsx(Fx,{"data-type":"outside",ref:c,onFocus:g=>{if(Z9(g,o)){var x;(x=u.current)==null||x.focus()}else{const b=l?l.domReference:null,v=zD(b);v?.focus()}}}),p&&o&&r.jsx("span",{"aria-owns":o.id,style:XD}),o&&_n.createPortal(e,o),p&&o&&r.jsx(Fx,{"data-type":"outside",ref:d,onFocus:g=>{if(Z9(g,o)){var x;(x=h.current)==null||x.focus()}else{const b=l?l.domReference:null,v=BD(b);v?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const tR=()=>P.useContext(K8),sR={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},nR={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Hx=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 iR(t,e){e===void 0&&(e={});const{open:s,onOpenChange:n,elements:i,dataRef:o}=t,{enabled:l=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:f=!1,bubbles:m,capture:p}=e,g=H8(),x=ic(typeof c=="function"?c:()=>!1),b=typeof c=="function"?x:c,v=P.useRef(!1),{escapeKey:L,outsidePress:_}=Hx(m),{escapeKey:y,outsidePress:S}=Hx(p),k=P.useRef(!1),w=ic(A=>{var E;if(!s||!l||!a||A.key!=="Escape"||k.current)return;const D=(E=o.current.floatingContext)==null?void 0:E.nodeId,I=g?rh(g.nodesRef.current,D):[];if(!L&&(A.stopPropagation(),I.length>0)){let R=!0;if(I.forEach($=>{var B;if((B=$.context)!=null&&B.open&&!$.context.dataRef.current.__escapeKeyBubbles){R=!1;return}}),!R)return}n(!1,DD(A)?A.nativeEvent:A,"escape-key")}),j=ic(A=>{var E;const D=()=>{var I;w(A),(I=fd(A))==null||I.removeEventListener("keydown",D)};(E=fd(A))==null||E.addEventListener("keydown",D)}),N=ic(A=>{var E;const D=o.current.insideReactTree;o.current.insideReactTree=!1;const I=v.current;if(v.current=!1,d==="click"&&I||D||typeof b=="function"&&!b(A))return;const R=fd(A),$="["+tg("inert")+"]",B=bu(i.floating).querySelectorAll($);let M=Wi(R)?R:null;for(;M&&!q9(M);){const K=NC(M);if(q9(K)||!Wi(K))break;M=K}if(B.length&&Wi(R)&&!PD(R)&&!pm(R,i.floating)&&Array.from(B).every(K=>!pm(M,K)))return;if(TC(R)&&V){const K=q9(R),q=VC(R),W=/auto|scroll/,G=K||W.test(q.overflowX),Y=K||W.test(q.overflowY),ee=G&&R.clientWidth>0&&R.scrollWidth>R.clientWidth,ne=Y&&R.clientHeight>0&&R.scrollHeight>R.clientHeight,oe=q.direction==="rtl",Z=ne&&(oe?A.offsetX<=R.offsetWidth-R.clientWidth:A.offsetX>R.clientWidth),J=ee&&A.offsetY>R.clientHeight;if(Z||J)return}const O=(E=o.current.floatingContext)==null?void 0:E.nodeId,F=g&&rh(g.nodesRef.current,O).some(K=>{var q;return X9(A,(q=K.context)==null?void 0:q.elements.floating)});if(X9(A,i.floating)||X9(A,i.domReference)||F)return;const U=g?rh(g.nodesRef.current,O):[];if(U.length>0){let K=!0;if(U.forEach(q=>{var W;if((W=q.context)!=null&&W.open&&!q.context.dataRef.current.__outsidePressBubbles){K=!1;return}}),!K)return}n(!1,A,"outside-press")}),T=ic(A=>{var E;const D=()=>{var I;N(A),(I=fd(A))==null||I.removeEventListener(d,D)};(E=fd(A))==null||E.addEventListener(d,D)});P.useEffect(()=>{if(!s||!l)return;o.current.__escapeKeyBubbles=L,o.current.__outsidePressBubbles=_;let A=-1;function E(B){n(!1,B,"ancestor-scroll")}function D(){window.clearTimeout(A),k.current=!0}function I(){A=window.setTimeout(()=>{k.current=!1},CC()?5:0)}const R=bu(i.floating);a&&(R.addEventListener("keydown",y?j:w,y),R.addEventListener("compositionstart",D),R.addEventListener("compositionend",I)),b&&R.addEventListener(d,S?T:N,S);let $=[];return f&&(Wi(i.domReference)&&($=W9(i.domReference)),Wi(i.floating)&&($=$.concat(W9(i.floating))),!Wi(i.reference)&&i.reference&&i.reference.contextElement&&($=$.concat(W9(i.reference.contextElement)))),$=$.filter(B=>{var M;return B!==((M=R.defaultView)==null?void 0:M.visualViewport)}),$.forEach(B=>{B.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(R.removeEventListener("keydown",y?j:w,y),R.removeEventListener("compositionstart",D),R.removeEventListener("compositionend",I)),b&&R.removeEventListener(d,S?T:N,S),$.forEach(B=>{B.removeEventListener("scroll",E)}),window.clearTimeout(A)}},[o,i,a,b,d,s,n,f,l,L,_,w,y,j,N,S,T]),P.useEffect(()=>{o.current.insideReactTree=!1},[o,b,d]);const C=P.useMemo(()=>({onKeyDown:w,...u&&{[sR[h]]:A=>{n(!1,A.nativeEvent,"reference-press")},...h!=="click"&&{onClick(A){n(!1,A.nativeEvent,"reference-press")}}}}),[w,n,u,h]),V=P.useMemo(()=>{function A(E){E.button===0&&(v.current=!0)}return{onKeyDown:w,onMouseDown:A,onMouseUp:A,[nR[d]]:()=>{o.current.insideReactTree=!0}}},[w,d,o]);return P.useMemo(()=>l?{reference:C,floating:V}:{},[l,C,V])}function rR(t){const{open:e=!1,onOpenChange:s,elements:n}=t,i=eg(),o=P.useRef({}),[l]=P.useState(()=>GD()),a=U8()!=null,[c,d]=P.useState(n.reference),u=ic((m,p,g)=>{o.current.openEvent=m?p:void 0,l.emit("openchange",{open:m,event:p,reason:g,nested:a}),s?.(m,p,g)}),h=P.useMemo(()=>({setPositionReference:d}),[]),f=P.useMemo(()=>({reference:c||n.reference||null,floating:n.floating||null,domReference:n.reference}),[c,n.reference,n.floating]);return P.useMemo(()=>({dataRef:o,open:e,onOpenChange:u,elements:f,events:l,floatingId:i,refs:h}),[e,u,f,l,i,h])}function oR(t){t===void 0&&(t={});const{nodeId:e}=t,s=rR({...t,elements:{reference:null,floating:null,...t.elements}}),n=t.rootContext||s,i=n.elements,[o,l]=P.useState(null),[a,c]=P.useState(null),u=i?.domReference||o,h=P.useRef(null),f=H8();xl(()=>{u&&(h.current=u)},[u]);const m=jC({...t,elements:{...i,...a&&{reference:a}}}),p=P.useCallback(L=>{const _=Wi(L)?{getBoundingClientRect:()=>L.getBoundingClientRect(),getClientRects:()=>L.getClientRects(),contextElement:L}:L;c(_),m.refs.setReference(_)},[m.refs]),g=P.useCallback(L=>{(Wi(L)||L===null)&&(h.current=L,l(L)),(Wi(m.refs.reference.current)||m.refs.reference.current===null||L!==null&&!Wi(L))&&m.refs.setReference(L)},[m.refs]),x=P.useMemo(()=>({...m.refs,setReference:g,setPositionReference:p,domReference:h}),[m.refs,g,p]),b=P.useMemo(()=>({...m.elements,domReference:u}),[m.elements,u]),v=P.useMemo(()=>({...m,...n,refs:x,elements:b,nodeId:e}),[m,x,b,e,n]);return xl(()=>{n.dataRef.current.floatingContext=v;const L=f?.nodesRef.current.find(_=>_.id===e);L&&(L.context=v)}),P.useMemo(()=>({...m,context:v,refs:x,elements:b}),[m,x,b,v])}function e1(t,e,s){const n=new Map,i=s==="item";let o=t;if(i&&t){const{[$x]:l,[Ox]:a,...c}=t;o=c}return{...s==="floating"&&{tabIndex:-1,[UD]:""},...o,...e.map(l=>{const a=l?l[s]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((l,a)=>(a&&Object.entries(a).forEach(c=>{let[d,u]=c;if(!(i&&[$x,Ox].includes(d)))if(d.indexOf("on")===0){if(n.has(d)||n.set(d,[]),typeof u=="function"){var h;(h=n.get(d))==null||h.push(u),l[d]=function(){for(var f,m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];return(f=n.get(d))==null?void 0:f.map(x=>x(...p)).find(x=>x!==void 0)}}}else l[d]=u}),l),{})}}function lR(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),s=t.map(a=>a?.floating),n=t.map(a=>a?.item),i=P.useCallback(a=>e1(a,t,"reference"),e),o=P.useCallback(a=>e1(a,t,"floating"),s),l=P.useCallback(a=>e1(a,t,"item"),n);return P.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:l}),[i,o,l])}const aR=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function cR(t,e){var s,n;e===void 0&&(e={});const{open:i,elements:o,floatingId:l}=t,{enabled:a=!0,role:c="dialog"}=e,d=eg(),u=((s=o.domReference)==null?void 0:s.id)||d,h=P.useMemo(()=>{var v;return((v=ED(o.floating))==null?void 0:v.id)||l},[o.floating,l]),f=(n=aR.get(c))!=null?n:c,p=U8()!=null,g=P.useMemo(()=>f==="tooltip"||c==="label"?{["aria-"+(c==="label"?"labelledby":"describedby")]:i?h:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?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,i,u,c]),x=P.useMemo(()=>{const v={id:h,...f&&{role:f}};return f==="tooltip"||c==="label"?v:{...v,...f==="menu"&&{"aria-labelledby":u}}},[f,h,u,c]),b=P.useCallback(v=>{let{active:L,selected:_}=v;const y={role:"option",...L&&{id:h+"-fui-option"}};switch(c){case"select":case"combobox":return{...y,"aria-selected":_}}return{}},[h,c]);return P.useMemo(()=>a?{reference:g,floating:x,item:b}:{},[a,g,x,b])}function dR(t){var e;const{char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:a}=t,c=n&&!i,d=xN(s),u=new RegExp(`\\s${d}$`),h=l?"^":"",f=i?"":d,m=c?new RegExp(`${h}${d}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${h}(?:^)?${d}[^\\s${f}]*`,"gm"),p=((e=a.nodeBefore)==null?void 0:e.isText)&&a.nodeBefore.text;if(!p)return null;const g=a.pos-p.length,x=Array.from(p.matchAll(m)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const b=x.input.slice(Math.max(0,x.index-1),x.index),v=new RegExp(`^[${o?.join("")}\0]?$`).test(b);if(o!==null&&!v)return null;const L=g+x.index;let _=L+x[0].length;return c&&u.test(p.slice(_-1,_+1))&&(x[0]+=" ",_+=1),L<a.pos&&_>=a.pos?{range:{from:L,to:_},query:x[0].slice(s.length),text:x[0]}:null}var W8=new or("suggestion");function q8({pluginKey:t=W8,editor:e,char:s="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:a="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:h=()=>null,items:f=()=>[],render:m=()=>({}),allow:p=()=>!0,findSuggestionMatch:g=dR,shouldShow:x}){let b;const v=m?.(),L=()=>{const k=e.state.selection.$anchor.pos,w=e.view.coordsAtPos(k),{top:j,right:N,bottom:T,left:C}=w;try{return new DOMRect(C,j,N-C,T-j)}catch{return null}},_=(k,w)=>w?()=>{const j=t.getState(e.state),N=j?.decorationId,T=k.dom.querySelector(`[data-decoration-id="${N}"]`);return T?.getBoundingClientRect()||null}:L;function y(k,w){var j;try{const T=t.getState(k.state),C=T?.decorationId?k.dom.querySelector(`[data-decoration-id="${T.decorationId}"]`):null,V={editor:e,range:T?.range||{from:0,to:0},query:T?.query||null,text:T?.text||null,items:[],command:A=>h({editor:e,range:T?.range||{from:0,to:0},props:A}),decorationNode:C,clientRect:_(k,C)};(j=v?.onExit)==null||j.call(v,V)}catch{}const N=k.state.tr.setMeta(w,{exit:!0});k.dispatch(N)}const S=new _f({key:t,view(){return{update:async(k,w)=>{var j,N,T,C,V,A,E;const D=(j=this.key)==null?void 0:j.getState(w),I=(N=this.key)==null?void 0:N.getState(k.state),R=D.active&&I.active&&D.range.from!==I.range.from,$=!D.active&&I.active,B=D.active&&!I.active,M=!$&&!B&&D.query!==I.query,O=$||R&&M,F=M||R,U=B||R&&M;if(!O&&!F&&!U)return;const K=U&&!O?D:I,q=k.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);b={editor:e,range:K.range,query:K.query,text:K.text,items:[],command:W=>h({editor:e,range:K.range,props:W}),decorationNode:q,clientRect:_(k,q)},O&&((T=v?.onBeforeStart)==null||T.call(v,b)),F&&((C=v?.onBeforeUpdate)==null||C.call(v,b)),(F||O)&&(b.items=await f({editor:e,query:K.query})),U&&((V=v?.onExit)==null||V.call(v,b)),F&&((A=v?.onUpdate)==null||A.call(v,b)),O&&((E=v?.onStart)==null||E.call(v,b))},destroy:()=>{var k;b&&((k=v?.onExit)==null||k.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(k,w,j,N){const{isEditable:T}=e,{composing:C}=e.view,{selection:V}=k,{empty:A,from:E}=V,D={...w},I=k.getMeta(t);if(I&&I.exit)return D.active=!1,D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null,D;if(D.composing=C,T&&(A||e.view.composing)){(E<w.range.from||E>w.range.to)&&!C&&!w.composing&&(D.active=!1);const R=g({char:s,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:V.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;R&&p({editor:e,state:N,range:R.range,isActive:w.active})&&(!x||x({editor:e,range:R.range,query:R.query,text:R.text,transaction:k}))?(D.active=!0,D.decorationId=w.decorationId?w.decorationId:$,D.range=R.range,D.query=R.query,D.text=R.text):D.active=!1}else D.active=!1;return D.active||(D.decorationId=null,D.range={from:0,to:0},D.query=null,D.text=null),D}},props:{handleKeyDown(k,w){var j,N,T,C;const{active:V,range:A}=S.getState(k.state);if(!V)return!1;if(w.key==="Escape"||w.key==="Esc"){const D=S.getState(k.state),I=(j=b?.decorationNode)!=null?j:null,R=I??(D?.decorationId?k.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`):null);if(((N=v?.onKeyDown)==null?void 0:N.call(v,{view:k,event:w,range:D.range}))||!1)return!0;const B={editor:e,range:D.range,query:D.query,text:D.text,items:[],command:M=>h({editor:e,range:D.range,props:M}),decorationNode:R,clientRect:R?()=>R.getBoundingClientRect()||null:null};return(T=v?.onExit)==null||T.call(v,B),y(k,t),!0}return((C=v?.onKeyDown)==null?void 0:C.call(v,{view:k,event:w,range:A}))||!1},decorations(k){const{active:w,range:j,decorationId:N,query:T}=S.getState(k);if(!w)return null;const C=!T?.length,V=[c];return C&&V.push(u),pN.create(k.doc,[gN.inline(j.from,j.to,{nodeName:a,class:V.join(" "),"data-decoration-id":N,"data-decoration-content":d})])}}});return S}function G8(t,e=W8){const s=t.state.tr.setMeta(e,{exit:!0});t.dispatch(s)}var uR=q8;function hR(t){const e=z.c(24),{editor:s,query:n,items:i,onSelect:o,onClose:l}=t,[a,c]=P.useState(0),d=P.useRef(i),u=P.useRef(a),h=P.useRef(o),f=P.useRef(l),m=P.useDeferredValue(n);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],P.useEffect(p,g);let x,b;e[3]!==i.length||e[4]!==a?(x=()=>{a>=i.length&&i.length>0&&c(0)},b=[i.length,a],e[3]=i.length,e[4]=a,e[5]=x,e[6]=b):(x=e[5],b=e[6]),P.useEffect(x,b);let v,L;e[7]!==i?(v=()=>{d.current=i},L=[i],e[7]=i,e[8]=v,e[9]=L):(v=e[8],L=e[9]),P.useEffect(v,L);let _,y;e[10]!==a?(_=()=>{u.current=a},y=[a],e[10]=a,e[11]=_,e[12]=y):(_=e[11],y=e[12]),P.useEffect(_,y);let S,k;e[13]!==o?(k=()=>{h.current=o},S=[o],e[13]=o,e[14]=S,e[15]=k):(S=e[14],k=e[15]),P.useEffect(k,S);let w,j;e[16]!==l?(w=()=>{f.current=l},j=[l],e[16]=l,e[17]=w,e[18]=j):(w=e[17],j=e[18]),P.useEffect(w,j);let N,T;e[19]!==s?(N=()=>{if(s?.isDestroyed)return;let A;try{A=s.view.dom}catch{return}if(!A)return;const E=I=>{const R=d.current;if(!R.length)return!1;const $=()=>c(M=>(M+1)%R.length),B=()=>c(M=>(M-1+R.length)%R.length);switch(I.key){case"ArrowUp":return I.preventDefault(),B(),!0;case"ArrowDown":return I.preventDefault(),$(),!0;case"Tab":return I.preventDefault(),I.shiftKey?B():$(),!0;case"Home":return I.preventDefault(),c(0),!0;case"End":return I.preventDefault(),c(R.length-1),!0;case"Enter":{if(I.isComposing)return!1;I.preventDefault();const M=u.current;return M!==-1&&R[M]&&h.current?.(R[M],M),!0}case"Escape":return I.preventDefault(),f.current?.(),!0;default:return!1}},D=I=>{E(I)};return A.addEventListener("keydown",D,!0),()=>{A?.removeEventListener("keydown",D,!0)}},T=[s],e[19]=s,e[20]=N,e[21]=T):(N=e[20],T=e[21]),P.useEffect(N,T);const C=i.length?a:void 0;let V;return e[22]!==C?(V={selectedIndex:C,setSelectedIndex:c},e[22]=C,e[23]=V):V=e[23],V}function fR(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 Y8=P.createContext(void 0);function J8(){const t=P.useContext(Y8);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function mR(t){const e=z.c(16),{editor:s,char:n,pluginKey:i,allow:o,onOpenChange:l}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[c,d]=P.useReducer(fR,a);let u;e[1]!==l?(u=g=>{l?.(g)},e[1]=l,e[2]=u):u=e[2];const h=P.useEffectEvent(u);let f;e[3]!==n||e[4]!==o||e[5]!==s||e[6]!==h||e[7]!==i?(f=()=>{if(s?.isDestroyed)return;const g=i instanceof or?i:new or(i);s.state.plugins.find(v=>v.spec.key===g)&&s.unregisterPlugin(g);const b=q8({pluginKey:g,editor:s,char:n,allow(v){const L=s.state.doc.resolve(v.range.from);for(let _=L.depth;_>0;_--)if(L.node(_).type.name==="image")return!1;return!(o&&!o(v))},command(){},render:()=>({onStart:v=>{d({type:"ON_START",payload:{element:v.decorationNode??null,query:v.query,range:v.range}}),h(!0)},onUpdate:v=>{d({type:"ON_UPDATE",payload:{element:v.decorationNode??null,query:v.query,range:v.range}})},onKeyDown:v=>v.event.key==="Escape"?(d({type:"ON_EXIT"}),!0):!1,onExit:()=>{d({type:"ON_EXIT"}),h(!1)}}),items:pR});return s.registerPlugin(b),()=>{s?.isDestroyed||s.unregisterPlugin(g)}},e[3]=n,e[4]=o,e[5]=s,e[6]=h,e[7]=i,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==o||e[11]!==s||e[12]!==i?(m=[s,i,n,d,o],e[9]=n,e[10]=o,e[11]=s,e[12]=i,e[13]=m):m=e[13],P.useEffect(f,m);let p;return e[14]!==c?(p={state:c,dispatch:d},e[14]=c,e[15]=p):p=e[15],p}function pR(){return[]}function gR({editor:t,queryKey:e,queryFn:s,onSelect:n}){const{state:i,dispatch:o}=J8(),l=P.useDeferredValue(i.query),{data:a}=pf({queryKey:Qe.suggestionItems(e,i.open,l),queryFn:()=>i.open?s({query:l}):[]}),c=()=>{o({type:"ON_EXIT"})},d=async(h,f)=>{if(!(i.selectedItem!==null||!i.range)){o({type:"SET_SELECTED_ITEM",payload:h});try{const{view:m}=t,g=m.state.selection.$to.nodeAfter?.text?.startsWith(" "),x=i.range?{...i.range}:{from:0,to:0};g&&i.range&&(x.to+=1),await n({range:x,item:h})===!1?o({type:"SET_SELECTED_ITEM",payload:null}):c()}catch{c()}}},{selectedIndex:u}=hR({editor:t,query:l,items:a,onSelect:d,onClose:c});return{selectedItem:i.selectedItem,items:a,selectedIndex:u,close:c,onSelect:d}}function xR({children:t}){const{state:e,dispatch:s}=J8(),{open:n,element:i}=e,o=()=>{s({type:"ON_EXIT"})},{refs:l,floatingStyles:a,context:c}=oR({placement:"bottom-start",open:n,onOpenChange:f=>{f||o()},elements:{reference:i},middleware:[PC(10),EC(),DC()],whileElementsMounted:RC}),d=iR(c,{outsidePress:f=>!(f.target instanceof Element&&f.target.closest(".ProseMirror"))}),u=cR(c,{role:"listbox"}),{getFloatingProps:h}=lR([d,u]);return n?r.jsx(eR,{children:r.jsx("div",{ref:l.setFloating,style:a,...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 bR=t=>{const e=z.c(29),{item:s,isSelected:n,onSelect:i,isLoading:o,ref:l}=t;let a;if(e[0]!==s){const S=er(s._meta);a=s.title||Yp(s.name,S),e[0]=s,e[1]=a}else a=e[1];const c=a,d=s.description||null,u=s.icon,h=n&&"bg-accent text-accent-foreground",f=o&&"pointer-events-none opacity-50";let m;e[2]!==h||e[3]!==f?(m=ie("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(ai,{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 x;e[10]!==o?(x=o&&r.jsx(Sc,{size:"xs"}),e[10]=o,e[11]=x):x=e[11];let b;e[12]!==g||e[13]!==x?(b=r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,x]}),e[12]=g,e[13]=x,e[14]=b):b=e[14];let v;e[15]!==d?(v=d&&r.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=v):v=e[16];let L;e[17]!==b||e[18]!==v?(L=r.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,v]}),e[17]=b,e[18]=v,e[19]=L):L=e[19];let _;e[20]!==s.drillable?(_=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]=_):_=e[21];let y;return e[22]!==i||e[23]!==l||e[24]!==L||e[25]!==_||e[26]!==m||e[27]!==p?(y=r.jsxs("div",{ref:l,onClick:i,className:m,children:[p,L,_]}),e[22]=i,e[23]=l,e[24]=L,e[25]=_,e[26]=m,e[27]=p,e[28]=y):y=e[28],y},vR=t=>{const e=z.c(21),{editor:s,queryKey:n,queryFn:i,onSelect:o}=t,l=re();let a;e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==n?(a={editor:s,queryKey:n,queryFn:i,onSelect:o},e[0]=s,e[1]=o,e[2]=i,e[3]=n,e[4]=a):a=e[4];const{items:c,selectedIndex:d,onSelect:u,selectedItem:h}=gR(a);if(!c.length){let g;e[5]!==l?(g=l("chat.mention.noItemsFound"),e[5]=l,e[6]=g):g=e[6];let x;return e[7]!==g?(x=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:g}),e[7]=g,e[8]=x):x=e[8],x}let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[9]=f):f=e[9];let m;if(e[10]!==u||e[11]!==c||e[12]!==d||e[13]!==h?.name){let g;e[15]!==u||e[16]!==d||e[17]!==h?.name?(g=(x,b)=>r.jsx(bR,{item:x,isSelected:b===d,ref:b===d?LR:void 0,onSelect:()=>u(x,b),isLoading:h?.name===x.name},`${x.kind??"item"}:${x.name}`),e[15]=u,e[16]=d,e[17]=h?.name,e[18]=g):g=e[18],m=c.map(g),e[10]=u,e[11]=c,e[12]=d,e[13]=h?.name,e[14]=m}else m=e[14];let p;return e[19]!==m?(p=r.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:f,children:r.jsx("div",{className:"p-1",children:m})}),e[19]=m,e[20]=p):p=e[20],p};function yR(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"p-1",children:[...Array(3)].map(_R)}),t[0]=e):e=t[0],e}function _R(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 Q8(t){const e=z.c(18),{editor:s,char:n,pluginKey:i,queryKey:o,queryFn:l,onSelect:a,allow:c,onOpenChange:d}=t;let u;e[0]!==c||e[1]!==n||e[2]!==s||e[3]!==d||e[4]!==i?(u={editor:s,char:n,pluginKey:i,allow:c,onOpenChange:d},e[0]=c,e[1]=n,e[2]=s,e[3]=d,e[4]=i,e[5]=u):u=e[5];const{state:h,dispatch:f}=mR(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(yR,{}),e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==a||e[12]!==l||e[13]!==o?(g=r.jsx(xR,{children:r.jsx(P.Suspense,{fallback:p,children:r.jsx(vR,{editor:s,queryKey:o,queryFn:l,onSelect:a})})}),e[10]=s,e[11]=a,e[12]=l,e[13]=o,e[14]=g):g=e[14];let x;return e[15]!==m||e[16]!==g?(x=r.jsx(Y8.Provider,{value:m,children:g}),e[15]=m,e[16]=g,e[17]=x):x=e[17],x}function LR(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const wR=t=>{const e=z.c(53),{editor:s,virtualMcpId:n,suggestionOpenRef:i}=t,o=re(),l=as(),{org:a}=Fe(),c=Fc();let d;e[0]!==c?(d=k2(c),e[0]=c,e[1]=d):d=e[1];const u=d;let h;e[2]!==a.id||e[3]!==a.slug||e[4]!==n?(h={connectionId:n,orgId:a.id,orgSlug:a.slug},e[2]=a.id,e[3]=a.slug,e[4]=n,e[5]=h):h=e[5];const f=Gt(h);let m;e[6]!==a.id||e[7]!==n?(m=Qe.virtualMcpResources(n,a.id),e[6]=a.id,e[7]=n,e[8]=m):m=e[8];const p=m,[g,x]=P.useState("categories");let b;e[9]!==g?(b=()=>g,e[9]=g,e[10]=b):b=e[10];const v=P.useEffectEvent(b),L=P.useRef(null),_=P.useRef(!1),y=n??"default";let S;e[11]!==g||e[12]!==a.id||e[13]!==y?(S=["at-mention",a.id,y,g],e[11]=g,e[12]=a.id,e[13]=y,e[14]=S):S=e[14];const k=S;let w;e[15]!==o?(w=o("chat.mentionAt.agentsTitle"),e[15]=o,e[16]=w):w=e[16];let j;e[17]!==o?(j=o("chat.mentionAt.agentsDescription"),e[17]=o,e[18]=j):j=e[18];let N;e[19]!==w||e[20]!==j?(N={name:"agents",title:w,description:j,kind:"category",drillable:!0},e[19]=w,e[20]=j,e[21]=N):N=e[21];let T;e[22]!==o?(T=o("chat.mentionAt.resourcesTitle"),e[22]=o,e[23]=T):T=e[23];let C;e[24]!==o?(C=o("chat.mentionAt.resourcesDescription"),e[24]=o,e[25]=C):C=e[25];let V;e[26]!==T||e[27]!==C?(V={name:"resources",title:T,description:C,kind:"category",drillable:!0},e[26]=T,e[27]=C,e[28]=V):V=e[28];let A;e[29]!==V||e[30]!==N?(A=[N,V],e[29]=V,e[30]=N,e[31]=A):A=e[31];const E=A;let D;e[32]!==f||e[33]!==s||e[34]!==o?(D=async F=>{const{item:U,range:K}=F;if(Je("chat_picker_item_selected",{picker:"@",item_kind:U.kind,item_name:U.name}),U.kind!=="category"&&(_.current=!0),U.kind==="category")return x(U.name==="agents"?"agents":"resources"),!1;if(U.kind==="agent"&&U.agentId){wc(s,K,{id:U.agentId,name:U.name,metadata:{agentId:U.agentId,title:U.name},char:"@"}),x("categories");return}if(U.kind==="resource"&&U.uri&&f){try{const q=await oy(f,U.uri);wc(s,K,{id:U.uri,name:U.uri,metadata:q.contents,char:"@"})}catch(q){console.error("[at-mention] Failed to fetch resource:",q),ge.error(o("chat.mentionAt.failedToLoadResource"))}x("categories");return}},e[32]=f,e[33]=s,e[34]=o,e[35]=D):D=e[35];const I=D;let R;e[36]!==c||e[37]!==E||e[38]!==f||e[39]!==u||e[40]!==v||e[41]!==l||e[42]!==p||e[43]!==n?(R=async F=>{const{query:U}=F,K=v();if(K==="categories"){if(!U.trim())return E;const G=U.toLowerCase(),Y=c.filter(ne=>ne.status==="active"&&(!ne.id||!yh(ne.id))&&!u.has(ne.id)&&ne.id!==n&&(ne.title.toLowerCase().includes(G)||ne.description?.toLowerCase().includes(G))).map(SR),ee=await(async()=>{if(!f)return[];let ne=l.getQueryData(p);return ne||(ne=await l.fetchQuery({queryKey:p,queryFn:()=>qd(f),staleTime:6e4})),(ne?.resources??[]).filter(oe=>oe.uri.toLowerCase().includes(G)||oe.name?.toLowerCase().includes(G)||oe.description?.toLowerCase().includes(G)).map(kR)})();return[...Y,...ee]}if(K==="agents"){let G=c.filter(Y=>Y.status==="active"&&(!Y.id||!yh(Y.id))&&!u.has(Y.id)&&Y.id!==n);if(U.trim()){const Y=U.toLowerCase();G=G.filter(ee=>ee.title.toLowerCase().includes(Y)||ee.description?.toLowerCase().includes(Y))}return G.map(jR)}if(!f)return[];let q=l.getQueryData(p);q?l.fetchQuery({queryKey:p,queryFn:()=>qd(f),staleTime:6e4}).catch(CR):q=await l.fetchQuery({queryKey:p,queryFn:()=>qd(f),staleTime:6e4});let W=q?.resources??[];if(U.trim()){const G=U.toLowerCase();W=W.filter(Y=>Y.uri.toLowerCase().includes(G)||Y.name?.toLowerCase().includes(G)||Y.description?.toLowerCase().includes(G))}return W.map(NR)},e[36]=c,e[37]=E,e[38]=f,e[39]=u,e[40]=v,e[41]=l,e[42]=p,e[43]=n,e[44]=R):R=e[44];const $=R;let B;e[45]!==i?(B=F=>{if(i&&(i.current=F),F)L.current=Date.now(),_.current=!1,Je("chat_picker_opened",{picker:"@"});else{const U=L.current;Je("chat_picker_closed",{picker:"@",outcome:_.current?"selected":"dismissed",duration_ms:U?Date.now()-U:null}),L.current=null,x("categories")}},e[45]=i,e[46]=B):B=e[46];const M=B;let O;return e[47]!==s||e[48]!==$||e[49]!==I||e[50]!==M||e[51]!==k?(O=r.jsx(Q8,{editor:s,char:"@",pluginKey:"atDropdownMenu",queryKey:k,queryFn:$,onSelect:I,onOpenChange:M}),e[47]=s,e[48]=$,e[49]=I,e[50]=M,e[51]=k,e[52]=O):O=e[52],O};function SR(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function kR(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}function jR(t){return{name:t.title,title:t.title,description:t.description??void 0,icon:t.icon??null,kind:"agent",agentId:t.id}}function CR(){}function NR(t){return{name:t.name??t.uri,title:t.name,description:t.description,kind:"resource",uri:t.uri}}async function Kx(t,e,s,n,i,o,l){try{const a=await Pu(s,n,o);wc(t,e,{id:n,name:Bc(n,i),metadata:a.messages,char:"/",kind:"prompt",args:o})}catch(a){console.error("[slash] Failed to fetch prompt:",a),ge.error(l.t("chat.mentionSlash.failedLoadPrompt"))}}async function TR(t,e,s,n,i){try{const o=await oy(s,n);wc(t,e,{id:n,name:n,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),ge.error(i.t("chat.mentionSlash.failedLoadResource"))}}async function VR(t,e,s,n,i){try{const{files:o,omittedPaths:l}=await BV(s,n.volume,n.path),a={sandboxPath:n.sandboxPath,files:o,omittedPaths:l};wc(t,e,{id:n.id,name:n.name,metadata:a,char:"/",kind:"skill"})}catch(o){console.error("[slash] Failed to fetch skill:",o),ge.error(i.t("chat.mentionSlash.failedLoadSkill"))}}const AR=({editor:t,virtualMcpId:e,suggestionOpenRef:s})=>{const n=re(),i=as(),{org:o}=Fe(),l=Gt({connectionId:e,orgId:o.id,orgSlug:o.slug}),a=Qe.virtualMcpPrompts(e,o.id),c=Qe.virtualMcpResources(e,o.id),d=Qe.slashSkills(o.id),u=["slash-mention",o.id,e??"default"],[h,f]=P.useState(null),[m,p]=P.useState(null),g=bN(t);g&&(g.onEditChip=async k=>{if(l)try{const j=(await Wx(i,a,l)).find(N=>N.name===k.promptId);if(!j?.arguments||j.arguments.length===0)return;p({...k,prompt:j})}catch(w){console.error("[slash] Failed to load prompt for editing:",w),ge.error(n("chat.mentionSlash.failedLoadPrompt"))}});const x=P.useRef(null),b=P.useRef(!1),v=async({item:k,range:w})=>{if(Je("chat_picker_item_selected",{picker:"/",item_kind:k.kind,item_name:k.name}),b.current=!0,!!l)if(k.kind==="prompt"){if(k.arguments&&k.arguments.length>0){f({range:w,item:k});return}const j=er(k._meta);await Kx(t,w,l,k.name,j,void 0,{t:n})}else k.kind==="skill"?k.skill&&await VR(t,w,o.slug,k.skill,{t:n}):k.uri&&await TR(t,w,l,k.uri,{t:n})},L=async k=>{if(!h||!l)return;const{range:w,item:j}=h,N=er(j._meta);await Kx(t,w,l,j.name,N,k,{t:n}),f(null)},_=async k=>{if(!(!m||!l)){if(!vN(t,m.pos,m.promptId)){ge.error(n("chat.mentionSlash.failedUpdatePrompt")),p(null);return}try{const w=await Pu(l,m.promptId,k),j=er(m.prompt._meta);t.chain().focus().setNodeSelection(m.pos).deleteSelection().insertContentAt(m.pos,yf({id:m.promptId,name:Bc(m.promptId,j),metadata:w.messages,char:"/",kind:"prompt",args:k})).run(),Je("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:m.promptId})}catch(w){console.error("[slash] Failed to update prompt:",w),ge.error(n("chat.mentionSlash.failedUpdatePrompt"))}p(null)}},y=async k=>{const{query:w}=k;if(!l)return[];const[j,N,T]=await Promise.all([Wx(i,a,l),ER(i,c,l),PR(i,d,o.slug)]),C=w.trim().toLowerCase(),V=(j??[]).filter(D=>!C||D.name.toLowerCase().includes(C)||D.title?.toLowerCase().includes(C)||D.description?.toLowerCase().includes(C)).map(D=>({name:D.name,title:D.title,description:D.description,kind:"prompt",arguments:D.arguments,_meta:D._meta})),A=(N??[]).filter(D=>!C||D.uri.toLowerCase().includes(C)||D.name?.toLowerCase().includes(C)||D.description?.toLowerCase().includes(C)).map(D=>({name:D.name??D.uri,title:D.name,description:D.description,kind:"resource",uri:D.uri})),E=(T??[]).filter(D=>!C||D.name.toLowerCase().includes(C)||D.id.toLowerCase().includes(C)||D.description?.toLowerCase().includes(C)).map(D=>({name:D.name,title:D.name,description:D.description??void 0,kind:"skill",skill:D}));return[...V,...A,...E]},S=h?.item.kind==="prompt"?{name:h.item.name,title:h.item.title,arguments:h.item.arguments,description:h.item.description,_meta:h.item._meta}:null;return r.jsxs(r.Fragment,{children:[r.jsx(Q8,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:u,queryFn:y,onSelect:v,onOpenChange:k=>{if(s&&(s.current=k),k)x.current=Date.now(),b.current=!1,Je("chat_picker_opened",{picker:"/"});else{const w=x.current;Je("chat_picker_closed",{picker:"/",outcome:b.current?"selected":"dismissed",duration_ms:w?Date.now()-w:null}),x.current=null}}}),r.jsx(mu,{prompt:S,setPrompt:()=>f(null),onSubmit:L}),r.jsx(mu,{prompt:m?.prompt??null,setPrompt:()=>p(null),onSubmit:_,defaultValues:m?.args},m?`edit-${m.promptId}-${m.pos}`:"edit-idle")]})};async function Wx(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>im(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>im(s),staleTime:6e4}),n?.prompts??[]}async function PR(t,e,s){const n=t.getQueryData(e),i=()=>t.fetchQuery({queryKey:e,queryFn:()=>zV(s),staleTime:6e4});return n?(i().catch(()=>{}),n):i().catch(()=>[])}async function ER(t,e,s){let n=t.getQueryData(e);return n?t.fetchQuery({queryKey:e,queryFn:()=>qd(s),staleTime:6e4}).catch(()=>{}):n=await t.fetchQuery({queryKey:e,queryFn:()=>qd(s),staleTime:6e4}),n?.resources??[]}const X8="Ask anything, / for prompts & skills, @ for agents & resources...";function DR(t){return[wf.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Z2.configure({placeholder:()=>t.current??X8,showOnlyWhenEditable:!1}),_N,LN]}function Z8({tiptapDoc:t,setTiptapDoc:e,disabled:s=!1,enterToSubmit:n=!1,placeholder:i,onSubmit:o,suggestionOpenRef:l,children:a}){const c=P.useRef(o),d=P.useRef(e),u=P.useRef(n),h=P.useRef(i),f=Lf({extensions:DR(h),content:t||"",editorProps:{attributes:{"data-chat-input":"true",role:"textbox","aria-multiline":"true","aria-label":i??X8,class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,p)=>p.key==="Enter"&&!p.shiftKey&&u.current&&!l?.current?(p.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{d.current(m?.getJSON())}});return P.useEffect(()=>{f?.setEditable(!s)},[f,s]),P.useEffect(()=>{c.current=o},[o]),P.useEffect(()=>{d.current=e},[e]),P.useEffect(()=>{u.current=n},[n]),P.useEffect(()=>{h.current=i},[i]),P.useEffect(()=>{if(!f||f.isDestroyed)return;const m=JSON.stringify(f.getJSON()),p=JSON.stringify(t||{type:"doc",content:[]});m!==p&&f.commands.setContent(t||{type:"doc",content:[]})},[f,t]),r.jsx(yN.Provider,{value:{editor:f},children:a})}function e7(t){const e=z.c(29),{disabled:s,virtualMcpId:n,showFileUploader:i,selectedModel:o,onUnsupportedFile:l,suggestionOpenRef:a,ref:c,className:d}=t,u=s===void 0?!1:s,h=i===void 0?!1:i,{editor:f}=Au();let m,p;if(e[0]!==f?(m=()=>({focus:()=>{f?.commands.focus()},clear:()=>{f?.commands.clearContent(!0)},appendText:j=>{if(!f)return;const N=f.state.doc.textContent.trim()==="";f.commands.focus("end"),N||f.commands.insertContent(" "),f.commands.insertContent(j)},syncVoiceText:(j,N)=>{if(f&&(f.commands.setContent(j||{type:"doc",content:[]}),N)){f.commands.focus("end");const T=f.state.doc.textContent.trim().length>0;f.commands.insertContent({type:"text",text:T?" "+N:N})}},restoreContent:j=>{f&&f.commands.setContent(j||{type:"doc",content:[]})}}),p=[f],e[0]=f,e[1]=m,e[2]=p):(m=e[1],p=e[2]),P.useImperativeHandle(c??null,m,p),!f)return null;const g=u&&"cursor-not-allowed opacity-70",x=u&&"[&_.ProseMirror]:cursor-not-allowed";let b;e[3]!==d||e[4]!==g||e[5]!==x?(b=ie("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",d,"[&_.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","[&_.ProseMirror_p.is-editor-empty:first-child::before]:w-full","[&_.ProseMirror_p.is-editor-empty:first-child::before]:break-words",g,x),e[3]=d,e[4]=g,e[5]=x,e[6]=b):b=e[6];let v;e[7]!==f||e[8]!==b?(v=r.jsx(Sf,{editor:f,className:b}),e[7]=f,e[8]=b,e[9]=v):v=e[9];const L=n??null;let _;e[10]!==f||e[11]!==a||e[12]!==L?(_=r.jsx(P.Suspense,{fallback:null,children:r.jsx(AR,{editor:f,virtualMcpId:L,suggestionOpenRef:a})}),e[10]=f,e[11]=a,e[12]=L,e[13]=_):_=e[13];const y=n??null;let S;e[14]!==f||e[15]!==a||e[16]!==y?(S=r.jsx(P.Suspense,{fallback:null,children:r.jsx(wR,{editor:f,virtualMcpId:y,suggestionOpenRef:a})}),e[14]=f,e[15]=a,e[16]=y,e[17]=S):S=e[17];let k;e[18]!==u||e[19]!==f||e[20]!==l||e[21]!==o||e[22]!==h?(k=h&&o&&!u?r.jsx(aD,{editor:f,selectedModel:o,onUnsupportedFile:l}):null,e[18]=u,e[19]=f,e[20]=l,e[21]=o,e[22]=h,e[23]=k):k=e[23];let w;return e[24]!==_||e[25]!==S||e[26]!==k||e[27]!==v?(w=r.jsxs(r.Fragment,{children:[v,_,S,k]}),e[24]=_,e[25]=S,e[26]=k,e[27]=v,e[28]=w):w=e[28],w}function t7(t){const e=z.c(3),[s]=Ti();let n;return e[0]!==s.enableSounds||e[1]!==t?(n=()=>{s.enableSounds&&tA(t.dataUri).catch(o=>{console.warn(`[sound] ${t.name} playback failed:`,o)})},e[0]=s.enableSounds,e[1]=t,e[2]=n):n=e[2],n}const RR={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"},IR=pT.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),MR=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function $R(){const t=z.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:MR.map(OR)}),t[0]=e):e=t[0],e}function OR(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 BR({disabled:t,onOpenConnections:e,virtualMcpId:s,selectedModel:n,isStreaming:i,onUnsupportedFile:o}){const l=re(),[a,c]=P.useState(!1),d=t7(RR),{org:u}=Fe(),{editor:h}=Au(),f=P.useRef(null),m=Df(n),p=()=>{!m||i||(c(!1),f.current?.click())},g=async W=>{const G=W.target.files;if(!G||G.length===0||!h)return;const Y=Array.from(G);try{let ee=h.state.selection.from;for(const ne of Y)await X2(h,n??null,ne,ee,o,l),ee=h.state.selection.to}finally{f.current&&(f.current.value="")}},x=Gt({connectionId:s,orgId:u.id,orgSlug:u.slug}),b=Qe.virtualMcpPrompts(s,u.id),{data:v,isLoading:L}=Pt({queryKey:b,queryFn:()=>im(x),staleTime:6e4,enabled:a&&!!x}),_=v?.prompts??[],[y,S]=P.useState(null),{chatMode:k,setChatMode:w}=Il(),[j,N]=Ti(),T=ul.find(W=>W.value===j.toolApprovalLevel)??ul[0],C=l(T.shortKey),V=W=>{const G=ul.find(Y=>Y.value===W);if(G){if(G.value===j.toolApprovalLevel){c(!1);return}d(),Je("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:G.value,source:"tools_popover"}),N({...j,toolApprovalLevel:G.value}),c(!1)}},A=k==="plan",E=()=>{d();const W=A?"default":"plan";Je("chat_mode_changed",{from_mode:k,to_mode:W,source:"tools_popover"}),w(W),c(!1)},D=()=>{e(),c(!1)},I=async(W,G)=>{if(!h||!x)return;const Y=er(W._meta),ee={from:h.state.selection.from,to:h.state.selection.to};try{const ne=await Pu(x,W.name,G);wc(h,ee,{id:W.name,name:Bc(W.name,Y),metadata:ne.messages,char:"/",kind:"prompt",args:G})}catch{ge.error(l("chat.toolsPopover.failedLoadPrompt"))}},R=async W=>{c(!1);const G=!!(W.arguments&&W.arguments.length>0);if(Je("chat_prompt_inserted",{prompt_name:W.name,with_arguments:G}),G){S(W);return}await I(W)},$=async W=>{y&&(await I(y,W),S(null))},B=()=>{d();const W=k==="gen-image"?"default":"gen-image";Je("chat_mode_changed",{from_mode:k,to_mode:W,source:"tools_popover"}),w(W),c(!1)},M=()=>{d();const W=k==="web-search"?"default":"web-search";Je("chat_mode_changed",{from_mode:k,to_mode:W,source:"tools_popover"}),w(W),c(!1)},O=()=>{d();const W=k==="deep-research"?"default":"deep-research";Je("chat_mode_changed",{from_mode:k,to_mode:W,source:"tools_popover"}),w(W),c(!1)},F=k==="gen-image",U=k==="web-search",K=k==="deep-research",q=r.jsx("input",{ref:f,type:"file",multiple:!0,accept:PV(n??null),className:"hidden",onChange:g,disabled:i});return r.jsxs(r.Fragment,{children:[q,r.jsxs(Xt,{open:a,onOpenChange:W=>{W&&!a&&Je("chat_tools_popover_opened",{chat_mode:k}),c(W)},children:[r.jsx(Zt,{asChild:!0,children:r.jsxs(he,{type:"button",variant:"ghost",size:"default",disabled:t,title:l("chat.toolsPopover.tools"),"aria-label":l("chat.toolsPopover.tools"),className:ie("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[r.jsx(n6,{size:14}),r.jsx("span",{className:ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:l("chat.toolsPopover.tools")})]})}),r.jsxs(es,{align:"start",className:"w-56 p-1.5 space-y-1",children:[m?r.jsxs(Xe,{onClick:p,disabled:i,children:[r.jsx(Ht,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]}):r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsxs(Xe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:W=>W.preventDefault(),children:[r.jsx(Ht,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.addFile")})]})}),r.jsx(Ke,{side:"right",children:l("chat.toolsPopover.modelNoFileSupport")})]}),r.jsxs(Xe,{onClick:E,className:ie(A&&"text-special"),children:[r.jsx(kc,{size:16,className:ie(A&&"text-special")}),r.jsx("span",{className:"flex-1 whitespace-nowrap",children:l("chat.toolsPopover.planMode")}),r.jsx("span",{className:ie("text-xs text-muted-foreground",A&&"text-special font-medium"),children:IR})]}),r.jsxs(Xe,{onClick:B,className:ie(F&&"text-special"),children:[r.jsx(_i,{size:16,className:ie(F&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.createImage")}),F&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Xe,{onClick:M,className:ie(U&&"text-special"),children:[r.jsx(Rr,{size:16,className:ie(U&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.webSearch")}),U&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Xe,{onClick:O,className:ie(K&&"text-special"),children:[r.jsx(i6,{size:16,className:ie(K&&"text-special")}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.deepResearch")}),K&&r.jsx("span",{className:"text-xs text-special font-medium",children:l("chat.toolsPopover.on")})]}),r.jsxs(Yi,{children:[r.jsxs(Ji,{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:l("chat.toolsPopover.prompts")})]}),r.jsx(Qi,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:L?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[r.jsx(lt,{size:14,className:"animate-spin"}),l("chat.toolsPopover.loadingPrompts")]}):_.length===0?r.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:l("chat.toolsPopover.noPromptsAvailable")}):_.map(W=>r.jsxs(Xe,{onClick:()=>R(W),className:"flex flex-col items-start gap-0.5",children:[r.jsx("span",{className:"font-medium text-sm capitalize",children:W.title||Yp(W.name,er(W._meta))}),W.description&&r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:W.description})]},W.name))})]}),r.jsxs(Yi,{children:[r.jsxs(Ji,{className:"gap-2",children:[r.jsx(Vf,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.approval")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:C})]}),r.jsx(Qi,{className:"w-48 p-1.5",children:r.jsx(cm,{value:j.toolApprovalLevel,onValueChange:V,children:ul.map(W=>r.jsx(fc,{value:W.value,children:l(W.labelKey)},W.value))})})]}),r.jsxs(Xe,{onClick:D,children:[r.jsx(l2,{size:16}),r.jsx("span",{className:"flex-1",children:l("chat.toolsPopover.connections")}),r.jsx(P.Suspense,{children:r.jsx($R,{})})]})]})]}),r.jsx(mu,{prompt:y,setPrompt:S,onSubmit:$})]})}const zR=[{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 FR(){const t=z.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:zR.map(UR)}),t[0]=e):e=t[0],e}function UR(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 HR(t){const e=z.c(10),{onClick:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ie("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("chat.connectionsBanner.description"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:o}),e[3]=o,e[4]=l):l=e[4];let a,c;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(FR,{}),c=r.jsx(nn,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[5]=a,e[6]=c):(a=e[5],c=e[6]);let d;return e[7]!==s||e[8]!==l?(d=r.jsxs("button",{type:"button",onClick:s,className:i,children:[l,a,c]}),e[7]=s,e[8]=l,e[9]=d):d=e[9],d}const Dd=48;function KR(){const t=z.c(9),[e,s]=P.useState("idle"),[n,i]=P.useState(""),[o,l]=P.useState(""),[a,c]=P.useState(GR),d=P.useRef(null),u=P.useRef(null),h=P.useRef(null),f=P.useRef(null),m=P.useRef(0),p=P.useRef(!1),g=P.useRef(""),x=P.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let v;t[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0),u.current?.close().catch(qR),f.current?.getTracks().forEach(WR),h.current=null,u.current=null,f.current=null},t[0]=v):v=t[0];const L=v;let _;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const T=C=>{f.current=C;const V=new AudioContext;u.current=V;const A=V.createMediaStreamSource(C),E=V.createAnalyser();E.fftSize=128,E.smoothingTimeConstant=.8,A.connect(E),h.current=E;const D=new Uint8Array(E.frequencyBinCount),I=()=>{if(!h.current)return;h.current.getByteFrequencyData(D);const R=[];for(let $=0;$<Dd;$++){const B=Math.floor($/Dd*D.length);R.push(Math.max(.04,(D[B]??0)/255))}c(R),m.current=requestAnimationFrame(I)};I()};_=async()=>{const C=window.SpeechRecognition||window.webkitSpeechRecognition;if(!C)return s("unsupported"),"unsupported";let V;try{V=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return s("permission-denied"),"permission-denied"}i(""),l(""),x.current="",g.current="",p.current=!0,s("recording"),T(V);const A=new C;d.current=A,A.interimResults=!0,A.continuous=!0,A.lang=navigator.language||"en-US",A.onresult=E=>{if(d.current!==A)return;let D="",I="";for(let R=E.resultIndex;R<E.results.length;R++){const $=E.results[R],B=$?.[0]?.transcript??"";$?.isFinal?I=I+B:D=D+B}I&&(g.current=g.current+I,i(g.current)),x.current=D,l(D)},A.onerror=E=>{d.current===A&&E.error!=="no-speech"&&(p.current=!1,d.current=null,L(),s(E.error==="not-allowed"?"permission-denied":"idle"))},A.onend=()=>{if(d.current===A&&p.current)try{A.start()}catch{}};try{A.start()}catch{return p.current=!1,d.current=null,L(),s("idle"),"idle"}return"recording"},t[1]=_}else _=t[1];const y=_;let S;t[2]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{p.current=!1,d.current?.stop(),L(),s("idle"),c(Array(Dd).fill(.05)),l("");const T=(g.current+(x.current?" "+x.current:"")).trim();return i(""),g.current="",x.current="",T},t[2]=S):S=t[2];const k=S;let w;t[3]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{p.current=!1,d.current?.abort(),L(),s("idle"),i(""),l(""),c(Array(Dd).fill(.05)),g.current="",x.current=""},t[3]=w):w=t[3];const j=w;let N;return t[4]!==o||t[5]!==e||t[6]!==n||t[7]!==a?(N={status:e,transcript:n,interimTranscript:o,waveformData:a,isSupported:b,startRecording:y,stopRecording:k,cancelRecording:j},t[4]=o,t[5]=e,t[6]=n,t[7]=a,t[8]=N):N=t[8],N}function WR(t){return t.stop()}function qR(){}function GR(){return Array(Dd).fill(.05)}function YR(t){const e=z.c(4),{data:s}=t;let n;e[0]!==s?(n=s.map(JR),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:n}),e[2]=n,e[3]=i):i=e[3],i}function JR(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)}function QR(t){return t.hasDraft?"send":t.isStreaming||t.isRunInProgress?"stop":"disabled"}function b0(t){const e=z.c(7),{message:s,icon:n}=t;let i;e[0]!==n?(i=n??r.jsx(Vu,{size:14,className:"shrink-0"}),e[0]=n,e[1]=i):i=e[1];const o=s??"";let l;e[2]!==o?(l=r.jsx("span",{className:"text-sm",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=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:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function XR(t,e,s){const n=z.c(7),{editor:i}=Au(),o=re(),[l,a]=P.useState(!1),c=P.useRef(0);let d,u;return n[0]!==s||n[1]!==i||n[2]!==e||n[3]!==t||n[4]!==o?(d=()=>{const h=g=>{g.dataTransfer?.types.includes("Files")&&(g.preventDefault(),c.current=c.current+1,a(!0))},f=g=>{g.preventDefault(),c.current=Math.max(0,c.current-1),c.current===0&&a(!1)},m=ZR,p=g=>{if(g.preventDefault(),c.current=0,a(!1),s||!i||!t||!Df(t))return;const x=g.dataTransfer?.files;if(!x||x.length===0)return;const b=Array.from(x);(async()=>{let v=i.state.selection.from;for(const L of b)await X2(i,t,L,v,e,o),v=i.state.selection.to})()};return window.addEventListener("dragenter",h),window.addEventListener("dragleave",f),window.addEventListener("dragover",m),window.addEventListener("drop",p),()=>{window.removeEventListener("dragenter",h),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",m),window.removeEventListener("drop",p)}},u=[i,t,e,o,s],n[0]=s,n[1]=i,n[2]=e,n[3]=t,n[4]=o,n[5]=d,n[6]=u):(d=n[5],u=n[6]),P.useEffect(d,u),l}function ZR(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function eI(t){const e=z.c(14),{selectedModel:s}=t,n=re();let i,o,l;if(e[0]!==s||e[1]!==n){const{parts:d}=_6(s);e[5]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(Yn,{size:24}),e[5]=l):l=e[5],i="text-sm font-medium";let u;e[6]!==n?(u=h=>n(h),e[6]=n,e[7]=u):u=e[7],o=n("chat.input.dropFilesHere",{fileTypes:d.map(u).join(", ")}),e[0]=s,e[1]=n,e[2]=i,e[3]=o,e[4]=l}else i=e[2],o=e[3],l=e[4];let a;e[8]!==i||e[9]!==o?(a=r.jsx("span",{className:i,children:o}),e[8]=i,e[9]=o,e[10]=a):a=e[10];let c;return e[11]!==l||e[12]!==a?(c=r.jsxs(r.Fragment,{children:[l,a]}),e[11]=l,e[12]=a,e[13]=c):c=e[13],c}function tI(){const t=z.c(5),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Vu,{size:24}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("chat.input.modelCannotReadAttachments"),t[1]=e,t[2]=n):n=t[2];let i;return t[3]!==n?(i=r.jsxs(r.Fragment,{children:[s,r.jsx("span",{className:"text-sm font-medium",children:n})]}),t[3]=n,t[4]=i):i=t[4],i}function sI(t){const e=z.c(11),{selectedModel:s,onUnsupportedFile:n,disabled:i}=t,o=XR(s,n,i);let l;e[0]!==s?(l=Df(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o?"opacity-100":"opacity-0 pointer-events-none",d=a?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let u;e[2]!==c||e[3]!==d?(u=ie("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,d),e[2]=c,e[3]=d,e[4]=u):u=e[4];let h;e[5]!==s||e[6]!==a?(h=a?r.jsx(eI,{selectedModel:s}):r.jsx(tI,{}),e[5]=s,e[6]=a,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function v0(t){const e=z.c(14),{onClick:s,label:n,icon:i,colorClass:o,maxWidthClass:l}=t;let a;e[0]!==o?(a=ie("flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium group min-w-0 shrink animate-in fade-in duration-200",o),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==l?(c=ie("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:opacity-100",l),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==n||e[5]!==c?(d=r.jsx("span",{className:c,children:n}),e[4]=n,e[5]=c,e[6]=d):d=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(Is,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"}),e[7]=u):u=e[7];let h;return e[8]!==i||e[9]!==n||e[10]!==s||e[11]!==a||e[12]!==d?(h=r.jsxs("button",{type:"button",onClick:s,title:n,"aria-label":n,className:a,children:[i,d,u]}),e[8]=i,e[9]=n,e[10]=s,e[11]=a,e[12]=d,e[13]=h):h=e[13],h}function nI(){const t=z.c(6),e=Yt(),{org:s,locator:n}=Fe(),{create:i}=zc();let o;return t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==s.id||t[4]!==s.slug?(o=async l=>{const{tiptapDoc:a,virtualMcp:c}=l,d=crypto.randomUUID(),u=c?.id??Uo(s.id).id;qy(sessionStorage,n,d,{tiptapDoc:a});try{await i({id:d,virtual_mcp_id:u})}catch{}const h={virtualmcpid:u,autosend:vT};e({to:"/$org/$taskId",params:{org:s.slug,taskId:d},search:h})},t[0]=i,t[1]=n,t[2]=e,t[3]=s.id,t[4]=s.slug,t[5]=o):o=t[5],o}function iI({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const s=re(),n=Gp(),i=Ts(),o=n?.messages??[],l=n?.isStreaming??!1,a=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),d=i?.taskId??"",u=d||eE,h=nI(),{selectedModel:f,selectedVirtualMcp:m,isModelsLoading:p,tiptapDocRef:g,imageModel:x,webSearchModel:b,deepResearchModel:v,chatMode:L,setChatMode:_}=Il(),{data:y}=In.useSession(),S=y?.user?.id,{org:k,locator:w}=Fe(),j=Uo(k.id).id,N=Ms(m?.id),T=Cn(N?.id).runtime==="cms",C=t7(sA),[V,A]=P.useState(!1),{unsupportedFile:E,onUnsupportedFile:D,clearUnsupportedFile:I}=fD(),R=KR(),$=P.useRef(void 0),B=async()=>{$.current=ne;const _e=await R.startRecording();Je("chat_voice_started",{thread_id:d,outcome:_e==="recording"?"started":_e==="unsupported"?"unsupported":_e==="permission-denied"?"permission_denied":"unknown"})},M=()=>{Je("chat_voice_confirmed",{thread_id:d});const _e=R.stopRecording();Q.current?.syncVoiceText($.current,_e),Q.current?.focus()},O=()=>{Je("chat_voice_cancelled",{thread_id:d}),R.cancelRecording(),Q.current?.restoreContent($.current)};P.useEffect(()=>{if(R.status!=="recording")return;const _e=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();Q.current?.syncVoiceText($.current,_e)},[R.transcript,R.interimTranscript,R.status]);const F=i?.activeTask??null,U=F?.created_by,K=!!(S&&U&&U!==S),{data:q}=P6({enabled:K}),W=(q?.data?.members??[]).find(_e=>_e.userId===U),G=W?.user?.name??W?.user?.email?.split("@")[0]??null,Y=qc(),ee=Vy({isDesktopApp:Y,harnessId:F?.harness_id}),[ne,oe]=P.useState(()=>Nx(sessionStorage,w,u)??void 0),Z=_e=>{oe(_e),g.current=_e,w8(sessionStorage,w,u,_e,{onQuotaExceeded:({docSizeBytes:Pe})=>{Je("chat_draft_quota_exceeded",{thread_id:d||null,doc_size_bytes:Pe}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},J=P.useRef(d);if(J.current!==d){J.current=d;const _e=Nx(sessionStorage,w,u)??void 0;oe(_e),g.current=_e}const se=[...o].reverse().find(_e=>_e.role==="assistant")?.metadata?.modelLimits?.contextWindow??f?.limits?.contextWindow,Q=P.useRef(null),ce=P.useRef(!1),te=L==="plan",le=_e=>{C(),Je("chat_mode_changed",{from_mode:_e,to_mode:"default",source:"pill_dismiss"}),_("default")};P.useEffect(()=>{const _e=Pe=>{Ky(Pe)&&Pe.code==="KeyL"&&(Pe.preventDefault(),Pe.shiftKey&&_(L==="plan"?"default":"plan"),Q.current?.focus())};return document.addEventListener("keydown",_e),()=>document.removeEventListener("keydown",_e)},[L,_]);const ue=Ey(o),ae=[...o].reverse().find(_e=>_e.role==="assistant"&&_e.metadata?.usage)?.metadata?.usage?.contextTokens??0,de=!p&&!L8(ne),X=QR({hasDraft:de,isStreaming:l,isRunInProgress:a}),pe=X==="send",ye=X==="stop",we=_e=>{if(_e?.preventDefault(),X==="send"&&ne){if(Je("chat_message_sent",{thread_id:d||null,mode:L,model_id:f?.modelId??null,model_provider:f?.providerId??null,virtual_mcp_id:m?.id??null,submission:_e?"button_or_enter":"programmatic"}),n){if(n.isSendInFlight()){ge.info(s("chat.input.stillSendingPreviousMessage"));return}n.sendMessage(ne)}else h({tiptapDoc:ne,virtualMcp:m});sE(sessionStorage,w,u),Z(void 0)}else X==="stop"&&(Je("chat_message_stopped",{thread_id:d}),c())};if(K)return r.jsx(b0,{message:G?s("chat.input.readOnlyOthersChatNamed",{name:G}):s("chat.input.readOnlyOthersChat"),icon:G?r.jsx(Bs,{shape:"circle",size:"2xs",url:W?.user?.image??void 0,fallback:G.slice(0,2).toUpperCase()}):void 0});if(F?.metadata?.read_only)return r.jsx(b0,{message:s("chat.input.readOnlyThread")});if(ee)return r.jsx(b0,{message:s("chat.input.codingAgentRequiresDesktop")});if(T){if(!i)return r.jsx(b0,{message:s("chat.input.fastPreviewUnavailable")});const _e=()=>{const Pe=i.createTask({runtime:"sandbox"});Je("coding_session_started",{thread_id:Pe})};return r.jsxs("button",{type:"button",onClick:_e,className:"group flex w-full items-center gap-3 rounded-2xl border border-border bg-background/60 px-4 py-3.5 text-left shadow-sm backdrop-blur-sm transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[r.jsx(qo,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:s("chat.fastPreview.startCodingSession")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:s("chat.fastPreview.chatNeedsSession")})]}),r.jsx(Wo,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}return 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"}),n&&i&&r.jsx(Wf,{}),n&&i&&d?r.jsx(JE,{taskId:d}):null,r.jsx(Z8,{tiptapDoc:ne,setTiptapDoc:Z,disabled:R.status==="recording",enterToSubmit:!0,placeholder:s("chat.input.placeholder"),onSubmit:we,suggestionOpenRef:ce,children:r.jsxs("form",{onSubmit:we,className:ie("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[r.jsx(sI,{selectedModel:f,onUnsupportedFile:D,disabled:R.status==="recording"}),r.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:r.jsx(e7,{ref:Q,disabled:R.status==="recording",virtualMcpId:m?.id??j,showFileUploader:!0,selectedModel:f,onUnsupportedFile:D,suggestionOpenRef:ce})}),r.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:R.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(YR,{data:R.waveformData.slice(0,28)}),r.jsx("button",{type:"button",onClick:O,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":s("chat.input.cancelRecording"),children:r.jsx(Is,{size:16})}),r.jsx("button",{type:"button",onClick:M,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":s("chat.input.useTranscription"),children:r.jsx(qt,{size:16})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(BR,{disabled:!1,onOpenConnections:()=>{Je("connections_dialog_opened",{source:"tools_popover",mode:"add"}),A(!0)},virtualMcpId:m?.id??j,selectedModel:f,isStreaming:l,onUnsupportedFile:D}),te&&r.jsx(v0,{onClick:()=>le("plan"),label:s("chat.input.planMode"),icon:r.jsx(kc,{size:14,className:"shrink-0"}),colorClass:"text-violet-600 dark:text-violet-400 hover:bg-violet-500/10",maxWidthClass:"@[320px]/chat-bottom:max-w-32"}),L==="gen-image"&&x&&r.jsx(v0,{onClick:()=>le("gen-image"),label:s("chat.input.createImage"),icon:r.jsx(_i,{size:14,className:"shrink-0"}),colorClass:"text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),L==="web-search"&&b&&r.jsx(v0,{onClick:()=>le("web-search"),label:s("chat.input.webSearch"),icon:r.jsx(Rr,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),L==="deep-research"&&v&&r.jsx(v0,{onClick:()=>le("deep-research"),label:s("chat.input.deepResearch"),icon:r.jsx(i6,{size:14,className:"shrink-0"}),colorClass:"text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",maxWidthClass:"@[320px]/chat-bottom:max-w-[120px]"}),se&&ae>0&&r.jsx(wN,{usage:ue,totalTokens:ae,contextWindow:se,onOpenContextPanel:t})]}),r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx(lD,{}),R.isSupported&&r.jsx(he,{type:"button",onClick:B,disabled:!1,variant:"ghost",size:"icon",className:ie("size-8 rounded-lg transition-colors",R.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:R.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),"aria-label":R.status==="permission-denied"?s("chat.input.microphoneAccessDenied"):s("chat.input.voiceInput"),children:r.jsx(RT,{size:18})}),r.jsx(he,{type:ye?"button":"submit",onClick:_e=>{ye&&(_e.preventDefault(),_e.stopPropagation(),c())},variant:pe||ye?"default":"ghost",size:"icon",disabled:!pe&&!ye,className:ie("size-8 rounded-lg transition-all",!pe&&!ye&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:s(X==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessageEnter"),"aria-label":s(X==="stop"?l?"chat.input.stopGenerating":"chat.input.cancelRun":"chat.input.sendMessage"),children:ye?r.jsx(IT,{size:20}):r.jsx(bf,{size:20})})]})]})})]})},d),e&&r.jsx(HR,{onClick:()=>{Je("connections_banner_clicked",{source:"home_chat_input"}),Je("connections_dialog_opened",{source:"home_banner",mode:"add"}),A(!0)}})]})}),r.jsx(L2,{mode:"browse",open:V,onOpenChange:A,defaultTab:"all"}),r.jsx(uD,{info:E,onClose:I})]})}function rI(t){let e=0;for(const s of t)for(const n of s.parts??[]){const i=n;i.type==="tool-load_repo"&&i.state==="output-available"&&i.output?.success===!0&&e++}return e}function oI(){const t=z.c(8),e=Yt(),s=s2(),n=Gp()?.messages??[],i=Ts()?.taskId??null;let o;t[0]!==n?(o=rI(n),t[0]=n,t[1]=o):o=t[1];const l=o,a=P.useRef(null),c=P.useRef(null);let d,u;t[2]!==l||t[3]!==s||t[4]!==e||t[5]!==i?(d=()=>{if(!l||!i)return;const h=`${i}:${l}`;c.current!==h&&(c.current=h,s?.refreshThreadMetadata(i)),a.current!==i&&(a.current=i,e({to:".",search:lI,replace:!0}))},u=[l,i,e,s],t[2]=l,t[3]=s,t[4]=e,t[5]=i,t[6]=d,t[7]=u):(d=t[6],u=t[7]),P.useEffect(d,u)}function lI(t){return{...t,main:"preview"}}const aI={usd:[{dollars:10,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:20,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.bestValueLabel"}],brl:[{dollars:50,labelKey:"chat.creditsEmptyState.starterLabel"},{dollars:100,labelKey:"chat.creditsEmptyState.popularLabel"},{dollars:500,labelKey:"chat.creditsEmptyState.bestValueLabel"}]};function s7(t){return`deco-credits-empty-dismissed:${t}`}function cI(t){try{return localStorage.getItem(s7(t))==="1"}catch{return!1}}function dI(){const t=z.c(68),e=re(),{org:s}=Fe(),n=Yt(),{decoKeyId:i}=_2(),o=ys(),[l,a]=P.useState(!0),[c,d]=P.useState(""),[u,h]=P.useState(!1),[f,m]=P.useState("usd"),p=f==="brl"?"R$":"$";let g;t[0]!==s.id?(g=()=>{Je("credits_empty_state_dismissed",{organization_id:s.id}),a(!1);try{localStorage.setItem(s7(s.id),"1")}catch{}},t[0]=s.id,t[1]=g):g=t[1];const x=g;let b,v;t[2]!==l||t[3]!==s.id?(b=()=>{l&&Je("credits_empty_state_shown",{organization_id:s.id})},v=[l,s.id],t[2]=l,t[3]=s.id,t[4]=b,t[5]=v):(b=t[4],v=t[5]),P.useEffect(b,v);let L;t[6]!==f||t[7]!==o?(L=async Y=>{const{url:ee}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:Y,currency:f});return ee},t[6]=f,t[7]=o,t[8]=L):L=t[8];let _;t[9]!==x?(_=Y=>{Y&&window.open(Y,"_blank","noopener,noreferrer"),x()},t[9]=x,t[10]=_):_=t[10];let y;t[11]!==e?(y=Y=>{ge.error(e("chat.creditsEmptyState.topUpFailed",{message:Y.message}))},t[11]=e,t[12]=y):y=t[12];let S;t[13]!==L||t[14]!==_||t[15]!==y?(S={mutationFn:L,onSuccess:_,onError:y},t[13]=L,t[14]=_,t[15]=y,t[16]=S):S=t[16];const{mutate:k,isPending:w}=Rs(S),j=parseFloat(c),N=!isNaN(j)&&j>=1;if(!l)return null;let T;t[17]!==x?(T=Y=>!Y&&x(),t[17]=x,t[18]=T):T=t[18];let C;t[19]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=C):C=t[19];let V;t[20]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:r.jsx(r6,{size:20,className:"text-warning"})}),t[20]=V):V=t[20];let A;t[21]!==e?(A=e("chat.creditsEmptyState.title"),t[21]=e,t[22]=A):A=t[22];let E;t[23]!==A?(E=r.jsx(Kt,{className:"text-lg font-semibold",children:A}),t[23]=A,t[24]=E):E=t[24];let D;t[25]!==e?(D=e("chat.creditsEmptyState.description"),t[25]=e,t[26]=D):D=t[26];let I;t[27]!==D?(I=r.jsx(kn,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:D}),t[27]=D,t[28]=I):I=t[28];let R;t[29]!==E||t[30]!==I?(R=r.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[C,r.jsxs(os,{className:"relative gap-3",children:[V,r.jsxs("div",{className:"text-center",children:[E,I]})]})]}),t[29]=E,t[30]=I,t[31]=R):R=t[31];let $;t[32]!==f||t[33]!==p||t[34]!==c||t[35]!==j||t[36]!==i||t[37]!==N||t[38]!==w||t[39]!==u||t[40]!==e||t[41]!==k?($=i&&r.jsxs("div",{className:"px-6 pb-5",children:[r.jsx("div",{className:"mb-4",children:r.jsxs(Ef,{type:"single",variant:"outline",size:"sm",value:f,onValueChange:Y=>{Y&&m(Y)},children:[r.jsx(Cc,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),r.jsx(Cc,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),r.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:aI[f].map(Y=>{const{dollars:ee,labelKey:ne}=Y;return r.jsxs("button",{type:"button",disabled:w,onClick:()=>{Je("credits_topup_clicked",{amount_cents:ee*100,currency:f,tier_label:ne,source:"empty_state"}),k(ee*100)},className:ie("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,ee]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e(ne)})]},ee)})}),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(gt,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:Y=>d(Y.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),r.jsx(he,{className:"h-10",disabled:!N||w,onClick:()=>{Je("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:f,tier_label:"custom",source:"empty_state"}),k(Math.round(j*100))},children:e(w?"chat.creditsEmptyState.opening":"chat.creditsEmptyState.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:e("chat.creditsEmptyState.enterCustomAmount")})]}),t[32]=f,t[33]=p,t[34]=c,t[35]=j,t[36]=i,t[37]=N,t[38]=w,t[39]=u,t[40]=e,t[41]=k,t[42]=$):$=t[42];let B;t[43]!==x||t[44]!==n||t[45]!==s.slug?(B=()=>{n({to:"/$org/settings/ai-providers",params:{org:s.slug}}),x()},t[43]=x,t[44]=n,t[45]=s.slug,t[46]=B):B=t[46];let M;t[47]!==e?(M=e("chat.creditsEmptyState.useYourOwnProvider"),t[47]=e,t[48]=M):M=t[48];let O;t[49]===Symbol.for("react.memo_cache_sentinel")?(O=r.jsx(Wo,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[49]=O):O=t[49];let F;t[50]!==B||t[51]!==M?(F=r.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:B,children:[M,O]}),t[50]=B,t[51]=M,t[52]=F):F=t[52];let U;t[53]!==e?(U=e("chat.creditsEmptyState.skipForNow"),t[53]=e,t[54]=U):U=t[54];let K;t[55]!==x||t[56]!==U?(K=r.jsx(he,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:x,children:U}),t[55]=x,t[56]=U,t[57]=K):K=t[57];let q;t[58]!==F||t[59]!==K?(q=r.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,K]}),t[58]=F,t[59]=K,t[60]=q):q=t[60];let W;t[61]!==R||t[62]!==$||t[63]!==q?(W=r.jsxs(Bt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:uI,children:[R,$,q]}),t[61]=R,t[62]=$,t[63]=q,t[64]=W):W=t[64];let G;return t[65]!==W||t[66]!==T?(G=r.jsx(zt,{open:!0,onOpenChange:T,children:W}),t[65]=W,t[66]=T,t[67]=G):G=t[67],G}function uI(t){return t.preventDefault()}function hI(t){const e=z.c(6),{balanceDollars:s}=t;let n;e[0]!==s?(n=s.toFixed(2),e[0]=s,e[1]=n):n=e[1];const i=n;let o,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=r.jsx(r6,{size:13,className:"text-success"}),e[2]=o,e[3]=l):(o=e[2],l=e[3]);let a;return e[4]!==i?(a=r.jsxs("div",{className:o,children:[l,r.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",i," in credits to get started"]})]}),e[4]=i,e[5]=a):a=e[5],a}function fI(){const t=z.c(8),{org:e}=Fe(),s=Yt();let n;t[0]!==s||t[1]!==e.slug?(n=()=>s({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=s,t[1]=e.slug,t[2]=n):n=t[2];let i,o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=ie("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),o=r.jsx(bn,{size:13,className:"text-warning"}),l=r.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=i,t[4]=o,t[5]=l):(i=t[3],o=t[4],l=t[5]);let a;return t[6]!==n?(a=r.jsxs("button",{type:"button",onClick:n,className:i,children:[o,l]}),t[6]=n,t[7]=a):a=t[7],a}function mI(t){const e=z.c(11),{className:s}=t;let n;e[0]!==s?(n=ie("flex h-full w-full flex-col bg-background",s),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=i):i=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex items-center gap-3",children:[i,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 l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=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]=l):l=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=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(y0,{align:"right",width:"w-3/4"}),r.jsx(y0,{align:"left",width:"w-full",lines:3}),r.jsx(y0,{align:"right",width:"w-2/3"}),r.jsx(y0,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=a):a=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]!==n?(h=r.jsxs("div",{className:n,children:[l,a,u]}),e[9]=n,e[10]=h):h=e[10],h}function y0(t){const e=z.c(22),{align:s,width:n,lines:i}=t,o=n===void 0?"w-full":n,l=i===void 0?1:i,a=s==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==a?(c=ie("flex w-full gap-4 px-4 py-2",a),e[0]=a,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=ie("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=ie("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]!==l?(p=Array.from({length:l}),e[8]=l,e[9]=p):p=e[9];let g;e[10]!==l||e[11]!==p?(g=r.jsx("div",{className:"space-y-2",children:p.map((L,_)=>r.jsx("div",{className:ie("h-3 rounded bg-muted-foreground/20 animate-pulse",_===l-1?"w-3/4":"w-full"),style:{animationDelay:`${_*.1}s`}},_))}),e[10]=l,e[11]=p,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==m?(x=r.jsx("div",{className:m,children:g}),e[13]=g,e[14]=m,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==u?(b=r.jsxs("div",{className:u,children:[h,x]}),e[16]=x,e[17]=u,e[18]=b):b=e[18];let v;return e[19]!==b||e[20]!==c?(v=r.jsx("div",{className:c,children:b}),e[19]=b,e[20]=c,e[21]=v):v=e[21],v}function pI(t){const e=z.c(7),{scrollRef:s,sentinelRef:n,hasMoreOlder:i,isFetchingOlder:o,fetchOlderMessages:l}=t;let a,c;e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==s||e[4]!==n?(a=()=>{const d=n.current,u=s.current;if(!d||!u||!i)return;const h=new IntersectionObserver(async f=>{if(!f[0]?.isIntersecting||o||!i)return;const p=u.scrollHeight,g=u.scrollTop;await l(),requestAnimationFrame(()=>{const x=u.scrollHeight;u.scrollTop=g+(x-p)})},{root:u,rootMargin:"200px 0px 0px 0px"});return h.observe(d),()=>h.disconnect()},c=[s,n,i,o,l],e[0]=l,e[1]=i,e[2]=o,e[3]=s,e[4]=n,e[5]=a,e[6]=c):(a=e[5],c=e[6]),P.useEffect(a,c)}function gI(t){const e=z.c(5),{className:s,children:n}=t;let i;e[0]!==s?(i=ie("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",s),e[0]=s,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=r.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function xI(t){const e=z.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-1 min-h-0 overflow-y-auto isolate",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}function bI(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:s}),e[0]=s,e[1]=n):n=e[1],n}function vI(){const t=re(),{messages:e,status:s,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o}=ui(),{taskId:l}=un();oI();const a=Ty(l??""),c=oN(a),d=c.size===0?e:e.filter(v=>!c.has(v.id)),u=SN(d),h=u.at(-1),m=ZP()*OP+16,p=P.useRef(null),g=P.useRef(null);pI({scrollRef:p,sentinelRef:g,hasMoreOlder:n,isFetchingOlder:i,fetchOlderMessages:o});const x=kN({initial:!1}),b=v=>{p.current=v,x.scrollRef(v)};return r.jsx(jN,{messages:e,children:r.jsxs("div",{className:"relative h-full w-full min-w-0",children:[r.jsx("div",{ref:b,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:m},children:r.jsxs("div",{ref:x.contentRef,className:"overflow-x-clip",children:[r.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[r.jsx("div",{ref:g,"aria-hidden":!0,className:"h-px"}),i&&r.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),u.slice(0,-1).map((v,L)=>r.jsx(hx,{pair:v,isLastPair:!1,status:L===u.length-1?s:void 0},`pair-${v.user?.id??v.assistant?.id}`))]}),h&&r.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:r.jsx(hx,{pair:h,isLastPair:!0,status:s},`pair-${h.user?.id??h.assistant?.id}`)})]})}),!x.isAtBottom&&r.jsx(he,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 rounded-full shadow-md animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:m+8},onClick:()=>{x.scrollToBottom()},children:r.jsx(JC,{size:14})})]})})}function yI(t){const e=z.c(5),{children:s,className:n}=t;let i;e[0]!==n?(i=ie("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==s||e[3]!==i?(o=r.jsx("div",{className:i,children:s}),e[2]=s,e[3]=i,e[4]=o):o=e[4],o}const hs=Object.assign(gI,{Main:xI,Messages:vI,EmptyState:bI,Footer:yI,Input:iI,Provider:rN,ActiveTaskProvider:iN,Skeleton:mI,IceBreakers:$P,NoAiProviderEmptyState:EV,CreditsEmptyState:dI,CreditsEyebrow:hI,NoCreditsEyebrow:fI,CreditsExhaustedBanner:E8});function _I({isThreadLocked:t,hasCloudProviderKeys:e}){return t?!1:!e}function LI(){const t=z.c(3),e=If(),n=Ts()?.isThreadLocked??!1,i=e.length>0;let o;return t[0]!==n||t[1]!==i?(o=_I({isThreadLocked:n,hasCloudProviderKeys:i}),t[0]=n,t[1]=i,t[2]=o):o=t[2],o}function md(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function t1(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 wI(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function SI(t){const e=z.c(4),{items:s}=t;let n;e[0]!==s?(n=s.map(kI),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=r.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:n}),e[2]=n,e[3]=i):i=e[3],i}function kI(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 jI(t){const e=z.c(33),{userTokens:s,assistantTokens:n,otherTokens:i}=t,o=re(),l=s+n+i,a=l>0?s/l*100:0,c=l>0?n/l*100:0,d=l>0?i/l*100:0;let u;e[0]!==a?(u=a>0&&r.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==c?(h=c>0&&r.jsx("div",{className:"h-full bg-chart-2",style:{width:`${c}%`}}),e[2]=c,e[3]=h):h=e[3];let f;e[4]!==d?(f=d>0&&r.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${d}%`}}),e[4]=d,e[5]=f):f=e[5];let m;e[6]!==u||e[7]!==h||e[8]!==f?(m=r.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[u,h,f]}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=p):p=e[10];let g;e[11]!==o||e[12]!==a?(g=o("chat.contextPanel.userPercent",{pct:a.toFixed(1)}),e[11]=o,e[12]=a,e[13]=g):g=e[13];let x;e[14]!==g?(x=r.jsxs("div",{className:"flex items-center gap-1.5",children:[p,r.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e[14]=g,e[15]=x):x=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[16]=b):b=e[16];let v;e[17]!==c||e[18]!==o?(v=o("chat.contextPanel.assistantPercent",{pct:c.toFixed(1)}),e[17]=c,e[18]=o,e[19]=v):v=e[19];let L;e[20]!==v?(L=r.jsxs("div",{className:"flex items-center gap-1.5",children:[b,r.jsx("span",{className:"text-xs text-muted-foreground",children:v})]}),e[20]=v,e[21]=L):L=e[21];let _;e[22]!==d||e[23]!==i||e[24]!==o?(_=i>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.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.otherPercent",{pct:d.toFixed(1)})})]}),e[22]=d,e[23]=i,e[24]=o,e[25]=_):_=e[25];let y;e[26]!==L||e[27]!==_||e[28]!==x?(y=r.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[x,L,_]}),e[26]=L,e[27]=_,e[28]=x,e[29]=y):y=e[29];let S;return e[30]!==y||e[31]!==m?(S=r.jsxs("div",{className:"flex flex-col gap-2",children:[m,y]}),e[30]=y,e[31]=m,e[32]=S):S=e[32],S}function CI(t){const e=z.c(14),{agentId:s,isError:n}=t,i=Ms(s),o=re();let l;e[0]!==i?.title||e[1]!==o?(l=i?.title??o("chat.subtask.subtaskNoun"),e[0]=i?.title,e[1]=o,e[2]=l):l=e[2];const a=l,c=i?.icon??null;let d;e[3]!==c||e[4]!==a?(d=r.jsx(Ai,{icon:c,name:a,size:"xs",className:"size-6 rounded-md shrink-0"}),e[3]=c,e[4]=a,e[5]=d):d=e[5];const u=n?"text-destructive":"text-foreground";let h;e[6]!==u?(h=ie("shrink-0 font-medium",u),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==a||e[9]!==h?(f=r.jsx("span",{className:h,children:a}),e[8]=a,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==d||e[12]!==f?(m=r.jsxs(r.Fragment,{children:[d,f]}),e[11]=d,e[12]=f,e[13]=m):m=e[13],m}function NI(t){const e=z.c(12),{isError:s}=t,n=re();let i;e[0]!==n?(i=n("chat.contextPanel.subtask"),e[0]=n,e[1]=i):i=e[1];const o=i;let l;e[2]!==o?(l=r.jsx(Ai,{icon:null,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[2]=o,e[3]=l):l=e[3];const a=s?"text-destructive":"text-foreground";let c;e[4]!==a?(c=ie("shrink-0 font-medium",a),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==o||e[7]!==c?(d=r.jsx("span",{className:c,children:o}),e[6]=o,e[7]=c,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==d?(u=r.jsxs(r.Fragment,{children:[l,d]}),e[9]=l,e[10]=d,e[11]=u):u=e[11],u}function TI(t){const e=z.c(18),{part:s}=t,n=s.input?.agent_id,i=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",l=s.state==="approval-requested";let a;e[0]!==o?(a=r.jsx(NI,{isError:o}),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n||e[3]!==o?(c=r.jsx(CI,{agentId:n,isError:o}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let d;e[5]!==a||e[6]!==c?(d=r.jsx(P.Suspense,{fallback:a,children:c}),e[5]=a,e[6]=c,e[7]=d):d=e[7];let u;e[8]!==s.input?(u=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]=u):u=e[9];let h;e[10]!==l||e[11]!==o||e[12]!==i?(h=r.jsx("span",{className:"ml-auto shrink-0",children:i?r.jsx(lt,{size:12,className:"animate-spin text-muted-foreground"}):o?r.jsx(DT,{size:12,className:"text-destructive"}):l?r.jsx(bn,{size:12,className:"text-warning"}):r.jsx(hi,{size:12,className:"text-success"})}),e[10]=l,e[11]=o,e[12]=i,e[13]=h):h=e[13];let f;return e[14]!==d||e[15]!==u||e[16]!==h?(f=r.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[d,u,h]}),e[14]=d,e[15]=u,e[16]=h,e[17]=f):f=e[17],f}function VI(t){const e=z.c(78),{onClose:s,back:n,className:i}=t,o=re(),[l,a]=P.useState(null),{messages:c}=ui(),{activeTask:d}=un(),{selectedModel:u,selectedVirtualMcp:h}=Il();let f,m,p,g,x,b,v,L;if(e[0]!==d||e[1]!==n||e[2]!==i||e[3]!==c||e[4]!==s||e[5]!==l?.id||e[6]!==u||e[7]!==h?.title||e[8]!==o){L=Symbol.for("react.early_return_sentinel");e:{const S=Ey(c),k=[...c].reverse().find(zI),w=k?.metadata?.usage,j=k?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,N=w?.contextTokens??0,T=j&&j>0?(N/j*100).toFixed(1):null,C=c;let V;e[17]!==C?(V=C.filter(BI).reduce(OI,0),e[17]=C,e[18]=V):V=e[18];const A=V,E=c;let D;e[19]!==E?(D=E.filter($I).reduce(MI,0),e[19]=E,e[20]=D):D=e[20];const I=D,R=Math.max(0,S.totalTokens-A-I),$=c[0],B=c.at(-1),M=$?.metadata?.created_at??d?.created_at,O=B?.metadata?.created_at??d?.updated_at,F=c.filter(II),U=c.flatMap(DI),K=u?.modelId?wI(u.modelId):"—",q=h?.title??"Super Agent",W=[{label:o("chat.contextPanel.sessionLabel"),value:d?.title??o("chat.contextPanel.newChat")},{label:o("chat.contextPanel.messagesLabel"),value:F.length},{label:o("chat.contextPanel.agentLabel"),value:q},{label:o("chat.contextPanel.modelLabel"),value:K},{label:o("chat.contextPanel.contextLimitLabel"),value:j?md(j):"—"},{label:o("chat.contextPanel.sessionTokensLabel"),value:S.totalTokens>0?md(S.totalTokens):"0"},{label:o("chat.contextPanel.usageLabel"),value:T!==null?`${T}%`:"—"},{label:o("chat.contextPanel.inputTokensLabel"),value:S.inputTokens>0?md(S.inputTokens):"0"},{label:o("chat.contextPanel.outputTokensLabel"),value:S.outputTokens>0?md(S.outputTokens):"0"},{label:o("chat.contextPanel.reasoningTokensLabel"),value:S.reasoningTokens>0?md(S.reasoningTokens):"0"},{label:o("chat.contextPanel.costLabel"),value:S.cost>0?`$${S.cost<.001?S.cost.toFixed(6):S.cost.toFixed(4)}`:"$0.00"},{label:o("chat.contextPanel.sessionCreatedLabel"),value:t1(M)},{label:o("chat.contextPanel.lastActivityLabel"),value:t1(O)}];if(!d&&F.length===0){let H;e[21]!==i?(H=ie("flex flex-col h-full w-full border-l border-border bg-background",i),e[21]=i,e[22]=H):H=e[22];let se;e[23]!==o?(se=o("chat.contextPanel.title"),e[23]=o,e[24]=se):se=e[24];let Q;e[25]!==se?(Q=r.jsx("span",{className:"text-sm font-medium text-foreground",children:se}),e[25]=se,e[26]=Q):Q=e[26];let ce;e[27]!==n?(ce=n?r.jsx(rm,{size:14,className:"text-muted-foreground"}):r.jsx(Li,{size:14,className:"text-muted-foreground"}),e[27]=n,e[28]=ce):ce=e[28];let te;e[29]!==s||e[30]!==ce?(te=r.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ce}),e[29]=s,e[30]=ce,e[31]=te):te=e[31];let le;e[32]!==Q||e[33]!==te?(le=r.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[Q,te]}),e[32]=Q,e[33]=te,e[34]=le):le=e[34];let ue;e[35]!==o?(ue=o("chat.contextPanel.emptyState"),e[35]=o,e[36]=ue):ue=e[36];let fe;e[37]!==ue?(fe=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:ue})}),e[37]=ue,e[38]=fe):fe=e[38];let ae;e[39]!==H||e[40]!==le||e[41]!==fe?(ae=r.jsxs("div",{className:H,children:[le,fe]}),e[39]=H,e[40]=le,e[41]=fe,e[42]=ae):ae=e[42],L=ae;break e}e[43]!==i?(b=ie("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",i),e[43]=i,e[44]=b):b=e[44];let G;e[45]!==o?(G=o("chat.contextPanel.title"),e[45]=o,e[46]=G):G=e[46];let Y;e[47]!==G?(Y=r.jsx("span",{className:"text-sm font-medium text-foreground",children:G}),e[47]=G,e[48]=Y):Y=e[48];let ee;e[49]!==n?(ee=n?r.jsx(rm,{size:14}):r.jsx(Li,{size:14}),e[49]=n,e[50]=ee):ee=e[50];let ne;e[51]!==s||e[52]!==ee?(ne=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:ee}),e[51]=s,e[52]=ee,e[53]=ne):ne=e[53],e[54]!==Y||e[55]!==ne?(v=r.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[Y,ne]}),e[54]=Y,e[55]=ne,e[56]=v):v=e[56],f="flex flex-col gap-8 p-6",m=U.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.subtasksSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:U.map(EI)})]}),p=r.jsx(SI,{items:W});let oe;e[57]!==o?(oe=o("chat.contextPanel.contextBreakdownSection"),e[57]=o,e[58]=oe):oe=e[58];let Z;e[59]!==oe?(Z=r.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[59]=oe,e[60]=Z):Z=e[60];let J;e[61]!==I||e[62]!==R||e[63]!==A?(J=r.jsx(jI,{userTokens:A,assistantTokens:I,otherTokens:R}),e[61]=I,e[62]=R,e[63]=A,e[64]=J):J=e[64],e[65]!==Z||e[66]!==J?(g=r.jsxs("div",{className:"flex flex-col gap-3",children:[Z,J]}),e[65]=Z,e[66]=J,e[67]=g):g=e[67],x=F.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.contextPanel.rawMessagesSection")}),r.jsx("div",{className:"flex flex-col gap-1",children:F.map(H=>{const se=H.metadata?.created_at,Q=l?.id===H.id;return r.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>a(Q?null:H),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:ie("shrink-0 font-medium",H.role==="user"?"text-chart-1":"text-chart-2"),children:H.role}),r.jsx("span",{className:"text-muted-foreground",children:"•"}),r.jsx("span",{className:"truncate text-muted-foreground font-mono",children:H.id})]}),se&&r.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:t1(se)})]}),Q&&r.jsxs(r.Fragment,{children:[H.role==="assistant"&&(()=>{const ce=H.metadata?._request;if(!ce)return null;const te=ce.systemSections??[],le=Math.max(1,...te.map(PI)),ue=te.reduce(AI,0);return r.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-foreground",children:o("chat.contextPanel.requestLabel")}),r.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[ce.activeTools??0," / ",ce.tools??0," ",o("chat.contextPanel.toolsActive")]})]}),te.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"text-muted-foreground",children:[o("chat.contextPanel.systemPromptLabel")," ",r.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ue/4).toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),te.map((fe,ae)=>{const de=fe.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${ae}`,X=fe.chars/le*100,pe=Math.round(fe.chars/4);return r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-mono text-foreground truncate",children:de}),r.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",pe.toLocaleString()," ",o("chat.contextPanel.tokAbbrev")]})]}),r.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${X}%`}})})]},ae)})]})]})})(),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(H,null,2)})]})]},H.id)})})]})}e[0]=d,e[1]=n,e[2]=i,e[3]=c,e[4]=s,e[5]=l?.id,e[6]=u,e[7]=h?.title,e[8]=o,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=x,e[14]=b,e[15]=v,e[16]=L}else f=e[9],m=e[10],p=e[11],g=e[12],x=e[13],b=e[14],v=e[15],L=e[16];if(L!==Symbol.for("react.early_return_sentinel"))return L;let _;e[68]!==f||e[69]!==m||e[70]!==p||e[71]!==g||e[72]!==x?(_=r.jsxs("div",{className:f,children:[m,p,g,x]}),e[68]=f,e[69]=m,e[70]=p,e[71]=g,e[72]=x,e[73]=_):_=e[73];let y;return e[74]!==b||e[75]!==v||e[76]!==_?(y=r.jsxs("div",{className:b,children:[v,_]}),e[74]=b,e[75]=v,e[76]=_,e[77]=y):y=e[77],y}function AI(t,e){return t+e.chars}function PI(t){return t.chars}function EI(t,e){return r.jsx(TI,{part:t},e)}function DI(t){return(t.parts??[]).filter(RI)}function RI(t){return t.type==="tool-subtask"}function II(t){return t.role!=="system"}function MI(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function $I(t){return t.role==="assistant"}function OI(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function BI(t){return t.role==="user"}function zI(t){return t.role==="assistant"&&t.metadata?.usage}function FI(t){const e=z.c(21),{onOpenContextPanel:s}=t,{org:n}=Fe(),{selectedVirtualMcp:i}=Il();let o;e[0]!==n.id?(o=Uo(n.id),e[0]=n.id,e[1]=o):o=e[1];const a=i??o,d=Ms(a.id)??a,u=d.title??"Super Agent",h=d.icon??null,f=d.description??null;let m;e[2]!==h||e[3]!==u?(m=r.jsx(ai,{icon:h,name:u,size:"lg"}),e[2]=h,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==u?(p=r.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:u}),e[5]=u,e[6]=p):p=e[6];let g;e[7]!==f?(g=f?r.jsx("p",{className:"text-sm text-muted-foreground max-w-md text-balance",children:f}):null,e[7]=f,e[8]=g):g=e[8];let x;e[9]!==p||e[10]!==g?(x=r.jsxs("div",{className:"space-y-1.5",children:[p,g]}),e[9]=p,e[10]=g,e[11]=x):x=e[11];let b;e[12]!==m||e[13]!==x?(b=r.jsxs("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-4 px-6 text-center overflow-hidden",children:[m,x]}),e[12]=m,e[13]=x,e[14]=b):b=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(hs.IceBreakers,{className:"pb-3"}),e[15]=v):v=e[15];let L;e[16]!==s?(L=r.jsxs(hs.Footer,{children:[v,r.jsx(hs.Input,{onOpenContextPanel:s})]}),e[16]=s,e[17]=L):L=e[17];let _;return e[18]!==b||e[19]!==L?(_=r.jsxs(r.Fragment,{children:[b,L]}),e[18]=b,e[19]=L,e[20]=_):_=e[20],_}function qx(t){const e=z.c(17),{outputs:s,collapsed:n,onToggle:i,variant:o}=t,l=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let a;e[0]!==l?(a=ie(l),e[0]=l,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=c):c=e[2];const d=n&&"-rotate-90";let u;e[3]!==d?(u=ie("size-4 text-muted-foreground transition-transform",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==u?(h=r.jsx(_s,{className:u}),e[5]=u,e[6]=h):h=e[6];let f;e[7]!==i||e[8]!==h?(f=r.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[c,h]}),e[7]=i,e[8]=h,e[9]=f):f=e[9];let m;e[10]!==n||e[11]!==s?(m=!n&&r.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(UI)}),e[10]=n,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==a||e[14]!==f||e[15]!==m?(p=r.jsxs("div",{className:a,children:[f,m]}),e[13]=a,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function UI(t){return r.jsx(NN,{file:t},t.key)}function HI(){const t=z.c(13),e=Ts()?.taskId??null,s=CN();let n;t[0]!==s?(n={enabled:s},t[0]=s,t[1]=n):n=t[1];const{data:i}=Dy(e,n),[o,l]=P.useState(!1),[a,c]=P.useState(!0);if(!e||!i||i.length===0)return null;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>l(WI),t[2]=d):d=t[2];let u;t[3]!==o||t[4]!==i?(u=r.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:r.jsx(qx,{variant:"card",outputs:i,collapsed:o,onToggle:d})}),t[3]=o,t[4]=i,t[5]=u):u=t[5];let h;t[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(KI),t[6]=h):h=t[6];let f;t[7]!==a||t[8]!==i?(f=r.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:r.jsx(qx,{variant:"bar",outputs:i,collapsed:a,onToggle:h})}),t[7]=a,t[8]=i,t[9]=f):f=t[9];let m;return t[10]!==u||t[11]!==f?(m=r.jsxs(r.Fragment,{children:[u,f]}),t[10]=u,t[11]=f,t[12]=m):m=t[12],m}function KI(t){return!t}function WI(t){return!t}function qI(){const t=z.c(31),{org:e}=Fe(),s=Ts(),{isChatEmpty:n}=ui(),[i,o]=P.useState("chat"),l=_2(),a=LI(),{runtime:c}=Cn(s?.virtualMcpId);if(a&&c!=="cms"){let N;return t[0]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(hs,{className:"animate-in fade-in-0 duration-200",children:r.jsx(hs.Main,{className:"flex flex-col items-center",children:r.jsx(hs.EmptyState,{children:r.jsx(hs.NoAiProviderEmptyState,{})})})}),t[0]=N):N=t[0],N}let u;t[1]!==l.hasDecoKey||t[2]!==l.hasOnlyDecoProvider||t[3]!==l.isLoading||t[4]!==l.isZeroBalance||t[5]!==n||t[6]!==e?(u=l.hasDecoKey&&l.isZeroBalance&&l.hasOnlyDecoProvider&&!l.isLoading&&n&&!cI(e.id),t[1]=l.hasDecoKey,t[2]=l.hasOnlyDecoProvider,t[3]=l.isLoading,t[4]=l.isZeroBalance,t[5]=n,t[6]=e,t[7]=u):u=t[7];const h=u;let f;t[8]!==h?(f=h&&r.jsx(hs.CreditsEmptyState,{}),t[8]=h,t[9]=f):f=t[9];const m=i!=="chat"?!0:void 0,p=i!=="chat",g=i!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let x;t[10]!==g?(x=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",g),t[10]=g,t[11]=x):x=t[11];let b;t[12]!==n||t[13]!==c?(b=n&&c!=="cms"?r.jsx(FI,{onOpenContextPanel:()=>o("context")}):r.jsxs(r.Fragment,{children:[r.jsxs(hs.Main,{className:"relative flex flex-col overflow-hidden @container",children:[r.jsx(HI,{}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(hs.Messages,{})})]}),r.jsx(hs.Footer,{children:r.jsx(hs.Input,{onOpenContextPanel:()=>o("context")})})]}),t[12]=n,t[13]=c,t[14]=b):b=t[14];let v;t[15]!==m||t[16]!==p||t[17]!==x||t[18]!==b?(v=r.jsx("div",{inert:m,"aria-hidden":p,className:x,children:b}),t[15]=m,t[16]=p,t[17]=x,t[18]=b,t[19]=v):v=t[19];const L=i!=="context"?!0:void 0,_=i!=="context",y=i==="context"?"opacity-100":"opacity-0 pointer-events-none";let S;t[20]!==y?(S=ie("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",y),t[20]=y,t[21]=S):S=t[21];let k;t[22]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(VI,{back:!0,onClose:()=>o("chat")}),t[22]=k):k=t[22];let w;t[23]!==S||t[24]!==L||t[25]!==_?(w=r.jsx("div",{inert:L,"aria-hidden":_,className:S,children:k}),t[23]=S,t[24]=L,t[25]=_,t[26]=w):w=t[26];let j;return t[27]!==f||t[28]!==w||t[29]!==v?(j=r.jsxs(hs,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[f,v,w]}),t[27]=f,t[28]=w,t[29]=v,t[30]=j):j=t[30],j}function n7(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(hs.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(Ws,{fallback:e,children:r.jsx(P.Suspense,{fallback:r.jsx(hs.Skeleton,{}),children:r.jsx(qI,{})})}),t[1]=s):s=t[1],s}function GI(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function sg(t){return t?.name||t?.email?.split("@")[0]||void 0}function qf(t){const e=GI(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}async function YI(t,e,s){const n=await t.callTool({name:e,arguments:s});if(n.isError){const i=n.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(i)}return n}const i7=["SANDBOX_START"],_0=new Map,JI=t=>`${t.virtualMcpId}::${t.branch??""}`,QI=t=>t.message.includes("retry shortly"),s1=new Set,gm={mark:(t,e)=>s1.add(`${t}::${e}`),clear:(t,e)=>s1.delete(`${t}::${e}`),isStopped:(t,e)=>s1.has(`${t}::${e}`)};function r7(t,e){const s=as();return Rs({mutationKey:i7,retry:(n,i)=>QI(i)&&n<6,retryDelay:n=>Mu(5e3,500,n,2,0),mutationFn:async n=>{n.branch&&gm.clear(n.virtualMcpId,n.branch);const i=JI(n),o=_0.get(i);if(o)return o;const l=(async()=>(await YI(t,"SANDBOX_START",n)).structuredContent)();_0.set(i,l);try{return await l}finally{_0.get(i)===l&&_0.delete(i)}},onSuccess:()=>{uu(s),e?.onStarted?.()}})}function XI(t,e){const s=z.c(3);let n;return s[0]!==e||s[1]!==t?(n={mutationKey:i7,predicate:o=>{if(!t)return!1;const l=o.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=n):n=s[2],c8(n)>0}function Gx(t,e){return+(e.sidePanel!==null)+Number(e.mainOpen)<=1?!1:t==="side"?e.sidePanel!==null:e.mainOpen}function ZI(t){return t.sidePanel!==null||t.mainOpen?t:{...t,sidePanel:"chat"}}function eM(t){const e=t.mainParamValue===0?"0":t.mainParamValue,s=t.entityMetadata?.defaultMainView??null,n=s==null||s.type==="chat",i=t.mainParamPresent?e!=="0":!n,o=n||t.entityMetadata?.chatDefaultOpen?"chat":null,l=t.sidePanelParamPresent?t.sidePanelParamValue===0?null:t.sidePanelParamValue??null:o;return ZI({sidePanel:l,mainOpen:i})}function n1(t,e){switch(t.type){case"toggleSidePanel":return e.sidePanel===t.sidePanel?Gx("side",e)?{sidepanel:0}:null:{sidepanel:t.sidePanel};case"toggleMain":return e.mainOpen?Gx("main",e)?{main:0}:null:{main:t.openMainValue};case"openSidePanel":return e.sidePanel===t.sidePanel?null:{sidepanel:t.sidePanel}}}function tM(t){return t.sidePanel!==null&&t.mainOpen?{side:33,main:67}:t.sidePanel!==null?{side:100,main:0}:t.mainOpen?{side:0,main:100}:{side:0,main:0}}function sM(t){const{sidePanel:e,mainOpen:s}=t.visibility;return e!==null&&(t.sidePanelParamPresent||!s)?e:s?"main":"chat"}function nM(t,e){return t==="main"?{sidepanel:0,main:e}:{sidepanel:t,main:0}}function iM(t,e){const s=Yt(),n=ur({strict:!1}),i=gf({strict:!1}),{create:o}=zc(),{threads:l}=n2(),{virtualMcpId:a,orgSlug:c,isAgentRoute:d}=e,u=n.main===0?"0":n.main,{sidePanel:h,mainOpen:f}=eM({entityMetadata:t,mainParamPresent:n.main!==void 0,mainParamValue:u,sidePanelParamPresent:n.sidepanel!==void 0,sidePanelParamValue:n.sidepanel}),m={sidePanel:h,mainOpen:f},p=P.useRef(crypto.randomUUID()),g=i.taskId??p.current,x="/$org/$taskId",b=T=>({org:c,taskId:T}),v=d?{virtualmcpid:a}:{},L=(T,C)=>{s({to:x,params:b(g),search:V=>({...V,...T}),replace:C?.replace??!1})},_=(T,C)=>{s({to:x,params:b(T),search:V=>{const A={};return C?A.virtualmcpid=C:d&&(A.virtualmcpid=a),A}})},y=()=>{const T=n1({type:"toggleMain",openMainValue:ac(t)},m);T&&L(T,{replace:!0})},S=T=>{const C=n1({type:"toggleSidePanel",sidePanel:T},m);C&&L(C,{replace:!0})},k=T=>{const C=u&&u!=="0"?u:ac(t);L(nM(T,C),{replace:!0})},w=T=>{const C=n1({type:"openSidePanel",sidePanel:T},m);C&&L(C,{replace:!0})},j=async()=>{const T=crypto.randomUUID(),C=l.find(V=>V.id===g)?.branch??null;try{await o({id:T,virtual_mcp_id:a,...C?{branch:C}:{}})}catch{}s({to:x,params:b(T),search:V=>({...v})})},N=T=>{L({main:T==="0"?0:T},{replace:!0})};return{taskId:g,sidePanel:h,mainOpen:f,mainParam:u,sidePanelParamPresent:n.sidepanel!==void 0,setTaskId:_,toggleMain:y,toggleSidePanel:S,setMobileSurface:k,openSidePanel:w,createNewTask:j,openTab:N}}function rM(t){const e=z.c(10),{org:s}=Fe(),n=s2(),{data:i}=In.useSession(),o=i?.user?.id,l=t?.id??null,a=!!t&&!!o&&!!t.created_by&&t.created_by!==o;let c;e[0]!==s.id||e[1]!==l?(c=Qe.viewedThreadMetadataRefresh(s.id,l??""),e[0]=s.id,e[1]=l,e[2]=c):c=e[2];const d=!!n&&!!l&&a;let u;e[3]!==n||e[4]!==l?(u=async()=>(await n?.refreshThreadMetadata(l??""),!0),e[3]=n,e[4]=l,e[5]=u):u=e[5];let h;e[6]!==c||e[7]!==d||e[8]!==u?(h={queryKey:c,enabled:d,staleTime:Number.POSITIVE_INFINITY,queryFn:u},e[6]=c,e[7]=d,e[8]=u,e[9]=h):h=e[9],Pt(h)}function oM(t,e){const s=getComputedStyle(t),n=parseFloat(s.fontSize);return e*n}function lM(t,e){const s=getComputedStyle(t.ownerDocument.documentElement),n=parseFloat(s.fontSize);return e*n}function aM(t){return t/100*window.innerHeight}function cM(t){return t/100*window.innerWidth}function dM(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function Rd({groupSize:t,panelElement:e,styleProp:s}){let n;const[i,o]=dM(s);switch(o){case"%":{n=i/100*t;break}case"px":{n=i;break}case"rem":{n=lM(e,i);break}case"em":{n=oM(e,i);break}case"vh":{n=aM(i);break}case"vw":{n=cM(i);break}}return n}function Ln(t){return parseFloat(t.toFixed(3))}function Vc({group:t}){const{orientation:e,panels:s}=t;return s.reduce((n,i)=>(n+=e==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,n),0)}function xm(t){const{panels:e}=t,s=Vc({group:t});return s===0?e.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):e.map(n=>{const{element:i,panelConstraints:o}=n;let l=0;if(o.collapsedSize!==void 0){const u=Rd({groupSize:s,panelElement:i,styleProp:o.collapsedSize});l=Ln(u/s*100)}let a;if(o.defaultSize!==void 0){const u=Rd({groupSize:s,panelElement:i,styleProp:o.defaultSize});a=Ln(u/s*100)}let c=0;if(o.minSize!==void 0){const u=Rd({groupSize:s,panelElement:i,styleProp:o.minSize});c=Ln(u/s*100)}let d=100;if(o.maxSize!==void 0){const u=Rd({groupSize:s,panelElement:i,styleProp:o.maxSize});d=Ln(u/s*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:c,maxSize:d,panelId:n.id}})}function Qt(t,e="Assertion error"){if(!t)throw Error(e)}function bm(t,e){return Array.from(e).sort(t==="horizontal"?uM:hM)}function uM(t,e){const s=t.element.offsetLeft-e.element.offsetLeft;return s!==0?s:t.element.offsetWidth-e.element.offsetWidth}function hM(t,e){const s=t.element.offsetTop-e.element.offsetTop;return s!==0?s:t.element.offsetHeight-e.element.offsetHeight}function o7(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function l7(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function fM({orientation:t,rects:e,targetRect:s}){const n={x:s.x+s.width/2,y:s.y+s.height/2};let i,o=Number.MAX_VALUE;for(const l of e){const{x:a,y:c}=l7(n,l),d=t==="horizontal"?a:c;d<o&&(o=d,i=l)}return Qt(i,"No rect found"),i}let L0;function mM(){return L0===void 0&&(typeof matchMedia=="function"?L0=!!matchMedia("(pointer:coarse)").matches:L0=!1),L0}function a7(t){const{element:e,orientation:s,panels:n,separators:i}=t,o=bm(s,Array.from(e.children).filter(o7).map(p=>({element:p}))).map(({element:p})=>p),l=[];let a=!1,c=!1,d=-1,u=-1,h=0,f,m=[];{let p=-1;for(const g of o)g.hasAttribute("data-panel")&&(p++,g.hasAttribute("data-disabled")||(h++,d===-1&&(d=p),u=p))}if(h>1){let p=-1;for(const g of o)if(g.hasAttribute("data-panel")){p++;const x=n.find(b=>b.element===g);if(x){if(f){const b=f.element.getBoundingClientRect(),v=g.getBoundingClientRect();let L;if(c){const _=s==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),y=s==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(m.length){case 0:{L=[_,y];break}case 1:{const S=m[0],k=fM({orientation:s,rects:[b,v],targetRect:S.element.getBoundingClientRect()});L=[S,k===b?y:_];break}default:{L=m;break}}}else m.length?L=m:L=[s==="horizontal"?new DOMRect(b.right,v.top,v.left-b.right,v.height):new DOMRect(v.left,b.bottom,v.width,v.top-b.bottom)];for(const _ of L){let y="width"in _?_:_.element.getBoundingClientRect();const S=mM()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(y.width<S){const w=S-y.width;y=new DOMRect(y.x-w/2,y.y,y.width+w,y.height)}if(y.height<S){const w=S-y.height;y=new DOMRect(y.x,y.y-w/2,y.width,y.height+w)}const k=p<=d||p>u;!a&&!k&&l.push({group:t,groupSize:Vc({group:t}),panels:[f,x],separator:"width"in _?void 0:_,rect:y}),a=!1}}c=!1,f=x,m=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const x=i.find(b=>b.element===g);x?m.push(x):(f=void 0,m=[])}else c=!0}return l}let c7=class{#e={};addListener(e,s){const n=this.#e[e];return n===void 0?this.#e[e]=[s]:n.includes(s)||n.push(s),()=>{this.removeListener(e,s)}}emit(e,s){const n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,s);else{let i=!1,o=null;const l=Array.from(n);for(let a=0;a<l.length;a++){const c=l[a];try{c.call(null,s)}catch(d){o===null&&(i=!0,o=d)}}if(i)throw o}}removeAllListeners(){this.#e={}}removeListener(e,s){const n=this.#e[e];if(n!==void 0){const i=n.indexOf(s);i>=0&&n.splice(i,1)}}},mc={cursorFlags:0,state:"inactive"};const ng=new c7;function Sl(){return mc}function pM(t){return ng.addListener("change",t)}function gM(t){const e=mc,s={...mc};s.cursorFlags=t,mc=s,ng.emit("change",{prev:e,next:s})}function pc(t){const e=mc;mc=t,ng.emit("change",{prev:e,next:t})}const xM=t=>t,i1=()=>{},d7=1,u7=2,h7=4,f7=8,Yx=3,Jx=12;let w0;function Qx(){return w0===void 0&&(w0=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(w0=!0)),w0}function bM({cursorFlags:t,groups:e,state:s}){let n=0,i=0;switch(s){case"active":case"hover":e.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(!(n===0&&i===0)){switch(s){case"active":{if(t&&Qx()){const o=(t&d7)!==0,l=(t&u7)!==0,a=(t&h7)!==0,c=(t&f7)!==0;if(o)return a?"se-resize":c?"ne-resize":"e-resize";if(l)return a?"sw-resize":c?"nw-resize":"w-resize";if(a)return"s-resize";if(c)return"n-resize"}break}}return Qx()?n>0&&i>0?"move":n>0?"ew-resize":"ns-resize":n>0&&i>0?"grab":n>0?"col-resize":"row-resize"}}const Xx=new WeakMap;function ig(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:s}=Xx.get(t)??{};s===void 0&&(s=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&(Object.isExtensible(t.adoptedStyleSheets)?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s]));const n=Sl();switch(n.state){case"active":case"hover":{const i=bM({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(l=>l.group),state:n.state}),o=`*, *:hover {cursor: ${i} !important; }`;if(e===o)return;e=o,i?s.cssRules.length===0?s.insertRule(o):s.replaceSync(o):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{e=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}Xx.set(t,{prevStyle:e,styleSheet:s})}let Xi=new Map;const m7=new c7;function vM(t){Xi=new Map(Xi),Xi.delete(t)}function Zx(t,e){for(const[s]of Xi)if(s.id===t)return s}function Lo(t,e){for(const[s,n]of Xi)if(s.id===t)return n;if(e)throw Error(`Could not find data for Group with id ${t}`)}function zl(){return Xi}function rg(t,e){return m7.addListener("groupChange",s=>{s.group.id===t&&e(s)})}function $r(t,e,s){const n=Xi.get(t);Xi=new Map(Xi),Xi.set(t,e),m7.emit("groupChange",{group:t,isUserInteraction:s?.isUserInteraction===!0,prev:n,next:e})}function p7(t){const e=Sl();let s=!1;return e.state==="active"&&(pc({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(ig(t),s=!0,e.hitRegions.forEach(n=>{const i=Lo(n.group.id,!0);$r(n.group,i,{isUserInteraction:!0})}))),s}function e4(t){t.defaultPrevented||p7(t.currentTarget)}function yM(t,e,s){let n,i={x:1/0,y:1/0};for(const o of e){const l=l7(s,o.rect);switch(t){case"horizontal":{l.x<=i.x&&(n=o,i=l);break}case"vertical":{l.y<=i.y&&(n=o,i=l);break}}}return n?{distance:i,hitRegion:n}:void 0}function _M(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function LM(t,e){if(t===e)throw new Error("Cannot compare node with itself");const s={a:n4(t),b:n4(e)};let n;for(;s.a.at(-1)===s.b.at(-1);)n=s.a.pop(),s.b.pop();Qt(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:s4(t4(s.a)),b:s4(t4(s.b))};if(i.a===i.b){const o=n.childNodes,l={a:s.a.at(-1),b:s.b.at(-1)};let a=o.length;for(;a--;){const c=o[a];if(c===l.a)return 1;if(c===l.b)return-1}}return Math.sign(i.a-i.b)}const wM=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function SM(t){const e=getComputedStyle(g7(t)??t).display;return e==="flex"||e==="inline-flex"}function kM(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||SM(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||wM.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function t4(t){let e=t.length;for(;e--;){const s=t[e];if(Qt(s,"Missing node"),kM(s))return s}return null}function s4(t){return t&&Number(getComputedStyle(t).zIndex)||0}function n4(t){const e=[];for(;t;)e.push(t),t=g7(t);return e}function g7(t){const{parentNode:e}=t;return _M(e)?e.host:e}function jM(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function CM({groupElement:t,hitRegion:e,pointerEventTarget:s}){if(!o7(s)||s.contains(t)||t.contains(s))return!0;if(LM(s,t)>0){let n=s;for(;n;){if(n.contains(t))return!0;if(jM(n.getBoundingClientRect(),e))return!1;n=n.parentElement}}return!0}function og(t,e){const s=[];return e.forEach((n,i)=>{if(i.disabled)return;const o=a7(i),l=yM(i.orientation,o,{x:t.clientX,y:t.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&CM({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:t.target})&&s.push(l.hitRegion)}),s}function NM(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!=e[s])return!1;return!0}function gn(t,e,s=0){return Math.abs(Ln(t)-Ln(e))<=s}function Ki(t,e){return gn(t,e)?0:t>e?1:-1}function cc({overrideDisabledPanels:t,panelConstraints:e,prevSize:s,size:n}){const{collapsedSize:i=0,collapsible:o,disabled:l,maxSize:a=100,minSize:c=0}=e;if(l&&!t)return s;if(Ki(n,c)<0)if(o){const d=(i+c)/2;Ki(n,d)<0?n=i:n=c}else n=c;return n=Math.min(a,n),n=Ln(n),n}function vu({delta:t,initialLayout:e,panelConstraints:s,pivotIndices:n,prevLayout:i,trigger:o}){if(gn(t,0))return e;const l=o==="imperative-api",a=Object.values(e),c=Object.values(i),d=[...a],[u,h]=n;Qt(u!=null,"Invalid first pivot index"),Qt(h!=null,"Invalid second pivot index");let f=0;switch(o){case"keyboard":{{const g=t<0?h:u,x=s[g];Qt(x,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:L=0}=x;if(v){const _=a[g];if(Qt(_!=null,`Previous layout not found for panel index ${g}`),gn(_,b)){const y=L-_;Ki(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{const g=t<0?u:h,x=s[g];Qt(x,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:v,minSize:L=0}=x;if(v){const _=a[g];if(Qt(_!=null,`Previous layout not found for panel index ${g}`),gn(_,L)){const y=_-b;Ki(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}break}default:{const g=t<0?h:u,x=s[g];Qt(x,`Panel constraints not found for index ${g}`);const b=a[g],{collapsible:v,collapsedSize:L,minSize:_}=x;if(v&&Ki(b,_)<0)if(t>0){const y=_-L,S=y/2,k=b+t;Ki(k,_)<0&&(t=Ki(t,S)<=0?0:y)}else{const y=_-L,S=100-y/2,k=b-t;Ki(k,_)<0&&(t=Ki(100+t,S)>0?0:-y)}break}}{const g=t<0?1:-1;let x=t<0?h:u,b=0;for(;;){const L=a[x];Qt(L!=null,`Previous layout not found for panel index ${x}`);const _=cc({overrideDisabledPanels:l,panelConstraints:s[x],prevSize:L,size:100})-L;if(b+=_,x+=g,x<0||x>=s.length)break}const v=Math.min(Math.abs(t),Math.abs(b));t=t<0?0-v:v}{let g=t<0?u:h;for(;g>=0&&g<s.length;){const x=Math.abs(t)-Math.abs(f),b=a[g];Qt(b!=null,`Previous layout not found for panel index ${g}`);const v=b-x,L=cc({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:b,size:v});if(!gn(b,L)&&(f+=b-L,d[g]=L,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(NM(c,d))return i;{const g=t<0?h:u,x=a[g];Qt(x!=null,`Previous layout not found for panel index ${g}`);const b=x+f,v=cc({overrideDisabledPanels:l,panelConstraints:s[g],prevSize:x,size:b});if(d[g]=v,!gn(v,b)){let L=b-v,_=t<0?h:u;for(;_>=0&&_<s.length;){const y=d[_];Qt(y!=null,`Previous layout not found for panel index ${_}`);const S=y+L,k=cc({overrideDisabledPanels:l,panelConstraints:s[_],prevSize:y,size:S});if(gn(y,k)||(L-=k-y,d[_]=k),gn(L,0))break;t>0?_--:_++}}}const m=Object.values(d).reduce((g,x)=>x+g,0);if(!gn(m,100,.1))return i;const p=Object.keys(i);return d.reduce((g,x,b)=>(g[p[b]]=x,g),{})}function kl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(e[s]===void 0||Ki(t[s],e[s])!==0)return!1;return!0}function jl({layout:t,panelConstraints:e}){const s=Object.values(t),n=[...s],i=n.reduce((a,c)=>a+c,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!gn(i,100)&&n.length>0)for(let a=0;a<e.length;a++){const c=n[a];Qt(c!=null,`No layout data found for index ${a}`);const d=100/i*c;n[a]=d}let o=0;for(let a=0;a<e.length;a++){const c=s[a];Qt(c!=null,`No layout data found for index ${a}`);const d=n[a];Qt(d!=null,`No layout data found for index ${a}`);const u=cc({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});d!=u&&(o+=d-u,n[a]=u)}if(!gn(o,0))for(let a=0;a<e.length;a++){const c=n[a];Qt(c!=null,`No layout data found for index ${a}`);const d=c+o,u=cc({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:c,size:d});if(c!==u&&(o-=u-c,n[a]=u,gn(o,0)))break}const l=Object.keys(t);return n.reduce((a,c,d)=>(a[l[d]]=c,a),{})}function x7({groupId:t,panelId:e}){const s=()=>{const c=zl();for(const[d,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:f,groupSize:m,separatorToPanels:p}]of c)if(d.id===t)return{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:d,groupSize:m,layout:f,separatorToPanels:p};throw Error(`Group ${t} not found`)},n=()=>{const c=s().derivedPanelConstraints.find(d=>d.panelId===e);if(c!==void 0)return c;throw Error(`Panel constraints not found for Panel ${e}`)},i=()=>{const c=s().group.panels.find(d=>d.id===e);if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},o=()=>{const c=s().layout[e];if(c!==void 0)return c;throw Error(`Layout not found for Panel ${e}`)},l=({nextSize:c,panels:d,prevLayout:u,derivedPanelConstraints:h})=>{const f=o(),m=d.findIndex(x=>x.id===e),p=m===0,g=m===d.length-1;if(g&&c<f&&(p||d.slice(0,m).every((x,b)=>{const v=h[b];return v?.collapsible&&gn(v.collapsedSize,u[v.panelId])}))){const x=d.slice(0,m).reduce((b,v)=>b+u[v.id],0);return{...u,[e]:Ln(100-x)}}return vu({delta:g?f-c:c-f,initialLayout:u,panelConstraints:h,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:u,trigger:"imperative-api"})},a=c=>{const d=o();if(c===d)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:f,groupSize:m,layout:p,separatorToPanels:g}=s(),x=l({nextSize:c,panels:f.panels,prevLayout:p,derivedPanelConstraints:h}),b=jl({layout:x,panelConstraints:h});kl(p,b)||$r(f,{defaultLayoutDeferred:u,derivedPanelConstraints:h,groupSize:m,layout:b,separatorToPanels:g})};return{collapse:()=>{const{collapsible:c,collapsedSize:d}=n(),{mutableValues:u}=i(),h=o();c&&h!==d&&(u.expandToSize=h,a(d))},expand:()=>{const{collapsible:c,collapsedSize:d,minSize:u}=n(),{mutableValues:h}=i(),f=o();if(c&&f===d){let m=h.expandToSize??u;m===0&&(m=1),a(m)}},getSize:()=>{const{group:c}=s(),d=o(),{element:u}=i(),h=c.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:d,inPixels:h}},isCollapsed:()=>{const{collapsible:c,collapsedSize:d}=n(),u=o();return c&&gn(d,u)},resize:c=>{const{group:d}=s(),{element:u}=i(),h=Vc({group:d}),f=Rd({groupSize:h,panelElement:u,styleProp:c}),m=Ln(f/h*100);a(m)}}}function i4(t){if(t.defaultPrevented)return;const e=zl();og(t,e).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const n=s.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(n){const i=n.panelConstraints.defaultSize,o=x7({groupId:s.group.id,panelId:n.id});o&&i!==void 0&&(o.resize(i),t.preventDefault())}}})}function oh(t){const e=zl();for(const[s]of e)if(s.separators.some(n=>n.element===t))return s;throw Error("Could not find parent Group for separator element")}function b7({groupId:t}){const e=()=>{const s=zl();for(const[n,i]of s)if(n.id===t)return{group:n,...i};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:n}=e();return s?{}:n},setLayout(s){const{defaultLayoutDeferred:n,derivedPanelConstraints:i,group:o,groupSize:l,layout:a,separatorToPanels:c}=e(),d=jl({layout:s,panelConstraints:i});return n?a:(kl(a,d)||$r(o,{defaultLayoutDeferred:n,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c}),d)}}}function sl(t,e){const s=oh(t),n=Lo(s.id,!0),i=s.separators.find(u=>u.element===t);Qt(i,"Matching separator not found");const o=n.separatorToPanels.get(i);Qt(o,"Matching panels not found");const l=o.map(u=>s.panels.indexOf(u)),a=b7({groupId:s.id}).getLayout(),c=vu({delta:e,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),d=jl({layout:c,panelConstraints:n.derivedPanelConstraints});kl(a,d)||$r(s,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:d,separatorToPanels:n.separatorToPanels},{isUserInteraction:!0})}function r4(t){if(t.defaultPrevented)return;const e=t.currentTarget,s=oh(e);if(!s.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),s.orientation==="vertical"&&sl(e,5);break}case"ArrowLeft":{t.preventDefault(),s.orientation==="horizontal"&&sl(e,-5);break}case"ArrowRight":{t.preventDefault(),s.orientation==="horizontal"&&sl(e,5);break}case"ArrowUp":{t.preventDefault(),s.orientation==="vertical"&&sl(e,-5);break}case"End":{t.preventDefault(),sl(e,100);break}case"Enter":{t.preventDefault();const n=oh(e),i=Lo(n.id,!0),{derivedPanelConstraints:o,layout:l,separatorToPanels:a}=i,c=n.separators.find(f=>f.element===e);Qt(c,"Matching separator not found");const d=a.get(c);Qt(d,"Matching panels not found");const u=d[0],h=o.find(f=>f.panelId===u.id);if(Qt(h,"Panel metadata not found"),h.collapsible){const f=l[u.id],m=h.collapsedSize===f?n.mutableState.expandedPanelSizes[u.id]??h.minSize:h.collapsedSize;sl(e,m-f)}break}case"F6":{t.preventDefault();const n=oh(e).separators.map(l=>l.element),i=Array.from(n).findIndex(l=>l===t.currentTarget);Qt(i!==null,"Index not found");const o=t.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[o].focus({preventScroll:!0});break}case"Home":{t.preventDefault(),sl(e,-100);break}}}function o4(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=zl(),s=og(t,e),n=new Map;let i=!1;s.forEach(o=>{o.separator&&(i||(i=!0,o.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=e.get(o.group);l&&n.set(o.group,l.layout)}),pc({cursorFlags:0,hitRegions:s,initialLayoutMap:n,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),s.length&&t.preventDefault()}function v7({document:t,event:e,hitRegions:s,initialLayoutMap:n,mountedGroups:i,pointerDownAtPoint:o,prevCursorFlags:l}){let a=0;s.forEach(d=>{const{group:u,groupSize:h}=d,{orientation:f,panels:m}=u,{disableCursor:p}=u.mutableState;let g=0;o?f==="horizontal"?g=(e.clientX-o.x)/h*100:g=(e.clientY-o.y)/h*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const x=n.get(u),b=i.get(u);if(!x||!b)return;const{defaultLayoutDeferred:v,derivedPanelConstraints:L,groupSize:_,layout:y,separatorToPanels:S}=b;if(L&&y&&S){const k=vu({delta:g,initialLayout:x,panelConstraints:L,pivotIndices:d.panels.map(w=>m.indexOf(w)),prevLayout:y,trigger:"mouse-or-touch"});if(kl(k,y)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?d7:u7;break}case"vertical":{a|=g<0?h7:f7;break}}}else $r(d.group,{defaultLayoutDeferred:v,derivedPanelConstraints:L,groupSize:_,layout:k,separatorToPanels:S})}});let c=0;e.movementX===0?c|=l&Yx:c|=a&Yx,e.movementY===0?c|=l&Jx:c|=a&Jx,gM(c),ig(t)}function l4(t){const e=zl(),s=Sl();s.state==="active"&&v7({document:t.currentTarget,event:t,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:e,prevCursorFlags:s.cursorFlags})}function a4(t){if(t.defaultPrevented)return;const e=Sl(),s=zl();switch(e.state){case"active":{if(t.buttons===0){pc({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(n=>{const i=Lo(n.group.id,!0);$r(n.group,i,{isUserInteraction:!0})});return}for(const n of e.hitRegions)if(n.separator){const{element:i}=n.separator;i.hasPointerCapture?.(t.pointerId)||i.setPointerCapture?.(t.pointerId)}v7({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const n=og(t,s);n.length===0?e.state!=="inactive"&&pc({cursorFlags:0,state:"inactive"}):pc({cursorFlags:0,hitRegions:n,state:"hover"}),ig(t.currentTarget);break}}}function c4(t){t.relatedTarget instanceof HTMLIFrameElement&&Sl().state==="hover"&&pc({cursorFlags:0,state:"inactive"})}function d4(t){t.defaultPrevented||t.pointerType==="mouse"&&t.button>0||p7(t.currentTarget)&&t.preventDefault()}function u4(t){let e=0,s=0;const n={};for(const o of t)if(o.defaultSize!==void 0){e++;const l=Ln(o.defaultSize);s+=l,n[o.panelId]=l}else n[o.panelId]=void 0;const i=t.length-e;if(i!==0){const o=Ln((100-s)/i);for(const l of t)l.defaultSize===void 0&&(n[l.panelId]=o)}return n}function TM(t,e,s){if(!s[0])return;const n=t.panels.find(c=>c.element===e);if(!n||!n.onResize)return;const i=Vc({group:t}),o=t.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,l=n.mutableValues.prevSize,a={asPercentage:Ln(o/i*100),inPixels:o};n.mutableValues.prevSize=a,n.onResize(a,n.id,l)}function VM(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function AM({group:t,nextGroupSize:e,prevGroupSize:s,prevLayout:n}){if(s<=0||e<=0||s===e)return n;let i=0,o=0,l=!1;const a=new Map,c=[];for(const h of t.panels){const f=n[h.id]??0;if(h.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){l=!0;const m=f/100*s,p=Ln(m/e*100);a.set(h.id,p),i+=p}else c.push(h.id),o+=f}if(!l||c.length===0)return n;const d=100-i,u={...n};if(a.forEach((h,f)=>{u[f]=h}),o>0)for(const h of c){const f=n[h]??0;u[h]=Ln(f/o*d)}else{const h=Ln(d/c.length);for(const f of c)u[f]=h}return u}function PM(t,e){const s=t.map(i=>i.id),n=Object.keys(e);if(s.length!==n.length)return!1;for(const i of s)if(!n.includes(i))return!1;return!0}const Qa=new Map;function EM(t){let e=!0;Qt(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=t.element.ownerDocument.defaultView.ResizeObserver,n=new Set,i=new Set,o=new s(p=>{for(const g of p){const{borderBoxSize:x,target:b}=g;if(b===t.element){if(e){const v=Vc({group:t});if(v===0)return;const L=Lo(t.id);if(!L)return;const _=xm(t),y=L.defaultLayoutDeferred?u4(_):L.layout,S=AM({group:t,nextGroupSize:v,prevGroupSize:L.groupSize,prevLayout:y}),k=jl({layout:S,panelConstraints:_});if(!L.defaultLayoutDeferred&&kl(L.layout,k)&&VM(L.derivedPanelConstraints,_)&&L.groupSize===v)return;$r(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:_,groupSize:v,layout:k,separatorToPanels:L.separatorToPanels})}}else TM(t,b,x)}});o.observe(t.element),t.panels.forEach(p=>{Qt(!n.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),n.add(p.id),p.onResize&&o.observe(p.element)});const l=Vc({group:t}),a=xm(t),c=t.panels.map(({id:p})=>p).join(",");let d=t.mutableState.defaultLayout;d&&(PM(t.panels,d)||(d=void 0));const u=t.mutableState.layouts[c]??d??u4(a),h=jl({layout:u,panelConstraints:a}),f=t.element.ownerDocument;Qa.set(f,(Qa.get(f)??0)+1);const m=new Map;return a7(t).forEach(p=>{p.separator&&m.set(p.separator,p.panels)}),$r(t,{defaultLayoutDeferred:l===0,derivedPanelConstraints:a,groupSize:l,layout:h,separatorToPanels:m}),t.separators.forEach(p=>{Qt(!i.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),i.add(p.id),p.element.addEventListener("keydown",r4)}),Qa.get(f)===1&&(f.addEventListener("contextmenu",e4,!0),f.addEventListener("dblclick",i4,!0),f.addEventListener("pointerdown",o4,!0),f.addEventListener("pointerleave",l4),f.addEventListener("pointermove",a4),f.addEventListener("pointerout",c4),f.addEventListener("pointerup",d4,!0)),function(){e=!1,Qa.set(f,Math.max(0,(Qa.get(f)??0)-1)),vM(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",r4)}),Qa.get(f)||(f.removeEventListener("contextmenu",e4,!0),f.removeEventListener("dblclick",i4,!0),f.removeEventListener("pointerdown",o4,!0),f.removeEventListener("pointerleave",l4),f.removeEventListener("pointermove",a4),f.removeEventListener("pointerout",c4),f.removeEventListener("pointerup",d4,!0)),o.disconnect()}}function DM(){const[t,e]=P.useState({}),s=P.useCallback(()=>e({}),[]);return[t,s]}function lg(t){const e=P.useId();return`${t??e}`}const Fl=typeof window<"u"?P.useLayoutEffect:P.useEffect;function Yd(t){const e=P.useRef(t);return Fl(()=>{e.current=t},[t]),P.useCallback((...s)=>e.current?.(...s),[e])}function ag(...t){return Yd(e=>{t.forEach(s=>{if(s)switch(typeof s){case"function":{s(e);break}case"object":{s.current=e;break}}})})}function cg(t){const e=P.useRef({...t});return Fl(()=>{for(const s in t)e.current[s]=t[s]},[t]),e.current}const y7=P.createContext(null);function RM(t,e){const s=P.useRef({getLayout:()=>({}),setLayout:xM});P.useImperativeHandle(e,()=>s.current,[]),Fl(()=>{Object.assign(s.current,b7({groupId:t}))})}function _7({children:t,className:e,defaultLayout:s,disableCursor:n,disabled:i,elementRef:o,groupRef:l,id:a,onLayoutChange:c,onLayoutChanged:d,orientation:u="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:f,...m}){const p=P.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Yd(T=>{kl(p.current.onLayoutChange,T)||(p.current.onLayoutChange=T,c?.(T))}),x=Yd((T,C)=>{kl(p.current.onLayoutChanged,T)||(p.current.onLayoutChanged=T,d?.(T,{isUserInteraction:C}))}),b=lg(a),v=P.useRef(null),[L,_]=DM(),y=P.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),S=ag(v,o);RM(b,l);const k=Yd((T,C)=>{const V=Sl(),A=Zx(T),E=Lo(T);if(E){let D=!1;return V.state==="active"&&(D=V.hitRegions.some(I=>I.group===A)),{flexGrow:E.layout[C]??1,pointerEvents:D?"none":void 0}}if(s?.[C])return{flexGrow:s?.[C]}}),w=cg({defaultLayout:s,disableCursor:n}),j=P.useMemo(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:k,id:b,orientation:u,registerPanel:T=>{const C=y.current;return C.panels=bm(u,[...C.panels,T]),_(),()=>{C.panels=C.panels.filter(V=>V!==T),_()}},registerSeparator:T=>{const C=y.current;return C.separators=bm(u,[...C.separators,T]),_(),()=>{C.separators=C.separators.filter(V=>V!==T),_()}},updatePanelProps:(T,{disabled:C})=>{const V=y.current.panels.find(D=>D.id===T);V&&(V.panelConstraints.disabled=C);const A=Zx(b),E=Lo(b);A&&E&&$r(A,{...E,derivedPanelConstraints:xm(A)})},updateSeparatorProps:(T,{disabled:C,disableDoubleClick:V})=>{const A=y.current.separators.find(E=>E.id===T);A&&(A.disabled=C,A.disableDoubleClick=V)}}),[k,b,_,u,w]),N=P.useRef(null);return Fl(()=>{const T=v.current;if(T===null)return;const C=y.current;let V;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===C.panels.length){V={};for(const B of C.panels){const M=w.defaultLayout[B.id];M!==void 0&&(V[B.id]=M)}}const A={disabled:!!i,element:T,id:b,mutableState:{defaultLayout:V,disableCursor:!!w.disableCursor,expandedPanelSizes:y.current.lastExpandedPanelSizes,layouts:y.current.layouts},orientation:u,panels:C.panels,resizeTargetMinimumSize:C.resizeTargetMinimumSize,separators:C.separators};N.current=A;const E=EM(A),{defaultLayoutDeferred:D,derivedPanelConstraints:I,layout:R}=Lo(A.id,!0);!D&&I.length>0&&(g(R),x(R,!1));const $=rg(b,B=>{const{defaultLayoutDeferred:M,derivedPanelConstraints:O,layout:F}=B.next;if(M||O.length===0)return;const U=A.panels.map(({id:q})=>q).join(",");A.mutableState.layouts[U]=F,O.forEach(q=>{if(q.collapsible){const{layout:W}=B.prev??{};if(W){const G=gn(q.collapsedSize,F[q.panelId]),Y=gn(q.collapsedSize,W[q.panelId]);G&&!Y&&(A.mutableState.expandedPanelSizes[q.panelId]=W[q.panelId])}}});const K=Sl().state!=="active";g(F),K&&x(F,B.isUserInteraction)});return()=>{N.current=null,E(),$()}},[i,b,x,g,u,L,w]),P.useEffect(()=>{const T=N.current;T&&(T.mutableState.defaultLayout=s,T.mutableState.disableCursor=!!n)}),r.jsx(y7.Provider,{value:j,children:r.jsx("div",{...m,className:e,"data-group":!0,"data-testid":b,id:b,ref:S,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:t})})}_7.displayName="Group";function dg(){const t=P.useContext(y7);return Qt(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function IM(t,e){const{id:s}=dg(),n=P.useRef({collapse:i1,expand:i1,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:i1});P.useImperativeHandle(e,()=>n.current,[]),Fl(()=>{Object.assign(n.current,x7({groupId:s,panelId:t}))})}function L7({children:t,className:e,collapsedSize:s="0%",collapsible:n=!1,defaultSize:i,disabled:o,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:c,maxSize:d="100%",minSize:u="0%",onResize:h,panelRef:f,style:m,...p}){const g=!!c,x=lg(c),b=cg({disabled:o}),v=P.useRef(null),L=ag(v,l),{getPanelStyles:_,id:y,orientation:S,registerPanel:k,updatePanelProps:w}=dg(),j=h!==null,N=Yd((A,E,D)=>{h?.(A,c,D)});Fl(()=>{const A=v.current;if(A!==null){const E={element:A,id:x,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:j?N:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:s,collapsible:n,defaultSize:i,disabled:b.disabled,maxSize:d,minSize:u}};return k(E)}},[a,s,n,i,j,x,g,d,u,N,k,b]),P.useEffect(()=>{w(x,{disabled:o})},[o,x,w]),IM(x,f);const T=()=>{const A=_(y,x);if(A)return JSON.stringify(A)},C=P.useSyncExternalStore(A=>rg(y,A),T,T);let V;return C?V=JSON.parse(C):i!==void 0?V={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:V={flexGrow:1},r.jsx("div",{...p,"data-disabled":o||void 0,"data-panel":!0,"data-testid":x,id:x,ref:L,style:{...MM,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...V},children:r.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:S==="horizontal"?"pan-y":"pan-x"},children:t})})}L7.displayName="Panel";const MM={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function $M({layout:t,panelConstraints:e,panelId:s,panelIndex:n}){let i,o;const l=t[s],a=e.find(c=>c.panelId===s);if(a){const c=a.maxSize,d=a.collapsible?a.collapsedSize:a.minSize,u=[n,n+1];o=jl({layout:vu({delta:d-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s],i=jl({layout:vu({delta:c-l,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[s]}return{valueControls:s,valueMax:i,valueMin:o,valueNow:l}}function w7({children:t,className:e,disabled:s,disableDoubleClick:n,elementRef:i,id:o,style:l,...a}){const c=lg(o),d=cg({disabled:s,disableDoubleClick:n}),[u,h]=P.useState({}),[f,m]=P.useState("inactive"),[p,g]=P.useState(!1),x=P.useRef(null),b=ag(x,i),{disableCursor:v,id:L,orientation:_,registerSeparator:y,updateSeparatorProps:S}=dg(),k=_==="horizontal"?"vertical":"horizontal";Fl(()=>{const N=x.current;if(N!==null){const T={disabled:d.disabled,disableDoubleClick:d.disableDoubleClick,element:N,id:c},C=y(T),V=pM(E=>{m(E.next.state!=="inactive"&&E.next.hitRegions.some(D=>D.separator===T)?E.next.state:"inactive")}),A=rg(L,E=>{const{derivedPanelConstraints:D,layout:I,separatorToPanels:R}=E.next,$=R.get(T);if($){const B=$[0],M=$.indexOf(B);h($M({layout:I,panelConstraints:D,panelId:B.id,panelIndex:M}))}});return()=>{V(),A(),C()}}},[L,c,y,d]),P.useEffect(()=>{S(c,{disabled:s,disableDoubleClick:n})},[s,n,c,S]);let w;s&&!v&&(w="not-allowed");let j;return s?j="disabled":f==="active"?j="active":p?j="focus":j=f,r.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":s||void 0,"aria-orientation":k,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:t,className:e,"data-separator":j,"data-testid":c,id:c,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:b,role:"separator",style:{flexBasis:"auto",cursor:w,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}w7.displayName="Separator";function S7(t){const e=z.c(10);let s,n,i;e[0]!==t?({className:s,ref:i,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==s?(o=ie("flex h-full w-full",s),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==n||e[7]!==i||e[8]!==o?(l=r.jsx(_7,{groupRef:i,"data-slot":"resizable-panel-group",className:o,...n}),e[6]=n,e[7]=i,e[8]=o,e[9]=l):l=e[9],l}function Ch(t){const e=z.c(10);let s,n,i;e[0]!==t?({ref:n,style:i,...s}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==i?(o={overflow:"hidden",...i},e[4]=i,e[5]=o):o=e[5];let l;return e[6]!==s||e[7]!==n||e[8]!==o?(l=r.jsx(L7,{panelRef:n,"data-slot":"resizable-panel",style:o,...s}),e[6]=s,e[7]=n,e[8]=o,e[9]=l):l=e[9],l}function k7(t){const e=z.c(12);let s,n,i;e[0]!==t?({withHandle:i,className:s,...n}=t,e[0]=t,e[1]=s,e[2]=n,e[3]=i):(s=e[1],n=e[2],i=e[3]);let o;e[4]!==s?(o=ie("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0 [&[aria-orientation=horizontal]>div]:rotate-90",s),e[4]=s,e[5]=o):o=e[5];let l;e[6]!==i?(l=i&&r.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:r.jsx(Uc,{className:"size-2.5"})}),e[6]=i,e[7]=l):l=e[7];let a;return e[8]!==n||e[9]!==o||e[10]!==l?(a=r.jsx(w7,{"data-slot":"resizable-handle",className:o,...n,children:l}),e[8]=n,e[9]=o,e[10]=l,e[11]=a):a=e[11],a}function h4(t,e){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function OM(t,e){const s=z.c(8);let n;s[0]!==e?(n=c=>h4(c,e),s[0]=e,s[1]=n):n=s[1];const[i,o]=xf(t,n);let l;s[2]!==e||s[3]!==i?(l=h4(i,e),s[2]=e,s[3]=i,s[4]=l):l=s[4];let a;return s[5]!==o||s[6]!==l?(a=[l,o],s[5]=o,s[6]=l,s[7]=a):a=s[7],a}const BM=33;function zM(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Kp.sidePanelWidth(),t[0]=e):e=t[0],OM(e,BM)}function vm(){const t=z.c(3),[e,s]=P.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let o;return t[1]!==e?(o=[e,i],t[1]=e,t[2]=o):o=t[2],o}function j7(t){if(!t||typeof t!="object")return null;const e=t;return e.isError?e.content?.find(n=>n.type==="text")?.text?.trim()||"GitHub MCP tool returned an error":null}function ug(t){const e=j7(t);if(e)throw new Error(e)}function FM(t){try{return JSON.parse(t)}catch{return null}}function UM(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,n=s?FM(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function Hu(t){const e=UM(t);return e===null?null:e}function C7(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function HM(t){if(!t||typeof t!="object")return null;const e=t.content?.find(i=>i.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],n=C7(s);return!n||!s?null:{number:n,htmlUrl:s}}function f4(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const m4=/[\r\n<>]/,KM=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Ku(t){const e=t?.userName?.trim();if(!e||m4.test(e))return null;const s=t?.userEmail?.trim();return!s||m4.test(s)?{userName:e}:KM.test(s)?{userName:e,userEmail:s}:{userName:e}}function WM(t){return t.split(`
|
|
3
3
|
`).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
|
|
4
4
|
`).trimEnd()}function qM(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function N7(t,e){const s=Ku(e);if(!s)return t;const n=WM(t),i=qM(s);if(n.includes(i))return n;const o=n.trimEnd();return o.length>0?`${o}
|
|
5
5
|
|
|
@@ -84,7 +84,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
84
84
|
`))}}f={type:"taskItem",raw:"",mainContent:b,indentLevel:h,checked:u??!1,text:b,tokens:this.lexer.inlineTokens(b),nestedTokens:v}}const m=d?"taskList":"list";o!==m?(i.length>0&&n.push({type:o,items:i}),i=[f],o=m):i.push(f)}i.length>0&&n.push({type:o,items:i});const l=[];for(let a=0;a<n.length;a+=1){const c=n[a],d={...t,type:c.type,items:c.items},u=this.parseToken(d);u&&(Array.isArray(u)?l.push(...u):l.push(u))}return l.length>0?l:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),s=this.createParseHelpers();if(e.find(i=>{if(!i.parseMarkdown)return!1;const o=i.parseMarkdown(t,s),l=this.normalizeParseResult(o);return l&&(!Array.isArray(l)||l.length>0)?(this.lastParseResult=l,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,s)=>{const n={type:t,attrs:e||void 0,content:s||void 0};return(!e||Object.keys(e).length===0)&&delete n.attrs,n},applyMark:(t,e,s)=>({mark:t,content:e,attrs:s&&Object.keys(s).length>0?s:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){var e,s,n,i;const o=[];for(let l=0;l<t.length;l+=1){const a=t[l];if(a.type==="text")o.push({type:"text",text:a.text||""});else if(a.type==="html"){const c=((s=(e=a.raw)!=null?e:a.text)!=null?s:"").toString(),d=/^<\/[\s]*[\w-]+/i.test(c),u=c.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!d&&u&&!/\/>$/.test(c)){const f=u[1],m=this.escapeRegex(f),p=new RegExp(`^<\\/\\s*${m}\\b`,"i");let g=-1;const x=[c];for(let b=l+1;b<t.length;b+=1){const v=t[b],L=((i=(n=v.raw)!=null?n:v.text)!=null?i:"").toString();if(x.push(L),v.type==="html"&&p.test(L)){g=b;break}}if(g!==-1){const b=x.join(""),v={type:"html",raw:b,text:b,block:!1},L=this.parseHTMLToken(v);if(L){const _=this.normalizeParseResult(L);Array.isArray(_)?o.push(..._):_&&o.push(_)}l=g;continue}}const h=this.parseHTMLToken(a);if(h){const f=this.normalizeParseResult(h);Array.isArray(f)?o.push(...f):f&&o.push(f)}}else if(a.type){const c=this.getHandlerForToken(a.type);if(c&&c.parseMarkdown){const d=this.createParseHelpers(),u=c.parseMarkdown(a,d);if(this.isMarkResult(u)){const h=this.applyMarkToContent(u.mark,u.content,u.attrs);o.push(...h)}else{const h=this.normalizeParseResult(u);Array.isArray(h)?o.push(...h):h&&o.push(h)}}else a.tokens&&o.push(...this.parseInlineTokens(a.tokens))}}return o}applyMarkToContent(t,e,s){return e.map(n=>{if(n.type==="text"){const i=n.marks||[],o=s?{type:t,attrs:s}:{type:t};return{...n,marks:[...i,o]}}return{...n,content:n.content?this.applyMarkToContent(t,n.content,s):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:t.text||""};case"html":return this.parseHTMLToken(t);case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(typeof window>"u")return t.block?{type:"paragraph",content:[{type:"text",text:e}]}:{type:"text",text:e};try{const s=IN(e,this.baseExtensions);return s.type==="doc"&&s.content?t.block?s.content:s.content.length===1&&s.content[0].type==="paragraph"&&s.content[0].content?s.content[0].content:s.content:s}catch(s){throw new Error(`Failed to parse HTML in markdown: ${s}`)}}renderNodeToMarkdown(t,e,s=0,n=0,i={}){var o;if(t.type==="text")return t.text||"";if(!t.type)return"";const l=this.getHandlerForToken(t.type);if(!l)return"";const a=Array.isArray(e?.content)&&s>0?e.content[s-1]:void 0,c={renderChildren:(h,f)=>{const m=l.isIndenting?n+1:n;return!Array.isArray(h)&&h.content?this.renderNodes(h.content,t,f||"",s,m):this.renderNodes(h,t,f||"",s,m)},renderChild:(h,f)=>{const m=l.isIndenting?n+1:n;return this.renderNodeToMarkdown(h,t,f,m)},indent:h=>this.indentString+h,wrapInBlock:yW},d={index:s,level:n,parentType:e?.type,previousNode:a,meta:{parentAttrs:e?.attrs,...i}};return((o=l.renderMarkdown)==null?void 0:o.call(l,t,c,d))||""}renderNodes(t,e,s="",n=0,i=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,s,i):t.type?this.renderNodeToMarkdown(t,e,n,i):""}renderNodesWithMarkBoundaries(t,e,s="",n=0){const i=[],o=new Map;return t.forEach((l,a)=>{const c=a<t.length-1?t[a+1]:null;if(l.type)if(l.type==="text"){let d=l.text||"";const u=new Map((l.marks||[]).map(b=>[b.type,b])),h=LW(o,u),f=_W(u,c);let m="";if(f.length>0){const b=d.match(/(\s+)$/);b&&(m=b[1],d=d.slice(0,-m.length))}f.forEach(b=>{const v=u.get(b),L=this.getMarkClosing(b,v);L&&(d+=L),o.has(b)&&o.delete(b)});let p="";if(h.length>0){const b=d.match(/^(\s+)/);b&&(p=b[1],d=d.slice(p.length))}h.forEach(({type:b,mark:v})=>{const L=this.getMarkOpening(b,v);L&&(d=L+d),f.includes(b)||o.set(b,v)}),d=p+d;const g=wW(o,u,c,this.markSetsEqual.bind(this));let x="";if(g.length>0){const b=d.match(/(\s+)$/);b&&(x=b[1],d=d.slice(0,-x.length))}g.forEach(b=>{const v=o.get(b),L=this.getMarkClosing(b,v);L&&(d+=L),o.delete(b)}),d+=x,d+=m,i.push(d)}else{const d=new Map(o),u=SW(o,this.getMarkClosing.bind(this)),h=this.renderNodeToMarkdown(l,e,a,n),f=l.type==="hardBreak"?"":kW(d,o,this.getMarkOpening.bind(this));i.push(u+h+f)}}),i.join(s)}getMarkOpening(t,e){const s=this.getHandlersForNodeType(t),n=s.length>0?s[0]:void 0;if(!n||!n.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",o={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const l=n.renderMarkdown(o,{renderChildren:()=>i,renderChild:()=>i,indent:c=>c,wrapInBlock:(c,d)=>c+d},{index:0,level:0,parentType:"text",meta:{}}),a=l.indexOf(i);return a>=0?l.substring(0,a):""}catch(l){throw new Error(`Failed to get mark opening for ${t}: ${l}`)}}getMarkClosing(t,e){const s=this.getHandlersForNodeType(t),n=s.length>0?s[0]:void 0;if(!n||!n.renderMarkdown)return"";const i="__TIPTAP_MARKDOWN_PLACEHOLDER__",o={type:t,attrs:e.attrs||{},content:[{type:"text",text:i}]};try{const l=n.renderMarkdown(o,{renderChildren:()=>i,renderChild:()=>i,indent:d=>d,wrapInBlock:(d,u)=>d+u},{index:0,level:0,parentType:"text",meta:{}}),a=l.indexOf(i),c=a+i.length;return a>=0?l.substring(c):""}catch(l){throw new Error(`Failed to get mark closing for ${t}: ${l}`)}}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.keys()).every(s=>e.has(s))}},c5=jW,UL=Vi.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType)return yr.setContent(t,e);if(R0(t,e?.contentType)!=="markdown"||!this.editor.markdown)return yr.setContent(t,e);const n=this.editor.markdown.parse(t);return yr.setContent(n,e)},insertContent:(t,e)=>{if(!e?.contentType)return yr.insertContent(t,e);if(R0(t,e?.contentType)!=="markdown"||!this.editor.markdown)return yr.insertContent(t,e);const n=this.editor.markdown.parse(t);return yr.insertContent(n,e)},insertContentAt:(t,e,s)=>{if(!s?.contentType)return yr.insertContentAt(t,e,s);if(R0(e,s?.contentType)!=="markdown"||!this.editor.markdown)return yr.insertContentAt(t,e,s);const i=this.editor.markdown.parse(e);return yr.insertContentAt(t,i,s)}}},addStorage(){return{manager:new c5({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new c5({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||R0(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);this.editor.options.content=e}});function CW(t){const e=z.c(25),{node:s,selected:n,editor:i,deleteNode:o}=t,l=re(),a=typeof s.attrs.href=="string"?s.attrs.href:"",c=typeof s.attrs.name=="string"?s.attrs.name:"";let d;e[0]!==c||e[1]!==l?(d=c||l("markdownEditor.fileNameFallback"),e[0]=c,e[1]=l,e[2]=d):d=e[2];const u=d,h=n&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let f;e[3]!==h?(f=ie("mx-0.5 inline-flex max-w-full select-none items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 align-middle text-sm text-foreground",h),e[3]=h,e[4]=f):f=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(yi,{size:14,className:"shrink-0 text-muted-foreground"}),e[5]=m):m=e[5];let p;e[6]!==u?(p=r.jsx("span",{className:"min-w-0 truncate",children:u}),e[6]=u,e[7]=p):p=e[7];let g;e[8]!==u||e[9]!==l?(g=l("markdownEditor.downloadFile",{name:u}),e[8]=u,e[9]=l,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Nc,{size:14}),e[11]=x):x=e[11];let b;e[12]!==a||e[13]!==u||e[14]!==g?(b=r.jsx("a",{href:a,download:u,"aria-label":g,onMouseDown:TW,className:"shrink-0 rounded-md p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:x}),e[12]=a,e[13]=u,e[14]=g,e[15]=b):b=e[15];let v;e[16]!==o||e[17]!==i.isEditable||e[18]!==l?(v=i.isEditable&&r.jsx("button",{type:"button","aria-label":l("markdownEditor.removeFile"),onMouseDown:NW,onClick:o,className:"shrink-0 rounded-md p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r.jsx(Is,{size:14})}),e[16]=o,e[17]=i.isEditable,e[18]=l,e[19]=v):v=e[19];let L;return e[20]!==f||e[21]!==p||e[22]!==b||e[23]!==v?(L=r.jsxs(Xp,{as:"span",className:f,children:[m,p,b,v]}),e[20]=f,e[21]=p,e[22]=b,e[23]=v,e[24]=L):L=e[24],L}function NW(t){return t.preventDefault()}function TW(t){return t.preventDefault()}function VW(t){return t.replace(/([[\]])/g,"\\$1")}const AW=Jp.create({name:"attachment",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href"),renderHTML:t=>t.href?{href:t.href}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||t.textContent,renderHTML:t=>t.name?{"data-name":t.name}:{}}}},parseHTML(){return[{tag:"a[data-attachment]"}]},renderHTML({HTMLAttributes:t,node:e}){return["a",kf(t,{"data-attachment":""}),typeof e.attrs.name=="string"?e.attrs.name:""]},renderMarkdown:t=>{const e=typeof t.attrs?.href=="string"?t.attrs.href:"",s=typeof t.attrs?.name=="string"?t.attrs.name:"";return`[${VW(s)}](${e})`},addNodeView(){return Qp(CW)}});function PW(t){const e=z.c(5),{node:s,selected:n}=t,i=typeof s.attrs.name=="string"?s.attrs.name:"",o=n&&"ring-2 ring-ring";let l;e[0]!==o?(l=ie("select-none rounded px-1 font-medium text-primary","bg-primary/10",o),e[0]=o,e[1]=l):l=e[1];let a;return e[2]!==i||e[3]!==l?(a=r.jsxs(Xp,{as:"span","data-testid":"mention-chip",className:l,children:["@",i]}),e[2]=i,e[3]=l,e[4]=a):a=e[4],a}const HL=Jp.create({name:"mention",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-mention-id"),renderHTML:t=>t.id?{"data-mention-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-mention-name"),renderHTML:t=>t.name?{"data-mention-name":t.name}:{}}}},parseHTML(){return[{tag:"span[data-mention-id]"}]},renderHTML({HTMLAttributes:t,node:e}){return["span",kf(t),`@${typeof e.attrs.name=="string"?e.attrs.name:""}`]},renderMarkdown:t=>{const e=typeof t.attrs?.id=="string"?t.attrs.id:"",s=typeof t.attrs?.name=="string"?t.attrs.name:"";return e?MN(e,s):`@${s}`},addNodeView(){return Qp(PW)}}),EW="studio.mention-members.",Bm=new Map;function d5(t){const e=Bm.get(t);if(e)return e;try{const s=localStorage.getItem(t);if(!s)return;const n=JSON.parse(s);if(!Array.isArray(n))return;const i=n.filter(o=>!!o&&typeof o.id=="string"&&typeof o.name=="string");return Bm.set(t,i),i}catch{return}}function DW(t,e){Bm.set(t,e);try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function RW(t,e){if(!t?.length)return e;const s=new Map(t.map(n=>[n.id,n]));return e.map(n=>{const i=s.get(n.id);return i&&i.name===n.name&&i.email===n.email&&i.image===n.image?i:n})}function IW(t){return t.map(e=>({id:e.userId,name:e.user?.name?.trim()||e.user?.email?.trim()||"",email:e.user?.email??"",image:e.user?.image??null})).filter(e=>!!e.name).sort((e,s)=>e.name.localeCompare(s.name))}function MW(t){const e=z.c(17),{locator:s}=Fe(),n=eP(),i=`${EW}${s}`;let o;e[0]!==s?(o=Qe.mentionMembers(s),e[0]=s,e[1]=o):o=e[1];let l;e[2]!==i?(l=()=>d5(i),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==n||e[5]!==i?(a=async()=>{const m=await n.organization.listMembers(),p=RW(d5(i),IW(m?.data?.members??[]));return DW(i,p),p},e[4]=n,e[5]=i,e[6]=a):a=e[6];let c;e[7]!==t||e[8]!==o||e[9]!==l||e[10]!==a?(c={queryKey:o,enabled:t,staleTime:0,placeholderData:l,queryFn:a},e[7]=t,e[8]=o,e[9]=l,e[10]=a,e[11]=c):c=e[11];const d=Pt(c);let u;e[12]!==d.data?(u=d.data??[],e[12]=d.data,e[13]=u):u=e[13];const h=d.isFetching&&!d.data;let f;return e[14]!==u||e[15]!==h?(f={members:u,loading:h},e[14]=u,e[15]=h,e[16]=f):f=e[16],f}const u5={query:"",range:null,rect:null,editor:null};class KL{state=u5;listeners=new Set;dismissal=null;latched=!1;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;set(e){this.state=e;for(const s of this.listeners)s()}close(){this.latched=!1,this.set(u5)}}const g9=new or("markdownEditorMention");function $W(t,e,s){t.chain().focus().insertContentAt(e,[{type:"mention",attrs:{id:s.id,name:s.name}},{type:"text",text:" "}]).run(),G8(t.view,g9)}function OW(t,e,s){const n=Math.min(e+s,t.content.size);return e>=n?"":t.textBetween(e,n,"","")}function WL(t,e){const s=e.getSnapshot().range??void 0;s&&s.to>s.from&&(e.dismissal={from:s.from,text:t.state.doc.textBetween(s.from,s.to,"")}),G8(t.view,g9)}function qL(t){return Vi.create({name:"mentionSuggestion",addProseMirrorPlugins(){const e={editor:this.editor,char:"@",pluginKey:g9,allowedPrefixes:[" ",`
|
|
85
85
|
`],allow:({state:s,range:n})=>{const i=t.dismissal;return i?n.from===i.from&&OW(s.doc,i.from,i.text.length)===i.text?!1:(t.dismissal=null,!0):!0},items:()=>[],render:()=>({onStart:s=>{t.set({query:s.query,range:s.range,rect:s.clientRect??null,editor:s.editor})},onUpdate:s=>{t.set({query:s.query,range:s.range,rect:s.clientRect??null,editor:s.editor})},onKeyDown:({event:s})=>s.key==="Escape"?(WL(this.editor,t),t.close(),!0):!1,onExit:()=>{t.latched||t.close()}})};return[uR(e)]}})}const h5=256,BW=40,f5=280,zW=140;function GL(t){const e=z.c(4),{store:s}=t,n=P.useSyncExternalStore(s.subscribe,s.getSnapshot),i=n.range!==null;let o;return e[0]!==i||e[1]!==n||e[2]!==s?(o=i?r.jsx(FW,{store:s,state:n}):null,e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3],o}function FW({store:t,state:e}){const s=re(),{members:n,loading:i}=MW(!0),[o,l]=P.useState(e.query),[a,c]=P.useState(null),d=UW(e.editor),u=d.getBoundingClientRect(),h=d===document.body?new DOMRect(0,0,window.innerWidth,window.innerHeight):u,f=e.rect?.()??new DOMRect(0,0,0,0),m=h.bottom-f.bottom,p=m<f5&&f.top-h.top>m,g=(p?f.top-h.top:m)-8,x=Math.min(f5,Math.max(g,zW))-BW,b={position:"absolute",width:h5,left:Math.min(f.left,h.right-h5-8)-u.left,...p?{bottom:u.bottom-f.top+6}:{top:f.bottom-u.top+6}},v=()=>{e.editor&&WL(e.editor,t),t.close()},L=y=>{const S=y.relatedTarget;if((!S||e.editor?.view.dom.contains(S)===!0)&&t.latched){a?.focus();return}v()},_=y=>{!e.editor||!e.range||($W(e.editor,e.range,y),t.close())};return _n.createPortal(r.jsx("div",{style:b,"data-testid":"mention-menu",className:"z-50 overflow-hidden rounded-lg border border-border bg-popover shadow-md",children:r.jsxs(hr,{onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),v(),e.editor?.commands.focus())},children:[r.jsx(Pi,{ref:c,autoFocus:!0,onFocus:()=>{t.latched=!0},value:o,onValueChange:l,placeholder:s("markdownEditor.mentionSearch"),onBlur:L}),r.jsxs(Ei,{style:{maxHeight:x},children:[i?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(Sc,{size:"sm"})}):r.jsx(di,{children:s("markdownEditor.mentionEmpty")}),n.map(y=>r.jsxs(Cs,{value:`${y.name} ${y.email}`,onSelect:()=>_(y),onMouseDown:S=>S.preventDefault(),className:"gap-2",children:[r.jsx(Bs,{url:y.image??void 0,fallback:En(y.name),shape:"circle",size:"xs"}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.name})]},y.id))]})]})}),d)}function UW(t){const e=t?.view.dom.closest('[role="dialog"]');return e instanceof HTMLElement?e:document.body}var HW=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,KW=Jp.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",kf(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,s,n,i,o,l;const a=(s=(e=t.attrs)==null?void 0:e.src)!=null?s:"",c=(i=(n=t.attrs)==null?void 0:n.alt)!=null?i:"",d=(l=(o=t.attrs)==null?void 0:o.title)!=null?l:"";return d?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:s,alwaysPreserveAspectRatio:n}=this.options.resize;return({node:i,getPos:o,HTMLAttributes:l,editor:a})=>{const c=document.createElement("img");Object.entries(l).forEach(([h,f])=>{if(f!=null)switch(h){case"width":case"height":break;default:c.setAttribute(h,f);break}}),c.src=l.src;const d=new ON({element:c,editor:a,node:i,getPos:o,onResize:(h,f)=>{c.style.width=`${h}px`,c.style.height=`${f}px`},onCommit:(h,f)=>{const m=o();m!==void 0&&this.editor.chain().setNodeSelection(m).updateAttributes(this.name,{width:h,height:f}).run()},onUpdate:(h,f,m)=>h.type===i.type,options:{directions:t,min:{width:e,height:s},preserveAspectRatio:n===!0}}),u=d.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",c.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},d}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[$N({find:HW,type:this.type,getAttributes:t=>{const[,,e,s,n]=t;return{src:s,alt:e,title:n}}})]}}),WW=KW;function qW(t){const e=z.c(16),{node:s,selected:n,editor:i,deleteNode:o}=t,l=re(),a=typeof s.attrs.src=="string"?s.attrs.src:"",c=typeof s.attrs.alt=="string"?s.attrs.alt:"";let d;e[0]!==c||e[1]!==l?(d=c||l("markdownEditor.imageAltFallback"),e[0]=c,e[1]=l,e[2]=d):d=e[2];const u=n&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let h;e[3]!==u?(h=ie("max-h-[420px] max-w-full rounded-lg border border-border object-contain",u),e[3]=u,e[4]=h):h=e[4];let f;e[5]!==a||e[6]!==d||e[7]!==h?(f=r.jsx("img",{src:a,alt:d,draggable:!1,className:h}),e[5]=a,e[6]=d,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i.isEditable||e[11]!==l?(m=i.isEditable&&r.jsx("button",{type:"button","aria-label":l("markdownEditor.removeImage"),onMouseDown:GW,onClick:o,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-md border border-border bg-card text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:r.jsx(Is,{size:14})}),e[9]=o,e[10]=i.isEditable,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==f||e[14]!==m?(p=r.jsxs(Xp,{className:"group/image relative my-3 w-fit max-w-full",children:[f,m]}),e[13]=f,e[14]=m,e[15]=p):p=e[15],p}function GW(t){return t.preventDefault()}const YW=WW.extend({addNodeView(){return Qp(qW)}}).configure({inline:!1,allowBase64:!1}),zm="uploads",JW="editor-images",YL="editor-files",QW=new RegExp(`^/api/[^/]+/fs/${zm}/read$`),m5="http://relative.invalid";function XW(t){let e;try{e=new URL(t,m5)}catch{return!1}return e.origin!==m5||!QW.test(e.pathname)?!1:(e.searchParams.get("path")??"").startsWith(`${YL}/`)}const ZW={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},eq=BN.extend({parseMarkdown:(t,e)=>{const s=typeof t.href=="string"?t.href:"";if(XW(s))return e.createNode("attachment",{href:s,name:t.text??""});const n=zN(s);return n?e.createNode("mention",{id:n,name:(t.text??"").replace(/^@/,"")}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:s,title:t.title||null})}});function tq(t="",e){return[wf.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),eq.configure(ZW),Z2.configure({placeholder:t}),YW,AW,HL,...e?[qL(e)]:[],UL.configure({markedOptions:{breaks:!0}})]}const sq=/^(\s*)([-*+]|\d+[.)])\s+\S/,nq=/^\s*(```|~~~)/,iq=/^\s+(?![-*+>#]|\d+[.)]\s)\S/;function rq(t){const e=[];let s=!1,n=!1;for(const i of t.split(`
|
|
86
86
|
`)){if(nq.test(i)){s=!s,n=!1,e.push(i);continue}if(s){e.push(i);continue}if(sq.test(i)){n=!0,e.push(i);continue}if(!i.trim()){n=!1,e.push(i);continue}if(n&&iq.test(i)){e[e.length-1]=`${e[e.length-1]} ${i.trim()}`;continue}n=!1,e.push(i)}return e.join(`
|
|
87
|
-
`)}const oq=10,lq=25,aq={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function cq(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??aq[t.type]??(i3(t)?".png":"")}function i3(t){return t.type.startsWith("image/")}function dq(){const t=re(),{upload:e}=pu(zm),s=j2(zm),[n,i]=P.useState(0);return{uploadFile:async l=>{const a=i3(l),c=a?oq:lq;if(l.size>c*1024*1024)return ge.error(t("markdownEditor.fileTooLarge",{name:l.name,max:String(c)})),null;const d=a?JW:YL,u=`${crypto.randomUUID()}${cq(l)}`;i(h=>h+1);try{return await e.mutateAsync({dir:d,files:[new File([l],u,{type:l.type})]}),s(`${d}/${u}`)}catch{return ge.error(t("markdownEditor.uploadFailed",{name:l.name})),null}finally{i(h=>h-1)}},pending:n}}const uq=["outline-none","min-h-[200px] sm:min-h-[320px]","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0","[&_p]:my-3 [&_p]:leading-[1.5]","[&_h1]:my-3 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:leading-[1.5] [&_h1]:text-foreground","[&_h2]:my-3 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:leading-[1.5] [&_h2]:text-foreground","[&_h3]:my-3 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:leading-[1.5] [&_h3]:text-foreground","[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-5","[&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:my-0.5 [&_li>p]:my-0","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]","[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-[13px]","[&_pre_code]:bg-transparent [&_pre_code]:p-0","[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2","[&_hr]:my-4 [&_hr]:border-border","[&_strong]:font-semibold [&_strong]:text-foreground"].join(" "),hq=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground/50","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function p5(t,e,s,n){const i=t.state.schema.nodes[s];if(!i)return e;const o=t.state.tr.replaceWith(e,e,i.create(n)),l=o.mapping.map(e,1);return o.setSelection(Gi.near(o.doc.resolve(l))),t.dispatch(o),t.state.selection.to}function fq({defaultValue:t,onChange:e,placeholder:s,editable:n=!0}){const i=re(),{uploadFile:o,pending:l}=dq(),[a]=P.useState(()=>new KL),c=P.useRef(null),d=P.useRef(e),u=P.useRef(o);d.current=e,u.current=o;const h=(p,g,x)=>g.length===0?!1:((async()=>{let b=x;for(const v of g){const L=await u.current(v);L&&(b=i3(v)?p5(p,b,"image",{src:L,alt:v.name}):p5(p,b,"attachment",{href:L,name:v.name}))}})(),!0),f=Lf({extensions:tq(s,a),content:rq(t),contentType:"markdown",editable:n,editorProps:{attributes:{role:"textbox","aria-label":s??"","aria-multiline":"true",class:ie(uq,hq)},handlePaste:(p,g)=>{const x=Array.from(g.clipboardData?.files??[]);return x.length===0?!1:(g.stopPropagation(),h(p,x,p.state.selection.to))},handleDrop:(p,g,x,b)=>{if(b)return!1;const v=Array.from(g.dataTransfer?.files??[]);if(v.length===0)return!1;const L=p.posAtCoords({left:g.clientX,top:g.clientY})?.pos;return L===void 0?!1:(g.stopPropagation(),h(p,v,L))}},onUpdate:({editor:p})=>d.current(p.getMarkdown())});if(!f)return null;const m=p=>{!p||p.length===0||h(f.view,Array.from(p),f.state.selection.to)};return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(AK,{editor:f}),r.jsx(GL,{store:a}),r.jsx(Sf,{editor:f,className:"text-[15px] text-muted-foreground"}),r.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground",children:[n&&r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm","aria-label":i("markdownEditor.attachFile"),onClick:()=>c.current?.click(),children:r.jsx(s6,{size:14})}),l>0&&r.jsxs("span",{className:"inline-flex items-center gap-1.5","aria-live":"polite",role:"status",children:[r.jsx(Af,{size:12,className:"animate-spin"}),l===1?i("markdownEditor.uploading"):i("markdownEditor.uploadingCount",{count:String(l)})]})]}),r.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:p=>{m(p.target.files),p.target.value=""}})]})}const mq="claude-subscription";function pq(t){const e=(t??[]).filter(s=>s.costUsd!==null);return e.length===0?null:{total:e.reduce((s,n)=>s+(n.costUsd??0),0),runCount:e.length,onSubscription:e.every(s=>s.costProvider===mq)}}function gq(t,e){const s=t.state==="open"&&!t.merged,n=t.mergeable===!1,i=t.checksStatus!=="failing";return{isOpen:s,hasConflict:n,showShip:e&&s&&i&&!n,showResolveConflict:e&&s&&n}}const xq=6e4;function JL(t){const e=z.c(10),{locator:s}=Fe(),n=ys();let i;e[0]!==t||e[1]!==s?(i=Qe.taskBoardItemPrs(s,t??""),e[0]=t,e[1]=s,e[2]=i):i=e[2];const o=!!t;let l;e[3]!==t||e[4]!==n?(l=async()=>(await n.call("TASK_BOARD_ITEM_PRS_GET",{taskBoardItemId:t})).prs,e[3]=t,e[4]=n,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==o||e[8]!==l?(a={queryKey:i,enabled:o,refetchInterval:xq,queryFn:l},e[6]=i,e[7]=o,e[8]=l,e[9]=a):a=e[9],Pt(a)}function QL(t){const e=z.c(10),{locator:s}=Fe(),n=ys();let i;e[0]!==t||e[1]!==s?(i=Qe.taskBoardActivity(s,t??""),e[0]=t,e[1]=s,e[2]=i):i=e[2];const o=!!t;let l;e[3]!==t||e[4]!==n?(l=async()=>(await n.call("TASK_BOARD_ACTIVITY_LIST",{taskBoardItemId:t})).activity,e[3]=t,e[4]=n,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==o||e[8]!==l?(a={queryKey:i,enabled:o,queryFn:l},e[6]=i,e[7]=o,e[8]=l,e[9]=a):a=e[9],Pt(a)}function bq(t){const e=z.c(10),{locator:s}=Fe(),n=ys(),i=as();let o;e[0]!==t||e[1]!==n?(o=async()=>await n.call("TASK_BOARD_PROMOTE_TO_PRODUCTION",{taskBoardItemId:t}),e[0]=t,e[1]=n,e[2]=o):o=e[2];let l;e[3]!==t||e[4]!==s||e[5]!==i?(l=()=>{i.invalidateQueries({queryKey:Qe.taskBoardItemPrs(s,t)}),i.invalidateQueries({queryKey:Qe.taskBoardActivity(s,t)})},e[3]=t,e[4]=s,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==o||e[8]!==l?(a={mutationFn:o,onSuccess:l},e[7]=o,e[8]=l,e[9]=a):a=e[9],Rs(a)}function vq(t){const e=z.c(10),{locator:s}=Fe(),n=ys(),i=as();let o;e[0]!==t||e[1]!==n?(o=async c=>await n.call("TASK_BOARD_RESOLVE_CONFLICT",{id:t,prNumber:c}),e[0]=t,e[1]=n,e[2]=o):o=e[2];let l;e[3]!==t||e[4]!==s||e[5]!==i?(l=()=>{i.invalidateQueries({queryKey:Qe.taskBoardItemPrs(s,t)}),i.invalidateQueries({queryKey:Qe.taskBoardActivity(s,t)})},e[3]=t,e[4]=s,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==o||e[8]!==l?(a={mutationFn:o,onSuccess:l},e[7]=o,e[8]=l,e[9]=a):a=e[9],Rs(a)}function XL(t){return t?GA:[]}function yq(t,e){return e.length===0?!0:YA(t,e)}function _q(t,e){if(e.length===0)return null;const s=e.map(o=>t.find(l=>l.reviewer===o)),n=s.filter(o=>o?.verdict==="approved"),i={passed:n.length,total:e.length};return s.some(o=>o?.verdict==="changes_requested")?{...i,tone:"danger"}:n.length===0?{...i,tone:"danger"}:n.length<e.length?{...i,tone:"pending"}:{...i,tone:"ok"}}function Lq(t){return t==="in_review"||t==="approved"}function r3(t){const e=z.c(57),{members:s,onSelect:n}=t,i=re();let o;e[0]!==i?(o=i("taskBoard.taskDialog.assignToPlaceholder"),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==i?(l=i("taskBoard.taskDialog.assignToPlaceholder"),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==l?(a=r.jsx(Pi,{placeholder:o,"aria-label":l,className:"h-9"}),e[4]=o,e[5]=l,e[6]=a):a=e[6];let c;e[7]!==i?(c=i("taskBoard.taskDialog.noMembersFound"),e[7]=i,e[8]=c):c=e[8];let d;e[9]!==c?(d=r.jsx(di,{children:c}),e[9]=c,e[10]=d):d=e[10];let u;e[11]!==i?(u=i("taskBoard.taskDialog.superAgentLabel"),e[11]=i,e[12]=u):u=e[12];let h;e[13]!==n?(h=()=>n(ks),e[13]=n,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(sr,{size:16}),e[15]=f):f=e[15];let m;e[16]!==i?(m=i("taskBoard.taskDialog.superAgentLabel"),e[16]=i,e[17]=m):m=e[17];let p;e[18]!==m?(p=r.jsx("span",{className:"truncate",children:m}),e[18]=m,e[19]=p):p=e[19];let g;e[20]!==p||e[21]!==u||e[22]!==h?(g=r.jsxs(Cs,{value:u,onSelect:h,className:"gap-2",children:[f,p]}),e[20]=p,e[21]=u,e[22]=h,e[23]=g):g=e[23];let x;e[24]!==i?(x=i("taskBoard.taskDialog.unassignedLabel"),e[24]=i,e[25]=x):x=e[25];let b;e[26]!==n?(b=()=>n(null),e[26]=n,e[27]=b):b=e[27];let v;e[28]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(U6,{size:16,className:"text-muted-foreground"}),e[28]=v):v=e[28];let L;e[29]!==i?(L=i("taskBoard.taskDialog.unassignedLabel"),e[29]=i,e[30]=L):L=e[30];let _;e[31]!==L?(_=r.jsx("span",{className:"truncate",children:L}),e[31]=L,e[32]=_):_=e[32];let y;e[33]!==x||e[34]!==b||e[35]!==_?(y=r.jsxs(Cs,{value:x,onSelect:b,className:"gap-2",children:[v,_]}),e[33]=x,e[34]=b,e[35]=_,e[36]=y):y=e[36];let S;e[37]!==g||e[38]!==y?(S=r.jsxs(qs,{children:[g,y]}),e[37]=g,e[38]=y,e[39]=S):S=e[39];let k;e[40]!==i?(k=i("taskBoard.taskDialog.membersGroupHeading"),e[40]=i,e[41]=k):k=e[41];let w;if(e[42]!==s||e[43]!==n){let C;e[45]!==n?(C=V=>r.jsxs(Cs,{value:V.user?.name??V.userId,onSelect:()=>n(V.userId),className:"gap-2",children:[r.jsx(Bs,{url:V.user?.image??void 0,fallback:En(V.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:V.user?.name??V.userId})]},V.userId),e[45]=n,e[46]=C):C=e[46],w=s.map(C),e[42]=s,e[43]=n,e[44]=w}else w=e[44];let j;e[47]!==k||e[48]!==w?(j=r.jsx(qs,{heading:k,children:w}),e[47]=k,e[48]=w,e[49]=j):j=e[49];let N;e[50]!==S||e[51]!==j||e[52]!==d?(N=r.jsxs(Ei,{children:[d,S,j]}),e[50]=S,e[51]=j,e[52]=d,e[53]=N):N=e[53];let T;return e[54]!==N||e[55]!==a?(T=r.jsxs(hr,{children:[a,N]}),e[54]=N,e[55]=a,e[56]=T):T=e[56],T}function wq({tags:t,selectedIds:e,defaultColor:s,onToggle:n,onCreate:i,onDelete:o}){const l=re(),[a,c]=P.useState(""),[d,u]=P.useState(!1),[h,f]=P.useState(s),m=a.trim(),p=t.some(x=>x.name.toLowerCase()===m.toLowerCase()),g=async()=>{if(!(!m||p||d)){u(!0);try{await i(m,h),c("")}finally{u(!1)}}};return r.jsxs(hr,{children:[r.jsx(Pi,{value:a,onValueChange:c,placeholder:l("taskBoard.taskDialog.tagFilterPlaceholder"),"aria-label":l("taskBoard.taskDialog.tagFilterPlaceholder"),className:"h-9"}),r.jsxs(Ei,{children:[m&&!p?r.jsx(qs,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"color",value:h,onChange:x=>f(x.target.value),"aria-label":l("taskBoard.taskDialog.pickTagColorAriaLabel"),className:"ml-2 size-4 shrink-0 cursor-pointer appearance-none rounded-full border-0 bg-transparent p-0 [&::-moz-color-swatch]:rounded-full [&::-moz-color-swatch]:border-0 [&::-webkit-color-swatch]:rounded-full [&::-webkit-color-swatch]:border-0 [&::-webkit-color-swatch-wrapper]:p-0"}),r.jsxs(Cs,{value:`create-${m}`,disabled:d,onSelect:g,className:"flex-1 gap-2",children:[r.jsx(Ht,{size:16,className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:l("taskBoard.taskDialog.createTagOption",{name:m})})]})]})}):r.jsx(di,{children:l("taskBoard.taskDialog.noTagsFound")}),r.jsx(qs,{children:t.map(x=>{const b=e.includes(x.id);return r.jsxs(Cs,{value:x.name,onSelect:()=>n(x.id),className:"group gap-2",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ou(x.color)}}),r.jsx("span",{className:"flex-1 truncate",children:x.name}),r.jsx("button",{type:"button","aria-label":l("taskBoard.taskDialog.deleteTagAriaLabel",{name:x.name}),className:"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground opacity-0 hover:bg-background hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",onClick:v=>{v.stopPropagation(),o(x.id)},children:r.jsx(f2,{size:13})}),b&&r.jsx(qt,{size:14,className:"shrink-0 text-foreground"})]},x.id)})})]})]})}function Sq(t){if(!t)return[];const e=[],s=new Set,n=(l,a)=>{s.has(l)||(s.add(l),e.push({url:l,label:a.trim()||l}))},i=t.replace(/!\[[^\]]*\]\([^)]*\)/g,"");for(const l of i.matchAll(/\[([^\]]*)\]\((https?:\/\/[^)\s]+)[^)]*\)/g))n(l[2]??"",l[1]??"");const o=i.replace(/\[[^\]]*\]\([^)]*\)/g,"");for(const l of o.matchAll(/https?:\/\/[^\s)]+/g))n(l[0],l[0]);return e}function kq(t){return{id:t.threadId,title:t.title,status:t.status,created_at:t.createdAt,virtual_mcp_id:t.virtualMcpId}}function jq(t){const e=z.c(5),{title:s}=t;let n;e[0]!==s?(n=r.jsx(hy,{className:"shrink-0 border-b border-border px-5 pb-5 pt-6 md:px-6",children:r.jsx(uy,{className:"truncate text-sm leading-snug",children:s})}),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex flex-1 items-center justify-center"}),e[2]=i):i=e[2];let o;return e[3]!==n?(o=r.jsxs(r.Fragment,{children:[n,i]}),e[3]=n,e[4]=o):o=e[4],o}function Cq(t){const e=z.c(12),{thread:s}=t,{org:n,locator:i}=Fe();let o;e[0]!==n.id||e[1]!==n.slug?(o={connectionId:Ho,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=o):o=e[2];const l=Gt(o),a=ci(),c=Fc(),{data:d}=Iu();let u;e[3]!==s?(u=kq(s),e[3]=s,e[4]=u):u=e[4];let h;return e[5]!==l||e[6]!==a||e[7]!==i||e[8]!==d||e[9]!==u||e[10]!==c?(h=r.jsx(FN,{thread:u,client:l,locator:i,connections:a,virtualMcps:c,members:d,meta:!1}),e[5]=l,e[6]=a,e[7]=i,e[8]=d,e[9]=u,e[10]=c,e[11]=h):h=e[11],h}function Nq(t){const e=z.c(11),{thread:s,onClose:n}=t,i=re(),o=!!s;let l;e[0]!==n?(l=u=>!u&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]!==i||e[3]!==s?(a=s&&r.jsx(P.Suspense,{fallback:r.jsx(jq,{title:s.title??i("taskBoard.taskDialog.superAgentDefaultName")}),children:r.jsx(Cq,{thread:s})}),e[2]=i,e[3]=s,e[4]=a):a=e[4];let c;e[5]!==a?(c=r.jsx(fy,{"data-testid":"task-thread-sheet",className:"flex flex-col gap-0 p-0 sm:max-w-2xl",children:a}),e[5]=a,e[6]=c):c=e[6];let d;return e[7]!==o||e[8]!==l||e[9]!==c?(d=r.jsx(my,{open:o,onOpenChange:l,children:c}),e[7]=o,e[8]=l,e[9]=c,e[10]=d):d=e[10],d}const Tq=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function Vq(t){const e=z.c(24),{placeholder:s,onSubmit:n,onEmptyChange:i,ref:o,className:l}=t,[a]=P.useState(Aq);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=wf.configure({heading:!1,bulletList:!1,orderedList:!1,listItem:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,link:!1,underline:!1}),e[0]=c):c=e[0];let d;e[1]!==a?(d=qL(a),e[1]=a,e[2]=d):d=e[2];let u;e[3]!==s?(u=Z2.configure({placeholder:s}),e[3]=s,e[4]=u):u=e[4];let h;e[5]!==d||e[6]!==u?(h=[c,HL,d,u,UL],e[5]=d,e[6]=u,e[7]=h):h=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=ie("outline-none text-sm leading-relaxed text-foreground",Tq),e[8]=f):f=e[8];let m;e[9]!==s?(m={role:"textbox","aria-label":s,"aria-multiline":"true",class:f},e[9]=s,e[10]=m):m=e[10];let p;e[11]!==i?(p=y=>{const{editor:S}=y;return i(S.isEmpty)},e[11]=i,e[12]=p):p=e[12];const g=Lf({extensions:h,editorProps:{attributes:m,handleKeyDown:(y,S)=>S.key!=="Enter"||S.shiftKey||g9.getState(y.state)?.active?!1:(S.preventDefault(),x(),!0)},onUpdate:p});function x(){if(!g)return;const y=g.getMarkdown().trim();y&&(n(y),g.commands.clearContent(),i(!0))}let b;e[13]!==g?.commands||e[14]!==x?(b=()=>({submit:x,focus:()=>g?.commands.focus()}),e[13]=g?.commands,e[14]=x,e[15]=b):b=e[15],P.useImperativeHandle(o,b);let v;e[16]!==l||e[17]!==g?(v=r.jsx(Sf,{editor:g,className:l}),e[16]=l,e[17]=g,e[18]=v):v=e[18];let L;e[19]!==a?(L=r.jsx(GL,{store:a}),e[19]=a,e[20]=L):L=e[20];let _;return e[21]!==L||e[22]!==v?(_=r.jsxs(r.Fragment,{children:[v,L]}),e[21]=L,e[22]=v,e[23]=_):_=e[23],_}function Aq(){return new KL}function Pq(t){const e=z.c(40),{thread:s,me:n,onReply:i,onDelete:o,onToggleResolved:l}=t,a=re(),[c,d]=P.useState(!1);if(s.resolved&&!c){let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>d(!0),e[0]=v):v=e[0];let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(qT,{size:16,className:"shrink-0 text-muted-foreground"}),e[1]=L):L=e[1];let _;e[2]!==a||e[3]!==s?(_=Dq(s,a),e[2]=a,e[3]=s,e[4]=_):_=e[4];let y;e[5]!==_?(y=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:_}),e[5]=_,e[6]=y):y=e[6];let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(Uf,{size:16,className:"shrink-0 text-muted-foreground"}),e[7]=S):S=e[7];let k;return e[8]!==y?(k=r.jsxs("button",{type:"button",onClick:v,className:"flex w-full items-center gap-2.5 rounded-xl bg-card px-4 py-3 text-left card-shadow transition-colors hover:bg-muted/60",children:[L,y,S]}),e[8]=y,e[9]=k):k=e[9],k}let u;e[10]!==a||e[11]!==s.resolved?(u=s.resolved&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>d(!1),className:"flex items-center justify-between gap-2 rounded-t-xl bg-muted/40 px-4 py-2.5 text-left text-sm text-muted-foreground transition-colors hover:text-foreground",children:[a("taskBoard.taskDialog.commentCollapseThread"),r.jsx(Is,{size:14,"aria-hidden":!0})]}),r.jsx(b1,{})]}),e[10]=a,e[11]=s.resolved,e[12]=u):u=e[12];let h;e[13]!==n||e[14]!==o||e[15]!==s?(h=g5(s,n)?()=>o(s.id):void 0,e[13]=n,e[14]=o,e[15]=s,e[16]=h):h=e[16];let f;e[17]!==l||e[18]!==h||e[19]!==s?(f=r.jsx(x5,{comment:s,onDelete:h,resolved:s.resolved,onToggleResolved:l}),e[17]=l,e[18]=h,e[19]=s,e[20]=f):f=e[20];let m;if(e[21]!==n||e[22]!==o||e[23]!==s.replies){let v;e[25]!==n||e[26]!==o?(v=(L,_)=>r.jsxs(P.Fragment,{children:[r.jsx(b1,{inset:_>0}),r.jsx(x5,{comment:L,onDelete:g5(L,n)?()=>o(L.id):void 0,isReply:!0})]},L.id),e[25]=n,e[26]=o,e[27]=v):v=e[27],m=s.replies.map(v),e[21]=n,e[22]=o,e[23]=s.replies,e[24]=m}else m=e[24];let p;e[28]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(b1,{}),e[28]=p):p=e[28];let g;e[29]!==a?(g=a("taskBoard.taskDialog.commentReplyPlaceholder"),e[29]=a,e[30]=g):g=e[30];let x;e[31]!==n||e[32]!==i||e[33]!==g?(x=r.jsx(ew,{variant:"reply",placeholder:g,author:n,onSubmit:i}),e[31]=n,e[32]=i,e[33]=g,e[34]=x):x=e[34];let b;return e[35]!==u||e[36]!==f||e[37]!==m||e[38]!==x?(b=r.jsxs("div",{className:"flex flex-col rounded-xl bg-card card-shadow",children:[u,f,m,p,x]}),e[35]=u,e[36]=f,e[37]=m,e[38]=x,e[39]=b):b=e[39],b}function g5(t,e){return t.author.id===e.id||t.author.isAgent===!0}const Eq=new Intl.ListFormat(void 0,{style:"long",type:"conjunction"});function Dq(t,e){const s=[t,...t.replies],n=Eq.format([...new Set(s.map(i=>i.author.name))]);return s.length===1?e("taskBoard.taskDialog.commentResolvedSummaryOne",{names:n}):e("taskBoard.taskDialog.commentResolvedSummaryMany",{count:s.length,names:n})}function Rq(t){const e=z.c(6),{me:s,onSubmit:n}=t,i=re();let o;e[0]!==i?(o=i("taskBoard.taskDialog.commentPlaceholder"),e[0]=i,e[1]=o):o=e[1];let l;return e[2]!==s||e[3]!==n||e[4]!==o?(l=r.jsx(ew,{variant:"root",placeholder:o,author:s,onSubmit:n}),e[2]=s,e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function b1(t){const e=z.c(4),{inset:s}=t,n=s&&"ml-12";let i;e[0]!==n?(i=ie("h-px bg-border/50",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==i?(o=r.jsx("span",{className:i}),e[2]=i,e[3]=o):o=e[3],o}function x5(t){const e=z.c(28),{comment:s,isReply:n,resolved:i,onDelete:o,onToggleResolved:l}=t;let a;e[0]!==s.author?(a=r.jsx(ZL,{author:s.author}),e[0]=s.author,e[1]=a):a=e[1];let c;e[2]!==s.author.name?(c=r.jsx("span",{className:"text-sm font-medium text-foreground",children:s.author.name}),e[2]=s.author.name,e[3]=c):c=e[3];let d;e[4]!==s.createdAt?(d=Ol(new Date(s.createdAt)),e[4]=s.createdAt,e[5]=d):d=e[5];let u;e[6]!==d?(u=r.jsx("span",{className:"text-sm text-muted-foreground",children:d}),e[6]=d,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==l||e[10]!==i?(h=(o||l)&&r.jsx(Iq,{resolved:i,onDelete:o,onToggleResolved:l}),e[8]=o,e[9]=l,e[10]=i,e[11]=h):h=e[11];let f;e[12]!==a||e[13]!==c||e[14]!==u||e[15]!==h?(f=r.jsxs("div",{className:"flex items-center gap-2",children:[a,c,u,h]}),e[12]=a,e[13]=c,e[14]=u,e[15]=h,e[16]=f):f=e[16];const m=n&&"pl-8";let p;e[17]!==m?(p=ie("text-sm leading-relaxed text-foreground [&_li]:text-sm [&_p]:text-sm",m),e[17]=m,e[18]=p):p=e[18];let g;e[19]!==s.body||e[20]!==s.id?(g=r.jsx(Fo,{id:s.id,text:s.body}),e[19]=s.body,e[20]=s.id,e[21]=g):g=e[21];let x;e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:p,children:g}),e[22]=p,e[23]=g,e[24]=x):x=e[24];let b;return e[25]!==x||e[26]!==f?(b=r.jsxs("div",{className:"group flex flex-col gap-1.5 p-4",children:[f,x]}),e[25]=x,e[26]=f,e[27]=b):b=e[27],b}function Iq(t){const e=z.c(18),{resolved:s,onDelete:n,onToggleResolved:i}=t,o=re();let l;e[0]!==o?(l=o("taskBoard.taskDialog.commentActionsAriaLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Gn,{size:16}),e[2]=a):a=e[2];let c;e[3]!==l?(c=r.jsx(Zt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":l,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-colors hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100",children:a})}),e[3]=l,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==o?(d=i&&r.jsxs(r.Fragment,{children:[r.jsxs(Xe,{onSelect:i,children:[r.jsx(qt,{size:16}),o(s?"taskBoard.taskDialog.commentUnresolveThread":"taskBoard.taskDialog.commentResolveThread")]}),r.jsx(Pr,{})]}),e[5]=i,e[6]=s,e[7]=o,e[8]=d):d=e[8];let u;e[9]!==n||e[10]!==o?(u=n&&r.jsxs(Xe,{variant:"destructive",onSelect:n,children:[r.jsx(f2,{size:16}),o("taskBoard.taskDialog.commentDelete")]}),e[9]=n,e[10]=o,e[11]=u):u=e[11];let h;e[12]!==d||e[13]!==u?(h=r.jsxs(es,{align:"end",className:"w-48",children:[d,u]}),e[12]=d,e[13]=u,e[14]=h):h=e[14];let f;return e[15]!==c||e[16]!==h?(f=r.jsxs(Xt,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=f):f=e[17],f}function ZL(t){const e=z.c(6),{author:s}=t;if(s.isAgent){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(sr,{size:24}),e[0]=l):l=e[0],l}const n=s.image??void 0;let i;e[1]!==s.name?(i=En(s.name),e[1]=s.name,e[2]=i):i=e[2];let o;return e[3]!==n||e[4]!==i?(o=r.jsx(Bs,{url:n,fallback:i,shape:"circle",size:"xs"}),e[3]=n,e[4]=i,e[5]=o):o=e[5],o}function ew(t){const e=z.c(27),{variant:s,placeholder:n,author:i,onSubmit:o}=t,l=re(),a=P.useRef(null),[c,d]=P.useState(!0);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>a.current?.submit(),e[0]=u):u=e[0];const h=u,f=s==="root"&&"min-h-10";let m;e[1]!==f?(m=ie("w-full [&_.tiptap]:outline-none",f),e[1]=f,e[2]=m):m=e[2];let p;e[3]!==o||e[4]!==n||e[5]!==m?(p=r.jsx(Vq,{ref:a,placeholder:n,onSubmit:o,onEmptyChange:d,className:m}),e[3]=o,e[4]=n,e[5]=m,e[6]=p):p=e[6];const g=p;let x;e[7]!==l?(x=l("taskBoard.taskDialog.commentSubmitAriaLabel"),e[7]=l,e[8]=x):x=e[8];let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(bf,{size:16}),e[9]=b):b=e[9];let v;e[10]!==c||e[11]!==x?(v=r.jsx("button",{type:"button",disabled:c,onClick:h,"aria-label":x,className:"flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40",children:b}),e[10]=c,e[11]=x,e[12]=v):v=e[12];const L=v;let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=()=>a.current?.focus(),e[13]=_):_=e[13];const y=_;if(s==="root"){let j;e[14]!==L?(j=r.jsx("div",{className:"flex items-center justify-end",children:L}),e[14]=L,e[15]=j):j=e[15];let N;return e[16]!==j||e[17]!==g?(N=r.jsxs("div",{"data-testid":"new-comment-composer",onClick:y,className:"relative flex cursor-text flex-col gap-1 rounded-xl bg-card p-3 card-shadow",children:[g,j]}),e[16]=j,e[17]=g,e[18]=N):N=e[18],N}let S;e[19]!==i?(S=r.jsx("span",{className:"mt-0.5 shrink-0",children:r.jsx(ZL,{author:i})}),e[19]=i,e[20]=S):S=e[20];let k;e[21]!==g?(k=r.jsx("div",{className:"min-w-0 flex-1 pt-0.5",children:g}),e[21]=g,e[22]=k):k=e[22];let w;return e[23]!==L||e[24]!==k||e[25]!==S?(w=r.jsxs("div",{"data-testid":"reply-composer",onClick:y,className:"relative flex cursor-text items-start gap-2 p-3",children:[S,k,L]}),e[23]=L,e[24]=k,e[25]=S,e[26]=w):w=e[26],w}function Mq(t){const e=t.filter(n=>!n.parentId).map(n=>({...n,replies:[]})),s=new Map(e.map(n=>[n.id,n]));for(const n of t)n.parentId&&s.get(n.parentId)?.replies.push(n);return e}function $q(t){const e=z.c(36),{locator:s}=Fe(),n=ys(),i=as();let o;e[0]!==t||e[1]!==s?(o=Qe.taskBoardComments(s,t??""),e[0]=t,e[1]=s,e[2]=o):o=e[2];const l=o,a=!!t;let c;e[3]!==t||e[4]!==n?(c=async()=>Mq((await n.call("TASK_BOARD_COMMENT_LIST",{taskBoardItemId:t})).comments),e[3]=t,e[4]=n,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==a||e[8]!==c?(d={queryKey:l,enabled:a,queryFn:c},e[6]=l,e[7]=a,e[8]=c,e[9]=d):d=e[9];const u=Pt(d);let h;e[10]!==i||e[11]!==l?(h=()=>i.invalidateQueries({queryKey:l}),e[10]=i,e[11]=l,e[12]=h):h=e[12];const f=h;let m;e[13]!==t||e[14]!==n?(m=w=>n.call("TASK_BOARD_COMMENT_CREATE",{taskBoardItemId:t,...w}),e[13]=t,e[14]=n,e[15]=m):m=e[15];let p;e[16]!==f||e[17]!==m?(p={mutationFn:m,onSuccess:f},e[16]=f,e[17]=m,e[18]=p):p=e[18];const g=Rs(p);let x;e[19]!==n?(x=w=>n.call("TASK_BOARD_COMMENT_UPDATE",w),e[19]=n,e[20]=x):x=e[20];let b;e[21]!==f||e[22]!==x?(b={mutationFn:x,onSuccess:f},e[21]=f,e[22]=x,e[23]=b):b=e[23];const v=Rs(b);let L;e[24]!==n?(L=w=>n.call("TASK_BOARD_COMMENT_DELETE",{id:w}),e[24]=n,e[25]=L):L=e[25];let _;e[26]!==f||e[27]!==L?(_={mutationFn:L,onSuccess:f},e[26]=f,e[27]=L,e[28]=_):_=e[28];const y=Rs(_);let S;e[29]!==u.data?(S=u.data??[],e[29]=u.data,e[30]=S):S=e[30];let k;return e[31]!==g||e[32]!==y||e[33]!==v||e[34]!==S?(k={threads:S,post:g,setResolved:v,remove:y},e[31]=g,e[32]=y,e[33]=v,e[34]=S,e[35]=k):k=e[35],k}function Oq(t){const e=z.c(24),{locator:s}=Fe(),n=ys(),i=as();let o;e[0]!==t||e[1]!==s?(o=Qe.notificationSubscribers(s,t??""),e[0]=t,e[1]=s,e[2]=o):o=e[2];const l=o,a=!!t;let c;e[3]!==t||e[4]!==n?(c=async()=>(await n.call("NOTIFICATION_SUBSCRIPTION_LIST",{taskBoardItemId:t})).userIds,e[3]=t,e[4]=n,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==a||e[8]!==c?(d={queryKey:l,enabled:a,queryFn:c},e[6]=l,e[7]=a,e[8]=c,e[9]=d):d=e[9];const u=Pt(d);let h;e[10]!==t||e[11]!==n?(h=b=>n.call("NOTIFICATION_SUBSCRIPTION_SET",{taskBoardItemId:t,subscribed:b}),e[10]=t,e[11]=n,e[12]=h):h=e[12];let f;e[13]!==i||e[14]!==l?(f=()=>i.invalidateQueries({queryKey:l}),e[13]=i,e[14]=l,e[15]=f):f=e[15];let m;e[16]!==h||e[17]!==f?(m={mutationFn:h,onSuccess:f},e[16]=h,e[17]=f,e[18]=m):m=e[18];const p=Rs(m);let g;e[19]!==u.data?(g=u.data??[],e[19]=u.data,e[20]=g):g=e[20];let x;return e[21]!==p||e[22]!==g?(x={subscriberIds:g,setSubscribed:p},e[21]=p,e[22]=g,e[23]=x):x=e[23],x}const Bq=3;function zq(t){const e=z.c(23),{itemId:s,members:n}=t,i=re(),{data:o}=In.useSession(),l=o?.user?.id,{subscriberIds:a,setSubscribed:c}=Oq(s);let d;e[0]!==l||e[1]!==a?(d=!!l&&a.includes(l),e[0]=l,e[1]=a,e[2]=d):d=e[2];const u=d;let h;if(e[3]!==s||e[4]!==n||e[5]!==l||e[6]!==c||e[7]!==u||e[8]!==a||e[9]!==i){const f=new Map(n.map(Hq)),m=l?f.get(l):void 0;let p;e[11]!==l?(p=k=>k!==l,e[11]=l,e[12]=p):p=e[12];const g=a.filter(p).map(k=>f.get(k)).filter(Uq),x=[...u&&m?[m]:[],...g],b=x.slice(0,Bq),v=x.length-b.length,L=!s||c.isPending;let _;e[13]!==c||e[14]!==u?(_=()=>c.mutate(!u),e[13]=c,e[14]=u,e[15]=_):_=e[15];let y;e[16]!==u||e[17]!==i?(y=i(u?"taskBoard.taskDialog.unsubscribe":"taskBoard.taskDialog.subscribe"),e[16]=u,e[17]=i,e[18]=y):y=e[18];let S;e[19]!==L||e[20]!==_||e[21]!==y?(S=r.jsx(he,{type:"button",variant:"ghost",size:"sm",disabled:L,onClick:_,className:"h-7 px-2 text-sm font-normal text-muted-foreground",children:y}),e[19]=L,e[20]=_,e[21]=y,e[22]=S):S=e[22],h=r.jsxs("div",{className:"flex items-center gap-2",children:[S,b.length>0&&r.jsxs("span",{className:"inline-flex items-center",title:x.map(k=>k.user?.name??i("taskBoard.taskDialog.someoneLabel")).join(", "),children:[b.map(Fq),v>0&&r.jsxs("span",{className:"-ml-2 inline-flex size-6 items-center justify-center rounded-full bg-muted text-[10px] font-medium text-muted-foreground ring-2 ring-background",children:["+",v]})]})]}),e[3]=s,e[4]=n,e[5]=l,e[6]=c,e[7]=u,e[8]=a,e[9]=i,e[10]=h}else h=e[10];return h}function Fq(t){return r.jsx(Bs,{url:t.user?.image??void 0,fallback:En(t.user?.name),shape:"circle",size:"xs",className:"-ml-2 ring-2 ring-background first:ml-0"},t.userId)}function Uq(t){return!!t}function Hq(t){return[t.userId,t]}function o3(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59).toISOString()}function tw(t){if(!t)return null;const e=new Date(t);return Number.isNaN(e.getTime())?null:e}const b5=560,Kq=2e3,sw=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),Ui="inline-flex h-9 items-center justify-start gap-2 rounded-lg border border-border px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted sm:border-transparent",v5=4,y5=1,xd="opacity-50";function Wq(t){const e=z.c(22),{threads:s}=t,n=re();let i,o,l,a,c,d;if(e[0]!==n||e[1]!==s){d=Symbol.for("react.early_return_sentinel");e:{const f=pq(s);if(!f){d=null;break e}const{total:m,runCount:p,onSubscription:g}=f,x=p===1,b=g?x?"taskBoard.taskDialog.costTooltipSubscriptionSingular":"taskBoard.taskDialog.costTooltipSubscriptionPlural":x?"taskBoard.taskDialog.costTooltipSingular":"taskBoard.taskDialog.costTooltipPlural";e[8]===Symbol.for("react.memo_cache_sentinel")?(l=ie(Ui,"cursor-default hover:bg-transparent"),e[8]=l):l=e[8];const v=String(p);e[9]!==n||e[10]!==v||e[11]!==b?(a=n(b,{runs:v}),e[9]=n,e[10]=v,e[11]=b,e[12]=a):a=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(KA,{size:16,className:"shrink-0 text-muted-foreground"}),e[13]=c):c=e[13],i="tabular-nums",o=n("taskBoard.taskDialog.costEstimatePrefix",{amount:m.toLocaleString(void 0,{style:"currency",currency:"USD"})})}e[0]=n,e[1]=s,e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=d}else i=e[2],o=e[3],l=e[4],a=e[5],c=e[6],d=e[7];if(d!==Symbol.for("react.early_return_sentinel"))return d;let u;e[14]!==i||e[15]!==o?(u=r.jsx("span",{className:i,children:o}),e[14]=i,e[15]=o,e[16]=u):u=e[16];let h;return e[17]!==l||e[18]!==a||e[19]!==c||e[20]!==u?(h=r.jsxs("div",{className:l,title:a,children:[c,u]}),e[17]=l,e[18]=a,e[19]=c,e[20]=u,e[21]=h):h=e[21],h}function ch(t){const e=z.c(7),{label:s,children:n}=t;let i;e[0]!==s?(i=r.jsx("span",{className:"px-3 text-sm font-medium text-muted-foreground opacity-[0.74]",children:s}),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==n?(o=r.jsx("div",{className:"flex flex-wrap gap-2 sm:flex-col sm:items-start sm:gap-1",children:n}),e[2]=n,e[3]=o):o=e[3];let l;return e[4]!==i||e[5]!==o?(l=r.jsxs("div",{className:"flex flex-col gap-2",children:[i,o]}),e[4]=i,e[5]=o,e[6]=l):l=e[6],l}function qq(t){const e=z.c(7),{item:s}=t,n=re(),{data:i}=JL(s.id);if(!i||i.length===0)return null;let o;e[0]!==n?(o=n("taskBoard.taskDialog.reviewsLabel"),e[0]=n,e[1]=o):o=e[1];let l;e[2]!==i?(l=i.map(Gq),e[2]=i,e[3]=l):l=e[3];let a;return e[4]!==o||e[5]!==l?(a=r.jsx(ch,{label:o,children:l}),e[4]=o,e[5]=l,e[6]=a):a=e[6],a}function Gq(t){return r.jsx(he,{asChild:!0,variant:"ghost",className:"h-9 w-full justify-start gap-2 px-3 font-medium",children:r.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",title:t.title?`#${t.number} ${t.title}`:t.url,children:[r.jsx(yo,{size:16,className:"shrink-0"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:t.title??`#${t.number}`})]})},t.url)}function nw(t){const e=z.c(11),{label:s,action:n,children:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(_s,{size:14,className:"shrink-0 transition-transform group-data-[state=closed]:-rotate-90"}),e[0]=o):o=e[0];let l;e[1]!==s?(l=r.jsxs($y,{className:"group flex w-fit items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",children:[s,o]}),e[1]=s,e[2]=l):l=e[2];let a;e[3]!==n||e[4]!==l?(a=r.jsxs("div",{className:"flex min-h-7 items-center justify-between gap-2",children:[l,n]}),e[3]=n,e[4]=l,e[5]=a):a=e[5];let c;e[6]!==i?(c=r.jsx(Oy,{children:i}),e[6]=i,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==c?(d=r.jsxs(By,{defaultOpen:!0,className:"flex flex-col gap-2",children:[a,c]}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d}function iw(t){const e=z.c(449),{chrome:s,open:n,onClose:i,item:o,defaultStatus:l,onSubmit:a,onDelete:c,onClone:d,onArchive:u,onOpenPreview:h,onNewChat:f,onAutoFix:m,onRerun:p,isSaving:g}=t,x=n===void 0?!0:n,b=re(),{org:v}=Fe(),{data:L}=Iu();let _;e[0]!==L?.data?.members?(_=L?.data?.members??[],e[0]=L?.data?.members,e[1]=_):_=e[1];const y=_,S=S2("delivery_lanes_enabled"),{handleCopy:k,copied:w}=J9(),{handleCopy:j,copied:N}=J9(),{handleCopy:T,copied:C}=J9(),{data:V}=z2();let A;e[2]!==V?(A=V===void 0?[]:V,e[2]=V,e[3]=A):A=e[3];const E=A,D=tP(),I=sP();let R;e[4]===Symbol.for("react.memo_cache_sentinel")?(R={slug:"mcp-github"},e[4]=R):R=e[4];const $=q6(ci(R)),B=o?.title??"",M=o?.description??"",O=o?.status??l??"triage",F=o?.priority??"medium",U=o?.type??JA,K=o?.assigneeId??null,q=o?.repo??null,W=o?.dueDate;let G;e[5]!==W?(G=tw(W),e[5]=W,e[6]=G):G=e[6];let Y;e[7]!==o?.tags?(Y=o?.tags.map(Xq)??[],e[7]=o?.tags,e[8]=Y):Y=e[8];let ee;e[9]!==U||e[10]!==K||e[11]!==q||e[12]!==G||e[13]!==Y||e[14]!==B||e[15]!==M||e[16]!==O||e[17]!==F?(ee={title:B,description:M,status:O,priority:F,type:U,assigneeId:K,repo:q,dueDate:G,tagIds:Y},e[9]=U,e[10]=K,e[11]=q,e[12]=G,e[13]=Y,e[14]=B,e[15]=M,e[16]=O,e[17]=F,e[18]=ee):ee=e[18];const[ne,oe]=P.useState(ee),{title:Z,description:J,status:H,priority:se,assigneeId:Q,repo:ce,dueDate:te}=ne,le=ne.type,ue=J6(),fe=o?.sprintId?ue.get(o.sprintId)??null:null,ae=ne.tagIds,[de,X]=P.useState(!1),[pe,ye]=P.useState(!1),we=pe&&!de;let _e;e[19]===Symbol.for("react.memo_cache_sentinel")?(_e=Ie=>{if(!Ie)return;const St=()=>ye(Ie.scrollHeight>b5);St();const Ft=new ResizeObserver(St);return Ft.observe(Ie),()=>Ft.disconnect()},e[19]=_e):_e=e[19];const Pe=_e,[Se,Te]=P.useState(!1),[ve,ke]=P.useState(!1),[Le,Ne]=P.useState(!1),[et,Ye]=P.useState(null);let ze;e[20]!==o?.threads||e[21]!==et?(ze=o?.threads.find(Ie=>Ie.threadId===et)??null,e[20]=o?.threads,e[21]=et,e[22]=ze):ze=e[22];const Me=ze,at=P.useRef(ne),Ze=P.useRef(null),it=P.useRef(a);let rt;e[23]===Symbol.for("react.memo_cache_sentinel")?(rt=()=>{Ze.current=null;const Ie=at.current;Ie.title.trim()&&it.current({title:Ie.title.trim(),description:Ie.description.trim()||null,status:Ie.status,priority:Ie.priority,type:Ie.type,assigneeId:Ie.assigneeId,repo:Ie.repo,dueDate:Ie.dueDate?o3(Ie.dueDate):null,tagIds:Ie.tagIds})},e[23]=rt):rt=e[23];const dt=rt;let nt;e[24]!==dt||e[25]!==o||e[26]!==a?(nt=(Ie,St)=>{const Ft=St===void 0?!1:St,Ps={...at.current,...Ie};at.current=Ps,it.current=a,oe(Ps),o&&(Ze.current&&clearTimeout(Ze.current),Ft?Ze.current=setTimeout(dt,Kq):dt())},e[24]=dt,e[25]=o,e[26]=a,e[27]=nt):nt=e[27];const Re=nt;let ft;e[28]!==dt?(ft=()=>{Ze.current&&(clearTimeout(Ze.current),dt())},e[28]=dt,e[29]=ft):ft=e[29];const ut=ft;let be;e[30]===Symbol.for("react.memo_cache_sentinel")?(be=()=>{Ze.current&&(clearTimeout(Ze.current),Ze.current=null)},e[30]=be):be=e[30];const qe=be;let tt;e[31]!==ut||e[32]!==i?(tt=()=>{ut(),i()},e[31]=ut,e[32]=i,e[33]=tt):tt=e[33];const Ue=tt;let Lt;e[34]!==ut?(Lt=Ie=>{if(Ie)return()=>ut()},e[34]=ut,e[35]=Lt):Lt=e[35];const wt=Lt;let ht;e[36]!==Ue?(ht=Ie=>{if(!Ie)return;const St=Ft=>{if(Ft.key!=="Escape"||Ft.defaultPrevented||document.querySelector('[data-radix-popper-content-wrapper], [role="dialog"][data-state="open"]'))return;const Ps=Ft.target;if(Ps instanceof HTMLElement&&(Ps.isContentEditable||Ps instanceof HTMLInputElement||Ps instanceof HTMLTextAreaElement)){Ps.blur();return}Ue()};return document.addEventListener("keydown",St),()=>document.removeEventListener("keydown",St)},e[36]=Ue,e[37]=ht):ht=e[37];const Tt=ht;let $e;e[38]!==D||e[39]!==Re?($e=async(Ie,St)=>{const Ft=await D.mutateAsync({name:Ie,color:St});Re({tagIds:[...at.current.tagIds,Ft.id]})},e[38]=D,e[39]=Re,e[40]=$e):$e=e[40];const ct=$e;let kt;e[41]!==I||e[42]!==Re?(kt=Ie=>{I.mutate(Ie),Re({tagIds:at.current.tagIds.filter(St=>St!==Ie)})},e[41]=I,e[42]=Re,e[43]=kt):kt=e[43];const xt=kt,yt=Q===ks,me=o&&m&&(H==="triage"||H==="todo")&&!yt,Ae=o&&p&&o.assigneeId===ks;let Oe;e[44]!==o||e[45]!==v?(Oe=o?Y6(v.slug,o.keySeq,o.jiraIssueKey):null,e[44]=o,e[45]=v,e[46]=Oe):Oe=e[46];const je=Oe;let ot;if(e[47]!==Q||e[48]!==y){let Ie;e[50]!==Q?(Ie=St=>St.userId===Q,e[50]=Q,e[51]=Ie):Ie=e[51],ot=y.find(Ie),e[47]=Q,e[48]=y,e[49]=ot}else ot=e[49];const mt=ot;let $t;e[52]!==o||e[53]!==y?($t=o?.assignedBy?y.find(Ie=>Ie.userId===o.assignedBy):void 0,e[52]=o,e[53]=y,e[54]=$t):$t=e[54];const At=$t,hn=ii[H].icon;let Ot,As,$n,_t,Fs,fn,ln,mn,Ce,st,Dt,Ls,Js,an,On;if(e[55]!==s||e[56]!==Ue||e[57]!==w||e[58]!==T||e[59]!==j||e[60]!==J||e[61]!==ut||e[62]!==k||e[63]!==C||e[64]!==g||e[65]!==o||e[66]!==je||e[67]!==N||e[68]!==u||e[69]!==m||e[70]!==d||e[71]!==c||e[72]!==f||e[73]!==p||e[74]!==v||e[75]!==Re||e[76]!==me||e[77]!==Ae||e[78]!==H||e[79]!==b||e[80]!==Z){Ot=!!o&&n8(o);let Ie;e[96]!==s||e[97]!==Ue||e[98]!==T||e[99]!==C||e[100]!==je||e[101]!==b?(Ie=s==="page"?r.jsx(BA,{className:"-ml-2",children:r.jsxs(zA,{className:"text-[15px]",children:[r.jsx(Lx,{children:r.jsx(FA,{asChild:!0,className:"rounded-md px-2 py-1 text-muted-foreground hover:bg-accent",children:r.jsx("button",{type:"button",onClick:Ue,children:b("taskBoard.taskDetail.breadcrumbTasks")})})}),r.jsx(UA,{}),r.jsx(Lx,{children:r.jsx(HA,{className:"px-2 py-1",children:je??b("taskBoard.taskDetail.breadcrumbTask")})})]})}):je?r.jsxs(he,{variant:"ghost",size:"sm",title:je,"aria-label":b("taskBoard.taskDialog.copyIdAriaLabel"),className:"-ml-2 gap-2 px-2 text-[15px] text-muted-foreground hover:text-foreground",onClick:()=>{T(je),ge.success(b("taskBoard.taskDialog.idCopied"))},children:[C?r.jsx(qt,{size:16}):r.jsx(gx,{size:16}),je]}):r.jsxs("span",{"aria-hidden":!0,className:"flex h-7 items-center gap-2 text-[15px] text-muted-foreground opacity-50",children:[r.jsx(gx,{size:16}),"–"]}),e[96]=s,e[97]=Ue,e[98]=T,e[99]=C,e[100]=je,e[101]=b,e[102]=Ie):Ie=e[102];let St;e[103]!==g||e[104]!==o||e[105]!==b?(St=o&&g&&r.jsx("span",{className:"mr-1 text-sm text-muted-foreground",children:b("taskBoard.taskDialog.savingLabel")}),e[103]=g,e[104]=o,e[105]=b,e[106]=St):St=e[106];let Ft;e[107]!==w||e[108]!==j||e[109]!==J||e[110]!==k||e[111]!==o||e[112]!==je||e[113]!==N||e[114]!==u||e[115]!==m||e[116]!==d||e[117]!==c||e[118]!==f||e[119]!==p||e[120]!==v||e[121]!==me||e[122]!==Ae||e[123]!==H||e[124]!==b?(Ft=o&&r.jsxs(r.Fragment,{children:[r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":b("taskBoard.taskDialog.shareAriaLabel"),title:b("taskBoard.taskDialog.shareTitle"),className:"text-muted-foreground hover:text-foreground",onClick:()=>{j(`${window.location.origin}/${v.slug}/t/${je??o.id}`),ge.success(b("taskBoard.taskDialog.linkCopied"))},children:N?r.jsx(qt,{size:16}):r.jsx(GT,{size:16})}),r.jsxs(Xt,{modal:!1,children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":b("taskBoard.taskDialog.moreActionsAriaLabel"),className:"text-muted-foreground hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground",children:r.jsx(Gn,{size:16})})}),r.jsxs(es,{align:"end",className:"w-48",children:[f&&r.jsxs(Xe,{onSelect:f,children:[r.jsx(Nf,{size:16}),b("taskBoard.taskDialog.newChatButton")]}),me&&r.jsxs(Xe,{onSelect:m,children:[r.jsx(Ml,{size:16}),b("taskBoard.taskBoard.autoFix")]}),Ae&&r.jsxs(Xe,{onSelect:p,children:[r.jsx(Dn,{size:16}),b("taskBoard.taskBoard.rerun")]}),(f||me||Ae)&&r.jsx(Pr,{}),J&&r.jsxs(Xe,{onSelect:()=>k(J),children:[w?r.jsx(qt,{size:16}):r.jsx(dn,{size:16}),b("taskBoard.taskDialog.copyDescription")]}),d&&r.jsxs(Xe,{onSelect:d,children:[r.jsx(YT,{size:16}),b("taskBoard.taskDialog.cloneTask")]}),u&&H!=="archived"&&r.jsxs(Xe,{onSelect:()=>{qe(),u()},children:[r.jsx(Sy,{size:16}),b("taskBoard.taskDialog.archiveTask")]}),c&&r.jsxs(Xe,{variant:"destructive",onSelect:()=>{qe(),c()},children:[r.jsx(f2,{size:16}),b("taskBoard.taskDialog.deleteTask")]})]})]})]}),e[107]=w,e[108]=j,e[109]=J,e[110]=k,e[111]=o,e[112]=je,e[113]=N,e[114]=u,e[115]=m,e[116]=d,e[117]=c,e[118]=f,e[119]=p,e[120]=v,e[121]=me,e[122]=Ae,e[123]=H,e[124]=b,e[125]=Ft):Ft=e[125];let Ps;e[126]!==s||e[127]!==Ue||e[128]!==b?(Ps=s==="dialog"&&r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":b("taskBoard.taskDialog.closeAriaLabel"),className:"text-muted-foreground hover:text-foreground",onClick:Ue,children:r.jsx(Is,{size:16})}),e[126]=s,e[127]=Ue,e[128]=b,e[129]=Ps):Ps=e[129];let lo;e[130]!==St||e[131]!==Ft||e[132]!==Ps?(lo=r.jsxs("div",{className:"flex items-center gap-0.5",children:[St,Ft,Ps]}),e[130]=St,e[131]=Ft,e[132]=Ps,e[133]=lo):lo=e[133];let m0;e[134]!==Ie||e[135]!==lo?(m0=r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-6 pb-4 pt-6 sm:px-8",children:[Ie,lo]}),e[134]=Ie,e[135]=lo,e[136]=m0):m0=e[136];const p0=m0;e[137]!==s||e[138]!==p0?(On=s==="page"?r.jsx("div",{className:"mx-auto w-full max-w-[1040px]",children:p0}):p0,e[137]=s,e[138]=p0,e[139]=On):On=e[139],an="flex min-h-0 flex-1 flex-col overflow-y-auto";const K9=s==="page"&&"mx-auto w-full max-w-[1040px]";e[140]!==K9?(Js=ie("flex flex-col sm:flex-row",K9),e[140]=K9,e[141]=Js):Js=e[141],Ls="flex min-w-0 flex-col gap-2 p-6 sm:flex-1 sm:p-8 sm:pt-6",As=Qq,$n=Z,_t=g0=>{Ot||(Re({title:g0.target.value},!0),g0.target.style.height="auto",g0.target.style.height=`${g0.target.scrollHeight}px`)},Fs=Jq,fn=ut,e[142]!==b?(ln=b("taskBoard.taskDialog.taskTitlePlaceholder"),e[142]=b,e[143]=ln):ln=e[143],mn=!0,Ce=1,st=Ot,Dt=ie("w-full resize-none overflow-hidden border-0 bg-transparent text-2xl font-semibold leading-snug text-foreground outline-none placeholder:text-foreground/30",Ot&&"cursor-default"),e[55]=s,e[56]=Ue,e[57]=w,e[58]=T,e[59]=j,e[60]=J,e[61]=ut,e[62]=k,e[63]=C,e[64]=g,e[65]=o,e[66]=je,e[67]=N,e[68]=u,e[69]=m,e[70]=d,e[71]=c,e[72]=f,e[73]=p,e[74]=v,e[75]=Re,e[76]=me,e[77]=Ae,e[78]=H,e[79]=b,e[80]=Z,e[81]=Ot,e[82]=As,e[83]=$n,e[84]=_t,e[85]=Fs,e[86]=fn,e[87]=ln,e[88]=mn,e[89]=Ce,e[90]=st,e[91]=Dt,e[92]=Ls,e[93]=Js,e[94]=an,e[95]=On}else Ot=e[81],As=e[82],$n=e[83],_t=e[84],Fs=e[85],fn=e[86],ln=e[87],mn=e[88],Ce=e[89],st=e[90],Dt=e[91],Ls=e[92],Js=e[93],an=e[94],On=e[95];let cs;e[144]!==As||e[145]!==$n||e[146]!==_t||e[147]!==Fs||e[148]!==fn||e[149]!==ln||e[150]!==mn||e[151]!==Ce||e[152]!==st||e[153]!==Dt?(cs=r.jsx("textarea",{ref:As,value:$n,onChange:_t,onKeyDown:Fs,onBlur:fn,placeholder:ln,autoFocus:mn,rows:Ce,readOnly:st,className:Dt}),e[144]=As,e[145]=$n,e[146]=_t,e[147]=Fs,e[148]=fn,e[149]=ln,e[150]=mn,e[151]=Ce,e[152]=st,e[153]=Dt,e[154]=cs):cs=e[154];let fr;e[155]!==Ot||e[156]!==b?(fr=Ot&&r.jsxs("p",{className:"mb-3 mt-1 flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Vu,{size:12}),b("taskBoard.taskDialog.reportsContentLocked")]}),e[155]=Ot,e[156]=b,e[157]=fr):fr=e[157];let Wr;e[158]!==cs||e[159]!==fr?(Wr=r.jsxs("div",{children:[cs,fr]}),e[158]=cs,e[159]=fr,e[160]=Wr):Wr=e[160];const Ql=we&&"overflow-hidden";let mr;e[161]!==Ql?(mr=ie("relative",Ql),e[161]=Ql,e[162]=mr):mr=e[162];let qr;e[163]!==we?(qr=we?{maxHeight:b5}:void 0,e[163]=we,e[164]=qr):qr=e[164];let Bn;e[165]===Symbol.for("react.memo_cache_sentinel")?(Bn=()=>X(!0),e[165]=Bn):Bn=e[165];let pr;e[166]!==Re?(pr=Ie=>Re({description:Ie},!0),e[166]=Re,e[167]=pr):pr=e[167];let Gr;e[168]!==b?(Gr=b("taskBoard.taskDialog.descriptionPlaceholder"),e[168]=b,e[169]=Gr):Gr=e[169];const Xo=!Ot;let Yr;e[170]!==J||e[171]!==pr||e[172]!==Gr||e[173]!==Xo?(Yr=r.jsx("div",{ref:Pe,"data-testid":"task-description",children:r.jsx(fq,{defaultValue:J,onChange:pr,placeholder:Gr,editable:Xo})}),e[170]=J,e[171]=pr,e[172]=Gr,e[173]=Xo,e[174]=Yr):Yr=e[174];let Xn;e[175]!==we?(Xn=we&&r.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-background to-transparent"}),e[175]=we,e[176]=Xn):Xn=e[176];let gr;e[177]!==ut||e[178]!==mr||e[179]!==qr||e[180]!==Yr||e[181]!==Xn?(gr=r.jsxs("div",{className:mr,style:qr,onFocusCapture:Bn,onBlurCapture:ut,children:[Yr,Xn]}),e[177]=ut,e[178]=mr,e[179]=qr,e[180]=Yr,e[181]=Xn,e[182]=gr):gr=e[182];let Jr;e[183]!==de||e[184]!==pe||e[185]!==b?(Jr=pe&&r.jsxs(he,{type:"button",variant:"ghost",size:"sm",className:"mt-2 w-fit text-muted-foreground hover:text-foreground",onClick:()=>X(Yq),children:[r.jsx(_s,{size:14,className:ie("transition-transform",de&&"rotate-180")}),b(de?"taskBoard.taskDialog.showLess":"taskBoard.taskDialog.showMore")]}),e[183]=de,e[184]=pe,e[185]=b,e[186]=Jr):Jr=e[186];let Qr;e[187]!==gr||e[188]!==Jr?(Qr=r.jsxs("div",{className:"flex flex-col py-6",children:[gr,Jr]}),e[187]=gr,e[188]=Jr,e[189]=Qr):Qr=e[189];let Xr;e[190]!==o?(Xr=o&&r.jsx("div",{className:"py-4",children:r.jsx("hr",{className:"border-border"})}),e[190]=o,e[191]=Xr):Xr=e[191];let Zo;e[192]!==At||e[193]!==mt||e[194]!==J||e[195]!==o||e[196]!==y||e[197]!==h||e[198]!==Ye?(Zo=o&&r.jsxs("div",{className:"flex flex-col gap-8",children:[r.jsx(cG,{item:o,description:J,onOpenPreview:h}),r.jsx(hG,{item:o,members:y,startedBy:At??mt,onOpenThread:Ie=>Ye(Ie.threadId)})]}),e[192]=At,e[193]=mt,e[194]=J,e[195]=o,e[196]=y,e[197]=h,e[198]=Ye,e[199]=Zo):Zo=e[199];let Zr;e[200]!==Qr||e[201]!==Xr||e[202]!==Zo?(Zr=r.jsxs("div",{className:"flex flex-col",children:[Qr,Xr,Zo]}),e[200]=Qr,e[201]=Xr,e[202]=Zo,e[203]=Zr):Zr=e[203];let eo;e[204]!==Ls||e[205]!==Wr||e[206]!==Zr?(eo=r.jsxs("div",{className:Ls,children:[Wr,Zr]}),e[204]=Ls,e[205]=Wr,e[206]=Zr,e[207]=eo):eo=e[207];const D9="flex w-full shrink-0 flex-col gap-8 border-t border-border p-6 sm:sticky sm:top-0 sm:max-h-dvh sm:w-[300px] sm:self-start sm:overflow-y-auto sm:border-t-0";let Ii;e[208]!==o?(Ii=o&&r.jsx(qq,{item:o}),e[208]=o,e[209]=Ii):Ii=e[209];const el=ch;let to;e[210]!==b?(to=b("taskBoard.taskDialog.propertiesLabel"),e[210]=b,e[211]=to):to=e[211];let so;e[212]!==o||e[213]!==H?(so=ie(o?Z6({...o,status:H}):ii[H].iconClassName),e[212]=o,e[213]=H,e[214]=so):so=e[214];let no;e[215]!==hn||e[216]!==so?(no=r.jsx(hn,{size:16,className:so}),e[215]=hn,e[216]=so,e[217]=no):no=e[217];const Mi=ii[H];let xr;e[218]!==b||e[219]!==Mi.labelKey?(xr=b(Mi.labelKey),e[218]=b,e[219]=Mi.labelKey,e[220]=xr):xr=e[220];let br;e[221]!==no||e[222]!==xr?(br=r.jsx(Zt,{asChild:!0,children:r.jsxs("button",{type:"button",className:Ui,children:[no,xr]})}),e[221]=no,e[222]=xr,e[223]=br):br=e[223];let $i;if(e[224]!==S||e[225]!==Re||e[226]!==b){let Ie;e[228]!==Re||e[229]!==b?(Ie=St=>{const Ft=ii[St].icon;return r.jsxs(Xe,{onSelect:()=>Re({status:St}),className:"gap-2",children:[r.jsx(Ft,{size:16,className:ii[St].iconClassName}),b(ii[St].labelKey)]},St)},e[228]=Re,e[229]=b,e[230]=Ie):Ie=e[230],$i=e8(S).map(Ie),e[224]=S,e[225]=Re,e[226]=b,e[227]=$i}else $i=e[227];let vr;e[231]!==$i?(vr=r.jsx(es,{align:"start",className:"w-44",children:$i}),e[231]=$i,e[232]=vr):vr=e[232];let io;e[233]!==br||e[234]!==vr?(io=r.jsxs(Xt,{children:[br,vr]}),e[233]=br,e[234]=vr,e[235]=io):io=e[235];let Oi;e[236]!==Ot||e[237]!==b?(Oi=Ot?b("taskBoard.taskDialog.reportsContentLocked"):void 0,e[236]=Ot,e[237]=b,e[238]=Oi):Oi=e[238];const cd=Ot&&"cursor-default opacity-60";let fi;e[239]!==cd?(fi=ie(Ui,cd),e[239]=cd,e[240]=fi):fi=e[240];const ro=xo[le].icon;let tl;e[241]!==ro?(tl=r.jsx(ro,{size:16}),e[241]=ro,e[242]=tl):tl=e[242];const dd=tl,Xl=xo[le];let oo;e[243]!==b||e[244]!==Xl.labelKey?(oo=b(Xl.labelKey),e[243]=b,e[244]=Xl.labelKey,e[245]=oo):oo=e[245];let xe;e[246]!==Ot||e[247]!==Oi||e[248]!==fi||e[249]!==dd||e[250]!==oo?(xe=r.jsx(Zt,{asChild:!0,children:r.jsxs("button",{type:"button",disabled:Ot,title:Oi,className:fi,children:[dd,oo]})}),e[246]=Ot,e[247]=Oi,e[248]=fi,e[249]=dd,e[250]=oo,e[251]=xe):xe=e[251];let De;e[252]!==Re||e[253]!==b?(De=t8.map(Ie=>{const St=xo[Ie].icon;return r.jsxs(Xe,{onSelect:()=>Re({type:Ie}),children:[r.jsx(St,{size:16}),b(xo[Ie].labelKey)]},Ie)}),e[252]=Re,e[253]=b,e[254]=De):De=e[254];let vt;e[255]!==De?(vt=r.jsx(es,{align:"start",className:"w-44",children:De}),e[255]=De,e[256]=vt):vt=e[256];let Vt;e[257]!==xe||e[258]!==vt?(Vt=r.jsxs(Xt,{children:[xe,vt]}),e[257]=xe,e[258]=vt,e[259]=Vt):Vt=e[259];let ws;e[260]!==Ot||e[261]!==b?(ws=Ot?b("taskBoard.taskDialog.reportsContentLocked"):void 0,e[260]=Ot,e[261]=b,e[262]=ws):ws=e[262];const zn=se==="none"&&xd,vn=Ot&&"cursor-default opacity-60";let Zl;e[263]!==zn||e[264]!==vn?(Zl=ie(Ui,zn,vn),e[263]=zn,e[264]=vn,e[265]=Zl):Zl=e[265];let ea;e[266]!==se||e[267]!==b?(ea=se==="none"?r.jsxs(r.Fragment,{children:[r.jsx(Gn,{size:16}),b("taskBoard.taskDialog.setPriorityButton")]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:ie("size-2 rounded-full",Wn[se].dotClassName)}),b(Wn[se].labelKey)]}),e[266]=se,e[267]=b,e[268]=ea):ea=e[268];let ta;e[269]!==Ot||e[270]!==ws||e[271]!==Zl||e[272]!==ea?(ta=r.jsx(Zt,{asChild:!0,children:r.jsx("button",{type:"button",disabled:Ot,title:ws,className:Zl,children:ea})}),e[269]=Ot,e[270]=ws,e[271]=Zl,e[272]=ea,e[273]=ta):ta=e[273];let sa;e[274]!==Re||e[275]!==b?(sa=Ff.map(Ie=>r.jsxs(Xe,{onSelect:()=>Re({priority:Ie}),children:[r.jsx("span",{className:ie("size-2 rounded-full",Wn[Ie].dotClassName)}),b(Wn[Ie].labelKey)]},Ie)),e[274]=Re,e[275]=b,e[276]=sa):sa=e[276];let na;e[277]!==sa?(na=r.jsx(es,{align:"start",className:"w-40",children:sa}),e[277]=sa,e[278]=na):na=e[278];let ia;e[279]!==ta||e[280]!==na?(ia=r.jsxs(Xt,{children:[ta,na]}),e[279]=ta,e[280]=na,e[281]=ia):ia=e[281];const R9=!Q&&xd;let ra;e[282]!==R9?(ra=ie(Ui,R9),e[282]=R9,e[283]=ra):ra=e[283];let oa;e[284]!==At||e[285]!==mt||e[286]!==yt||e[287]!==b?(oa=yt&&At?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"hidden items-center gap-2 sm:flex",children:[r.jsx(Bs,{url:At.user?.image??void 0,fallback:En(At.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:At.user?.name??b("taskBoard.taskDialog.superAgentDefaultName")})]}),r.jsxs("span",{className:"flex items-center gap-2 sm:hidden",children:[r.jsxs("span",{className:"inline-flex items-center",children:[r.jsx(Bs,{url:At.user?.image??void 0,fallback:En(At.user?.name),shape:"circle",size:"2xs",className:"-mr-1.5 ring-2 ring-background"}),r.jsx(sr,{size:16,className:"ring-2 ring-background"})]}),b("taskBoard.taskDialog.superAgentLabel")]})]}):yt?r.jsxs(r.Fragment,{children:[r.jsx(sr,{size:16}),b("taskBoard.taskDialog.superAgentLabel")]}):mt?r.jsxs(r.Fragment,{children:[r.jsx(Bs,{url:mt.user?.image??void 0,fallback:En(mt.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:mt.user?.name??b("taskBoard.taskDialog.unassignedLabel")})]}):r.jsxs(r.Fragment,{children:[r.jsx(f6,{size:16,className:"text-muted-foreground"}),b("taskBoard.taskDialog.assignButton")]}),e[284]=At,e[285]=mt,e[286]=yt,e[287]=b,e[288]=oa):oa=e[288];let la;e[289]!==ra||e[290]!==oa?(la=r.jsx(ms,{asChild:!0,children:r.jsx("button",{type:"button",className:ra,children:oa})}),e[289]=ra,e[290]=oa,e[291]=la):la=e[291];let aa;e[292]!==o?.assigneeId||e[293]!==p||e[294]!==Re?(aa=Ie=>{if(ke(!1),Ie===ks&&o?.assigneeId===ks){p?.();return}Re({assigneeId:Ie})},e[292]=o?.assigneeId,e[293]=p,e[294]=Re,e[295]=aa):aa=e[295];let ca;e[296]!==y||e[297]!==aa?(ca=r.jsx(bs,{align:"start",className:"w-56 p-0",children:r.jsx(r3,{members:y,onSelect:aa})}),e[296]=y,e[297]=aa,e[298]=ca):ca=e[298];let da;e[299]!==ve||e[300]!==ca||e[301]!==la?(da=r.jsxs(vs,{open:ve,onOpenChange:ke,modal:!0,children:[la,ca]}),e[299]=ve,e[300]=ca,e[301]=la,e[302]=da):da=e[302];let ua;e[303]!==At||e[304]!==yt||e[305]!==b?(ua=yt&&At&&r.jsxs("div",{className:"relative mt-1.5 hidden items-center pl-5 sm:flex",children:[r.jsx("span",{className:"absolute -top-1.5 left-5 h-[calc(50%+0.375rem)] w-2.5 rounded-bl-md border-b border-l border-border"}),r.jsxs("span",{className:ie(Ui,"pointer-events-none"),children:[r.jsx(sr,{size:16}),b("taskBoard.taskDialog.superAgentLabel")]})]}),e[303]=At,e[304]=yt,e[305]=b,e[306]=ua):ua=e[306];let ha;e[307]!==da||e[308]!==ua?(ha=r.jsxs("div",{className:"flex flex-col",children:[da,ua]}),e[307]=da,e[308]=ua,e[309]=ha):ha=e[309];const I9=!te&&xd;let fa;e[310]!==I9?(fa=ie(Ui,I9),e[310]=I9,e[311]=fa):fa=e[311];let c0;e[312]===Symbol.for("react.memo_cache_sentinel")?(c0=r.jsx(Bl,{size:16,className:"text-muted-foreground"}),e[312]=c0):c0=e[312];let ma;e[313]!==te||e[314]!==b?(ma=te?sw.format(te):b("taskBoard.taskDialog.dueDateLabel"),e[313]=te,e[314]=b,e[315]=ma):ma=e[315];let pa;e[316]!==fa||e[317]!==ma?(pa=r.jsx(ms,{asChild:!0,children:r.jsxs("button",{type:"button",className:fa,children:[c0,ma]})}),e[316]=fa,e[317]=ma,e[318]=pa):pa=e[318];const M9=te??void 0;let ga;e[319]!==Re?(ga=Ie=>{Re({dueDate:Ie??null}),Ie&&Te(!1)},e[319]=Re,e[320]=ga):ga=e[320];let xa;e[321]!==M9||e[322]!==ga?(xa=r.jsx(bs,{className:"w-auto p-0",align:"start",children:r.jsx(jf,{mode:"single",selected:M9,onSelect:ga,initialFocus:!0})}),e[321]=M9,e[322]=ga,e[323]=xa):xa=e[323];let ba;e[324]!==Se||e[325]!==pa||e[326]!==xa?(ba=r.jsxs(vs,{open:Se,onOpenChange:Te,children:[pa,xa]}),e[324]=Se,e[325]=pa,e[326]=xa,e[327]=ba):ba=e[327];const $9=fe&&r.jsxs("span",{className:ie(Ui,"cursor-default"),children:[r.jsx(G6,{size:16,className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:fe.name}),r.jsx("span",{className:"shrink-0 text-muted-foreground",children:fe.state==="active"?b("taskBoard.taskDialog.sprintCurrent"):VA(fe)})]}),O9=o?.threads;let va;e[328]!==O9?(va=r.jsx(Wq,{threads:O9}),e[328]=O9,e[329]=va):va=e[329];let ya;e[330]!==el||e[331]!==ha||e[332]!==ba||e[333]!==$9||e[334]!==va||e[335]!==to||e[336]!==io||e[337]!==Vt||e[338]!==ia?(ya=r.jsxs(el,{label:to,children:[io,Vt,ia,ha,ba,$9,va]}),e[330]=el,e[331]=ha,e[332]=ba,e[333]=$9,e[334]=va,e[335]=to,e[336]=io,e[337]=Vt,e[338]=ia,e[339]=ya):ya=e[339];let _a;e[340]!==b?(_a=b("taskBoard.taskDialog.labelsLabel"),e[340]=b,e[341]=_a):_a=e[341];let La;e[342]!==E||e[343]!==Re||e[344]!==Ne||e[345]!==b||e[346]!==ae?(La=ae.length===0?r.jsx(ms,{asChild:!0,children:r.jsxs("button",{type:"button",className:ie(Ui,xd),children:[r.jsx($2,{size:16}),b("taskBoard.taskDialog.tagsButton")]})}):r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:px-3",children:[ae.map(Ie=>{const St=E.find(Ft=>Ft.id===Ie);return St?r.jsxs("button",{type:"button",onClick:()=>Ne(!0),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-muted",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ou(St.color)}}),r.jsx("span",{className:"truncate",children:St.name}),r.jsx("span",{role:"button",tabIndex:0,"aria-label":b("taskBoard.taskDialog.removeTagAriaLabel",{name:St.name}),className:"-mr-0.5 flex size-3.5 items-center justify-center rounded-sm text-muted-foreground hover:bg-background hover:text-foreground",onClick:Ft=>{Ft.stopPropagation(),Re({tagIds:ae.filter(Ps=>Ps!==Ie)})},onKeyDown:Ft=>{(Ft.key==="Enter"||Ft.key===" ")&&(Ft.preventDefault(),Ft.stopPropagation(),Re({tagIds:ae.filter(Ps=>Ps!==Ie)}))},children:r.jsx(Is,{size:10})})]},Ie):null}),r.jsx(ms,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":b("taskBoard.taskDialog.addTagButton"),className:"flex size-7 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r.jsx(Ht,{size:14})})})]}),e[342]=E,e[343]=Re,e[344]=Ne,e[345]=b,e[346]=ae,e[347]=La):La=e[347];let wa;e[348]!==E.length?(wa=QA(E.length),e[348]=E.length,e[349]=wa):wa=e[349];let Sa;e[350]!==Re||e[351]!==ae?(Sa=Ie=>Re({tagIds:ae.includes(Ie)?ae.filter(St=>St!==Ie):[...ae,Ie]}),e[350]=Re,e[351]=ae,e[352]=Sa):Sa=e[352];let ka;e[353]!==ct||e[354]!==xt||e[355]!==E||e[356]!==wa||e[357]!==Sa||e[358]!==ae?(ka=r.jsx(bs,{align:"start",className:"w-56 p-0",children:r.jsx(wq,{tags:E,selectedIds:ae,defaultColor:wa,onToggle:Sa,onCreate:ct,onDelete:xt})}),e[353]=ct,e[354]=xt,e[355]=E,e[356]=wa,e[357]=Sa,e[358]=ae,e[359]=ka):ka=e[359];let ja;e[360]!==Ne||e[361]!==La||e[362]!==ka||e[363]!==Le?(ja=r.jsxs(vs,{open:Le,onOpenChange:Ne,modal:!0,children:[La,ka]}),e[360]=Ne,e[361]=La,e[362]=ka,e[363]=Le,e[364]=ja):ja=e[364];let Ca;e[365]!==_a||e[366]!==ja?(Ca=r.jsx(ch,{label:_a,children:ja}),e[365]=_a,e[366]=ja,e[367]=Ca):Ca=e[367];const B9=ch;let Na;e[368]!==b?(Na=b("taskBoard.taskDialog.projectLabel"),e[368]=b,e[369]=Na):Na=e[369];const z9=Xt,F9=!ce&&xd;let Ta;e[370]!==F9?(Ta=ie(Ui,"max-w-full",F9),e[370]=F9,e[371]=Ta):Ta=e[371];let d0;e[372]===Symbol.for("react.memo_cache_sentinel")?(d0=r.jsx(Jn,{className:"size-4 shrink-0"}),e[372]=d0):d0=e[372];let Va;e[373]!==ce||e[374]!==b?(Va=ce??b("taskBoard.taskDialog.repoButton"),e[373]=ce,e[374]=b,e[375]=Va):Va=e[375];let Aa;e[376]!==Va?(Aa=r.jsx("span",{className:"min-w-0 truncate text-left",children:Va}),e[376]=Va,e[377]=Aa):Aa=e[377];let Pa;e[378]!==Ta||e[379]!==Aa?(Pa=r.jsx(Zt,{asChild:!0,children:r.jsxs("button",{type:"button",className:Ta,children:[d0,Aa]})}),e[378]=Ta,e[379]=Aa,e[380]=Pa):Pa=e[380];const U9=es,bC="start",vC="w-56";let Ea;e[381]!==Re?(Ea=()=>Re({repo:null}),e[381]=Re,e[382]=Ea):Ea=e[382];let Da;e[383]!==b?(Da=b("taskBoard.taskDialog.noRepo"),e[383]=b,e[384]=Da):Da=e[384];let Ra;e[385]!==Ea||e[386]!==Da?(Ra=r.jsx(Xe,{onSelect:Ea,children:Da}),e[385]=Ea,e[386]=Da,e[387]=Ra):Ra=e[387];let u0;e[388]!==Re?(u0=Ie=>r.jsxs(Xe,{className:"gap-2",onSelect:()=>Re({repo:Ie}),children:[r.jsx(Jn,{className:"size-4 shrink-0"}),r.jsx("span",{className:"truncate",children:Ie})]},Ie),e[388]=Re,e[389]=u0):u0=e[389];const H9=$.map(u0);let Ia;e[390]!==U9||e[391]!==Ra||e[392]!==H9?(Ia=r.jsxs(U9,{align:bC,className:vC,children:[Ra,H9]}),e[390]=U9,e[391]=Ra,e[392]=H9,e[393]=Ia):Ia=e[393];let Ma;e[394]!==z9||e[395]!==Pa||e[396]!==Ia?(Ma=r.jsxs(z9,{children:[Pa,Ia]}),e[394]=z9,e[395]=Pa,e[396]=Ia,e[397]=Ma):Ma=e[397];let $a;e[398]!==B9||e[399]!==Na||e[400]!==Ma?($a=r.jsx(B9,{label:Na,children:Ma}),e[398]=B9,e[399]=Na,e[400]=Ma,e[401]=$a):$a=e[401];let Oa;e[402]!==ya||e[403]!==Ca||e[404]!==$a||e[405]!==Ii?(Oa=r.jsxs("div",{className:D9,children:[Ii,ya,Ca,$a]}),e[402]=ya,e[403]=Ca,e[404]=$a,e[405]=Ii,e[406]=Oa):Oa=e[406];let Ba;e[407]!==Oa||e[408]!==Js||e[409]!==eo?(Ba=r.jsxs("div",{className:Js,children:[eo,Oa]}),e[407]=Oa,e[408]=Js,e[409]=eo,e[410]=Ba):Ba=e[410];let za;e[411]!==Ba||e[412]!==an?(za=r.jsx("div",{className:an,children:Ba}),e[411]=Ba,e[412]=an,e[413]=za):za=e[413];let Fa;e[414]!==Ye?(Fa=()=>Ye(null),e[414]=Ye,e[415]=Fa):Fa=e[415];let Ua;e[416]!==Me||e[417]!==Fa?(Ua=r.jsx(Nq,{thread:Me,onClose:Fa}),e[416]=Me,e[417]=Fa,e[418]=Ua):Ua=e[418];let Ha;e[419]!==dt||e[420]!==g||e[421]!==o||e[422]!==b||e[423]!==Z?(Ha=!o&&r.jsx("div",{className:"flex h-16 items-center justify-end border-t border-border px-4",children:r.jsxs(he,{size:"sm",disabled:!Z.trim()||g,onClick:dt,children:[r.jsx(Ht,{size:16}),b("taskBoard.taskDialog.createTaskButton")]})}),e[419]=dt,e[420]=g,e[421]=o,e[422]=b,e[423]=Z,e[424]=Ha):Ha=e[424];let h0;e[425]!==za||e[426]!==Ua||e[427]!==Ha||e[428]!==On?(h0=r.jsxs(r.Fragment,{children:[On,za,Ua,Ha]}),e[425]=za,e[426]=Ua,e[427]=Ha,e[428]=On,e[429]=h0):h0=e[429];const Ka=h0;if(s==="page"){let Ie;e[430]!==Tt||e[431]!==wt?(Ie=Ft=>{const Ps=Tt(Ft),lo=wt(Ft);return()=>{Ps?.(),lo?.()}},e[430]=Tt,e[431]=wt,e[432]=Ie):Ie=e[432];let St;return e[433]!==Ka||e[434]!==Ie?(St=r.jsx("div",{ref:Ie,"data-testid":"task-detail",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:Ka}),e[433]=Ka,e[434]=Ie,e[435]=St):St=e[435],St}let Wa;e[436]!==Ue?(Wa=Ie=>!Ie&&Ue(),e[436]=Ue,e[437]=Wa):Wa=e[437];let qa;e[438]!==b?(qa=b("taskBoard.taskDialog.newTaskTitle"),e[438]=b,e[439]=qa):qa=e[439];let Ga;e[440]!==qa?(Ga=r.jsx(Kt,{className:"sr-only",children:qa}),e[440]=qa,e[441]=Ga):Ga=e[441];let Ya;e[442]!==Ka||e[443]!==Ga?(Ya=r.jsxs(Bt,{className:"flex max-h-[92vh] flex-col gap-0 overflow-hidden rounded-2xl p-0 sm:h-[90vh] sm:max-h-[820px] sm:max-w-[1040px]",closeButtonClassName:"hidden",children:[Ga,Ka]}),e[442]=Ka,e[443]=Ga,e[444]=Ya):Ya=e[444];let f0;return e[445]!==x||e[446]!==Wa||e[447]!==Ya?(f0=r.jsx(zt,{open:x,onOpenChange:Wa,children:Ya}),e[445]=x,e[446]=Wa,e[447]=Ya,e[448]=f0):f0=e[448],f0}function Yq(t){return!t}function Jq(t){t.key==="Enter"&&t.preventDefault()}function Qq(t){t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)}function Xq(t){return t.id}function rw(t){const e=z.c(2);let s;return e[0]!==t?(s=r.jsx(iw,{...t,chrome:"dialog"}),e[0]=t,e[1]=s):s=e[1],s}function Zq(t){const e=z.c(2);let s;return e[0]!==t?(s=r.jsx(iw,{...t,chrome:"page"}),e[0]=t,e[1]=s):s=e[1],s}function eG(t,e){switch(t.status){case"failed":return AA(t.failureKind)?{label:t.failureKind==="superseded"?e("taskBoard.taskDialog.threadStatusSuperseded"):e("taskBoard.taskDialog.threadStatusEndedAfterDelivery"),className:"text-muted-foreground",icon:bn}:{label:e("taskBoard.taskDialog.threadStatusError"),className:"text-destructive",icon:JT};case"requires_action":return{label:e("taskBoard.taskDialog.threadStatusNeedsInput"),className:"text-warning",icon:Eu};case"in_progress":return{label:e("taskBoard.taskDialog.threadStatusRunning"),className:"text-primary",icon:Af,spin:!0};case"completed":return{label:e("taskBoard.taskDialog.threadStatusCompleted"),className:"text-success",icon:hi};case"expired":return{label:e("taskBoard.taskDialog.threadStatusExpired"),className:"text-muted-foreground",icon:bn};default:return t.status}}function tG(t){const e=z.c(28),{thread:s,startedBy:n,onOpen:i}=t,o=re();let l;if(e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==s){const a=s.status?eG({...s,status:s.status},o):null,c=s.lastMessage;let d;e[5]!==s.title?(d=XA(s.title,"reviewer"),e[5]=s.title,e[6]=d):d=e[6];const u=d;let h;e[7]!==i||e[8]!==s?(h=()=>i?.(s),e[7]=i,e[8]=s,e[9]=h):h=e[9];let f;e[10]!==u?(f=u?r.jsx(Wg,{size:16,className:"shrink-0"}):r.jsx(sr,{size:16,className:"shrink-0"}),e[10]=u,e[11]=f):f=e[11];let m;e[12]!==o||e[13]!==s.title?(m=s.title||o("taskBoard.taskDialog.superAgentDefaultName"),e[12]=o,e[13]=s.title,e[14]=m):m=e[14];let p;e[15]!==m?(p=r.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==n||e[18]!==o?(g=n&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"shrink-0 text-sm text-muted-foreground/50",children:o("taskBoard.taskDialog.startedByLabel")}),r.jsx(Bs,{url:n.user?.image??void 0,fallback:En(n.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate text-sm text-foreground",children:n.user?.name??o("taskBoard.taskDialog.someoneLabel")})]}),e[17]=n,e[18]=o,e[19]=g):g=e[19];let x;e[20]!==i||e[21]!==o?(x=i&&r.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1 text-xs text-muted-foreground/60 group-hover:text-foreground",children:[o("taskBoard.taskDialog.openThreadHint"),r.jsx(nn,{size:14})]}),e[20]=i,e[21]=o,e[22]=x):x=e[22];let b;e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x?(b=r.jsxs("div",{className:"flex items-center gap-2",children:[f,p,g,x]}),e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=b):b=e[27],l=r.jsxs("button",{type:"button",disabled:!i,onClick:h,className:"group flex w-full flex-col gap-2 rounded-xl bg-card p-4 text-left card-shadow transition-colors enabled:hover:bg-muted/60 disabled:cursor-default",children:[b,a&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:ie("flex shrink-0 items-center gap-1.5",a.className),children:[r.jsx(a.icon,{size:15,className:ie(a.spin&&"animate-spin")}),r.jsx("span",{className:"text-sm",children:a.label})]}),c&&r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:c})]})]}),e[0]=i,e[1]=n,e[2]=o,e[3]=s,e[4]=l}else l=e[4];return l}function sG(t,e){return t.merged?{label:e("taskBoard.taskDialog.prStateMerged"),className:"text-special",icon:O2}:t.state==="closed"?{label:e("taskBoard.taskDialog.prStateClosed"),className:"text-destructive",icon:yo}:t.draft?{label:e("taskBoard.taskDialog.prStateDraft"),className:"text-muted-foreground",icon:yo}:{label:e("taskBoard.taskDialog.prStateOpen"),className:"text-success",icon:yo}}function nG(t,e){switch(t){case"passing":return{label:e("taskBoard.taskDialog.prChecksPassing"),className:"text-success",icon:hi};case"failing":return{label:e("taskBoard.taskDialog.prChecksFailing"),className:"text-destructive",icon:bn};case"pending":return{label:e("taskBoard.taskDialog.prChecksPending"),className:"text-warning",icon:Af};default:return null}}const iG=new Set(["failure","cancelled","timed_out","action_required","startup_failure","stale"]);function rG(t){if(t.status!=="completed")return{icon:Af,className:"text-warning",spin:!0};const e=t.conclusion;return e&&iG.has(e)?{icon:bn,className:"text-destructive",spin:!1}:e==="success"||e==="neutral"||e==="skipped"?{icon:hi,className:"text-success",spin:!1}:{icon:Eu,className:"text-muted-foreground",spin:!1}}function oG(t){const e=z.c(49),{pr:s,previewThread:n,reviewsReady:i,shipPending:o,resolvePending:l,onShip:a,onResolveConflict:c,onOpenPreview:d}=t,u=re(),[h,f]=P.useState(!1);let m;if(e[0]!==h||e[1]!==d||e[2]!==c||e[3]!==a||e[4]!==s||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==o||e[9]!==u){const p=sG(s,u),g=nG(s.checksStatus,u);let x;e[11]!==s||e[12]!==i?(x=gq(s,i),e[11]=s,e[12]=i,e[13]=x):x=e[13];const{isOpen:b,hasConflict:v,showShip:L,showResolveConflict:_}=x,y=!!n||!!s.previewUrl||L||_;let S;e[14]!==s.checks?(S=s.checks??[],e[14]=s.checks,e[15]=S):S=e[15];const k=S,w=k.length>0||g!=null,j=k.length>0;let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(Jn,{className:"size-4 shrink-0 text-foreground"}),e[16]=N):N=e[16];const T=s.title??`${s.repoOwner}/${s.repoName}`;let C;e[17]!==T?(C=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:T}),e[17]=T,e[18]=C):C=e[18];const V=ie("flex shrink-0 items-center gap-1 text-xs font-medium",p.className);let A;e[19]!==p?(A=r.jsx(p.icon,{size:13}),e[19]=p,e[20]=A):A=e[20];let E;e[21]!==p||e[22]!==V||e[23]!==A?(E=r.jsxs("span",{className:V,children:[A,p.label]}),e[21]=p,e[22]=V,e[23]=A,e[24]=E):E=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(xn,{size:12,className:"text-muted-foreground/60 group-hover:text-foreground"}),e[25]=D):D=e[25];let I;e[26]!==s.number||e[27]!==s.url?(I=r.jsxs("a",{href:s.url,target:"_blank",rel:"noreferrer",title:s.url,className:"group flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted",children:["#",s.number,D]}),e[26]=s.number,e[27]=s.url,e[28]=I):I=e[28];let R;e[29]!==I||e[30]!==C||e[31]!==E?(R=r.jsxs("div",{className:"flex items-center gap-3",children:[N,C,E,I]}),e[29]=I,e[30]=C,e[31]=E,e[32]=R):R=e[32];let $;e[33]!==v||e[34]!==b||e[35]!==u?($=v&&b&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-warning",children:[r.jsx(bn,{size:13,className:"shrink-0"}),u("taskBoard.taskDialog.prConflict")]}),e[33]=v,e[34]=b,e[35]=u,e[36]=$):$=e[36];let B;e[37]!==y||e[38]!==d||e[39]!==c||e[40]!==a||e[41]!==s.previewUrl||e[42]!==n||e[43]!==l||e[44]!==o||e[45]!==_||e[46]!==L||e[47]!==u?(B=y&&r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&r.jsxs(he,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",title:u("taskBoard.taskDialog.openPreviewTitle"),onClick:()=>d?.(n),children:[r.jsx(Nf,{size:13}),u("taskBoard.taskDialog.openPreviewButton")]}),s.previewUrl&&r.jsx(he,{asChild:!0,type:"button",variant:"outline",size:"sm",className:"gap-1.5",children:r.jsxs("a",{href:s.previewUrl,target:"_blank",rel:"noreferrer",children:[r.jsx(Mn,{size:14}),u("taskBoard.taskDialog.previewLabel"),r.jsx(xn,{size:12})]})}),L&&r.jsx(he,{type:"button",variant:"success",size:"sm",disabled:o,onClick:a,children:u("taskBoard.taskDialog.shipToProductionButton")}),_&&r.jsxs(he,{type:"button",variant:"warning",size:"sm",className:"gap-1.5",disabled:l,title:u("taskBoard.taskDialog.resolveConflictTitle"),onClick:c,children:[r.jsx(O2,{size:13}),u("taskBoard.taskDialog.resolveConflictButton")]})]}),e[37]=y,e[38]=d,e[39]=c,e[40]=a,e[41]=s.previewUrl,e[42]=n,e[43]=l,e[44]=o,e[45]=_,e[46]=L,e[47]=u,e[48]=B):B=e[48],m=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-3 card-shadow",children:[R,$,B,w&&r.jsxs("div",{className:"border-t border-border pt-2 text-xs",children:[r.jsxs("button",{type:"button",disabled:!j,onClick:()=>f(lG),className:"flex w-full items-center gap-1.5 font-medium disabled:cursor-default",children:[g?r.jsx(g.icon,{size:13,className:g.className}):r.jsx(hi,{size:13,className:"text-muted-foreground"}),r.jsx("span",{className:ie(g?.className??"text-muted-foreground"),children:g?.label??u("taskBoard.taskDialog.prChecksLabel")}),j&&r.jsx(nn,{size:14,className:ie("ml-auto text-muted-foreground/60 transition-transform",h&&"rotate-90")})]}),h&&r.jsx("div",{className:"mt-2 flex flex-col gap-2",children:k.map(M=>{const O=rG(M);return r.jsxs("div",{className:"rounded-md bg-muted/40 p-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(O.icon,{size:13,className:ie("shrink-0",O.className,O.spin&&"animate-spin")}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:M.name}),M.detailsUrl&&r.jsx("a",{href:M.detailsUrl,target:"_blank",rel:"noreferrer",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:r.jsx(xn,{size:12})})]}),M.summary&&r.jsx("div",{className:"mt-1.5 max-h-64 overflow-auto text-muted-foreground",children:r.jsx(Fo,{id:`${s.url}-${M.name}`,text:M.summary})})]},M.name)})})]})]}),e[0]=h,e[1]=d,e[2]=c,e[3]=a,e[4]=s,e[5]=n,e[6]=l,e[7]=i,e[8]=o,e[9]=u,e[10]=m}else m=e[10];return m}function lG(t){return!t}function aG(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(bt,{className:"size-4 shrink-0 rounded"}),r.jsx(bt,{className:"h-4 min-w-0 flex-1"}),r.jsx(bt,{className:"h-4 w-16 shrink-0"}),r.jsx(bt,{className:"h-4 w-10 shrink-0"})]}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-3 card-shadow",children:[e,r.jsxs("div",{className:"flex gap-2",children:[r.jsx(bt,{className:"h-7 w-20"}),r.jsx(bt,{className:"h-7 w-28"})]})]}),t[1]=s):s=t[1],s}function cG(t){const e=z.c(50),{item:s,description:n,onOpenPreview:i}=t,o=re(),{data:l,isLoading:a}=JL(s.id),{data:c}=QL(s.id),d=S6(),u=bq(s.id),h=vq(s.id);let f,m,p,g,x,b;if(e[0]!==c||e[1]!==n||e[2]!==s.status||e[3]!==s.threads||e[4]!==i||e[5]!==u||e[6]!==l||e[7]!==a||e[8]!==h||e[9]!==d||e[10]!==o){b=Symbol.for("react.early_return_sentinel");e:{const _=Sq(n),y=a&&!l;if(!y&&(!l||l.length===0)&&_.length===0){b=null;break e}let S;e[17]!==c||e[18]!==s.status||e[19]!==d?(S=Lq(s.status)&&yq(c??[],XL(d)),e[17]=c,e[18]=s.status,e[19]=d,e[20]=S):S=e[20];const k=S;let w;e[21]!==u||e[22]!==o?(w=()=>u.mutate(void 0,{onSuccess:A=>A?.merged?ge.success(o("taskBoard.taskDialog.shipSuccess")):ge.error(o("taskBoard.taskDialog.shipError")),onError:()=>ge.error(o("taskBoard.taskDialog.shipError"))}),e[21]=u,e[22]=o,e[23]=w):w=e[23];const j=w;let N;e[24]!==h||e[25]!==o?(N=A=>h.mutate(A,{onSuccess:()=>ge.success(o("taskBoard.taskDialog.resolveConflictSuccess")),onError:()=>ge.error(o("taskBoard.taskDialog.resolveConflictError"))}),e[24]=h,e[25]=o,e[26]=N):N=e[26];const T=N;let C;e[27]!==s.threads||e[28]!==i?(C=i?s.threads.find(uG):void 0,e[27]=s.threads,e[28]=i,e[29]=C):C=e[29];const V=C;f=nw,e[30]!==o?(x=o("taskBoard.taskDialog.linksLabel"),e[30]=o,e[31]=x):x=e[31],m="flex flex-col gap-1",e[32]!==y||e[33]!==i||e[34]!==T||e[35]!==j||e[36]!==V||e[37]!==u||e[38]!==l||e[39]!==h||e[40]!==k?(p=y?r.jsx(aG,{}):(l??[]).map(A=>r.jsx(oG,{pr:A,previewThread:V,reviewsReady:k,shipPending:u.isPending,resolvePending:h.isPending,onShip:j,onResolveConflict:()=>T(A.number),onOpenPreview:i},A.url)),e[32]=y,e[33]=i,e[34]=T,e[35]=j,e[36]=V,e[37]=u,e[38]=l,e[39]=h,e[40]=k,e[41]=p):p=e[41],g=_.map(dG)}e[0]=c,e[1]=n,e[2]=s.status,e[3]=s.threads,e[4]=i,e[5]=u,e[6]=l,e[7]=a,e[8]=h,e[9]=d,e[10]=o,e[11]=f,e[12]=m,e[13]=p,e[14]=g,e[15]=x,e[16]=b}else f=e[11],m=e[12],p=e[13],g=e[14],x=e[15],b=e[16];if(b!==Symbol.for("react.early_return_sentinel"))return b;let v;e[42]!==m||e[43]!==p||e[44]!==g?(v=r.jsxs("div",{className:m,children:[p,g]}),e[42]=m,e[43]=p,e[44]=g,e[45]=v):v=e[45];let L;return e[46]!==f||e[47]!==x||e[48]!==v?(L=r.jsx(f,{label:x,children:v}),e[46]=f,e[47]=x,e[48]=v,e[49]=L):L=e[49],L}function dG(t){return r.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"group flex items-center gap-2 rounded-md px-1 py-1.5 transition-colors hover:bg-muted",children:[r.jsx(Mn,{size:15,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:t.label}),r.jsx(xn,{size:13,className:"shrink-0 text-muted-foreground/50 group-hover:text-foreground"})]},t.url)}function uG(t){return t.hasPreview&&t.virtualMcpId}function hG(t){const e=z.c(7),{item:s,members:n,startedBy:i,onOpenThread:o}=t,l=re(),{data:a}=QL(s.id),{data:c}=In.useSession(),d=new Map(n.map(xG)),u={id:c?.user?.id??"me",name:c?.user?.name??l("taskBoard.taskDialog.commentYouLabel"),image:c?.user?.image},h=$q(s.id),f=L=>{if(L===ks)return{id:L,name:l("taskBoard.taskDialog.superAgentLabel"),isAgent:!0};if(L===u.id)return u;const _=d.get(L);return{id:L,name:_?.user?.name??L,image:_?.user?.image}},m=h.threads.map(L=>({id:L.id,author:f(L.authorId),body:L.body,createdAt:L.createdAt,resolved:L.resolved,replies:L.replies.map(_=>({id:_.id,author:f(_.authorId),body:_.body,createdAt:_.createdAt,replies:[]}))})),p=[...(a??[]).map(gG),...s.threads.map(pG),...m.map(mG)].sort(fG),g=[];for(const L of p){if(L.kind==="thread"){g.push({type:"thread",thread:L.thread});continue}if(L.kind==="comment"){g.push({type:"comment",comment:L.comment});continue}const _=g[g.length-1];_?.type==="timeline"?_.items.push(L.activity):g.push({type:"timeline",items:[L.activity]})}let x;e[0]!==l?(x=l("taskBoard.taskDialog.activityLabel"),e[0]=l,e[1]=x):x=e[1];let b;e[2]!==s.id||e[3]!==n?(b=r.jsx(zq,{itemId:s.id,members:n}),e[2]=s.id,e[3]=n,e[4]=b):b=e[4];let v;return e[5]!==h.post?(v=L=>h.post.mutate({body:L}),e[5]=h.post,e[6]=v):v=e[6],r.jsx(nw,{label:x,action:b,children:r.jsxs("div",{className:"flex flex-col gap-5",children:[r.jsx(Rq,{me:u,onSubmit:v}),g.map((L,_)=>L.type==="timeline"?r.jsx(vG,{items:L.items,memberByUserId:d},`timeline-${_}`):L.type==="comment"?r.jsx(Pq,{thread:L.comment,me:u,onReply:y=>h.post.mutate({body:y,parentId:L.comment.id}),onDelete:y=>h.remove.mutate(y),onToggleResolved:()=>h.setResolved.mutate({id:L.comment.id,resolved:!L.comment.resolved})},`comment-${L.comment.id}`):r.jsx(tG,{thread:L.thread,startedBy:i,onOpen:o},`thread-${L.thread.threadId}`))]})})}function fG(t,e){return e.at-t.at}function mG(t){return{kind:"comment",at:new Date(t.createdAt).getTime(),comment:t}}function pG(t){return{kind:"thread",at:new Date(t.createdAt).getTime(),thread:t}}function gG(t){return{kind:"activity",at:new Date(t.occurredAt).getTime(),activity:t}}function xG(t){return[t.userId,t]}function il(t){const e=z.c(7),{icon:s,label:n}=t;let i;e[0]!==s?(i=r.jsx("span",{className:"ml-1 mr-1 inline-flex h-[1lh] items-center align-top",children:s}),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==n?(o=r.jsx("span",{className:"mr-1",children:n}),e[2]=n,e[3]=o):o=e[3];let l;return e[4]!==i||e[5]!==o?(l=r.jsxs(r.Fragment,{children:[i,o]}),e[4]=i,e[5]=o,e[6]=l):l=e[6],l}const Uh="\0";function I0(t){return`${Uh}${t}${Uh}`}function rl(t,e){return t.split(new RegExp(`${Uh}(\\w+)${Uh}`)).map((s,n)=>r.jsx(P.Fragment,{children:n%2===0?s:e[s]},n))}function bd(t,e){return e(t==="qa"?"taskBoard.taskDialog.qaAgentLabel":t==="code_review"?"taskBoard.taskDialog.codeReviewerLabel":"taskBoard.taskDialog.reviewerLabel")}function bG(t,e,s){const n=f=>{const m=typeof f=="string"?ii[f]:void 0;if(!m)return String(f??"");const p=m.icon;return r.jsx(il,{icon:r.jsx(p,{size:14,className:m.iconClassName}),label:e(m.labelKey)})},i=f=>{const m=typeof f=="string"?Wn[f]:void 0;return m?r.jsx(il,{icon:r.jsx("span",{className:ie("size-2 rounded-full",m.dotClassName)}),label:e(m.labelKey)}):String(f??"")},o=f=>{const m=tw(typeof f=="string"?f:null);return m?r.jsx(il,{icon:r.jsx(Bl,{size:14,className:"text-muted-foreground"}),label:sw.format(m)}):""},l=f=>!Array.isArray(f)||f.length===0?null:f.map((m,p)=>{const g=m;return r.jsx(il,{icon:r.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:Ou(g.color)}}),label:g.name??""},g.id??p)}),a=f=>{if(f===ks)return r.jsx(il,{icon:r.jsx(sr,{size:14}),label:e("taskBoard.taskDialog.superAgentLabel")});const m=typeof f=="string"?s.get(f):void 0;return r.jsx(il,{icon:r.jsx(Bs,{url:m?.user?.image??void 0,fallback:En(m?.user?.name),shape:"circle",size:"2xs"}),label:m?.user?.name??e("taskBoard.taskDialog.someoneLabel")})},c=f=>r.jsx(il,{icon:r.jsx(Wg,{size:14}),label:bd(f,e)}),d=t.data,u=I0("from"),h=I0("to");switch(t.action){case"created":return e("taskBoard.taskDialog.activityCreated");case"status_changed":return typeof d.retry=="number"?e("taskBoard.taskDialog.activityRetryScheduled",{attempt:String(d.retry),of:String(d.of??d.retry),reason:String(d.reason??"")}):typeof d.retriesSpent=="number"&&d.retriesSpent>0?rl(e("taskBoard.taskDialog.activityRetriesExhausted",{to:h,count:String(d.retriesSpent)}),{to:n(d.to)}):rl(d.from?e("taskBoard.taskDialog.activityMovedFromTo",{from:u,to:h}):e("taskBoard.taskDialog.activityMovedTo",{to:h}),{from:n(d.from),to:n(d.to)});case"assignee_changed":return d.to==null?e("taskBoard.taskDialog.activityUnassigned"):rl(e(d.to===ks?"taskBoard.taskDialog.activityDelegated":"taskBoard.taskDialog.activityAssigned",{name:I0("name")}),{name:a(d.to)});case"type_changed":return d.from?e("taskBoard.taskDialog.activityTypeFromTo",{from:u,to:h}):e("taskBoard.taskDialog.activityTypeSet",{to:h});case"priority_changed":return d.to==="none"?e("taskBoard.taskDialog.activityPriorityCleared"):rl(!d.from||d.from==="none"?e("taskBoard.taskDialog.activityPrioritySet",{to:h}):e("taskBoard.taskDialog.activityPriorityFromTo",{from:u,to:h}),{from:i(d.from),to:i(d.to)});case"due_date_changed":return d.to==null?e("taskBoard.taskDialog.activityDueDateCleared"):rl(d.from==null?e("taskBoard.taskDialog.activityDueDateSet",{to:h}):e("taskBoard.taskDialog.activityDueDateFromTo",{from:u,to:h}),{from:o(d.from),to:o(d.to)});case"title_changed":return e("taskBoard.taskDialog.activityRenamed",{to:String(d.to??"")});case"description_changed":return e("taskBoard.taskDialog.activityDescriptionUpdated");case"tags_changed":return!Array.isArray(d.to)||d.to.length===0?e("taskBoard.taskDialog.activityTagsCleared"):rl(e("taskBoard.taskDialog.activityTagsSet",{to:h}),{to:l(d.to)});case"review_requested":return rl(e("taskBoard.taskDialog.activityDelegated",{name:I0("name")}),{name:c(d.reviewer)});case"review_approved":return typeof d.notes=="string"&&d.notes.trim()?e("taskBoard.taskDialog.activityReviewApprovedWithNotes",{reviewer:bd(d.reviewer,e),notes:d.notes}):e("taskBoard.taskDialog.activityReviewApproved",{reviewer:bd(d.reviewer,e)});case"review_changes_requested":return typeof d.notes=="string"&&d.notes.trim()?e("taskBoard.taskDialog.activityReviewChangesRequestedWithNotes",{reviewer:bd(d.reviewer,e),notes:d.notes}):e("taskBoard.taskDialog.activityReviewChangesRequested",{reviewer:bd(d.reviewer,e)});case"merge_conflict_resolution":return e("taskBoard.taskDialog.activityMergeConflictResolution");case"merge_failed":{const f=typeof d.detail=="string"?d.detail:"";switch(d.reason){case"no_pr":return e("taskBoard.taskDialog.activityMergeFailedNoPr");case"checks_failing":return e("taskBoard.taskDialog.activityMergeFailedChecksFailing");case"no_connection":return f?e("taskBoard.taskDialog.activityMergeFailedNoConnection",{detail:f}):e("taskBoard.taskDialog.activityMergeFailed");case"rate_limited":return e("taskBoard.taskDialog.activityMergeFailedRateLimited");case"refused":return f?e("taskBoard.taskDialog.activityMergeFailedRefused",{detail:f}):e("taskBoard.taskDialog.activityMergeFailed");default:return f?e("taskBoard.taskDialog.activityMergeFailedError",{detail:f}):e("taskBoard.taskDialog.activityMergeFailed")}}default:{const f=t.action;return String(f)}}}function _5(t){return!t||t===ks}function vG(t){const e=z.c(29),{items:s,memberByUserId:n}=t,i=re(),[o,l]=P.useState(!1);let a;e[0]!==n||e[1]!==i?(a=v=>_5(v)?i("taskBoard.taskDialog.superAgentLabel"):n.get(v)?.user?.name??i("taskBoard.taskDialog.someoneLabel"),e[0]=n,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==n?(d=v=>{if(_5(v))return r.jsx("span",{className:"z-10 flex size-4 shrink-0 items-center justify-center bg-background",children:r.jsx(sr,{size:16})});const L=n.get(v);return r.jsx("span",{className:"z-10 shrink-0 rounded-full bg-background",children:r.jsx(Bs,{url:L?.user?.image??void 0,fallback:En(L?.user?.name),shape:"circle",size:"2xs"})})},e[3]=n,e[4]=d):d=e[4];const u=d,h=s.length>v5&&!o;let f;e[5]!==h||e[6]!==s?(f=h?s.slice(0,y5):s,e[5]=h,e[6]=s,e[7]=f):f=e[7];const m=f;let p;e[8]!==m.length?(p=m.length>1&&r.jsx("span",{"aria-hidden":!0,className:"absolute bottom-3 left-2 top-3 w-px bg-border"}),e[8]=m.length,e[9]=p):p=e[9];let g;if(e[10]!==u||e[11]!==c||e[12]!==n||e[13]!==i||e[14]!==m){let v;e[16]!==u||e[17]!==c||e[18]!==n||e[19]!==i?(v=L=>r.jsxs("div",{className:"relative flex items-center gap-2.5",children:[u(L.actorId),r.jsxs("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:[c(L.actorId)," ",bG(L,i,n),r.jsxs("span",{className:"text-muted-foreground/60",children:[" · ",Ol(new Date(L.occurredAt))]})]})]},L.id),e[16]=u,e[17]=c,e[18]=n,e[19]=i,e[20]=v):v=e[20],g=m.map(v),e[10]=u,e[11]=c,e[12]=n,e[13]=i,e[14]=m,e[15]=g}else g=e[15];let x;e[21]!==o||e[22]!==s.length||e[23]!==i?(x=s.length>v5&&r.jsxs("button",{type:"button",onClick:()=>l(yG),className:"relative flex items-center gap-2.5 text-left",children:[r.jsx("span",{className:"z-10 flex size-4 shrink-0 items-center justify-center rounded-full bg-background text-muted-foreground/60",children:r.jsx(Gn,{size:14})}),r.jsx("span",{className:"text-xs text-muted-foreground/60 hover:text-foreground",children:o?i("taskBoard.taskDialog.timelineFoldLess"):i("taskBoard.taskDialog.timelineFoldMore",{count:String(s.length-y5)})})]}),e[21]=o,e[22]=s.length,e[23]=i,e[24]=x):x=e[24];let b;return e[25]!==p||e[26]!==g||e[27]!==x?(b=r.jsxs("div",{className:"relative flex flex-col gap-4",children:[p,g,x]}),e[25]=p,e[26]=g,e[27]=x,e[28]=b):b=e[28],b}function yG(t){return!t}const _G=[{id:"all",labelKey:"home.homeTasks.tabAll"},{id:"in_progress",labelKey:"home.homeTasks.tabInProgress"},{id:"in_review",labelKey:"home.homeTasks.tabInReview"},{id:"done",labelKey:"home.homeTasks.tabDone"}],LG=4;function wG(t){const e=z.c(64),{task:s,assignee:n,onOpen:i}=t,o=ii[s.status],l=o.icon,a=Wn[s.priority];let c,d,u,h,f,m,p,g,x,b,v,L,_,y;if(e[0]!==l||e[1]!==n?.user?.email||e[2]!==n?.user?.image||e[3]!==n?.user?.name||e[4]!==i||e[5]!==o.iconClassName||e[6]!==s.dueDate||e[7]!==s.title||e[8]!==s.updatedAt){const A=n?.user?.name??n?.user?.email?.split("@")[0]??null;let E;e[23]!==s.updatedAt?(E=Ol(new Date(s.updatedAt)),e[23]=s.updatedAt,e[24]=E):E=e[24],y=E;let D;e[25]!==s.dueDate?(D=s.dueDate?{label:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(s.dueDate)),overdue:new Date(s.dueDate).getTime()<Date.now()}:null,e[25]=s.dueDate,e[26]=D):D=e[26],d=D,v="button",L=i,_="flex w-full items-center gap-3 rounded-2xl bg-card px-4 py-3.5 text-left card-shadow transition-colors hover:bg-accent/60";let I;e[27]!==o.iconClassName?(I=ie("size-4 shrink-0",o.iconClassName),e[27]=o.iconClassName,e[28]=I):I=e[28],e[29]!==l||e[30]!==I?(h=r.jsx(l,{className:I}),e[29]=l,e[30]=I,e[31]=h):h=e[31],e[32]!==s.title?(f=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:s.title}),e[32]=s.title,e[33]=f):f=e[33],b="flex shrink-0 items-center gap-3 text-xs text-muted-foreground",x="hidden @2xl:inline-flex",c=Bs,u="circle",m="2xs",p=n?.user?.image??void 0,g=(A??"?").slice(0,2).toUpperCase(),e[0]=l,e[1]=n?.user?.email,e[2]=n?.user?.image,e[3]=n?.user?.name,e[4]=i,e[5]=o.iconClassName,e[6]=s.dueDate,e[7]=s.title,e[8]=s.updatedAt,e[9]=c,e[10]=d,e[11]=u,e[12]=h,e[13]=f,e[14]=m,e[15]=p,e[16]=g,e[17]=x,e[18]=b,e[19]=v,e[20]=L,e[21]=_,e[22]=y}else c=e[9],d=e[10],u=e[11],h=e[12],f=e[13],m=e[14],p=e[15],g=e[16],x=e[17],b=e[18],v=e[19],L=e[20],_=e[21],y=e[22];let S;e[34]!==c||e[35]!==u||e[36]!==m||e[37]!==p||e[38]!==g?(S=r.jsx(c,{shape:u,size:m,url:p,fallback:g}),e[34]=c,e[35]=u,e[36]=m,e[37]=p,e[38]=g,e[39]=S):S=e[39];let k;e[40]!==S||e[41]!==x?(k=r.jsx("span",{className:x,children:S}),e[40]=S,e[41]=x,e[42]=k):k=e[42];let w;e[43]!==a.flagClassName?(w=ie("size-3.5 shrink-0",a.flagClassName),e[43]=a.flagClassName,e[44]=w):w=e[44];let j;e[45]!==w?(j=r.jsx(zf,{className:w}),e[45]=w,e[46]=j):j=e[46];let N;e[47]!==d?(N=d&&r.jsxs("span",{className:ie("hidden items-center gap-1 @xl:inline-flex",d.overdue?"text-destructive":""),children:[r.jsx(Bl,{className:"size-3"}),d.label]}),e[47]=d,e[48]=N):N=e[48];let T;e[49]!==y?(T=r.jsx("span",{className:"hidden @xl:inline",children:y}),e[49]=y,e[50]=T):T=e[50];let C;e[51]!==k||e[52]!==j||e[53]!==N||e[54]!==T||e[55]!==b?(C=r.jsxs("div",{className:b,children:[k,j,N,T]}),e[51]=k,e[52]=j,e[53]=N,e[54]=T,e[55]=b,e[56]=C):C=e[56];let V;return e[57]!==h||e[58]!==f||e[59]!==C||e[60]!==v||e[61]!==L||e[62]!==_?(V=r.jsxs("button",{type:v,onClick:L,className:_,children:[h,f,C]}),e[57]=h,e[58]=f,e[59]=C,e[60]=v,e[61]=L,e[62]=_,e[63]=V):V=e[63],V}function SG(t,e){const s=t.filter(u=>u.status!=="done");if(s.length===0)return"";const n=s.filter(u=>u.status==="in_progress").length,i=s.filter(u=>u.status==="in_review").length,o=s.filter(u=>u.priority==="urgent"||u.priority==="high").length,l=s.filter(u=>u.dueDate&&new Date(u.dueDate).getTime()<Date.now()).length,a=[];n>0&&a.push(e("home.homeTasks.breakdownInProgress",{count:n})),i>0&&a.push(e("home.homeTasks.breakdownNeedsReview",{count:i}));let c=e("home.homeTasks.summaryLead",{count:s.length});a.length>0&&(c+=` — ${a.join(", ")}`),c+=".";const d=[];return o>0&&d.push(e("home.homeTasks.noteHighPriority",{count:o})),l>0&&d.push(e("home.homeTasks.noteOverdue",{count:l})),d.length>0?`${c} ${d.join(" ")}`:c}function kG(t){const e=z.c(49),{afterSummary:s}=t,n=re(),i=Yt(),{items:o,error:l}=Q6(),a=X6(),{data:c}=Iu();let d;if(e[0]!==c?.data?.members){const N=c?.data?.members??[];d=new Map(N.map(TG)),e[0]=c?.data?.members,e[1]=d}else d=e[1];const u=d,[h,f]=P.useState("all"),[m,p]=P.useState(!1);let g,x,b,v,L,_;if(e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==u||e[6]!==i||e[7]!==n||e[8]!==h){const N=(l?[]:o).filter(NG),T=[...N].sort(CG);let C;e[15]!==n?(C=(O,F)=>n(O,F),e[15]=n,e[16]=C):C=e[16];const V=SG(N,C),A=h==="all"?T:T.filter(O=>O.status===h);let E;e[17]!==i?(E=()=>i({to:".",search:jG}),e[17]=i,e[18]=E):E=e[18];const D=E;v="flex flex-col gap-10";let I;e[19]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(sr,{size:24,className:"mt-0.5"}),e[19]=I):I=e[19],L=r.jsxs("div",{className:"flex items-start gap-4 animate-in fade-in slide-in-from-top-1 duration-300",children:[I,r.jsx("p",{className:"max-w-3xl text-lg font-medium leading-snug text-foreground",children:V})]}),_=s,g="flex flex-col gap-4";let R;e[20]!==n?(R=n("home.homeTasks.tasksHeading"),e[20]=n,e[21]=R):R=e[21];let $;e[22]!==R?($=r.jsx("h2",{className:"text-base font-medium text-foreground",children:R}),e[22]=R,e[23]=$):$=e[23];let B;e[24]!==n||e[25]!==h?(B=_G.map(O=>r.jsx("button",{type:"button",onClick:()=>f(O.id),className:ie("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",h===O.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:n(O.labelKey)},O.id)),e[24]=n,e[25]=h,e[26]=B):B=e[26];let M;e[27]!==B?(M=r.jsx("div",{className:"flex items-center gap-1",children:B}),e[27]=B,e[28]=M):M=e[28],e[29]!==$||e[30]!==M?(x=r.jsxs("div",{className:"flex items-center gap-3",children:[$,M]}),e[29]=$,e[30]=M,e[31]=x):x=e[31],b=A.length===0?r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl bg-card px-4 py-10 text-center card-shadow",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:h==="all"?n("home.homeTasks.emptyStateNoTasks"):n("home.homeTasks.emptyStateNothing",{status:n(h==="in_progress"?"home.homeTasks.statusInProgress":h==="in_review"?"home.homeTasks.statusInReview":"home.homeTasks.statusDone")})}),h==="all"&&r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>p(!0),className:"gap-2",children:[r.jsx(Ht,{className:"size-4"}),n("home.homeTasks.createNewTask")]})]}):r.jsxs("div",{className:"flex flex-col gap-2",children:[A.slice(0,LG).map(O=>r.jsx(wG,{task:O,assignee:O.assigneeId?u.get(O.assigneeId):void 0,onOpen:D},O.id)),r.jsxs("button",{type:"button",onClick:D,className:"flex w-full items-center justify-center gap-1.5 rounded-2xl bg-card px-4 py-3 text-sm font-medium text-muted-foreground card-shadow transition-colors hover:bg-accent/60 hover:text-foreground",children:[n("home.homeTasks.seeAllTasks"),r.jsx(dy,{className:"size-3.5"})]})]}),e[2]=s,e[3]=l,e[4]=o,e[5]=u,e[6]=i,e[7]=n,e[8]=h,e[9]=g,e[10]=x,e[11]=b,e[12]=v,e[13]=L,e[14]=_}else g=e[9],x=e[10],b=e[11],v=e[12],L=e[13],_=e[14];let y;e[32]!==g||e[33]!==x||e[34]!==b?(y=r.jsxs("section",{className:g,children:[x,b]}),e[32]=g,e[33]=x,e[34]=b,e[35]=y):y=e[35];let S;e[36]===Symbol.for("react.memo_cache_sentinel")?(S=()=>p(!1),e[36]=S):S=e[36];let k;e[37]!==a.create?(k=N=>{a.create.mutate(N),p(!1)},e[37]=a.create,e[38]=k):k=e[38];let w;e[39]!==a.create.isPending||e[40]!==m||e[41]!==k?(w=r.jsx(rw,{open:m,onClose:S,isSaving:a.create.isPending,onSubmit:k}),e[39]=a.create.isPending,e[40]=m,e[41]=k,e[42]=w):w=e[42];let j;return e[43]!==w||e[44]!==v||e[45]!==L||e[46]!==_||e[47]!==y?(j=r.jsxs("div",{className:v,children:[L,_,y,w]}),e[43]=w,e[44]=v,e[45]=L,e[46]=_,e[47]=y,e[48]=j):j=e[48],j}function jG(t){return{...t,main:"board"}}function CG(t,e){return(e.updatedAt??"").localeCompare(t.updatedAt??"")}function NG(t){return t.status!=="archived"}function TG(t){return[t.userId,t]}function VG(t){const e=z.c(29),{isEditMode:s,hasChanges:n,onEnter:i,onSave:o,onCancel:l,onAddTile:a}=t,c=re();if(!s){let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(o6,{size:14}),e[0]=_):_=e[0];let y;e[1]!==c?(y=c("home.customizeToolbar.label"),e[1]=c,e[2]=y):y=e[2];let S;return e[3]!==i||e[4]!==y?(S=r.jsxs(he,{type:"button",size:"sm",variant:"ghost",onClick:i,className:"h-8 gap-1.5 text-muted-foreground",children:[_,y]}),e[3]=i,e[4]=y,e[5]=S):S=e[5],S}let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Ht,{size:14}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("home.customizeToolbar.addTile"),e[7]=c,e[8]=u):u=e[8];let h;e[9]!==a||e[10]!==u?(h=r.jsxs(he,{type:"button",size:"sm",variant:"ghost",onClick:a,className:"h-8 gap-1.5",children:[d,u]}),e[9]=a,e[10]=u,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Is,{size:14}),e[12]=f):f=e[12];let m;e[13]!==c?(m=c("home.customizeToolbar.cancel"),e[13]=c,e[14]=m):m=e[14];let p;e[15]!==l||e[16]!==m?(p=r.jsxs(he,{type:"button",size:"sm",variant:"ghost",onClick:l,className:"h-8 gap-1.5",children:[f,m]}),e[15]=l,e[16]=m,e[17]=p):p=e[17];const g=!n;let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(qt,{size:14}),e[18]=x):x=e[18];let b;e[19]!==c?(b=c("home.customizeToolbar.save"),e[19]=c,e[20]=b):b=e[20];let v;e[21]!==o||e[22]!==g||e[23]!==b?(v=r.jsxs(he,{type:"button",size:"sm",onClick:o,disabled:g,className:"h-8 gap-1.5",children:[x,b]}),e[21]=o,e[22]=g,e[23]=b,e[24]=v):v=e[24];let L;return e[25]!==v||e[26]!==h||e[27]!==p?(L=r.jsxs("div",{className:"flex items-center gap-1",children:[h,p,v]}),e[25]=v,e[26]=h,e[27]=p,e[28]=L):L=e[28],L}function AG(){const t=z.c(18),{isEditMode:e,enter:s,save:n,cancel:i,hasChanges:o}=Eg(),[l,a]=P.useState(!1),c=Rf();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(kG,{afterSummary:r.jsx(Oz,{})}),t[0]=d):d=t[0];let u;t[1]!==i||t[2]!==s||t[3]!==o||t[4]!==e||t[5]!==c||t[6]!==n?(u=!c&&r.jsx("div",{className:"flex justify-end",children:r.jsx(VG,{isEditMode:e,hasChanges:o,onEnter:s,onSave:n,onCancel:i,onAddTile:()=>a(!0)})}),t[1]=i,t[2]=s,t[3]=o,t[4]=e,t[5]=c,t[6]=n,t[7]=u):u=t[7];let h;t[8]!==e?(h=r.jsx(mH,{isEditMode:e}),t[8]=e,t[9]=h):h=t[9];let f;t[10]!==u||t[11]!==h?(f=r.jsxs("div",{className:"@container mx-auto flex max-w-5xl flex-col gap-10 px-6 py-8",children:[d,r.jsxs("div",{className:"flex flex-col gap-4",children:[u,h]})]}),t[10]=u,t[11]=h,t[12]=f):f=t[12];let m;t[13]!==l?(m=r.jsx(zH,{open:l,onOpenChange:a}),t[13]=l,t[14]=m):m=t[14];let p;return t[15]!==f||t[16]!==m?(p=r.jsxs("div",{className:"h-full overflow-y-auto",children:[f,m]}),t[15]=f,t[16]=m,t[17]=p):p=t[17],p}function PG(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Iz,{children:r.jsx(AG,{})}),t[0]=e):e=t[0],e}const EG=["taskBoard.subscriptionPaywall.trialBenefitMonitoring","taskBoard.subscriptionPaywall.trialBenefitAutoFix","taskBoard.subscriptionPaywall.trialBenefitRuns"],DG="https://decoims.com/image?src=decocms%2F7263a67f-fb83-410b-a5f2-e54e87deaaac%2Freport-kanban.png&quality=original&fit=cover";function RG(t){const e=z.c(83),{kind:s,onOpenChange:n}=t,i=re(),{mutate:o,isPending:l}=y6("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");if(s==="trial_exhausted"){let _;e[0]!==i?(_=i("taskBoard.subscriptionPaywall.previewAlt"),e[0]=i,e[1]=_):_=e[1];let y;e[2]!==_?(y=r.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:r.jsx("img",{src:DG,alt:_,className:"h-[160px] w-full object-cover object-left-top"})}),e[2]=_,e[3]=y):y=e[3];let S;e[4]!==i?(S=i("taskBoard.subscriptionPaywall.trialTitle"),e[4]=i,e[5]=S):S=e[5];let k;e[6]!==S?(k=r.jsx(Kt,{className:"text-xl font-semibold text-foreground",children:S}),e[6]=S,e[7]=k):k=e[7];let w;e[8]!==i?(w=EG.map(W=>r.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[r.jsx(hi,{size:18,className:"mt-0.5 shrink-0 text-success","aria-hidden":!0}),r.jsx("span",{className:"leading-snug text-foreground",children:i(W)})]},W)),e[8]=i,e[9]=w):w=e[9];let j;e[10]!==w?(j=r.jsx("ul",{className:"flex flex-col gap-3",children:w}),e[10]=w,e[11]=j):j=e[11];let N;e[12]!==i?(N=i("taskBoard.subscriptionPaywall.trialPrice"),e[12]=i,e[13]=N):N=e[13];let T;e[14]!==N?(T=r.jsx("span",{className:"text-2xl font-semibold text-foreground",children:N}),e[14]=N,e[15]=T):T=e[15];let C;e[16]!==i?(C=i("taskBoard.subscriptionPaywall.trialPricePeriod"),e[16]=i,e[17]=C):C=e[17];let V;e[18]!==C?(V=r.jsx("span",{className:"text-sm text-muted-foreground",children:C}),e[18]=C,e[19]=V):V=e[19];let A;e[20]!==V||e[21]!==T?(A=r.jsxs("div",{className:"flex items-baseline gap-1.5",children:[T,V]}),e[20]=V,e[21]=T,e[22]=A):A=e[22];let E;e[23]!==n?(E=()=>n(!1),e[23]=n,e[24]=E):E=e[24];let D;e[25]!==i?(D=i("taskBoard.subscriptionPaywall.notNowButton"),e[25]=i,e[26]=D):D=e[26];let I;e[27]!==l||e[28]!==E||e[29]!==D?(I=r.jsx(he,{variant:"ghost",onClick:E,disabled:l,className:"order-2 w-full sm:order-none sm:w-auto",children:D}),e[27]=l,e[28]=E,e[29]=D,e[30]=I):I=e[30];let R;e[31]!==n||e[32]!==o?(R=()=>o(void 0,{onSuccess:()=>n(!1)}),e[31]=n,e[32]=o,e[33]=R):R=e[33];let $;e[34]!==l?($=l&&r.jsx(lt,{size:16,className:"animate-spin"}),e[34]=l,e[35]=$):$=e[35];let B;e[36]!==i?(B=i("taskBoard.subscriptionPaywall.subscribeButton"),e[36]=i,e[37]=B):B=e[37];let M;e[38]!==l||e[39]!==R||e[40]!==$||e[41]!==B?(M=r.jsxs(he,{disabled:l,onClick:R,className:"order-1 w-full gap-2 sm:order-none sm:w-auto",children:[$,B]}),e[38]=l,e[39]=R,e[40]=$,e[41]=B,e[42]=M):M=e[42];let O;e[43]!==I||e[44]!==M?(O=r.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[I,M]}),e[43]=I,e[44]=M,e[45]=O):O=e[45];let F;e[46]!==A||e[47]!==O?(F=r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[A,O]}),e[46]=A,e[47]=O,e[48]=F):F=e[48];let U;e[49]!==F||e[50]!==k||e[51]!==j?(U=r.jsxs("div",{className:"flex flex-col gap-6 px-3 pb-3 pt-7",children:[k,j,F]}),e[49]=F,e[50]=k,e[51]=j,e[52]=U):U=e[52];let K;e[53]!==y||e[54]!==U?(K=r.jsxs(Bt,{className:"gap-0 p-3 sm:max-w-[440px]",closeButtonClassName:"z-10 rounded-full bg-background/70 p-1 text-foreground backdrop-blur transition-colors hover:bg-background",children:[y,U]}),e[53]=y,e[54]=U,e[55]=K):K=e[55];let q;return e[56]!==n||e[57]!==K?(q=r.jsx(zt,{open:!0,onOpenChange:n,children:K}),e[56]=n,e[57]=K,e[58]=q):q=e[58],q}let a;e[59]!==s||e[60]!==i?(a=s?{monthly_exhausted:{title:i("taskBoard.subscriptionPaywall.monthlyTitle"),description:i("taskBoard.subscriptionPaywall.monthlyDescription")},runs_exhausted:{title:i("taskBoard.subscriptionPaywall.runsTitle"),description:i("taskBoard.subscriptionPaywall.runsDescription")}}[s]:null,e[59]=s,e[60]=i,e[61]=a):a=e[61];const c=a,d=!!s,u=c?.title;let h;e[62]!==u?(h=r.jsx(Kt,{children:u}),e[62]=u,e[63]=h):h=e[63];const f=c?.description;let m;e[64]!==f?(m=r.jsx(kn,{children:f}),e[64]=f,e[65]=m):m=e[65];let p;e[66]!==h||e[67]!==m?(p=r.jsxs(os,{children:[h,m]}),e[66]=h,e[67]=m,e[68]=p):p=e[68];let g;e[69]!==n?(g=()=>n(!1),e[69]=n,e[70]=g):g=e[70];let x;e[71]!==i?(x=i("taskBoard.subscriptionPaywall.dismissButton"),e[71]=i,e[72]=x):x=e[72];let b;e[73]!==g||e[74]!==x?(b=r.jsx(qn,{children:r.jsx(he,{variant:"ghost",onClick:g,children:x})}),e[73]=g,e[74]=x,e[75]=b):b=e[75];let v;e[76]!==b||e[77]!==p?(v=r.jsxs(Bt,{className:"sm:max-w-[440px]",children:[p,b]}),e[76]=b,e[77]=p,e[78]=v):v=e[78];let L;return e[79]!==n||e[80]!==v||e[81]!==d?(L=r.jsx(zt,{open:d,onOpenChange:n,children:v}),e[79]=n,e[80]=v,e[81]=d,e[82]=L):L=e[82],L}const IG=new Set(["completed","failed","expired"]);function MG(t){return t.threads.some(e=>e.status!==null&&!IG.has(e.status))}function $G(t){const e=z.c(43),{items:s,pending:n,onOpenChange:i,onConfirm:o}=t,l=re(),a=s.length;let c;e[0]!==s?(c=s.some(MG),e[0]=s,e[1]=c):c=e[1];const d=c,u=a>0;let h;e[2]!==a||e[3]!==l?(h=a>1?l("taskBoard.rerun.titleMany",{count:a}):l("taskBoard.rerun.title"),e[2]=a,e[3]=l,e[4]=h):h=e[4];let f;e[5]!==h?(f=r.jsx(Kt,{children:h}),e[5]=h,e[6]=f):f=e[6];let m;e[7]!==a||e[8]!==l||e[9]!==d?(m=a>1?l("taskBoard.rerun.descriptionMany",{count:a}):l(d?"taskBoard.rerun.descriptionTakeover":"taskBoard.rerun.description"),e[7]=a,e[8]=l,e[9]=d,e[10]=m):m=e[10];let p;e[11]!==m?(p=r.jsx(kn,{children:m}),e[11]=m,e[12]=p):p=e[12];let g;e[13]!==f||e[14]!==p?(g=r.jsxs(os,{children:[f,p]}),e[13]=f,e[14]=p,e[15]=g):g=e[15];let x;e[16]!==i?(x=()=>i(!1),e[16]=i,e[17]=x):x=e[17];let b;e[18]!==l?(b=l("taskBoard.rerun.cancel"),e[18]=l,e[19]=b):b=e[19];let v;e[20]!==n||e[21]!==x||e[22]!==b?(v=r.jsx(he,{variant:"outline",onClick:x,disabled:n,children:b}),e[20]=n,e[21]=x,e[22]=b,e[23]=v):v=e[23];let L;e[24]!==n?(L=n&&r.jsx(lt,{className:"size-4 animate-spin"}),e[24]=n,e[25]=L):L=e[25];let _;e[26]!==l?(_=l("taskBoard.rerun.confirm"),e[26]=l,e[27]=_):_=e[27];let y;e[28]!==o||e[29]!==n||e[30]!==L||e[31]!==_?(y=r.jsxs(he,{onClick:o,disabled:n,children:[L,_]}),e[28]=o,e[29]=n,e[30]=L,e[31]=_,e[32]=y):y=e[32];let S;e[33]!==v||e[34]!==y?(S=r.jsxs(qn,{children:[v,y]}),e[33]=v,e[34]=y,e[35]=S):S=e[35];let k;e[36]!==S||e[37]!==g?(k=r.jsxs(Bt,{className:"max-w-md",children:[g,S]}),e[36]=S,e[37]=g,e[38]=k):k=e[38];let w;return e[39]!==i||e[40]!==k||e[41]!==u?(w=r.jsx(zt,{open:u,onOpenChange:i,children:k}),e[39]=i,e[40]=k,e[41]=u,e[42]=w):w=e[42],w}const L5=380,OG=90,w5=5,BG="cubic-bezier(0.22, 0.61, 0.36, 1)";function zG(t,e,s,n=!0){const i=P.useRef(new Map),o=P.useRef(new Map),l=P.useRef(!1);P.useLayoutEffect(()=>{const a=t.current;if(!a)return;if(!n){l.current=!0;return}const c=l.current;l.current=!1;const d=a.querySelectorAll("[data-flip-id]"),u=new Map,h=i.current;i.current=u;const f=typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,m=[];for(const _ of d){const y=_.dataset.flipId;if(!y)continue;const S=_.getBoundingClientRect(),k=_.dataset.flipLane;if(u.set(y,{rect:S,lane:k}),!s||c)continue;const w=h.get(y);if(!w)continue;const j=w.rect.left-S.left,N=w.rect.top-S.top;(j||N)&&m.push({el:_,dx:j,dy:N,lane:w.lane!==k})}if(!s||f||m.length===0)return;const p=o.current,g=_=>{_ instanceof HTMLElement&&(p.set(_,(p.get(_)??0)+1),_.style.overflow="visible")},x=_=>{if(!(_ instanceof HTMLElement))return;const y=(p.get(_)??1)-1;if(y>0){p.set(_,y);return}p.delete(_),_.style.overflow=""};for(const _ of m){const y=_.lane?` rotate(${_.dx>0?w5:-w5}deg)`:"";_.el.style.transition="none",_.el.style.transform=`translate(${_.dx}px, ${_.dy}px)${y}`,_.lane&&(_.el.style.zIndex="10",g(_.el.closest("[data-lane-scroll]")))}let b=0;const v=[],L=requestAnimationFrame(()=>{for(const _ of m){const y=_.lane?b++*OG:0;_.el.style.transition=`transform ${L5}ms ${BG} ${y}ms`,_.el.style.transform="",v.push(window.setTimeout(()=>{_.el.style.transition="",_.el.style.transform="",_.el.style.zIndex="",_.lane&&x(_.el.closest("[data-lane-scroll]"))},L5+y+30))}});return()=>{cancelAnimationFrame(L);for(const _ of v)clearTimeout(_);for(const _ of m)_.el.style.transition="",_.el.style.transform="",_.el.style.zIndex="",_.lane&&x(_.el.closest("[data-lane-scroll]"))}},[e,t,s,n])}function FG(t,e=[]){const s=[[`# Task: ${t.title}`,t.description?.trim()].filter(Boolean).join(`
|
|
87
|
+
`)}const oq=10,lq=25,aq={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function cq(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??aq[t.type]??(i3(t)?".png":"")}function i3(t){return t.type.startsWith("image/")}function dq(){const t=re(),{upload:e}=pu(zm),s=j2(zm),[n,i]=P.useState(0);return{uploadFile:async l=>{const a=i3(l),c=a?oq:lq;if(l.size>c*1024*1024)return ge.error(t("markdownEditor.fileTooLarge",{name:l.name,max:String(c)})),null;const d=a?JW:YL,u=`${crypto.randomUUID()}${cq(l)}`;i(h=>h+1);try{return await e.mutateAsync({dir:d,files:[new File([l],u,{type:l.type})]}),s(`${d}/${u}`)}catch{return ge.error(t("markdownEditor.uploadFailed",{name:l.name})),null}finally{i(h=>h-1)}},pending:n}}const uq=["outline-none","min-h-[200px] sm:min-h-[320px]","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0","[&_p]:my-3 [&_p]:leading-[1.5]","[&_h1]:my-3 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:leading-[1.5] [&_h1]:text-foreground","[&_h2]:my-3 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:leading-[1.5] [&_h2]:text-foreground","[&_h3]:my-3 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:leading-[1.5] [&_h3]:text-foreground","[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-5","[&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:my-0.5 [&_li>p]:my-0","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]","[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-[13px]","[&_pre_code]:bg-transparent [&_pre_code]:p-0","[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2","[&_hr]:my-4 [&_hr]:border-border","[&_strong]:font-semibold [&_strong]:text-foreground"].join(" "),hq=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground/50","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function p5(t,e,s,n){const i=t.state.schema.nodes[s];if(!i)return e;const o=t.state.tr.replaceWith(e,e,i.create(n)),l=o.mapping.map(e,1);return o.setSelection(Gi.near(o.doc.resolve(l))),t.dispatch(o),t.state.selection.to}function fq({defaultValue:t,onChange:e,placeholder:s,editable:n=!0}){const i=re(),{uploadFile:o,pending:l}=dq(),[a]=P.useState(()=>new KL),c=P.useRef(null),d=P.useRef(e),u=P.useRef(o);d.current=e,u.current=o;const h=(p,g,x)=>g.length===0?!1:((async()=>{let b=x;for(const v of g){const L=await u.current(v);L&&(b=i3(v)?p5(p,b,"image",{src:L,alt:v.name}):p5(p,b,"attachment",{href:L,name:v.name}))}})(),!0),f=Lf({extensions:tq(s,a),content:rq(t),contentType:"markdown",editable:n,editorProps:{attributes:{role:"textbox","aria-label":s??"","aria-multiline":"true",class:ie(uq,hq)},handlePaste:(p,g)=>{const x=Array.from(g.clipboardData?.files??[]);return x.length===0?!1:(g.stopPropagation(),h(p,x,p.state.selection.to))},handleDrop:(p,g,x,b)=>{if(b)return!1;const v=Array.from(g.dataTransfer?.files??[]);if(v.length===0)return!1;const L=p.posAtCoords({left:g.clientX,top:g.clientY})?.pos;return L===void 0?!1:(g.stopPropagation(),h(p,v,L))}},onUpdate:({editor:p,transaction:g})=>{g.docChanged&&d.current(p.getMarkdown())}});if(!f)return null;const m=p=>{!p||p.length===0||h(f.view,Array.from(p),f.state.selection.to)};return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(AK,{editor:f}),r.jsx(GL,{store:a}),r.jsx(Sf,{editor:f,className:"text-[15px] text-muted-foreground"}),r.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground",children:[n&&r.jsx(he,{type:"button",variant:"ghost",size:"icon-sm","aria-label":i("markdownEditor.attachFile"),onClick:()=>c.current?.click(),children:r.jsx(s6,{size:14})}),l>0&&r.jsxs("span",{className:"inline-flex items-center gap-1.5","aria-live":"polite",role:"status",children:[r.jsx(Af,{size:12,className:"animate-spin"}),l===1?i("markdownEditor.uploading"):i("markdownEditor.uploadingCount",{count:String(l)})]})]}),r.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:p=>{m(p.target.files),p.target.value=""}})]})}const mq="claude-subscription";function pq(t){const e=(t??[]).filter(s=>s.costUsd!==null);return e.length===0?null:{total:e.reduce((s,n)=>s+(n.costUsd??0),0),runCount:e.length,onSubscription:e.every(s=>s.costProvider===mq)}}function gq(t,e){const s=t.state==="open"&&!t.merged,n=t.mergeable===!1,i=t.checksStatus!=="failing";return{isOpen:s,hasConflict:n,showShip:e&&s&&i&&!n,showResolveConflict:e&&s&&n}}const xq=6e4;function JL(t){const e=z.c(10),{locator:s}=Fe(),n=ys();let i;e[0]!==t||e[1]!==s?(i=Qe.taskBoardItemPrs(s,t??""),e[0]=t,e[1]=s,e[2]=i):i=e[2];const o=!!t;let l;e[3]!==t||e[4]!==n?(l=async()=>(await n.call("TASK_BOARD_ITEM_PRS_GET",{taskBoardItemId:t})).prs,e[3]=t,e[4]=n,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==o||e[8]!==l?(a={queryKey:i,enabled:o,refetchInterval:xq,queryFn:l},e[6]=i,e[7]=o,e[8]=l,e[9]=a):a=e[9],Pt(a)}function QL(t){const e=z.c(10),{locator:s}=Fe(),n=ys();let i;e[0]!==t||e[1]!==s?(i=Qe.taskBoardActivity(s,t??""),e[0]=t,e[1]=s,e[2]=i):i=e[2];const o=!!t;let l;e[3]!==t||e[4]!==n?(l=async()=>(await n.call("TASK_BOARD_ACTIVITY_LIST",{taskBoardItemId:t})).activity,e[3]=t,e[4]=n,e[5]=l):l=e[5];let a;return e[6]!==i||e[7]!==o||e[8]!==l?(a={queryKey:i,enabled:o,queryFn:l},e[6]=i,e[7]=o,e[8]=l,e[9]=a):a=e[9],Pt(a)}function bq(t){const e=z.c(10),{locator:s}=Fe(),n=ys(),i=as();let o;e[0]!==t||e[1]!==n?(o=async()=>await n.call("TASK_BOARD_PROMOTE_TO_PRODUCTION",{taskBoardItemId:t}),e[0]=t,e[1]=n,e[2]=o):o=e[2];let l;e[3]!==t||e[4]!==s||e[5]!==i?(l=()=>{i.invalidateQueries({queryKey:Qe.taskBoardItemPrs(s,t)}),i.invalidateQueries({queryKey:Qe.taskBoardActivity(s,t)})},e[3]=t,e[4]=s,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==o||e[8]!==l?(a={mutationFn:o,onSuccess:l},e[7]=o,e[8]=l,e[9]=a):a=e[9],Rs(a)}function vq(t){const e=z.c(10),{locator:s}=Fe(),n=ys(),i=as();let o;e[0]!==t||e[1]!==n?(o=async c=>await n.call("TASK_BOARD_RESOLVE_CONFLICT",{id:t,prNumber:c}),e[0]=t,e[1]=n,e[2]=o):o=e[2];let l;e[3]!==t||e[4]!==s||e[5]!==i?(l=()=>{i.invalidateQueries({queryKey:Qe.taskBoardItemPrs(s,t)}),i.invalidateQueries({queryKey:Qe.taskBoardActivity(s,t)})},e[3]=t,e[4]=s,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==o||e[8]!==l?(a={mutationFn:o,onSuccess:l},e[7]=o,e[8]=l,e[9]=a):a=e[9],Rs(a)}function XL(t){return t?GA:[]}function yq(t,e){return e.length===0?!0:YA(t,e)}function _q(t,e){if(e.length===0)return null;const s=e.map(o=>t.find(l=>l.reviewer===o)),n=s.filter(o=>o?.verdict==="approved"),i={passed:n.length,total:e.length};return s.some(o=>o?.verdict==="changes_requested")?{...i,tone:"danger"}:n.length===0?{...i,tone:"danger"}:n.length<e.length?{...i,tone:"pending"}:{...i,tone:"ok"}}function Lq(t){return t==="in_review"||t==="approved"}function r3(t){const e=z.c(57),{members:s,onSelect:n}=t,i=re();let o;e[0]!==i?(o=i("taskBoard.taskDialog.assignToPlaceholder"),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==i?(l=i("taskBoard.taskDialog.assignToPlaceholder"),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==l?(a=r.jsx(Pi,{placeholder:o,"aria-label":l,className:"h-9"}),e[4]=o,e[5]=l,e[6]=a):a=e[6];let c;e[7]!==i?(c=i("taskBoard.taskDialog.noMembersFound"),e[7]=i,e[8]=c):c=e[8];let d;e[9]!==c?(d=r.jsx(di,{children:c}),e[9]=c,e[10]=d):d=e[10];let u;e[11]!==i?(u=i("taskBoard.taskDialog.superAgentLabel"),e[11]=i,e[12]=u):u=e[12];let h;e[13]!==n?(h=()=>n(ks),e[13]=n,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(sr,{size:16}),e[15]=f):f=e[15];let m;e[16]!==i?(m=i("taskBoard.taskDialog.superAgentLabel"),e[16]=i,e[17]=m):m=e[17];let p;e[18]!==m?(p=r.jsx("span",{className:"truncate",children:m}),e[18]=m,e[19]=p):p=e[19];let g;e[20]!==p||e[21]!==u||e[22]!==h?(g=r.jsxs(Cs,{value:u,onSelect:h,className:"gap-2",children:[f,p]}),e[20]=p,e[21]=u,e[22]=h,e[23]=g):g=e[23];let x;e[24]!==i?(x=i("taskBoard.taskDialog.unassignedLabel"),e[24]=i,e[25]=x):x=e[25];let b;e[26]!==n?(b=()=>n(null),e[26]=n,e[27]=b):b=e[27];let v;e[28]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(U6,{size:16,className:"text-muted-foreground"}),e[28]=v):v=e[28];let L;e[29]!==i?(L=i("taskBoard.taskDialog.unassignedLabel"),e[29]=i,e[30]=L):L=e[30];let _;e[31]!==L?(_=r.jsx("span",{className:"truncate",children:L}),e[31]=L,e[32]=_):_=e[32];let y;e[33]!==x||e[34]!==b||e[35]!==_?(y=r.jsxs(Cs,{value:x,onSelect:b,className:"gap-2",children:[v,_]}),e[33]=x,e[34]=b,e[35]=_,e[36]=y):y=e[36];let S;e[37]!==g||e[38]!==y?(S=r.jsxs(qs,{children:[g,y]}),e[37]=g,e[38]=y,e[39]=S):S=e[39];let k;e[40]!==i?(k=i("taskBoard.taskDialog.membersGroupHeading"),e[40]=i,e[41]=k):k=e[41];let w;if(e[42]!==s||e[43]!==n){let C;e[45]!==n?(C=V=>r.jsxs(Cs,{value:V.user?.name??V.userId,onSelect:()=>n(V.userId),className:"gap-2",children:[r.jsx(Bs,{url:V.user?.image??void 0,fallback:En(V.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:V.user?.name??V.userId})]},V.userId),e[45]=n,e[46]=C):C=e[46],w=s.map(C),e[42]=s,e[43]=n,e[44]=w}else w=e[44];let j;e[47]!==k||e[48]!==w?(j=r.jsx(qs,{heading:k,children:w}),e[47]=k,e[48]=w,e[49]=j):j=e[49];let N;e[50]!==S||e[51]!==j||e[52]!==d?(N=r.jsxs(Ei,{children:[d,S,j]}),e[50]=S,e[51]=j,e[52]=d,e[53]=N):N=e[53];let T;return e[54]!==N||e[55]!==a?(T=r.jsxs(hr,{children:[a,N]}),e[54]=N,e[55]=a,e[56]=T):T=e[56],T}function wq({tags:t,selectedIds:e,defaultColor:s,onToggle:n,onCreate:i,onDelete:o}){const l=re(),[a,c]=P.useState(""),[d,u]=P.useState(!1),[h,f]=P.useState(s),m=a.trim(),p=t.some(x=>x.name.toLowerCase()===m.toLowerCase()),g=async()=>{if(!(!m||p||d)){u(!0);try{await i(m,h),c("")}finally{u(!1)}}};return r.jsxs(hr,{children:[r.jsx(Pi,{value:a,onValueChange:c,placeholder:l("taskBoard.taskDialog.tagFilterPlaceholder"),"aria-label":l("taskBoard.taskDialog.tagFilterPlaceholder"),className:"h-9"}),r.jsxs(Ei,{children:[m&&!p?r.jsx(qs,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{type:"color",value:h,onChange:x=>f(x.target.value),"aria-label":l("taskBoard.taskDialog.pickTagColorAriaLabel"),className:"ml-2 size-4 shrink-0 cursor-pointer appearance-none rounded-full border-0 bg-transparent p-0 [&::-moz-color-swatch]:rounded-full [&::-moz-color-swatch]:border-0 [&::-webkit-color-swatch]:rounded-full [&::-webkit-color-swatch]:border-0 [&::-webkit-color-swatch-wrapper]:p-0"}),r.jsxs(Cs,{value:`create-${m}`,disabled:d,onSelect:g,className:"flex-1 gap-2",children:[r.jsx(Ht,{size:16,className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:l("taskBoard.taskDialog.createTagOption",{name:m})})]})]})}):r.jsx(di,{children:l("taskBoard.taskDialog.noTagsFound")}),r.jsx(qs,{children:t.map(x=>{const b=e.includes(x.id);return r.jsxs(Cs,{value:x.name,onSelect:()=>n(x.id),className:"group gap-2",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ou(x.color)}}),r.jsx("span",{className:"flex-1 truncate",children:x.name}),r.jsx("button",{type:"button","aria-label":l("taskBoard.taskDialog.deleteTagAriaLabel",{name:x.name}),className:"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground opacity-0 hover:bg-background hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",onClick:v=>{v.stopPropagation(),o(x.id)},children:r.jsx(f2,{size:13})}),b&&r.jsx(qt,{size:14,className:"shrink-0 text-foreground"})]},x.id)})})]})]})}function Sq(t){if(!t)return[];const e=[],s=new Set,n=(l,a)=>{s.has(l)||(s.add(l),e.push({url:l,label:a.trim()||l}))},i=t.replace(/!\[[^\]]*\]\([^)]*\)/g,"");for(const l of i.matchAll(/\[([^\]]*)\]\((https?:\/\/[^)\s]+)[^)]*\)/g))n(l[2]??"",l[1]??"");const o=i.replace(/\[[^\]]*\]\([^)]*\)/g,"");for(const l of o.matchAll(/https?:\/\/[^\s)]+/g))n(l[0],l[0]);return e}function kq(t){return{id:t.threadId,title:t.title,status:t.status,created_at:t.createdAt,virtual_mcp_id:t.virtualMcpId}}function jq(t){const e=z.c(5),{title:s}=t;let n;e[0]!==s?(n=r.jsx(hy,{className:"shrink-0 border-b border-border px-5 pb-5 pt-6 md:px-6",children:r.jsx(uy,{className:"truncate text-sm leading-snug",children:s})}),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex flex-1 items-center justify-center"}),e[2]=i):i=e[2];let o;return e[3]!==n?(o=r.jsxs(r.Fragment,{children:[n,i]}),e[3]=n,e[4]=o):o=e[4],o}function Cq(t){const e=z.c(12),{thread:s}=t,{org:n,locator:i}=Fe();let o;e[0]!==n.id||e[1]!==n.slug?(o={connectionId:Ho,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=o):o=e[2];const l=Gt(o),a=ci(),c=Fc(),{data:d}=Iu();let u;e[3]!==s?(u=kq(s),e[3]=s,e[4]=u):u=e[4];let h;return e[5]!==l||e[6]!==a||e[7]!==i||e[8]!==d||e[9]!==u||e[10]!==c?(h=r.jsx(FN,{thread:u,client:l,locator:i,connections:a,virtualMcps:c,members:d,meta:!1}),e[5]=l,e[6]=a,e[7]=i,e[8]=d,e[9]=u,e[10]=c,e[11]=h):h=e[11],h}function Nq(t){const e=z.c(11),{thread:s,onClose:n}=t,i=re(),o=!!s;let l;e[0]!==n?(l=u=>!u&&n(),e[0]=n,e[1]=l):l=e[1];let a;e[2]!==i||e[3]!==s?(a=s&&r.jsx(P.Suspense,{fallback:r.jsx(jq,{title:s.title??i("taskBoard.taskDialog.superAgentDefaultName")}),children:r.jsx(Cq,{thread:s})}),e[2]=i,e[3]=s,e[4]=a):a=e[4];let c;e[5]!==a?(c=r.jsx(fy,{"data-testid":"task-thread-sheet",className:"flex flex-col gap-0 p-0 sm:max-w-2xl",children:a}),e[5]=a,e[6]=c):c=e[6];let d;return e[7]!==o||e[8]!==l||e[9]!==c?(d=r.jsx(my,{open:o,onOpenChange:l,children:c}),e[7]=o,e[8]=l,e[9]=c,e[10]=d):d=e[10],d}const Tq=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function Vq(t){const e=z.c(24),{placeholder:s,onSubmit:n,onEmptyChange:i,ref:o,className:l}=t,[a]=P.useState(Aq);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=wf.configure({heading:!1,bulletList:!1,orderedList:!1,listItem:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,link:!1,underline:!1}),e[0]=c):c=e[0];let d;e[1]!==a?(d=qL(a),e[1]=a,e[2]=d):d=e[2];let u;e[3]!==s?(u=Z2.configure({placeholder:s}),e[3]=s,e[4]=u):u=e[4];let h;e[5]!==d||e[6]!==u?(h=[c,HL,d,u,UL],e[5]=d,e[6]=u,e[7]=h):h=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=ie("outline-none text-sm leading-relaxed text-foreground",Tq),e[8]=f):f=e[8];let m;e[9]!==s?(m={role:"textbox","aria-label":s,"aria-multiline":"true",class:f},e[9]=s,e[10]=m):m=e[10];let p;e[11]!==i?(p=y=>{const{editor:S}=y;return i(S.isEmpty)},e[11]=i,e[12]=p):p=e[12];const g=Lf({extensions:h,editorProps:{attributes:m,handleKeyDown:(y,S)=>S.key!=="Enter"||S.shiftKey||g9.getState(y.state)?.active?!1:(S.preventDefault(),x(),!0)},onUpdate:p});function x(){if(!g)return;const y=g.getMarkdown().trim();y&&(n(y),g.commands.clearContent(),i(!0))}let b;e[13]!==g?.commands||e[14]!==x?(b=()=>({submit:x,focus:()=>g?.commands.focus()}),e[13]=g?.commands,e[14]=x,e[15]=b):b=e[15],P.useImperativeHandle(o,b);let v;e[16]!==l||e[17]!==g?(v=r.jsx(Sf,{editor:g,className:l}),e[16]=l,e[17]=g,e[18]=v):v=e[18];let L;e[19]!==a?(L=r.jsx(GL,{store:a}),e[19]=a,e[20]=L):L=e[20];let _;return e[21]!==L||e[22]!==v?(_=r.jsxs(r.Fragment,{children:[v,L]}),e[21]=L,e[22]=v,e[23]=_):_=e[23],_}function Aq(){return new KL}function Pq(t){const e=z.c(40),{thread:s,me:n,onReply:i,onDelete:o,onToggleResolved:l}=t,a=re(),[c,d]=P.useState(!1);if(s.resolved&&!c){let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>d(!0),e[0]=v):v=e[0];let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(qT,{size:16,className:"shrink-0 text-muted-foreground"}),e[1]=L):L=e[1];let _;e[2]!==a||e[3]!==s?(_=Dq(s,a),e[2]=a,e[3]=s,e[4]=_):_=e[4];let y;e[5]!==_?(y=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:_}),e[5]=_,e[6]=y):y=e[6];let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(Uf,{size:16,className:"shrink-0 text-muted-foreground"}),e[7]=S):S=e[7];let k;return e[8]!==y?(k=r.jsxs("button",{type:"button",onClick:v,className:"flex w-full items-center gap-2.5 rounded-xl bg-card px-4 py-3 text-left card-shadow transition-colors hover:bg-muted/60",children:[L,y,S]}),e[8]=y,e[9]=k):k=e[9],k}let u;e[10]!==a||e[11]!==s.resolved?(u=s.resolved&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>d(!1),className:"flex items-center justify-between gap-2 rounded-t-xl bg-muted/40 px-4 py-2.5 text-left text-sm text-muted-foreground transition-colors hover:text-foreground",children:[a("taskBoard.taskDialog.commentCollapseThread"),r.jsx(Is,{size:14,"aria-hidden":!0})]}),r.jsx(b1,{})]}),e[10]=a,e[11]=s.resolved,e[12]=u):u=e[12];let h;e[13]!==n||e[14]!==o||e[15]!==s?(h=g5(s,n)?()=>o(s.id):void 0,e[13]=n,e[14]=o,e[15]=s,e[16]=h):h=e[16];let f;e[17]!==l||e[18]!==h||e[19]!==s?(f=r.jsx(x5,{comment:s,onDelete:h,resolved:s.resolved,onToggleResolved:l}),e[17]=l,e[18]=h,e[19]=s,e[20]=f):f=e[20];let m;if(e[21]!==n||e[22]!==o||e[23]!==s.replies){let v;e[25]!==n||e[26]!==o?(v=(L,_)=>r.jsxs(P.Fragment,{children:[r.jsx(b1,{inset:_>0}),r.jsx(x5,{comment:L,onDelete:g5(L,n)?()=>o(L.id):void 0,isReply:!0})]},L.id),e[25]=n,e[26]=o,e[27]=v):v=e[27],m=s.replies.map(v),e[21]=n,e[22]=o,e[23]=s.replies,e[24]=m}else m=e[24];let p;e[28]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(b1,{}),e[28]=p):p=e[28];let g;e[29]!==a?(g=a("taskBoard.taskDialog.commentReplyPlaceholder"),e[29]=a,e[30]=g):g=e[30];let x;e[31]!==n||e[32]!==i||e[33]!==g?(x=r.jsx(ew,{variant:"reply",placeholder:g,author:n,onSubmit:i}),e[31]=n,e[32]=i,e[33]=g,e[34]=x):x=e[34];let b;return e[35]!==u||e[36]!==f||e[37]!==m||e[38]!==x?(b=r.jsxs("div",{className:"flex flex-col rounded-xl bg-card card-shadow",children:[u,f,m,p,x]}),e[35]=u,e[36]=f,e[37]=m,e[38]=x,e[39]=b):b=e[39],b}function g5(t,e){return t.author.id===e.id||t.author.isAgent===!0}const Eq=new Intl.ListFormat(void 0,{style:"long",type:"conjunction"});function Dq(t,e){const s=[t,...t.replies],n=Eq.format([...new Set(s.map(i=>i.author.name))]);return s.length===1?e("taskBoard.taskDialog.commentResolvedSummaryOne",{names:n}):e("taskBoard.taskDialog.commentResolvedSummaryMany",{count:s.length,names:n})}function Rq(t){const e=z.c(6),{me:s,onSubmit:n}=t,i=re();let o;e[0]!==i?(o=i("taskBoard.taskDialog.commentPlaceholder"),e[0]=i,e[1]=o):o=e[1];let l;return e[2]!==s||e[3]!==n||e[4]!==o?(l=r.jsx(ew,{variant:"root",placeholder:o,author:s,onSubmit:n}),e[2]=s,e[3]=n,e[4]=o,e[5]=l):l=e[5],l}function b1(t){const e=z.c(4),{inset:s}=t,n=s&&"ml-12";let i;e[0]!==n?(i=ie("h-px bg-border/50",n),e[0]=n,e[1]=i):i=e[1];let o;return e[2]!==i?(o=r.jsx("span",{className:i}),e[2]=i,e[3]=o):o=e[3],o}function x5(t){const e=z.c(28),{comment:s,isReply:n,resolved:i,onDelete:o,onToggleResolved:l}=t;let a;e[0]!==s.author?(a=r.jsx(ZL,{author:s.author}),e[0]=s.author,e[1]=a):a=e[1];let c;e[2]!==s.author.name?(c=r.jsx("span",{className:"text-sm font-medium text-foreground",children:s.author.name}),e[2]=s.author.name,e[3]=c):c=e[3];let d;e[4]!==s.createdAt?(d=Ol(new Date(s.createdAt)),e[4]=s.createdAt,e[5]=d):d=e[5];let u;e[6]!==d?(u=r.jsx("span",{className:"text-sm text-muted-foreground",children:d}),e[6]=d,e[7]=u):u=e[7];let h;e[8]!==o||e[9]!==l||e[10]!==i?(h=(o||l)&&r.jsx(Iq,{resolved:i,onDelete:o,onToggleResolved:l}),e[8]=o,e[9]=l,e[10]=i,e[11]=h):h=e[11];let f;e[12]!==a||e[13]!==c||e[14]!==u||e[15]!==h?(f=r.jsxs("div",{className:"flex items-center gap-2",children:[a,c,u,h]}),e[12]=a,e[13]=c,e[14]=u,e[15]=h,e[16]=f):f=e[16];const m=n&&"pl-8";let p;e[17]!==m?(p=ie("text-sm leading-relaxed text-foreground [&_li]:text-sm [&_p]:text-sm",m),e[17]=m,e[18]=p):p=e[18];let g;e[19]!==s.body||e[20]!==s.id?(g=r.jsx(Fo,{id:s.id,text:s.body}),e[19]=s.body,e[20]=s.id,e[21]=g):g=e[21];let x;e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:p,children:g}),e[22]=p,e[23]=g,e[24]=x):x=e[24];let b;return e[25]!==x||e[26]!==f?(b=r.jsxs("div",{className:"group flex flex-col gap-1.5 p-4",children:[f,x]}),e[25]=x,e[26]=f,e[27]=b):b=e[27],b}function Iq(t){const e=z.c(18),{resolved:s,onDelete:n,onToggleResolved:i}=t,o=re();let l;e[0]!==o?(l=o("taskBoard.taskDialog.commentActionsAriaLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(Gn,{size:16}),e[2]=a):a=e[2];let c;e[3]!==l?(c=r.jsx(Zt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":l,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-colors hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100",children:a})}),e[3]=l,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==o?(d=i&&r.jsxs(r.Fragment,{children:[r.jsxs(Xe,{onSelect:i,children:[r.jsx(qt,{size:16}),o(s?"taskBoard.taskDialog.commentUnresolveThread":"taskBoard.taskDialog.commentResolveThread")]}),r.jsx(Pr,{})]}),e[5]=i,e[6]=s,e[7]=o,e[8]=d):d=e[8];let u;e[9]!==n||e[10]!==o?(u=n&&r.jsxs(Xe,{variant:"destructive",onSelect:n,children:[r.jsx(f2,{size:16}),o("taskBoard.taskDialog.commentDelete")]}),e[9]=n,e[10]=o,e[11]=u):u=e[11];let h;e[12]!==d||e[13]!==u?(h=r.jsxs(es,{align:"end",className:"w-48",children:[d,u]}),e[12]=d,e[13]=u,e[14]=h):h=e[14];let f;return e[15]!==c||e[16]!==h?(f=r.jsxs(Xt,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=f):f=e[17],f}function ZL(t){const e=z.c(6),{author:s}=t;if(s.isAgent){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(sr,{size:24}),e[0]=l):l=e[0],l}const n=s.image??void 0;let i;e[1]!==s.name?(i=En(s.name),e[1]=s.name,e[2]=i):i=e[2];let o;return e[3]!==n||e[4]!==i?(o=r.jsx(Bs,{url:n,fallback:i,shape:"circle",size:"xs"}),e[3]=n,e[4]=i,e[5]=o):o=e[5],o}function ew(t){const e=z.c(27),{variant:s,placeholder:n,author:i,onSubmit:o}=t,l=re(),a=P.useRef(null),[c,d]=P.useState(!0);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>a.current?.submit(),e[0]=u):u=e[0];const h=u,f=s==="root"&&"min-h-10";let m;e[1]!==f?(m=ie("w-full [&_.tiptap]:outline-none",f),e[1]=f,e[2]=m):m=e[2];let p;e[3]!==o||e[4]!==n||e[5]!==m?(p=r.jsx(Vq,{ref:a,placeholder:n,onSubmit:o,onEmptyChange:d,className:m}),e[3]=o,e[4]=n,e[5]=m,e[6]=p):p=e[6];const g=p;let x;e[7]!==l?(x=l("taskBoard.taskDialog.commentSubmitAriaLabel"),e[7]=l,e[8]=x):x=e[8];let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(bf,{size:16}),e[9]=b):b=e[9];let v;e[10]!==c||e[11]!==x?(v=r.jsx("button",{type:"button",disabled:c,onClick:h,"aria-label":x,className:"flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40",children:b}),e[10]=c,e[11]=x,e[12]=v):v=e[12];const L=v;let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=()=>a.current?.focus(),e[13]=_):_=e[13];const y=_;if(s==="root"){let j;e[14]!==L?(j=r.jsx("div",{className:"flex items-center justify-end",children:L}),e[14]=L,e[15]=j):j=e[15];let N;return e[16]!==j||e[17]!==g?(N=r.jsxs("div",{"data-testid":"new-comment-composer",onClick:y,className:"relative flex cursor-text flex-col gap-1 rounded-xl bg-card p-3 card-shadow",children:[g,j]}),e[16]=j,e[17]=g,e[18]=N):N=e[18],N}let S;e[19]!==i?(S=r.jsx("span",{className:"mt-0.5 shrink-0",children:r.jsx(ZL,{author:i})}),e[19]=i,e[20]=S):S=e[20];let k;e[21]!==g?(k=r.jsx("div",{className:"min-w-0 flex-1 pt-0.5",children:g}),e[21]=g,e[22]=k):k=e[22];let w;return e[23]!==L||e[24]!==k||e[25]!==S?(w=r.jsxs("div",{"data-testid":"reply-composer",onClick:y,className:"relative flex cursor-text items-start gap-2 p-3",children:[S,k,L]}),e[23]=L,e[24]=k,e[25]=S,e[26]=w):w=e[26],w}function Mq(t){const e=t.filter(n=>!n.parentId).map(n=>({...n,replies:[]})),s=new Map(e.map(n=>[n.id,n]));for(const n of t)n.parentId&&s.get(n.parentId)?.replies.push(n);return e}function $q(t){const e=z.c(36),{locator:s}=Fe(),n=ys(),i=as();let o;e[0]!==t||e[1]!==s?(o=Qe.taskBoardComments(s,t??""),e[0]=t,e[1]=s,e[2]=o):o=e[2];const l=o,a=!!t;let c;e[3]!==t||e[4]!==n?(c=async()=>Mq((await n.call("TASK_BOARD_COMMENT_LIST",{taskBoardItemId:t})).comments),e[3]=t,e[4]=n,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==a||e[8]!==c?(d={queryKey:l,enabled:a,queryFn:c},e[6]=l,e[7]=a,e[8]=c,e[9]=d):d=e[9];const u=Pt(d);let h;e[10]!==i||e[11]!==l?(h=()=>i.invalidateQueries({queryKey:l}),e[10]=i,e[11]=l,e[12]=h):h=e[12];const f=h;let m;e[13]!==t||e[14]!==n?(m=w=>n.call("TASK_BOARD_COMMENT_CREATE",{taskBoardItemId:t,...w}),e[13]=t,e[14]=n,e[15]=m):m=e[15];let p;e[16]!==f||e[17]!==m?(p={mutationFn:m,onSuccess:f},e[16]=f,e[17]=m,e[18]=p):p=e[18];const g=Rs(p);let x;e[19]!==n?(x=w=>n.call("TASK_BOARD_COMMENT_UPDATE",w),e[19]=n,e[20]=x):x=e[20];let b;e[21]!==f||e[22]!==x?(b={mutationFn:x,onSuccess:f},e[21]=f,e[22]=x,e[23]=b):b=e[23];const v=Rs(b);let L;e[24]!==n?(L=w=>n.call("TASK_BOARD_COMMENT_DELETE",{id:w}),e[24]=n,e[25]=L):L=e[25];let _;e[26]!==f||e[27]!==L?(_={mutationFn:L,onSuccess:f},e[26]=f,e[27]=L,e[28]=_):_=e[28];const y=Rs(_);let S;e[29]!==u.data?(S=u.data??[],e[29]=u.data,e[30]=S):S=e[30];let k;return e[31]!==g||e[32]!==y||e[33]!==v||e[34]!==S?(k={threads:S,post:g,setResolved:v,remove:y},e[31]=g,e[32]=y,e[33]=v,e[34]=S,e[35]=k):k=e[35],k}function Oq(t){const e=z.c(24),{locator:s}=Fe(),n=ys(),i=as();let o;e[0]!==t||e[1]!==s?(o=Qe.notificationSubscribers(s,t??""),e[0]=t,e[1]=s,e[2]=o):o=e[2];const l=o,a=!!t;let c;e[3]!==t||e[4]!==n?(c=async()=>(await n.call("NOTIFICATION_SUBSCRIPTION_LIST",{taskBoardItemId:t})).userIds,e[3]=t,e[4]=n,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==a||e[8]!==c?(d={queryKey:l,enabled:a,queryFn:c},e[6]=l,e[7]=a,e[8]=c,e[9]=d):d=e[9];const u=Pt(d);let h;e[10]!==t||e[11]!==n?(h=b=>n.call("NOTIFICATION_SUBSCRIPTION_SET",{taskBoardItemId:t,subscribed:b}),e[10]=t,e[11]=n,e[12]=h):h=e[12];let f;e[13]!==i||e[14]!==l?(f=()=>i.invalidateQueries({queryKey:l}),e[13]=i,e[14]=l,e[15]=f):f=e[15];let m;e[16]!==h||e[17]!==f?(m={mutationFn:h,onSuccess:f},e[16]=h,e[17]=f,e[18]=m):m=e[18];const p=Rs(m);let g;e[19]!==u.data?(g=u.data??[],e[19]=u.data,e[20]=g):g=e[20];let x;return e[21]!==p||e[22]!==g?(x={subscriberIds:g,setSubscribed:p},e[21]=p,e[22]=g,e[23]=x):x=e[23],x}const Bq=3;function zq(t){const e=z.c(23),{itemId:s,members:n}=t,i=re(),{data:o}=In.useSession(),l=o?.user?.id,{subscriberIds:a,setSubscribed:c}=Oq(s);let d;e[0]!==l||e[1]!==a?(d=!!l&&a.includes(l),e[0]=l,e[1]=a,e[2]=d):d=e[2];const u=d;let h;if(e[3]!==s||e[4]!==n||e[5]!==l||e[6]!==c||e[7]!==u||e[8]!==a||e[9]!==i){const f=new Map(n.map(Hq)),m=l?f.get(l):void 0;let p;e[11]!==l?(p=k=>k!==l,e[11]=l,e[12]=p):p=e[12];const g=a.filter(p).map(k=>f.get(k)).filter(Uq),x=[...u&&m?[m]:[],...g],b=x.slice(0,Bq),v=x.length-b.length,L=!s||c.isPending;let _;e[13]!==c||e[14]!==u?(_=()=>c.mutate(!u),e[13]=c,e[14]=u,e[15]=_):_=e[15];let y;e[16]!==u||e[17]!==i?(y=i(u?"taskBoard.taskDialog.unsubscribe":"taskBoard.taskDialog.subscribe"),e[16]=u,e[17]=i,e[18]=y):y=e[18];let S;e[19]!==L||e[20]!==_||e[21]!==y?(S=r.jsx(he,{type:"button",variant:"ghost",size:"sm",disabled:L,onClick:_,className:"h-7 px-2 text-sm font-normal text-muted-foreground",children:y}),e[19]=L,e[20]=_,e[21]=y,e[22]=S):S=e[22],h=r.jsxs("div",{className:"flex items-center gap-2",children:[S,b.length>0&&r.jsxs("span",{className:"inline-flex items-center",title:x.map(k=>k.user?.name??i("taskBoard.taskDialog.someoneLabel")).join(", "),children:[b.map(Fq),v>0&&r.jsxs("span",{className:"-ml-2 inline-flex size-6 items-center justify-center rounded-full bg-muted text-[10px] font-medium text-muted-foreground ring-2 ring-background",children:["+",v]})]})]}),e[3]=s,e[4]=n,e[5]=l,e[6]=c,e[7]=u,e[8]=a,e[9]=i,e[10]=h}else h=e[10];return h}function Fq(t){return r.jsx(Bs,{url:t.user?.image??void 0,fallback:En(t.user?.name),shape:"circle",size:"xs",className:"-ml-2 ring-2 ring-background first:ml-0"},t.userId)}function Uq(t){return!!t}function Hq(t){return[t.userId,t]}function o3(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59).toISOString()}function tw(t){if(!t)return null;const e=new Date(t);return Number.isNaN(e.getTime())?null:e}const b5=560,Kq=2e3,sw=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),Ui="inline-flex h-9 items-center justify-start gap-2 rounded-lg border border-border px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted sm:border-transparent",v5=4,y5=1,xd="opacity-50";function Wq(t){const e=z.c(22),{threads:s}=t,n=re();let i,o,l,a,c,d;if(e[0]!==n||e[1]!==s){d=Symbol.for("react.early_return_sentinel");e:{const f=pq(s);if(!f){d=null;break e}const{total:m,runCount:p,onSubscription:g}=f,x=p===1,b=g?x?"taskBoard.taskDialog.costTooltipSubscriptionSingular":"taskBoard.taskDialog.costTooltipSubscriptionPlural":x?"taskBoard.taskDialog.costTooltipSingular":"taskBoard.taskDialog.costTooltipPlural";e[8]===Symbol.for("react.memo_cache_sentinel")?(l=ie(Ui,"cursor-default hover:bg-transparent"),e[8]=l):l=e[8];const v=String(p);e[9]!==n||e[10]!==v||e[11]!==b?(a=n(b,{runs:v}),e[9]=n,e[10]=v,e[11]=b,e[12]=a):a=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(KA,{size:16,className:"shrink-0 text-muted-foreground"}),e[13]=c):c=e[13],i="tabular-nums",o=n("taskBoard.taskDialog.costEstimatePrefix",{amount:m.toLocaleString(void 0,{style:"currency",currency:"USD"})})}e[0]=n,e[1]=s,e[2]=i,e[3]=o,e[4]=l,e[5]=a,e[6]=c,e[7]=d}else i=e[2],o=e[3],l=e[4],a=e[5],c=e[6],d=e[7];if(d!==Symbol.for("react.early_return_sentinel"))return d;let u;e[14]!==i||e[15]!==o?(u=r.jsx("span",{className:i,children:o}),e[14]=i,e[15]=o,e[16]=u):u=e[16];let h;return e[17]!==l||e[18]!==a||e[19]!==c||e[20]!==u?(h=r.jsxs("div",{className:l,title:a,children:[c,u]}),e[17]=l,e[18]=a,e[19]=c,e[20]=u,e[21]=h):h=e[21],h}function ch(t){const e=z.c(7),{label:s,children:n}=t;let i;e[0]!==s?(i=r.jsx("span",{className:"px-3 text-sm font-medium text-muted-foreground opacity-[0.74]",children:s}),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==n?(o=r.jsx("div",{className:"flex flex-wrap gap-2 sm:flex-col sm:items-start sm:gap-1",children:n}),e[2]=n,e[3]=o):o=e[3];let l;return e[4]!==i||e[5]!==o?(l=r.jsxs("div",{className:"flex flex-col gap-2",children:[i,o]}),e[4]=i,e[5]=o,e[6]=l):l=e[6],l}function qq(t){const e=z.c(7),{item:s}=t,n=re(),{data:i}=JL(s.id);if(!i||i.length===0)return null;let o;e[0]!==n?(o=n("taskBoard.taskDialog.reviewsLabel"),e[0]=n,e[1]=o):o=e[1];let l;e[2]!==i?(l=i.map(Gq),e[2]=i,e[3]=l):l=e[3];let a;return e[4]!==o||e[5]!==l?(a=r.jsx(ch,{label:o,children:l}),e[4]=o,e[5]=l,e[6]=a):a=e[6],a}function Gq(t){return r.jsx(he,{asChild:!0,variant:"ghost",className:"h-9 w-full justify-start gap-2 px-3 font-medium",children:r.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",title:t.title?`#${t.number} ${t.title}`:t.url,children:[r.jsx(yo,{size:16,className:"shrink-0"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:t.title??`#${t.number}`})]})},t.url)}function nw(t){const e=z.c(11),{label:s,action:n,children:i}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(_s,{size:14,className:"shrink-0 transition-transform group-data-[state=closed]:-rotate-90"}),e[0]=o):o=e[0];let l;e[1]!==s?(l=r.jsxs($y,{className:"group flex w-fit items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",children:[s,o]}),e[1]=s,e[2]=l):l=e[2];let a;e[3]!==n||e[4]!==l?(a=r.jsxs("div",{className:"flex min-h-7 items-center justify-between gap-2",children:[l,n]}),e[3]=n,e[4]=l,e[5]=a):a=e[5];let c;e[6]!==i?(c=r.jsx(Oy,{children:i}),e[6]=i,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==c?(d=r.jsxs(By,{defaultOpen:!0,className:"flex flex-col gap-2",children:[a,c]}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d}function iw(t){const e=z.c(449),{chrome:s,open:n,onClose:i,item:o,defaultStatus:l,onSubmit:a,onDelete:c,onClone:d,onArchive:u,onOpenPreview:h,onNewChat:f,onAutoFix:m,onRerun:p,isSaving:g}=t,x=n===void 0?!0:n,b=re(),{org:v}=Fe(),{data:L}=Iu();let _;e[0]!==L?.data?.members?(_=L?.data?.members??[],e[0]=L?.data?.members,e[1]=_):_=e[1];const y=_,S=S2("delivery_lanes_enabled"),{handleCopy:k,copied:w}=J9(),{handleCopy:j,copied:N}=J9(),{handleCopy:T,copied:C}=J9(),{data:V}=z2();let A;e[2]!==V?(A=V===void 0?[]:V,e[2]=V,e[3]=A):A=e[3];const E=A,D=tP(),I=sP();let R;e[4]===Symbol.for("react.memo_cache_sentinel")?(R={slug:"mcp-github"},e[4]=R):R=e[4];const $=q6(ci(R)),B=o?.title??"",M=o?.description??"",O=o?.status??l??"triage",F=o?.priority??"medium",U=o?.type??JA,K=o?.assigneeId??null,q=o?.repo??null,W=o?.dueDate;let G;e[5]!==W?(G=tw(W),e[5]=W,e[6]=G):G=e[6];let Y;e[7]!==o?.tags?(Y=o?.tags.map(Xq)??[],e[7]=o?.tags,e[8]=Y):Y=e[8];let ee;e[9]!==U||e[10]!==K||e[11]!==q||e[12]!==G||e[13]!==Y||e[14]!==B||e[15]!==M||e[16]!==O||e[17]!==F?(ee={title:B,description:M,status:O,priority:F,type:U,assigneeId:K,repo:q,dueDate:G,tagIds:Y},e[9]=U,e[10]=K,e[11]=q,e[12]=G,e[13]=Y,e[14]=B,e[15]=M,e[16]=O,e[17]=F,e[18]=ee):ee=e[18];const[ne,oe]=P.useState(ee),{title:Z,description:J,status:H,priority:se,assigneeId:Q,repo:ce,dueDate:te}=ne,le=ne.type,ue=J6(),fe=o?.sprintId?ue.get(o.sprintId)??null:null,ae=ne.tagIds,[de,X]=P.useState(!1),[pe,ye]=P.useState(!1),we=pe&&!de;let _e;e[19]===Symbol.for("react.memo_cache_sentinel")?(_e=Ie=>{if(!Ie)return;const St=()=>ye(Ie.scrollHeight>b5);St();const Ft=new ResizeObserver(St);return Ft.observe(Ie),()=>Ft.disconnect()},e[19]=_e):_e=e[19];const Pe=_e,[Se,Te]=P.useState(!1),[ve,ke]=P.useState(!1),[Le,Ne]=P.useState(!1),[et,Ye]=P.useState(null);let ze;e[20]!==o?.threads||e[21]!==et?(ze=o?.threads.find(Ie=>Ie.threadId===et)??null,e[20]=o?.threads,e[21]=et,e[22]=ze):ze=e[22];const Me=ze,at=P.useRef(ne),Ze=P.useRef(null),it=P.useRef(a);let rt;e[23]===Symbol.for("react.memo_cache_sentinel")?(rt=()=>{Ze.current=null;const Ie=at.current;Ie.title.trim()&&it.current({title:Ie.title.trim(),description:Ie.description.trim()||null,status:Ie.status,priority:Ie.priority,type:Ie.type,assigneeId:Ie.assigneeId,repo:Ie.repo,dueDate:Ie.dueDate?o3(Ie.dueDate):null,tagIds:Ie.tagIds})},e[23]=rt):rt=e[23];const dt=rt;let nt;e[24]!==dt||e[25]!==o||e[26]!==a?(nt=(Ie,St)=>{const Ft=St===void 0?!1:St,Ps={...at.current,...Ie};at.current=Ps,it.current=a,oe(Ps),o&&(Ze.current&&clearTimeout(Ze.current),Ft?Ze.current=setTimeout(dt,Kq):dt())},e[24]=dt,e[25]=o,e[26]=a,e[27]=nt):nt=e[27];const Re=nt;let ft;e[28]!==dt?(ft=()=>{Ze.current&&(clearTimeout(Ze.current),dt())},e[28]=dt,e[29]=ft):ft=e[29];const ut=ft;let be;e[30]===Symbol.for("react.memo_cache_sentinel")?(be=()=>{Ze.current&&(clearTimeout(Ze.current),Ze.current=null)},e[30]=be):be=e[30];const qe=be;let tt;e[31]!==ut||e[32]!==i?(tt=()=>{ut(),i()},e[31]=ut,e[32]=i,e[33]=tt):tt=e[33];const Ue=tt;let Lt;e[34]!==ut?(Lt=Ie=>{if(Ie)return()=>ut()},e[34]=ut,e[35]=Lt):Lt=e[35];const wt=Lt;let ht;e[36]!==Ue?(ht=Ie=>{if(!Ie)return;const St=Ft=>{if(Ft.key!=="Escape"||Ft.defaultPrevented||document.querySelector('[data-radix-popper-content-wrapper], [role="dialog"][data-state="open"]'))return;const Ps=Ft.target;if(Ps instanceof HTMLElement&&(Ps.isContentEditable||Ps instanceof HTMLInputElement||Ps instanceof HTMLTextAreaElement)){Ps.blur();return}Ue()};return document.addEventListener("keydown",St),()=>document.removeEventListener("keydown",St)},e[36]=Ue,e[37]=ht):ht=e[37];const Tt=ht;let $e;e[38]!==D||e[39]!==Re?($e=async(Ie,St)=>{const Ft=await D.mutateAsync({name:Ie,color:St});Re({tagIds:[...at.current.tagIds,Ft.id]})},e[38]=D,e[39]=Re,e[40]=$e):$e=e[40];const ct=$e;let kt;e[41]!==I||e[42]!==Re?(kt=Ie=>{I.mutate(Ie),Re({tagIds:at.current.tagIds.filter(St=>St!==Ie)})},e[41]=I,e[42]=Re,e[43]=kt):kt=e[43];const xt=kt,yt=Q===ks,me=o&&m&&(H==="triage"||H==="todo")&&!yt,Ae=o&&p&&o.assigneeId===ks;let Oe;e[44]!==o||e[45]!==v?(Oe=o?Y6(v.slug,o.keySeq,o.jiraIssueKey):null,e[44]=o,e[45]=v,e[46]=Oe):Oe=e[46];const je=Oe;let ot;if(e[47]!==Q||e[48]!==y){let Ie;e[50]!==Q?(Ie=St=>St.userId===Q,e[50]=Q,e[51]=Ie):Ie=e[51],ot=y.find(Ie),e[47]=Q,e[48]=y,e[49]=ot}else ot=e[49];const mt=ot;let $t;e[52]!==o||e[53]!==y?($t=o?.assignedBy?y.find(Ie=>Ie.userId===o.assignedBy):void 0,e[52]=o,e[53]=y,e[54]=$t):$t=e[54];const At=$t,hn=ii[H].icon;let Ot,As,$n,_t,Fs,fn,ln,mn,Ce,st,Dt,Ls,Js,an,On;if(e[55]!==s||e[56]!==Ue||e[57]!==w||e[58]!==T||e[59]!==j||e[60]!==J||e[61]!==ut||e[62]!==k||e[63]!==C||e[64]!==g||e[65]!==o||e[66]!==je||e[67]!==N||e[68]!==u||e[69]!==m||e[70]!==d||e[71]!==c||e[72]!==f||e[73]!==p||e[74]!==v||e[75]!==Re||e[76]!==me||e[77]!==Ae||e[78]!==H||e[79]!==b||e[80]!==Z){Ot=!!o&&n8(o);let Ie;e[96]!==s||e[97]!==Ue||e[98]!==T||e[99]!==C||e[100]!==je||e[101]!==b?(Ie=s==="page"?r.jsx(BA,{className:"-ml-2",children:r.jsxs(zA,{className:"text-[15px]",children:[r.jsx(Lx,{children:r.jsx(FA,{asChild:!0,className:"rounded-md px-2 py-1 text-muted-foreground hover:bg-accent",children:r.jsx("button",{type:"button",onClick:Ue,children:b("taskBoard.taskDetail.breadcrumbTasks")})})}),r.jsx(UA,{}),r.jsx(Lx,{children:r.jsx(HA,{className:"px-2 py-1",children:je??b("taskBoard.taskDetail.breadcrumbTask")})})]})}):je?r.jsxs(he,{variant:"ghost",size:"sm",title:je,"aria-label":b("taskBoard.taskDialog.copyIdAriaLabel"),className:"-ml-2 gap-2 px-2 text-[15px] text-muted-foreground hover:text-foreground",onClick:()=>{T(je),ge.success(b("taskBoard.taskDialog.idCopied"))},children:[C?r.jsx(qt,{size:16}):r.jsx(gx,{size:16}),je]}):r.jsxs("span",{"aria-hidden":!0,className:"flex h-7 items-center gap-2 text-[15px] text-muted-foreground opacity-50",children:[r.jsx(gx,{size:16}),"–"]}),e[96]=s,e[97]=Ue,e[98]=T,e[99]=C,e[100]=je,e[101]=b,e[102]=Ie):Ie=e[102];let St;e[103]!==g||e[104]!==o||e[105]!==b?(St=o&&g&&r.jsx("span",{className:"mr-1 text-sm text-muted-foreground",children:b("taskBoard.taskDialog.savingLabel")}),e[103]=g,e[104]=o,e[105]=b,e[106]=St):St=e[106];let Ft;e[107]!==w||e[108]!==j||e[109]!==J||e[110]!==k||e[111]!==o||e[112]!==je||e[113]!==N||e[114]!==u||e[115]!==m||e[116]!==d||e[117]!==c||e[118]!==f||e[119]!==p||e[120]!==v||e[121]!==me||e[122]!==Ae||e[123]!==H||e[124]!==b?(Ft=o&&r.jsxs(r.Fragment,{children:[r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":b("taskBoard.taskDialog.shareAriaLabel"),title:b("taskBoard.taskDialog.shareTitle"),className:"text-muted-foreground hover:text-foreground",onClick:()=>{j(`${window.location.origin}/${v.slug}/t/${je??o.id}`),ge.success(b("taskBoard.taskDialog.linkCopied"))},children:N?r.jsx(qt,{size:16}):r.jsx(GT,{size:16})}),r.jsxs(Xt,{modal:!1,children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":b("taskBoard.taskDialog.moreActionsAriaLabel"),className:"text-muted-foreground hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground",children:r.jsx(Gn,{size:16})})}),r.jsxs(es,{align:"end",className:"w-48",children:[f&&r.jsxs(Xe,{onSelect:f,children:[r.jsx(Nf,{size:16}),b("taskBoard.taskDialog.newChatButton")]}),me&&r.jsxs(Xe,{onSelect:m,children:[r.jsx(Ml,{size:16}),b("taskBoard.taskBoard.autoFix")]}),Ae&&r.jsxs(Xe,{onSelect:p,children:[r.jsx(Dn,{size:16}),b("taskBoard.taskBoard.rerun")]}),(f||me||Ae)&&r.jsx(Pr,{}),J&&r.jsxs(Xe,{onSelect:()=>k(J),children:[w?r.jsx(qt,{size:16}):r.jsx(dn,{size:16}),b("taskBoard.taskDialog.copyDescription")]}),d&&r.jsxs(Xe,{onSelect:d,children:[r.jsx(YT,{size:16}),b("taskBoard.taskDialog.cloneTask")]}),u&&H!=="archived"&&r.jsxs(Xe,{onSelect:()=>{qe(),u()},children:[r.jsx(Sy,{size:16}),b("taskBoard.taskDialog.archiveTask")]}),c&&r.jsxs(Xe,{variant:"destructive",onSelect:()=>{qe(),c()},children:[r.jsx(f2,{size:16}),b("taskBoard.taskDialog.deleteTask")]})]})]})]}),e[107]=w,e[108]=j,e[109]=J,e[110]=k,e[111]=o,e[112]=je,e[113]=N,e[114]=u,e[115]=m,e[116]=d,e[117]=c,e[118]=f,e[119]=p,e[120]=v,e[121]=me,e[122]=Ae,e[123]=H,e[124]=b,e[125]=Ft):Ft=e[125];let Ps;e[126]!==s||e[127]!==Ue||e[128]!==b?(Ps=s==="dialog"&&r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":b("taskBoard.taskDialog.closeAriaLabel"),className:"text-muted-foreground hover:text-foreground",onClick:Ue,children:r.jsx(Is,{size:16})}),e[126]=s,e[127]=Ue,e[128]=b,e[129]=Ps):Ps=e[129];let lo;e[130]!==St||e[131]!==Ft||e[132]!==Ps?(lo=r.jsxs("div",{className:"flex items-center gap-0.5",children:[St,Ft,Ps]}),e[130]=St,e[131]=Ft,e[132]=Ps,e[133]=lo):lo=e[133];let m0;e[134]!==Ie||e[135]!==lo?(m0=r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-6 pb-4 pt-6 sm:px-8",children:[Ie,lo]}),e[134]=Ie,e[135]=lo,e[136]=m0):m0=e[136];const p0=m0;e[137]!==s||e[138]!==p0?(On=s==="page"?r.jsx("div",{className:"mx-auto w-full max-w-[1040px]",children:p0}):p0,e[137]=s,e[138]=p0,e[139]=On):On=e[139],an="flex min-h-0 flex-1 flex-col overflow-y-auto";const K9=s==="page"&&"mx-auto w-full max-w-[1040px]";e[140]!==K9?(Js=ie("flex flex-col sm:flex-row",K9),e[140]=K9,e[141]=Js):Js=e[141],Ls="flex min-w-0 flex-col gap-2 p-6 sm:flex-1 sm:p-8 sm:pt-6",As=Qq,$n=Z,_t=g0=>{Ot||(Re({title:g0.target.value},!0),g0.target.style.height="auto",g0.target.style.height=`${g0.target.scrollHeight}px`)},Fs=Jq,fn=ut,e[142]!==b?(ln=b("taskBoard.taskDialog.taskTitlePlaceholder"),e[142]=b,e[143]=ln):ln=e[143],mn=!0,Ce=1,st=Ot,Dt=ie("w-full resize-none overflow-hidden border-0 bg-transparent text-2xl font-semibold leading-snug text-foreground outline-none placeholder:text-foreground/30",Ot&&"cursor-default"),e[55]=s,e[56]=Ue,e[57]=w,e[58]=T,e[59]=j,e[60]=J,e[61]=ut,e[62]=k,e[63]=C,e[64]=g,e[65]=o,e[66]=je,e[67]=N,e[68]=u,e[69]=m,e[70]=d,e[71]=c,e[72]=f,e[73]=p,e[74]=v,e[75]=Re,e[76]=me,e[77]=Ae,e[78]=H,e[79]=b,e[80]=Z,e[81]=Ot,e[82]=As,e[83]=$n,e[84]=_t,e[85]=Fs,e[86]=fn,e[87]=ln,e[88]=mn,e[89]=Ce,e[90]=st,e[91]=Dt,e[92]=Ls,e[93]=Js,e[94]=an,e[95]=On}else Ot=e[81],As=e[82],$n=e[83],_t=e[84],Fs=e[85],fn=e[86],ln=e[87],mn=e[88],Ce=e[89],st=e[90],Dt=e[91],Ls=e[92],Js=e[93],an=e[94],On=e[95];let cs;e[144]!==As||e[145]!==$n||e[146]!==_t||e[147]!==Fs||e[148]!==fn||e[149]!==ln||e[150]!==mn||e[151]!==Ce||e[152]!==st||e[153]!==Dt?(cs=r.jsx("textarea",{ref:As,value:$n,onChange:_t,onKeyDown:Fs,onBlur:fn,placeholder:ln,autoFocus:mn,rows:Ce,readOnly:st,className:Dt}),e[144]=As,e[145]=$n,e[146]=_t,e[147]=Fs,e[148]=fn,e[149]=ln,e[150]=mn,e[151]=Ce,e[152]=st,e[153]=Dt,e[154]=cs):cs=e[154];let fr;e[155]!==Ot||e[156]!==b?(fr=Ot&&r.jsxs("p",{className:"mb-3 mt-1 flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Vu,{size:12}),b("taskBoard.taskDialog.reportsContentLocked")]}),e[155]=Ot,e[156]=b,e[157]=fr):fr=e[157];let Wr;e[158]!==cs||e[159]!==fr?(Wr=r.jsxs("div",{children:[cs,fr]}),e[158]=cs,e[159]=fr,e[160]=Wr):Wr=e[160];const Ql=we&&"overflow-hidden";let mr;e[161]!==Ql?(mr=ie("relative",Ql),e[161]=Ql,e[162]=mr):mr=e[162];let qr;e[163]!==we?(qr=we?{maxHeight:b5}:void 0,e[163]=we,e[164]=qr):qr=e[164];let Bn;e[165]===Symbol.for("react.memo_cache_sentinel")?(Bn=()=>X(!0),e[165]=Bn):Bn=e[165];let pr;e[166]!==Re?(pr=Ie=>Re({description:Ie},!0),e[166]=Re,e[167]=pr):pr=e[167];let Gr;e[168]!==b?(Gr=b("taskBoard.taskDialog.descriptionPlaceholder"),e[168]=b,e[169]=Gr):Gr=e[169];const Xo=!Ot;let Yr;e[170]!==J||e[171]!==pr||e[172]!==Gr||e[173]!==Xo?(Yr=r.jsx("div",{ref:Pe,"data-testid":"task-description",children:r.jsx(fq,{defaultValue:J,onChange:pr,placeholder:Gr,editable:Xo})}),e[170]=J,e[171]=pr,e[172]=Gr,e[173]=Xo,e[174]=Yr):Yr=e[174];let Xn;e[175]!==we?(Xn=we&&r.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-background to-transparent"}),e[175]=we,e[176]=Xn):Xn=e[176];let gr;e[177]!==ut||e[178]!==mr||e[179]!==qr||e[180]!==Yr||e[181]!==Xn?(gr=r.jsxs("div",{className:mr,style:qr,onFocusCapture:Bn,onBlurCapture:ut,children:[Yr,Xn]}),e[177]=ut,e[178]=mr,e[179]=qr,e[180]=Yr,e[181]=Xn,e[182]=gr):gr=e[182];let Jr;e[183]!==de||e[184]!==pe||e[185]!==b?(Jr=pe&&r.jsxs(he,{type:"button",variant:"ghost",size:"sm",className:"mt-2 w-fit text-muted-foreground hover:text-foreground",onClick:()=>X(Yq),children:[r.jsx(_s,{size:14,className:ie("transition-transform",de&&"rotate-180")}),b(de?"taskBoard.taskDialog.showLess":"taskBoard.taskDialog.showMore")]}),e[183]=de,e[184]=pe,e[185]=b,e[186]=Jr):Jr=e[186];let Qr;e[187]!==gr||e[188]!==Jr?(Qr=r.jsxs("div",{className:"flex flex-col py-6",children:[gr,Jr]}),e[187]=gr,e[188]=Jr,e[189]=Qr):Qr=e[189];let Xr;e[190]!==o?(Xr=o&&r.jsx("div",{className:"py-4",children:r.jsx("hr",{className:"border-border"})}),e[190]=o,e[191]=Xr):Xr=e[191];let Zo;e[192]!==At||e[193]!==mt||e[194]!==J||e[195]!==o||e[196]!==y||e[197]!==h||e[198]!==Ye?(Zo=o&&r.jsxs("div",{className:"flex flex-col gap-8",children:[r.jsx(cG,{item:o,description:J,onOpenPreview:h}),r.jsx(hG,{item:o,members:y,startedBy:At??mt,onOpenThread:Ie=>Ye(Ie.threadId)})]}),e[192]=At,e[193]=mt,e[194]=J,e[195]=o,e[196]=y,e[197]=h,e[198]=Ye,e[199]=Zo):Zo=e[199];let Zr;e[200]!==Qr||e[201]!==Xr||e[202]!==Zo?(Zr=r.jsxs("div",{className:"flex flex-col",children:[Qr,Xr,Zo]}),e[200]=Qr,e[201]=Xr,e[202]=Zo,e[203]=Zr):Zr=e[203];let eo;e[204]!==Ls||e[205]!==Wr||e[206]!==Zr?(eo=r.jsxs("div",{className:Ls,children:[Wr,Zr]}),e[204]=Ls,e[205]=Wr,e[206]=Zr,e[207]=eo):eo=e[207];const D9="flex w-full shrink-0 flex-col gap-8 border-t border-border p-6 sm:sticky sm:top-0 sm:max-h-dvh sm:w-[300px] sm:self-start sm:overflow-y-auto sm:border-t-0";let Ii;e[208]!==o?(Ii=o&&r.jsx(qq,{item:o}),e[208]=o,e[209]=Ii):Ii=e[209];const el=ch;let to;e[210]!==b?(to=b("taskBoard.taskDialog.propertiesLabel"),e[210]=b,e[211]=to):to=e[211];let so;e[212]!==o||e[213]!==H?(so=ie(o?Z6({...o,status:H}):ii[H].iconClassName),e[212]=o,e[213]=H,e[214]=so):so=e[214];let no;e[215]!==hn||e[216]!==so?(no=r.jsx(hn,{size:16,className:so}),e[215]=hn,e[216]=so,e[217]=no):no=e[217];const Mi=ii[H];let xr;e[218]!==b||e[219]!==Mi.labelKey?(xr=b(Mi.labelKey),e[218]=b,e[219]=Mi.labelKey,e[220]=xr):xr=e[220];let br;e[221]!==no||e[222]!==xr?(br=r.jsx(Zt,{asChild:!0,children:r.jsxs("button",{type:"button",className:Ui,children:[no,xr]})}),e[221]=no,e[222]=xr,e[223]=br):br=e[223];let $i;if(e[224]!==S||e[225]!==Re||e[226]!==b){let Ie;e[228]!==Re||e[229]!==b?(Ie=St=>{const Ft=ii[St].icon;return r.jsxs(Xe,{onSelect:()=>Re({status:St}),className:"gap-2",children:[r.jsx(Ft,{size:16,className:ii[St].iconClassName}),b(ii[St].labelKey)]},St)},e[228]=Re,e[229]=b,e[230]=Ie):Ie=e[230],$i=e8(S).map(Ie),e[224]=S,e[225]=Re,e[226]=b,e[227]=$i}else $i=e[227];let vr;e[231]!==$i?(vr=r.jsx(es,{align:"start",className:"w-44",children:$i}),e[231]=$i,e[232]=vr):vr=e[232];let io;e[233]!==br||e[234]!==vr?(io=r.jsxs(Xt,{children:[br,vr]}),e[233]=br,e[234]=vr,e[235]=io):io=e[235];let Oi;e[236]!==Ot||e[237]!==b?(Oi=Ot?b("taskBoard.taskDialog.reportsContentLocked"):void 0,e[236]=Ot,e[237]=b,e[238]=Oi):Oi=e[238];const cd=Ot&&"cursor-default opacity-60";let fi;e[239]!==cd?(fi=ie(Ui,cd),e[239]=cd,e[240]=fi):fi=e[240];const ro=xo[le].icon;let tl;e[241]!==ro?(tl=r.jsx(ro,{size:16}),e[241]=ro,e[242]=tl):tl=e[242];const dd=tl,Xl=xo[le];let oo;e[243]!==b||e[244]!==Xl.labelKey?(oo=b(Xl.labelKey),e[243]=b,e[244]=Xl.labelKey,e[245]=oo):oo=e[245];let xe;e[246]!==Ot||e[247]!==Oi||e[248]!==fi||e[249]!==dd||e[250]!==oo?(xe=r.jsx(Zt,{asChild:!0,children:r.jsxs("button",{type:"button",disabled:Ot,title:Oi,className:fi,children:[dd,oo]})}),e[246]=Ot,e[247]=Oi,e[248]=fi,e[249]=dd,e[250]=oo,e[251]=xe):xe=e[251];let De;e[252]!==Re||e[253]!==b?(De=t8.map(Ie=>{const St=xo[Ie].icon;return r.jsxs(Xe,{onSelect:()=>Re({type:Ie}),children:[r.jsx(St,{size:16}),b(xo[Ie].labelKey)]},Ie)}),e[252]=Re,e[253]=b,e[254]=De):De=e[254];let vt;e[255]!==De?(vt=r.jsx(es,{align:"start",className:"w-44",children:De}),e[255]=De,e[256]=vt):vt=e[256];let Vt;e[257]!==xe||e[258]!==vt?(Vt=r.jsxs(Xt,{children:[xe,vt]}),e[257]=xe,e[258]=vt,e[259]=Vt):Vt=e[259];let ws;e[260]!==Ot||e[261]!==b?(ws=Ot?b("taskBoard.taskDialog.reportsContentLocked"):void 0,e[260]=Ot,e[261]=b,e[262]=ws):ws=e[262];const zn=se==="none"&&xd,vn=Ot&&"cursor-default opacity-60";let Zl;e[263]!==zn||e[264]!==vn?(Zl=ie(Ui,zn,vn),e[263]=zn,e[264]=vn,e[265]=Zl):Zl=e[265];let ea;e[266]!==se||e[267]!==b?(ea=se==="none"?r.jsxs(r.Fragment,{children:[r.jsx(Gn,{size:16}),b("taskBoard.taskDialog.setPriorityButton")]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:ie("size-2 rounded-full",Wn[se].dotClassName)}),b(Wn[se].labelKey)]}),e[266]=se,e[267]=b,e[268]=ea):ea=e[268];let ta;e[269]!==Ot||e[270]!==ws||e[271]!==Zl||e[272]!==ea?(ta=r.jsx(Zt,{asChild:!0,children:r.jsx("button",{type:"button",disabled:Ot,title:ws,className:Zl,children:ea})}),e[269]=Ot,e[270]=ws,e[271]=Zl,e[272]=ea,e[273]=ta):ta=e[273];let sa;e[274]!==Re||e[275]!==b?(sa=Ff.map(Ie=>r.jsxs(Xe,{onSelect:()=>Re({priority:Ie}),children:[r.jsx("span",{className:ie("size-2 rounded-full",Wn[Ie].dotClassName)}),b(Wn[Ie].labelKey)]},Ie)),e[274]=Re,e[275]=b,e[276]=sa):sa=e[276];let na;e[277]!==sa?(na=r.jsx(es,{align:"start",className:"w-40",children:sa}),e[277]=sa,e[278]=na):na=e[278];let ia;e[279]!==ta||e[280]!==na?(ia=r.jsxs(Xt,{children:[ta,na]}),e[279]=ta,e[280]=na,e[281]=ia):ia=e[281];const R9=!Q&&xd;let ra;e[282]!==R9?(ra=ie(Ui,R9),e[282]=R9,e[283]=ra):ra=e[283];let oa;e[284]!==At||e[285]!==mt||e[286]!==yt||e[287]!==b?(oa=yt&&At?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"hidden items-center gap-2 sm:flex",children:[r.jsx(Bs,{url:At.user?.image??void 0,fallback:En(At.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:At.user?.name??b("taskBoard.taskDialog.superAgentDefaultName")})]}),r.jsxs("span",{className:"flex items-center gap-2 sm:hidden",children:[r.jsxs("span",{className:"inline-flex items-center",children:[r.jsx(Bs,{url:At.user?.image??void 0,fallback:En(At.user?.name),shape:"circle",size:"2xs",className:"-mr-1.5 ring-2 ring-background"}),r.jsx(sr,{size:16,className:"ring-2 ring-background"})]}),b("taskBoard.taskDialog.superAgentLabel")]})]}):yt?r.jsxs(r.Fragment,{children:[r.jsx(sr,{size:16}),b("taskBoard.taskDialog.superAgentLabel")]}):mt?r.jsxs(r.Fragment,{children:[r.jsx(Bs,{url:mt.user?.image??void 0,fallback:En(mt.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate",children:mt.user?.name??b("taskBoard.taskDialog.unassignedLabel")})]}):r.jsxs(r.Fragment,{children:[r.jsx(f6,{size:16,className:"text-muted-foreground"}),b("taskBoard.taskDialog.assignButton")]}),e[284]=At,e[285]=mt,e[286]=yt,e[287]=b,e[288]=oa):oa=e[288];let la;e[289]!==ra||e[290]!==oa?(la=r.jsx(ms,{asChild:!0,children:r.jsx("button",{type:"button",className:ra,children:oa})}),e[289]=ra,e[290]=oa,e[291]=la):la=e[291];let aa;e[292]!==o?.assigneeId||e[293]!==p||e[294]!==Re?(aa=Ie=>{if(ke(!1),Ie===ks&&o?.assigneeId===ks){p?.();return}Re({assigneeId:Ie})},e[292]=o?.assigneeId,e[293]=p,e[294]=Re,e[295]=aa):aa=e[295];let ca;e[296]!==y||e[297]!==aa?(ca=r.jsx(bs,{align:"start",className:"w-56 p-0",children:r.jsx(r3,{members:y,onSelect:aa})}),e[296]=y,e[297]=aa,e[298]=ca):ca=e[298];let da;e[299]!==ve||e[300]!==ca||e[301]!==la?(da=r.jsxs(vs,{open:ve,onOpenChange:ke,modal:!0,children:[la,ca]}),e[299]=ve,e[300]=ca,e[301]=la,e[302]=da):da=e[302];let ua;e[303]!==At||e[304]!==yt||e[305]!==b?(ua=yt&&At&&r.jsxs("div",{className:"relative mt-1.5 hidden items-center pl-5 sm:flex",children:[r.jsx("span",{className:"absolute -top-1.5 left-5 h-[calc(50%+0.375rem)] w-2.5 rounded-bl-md border-b border-l border-border"}),r.jsxs("span",{className:ie(Ui,"pointer-events-none"),children:[r.jsx(sr,{size:16}),b("taskBoard.taskDialog.superAgentLabel")]})]}),e[303]=At,e[304]=yt,e[305]=b,e[306]=ua):ua=e[306];let ha;e[307]!==da||e[308]!==ua?(ha=r.jsxs("div",{className:"flex flex-col",children:[da,ua]}),e[307]=da,e[308]=ua,e[309]=ha):ha=e[309];const I9=!te&&xd;let fa;e[310]!==I9?(fa=ie(Ui,I9),e[310]=I9,e[311]=fa):fa=e[311];let c0;e[312]===Symbol.for("react.memo_cache_sentinel")?(c0=r.jsx(Bl,{size:16,className:"text-muted-foreground"}),e[312]=c0):c0=e[312];let ma;e[313]!==te||e[314]!==b?(ma=te?sw.format(te):b("taskBoard.taskDialog.dueDateLabel"),e[313]=te,e[314]=b,e[315]=ma):ma=e[315];let pa;e[316]!==fa||e[317]!==ma?(pa=r.jsx(ms,{asChild:!0,children:r.jsxs("button",{type:"button",className:fa,children:[c0,ma]})}),e[316]=fa,e[317]=ma,e[318]=pa):pa=e[318];const M9=te??void 0;let ga;e[319]!==Re?(ga=Ie=>{Re({dueDate:Ie??null}),Ie&&Te(!1)},e[319]=Re,e[320]=ga):ga=e[320];let xa;e[321]!==M9||e[322]!==ga?(xa=r.jsx(bs,{className:"w-auto p-0",align:"start",children:r.jsx(jf,{mode:"single",selected:M9,onSelect:ga,initialFocus:!0})}),e[321]=M9,e[322]=ga,e[323]=xa):xa=e[323];let ba;e[324]!==Se||e[325]!==pa||e[326]!==xa?(ba=r.jsxs(vs,{open:Se,onOpenChange:Te,children:[pa,xa]}),e[324]=Se,e[325]=pa,e[326]=xa,e[327]=ba):ba=e[327];const $9=fe&&r.jsxs("span",{className:ie(Ui,"cursor-default"),children:[r.jsx(G6,{size:16,className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:fe.name}),r.jsx("span",{className:"shrink-0 text-muted-foreground",children:fe.state==="active"?b("taskBoard.taskDialog.sprintCurrent"):VA(fe)})]}),O9=o?.threads;let va;e[328]!==O9?(va=r.jsx(Wq,{threads:O9}),e[328]=O9,e[329]=va):va=e[329];let ya;e[330]!==el||e[331]!==ha||e[332]!==ba||e[333]!==$9||e[334]!==va||e[335]!==to||e[336]!==io||e[337]!==Vt||e[338]!==ia?(ya=r.jsxs(el,{label:to,children:[io,Vt,ia,ha,ba,$9,va]}),e[330]=el,e[331]=ha,e[332]=ba,e[333]=$9,e[334]=va,e[335]=to,e[336]=io,e[337]=Vt,e[338]=ia,e[339]=ya):ya=e[339];let _a;e[340]!==b?(_a=b("taskBoard.taskDialog.labelsLabel"),e[340]=b,e[341]=_a):_a=e[341];let La;e[342]!==E||e[343]!==Re||e[344]!==Ne||e[345]!==b||e[346]!==ae?(La=ae.length===0?r.jsx(ms,{asChild:!0,children:r.jsxs("button",{type:"button",className:ie(Ui,xd),children:[r.jsx($2,{size:16}),b("taskBoard.taskDialog.tagsButton")]})}):r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:px-3",children:[ae.map(Ie=>{const St=E.find(Ft=>Ft.id===Ie);return St?r.jsxs("button",{type:"button",onClick:()=>Ne(!0),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-muted",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ou(St.color)}}),r.jsx("span",{className:"truncate",children:St.name}),r.jsx("span",{role:"button",tabIndex:0,"aria-label":b("taskBoard.taskDialog.removeTagAriaLabel",{name:St.name}),className:"-mr-0.5 flex size-3.5 items-center justify-center rounded-sm text-muted-foreground hover:bg-background hover:text-foreground",onClick:Ft=>{Ft.stopPropagation(),Re({tagIds:ae.filter(Ps=>Ps!==Ie)})},onKeyDown:Ft=>{(Ft.key==="Enter"||Ft.key===" ")&&(Ft.preventDefault(),Ft.stopPropagation(),Re({tagIds:ae.filter(Ps=>Ps!==Ie)}))},children:r.jsx(Is,{size:10})})]},Ie):null}),r.jsx(ms,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":b("taskBoard.taskDialog.addTagButton"),className:"flex size-7 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r.jsx(Ht,{size:14})})})]}),e[342]=E,e[343]=Re,e[344]=Ne,e[345]=b,e[346]=ae,e[347]=La):La=e[347];let wa;e[348]!==E.length?(wa=QA(E.length),e[348]=E.length,e[349]=wa):wa=e[349];let Sa;e[350]!==Re||e[351]!==ae?(Sa=Ie=>Re({tagIds:ae.includes(Ie)?ae.filter(St=>St!==Ie):[...ae,Ie]}),e[350]=Re,e[351]=ae,e[352]=Sa):Sa=e[352];let ka;e[353]!==ct||e[354]!==xt||e[355]!==E||e[356]!==wa||e[357]!==Sa||e[358]!==ae?(ka=r.jsx(bs,{align:"start",className:"w-56 p-0",children:r.jsx(wq,{tags:E,selectedIds:ae,defaultColor:wa,onToggle:Sa,onCreate:ct,onDelete:xt})}),e[353]=ct,e[354]=xt,e[355]=E,e[356]=wa,e[357]=Sa,e[358]=ae,e[359]=ka):ka=e[359];let ja;e[360]!==Ne||e[361]!==La||e[362]!==ka||e[363]!==Le?(ja=r.jsxs(vs,{open:Le,onOpenChange:Ne,modal:!0,children:[La,ka]}),e[360]=Ne,e[361]=La,e[362]=ka,e[363]=Le,e[364]=ja):ja=e[364];let Ca;e[365]!==_a||e[366]!==ja?(Ca=r.jsx(ch,{label:_a,children:ja}),e[365]=_a,e[366]=ja,e[367]=Ca):Ca=e[367];const B9=ch;let Na;e[368]!==b?(Na=b("taskBoard.taskDialog.projectLabel"),e[368]=b,e[369]=Na):Na=e[369];const z9=Xt,F9=!ce&&xd;let Ta;e[370]!==F9?(Ta=ie(Ui,"max-w-full",F9),e[370]=F9,e[371]=Ta):Ta=e[371];let d0;e[372]===Symbol.for("react.memo_cache_sentinel")?(d0=r.jsx(Jn,{className:"size-4 shrink-0"}),e[372]=d0):d0=e[372];let Va;e[373]!==ce||e[374]!==b?(Va=ce??b("taskBoard.taskDialog.repoButton"),e[373]=ce,e[374]=b,e[375]=Va):Va=e[375];let Aa;e[376]!==Va?(Aa=r.jsx("span",{className:"min-w-0 truncate text-left",children:Va}),e[376]=Va,e[377]=Aa):Aa=e[377];let Pa;e[378]!==Ta||e[379]!==Aa?(Pa=r.jsx(Zt,{asChild:!0,children:r.jsxs("button",{type:"button",className:Ta,children:[d0,Aa]})}),e[378]=Ta,e[379]=Aa,e[380]=Pa):Pa=e[380];const U9=es,bC="start",vC="w-56";let Ea;e[381]!==Re?(Ea=()=>Re({repo:null}),e[381]=Re,e[382]=Ea):Ea=e[382];let Da;e[383]!==b?(Da=b("taskBoard.taskDialog.noRepo"),e[383]=b,e[384]=Da):Da=e[384];let Ra;e[385]!==Ea||e[386]!==Da?(Ra=r.jsx(Xe,{onSelect:Ea,children:Da}),e[385]=Ea,e[386]=Da,e[387]=Ra):Ra=e[387];let u0;e[388]!==Re?(u0=Ie=>r.jsxs(Xe,{className:"gap-2",onSelect:()=>Re({repo:Ie}),children:[r.jsx(Jn,{className:"size-4 shrink-0"}),r.jsx("span",{className:"truncate",children:Ie})]},Ie),e[388]=Re,e[389]=u0):u0=e[389];const H9=$.map(u0);let Ia;e[390]!==U9||e[391]!==Ra||e[392]!==H9?(Ia=r.jsxs(U9,{align:bC,className:vC,children:[Ra,H9]}),e[390]=U9,e[391]=Ra,e[392]=H9,e[393]=Ia):Ia=e[393];let Ma;e[394]!==z9||e[395]!==Pa||e[396]!==Ia?(Ma=r.jsxs(z9,{children:[Pa,Ia]}),e[394]=z9,e[395]=Pa,e[396]=Ia,e[397]=Ma):Ma=e[397];let $a;e[398]!==B9||e[399]!==Na||e[400]!==Ma?($a=r.jsx(B9,{label:Na,children:Ma}),e[398]=B9,e[399]=Na,e[400]=Ma,e[401]=$a):$a=e[401];let Oa;e[402]!==ya||e[403]!==Ca||e[404]!==$a||e[405]!==Ii?(Oa=r.jsxs("div",{className:D9,children:[Ii,ya,Ca,$a]}),e[402]=ya,e[403]=Ca,e[404]=$a,e[405]=Ii,e[406]=Oa):Oa=e[406];let Ba;e[407]!==Oa||e[408]!==Js||e[409]!==eo?(Ba=r.jsxs("div",{className:Js,children:[eo,Oa]}),e[407]=Oa,e[408]=Js,e[409]=eo,e[410]=Ba):Ba=e[410];let za;e[411]!==Ba||e[412]!==an?(za=r.jsx("div",{className:an,children:Ba}),e[411]=Ba,e[412]=an,e[413]=za):za=e[413];let Fa;e[414]!==Ye?(Fa=()=>Ye(null),e[414]=Ye,e[415]=Fa):Fa=e[415];let Ua;e[416]!==Me||e[417]!==Fa?(Ua=r.jsx(Nq,{thread:Me,onClose:Fa}),e[416]=Me,e[417]=Fa,e[418]=Ua):Ua=e[418];let Ha;e[419]!==dt||e[420]!==g||e[421]!==o||e[422]!==b||e[423]!==Z?(Ha=!o&&r.jsx("div",{className:"flex h-16 items-center justify-end border-t border-border px-4",children:r.jsxs(he,{size:"sm",disabled:!Z.trim()||g,onClick:dt,children:[r.jsx(Ht,{size:16}),b("taskBoard.taskDialog.createTaskButton")]})}),e[419]=dt,e[420]=g,e[421]=o,e[422]=b,e[423]=Z,e[424]=Ha):Ha=e[424];let h0;e[425]!==za||e[426]!==Ua||e[427]!==Ha||e[428]!==On?(h0=r.jsxs(r.Fragment,{children:[On,za,Ua,Ha]}),e[425]=za,e[426]=Ua,e[427]=Ha,e[428]=On,e[429]=h0):h0=e[429];const Ka=h0;if(s==="page"){let Ie;e[430]!==Tt||e[431]!==wt?(Ie=Ft=>{const Ps=Tt(Ft),lo=wt(Ft);return()=>{Ps?.(),lo?.()}},e[430]=Tt,e[431]=wt,e[432]=Ie):Ie=e[432];let St;return e[433]!==Ka||e[434]!==Ie?(St=r.jsx("div",{ref:Ie,"data-testid":"task-detail",className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:Ka}),e[433]=Ka,e[434]=Ie,e[435]=St):St=e[435],St}let Wa;e[436]!==Ue?(Wa=Ie=>!Ie&&Ue(),e[436]=Ue,e[437]=Wa):Wa=e[437];let qa;e[438]!==b?(qa=b("taskBoard.taskDialog.newTaskTitle"),e[438]=b,e[439]=qa):qa=e[439];let Ga;e[440]!==qa?(Ga=r.jsx(Kt,{className:"sr-only",children:qa}),e[440]=qa,e[441]=Ga):Ga=e[441];let Ya;e[442]!==Ka||e[443]!==Ga?(Ya=r.jsxs(Bt,{className:"flex max-h-[92vh] flex-col gap-0 overflow-hidden rounded-2xl p-0 sm:h-[90vh] sm:max-h-[820px] sm:max-w-[1040px]",closeButtonClassName:"hidden",children:[Ga,Ka]}),e[442]=Ka,e[443]=Ga,e[444]=Ya):Ya=e[444];let f0;return e[445]!==x||e[446]!==Wa||e[447]!==Ya?(f0=r.jsx(zt,{open:x,onOpenChange:Wa,children:Ya}),e[445]=x,e[446]=Wa,e[447]=Ya,e[448]=f0):f0=e[448],f0}function Yq(t){return!t}function Jq(t){t.key==="Enter"&&t.preventDefault()}function Qq(t){t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)}function Xq(t){return t.id}function rw(t){const e=z.c(2);let s;return e[0]!==t?(s=r.jsx(iw,{...t,chrome:"dialog"}),e[0]=t,e[1]=s):s=e[1],s}function Zq(t){const e=z.c(2);let s;return e[0]!==t?(s=r.jsx(iw,{...t,chrome:"page"}),e[0]=t,e[1]=s):s=e[1],s}function eG(t,e){switch(t.status){case"failed":return AA(t.failureKind)?{label:t.failureKind==="superseded"?e("taskBoard.taskDialog.threadStatusSuperseded"):e("taskBoard.taskDialog.threadStatusEndedAfterDelivery"),className:"text-muted-foreground",icon:bn}:{label:e("taskBoard.taskDialog.threadStatusError"),className:"text-destructive",icon:JT};case"requires_action":return{label:e("taskBoard.taskDialog.threadStatusNeedsInput"),className:"text-warning",icon:Eu};case"in_progress":return{label:e("taskBoard.taskDialog.threadStatusRunning"),className:"text-primary",icon:Af,spin:!0};case"completed":return{label:e("taskBoard.taskDialog.threadStatusCompleted"),className:"text-success",icon:hi};case"expired":return{label:e("taskBoard.taskDialog.threadStatusExpired"),className:"text-muted-foreground",icon:bn};default:return t.status}}function tG(t){const e=z.c(28),{thread:s,startedBy:n,onOpen:i}=t,o=re();let l;if(e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==s){const a=s.status?eG({...s,status:s.status},o):null,c=s.lastMessage;let d;e[5]!==s.title?(d=XA(s.title,"reviewer"),e[5]=s.title,e[6]=d):d=e[6];const u=d;let h;e[7]!==i||e[8]!==s?(h=()=>i?.(s),e[7]=i,e[8]=s,e[9]=h):h=e[9];let f;e[10]!==u?(f=u?r.jsx(Wg,{size:16,className:"shrink-0"}):r.jsx(sr,{size:16,className:"shrink-0"}),e[10]=u,e[11]=f):f=e[11];let m;e[12]!==o||e[13]!==s.title?(m=s.title||o("taskBoard.taskDialog.superAgentDefaultName"),e[12]=o,e[13]=s.title,e[14]=m):m=e[14];let p;e[15]!==m?(p=r.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==n||e[18]!==o?(g=n&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"shrink-0 text-sm text-muted-foreground/50",children:o("taskBoard.taskDialog.startedByLabel")}),r.jsx(Bs,{url:n.user?.image??void 0,fallback:En(n.user?.name),shape:"circle",size:"2xs"}),r.jsx("span",{className:"truncate text-sm text-foreground",children:n.user?.name??o("taskBoard.taskDialog.someoneLabel")})]}),e[17]=n,e[18]=o,e[19]=g):g=e[19];let x;e[20]!==i||e[21]!==o?(x=i&&r.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1 text-xs text-muted-foreground/60 group-hover:text-foreground",children:[o("taskBoard.taskDialog.openThreadHint"),r.jsx(nn,{size:14})]}),e[20]=i,e[21]=o,e[22]=x):x=e[22];let b;e[23]!==f||e[24]!==p||e[25]!==g||e[26]!==x?(b=r.jsxs("div",{className:"flex items-center gap-2",children:[f,p,g,x]}),e[23]=f,e[24]=p,e[25]=g,e[26]=x,e[27]=b):b=e[27],l=r.jsxs("button",{type:"button",disabled:!i,onClick:h,className:"group flex w-full flex-col gap-2 rounded-xl bg-card p-4 text-left card-shadow transition-colors enabled:hover:bg-muted/60 disabled:cursor-default",children:[b,a&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:ie("flex shrink-0 items-center gap-1.5",a.className),children:[r.jsx(a.icon,{size:15,className:ie(a.spin&&"animate-spin")}),r.jsx("span",{className:"text-sm",children:a.label})]}),c&&r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:c})]})]}),e[0]=i,e[1]=n,e[2]=o,e[3]=s,e[4]=l}else l=e[4];return l}function sG(t,e){return t.merged?{label:e("taskBoard.taskDialog.prStateMerged"),className:"text-special",icon:O2}:t.state==="closed"?{label:e("taskBoard.taskDialog.prStateClosed"),className:"text-destructive",icon:yo}:t.draft?{label:e("taskBoard.taskDialog.prStateDraft"),className:"text-muted-foreground",icon:yo}:{label:e("taskBoard.taskDialog.prStateOpen"),className:"text-success",icon:yo}}function nG(t,e){switch(t){case"passing":return{label:e("taskBoard.taskDialog.prChecksPassing"),className:"text-success",icon:hi};case"failing":return{label:e("taskBoard.taskDialog.prChecksFailing"),className:"text-destructive",icon:bn};case"pending":return{label:e("taskBoard.taskDialog.prChecksPending"),className:"text-warning",icon:Af};default:return null}}const iG=new Set(["failure","cancelled","timed_out","action_required","startup_failure","stale"]);function rG(t){if(t.status!=="completed")return{icon:Af,className:"text-warning",spin:!0};const e=t.conclusion;return e&&iG.has(e)?{icon:bn,className:"text-destructive",spin:!1}:e==="success"||e==="neutral"||e==="skipped"?{icon:hi,className:"text-success",spin:!1}:{icon:Eu,className:"text-muted-foreground",spin:!1}}function oG(t){const e=z.c(49),{pr:s,previewThread:n,reviewsReady:i,shipPending:o,resolvePending:l,onShip:a,onResolveConflict:c,onOpenPreview:d}=t,u=re(),[h,f]=P.useState(!1);let m;if(e[0]!==h||e[1]!==d||e[2]!==c||e[3]!==a||e[4]!==s||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==o||e[9]!==u){const p=sG(s,u),g=nG(s.checksStatus,u);let x;e[11]!==s||e[12]!==i?(x=gq(s,i),e[11]=s,e[12]=i,e[13]=x):x=e[13];const{isOpen:b,hasConflict:v,showShip:L,showResolveConflict:_}=x,y=!!n||!!s.previewUrl||L||_;let S;e[14]!==s.checks?(S=s.checks??[],e[14]=s.checks,e[15]=S):S=e[15];const k=S,w=k.length>0||g!=null,j=k.length>0;let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx(Jn,{className:"size-4 shrink-0 text-foreground"}),e[16]=N):N=e[16];const T=s.title??`${s.repoOwner}/${s.repoName}`;let C;e[17]!==T?(C=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:T}),e[17]=T,e[18]=C):C=e[18];const V=ie("flex shrink-0 items-center gap-1 text-xs font-medium",p.className);let A;e[19]!==p?(A=r.jsx(p.icon,{size:13}),e[19]=p,e[20]=A):A=e[20];let E;e[21]!==p||e[22]!==V||e[23]!==A?(E=r.jsxs("span",{className:V,children:[A,p.label]}),e[21]=p,e[22]=V,e[23]=A,e[24]=E):E=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(xn,{size:12,className:"text-muted-foreground/60 group-hover:text-foreground"}),e[25]=D):D=e[25];let I;e[26]!==s.number||e[27]!==s.url?(I=r.jsxs("a",{href:s.url,target:"_blank",rel:"noreferrer",title:s.url,className:"group flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted",children:["#",s.number,D]}),e[26]=s.number,e[27]=s.url,e[28]=I):I=e[28];let R;e[29]!==I||e[30]!==C||e[31]!==E?(R=r.jsxs("div",{className:"flex items-center gap-3",children:[N,C,E,I]}),e[29]=I,e[30]=C,e[31]=E,e[32]=R):R=e[32];let $;e[33]!==v||e[34]!==b||e[35]!==u?($=v&&b&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-warning",children:[r.jsx(bn,{size:13,className:"shrink-0"}),u("taskBoard.taskDialog.prConflict")]}),e[33]=v,e[34]=b,e[35]=u,e[36]=$):$=e[36];let B;e[37]!==y||e[38]!==d||e[39]!==c||e[40]!==a||e[41]!==s.previewUrl||e[42]!==n||e[43]!==l||e[44]!==o||e[45]!==_||e[46]!==L||e[47]!==u?(B=y&&r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&r.jsxs(he,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",title:u("taskBoard.taskDialog.openPreviewTitle"),onClick:()=>d?.(n),children:[r.jsx(Nf,{size:13}),u("taskBoard.taskDialog.openPreviewButton")]}),s.previewUrl&&r.jsx(he,{asChild:!0,type:"button",variant:"outline",size:"sm",className:"gap-1.5",children:r.jsxs("a",{href:s.previewUrl,target:"_blank",rel:"noreferrer",children:[r.jsx(Mn,{size:14}),u("taskBoard.taskDialog.previewLabel"),r.jsx(xn,{size:12})]})}),L&&r.jsx(he,{type:"button",variant:"success",size:"sm",disabled:o,onClick:a,children:u("taskBoard.taskDialog.shipToProductionButton")}),_&&r.jsxs(he,{type:"button",variant:"warning",size:"sm",className:"gap-1.5",disabled:l,title:u("taskBoard.taskDialog.resolveConflictTitle"),onClick:c,children:[r.jsx(O2,{size:13}),u("taskBoard.taskDialog.resolveConflictButton")]})]}),e[37]=y,e[38]=d,e[39]=c,e[40]=a,e[41]=s.previewUrl,e[42]=n,e[43]=l,e[44]=o,e[45]=_,e[46]=L,e[47]=u,e[48]=B):B=e[48],m=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-3 card-shadow",children:[R,$,B,w&&r.jsxs("div",{className:"border-t border-border pt-2 text-xs",children:[r.jsxs("button",{type:"button",disabled:!j,onClick:()=>f(lG),className:"flex w-full items-center gap-1.5 font-medium disabled:cursor-default",children:[g?r.jsx(g.icon,{size:13,className:g.className}):r.jsx(hi,{size:13,className:"text-muted-foreground"}),r.jsx("span",{className:ie(g?.className??"text-muted-foreground"),children:g?.label??u("taskBoard.taskDialog.prChecksLabel")}),j&&r.jsx(nn,{size:14,className:ie("ml-auto text-muted-foreground/60 transition-transform",h&&"rotate-90")})]}),h&&r.jsx("div",{className:"mt-2 flex flex-col gap-2",children:k.map(M=>{const O=rG(M);return r.jsxs("div",{className:"rounded-md bg-muted/40 p-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(O.icon,{size:13,className:ie("shrink-0",O.className,O.spin&&"animate-spin")}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:M.name}),M.detailsUrl&&r.jsx("a",{href:M.detailsUrl,target:"_blank",rel:"noreferrer",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:r.jsx(xn,{size:12})})]}),M.summary&&r.jsx("div",{className:"mt-1.5 max-h-64 overflow-auto text-muted-foreground",children:r.jsx(Fo,{id:`${s.url}-${M.name}`,text:M.summary})})]},M.name)})})]})]}),e[0]=h,e[1]=d,e[2]=c,e[3]=a,e[4]=s,e[5]=n,e[6]=l,e[7]=i,e[8]=o,e[9]=u,e[10]=m}else m=e[10];return m}function lG(t){return!t}function aG(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(bt,{className:"size-4 shrink-0 rounded"}),r.jsx(bt,{className:"h-4 min-w-0 flex-1"}),r.jsx(bt,{className:"h-4 w-16 shrink-0"}),r.jsx(bt,{className:"h-4 w-10 shrink-0"})]}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex flex-col gap-3 rounded-xl bg-card p-3 card-shadow",children:[e,r.jsxs("div",{className:"flex gap-2",children:[r.jsx(bt,{className:"h-7 w-20"}),r.jsx(bt,{className:"h-7 w-28"})]})]}),t[1]=s):s=t[1],s}function cG(t){const e=z.c(50),{item:s,description:n,onOpenPreview:i}=t,o=re(),{data:l,isLoading:a}=JL(s.id),{data:c}=QL(s.id),d=S6(),u=bq(s.id),h=vq(s.id);let f,m,p,g,x,b;if(e[0]!==c||e[1]!==n||e[2]!==s.status||e[3]!==s.threads||e[4]!==i||e[5]!==u||e[6]!==l||e[7]!==a||e[8]!==h||e[9]!==d||e[10]!==o){b=Symbol.for("react.early_return_sentinel");e:{const _=Sq(n),y=a&&!l;if(!y&&(!l||l.length===0)&&_.length===0){b=null;break e}let S;e[17]!==c||e[18]!==s.status||e[19]!==d?(S=Lq(s.status)&&yq(c??[],XL(d)),e[17]=c,e[18]=s.status,e[19]=d,e[20]=S):S=e[20];const k=S;let w;e[21]!==u||e[22]!==o?(w=()=>u.mutate(void 0,{onSuccess:A=>A?.merged?ge.success(o("taskBoard.taskDialog.shipSuccess")):ge.error(o("taskBoard.taskDialog.shipError")),onError:()=>ge.error(o("taskBoard.taskDialog.shipError"))}),e[21]=u,e[22]=o,e[23]=w):w=e[23];const j=w;let N;e[24]!==h||e[25]!==o?(N=A=>h.mutate(A,{onSuccess:()=>ge.success(o("taskBoard.taskDialog.resolveConflictSuccess")),onError:()=>ge.error(o("taskBoard.taskDialog.resolveConflictError"))}),e[24]=h,e[25]=o,e[26]=N):N=e[26];const T=N;let C;e[27]!==s.threads||e[28]!==i?(C=i?s.threads.find(uG):void 0,e[27]=s.threads,e[28]=i,e[29]=C):C=e[29];const V=C;f=nw,e[30]!==o?(x=o("taskBoard.taskDialog.linksLabel"),e[30]=o,e[31]=x):x=e[31],m="flex flex-col gap-1",e[32]!==y||e[33]!==i||e[34]!==T||e[35]!==j||e[36]!==V||e[37]!==u||e[38]!==l||e[39]!==h||e[40]!==k?(p=y?r.jsx(aG,{}):(l??[]).map(A=>r.jsx(oG,{pr:A,previewThread:V,reviewsReady:k,shipPending:u.isPending,resolvePending:h.isPending,onShip:j,onResolveConflict:()=>T(A.number),onOpenPreview:i},A.url)),e[32]=y,e[33]=i,e[34]=T,e[35]=j,e[36]=V,e[37]=u,e[38]=l,e[39]=h,e[40]=k,e[41]=p):p=e[41],g=_.map(dG)}e[0]=c,e[1]=n,e[2]=s.status,e[3]=s.threads,e[4]=i,e[5]=u,e[6]=l,e[7]=a,e[8]=h,e[9]=d,e[10]=o,e[11]=f,e[12]=m,e[13]=p,e[14]=g,e[15]=x,e[16]=b}else f=e[11],m=e[12],p=e[13],g=e[14],x=e[15],b=e[16];if(b!==Symbol.for("react.early_return_sentinel"))return b;let v;e[42]!==m||e[43]!==p||e[44]!==g?(v=r.jsxs("div",{className:m,children:[p,g]}),e[42]=m,e[43]=p,e[44]=g,e[45]=v):v=e[45];let L;return e[46]!==f||e[47]!==x||e[48]!==v?(L=r.jsx(f,{label:x,children:v}),e[46]=f,e[47]=x,e[48]=v,e[49]=L):L=e[49],L}function dG(t){return r.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"group flex items-center gap-2 rounded-md px-1 py-1.5 transition-colors hover:bg-muted",children:[r.jsx(Mn,{size:15,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:t.label}),r.jsx(xn,{size:13,className:"shrink-0 text-muted-foreground/50 group-hover:text-foreground"})]},t.url)}function uG(t){return t.hasPreview&&t.virtualMcpId}function hG(t){const e=z.c(7),{item:s,members:n,startedBy:i,onOpenThread:o}=t,l=re(),{data:a}=QL(s.id),{data:c}=In.useSession(),d=new Map(n.map(xG)),u={id:c?.user?.id??"me",name:c?.user?.name??l("taskBoard.taskDialog.commentYouLabel"),image:c?.user?.image},h=$q(s.id),f=L=>{if(L===ks)return{id:L,name:l("taskBoard.taskDialog.superAgentLabel"),isAgent:!0};if(L===u.id)return u;const _=d.get(L);return{id:L,name:_?.user?.name??L,image:_?.user?.image}},m=h.threads.map(L=>({id:L.id,author:f(L.authorId),body:L.body,createdAt:L.createdAt,resolved:L.resolved,replies:L.replies.map(_=>({id:_.id,author:f(_.authorId),body:_.body,createdAt:_.createdAt,replies:[]}))})),p=[...(a??[]).map(gG),...s.threads.map(pG),...m.map(mG)].sort(fG),g=[];for(const L of p){if(L.kind==="thread"){g.push({type:"thread",thread:L.thread});continue}if(L.kind==="comment"){g.push({type:"comment",comment:L.comment});continue}const _=g[g.length-1];_?.type==="timeline"?_.items.push(L.activity):g.push({type:"timeline",items:[L.activity]})}let x;e[0]!==l?(x=l("taskBoard.taskDialog.activityLabel"),e[0]=l,e[1]=x):x=e[1];let b;e[2]!==s.id||e[3]!==n?(b=r.jsx(zq,{itemId:s.id,members:n}),e[2]=s.id,e[3]=n,e[4]=b):b=e[4];let v;return e[5]!==h.post?(v=L=>h.post.mutate({body:L}),e[5]=h.post,e[6]=v):v=e[6],r.jsx(nw,{label:x,action:b,children:r.jsxs("div",{className:"flex flex-col gap-5",children:[r.jsx(Rq,{me:u,onSubmit:v}),g.map((L,_)=>L.type==="timeline"?r.jsx(vG,{items:L.items,memberByUserId:d},`timeline-${_}`):L.type==="comment"?r.jsx(Pq,{thread:L.comment,me:u,onReply:y=>h.post.mutate({body:y,parentId:L.comment.id}),onDelete:y=>h.remove.mutate(y),onToggleResolved:()=>h.setResolved.mutate({id:L.comment.id,resolved:!L.comment.resolved})},`comment-${L.comment.id}`):r.jsx(tG,{thread:L.thread,startedBy:i,onOpen:o},`thread-${L.thread.threadId}`))]})})}function fG(t,e){return e.at-t.at}function mG(t){return{kind:"comment",at:new Date(t.createdAt).getTime(),comment:t}}function pG(t){return{kind:"thread",at:new Date(t.createdAt).getTime(),thread:t}}function gG(t){return{kind:"activity",at:new Date(t.occurredAt).getTime(),activity:t}}function xG(t){return[t.userId,t]}function il(t){const e=z.c(7),{icon:s,label:n}=t;let i;e[0]!==s?(i=r.jsx("span",{className:"ml-1 mr-1 inline-flex h-[1lh] items-center align-top",children:s}),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==n?(o=r.jsx("span",{className:"mr-1",children:n}),e[2]=n,e[3]=o):o=e[3];let l;return e[4]!==i||e[5]!==o?(l=r.jsxs(r.Fragment,{children:[i,o]}),e[4]=i,e[5]=o,e[6]=l):l=e[6],l}const Uh="\0";function I0(t){return`${Uh}${t}${Uh}`}function rl(t,e){return t.split(new RegExp(`${Uh}(\\w+)${Uh}`)).map((s,n)=>r.jsx(P.Fragment,{children:n%2===0?s:e[s]},n))}function bd(t,e){return e(t==="qa"?"taskBoard.taskDialog.qaAgentLabel":t==="code_review"?"taskBoard.taskDialog.codeReviewerLabel":"taskBoard.taskDialog.reviewerLabel")}function bG(t,e,s){const n=f=>{const m=typeof f=="string"?ii[f]:void 0;if(!m)return String(f??"");const p=m.icon;return r.jsx(il,{icon:r.jsx(p,{size:14,className:m.iconClassName}),label:e(m.labelKey)})},i=f=>{const m=typeof f=="string"?Wn[f]:void 0;return m?r.jsx(il,{icon:r.jsx("span",{className:ie("size-2 rounded-full",m.dotClassName)}),label:e(m.labelKey)}):String(f??"")},o=f=>{const m=tw(typeof f=="string"?f:null);return m?r.jsx(il,{icon:r.jsx(Bl,{size:14,className:"text-muted-foreground"}),label:sw.format(m)}):""},l=f=>!Array.isArray(f)||f.length===0?null:f.map((m,p)=>{const g=m;return r.jsx(il,{icon:r.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:Ou(g.color)}}),label:g.name??""},g.id??p)}),a=f=>{if(f===ks)return r.jsx(il,{icon:r.jsx(sr,{size:14}),label:e("taskBoard.taskDialog.superAgentLabel")});const m=typeof f=="string"?s.get(f):void 0;return r.jsx(il,{icon:r.jsx(Bs,{url:m?.user?.image??void 0,fallback:En(m?.user?.name),shape:"circle",size:"2xs"}),label:m?.user?.name??e("taskBoard.taskDialog.someoneLabel")})},c=f=>r.jsx(il,{icon:r.jsx(Wg,{size:14}),label:bd(f,e)}),d=t.data,u=I0("from"),h=I0("to");switch(t.action){case"created":return e("taskBoard.taskDialog.activityCreated");case"status_changed":return typeof d.retry=="number"?e("taskBoard.taskDialog.activityRetryScheduled",{attempt:String(d.retry),of:String(d.of??d.retry),reason:String(d.reason??"")}):typeof d.retriesSpent=="number"&&d.retriesSpent>0?rl(e("taskBoard.taskDialog.activityRetriesExhausted",{to:h,count:String(d.retriesSpent)}),{to:n(d.to)}):rl(d.from?e("taskBoard.taskDialog.activityMovedFromTo",{from:u,to:h}):e("taskBoard.taskDialog.activityMovedTo",{to:h}),{from:n(d.from),to:n(d.to)});case"assignee_changed":return d.to==null?e("taskBoard.taskDialog.activityUnassigned"):rl(e(d.to===ks?"taskBoard.taskDialog.activityDelegated":"taskBoard.taskDialog.activityAssigned",{name:I0("name")}),{name:a(d.to)});case"type_changed":return d.from?e("taskBoard.taskDialog.activityTypeFromTo",{from:u,to:h}):e("taskBoard.taskDialog.activityTypeSet",{to:h});case"priority_changed":return d.to==="none"?e("taskBoard.taskDialog.activityPriorityCleared"):rl(!d.from||d.from==="none"?e("taskBoard.taskDialog.activityPrioritySet",{to:h}):e("taskBoard.taskDialog.activityPriorityFromTo",{from:u,to:h}),{from:i(d.from),to:i(d.to)});case"due_date_changed":return d.to==null?e("taskBoard.taskDialog.activityDueDateCleared"):rl(d.from==null?e("taskBoard.taskDialog.activityDueDateSet",{to:h}):e("taskBoard.taskDialog.activityDueDateFromTo",{from:u,to:h}),{from:o(d.from),to:o(d.to)});case"title_changed":return e("taskBoard.taskDialog.activityRenamed",{to:String(d.to??"")});case"description_changed":return e("taskBoard.taskDialog.activityDescriptionUpdated");case"tags_changed":return!Array.isArray(d.to)||d.to.length===0?e("taskBoard.taskDialog.activityTagsCleared"):rl(e("taskBoard.taskDialog.activityTagsSet",{to:h}),{to:l(d.to)});case"review_requested":return rl(e("taskBoard.taskDialog.activityDelegated",{name:I0("name")}),{name:c(d.reviewer)});case"review_approved":return typeof d.notes=="string"&&d.notes.trim()?e("taskBoard.taskDialog.activityReviewApprovedWithNotes",{reviewer:bd(d.reviewer,e),notes:d.notes}):e("taskBoard.taskDialog.activityReviewApproved",{reviewer:bd(d.reviewer,e)});case"review_changes_requested":return typeof d.notes=="string"&&d.notes.trim()?e("taskBoard.taskDialog.activityReviewChangesRequestedWithNotes",{reviewer:bd(d.reviewer,e),notes:d.notes}):e("taskBoard.taskDialog.activityReviewChangesRequested",{reviewer:bd(d.reviewer,e)});case"merge_conflict_resolution":return e("taskBoard.taskDialog.activityMergeConflictResolution");case"merge_failed":{const f=typeof d.detail=="string"?d.detail:"";switch(d.reason){case"no_pr":return e("taskBoard.taskDialog.activityMergeFailedNoPr");case"checks_failing":return e("taskBoard.taskDialog.activityMergeFailedChecksFailing");case"no_connection":return f?e("taskBoard.taskDialog.activityMergeFailedNoConnection",{detail:f}):e("taskBoard.taskDialog.activityMergeFailed");case"rate_limited":return e("taskBoard.taskDialog.activityMergeFailedRateLimited");case"refused":return f?e("taskBoard.taskDialog.activityMergeFailedRefused",{detail:f}):e("taskBoard.taskDialog.activityMergeFailed");default:return f?e("taskBoard.taskDialog.activityMergeFailedError",{detail:f}):e("taskBoard.taskDialog.activityMergeFailed")}}default:{const f=t.action;return String(f)}}}function _5(t){return!t||t===ks}function vG(t){const e=z.c(29),{items:s,memberByUserId:n}=t,i=re(),[o,l]=P.useState(!1);let a;e[0]!==n||e[1]!==i?(a=v=>_5(v)?i("taskBoard.taskDialog.superAgentLabel"):n.get(v)?.user?.name??i("taskBoard.taskDialog.someoneLabel"),e[0]=n,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==n?(d=v=>{if(_5(v))return r.jsx("span",{className:"z-10 flex size-4 shrink-0 items-center justify-center bg-background",children:r.jsx(sr,{size:16})});const L=n.get(v);return r.jsx("span",{className:"z-10 shrink-0 rounded-full bg-background",children:r.jsx(Bs,{url:L?.user?.image??void 0,fallback:En(L?.user?.name),shape:"circle",size:"2xs"})})},e[3]=n,e[4]=d):d=e[4];const u=d,h=s.length>v5&&!o;let f;e[5]!==h||e[6]!==s?(f=h?s.slice(0,y5):s,e[5]=h,e[6]=s,e[7]=f):f=e[7];const m=f;let p;e[8]!==m.length?(p=m.length>1&&r.jsx("span",{"aria-hidden":!0,className:"absolute bottom-3 left-2 top-3 w-px bg-border"}),e[8]=m.length,e[9]=p):p=e[9];let g;if(e[10]!==u||e[11]!==c||e[12]!==n||e[13]!==i||e[14]!==m){let v;e[16]!==u||e[17]!==c||e[18]!==n||e[19]!==i?(v=L=>r.jsxs("div",{className:"relative flex items-center gap-2.5",children:[u(L.actorId),r.jsxs("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:[c(L.actorId)," ",bG(L,i,n),r.jsxs("span",{className:"text-muted-foreground/60",children:[" · ",Ol(new Date(L.occurredAt))]})]})]},L.id),e[16]=u,e[17]=c,e[18]=n,e[19]=i,e[20]=v):v=e[20],g=m.map(v),e[10]=u,e[11]=c,e[12]=n,e[13]=i,e[14]=m,e[15]=g}else g=e[15];let x;e[21]!==o||e[22]!==s.length||e[23]!==i?(x=s.length>v5&&r.jsxs("button",{type:"button",onClick:()=>l(yG),className:"relative flex items-center gap-2.5 text-left",children:[r.jsx("span",{className:"z-10 flex size-4 shrink-0 items-center justify-center rounded-full bg-background text-muted-foreground/60",children:r.jsx(Gn,{size:14})}),r.jsx("span",{className:"text-xs text-muted-foreground/60 hover:text-foreground",children:o?i("taskBoard.taskDialog.timelineFoldLess"):i("taskBoard.taskDialog.timelineFoldMore",{count:String(s.length-y5)})})]}),e[21]=o,e[22]=s.length,e[23]=i,e[24]=x):x=e[24];let b;return e[25]!==p||e[26]!==g||e[27]!==x?(b=r.jsxs("div",{className:"relative flex flex-col gap-4",children:[p,g,x]}),e[25]=p,e[26]=g,e[27]=x,e[28]=b):b=e[28],b}function yG(t){return!t}const _G=[{id:"all",labelKey:"home.homeTasks.tabAll"},{id:"in_progress",labelKey:"home.homeTasks.tabInProgress"},{id:"in_review",labelKey:"home.homeTasks.tabInReview"},{id:"done",labelKey:"home.homeTasks.tabDone"}],LG=4;function wG(t){const e=z.c(64),{task:s,assignee:n,onOpen:i}=t,o=ii[s.status],l=o.icon,a=Wn[s.priority];let c,d,u,h,f,m,p,g,x,b,v,L,_,y;if(e[0]!==l||e[1]!==n?.user?.email||e[2]!==n?.user?.image||e[3]!==n?.user?.name||e[4]!==i||e[5]!==o.iconClassName||e[6]!==s.dueDate||e[7]!==s.title||e[8]!==s.updatedAt){const A=n?.user?.name??n?.user?.email?.split("@")[0]??null;let E;e[23]!==s.updatedAt?(E=Ol(new Date(s.updatedAt)),e[23]=s.updatedAt,e[24]=E):E=e[24],y=E;let D;e[25]!==s.dueDate?(D=s.dueDate?{label:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(s.dueDate)),overdue:new Date(s.dueDate).getTime()<Date.now()}:null,e[25]=s.dueDate,e[26]=D):D=e[26],d=D,v="button",L=i,_="flex w-full items-center gap-3 rounded-2xl bg-card px-4 py-3.5 text-left card-shadow transition-colors hover:bg-accent/60";let I;e[27]!==o.iconClassName?(I=ie("size-4 shrink-0",o.iconClassName),e[27]=o.iconClassName,e[28]=I):I=e[28],e[29]!==l||e[30]!==I?(h=r.jsx(l,{className:I}),e[29]=l,e[30]=I,e[31]=h):h=e[31],e[32]!==s.title?(f=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:s.title}),e[32]=s.title,e[33]=f):f=e[33],b="flex shrink-0 items-center gap-3 text-xs text-muted-foreground",x="hidden @2xl:inline-flex",c=Bs,u="circle",m="2xs",p=n?.user?.image??void 0,g=(A??"?").slice(0,2).toUpperCase(),e[0]=l,e[1]=n?.user?.email,e[2]=n?.user?.image,e[3]=n?.user?.name,e[4]=i,e[5]=o.iconClassName,e[6]=s.dueDate,e[7]=s.title,e[8]=s.updatedAt,e[9]=c,e[10]=d,e[11]=u,e[12]=h,e[13]=f,e[14]=m,e[15]=p,e[16]=g,e[17]=x,e[18]=b,e[19]=v,e[20]=L,e[21]=_,e[22]=y}else c=e[9],d=e[10],u=e[11],h=e[12],f=e[13],m=e[14],p=e[15],g=e[16],x=e[17],b=e[18],v=e[19],L=e[20],_=e[21],y=e[22];let S;e[34]!==c||e[35]!==u||e[36]!==m||e[37]!==p||e[38]!==g?(S=r.jsx(c,{shape:u,size:m,url:p,fallback:g}),e[34]=c,e[35]=u,e[36]=m,e[37]=p,e[38]=g,e[39]=S):S=e[39];let k;e[40]!==S||e[41]!==x?(k=r.jsx("span",{className:x,children:S}),e[40]=S,e[41]=x,e[42]=k):k=e[42];let w;e[43]!==a.flagClassName?(w=ie("size-3.5 shrink-0",a.flagClassName),e[43]=a.flagClassName,e[44]=w):w=e[44];let j;e[45]!==w?(j=r.jsx(zf,{className:w}),e[45]=w,e[46]=j):j=e[46];let N;e[47]!==d?(N=d&&r.jsxs("span",{className:ie("hidden items-center gap-1 @xl:inline-flex",d.overdue?"text-destructive":""),children:[r.jsx(Bl,{className:"size-3"}),d.label]}),e[47]=d,e[48]=N):N=e[48];let T;e[49]!==y?(T=r.jsx("span",{className:"hidden @xl:inline",children:y}),e[49]=y,e[50]=T):T=e[50];let C;e[51]!==k||e[52]!==j||e[53]!==N||e[54]!==T||e[55]!==b?(C=r.jsxs("div",{className:b,children:[k,j,N,T]}),e[51]=k,e[52]=j,e[53]=N,e[54]=T,e[55]=b,e[56]=C):C=e[56];let V;return e[57]!==h||e[58]!==f||e[59]!==C||e[60]!==v||e[61]!==L||e[62]!==_?(V=r.jsxs("button",{type:v,onClick:L,className:_,children:[h,f,C]}),e[57]=h,e[58]=f,e[59]=C,e[60]=v,e[61]=L,e[62]=_,e[63]=V):V=e[63],V}function SG(t,e){const s=t.filter(u=>u.status!=="done");if(s.length===0)return"";const n=s.filter(u=>u.status==="in_progress").length,i=s.filter(u=>u.status==="in_review").length,o=s.filter(u=>u.priority==="urgent"||u.priority==="high").length,l=s.filter(u=>u.dueDate&&new Date(u.dueDate).getTime()<Date.now()).length,a=[];n>0&&a.push(e("home.homeTasks.breakdownInProgress",{count:n})),i>0&&a.push(e("home.homeTasks.breakdownNeedsReview",{count:i}));let c=e("home.homeTasks.summaryLead",{count:s.length});a.length>0&&(c+=` — ${a.join(", ")}`),c+=".";const d=[];return o>0&&d.push(e("home.homeTasks.noteHighPriority",{count:o})),l>0&&d.push(e("home.homeTasks.noteOverdue",{count:l})),d.length>0?`${c} ${d.join(" ")}`:c}function kG(t){const e=z.c(49),{afterSummary:s}=t,n=re(),i=Yt(),{items:o,error:l}=Q6(),a=X6(),{data:c}=Iu();let d;if(e[0]!==c?.data?.members){const N=c?.data?.members??[];d=new Map(N.map(TG)),e[0]=c?.data?.members,e[1]=d}else d=e[1];const u=d,[h,f]=P.useState("all"),[m,p]=P.useState(!1);let g,x,b,v,L,_;if(e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==u||e[6]!==i||e[7]!==n||e[8]!==h){const N=(l?[]:o).filter(NG),T=[...N].sort(CG);let C;e[15]!==n?(C=(O,F)=>n(O,F),e[15]=n,e[16]=C):C=e[16];const V=SG(N,C),A=h==="all"?T:T.filter(O=>O.status===h);let E;e[17]!==i?(E=()=>i({to:".",search:jG}),e[17]=i,e[18]=E):E=e[18];const D=E;v="flex flex-col gap-10";let I;e[19]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(sr,{size:24,className:"mt-0.5"}),e[19]=I):I=e[19],L=r.jsxs("div",{className:"flex items-start gap-4 animate-in fade-in slide-in-from-top-1 duration-300",children:[I,r.jsx("p",{className:"max-w-3xl text-lg font-medium leading-snug text-foreground",children:V})]}),_=s,g="flex flex-col gap-4";let R;e[20]!==n?(R=n("home.homeTasks.tasksHeading"),e[20]=n,e[21]=R):R=e[21];let $;e[22]!==R?($=r.jsx("h2",{className:"text-base font-medium text-foreground",children:R}),e[22]=R,e[23]=$):$=e[23];let B;e[24]!==n||e[25]!==h?(B=_G.map(O=>r.jsx("button",{type:"button",onClick:()=>f(O.id),className:ie("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",h===O.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:n(O.labelKey)},O.id)),e[24]=n,e[25]=h,e[26]=B):B=e[26];let M;e[27]!==B?(M=r.jsx("div",{className:"flex items-center gap-1",children:B}),e[27]=B,e[28]=M):M=e[28],e[29]!==$||e[30]!==M?(x=r.jsxs("div",{className:"flex items-center gap-3",children:[$,M]}),e[29]=$,e[30]=M,e[31]=x):x=e[31],b=A.length===0?r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl bg-card px-4 py-10 text-center card-shadow",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:h==="all"?n("home.homeTasks.emptyStateNoTasks"):n("home.homeTasks.emptyStateNothing",{status:n(h==="in_progress"?"home.homeTasks.statusInProgress":h==="in_review"?"home.homeTasks.statusInReview":"home.homeTasks.statusDone")})}),h==="all"&&r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>p(!0),className:"gap-2",children:[r.jsx(Ht,{className:"size-4"}),n("home.homeTasks.createNewTask")]})]}):r.jsxs("div",{className:"flex flex-col gap-2",children:[A.slice(0,LG).map(O=>r.jsx(wG,{task:O,assignee:O.assigneeId?u.get(O.assigneeId):void 0,onOpen:D},O.id)),r.jsxs("button",{type:"button",onClick:D,className:"flex w-full items-center justify-center gap-1.5 rounded-2xl bg-card px-4 py-3 text-sm font-medium text-muted-foreground card-shadow transition-colors hover:bg-accent/60 hover:text-foreground",children:[n("home.homeTasks.seeAllTasks"),r.jsx(dy,{className:"size-3.5"})]})]}),e[2]=s,e[3]=l,e[4]=o,e[5]=u,e[6]=i,e[7]=n,e[8]=h,e[9]=g,e[10]=x,e[11]=b,e[12]=v,e[13]=L,e[14]=_}else g=e[9],x=e[10],b=e[11],v=e[12],L=e[13],_=e[14];let y;e[32]!==g||e[33]!==x||e[34]!==b?(y=r.jsxs("section",{className:g,children:[x,b]}),e[32]=g,e[33]=x,e[34]=b,e[35]=y):y=e[35];let S;e[36]===Symbol.for("react.memo_cache_sentinel")?(S=()=>p(!1),e[36]=S):S=e[36];let k;e[37]!==a.create?(k=N=>{a.create.mutate(N),p(!1)},e[37]=a.create,e[38]=k):k=e[38];let w;e[39]!==a.create.isPending||e[40]!==m||e[41]!==k?(w=r.jsx(rw,{open:m,onClose:S,isSaving:a.create.isPending,onSubmit:k}),e[39]=a.create.isPending,e[40]=m,e[41]=k,e[42]=w):w=e[42];let j;return e[43]!==w||e[44]!==v||e[45]!==L||e[46]!==_||e[47]!==y?(j=r.jsxs("div",{className:v,children:[L,_,y,w]}),e[43]=w,e[44]=v,e[45]=L,e[46]=_,e[47]=y,e[48]=j):j=e[48],j}function jG(t){return{...t,main:"board"}}function CG(t,e){return(e.updatedAt??"").localeCompare(t.updatedAt??"")}function NG(t){return t.status!=="archived"}function TG(t){return[t.userId,t]}function VG(t){const e=z.c(29),{isEditMode:s,hasChanges:n,onEnter:i,onSave:o,onCancel:l,onAddTile:a}=t,c=re();if(!s){let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(o6,{size:14}),e[0]=_):_=e[0];let y;e[1]!==c?(y=c("home.customizeToolbar.label"),e[1]=c,e[2]=y):y=e[2];let S;return e[3]!==i||e[4]!==y?(S=r.jsxs(he,{type:"button",size:"sm",variant:"ghost",onClick:i,className:"h-8 gap-1.5 text-muted-foreground",children:[_,y]}),e[3]=i,e[4]=y,e[5]=S):S=e[5],S}let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Ht,{size:14}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("home.customizeToolbar.addTile"),e[7]=c,e[8]=u):u=e[8];let h;e[9]!==a||e[10]!==u?(h=r.jsxs(he,{type:"button",size:"sm",variant:"ghost",onClick:a,className:"h-8 gap-1.5",children:[d,u]}),e[9]=a,e[10]=u,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(Is,{size:14}),e[12]=f):f=e[12];let m;e[13]!==c?(m=c("home.customizeToolbar.cancel"),e[13]=c,e[14]=m):m=e[14];let p;e[15]!==l||e[16]!==m?(p=r.jsxs(he,{type:"button",size:"sm",variant:"ghost",onClick:l,className:"h-8 gap-1.5",children:[f,m]}),e[15]=l,e[16]=m,e[17]=p):p=e[17];const g=!n;let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(qt,{size:14}),e[18]=x):x=e[18];let b;e[19]!==c?(b=c("home.customizeToolbar.save"),e[19]=c,e[20]=b):b=e[20];let v;e[21]!==o||e[22]!==g||e[23]!==b?(v=r.jsxs(he,{type:"button",size:"sm",onClick:o,disabled:g,className:"h-8 gap-1.5",children:[x,b]}),e[21]=o,e[22]=g,e[23]=b,e[24]=v):v=e[24];let L;return e[25]!==v||e[26]!==h||e[27]!==p?(L=r.jsxs("div",{className:"flex items-center gap-1",children:[h,p,v]}),e[25]=v,e[26]=h,e[27]=p,e[28]=L):L=e[28],L}function AG(){const t=z.c(18),{isEditMode:e,enter:s,save:n,cancel:i,hasChanges:o}=Eg(),[l,a]=P.useState(!1),c=Rf();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(kG,{afterSummary:r.jsx(Oz,{})}),t[0]=d):d=t[0];let u;t[1]!==i||t[2]!==s||t[3]!==o||t[4]!==e||t[5]!==c||t[6]!==n?(u=!c&&r.jsx("div",{className:"flex justify-end",children:r.jsx(VG,{isEditMode:e,hasChanges:o,onEnter:s,onSave:n,onCancel:i,onAddTile:()=>a(!0)})}),t[1]=i,t[2]=s,t[3]=o,t[4]=e,t[5]=c,t[6]=n,t[7]=u):u=t[7];let h;t[8]!==e?(h=r.jsx(mH,{isEditMode:e}),t[8]=e,t[9]=h):h=t[9];let f;t[10]!==u||t[11]!==h?(f=r.jsxs("div",{className:"@container mx-auto flex max-w-5xl flex-col gap-10 px-6 py-8",children:[d,r.jsxs("div",{className:"flex flex-col gap-4",children:[u,h]})]}),t[10]=u,t[11]=h,t[12]=f):f=t[12];let m;t[13]!==l?(m=r.jsx(zH,{open:l,onOpenChange:a}),t[13]=l,t[14]=m):m=t[14];let p;return t[15]!==f||t[16]!==m?(p=r.jsxs("div",{className:"h-full overflow-y-auto",children:[f,m]}),t[15]=f,t[16]=m,t[17]=p):p=t[17],p}function PG(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(Iz,{children:r.jsx(AG,{})}),t[0]=e):e=t[0],e}const EG=["taskBoard.subscriptionPaywall.trialBenefitMonitoring","taskBoard.subscriptionPaywall.trialBenefitAutoFix","taskBoard.subscriptionPaywall.trialBenefitRuns"],DG="https://decoims.com/image?src=decocms%2F7263a67f-fb83-410b-a5f2-e54e87deaaac%2Freport-kanban.png&quality=original&fit=cover";function RG(t){const e=z.c(83),{kind:s,onOpenChange:n}=t,i=re(),{mutate:o,isPending:l}=y6("ORGANIZATION_BILLING_CHECKOUT_START","taskBoard.subscriptionPaywall.checkoutError");if(s==="trial_exhausted"){let _;e[0]!==i?(_=i("taskBoard.subscriptionPaywall.previewAlt"),e[0]=i,e[1]=_):_=e[1];let y;e[2]!==_?(y=r.jsx("div",{className:"overflow-hidden rounded-xl bg-muted",children:r.jsx("img",{src:DG,alt:_,className:"h-[160px] w-full object-cover object-left-top"})}),e[2]=_,e[3]=y):y=e[3];let S;e[4]!==i?(S=i("taskBoard.subscriptionPaywall.trialTitle"),e[4]=i,e[5]=S):S=e[5];let k;e[6]!==S?(k=r.jsx(Kt,{className:"text-xl font-semibold text-foreground",children:S}),e[6]=S,e[7]=k):k=e[7];let w;e[8]!==i?(w=EG.map(W=>r.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[r.jsx(hi,{size:18,className:"mt-0.5 shrink-0 text-success","aria-hidden":!0}),r.jsx("span",{className:"leading-snug text-foreground",children:i(W)})]},W)),e[8]=i,e[9]=w):w=e[9];let j;e[10]!==w?(j=r.jsx("ul",{className:"flex flex-col gap-3",children:w}),e[10]=w,e[11]=j):j=e[11];let N;e[12]!==i?(N=i("taskBoard.subscriptionPaywall.trialPrice"),e[12]=i,e[13]=N):N=e[13];let T;e[14]!==N?(T=r.jsx("span",{className:"text-2xl font-semibold text-foreground",children:N}),e[14]=N,e[15]=T):T=e[15];let C;e[16]!==i?(C=i("taskBoard.subscriptionPaywall.trialPricePeriod"),e[16]=i,e[17]=C):C=e[17];let V;e[18]!==C?(V=r.jsx("span",{className:"text-sm text-muted-foreground",children:C}),e[18]=C,e[19]=V):V=e[19];let A;e[20]!==V||e[21]!==T?(A=r.jsxs("div",{className:"flex items-baseline gap-1.5",children:[T,V]}),e[20]=V,e[21]=T,e[22]=A):A=e[22];let E;e[23]!==n?(E=()=>n(!1),e[23]=n,e[24]=E):E=e[24];let D;e[25]!==i?(D=i("taskBoard.subscriptionPaywall.notNowButton"),e[25]=i,e[26]=D):D=e[26];let I;e[27]!==l||e[28]!==E||e[29]!==D?(I=r.jsx(he,{variant:"ghost",onClick:E,disabled:l,className:"order-2 w-full sm:order-none sm:w-auto",children:D}),e[27]=l,e[28]=E,e[29]=D,e[30]=I):I=e[30];let R;e[31]!==n||e[32]!==o?(R=()=>o(void 0,{onSuccess:()=>n(!1)}),e[31]=n,e[32]=o,e[33]=R):R=e[33];let $;e[34]!==l?($=l&&r.jsx(lt,{size:16,className:"animate-spin"}),e[34]=l,e[35]=$):$=e[35];let B;e[36]!==i?(B=i("taskBoard.subscriptionPaywall.subscribeButton"),e[36]=i,e[37]=B):B=e[37];let M;e[38]!==l||e[39]!==R||e[40]!==$||e[41]!==B?(M=r.jsxs(he,{disabled:l,onClick:R,className:"order-1 w-full gap-2 sm:order-none sm:w-auto",children:[$,B]}),e[38]=l,e[39]=R,e[40]=$,e[41]=B,e[42]=M):M=e[42];let O;e[43]!==I||e[44]!==M?(O=r.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[I,M]}),e[43]=I,e[44]=M,e[45]=O):O=e[45];let F;e[46]!==A||e[47]!==O?(F=r.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[A,O]}),e[46]=A,e[47]=O,e[48]=F):F=e[48];let U;e[49]!==F||e[50]!==k||e[51]!==j?(U=r.jsxs("div",{className:"flex flex-col gap-6 px-3 pb-3 pt-7",children:[k,j,F]}),e[49]=F,e[50]=k,e[51]=j,e[52]=U):U=e[52];let K;e[53]!==y||e[54]!==U?(K=r.jsxs(Bt,{className:"gap-0 p-3 sm:max-w-[440px]",closeButtonClassName:"z-10 rounded-full bg-background/70 p-1 text-foreground backdrop-blur transition-colors hover:bg-background",children:[y,U]}),e[53]=y,e[54]=U,e[55]=K):K=e[55];let q;return e[56]!==n||e[57]!==K?(q=r.jsx(zt,{open:!0,onOpenChange:n,children:K}),e[56]=n,e[57]=K,e[58]=q):q=e[58],q}let a;e[59]!==s||e[60]!==i?(a=s?{monthly_exhausted:{title:i("taskBoard.subscriptionPaywall.monthlyTitle"),description:i("taskBoard.subscriptionPaywall.monthlyDescription")},runs_exhausted:{title:i("taskBoard.subscriptionPaywall.runsTitle"),description:i("taskBoard.subscriptionPaywall.runsDescription")}}[s]:null,e[59]=s,e[60]=i,e[61]=a):a=e[61];const c=a,d=!!s,u=c?.title;let h;e[62]!==u?(h=r.jsx(Kt,{children:u}),e[62]=u,e[63]=h):h=e[63];const f=c?.description;let m;e[64]!==f?(m=r.jsx(kn,{children:f}),e[64]=f,e[65]=m):m=e[65];let p;e[66]!==h||e[67]!==m?(p=r.jsxs(os,{children:[h,m]}),e[66]=h,e[67]=m,e[68]=p):p=e[68];let g;e[69]!==n?(g=()=>n(!1),e[69]=n,e[70]=g):g=e[70];let x;e[71]!==i?(x=i("taskBoard.subscriptionPaywall.dismissButton"),e[71]=i,e[72]=x):x=e[72];let b;e[73]!==g||e[74]!==x?(b=r.jsx(qn,{children:r.jsx(he,{variant:"ghost",onClick:g,children:x})}),e[73]=g,e[74]=x,e[75]=b):b=e[75];let v;e[76]!==b||e[77]!==p?(v=r.jsxs(Bt,{className:"sm:max-w-[440px]",children:[p,b]}),e[76]=b,e[77]=p,e[78]=v):v=e[78];let L;return e[79]!==n||e[80]!==v||e[81]!==d?(L=r.jsx(zt,{open:d,onOpenChange:n,children:v}),e[79]=n,e[80]=v,e[81]=d,e[82]=L):L=e[82],L}const IG=new Set(["completed","failed","expired"]);function MG(t){return t.threads.some(e=>e.status!==null&&!IG.has(e.status))}function $G(t){const e=z.c(43),{items:s,pending:n,onOpenChange:i,onConfirm:o}=t,l=re(),a=s.length;let c;e[0]!==s?(c=s.some(MG),e[0]=s,e[1]=c):c=e[1];const d=c,u=a>0;let h;e[2]!==a||e[3]!==l?(h=a>1?l("taskBoard.rerun.titleMany",{count:a}):l("taskBoard.rerun.title"),e[2]=a,e[3]=l,e[4]=h):h=e[4];let f;e[5]!==h?(f=r.jsx(Kt,{children:h}),e[5]=h,e[6]=f):f=e[6];let m;e[7]!==a||e[8]!==l||e[9]!==d?(m=a>1?l("taskBoard.rerun.descriptionMany",{count:a}):l(d?"taskBoard.rerun.descriptionTakeover":"taskBoard.rerun.description"),e[7]=a,e[8]=l,e[9]=d,e[10]=m):m=e[10];let p;e[11]!==m?(p=r.jsx(kn,{children:m}),e[11]=m,e[12]=p):p=e[12];let g;e[13]!==f||e[14]!==p?(g=r.jsxs(os,{children:[f,p]}),e[13]=f,e[14]=p,e[15]=g):g=e[15];let x;e[16]!==i?(x=()=>i(!1),e[16]=i,e[17]=x):x=e[17];let b;e[18]!==l?(b=l("taskBoard.rerun.cancel"),e[18]=l,e[19]=b):b=e[19];let v;e[20]!==n||e[21]!==x||e[22]!==b?(v=r.jsx(he,{variant:"outline",onClick:x,disabled:n,children:b}),e[20]=n,e[21]=x,e[22]=b,e[23]=v):v=e[23];let L;e[24]!==n?(L=n&&r.jsx(lt,{className:"size-4 animate-spin"}),e[24]=n,e[25]=L):L=e[25];let _;e[26]!==l?(_=l("taskBoard.rerun.confirm"),e[26]=l,e[27]=_):_=e[27];let y;e[28]!==o||e[29]!==n||e[30]!==L||e[31]!==_?(y=r.jsxs(he,{onClick:o,disabled:n,children:[L,_]}),e[28]=o,e[29]=n,e[30]=L,e[31]=_,e[32]=y):y=e[32];let S;e[33]!==v||e[34]!==y?(S=r.jsxs(qn,{children:[v,y]}),e[33]=v,e[34]=y,e[35]=S):S=e[35];let k;e[36]!==S||e[37]!==g?(k=r.jsxs(Bt,{className:"max-w-md",children:[g,S]}),e[36]=S,e[37]=g,e[38]=k):k=e[38];let w;return e[39]!==i||e[40]!==k||e[41]!==u?(w=r.jsx(zt,{open:u,onOpenChange:i,children:k}),e[39]=i,e[40]=k,e[41]=u,e[42]=w):w=e[42],w}const L5=380,OG=90,w5=5,BG="cubic-bezier(0.22, 0.61, 0.36, 1)";function zG(t,e,s,n=!0){const i=P.useRef(new Map),o=P.useRef(new Map),l=P.useRef(!1);P.useLayoutEffect(()=>{const a=t.current;if(!a)return;if(!n){l.current=!0;return}const c=l.current;l.current=!1;const d=a.querySelectorAll("[data-flip-id]"),u=new Map,h=i.current;i.current=u;const f=typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,m=[];for(const _ of d){const y=_.dataset.flipId;if(!y)continue;const S=_.getBoundingClientRect(),k=_.dataset.flipLane;if(u.set(y,{rect:S,lane:k}),!s||c)continue;const w=h.get(y);if(!w)continue;const j=w.rect.left-S.left,N=w.rect.top-S.top;(j||N)&&m.push({el:_,dx:j,dy:N,lane:w.lane!==k})}if(!s||f||m.length===0)return;const p=o.current,g=_=>{_ instanceof HTMLElement&&(p.set(_,(p.get(_)??0)+1),_.style.overflow="visible")},x=_=>{if(!(_ instanceof HTMLElement))return;const y=(p.get(_)??1)-1;if(y>0){p.set(_,y);return}p.delete(_),_.style.overflow=""};for(const _ of m){const y=_.lane?` rotate(${_.dx>0?w5:-w5}deg)`:"";_.el.style.transition="none",_.el.style.transform=`translate(${_.dx}px, ${_.dy}px)${y}`,_.lane&&(_.el.style.zIndex="10",g(_.el.closest("[data-lane-scroll]")))}let b=0;const v=[],L=requestAnimationFrame(()=>{for(const _ of m){const y=_.lane?b++*OG:0;_.el.style.transition=`transform ${L5}ms ${BG} ${y}ms`,_.el.style.transform="",v.push(window.setTimeout(()=>{_.el.style.transition="",_.el.style.transform="",_.el.style.zIndex="",_.lane&&x(_.el.closest("[data-lane-scroll]"))},L5+y+30))}});return()=>{cancelAnimationFrame(L);for(const _ of v)clearTimeout(_);for(const _ of m)_.el.style.transition="",_.el.style.transform="",_.el.style.zIndex="",_.lane&&x(_.el.closest("[data-lane-scroll]"))}},[e,t,s,n])}function FG(t,e=[]){const s=[[`# Task: ${t.title}`,t.description?.trim()].filter(Boolean).join(`
|
|
88
88
|
|
|
89
89
|
`)];if(e.length>0){const n=e.map(i=>{const o=i.merged?"merged":i.state??(i.draft?"draft":"open"),l=i.title?.trim()||`${i.repoOwner}/${i.repoName}`;return`- #${i.number} ${l} [${o}] ${i.url}`});s.push(["## Linked pull requests",...n].join(`
|
|
90
90
|
`))}if(t.threads.length>0){const n=t.threads.map(i=>{const o=i.title?.trim()||"Untitled chat";return i.status?`- ${o} [${i.status}]`:`- ${o}`});s.push(["## Other chats on this task",...n].join(`
|
|
@@ -538,10 +538,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
538
538
|
22% { opacity: 0; }
|
|
539
539
|
}
|
|
540
540
|
`}),e[27]=y):y=e[27];let S;return e[28]!==_||e[29]!==h?(S=r.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[h,_,y]}),e[28]=_,e[29]=h,e[30]=S):S=e[30],S}function O0(t){const e=z.c(10),{phase:s,current:n,children:i}=t,o=s-n,l=o<0,a=o===0,c=l?90:o*-22,d=l?.94:1-Math.max(o,0)*.04,u=l?0:a?1:o===1?.8:.55,h=l?10:30-o,f=!a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=ie("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${c}px) scale(${d})`,g=a?"auto":"none";let x;e[1]!==u||e[2]!==p||e[3]!==g||e[4]!==h?(x={transform:p,opacity:u,zIndex:h,transitionDuration:"1000ms",pointerEvents:g},e[1]=u,e[2]=p,e[3]=g,e[4]=h,e[5]=x):x=e[5];let b;return e[6]!==i||e[7]!==f||e[8]!==x?(b=r.jsx("div",{"aria-hidden":f,className:m,style:x,children:i}),e[6]=i,e[7]=f,e[8]=x,e[9]=b):b=e[9],b}function L9(t){const e=z.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let i,o,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:ie("size-2.5 rounded-full",si)}),o=r.jsx("div",{className:ie("size-2.5 rounded-full",si)}),l=r.jsx("div",{className:ie("size-2.5 rounded-full",si)}),e[0]=i,e[1]=o,e[2]=l):(i=e[0],o=e[1],l=e[2]);let a;e[3]!==n?(a=n&&r.jsx("div",{className:ie("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",qi)}),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==a?(c=r.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[i,o,l,a]}),e[5]=a,e[6]=c):c=e[6],c}function yX(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(L9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsx("div",{className:"flex flex-1 px-8 py-5",children:r.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:mX.map(_X)})})]}),t[1]=s):s=t[1],s}function _X(t,e){if(e===iS)return r.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return r.jsx("div",{className:ie("relative rounded-md",si),children:r.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${rS}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function LX(){const t=z.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(L9,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:ie("w-[18%] rounded-md",qi),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=n):n=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=i):i=t[3];let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[n,r.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[i,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[r.jsx("div",{className:ie("rounded-md",qi),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),r.jsx("div",{className:ie("rounded-md",qi),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function wX(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(L9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:r.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:xX.map(SX)})})]}),t[1]=s):s=t[1],s}function SX(t,e){return r.jsx("div",{className:ie("aspect-square rounded-md",bX[e]?"bg-chart-2/70":si),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function kX(){const t=z.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx(L9,{showUrl:!0}),t[0]=e):e=t[0];let s,n,i,o,l;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),n=r.jsx("div",{className:ie("h-1.5 w-[70%] rounded-sm",si)}),i=r.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",si)}),o=r.jsx("div",{className:ie("h-1.5 w-[80%] rounded-sm",si)}),l=r.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",si)}),t[1]=s,t[2]=n,t[3]=i,t[4]=o,t[5]=l):(s=t[1],n=t[2],i=t[3],o=t[4],l=t[5]);let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,n,i,o,l,r.jsx("div",{className:"mt-auto",children:r.jsx("div",{className:ie("h-4 rounded-md",si)})})]}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:r.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[r.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),r.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",qi)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[r.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),r.jsx("div",{className:ie("h-4 w-10 rounded-full",qi)}),r.jsx("div",{className:ie("h-4 w-14 rounded-full",qi)})]}),t[8]=d):d=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsxs("div",{className:ie("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",qi),children:[r.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",si)}),r.jsx("div",{className:ie("h-1 w-[75%] rounded-sm",si)})]}),t[9]=u):u=t[9];let h;return t[10]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsxs("div",{className:"flex h-full flex-col",children:[e,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[a,r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c,r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[d,r.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[u,r.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[r.jsx("div",{className:ie("rounded-md",qi)}),r.jsx("div",{className:ie("rounded-md",qi)})]})]})]})]})]})]}),t[10]=h):h=t[10],h}function yc(t){const e=z.c(52),s=re();if(t.kind==="starting"){let m;return e[0]!==t.claimPhase||e[1]!==t.progress?(m=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsx(vX,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=m):m=e[2],m}if(t.kind==="errored"){const m=t.error.code===km.githubNotAuthenticated,p=t.error.code===km.githubConnectionMissing;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=r.jsx(Fr,{className:"size-12 text-destructive"}),e[3]=g):g=e[3];let x;e[4]!==s?(x=s("sandbox.stateCard.erroredHeadline"),e[4]=s,e[5]=x):x=e[5];let b;e[6]!==x?(b=r.jsx("h3",{className:"text-lg font-medium",children:x}),e[6]=x,e[7]=b):b=e[7];let v;e[8]!==p||e[9]!==m||e[10]!==t.error.message||e[11]!==s?(v=p?s("sandbox.stateCard.githubConnectionMissingMessage"):m?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[8]=p,e[9]=m,e[10]=t.error.message,e[11]=s,e[12]=v):v=e[12];let L;e[13]!==v?(L=r.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:v}),e[13]=v,e[14]=L):L=e[14];let _;e[15]!==p||e[16]!==m||e[17]!==t.connectionsHref||e[18]!==s?(_=(m||p)&&t.connectionsHref&&r.jsx(he,{asChild:!0,children:r.jsx("a",{href:t.connectionsHref,children:s(p?"sandbox.stateCard.linkRepoAgain":"sandbox.stateCard.reconnectGithub")})}),e[15]=p,e[16]=m,e[17]=t.connectionsHref,e[18]=s,e[19]=_):_=e[19];const y=t.onRetry;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(Dn,{className:"size-4"}),e[20]=S):S=e[20];let k;e[21]!==s?(k=s("sandbox.stateCard.retry"),e[21]=s,e[22]=k):k=e[22];let w;e[23]!==t.onRetry||e[24]!==k?(w=r.jsxs(he,{variant:"outline",onClick:y,children:[S," ",k]}),e[23]=t.onRetry,e[24]=k,e[25]=w):w=e[25];let j;e[26]!==_||e[27]!==w?(j=r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[_,w]}),e[26]=_,e[27]=w,e[28]=j):j=e[28];let N;return e[29]!==j||e[30]!==b||e[31]!==L?(N=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[g,b,L,j]})}),e[29]=j,e[30]=b,e[31]=L,e[32]=N):N=e[32],N}let n;e[33]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(QT,{className:"size-12 text-blue-500"}),e[33]=n):n=e[33];let i;e[34]!==s?(i=s("sandbox.stateCard.suspendedHeadline"),e[34]=s,e[35]=i):i=e[35];let o;e[36]!==i?(o=r.jsx("h3",{className:"text-lg font-medium",children:i}),e[36]=i,e[37]=o):o=e[37];let l;e[38]!==s?(l=s("sandbox.stateCard.resumeToContinue"),e[38]=s,e[39]=l):l=e[39];let a;e[40]!==l?(a=r.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:l}),e[40]=l,e[41]=a):a=e[41];const c=t.onResume;let d;e[42]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(wl,{className:"size-4"}),e[42]=d):d=e[42];let u;e[43]!==s?(u=s("sandbox.stateCard.resume"),e[43]=s,e[44]=u):u=e[44];let h;e[45]!==t.onResume||e[46]!==u?(h=r.jsxs(he,{onClick:c,className:"mt-2",children:[d," ",u]}),e[45]=t.onResume,e[46]=u,e[47]=h):h=e[47];let f;return e[48]!==o||e[49]!==a||e[50]!==h?(f=r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:r.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,o,a,h]})}),e[48]=o,e[49]=a,e[50]=h,e[51]=f):f=e[51],f}function v3(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function jX(t){if(!t)return null;try{const e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e)||typeof e.path!="string"||!e.path.startsWith("/"))return null;const s=typeof e.pageKey=="string"?e.pageKey:null,n={};if(e.params&&typeof e.params=="object")for(const[i,o]of Object.entries(e.params))typeof o=="string"&&(n[i]=o);return{path:e.path,pageKey:s,params:n}}catch{return null}}function y3(t){try{return jX(localStorage.getItem(t))}catch{return null}}function CX(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function oS(t){switch(t.lifecycle.phase){case"cloning":case"checking-out":return{step:"cloning",status:"doing"};case"clone-failed":return{step:"cloning",status:"failed"};case"installing":return{step:"install",status:"doing"};case"install-failed":return{step:"install",status:"failed"};case"starting":return{step:"dev",status:"doing"};case"running":return{step:"dev",status:"done"};case"start-failed":return{step:"dev",status:"failed"};case"crashed":return{step:"dev",status:"failed"};case"idle":return t.claimPhase&&t.claimPhase.kind!=="ready"&&t.claimPhase.kind!=="failed"?{step:"provision",status:"doing"}:{step:"cloning",status:"doing"}}}const O5="site-links",NX=/details?page|\bpdp\b/i,TX=/listingpage|\bplp\b/i;function VX(t,e,s){const n=new Set;for(const a of s)NX.test(a)&&n.add("product"),TX.test(a)&&n.add("category");const i=Nh(wo(t)),o=i[i.length-1],l=i[i.length-2];return o?.type==="text"&&o.text==="/p"&&l?.type==="param"&&l.name===e&&n.add("product"),e==="*"&&i.some(a=>a.type==="param"&&a.name==="*")&&n.add("category"),n}const AX=["rosa","preto","pink","black"];function B0(t,e){const s=e.trim();return s?t(s):AX.flatMap(n=>t(n))}function PX(t,e){const s=e.trim(),n=[];/^\d+$/.test(s)&&n.push({resolveType:t,props:{ids:[s]}});const o=s.includes("-")&&!/\s/.test(s)?s.replace(/-+/g," "):s;return n.push({resolveType:t,props:{query:o,count:10}}),n}const lS=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function _3(t){return t.split("/")[0]??""}function EX(t){const e=new Set;for(const s of t){const n=_3(s);lS.has(n)&&e.add(n)}return e}function DX(t,e){const s=_3(t);return!lS.has(s)||e.size===0?!0:e.has(s)}const RX=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>B0(s=>PX(t,s),e),optionsFromPayload:z0},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>B0(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:z0},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>B0(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:z0},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>B0(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:z0},{kind:"category",test:t=>t==="vtex/loaders/categories/tree.ts"||/categor(y|ies).*tree/i.test(t),clientFilter:!0,buildRequests:t=>[{resolveType:t,props:{}}],optionsFromPayload:FX}];function IX(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of RX){if(d.kind!==a)continue;const u=n.find(h=>d.test(h)&&DX(h,s));u&&c.push({cand:d,resolveType:u})}return c.find(d=>s.has(_3(d.resolveType)))??c[0]},o=(a,c,d)=>({kind:a.kind,id:`${a.kind}:${c}`,resolveType:c,clientFilter:a.clientFilter,isFallback:d,buildRequests:u=>a.buildRequests(c,u),optionsFromPayload:a.optionsFromPayload}),l=[];for(const a of["product","category"]){if(!t.has(a))continue;const c=i(a);c&&l.push(o(c.cand,c.resolveType,!1))}return t.size>0&&l.push(MX(t.has("category")?"category":"product")),l}function MX(t){return{kind:t,id:O5,resolveType:O5,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>qX(e,s)}}function fl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function $X(t,e,s){const n=new Set,i=new Set,o=l=>{if(Array.isArray(l)){for(const d of l)o(d);return}const a=fl(l);if(!a)return;const c=a.__resolveType;if(typeof c=="string"){if(s(c))n.add(c);else if(c in e&&!i.has(c)){i.add(c);const d=fl(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),o(e[c])}}for(const d of Object.values(a))o(d)};return o(t),n}function aS(t){const e=new Set,s=[];for(const n of t)for(const i of n)e.has(i.value)||(e.add(i.value),s.push(i));return s}function cS(t){try{return decodeURIComponent(t)}catch{return t}}function OX(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function BX(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=OX(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function dS(t,e,s){if(typeof t!="string"||!t)return null;let n;try{n=new URL(t,"https://placeholder.invalid").pathname}catch{return null}n=n.replace(/\/+$/,"");const i=Nh(wo(e)),{pattern:o,order:l}=BX(i),a=l.indexOf(s);if(a===-1)return null;const c=n.match(o);if(!c)return null;const d=c[a+1]?.replace(/^\/+|\/+$/g,"");return d?cS(d):null}function z0(t,e){const s=fl(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],i=[],o=new Set;for(const l of n){const a=fl(l);if(!a)continue;const c=dS(a.url,e.template,e.paramName);if(!c||o.has(c))continue;o.add(c);const d=fl(a.isVariantOf),u=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,h=Array.isArray(a.image)?fl(a.image[0]):null,f=typeof h?.url=="string"?h.url:void 0;i.push({value:c,label:u,image:f})}return i}function zX(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const s=e.replace(/^\/+|\/+$/g,"");return s?cS(s):null}function FX(t){const e=[],s=new Set,n=(i,o)=>{const l=fl(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...o,a]:o,d=zX(l.url);if(d&&!s.has(d)&&(s.add(d),e.push({value:d,label:c.join(" › ")||d})),Array.isArray(l.children))for(const u of l.children)n(u,c)};if(Array.isArray(t))for(const i of t)n(i,[]);return e}const UX=new Set(["login","logout","signin","sign-in","signup","sign-up","register","account","myaccount","my-account","minha-conta","conta","cart","carrinho","checkout","wishlist","favoritos","favorites","orders","pedidos","help","hc","sac","atendimento","contato","contact","institucional","newsletter","customer","sales","catalogsearch","search","busca","privacy-policy-cookie-restriction-mode"]);function HX(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function KX(t){if(typeof t!="string"||!t)return[];const e=[],s=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let n,i=0;for(;(n=s.exec(t))!==null&&i++<5e3;){const o=n[1]??"",l=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:o,text:l})}return e}function WX(t){if(typeof t!="string"||!t)return[];const e=[],s=new Set,n=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,i=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let o,l=0;for(;(o=n.exec(t))!==null&&l++<3e3;){const a=(o[1]??"").replace(/\\\//g,"/");if(!a||s.has(a))continue;s.add(a);const c=t.slice(o.index,o.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:a,name:o[2]??"",image:c||void 0})}return e}function qX(t,e){const s=[],n=new Set,i=(o,l,a,c)=>{if(s.length>=200)return;const d=dS(o,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&UX.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:HX(d),kind:a,image:c}))};for(const{url:o,name:l,image:a}of WX(t))i(o,l,"product",a);for(const{href:o,text:l}of KX(t))o.startsWith("/")&&!o.startsWith("//")&&i(o,l,"category");return s}function yd(t,e,s=50){const n=e.trim().toLowerCase();return(n?t.filter(o=>o.label.toLowerCase().includes(n)||o.value.toLowerCase().includes(n)):t).slice(0,s)}const uS=1e4;function GX(t){return{product:{noun:t("sandbox.pathParamPickerChip.kindProductNoun"),heading:t("sandbox.pathParamPickerChip.kindProductHeading")},category:{noun:t("sandbox.pathParamPickerChip.kindCategoryNoun"),heading:t("sandbox.pathParamPickerChip.kindCategoryHeading")}}}async function YX(t,{resolveType:e,props:s}){const n=await fetch(M7(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(uS)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function B5(t,e){const s=await fetch(I7(t,e),{signal:AbortSignal.timeout(uS)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function JX(t,e,s){const n=e.optionsFromPayload(await B5(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const o=jr(s.template,{[s.paramName]:i.value});if(o==="/")return n;try{const l=e.optionsFromPayload(await B5(t,o),s).filter(a=>a.kind==="product");return aS([n,l])}catch{return n}}function QX(t,e,s){return Qe.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function XX(t,e,s,n){if(e.homepageLinks)return JX(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const o=await Promise.allSettled(i.map(a=>YX(t,a))),l=o.filter(a=>a.status==="fulfilled").map(a=>a.value);if(l.length===0){const a=o.find(c=>c.status==="rejected");throw a?a.reason:new Error("Failed to fetch options")}return aS(l.map(a=>e.optionsFromPayload(a,n)))}function Wm(t,e,s,n,i){return{queryKey:QX(t,e,s),queryFn:()=>XX(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function _d(t){const e=z.c(16),{heading:s,iconKind:n,options:i,template:o,paramName:l,keyPrefix:a,onSelect:c}=t;if(i.length===0)return null;let d;if(e[0]!==n||e[1]!==a||e[2]!==c||e[3]!==i||e[4]!==l||e[5]!==o){let h;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==o?(h=f=>r.jsxs(Cs,{value:`${a}:${f.value}`,className:"gap-3 py-2",onSelect:()=>c(f.value),children:[n==="product"&&r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:f.image?r.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):r.jsx(Bf,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:f.label}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:jr(o,{[l]:f.value})})]})]},`${a}:${f.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=o,e[12]=h):h=e[12],d=i.map(h),e[0]=n,e[1]=a,e[2]=c,e[3]=i,e[4]=l,e[5]=o,e[6]=d}else d=e[6];let u;return e[13]!==s||e[14]!==d?(u=r.jsx(qs,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=u):u=e[15],u}function z5(t){const e=z.c(2),{text:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function ZX(t){const e=z.c(52),{sources:s,template:n,paramName:i,value:o,sandboxRef:l,onCommit:a}=t,c=re(),[d,u]=P.useState(!1),[h,f]=P.useState(""),[m,p]=P.useState(""),g=P.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=GX(c),L=[...new Set(s.map(Le=>b[Le.kind].noun))].join(" or ");let _;e[0]!==c||e[1]!==L?(_=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:L}),e[0]=c,e[1]=L,e[2]=_):_=e[2];const y=_,S={template:n,paramName:i};let k;e[3]!==h?(k=(Le,Ne)=>({source:Le,query:Ne,options:Le.clientFilter?yd(Ne.data??[],h):Ne.data??[]}),e[3]=h,e[4]=k):k=e[4];const w=k,j=s.filter(lZ),N=s.filter(oZ),T=dm({queries:j.map(Le=>Wm(l,Le,m,S,d))});let C;e[5]!==T||e[6]!==w?(C=(Le,Ne)=>w(Le,T[Ne]),e[5]=T,e[6]=w,e[7]=C):C=e[7];const V=j.map(C),A=V.length===0||V.every(rZ),E=dm({queries:N.map(Le=>Wm(l,Le,m,S,d&&A))});let D;e[8]!==E||e[9]!==w?(D=(Le,Ne)=>w(Le,E[Ne]),e[8]=E,e[9]=w,e[10]=D):D=e[10];const I=N.map(D),R=A?I:V,$=R.length===1&&R[0]?.source.homepageLinks?R[0]:null,M=$&&!$.query.isLoading&&!$.query.isError?$?.query.data??[]:[],O=yd(M.filter(iZ),h),F=yd(M.filter(nZ),h),U=O.length>0&&F.length>0,K=Le=>{u(Le),g.current&&clearTimeout(g.current),f(Le?o:""),p(Le?o:"")};let q;e[11]===Symbol.for("react.memo_cache_sentinel")?(q=Le=>{f(Le),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(Le)},300)},e[11]=q):q=e[11];const W=q,G=Le=>{a(Le),K(!1)},Y=q7(h),ee=jr(n,{[i]:Y}),ne=zt,oe=Bt,Z="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",J=sZ;let H;e[12]!==x||e[13]!==c?(H=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=H):H=e[14];let se;e[15]!==H?(se=r.jsx(os,{className:"sr-only",children:r.jsx(Kt,{children:H})}),e[15]=H,e[16]=se):se=e[16];let Q;e[17]===Symbol.for("react.memo_cache_sentinel")?(Q=r.jsx(Bf,{size:16,className:"shrink-0 text-foreground"}),e[17]=Q):Q=e[17];let ce;e[18]!==c?(ce=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=ce):ce=e[19];let te;e[20]!==x?(te=r.jsx("span",{className:"rounded-sm bg-violet-500/15 px-1 py-0.5 font-mono text-[12px] text-violet-600 dark:text-violet-400",children:x}),e[20]=x,e[21]=te):te=e[21];let le;e[22]!==ce||e[23]!==te?(le=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[Q,r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[ce," ",te]})]}),e[22]=ce,e[23]=te,e[24]=le):le=e[24];const ue=hr,fe=!1,ae="min-h-0 flex-1";let de;e[25]!==y||e[26]!==h?(de=r.jsx(Pi,{autoFocus:!0,placeholder:y,value:h,onValueChange:W}),e[25]=y,e[26]=h,e[27]=de):de=e[27];const X=Ei,pe="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let ye;e[28]!==c?(ye=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=ye):ye=e[29];let we;e[30]!==ye?(we=r.jsx(di,{children:ye}),e[30]=ye,e[31]=we):we=e[31];const _e=Y&&r.jsx(qs,{className:"shrink-0",children:r.jsxs(Cs,{value:`__raw__:${Y}`,className:"gap-3 py-2",onSelect:()=>G(Y),children:[r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:r.jsx(Wo,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:Y,paramLabel:x})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:ee})]})]})}),Pe=U?r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:r.jsx(_d,{heading:b.category.heading,iconKind:"category",options:O,template:n,paramName:i,keyPrefix:`${$?.source.id}:cat`,onSelect:G})}),r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r.jsx(_d,{heading:b.product.heading,iconKind:"product",options:F,template:n,paramName:i,keyPrefix:`${$?.source.id}:prod`,onSelect:G})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:R.map(Le=>{const{source:Ne,query:et,options:Ye}=Le,{noun:ze}=b[Ne.kind];if(et.isLoading)return r.jsx(z5,{text:c("sandbox.pathParamPickerChip.loading",{noun:ze})},Ne.id);if(et.isError)return r.jsx(z5,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},Ne.id);if(Ne.homepageLinks){const Me=et.data??[];return r.jsxs(P.Fragment,{children:[r.jsx(_d,{heading:b.category.heading,iconKind:"category",options:yd(Me.filter(tZ),h),template:n,paramName:i,keyPrefix:`${Ne.id}:cat`,onSelect:G}),r.jsx(_d,{heading:b.product.heading,iconKind:"product",options:yd(Me.filter(eZ),h),template:n,paramName:i,keyPrefix:`${Ne.id}:prod`,onSelect:G})]},Ne.id)}return r.jsx(_d,{heading:R.length>1?b[Ne.kind].heading:void 0,iconKind:Ne.kind,options:Ye,template:n,paramName:i,keyPrefix:Ne.id,onSelect:G},Ne.id)})});let Se;e[32]!==X||e[33]!==we||e[34]!==_e||e[35]!==Pe?(Se=r.jsxs(X,{className:pe,children:[we,_e,Pe]}),e[32]=X,e[33]=we,e[34]=_e,e[35]=Pe,e[36]=Se):Se=e[36];let Te;e[37]!==ue||e[38]!==de||e[39]!==Se?(Te=r.jsxs(ue,{shouldFilter:fe,className:ae,children:[de,Se]}),e[37]=ue,e[38]=de,e[39]=Se,e[40]=Te):Te=e[40];let ve;e[41]!==oe||e[42]!==se||e[43]!==le||e[44]!==Te||e[45]!==J?(ve=r.jsxs(oe,{className:Z,onClick:J,children:[se,le,Te]}),e[41]=oe,e[42]=se,e[43]=le,e[44]=Te,e[45]=J,e[46]=ve):ve=e[46];let ke;return e[47]!==ne||e[48]!==K||e[49]!==d||e[50]!==ve?(ke=r.jsx(ne,{open:d,onOpenChange:K,children:ve}),e[47]=ne,e[48]=K,e[49]=d,e[50]=ve,e[51]=ke):ke=e[51],r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",title:c("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:x}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-sm bg-violet-500/15 px-1 py-0.5 text-[12px] text-violet-600 hover:bg-violet-500/25 dark:text-violet-400",onClick:Le=>{Le.stopPropagation(),K(!0)},children:o||x}),ke]})}function eZ(t){return t.kind==="product"}function tZ(t){return t.kind!=="product"}function sZ(t){return t.stopPropagation()}function nZ(t){return t.kind==="product"}function iZ(t){return t.kind!=="product"}function rZ(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function oZ(t){return t.isFallback}function lZ(t){return!t.isFallback}function aZ(t){const e=z.c(8),{sources:s,template:n,paramName:i,sandboxRef:o,onFill:l}=t;let a,c;if(e[0]!==i||e[1]!==o||e[2]!==s||e[3]!==n){const m={template:n,paramName:i},p=s.filter(cZ);c=dm,a=p.map(g=>Wm(o,g,"",m,!0)),e[0]=i,e[1]=o,e[2]=s,e[3]=n,e[4]=a,e[5]=c}else a=e[4],c=e[5];let d;e[6]!==a?(d={queries:a},e[6]=a,e[7]=d):d=e[7];const u=c(d),[h,f]=P.useState(!1);if(!h)for(const m of u){if(m.isLoading)break;const p=m.data?.[0];if(p){f(!0),queueMicrotask(()=>l(p.value));break}}return null}function cZ(t){return!t.isFallback}function dZ(t){const e=z.c(31),{name:s,value:n,onCommit:i}=t,o=re(),[l,a]=P.useState(n),[c,d]=P.useState(!1),u=P.useRef(!1);let h;e[0]!==s||e[1]!==o?(h=s==="*"?o("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=o,e[2]=h):h=e[2];const f=h,m=l||f;let p;e[3]!==m?(p=r.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:m}),e[3]=m,e[4]=p):p=e[4];let g;e[5]!==f||e[6]!==o?(g=o("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=o,e[7]=g):g=e[7];let x,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=w=>a(w.target.value),b=()=>d(!0),e[8]=x,e[9]=b):(x=e[8],b=e[9]);let v;e[10]!==n?(v=w=>{w.key==="Enter"&&w.currentTarget.blur(),w.key==="Escape"&&(u.current=!0,a(n),w.currentTarget.blur())},e[10]=n,e[11]=v):v=e[11];let L;e[12]!==l||e[13]!==i||e[14]!==n?(L=()=>{if(d(!1),u.current){u.current=!1;return}const w=q7(l);a(w),w!==n&&i(w)},e[12]=l,e[13]=i,e[14]=n,e[15]=L):L=e[15];let _;e[16]!==l||e[17]!==f||e[18]!==g||e[19]!==v||e[20]!==L?(_=r.jsx("input",{type:"text",value:l,placeholder:f,title:g,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-violet-500/15 px-1 text-[12px] text-violet-600 outline-none placeholder:text-violet-500/60 focus:bg-violet-500/25 dark:text-violet-400",onClick:uZ,onChange:x,onFocus:b,onKeyDown:v,onBlur:L}),e[16]=l,e[17]=f,e[18]=g,e[19]=v,e[20]=L,e[21]=_):_=e[21];let y;e[22]!==p||e[23]!==_?(y=r.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[p,_]}),e[22]=p,e[23]=_,e[24]=y):y=e[24];let S;e[25]!==c||e[26]!==o?(S=c&&r.jsxs("span",{className:"pointer-events-none ml-1.5 flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-border bg-muted px-1 py-0.5 text-[10px] text-muted-foreground",children:[r.jsx(XT,{size:10}),o("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=o,e[27]=S):S=e[27];let k;return e[28]!==S||e[29]!==y?(k=r.jsxs(r.Fragment,{children:[y,S]}),e[28]=S,e[29]=y,e[30]=k):k=e[30],k}function uZ(t){return t.stopPropagation()}const hZ={loaders:"loader",actions:"action"},hS=new Set(["workflows"]);function fS(t){return hZ[t]}function mS(t,e,s){const n=t.manifest?.blocks??{};for(const[i,o]of Object.entries(n))if(i.includes(s)&&e in o)return!0;return!1}function fZ(t,e,s){return/\.tsx?$/.test(e)?!0:mS(t,e,s)}function mZ(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[i,o]of Object.entries(n))if(i.includes(e))for(const l of Object.keys(o))s.add(l);return s}function pZ(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function pS(t,e){const s=t.manifest?.blocks??{},n=[],i=new Set;for(const[o,l]of Object.entries(s))if(o.includes(e))for(const a of Object.keys(l))i.add(a);for(const o of i){if(o.toLowerCase().includes("preview")||e_.has(o)||hS.has(L3(o))||pZ(o,i))continue;const l=Yo(o,t);if(l.hidden)continue;const a=l.title&&l.title!==o?l.title:fs(o);n.push({resolveType:o,title:a})}return n.sort((o,l)=>o.title.localeCompare(l.title))}function F5(t,e){return pS(t,e).length}function L3(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const gZ={deco:"Deco",std:"Deco Standard",website:"Website"};function xZ(t){return gZ[t]??t}function gS(t){const e=L3(t);let n=t.split("/").filter(Boolean).slice(t.startsWith("deco-sites/")?2:1);return(n[0]==="loaders"||n[0]==="actions")&&(n=n.slice(1)),[e,...n.slice(0,-1)]}function xS(t,e,s){const n=[];for(const[i,o]of Object.entries(e)){if(fZ(t,i,s)||Zf(i)||!o||typeof o!="object"||Array.isArray(o))continue;const l=o,a=l.__resolveType;typeof a=="string"&&(e_.has(a)||hS.has(L3(a))||mS(t,a,s)&&n.push({key:i,resolveType:a,title:typeof l.name=="string"&&l.name?l.name:i}))}return n.sort((i,o)=>i.title.localeCompare(o.title))}function bS(t,e){const s=t[e],n=typeof s?.__resolveType=="string"?s.__resolveType:"",{__resolveType:i,...o}=s??{},l=typeof s?.name=="string"&&s.name?s.name:e;return{resolveType:n,props:o,title:l}}function vS(t){const e=z.c(14),{orgSlug:s,virtualMcpId:n,branch:i,threadId:o,enabled:l}=t,a=l===void 0?!0:l;let c;e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n?(c=Qe.sandboxRepoDir(s,n,i,o),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==o||e[8]!==n?(d=async()=>{const f=Or({orgSlug:s,virtualMcpId:n,branch:i,threadId:o},"config"),m=await fetch(f);return m.ok?(await m.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=o,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==a||e[11]!==c||e[12]!==d?(u={queryKey:c,queryFn:d,enabled:a,staleTime:1/0},e[10]=a,e[11]=c,e[12]=d,e[13]=u):u=e[13],Pt(u).data??null}const bZ={target:null,editSeoPageKey:null,variantOverride:null};function vZ(t,e){switch(e.type){case"select":return{...t,target:e.target,variantOverride:null,editSeoPageKey:null};case"edit-seo":return{...t,target:e.target,editSeoPageKey:e.target.key,variantOverride:null};case"consume-edit-seo":return{...t,editSeoPageKey:null};case"variant-override":return{...t,variantOverride:e.params}}}const yS=P.createContext(null);function U5(t){const e=z.c(9),{children:s}=t,[n,i]=P.useReducer(vZ,bZ);let o,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=h=>i({type:"select",target:h}),l=h=>i({type:"edit-seo",target:h}),a=()=>i({type:"consume-edit-seo"}),c=h=>i({type:"variant-override",params:h}),e[0]=o,e[1]=l,e[2]=a,e[3]=c):(o=e[0],l=e[1],a=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:o,editSeo:l,consumeEditSeo:a,setVariantOverride:c},e[4]=n,e[5]=d):d=e[5];let u;return e[6]!==s||e[7]!==d?(u=r.jsx(yS,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=u):u=e[8],u}function _S(){const t=P.use(yS);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}function w3(t){return(e,s)=>{B7(e),t(e,s)}}const yZ="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function w9(t){return Ms(t)?.metadata?.fieldDescriptionTooltips??!1}function S3(t){const e=z.c(9),{description:s,virtualMcpId:n,children:i}=t,o=w9(n);if(!s||!o)return i;let l;e[0]!==i?(l=P.cloneElement(i,{className:ie(i.props.className,yZ)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.jsx(He,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=r.jsx(Ke,{className:"max-w-64",children:s}),e[4]=s,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=r.jsxs(We,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Gs(t){const e=z.c(17),{htmlFor:s,label:n,description:i,labelClassName:o,virtualMcpId:l}=t;if(!w9(l)){let u;e[0]!==s||e[1]!==n||e[2]!==o?(u=r.jsx(Ut,{htmlFor:s,className:o,children:n}),e[0]=s,e[1]=n,e[2]=o,e[3]=u):u=e[3];let h;e[4]!==i?(h=i&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[4]=i,e[5]=h):h=e[5];let f;return e[6]!==u||e[7]!==h?(f=r.jsxs("div",{className:"space-y-0.5",children:[u,h]}),e[6]=u,e[7]=h,e[8]=f):f=e[8],f}let c;e[9]!==s||e[10]!==n||e[11]!==o?(c=r.jsx(Ut,{htmlFor:s,className:o,children:n}),e[9]=s,e[10]=n,e[11]=o,e[12]=c):c=e[12];let d;return e[13]!==i||e[14]!==c||e[15]!==l?(d=r.jsx(S3,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}var _Z=Vi.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(s=>e.updateAttributes(s,{textAlign:t})).some(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:s})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?s.unsetTextAlign():s.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),LZ=_Z,wZ=20,LS=(t,e=0)=>{const s=[];return!t.children.length||e>wZ||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...LS(n,e+1))}),s},SZ=t=>{if(!t.children.length)return;const e=LS(t);e&&e.forEach(s=>{var n,i;const o=s.getAttribute("style"),l=(i=(n=s.parentElement)==null?void 0:n.closest("span"))==null?void 0:i.getAttribute("style");s.setAttribute("style",`${l};${o}`)})},wS=GN.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&SZ(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",kf(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(s,n)=>{if(s.isTextblock)return!0;s.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),kZ=Vi.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=t.getAttribute("style");if(s){const n=s.split(";").map(i=>i.trim()).filter(Boolean);for(let i=n.length-1;i>=0;i-=1){const o=n[i].split(":");if(o.length>=2){const l=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(l==="background-color")return a.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),SS=Vi.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=t.getAttribute("style");if(s){const n=s.split(";").map(i=>i.trim()).filter(Boolean);for(let i=n.length-1;i>=0;i-=1){const o=n[i].split(":");if(o.length>=2){const l=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(l==="color")return a.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),jZ=Vi.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),kS=Vi.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),CZ=Vi.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Vi.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(kZ.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(SS.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(jZ.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(kS.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(CZ.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(wS.configure(this.options.textStyle)),t}});const NZ=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function TZ(t){const e=z.c(30),{editor:s,currentColor:n,open:i,onOpenChange:o}=t,l=re(),[a,c]=P.useState("#000000");let d;e[0]!==s||e[1]!==o?(d=S=>{s.chain().focus().setColor(S).run(),o(!1)},e[0]=s,e[1]=o,e[2]=d):d=e[2];const u=d;let h;e[3]!==s||e[4]!==o?(h=()=>{s.chain().focus().unsetColor().run(),o(!1)},e[3]=s,e[4]=o,e[5]=h):h=e[5];const f=h,m=i||n!==null;let p;e[6]!==l?(p=l("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=l,e[7]=p):p=e[7];let g;e[8]!==o||e[9]!==i?(g=()=>o(!i),e[8]=o,e[9]=i,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(hm,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let v;e[12]!==b?(v=r.jsxs("span",{className:"relative flex flex-col items-center",children:[x,r.jsx("span",{className:"mt-0.5 h-0.5 w-3.5 rounded-full",style:{backgroundColor:b}})]}),e[12]=b,e[13]=v):v=e[13];let L;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==v?(L=r.jsx(ts,{active:m,label:p,onClick:g,children:v}),e[14]=m,e[15]=p,e[16]=g,e[17]=v,e[18]=L):L=e[18];let _;e[19]!==u||e[20]!==f||e[21]!==n||e[22]!==a||e[23]!==o||e[24]!==i||e[25]!==l?(_=i&&r.jsxs("div",{tabIndex:-1,className:"absolute left-0 top-full z-20 mt-1.5 flex w-56 flex-col gap-2 rounded-md border bg-popover p-2 shadow-md",onBlur:S=>{S.currentTarget.contains(S.relatedTarget)||o(!1)},children:[r.jsx("div",{className:"grid grid-cols-6 gap-1",children:NZ.map(S=>r.jsx("button",{type:"button","aria-label":S,"aria-pressed":n===S,onMouseDown:PZ,onClick:()=>u(S),className:ie("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===S&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:S}},S))}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs("label",{className:"flex flex-1 items-center gap-1.5 rounded bg-muted/40 px-2 py-1 text-xs text-muted-foreground cursor-pointer",children:[r.jsx("input",{type:"color",value:a,onMouseDown:AZ,onChange:S=>c(S.target.value),onBlur:()=>u(a),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),l("sectionsEditor.richTextColorControl.customLabel")]}),r.jsx("button",{type:"button",onMouseDown:VZ,onClick:f,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors cursor-pointer hover:bg-muted hover:text-foreground",children:l("sectionsEditor.richTextColorControl.defaultLabel")})]})]}),e[19]=u,e[20]=f,e[21]=n,e[22]=a,e[23]=o,e[24]=i,e[25]=l,e[26]=_):_=e[26];let y;return e[27]!==_||e[28]!==L?(y=r.jsxs("div",{className:"relative",children:[L,_]}),e[27]=_,e[28]=L,e[29]=y):y=e[29],y}function VZ(t){return t.preventDefault()}function AZ(t){return t.stopPropagation()}function PZ(t){return t.preventDefault()}const F0=[1,2,3,4,5,6];function EZ(t){const e=new DOMParser().parseFromString(t,"text/html").body,s=Array.from(e.children);return s.length===0?e.innerHTML:s.map(n=>n.innerHTML).join("<br>")}const DZ=8,RZ=128,IZ=16,H5=1;function MZ({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o,inline:l=!1}){const a=re(),c=typeof e=="string"?e:"",d=P.useRef(s);d.current=s;const[u,h]=P.useState(!1),[f,m]=P.useState(!1),p=Lf({extensions:[wf.configure({heading:l?!1:{levels:[...F0]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[LZ.configure({types:["heading","paragraph"]})],wS,kS,SS],content:c||"",editorProps:{attributes:{class:ie("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:y})=>{const S=y.getHTML(),k=l?EZ(S):S;d.current(k==="<p></p>"||k===""?"":k)}}),g=My({editor:p,selector:({editor:y})=>({bold:y?.isActive("bold")??!1,italic:y?.isActive("italic")??!1,underline:y?.isActive("underline")??!1,strike:y?.isActive("strike")??!1,headingLevel:F0.find(S=>y?.isActive("heading",{level:S})??!1)??0,fontSize:y?.getAttributes("textStyle").fontSize??null,color:y?.getAttributes("textStyle").color??null,bulletList:y?.isActive("bulletList")??!1,orderedList:y?.isActive("orderedList")??!1,link:y?.isActive("link")??!1,alignLeft:y?.isActive({textAlign:"left"})??!1,alignCenter:y?.isActive({textAlign:"center"})??!1,alignRight:y?.isActive({textAlign:"right"})??!1,alignJustify:y?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=y=>{const S=p.chain().focus();if(y==="paragraph"){S.setParagraph().run();return}const k=F0.find(w=>`h${w}`===y);k&&S.setHeading({level:k}).run()},v=g.fontSize?parseInt(g.fontSize,10):NaN,L=Number.isFinite(v)?v:IZ,_=y=>{const S=Math.min(RZ,Math.max(DZ,y));p.chain().focus().setFontSize(`${S}px`).run()};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(Gs,{htmlFor:n,label:i,description:t.description,virtualMcpId:o?.virtualMcpId}),r.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[r.jsx(ts,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:r.jsx(d6,{size:14})}),r.jsx(ts,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:r.jsx(u6,{size:14})}),r.jsx(ts,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:r.jsx(ZT,{size:14})}),r.jsx(ts,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:r.jsx(h6,{size:14})}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs(ps,{value:x,onValueChange:b,children:[r.jsx(gs,{size:"sm","aria-label":a("sectionsEditor.richTextField.styleLabel"),onMouseDown:y=>y.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:r.jsx(Ns,{})}),r.jsxs(xs,{children:[r.jsx(It,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),F0.map(y=>r.jsx(It,{value:`h${y}`,children:a("sectionsEditor.richTextField.styleHeading",{level:y})},y))]})]})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(ts,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>_(L-H5),children:r.jsx(h2,{size:14})}),r.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:L}),r.jsx(ts,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>_(L+H5),children:r.jsx(Ht,{size:14})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(TZ,{editor:p,currentColor:g.color,open:f,onOpenChange:m}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(ts,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:r.jsx(B2,{size:14})}),r.jsx(ts,{active:g.orderedList,label:a("sectionsEditor.richTextField.orderedList"),onClick:()=>p.chain().focus().toggleOrderedList().run(),children:r.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(NK,{editor:p,active:g.link,open:u,onOpenChange:h}),!l&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),r.jsx(ts,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:r.jsx(SV,{size:14})}),r.jsx(ts,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:r.jsx(eV,{size:14})}),r.jsx(ts,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:r.jsx(tV,{size:14})}),r.jsx(ts,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:r.jsx(sV,{size:14})})]})]}),r.jsx(Sf,{editor:p})]})]})}const dc=t=>String(t).padStart(2,"0"),$Z="1900-01-01",OZ="2099-12-31",BZ="1900-01-01T00:00",zZ="2099-12-31T23:59";function FZ(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const s=new Date(t);return Number.isNaN(s.getTime())?"":`${s.getUTCFullYear()}-${dc(s.getUTCMonth()+1)}-${dc(s.getUTCDate())}`}function UZ(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function HZ(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${dc(e.getMonth()+1)}-${dc(e.getDate())}T${dc(e.getHours())}:${dc(e.getMinutes())}`}function KZ(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function WZ(t){const e=z.c(41),{id:s,withTime:n,value:i,onChange:o,calendarLabel:l}=t,[a,c]=P.useState(!1);let d;e[0]!==n?(d=$=>n?HZ($):FZ($),e[0]=n,e[1]=d):d=e[1];const u=d;let h;e[2]!==n?(h=$=>n?KZ($):UZ($),e[2]=n,e[3]=h):h=e[3];const f=h;let m;e[4]!==u||e[5]!==i?(m=()=>u(i),e[4]=u,e[5]=i,e[6]=m):m=e[6];const[p,g]=P.useState(m),[x,b]=P.useState(i);if(i!==x){b(i);const $=u(i);$!==p&&g($)}let v;e[7]!==o||e[8]!==f?(v=$=>{g($.target.value),o(f($.target.value))},e[7]=o,e[8]=f,e[9]=v):v=e[9];const L=v;let _;if(e[10]!==i){const $=i?new Date(i):null;_=$&&!Number.isNaN($.getTime())?$:null,e[10]=i,e[11]=_}else _=e[11];const y=_;let S;e[12]!==o||e[13]!==y||e[14]!==u||e[15]!==n?(S=$=>{if(!$)return;n&&y?$.setHours(y.getHours(),y.getMinutes(),0,0):$.setHours(0,0,0,0);const B=$.toISOString();g(u(B)),b(B),o(B),c(!1)},e[12]=o,e[13]=y,e[14]=u,e[15]=n,e[16]=S):S=e[16];const k=S,w=n?"datetime-local":"date",j=n?BZ:$Z,N=n?zZ:OZ;let T;e[17]!==u||e[18]!==i?(T=()=>g(u(i)),e[17]=u,e[18]=i,e[19]=T):T=e[19];let C;e[20]!==L||e[21]!==s||e[22]!==p||e[23]!==T||e[24]!==w||e[25]!==j||e[26]!==N?(C=r.jsx(gt,{id:s,type:w,min:j,max:N,value:p,onChange:L,onBlur:T,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=L,e[21]=s,e[22]=p,e[23]=T,e[24]=w,e[25]=j,e[26]=N,e[27]=C):C=e[27];let V;e[28]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(Bl,{className:"h-4 w-4"}),e[28]=V):V=e[28];let A;e[29]!==l?(A=r.jsx(ms,{asChild:!0,children:r.jsx(he,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:V})}),e[29]=l,e[30]=A):A=e[30];const E=y??void 0;let D;e[31]!==k||e[32]!==E?(D=r.jsx(bs,{className:"w-auto p-0",align:"end",onCloseAutoFocus:qZ,children:r.jsx(jf,{mode:"single",selected:E,onSelect:k,initialFocus:!0})}),e[31]=k,e[32]=E,e[33]=D):D=e[33];let I;e[34]!==a||e[35]!==A||e[36]!==D?(I=r.jsxs(vs,{open:a,onOpenChange:c,children:[A,D]}),e[34]=a,e[35]=A,e[36]=D,e[37]=I):I=e[37];let R;return e[38]!==C||e[39]!==I?(R=r.jsxs("div",{className:"flex gap-1",children:[C,I]}),e[38]=C,e[39]=I,e[40]=R):R=e[40],R}function qZ(t){return t.preventDefault()}function U0(t){const e=z.c(76),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=re(),d=typeof n=="string"?n:"",u=s.format;if(u==="rich-text"||u==="rich-text-inline"||u==="html"){const L=u==="rich-text-inline";let _;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==a||e[4]!==s||e[5]!==L||e[6]!==n?(_=r.jsx(MZ,{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a,inline:L}),e[0]=l,e[1]=i,e[2]=o,e[3]=a,e[4]=s,e[5]=L,e[6]=n,e[7]=_):_=e[7],_}if(u==="textarea"||u==="markdown"){const L=a?.virtualMcpId;let _;e[8]!==l||e[9]!==o||e[10]!==s.description||e[11]!==L?(_=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:L}),e[8]=l,e[9]=o,e[10]=s.description,e[11]=L,e[12]=_):_=e[12];let y;e[13]!==i?(y=w=>i(w.target.value),e[13]=i,e[14]=y):y=e[14];let S;e[15]!==o||e[16]!==d||e[17]!==y?(S=r.jsx(Ir,{id:o,value:d,onChange:y,rows:4}),e[15]=o,e[16]=d,e[17]=y,e[18]=S):S=e[18];let k;return e[19]!==_||e[20]!==S?(k=r.jsxs("div",{className:"space-y-2",children:[_,S]}),e[19]=_,e[20]=S,e[21]=k):k=e[21],k}const h=u==="date-time"||u==="datetime";if(u==="date"||h){const L=a?.virtualMcpId;let _;e[22]!==l||e[23]!==o||e[24]!==s.description||e[25]!==L?(_=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:L}),e[22]=l,e[23]=o,e[24]=s.description,e[25]=L,e[26]=_):_=e[26];let y;e[27]!==c?(y=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=y):y=e[28];let S;e[29]!==h||e[30]!==i||e[31]!==o||e[32]!==d||e[33]!==y?(S=r.jsx(WZ,{id:o,withTime:h,value:d,onChange:i,calendarLabel:y}),e[29]=h,e[30]=i,e[31]=o,e[32]=d,e[33]=y,e[34]=S):S=e[34];let k;return e[35]!==_||e[36]!==S?(k=r.jsxs("div",{className:"space-y-2",children:[_,S]}),e[35]=_,e[36]=S,e[37]=k):k=e[37],k}if(u==="color-input"||u==="color"){const L=a?.virtualMcpId;let _;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==L?(_=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:L}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=L,e[42]=_):_=e[42];const y=d||"#000000";let S;e[43]!==i?(S=C=>i(C.target.value),e[43]=i,e[44]=S):S=e[44];let k;e[45]!==y||e[46]!==S?(k=r.jsx("input",{type:"color",value:y,onChange:S,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=y,e[46]=S,e[47]=k):k=e[47];let w;e[48]!==i?(w=C=>i(C.target.value),e[48]=i,e[49]=w):w=e[49];let j;e[50]!==o||e[51]!==d||e[52]!==w?(j=r.jsx(gt,{id:o,value:d,onChange:w,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=o,e[51]=d,e[52]=w,e[53]=j):j=e[53];let N;e[54]!==k||e[55]!==j?(N=r.jsxs("div",{className:"flex items-center gap-2",children:[k,j]}),e[54]=k,e[55]=j,e[56]=N):N=e[56];let T;return e[57]!==_||e[58]!==N?(T=r.jsxs("div",{className:"space-y-2",children:[_,N]}),e[57]=_,e[58]=N,e[59]=T):T=e[59],T}const f=a?.virtualMcpId;let m;e[60]!==l||e[61]!==o||e[62]!==s.description||e[63]!==f?(m=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:f}),e[60]=l,e[61]=o,e[62]=s.description,e[63]=f,e[64]=m):m=e[64];const p=u==="url"?"url":"text";let g;e[65]!==i?(g=L=>i(L.target.value),e[65]=i,e[66]=g):g=e[66];const x=s.default!=null?String(s.default):void 0;let b;e[67]!==o||e[68]!==d||e[69]!==p||e[70]!==g||e[71]!==x?(b=r.jsx(gt,{id:o,type:p,value:d,onChange:g,placeholder:x,className:"h-10"}),e[67]=o,e[68]=d,e[69]=p,e[70]=g,e[71]=x,e[72]=b):b=e[72];let v;return e[73]!==m||e[74]!==b?(v=r.jsxs("div",{className:"space-y-2",children:[m,b]}),e[73]=m,e[74]=b,e[75]=v):v=e[75],v}const GZ=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,YZ=/^[+-]?\d*$/;function JZ(t,e){return(e?YZ:GZ).test(t)}function QZ(t){const e=z.c(16),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=typeof n=="number"?String(n):"",[d,u]=P.useState(c),[h,f]=P.useState(c);c!==h&&(f(c),d!==""&&c!==""&&Number(d)===Number(c)||u(c));const m=a?.virtualMcpId;let p;e[0]!==l||e[1]!==o||e[2]!==s.description||e[3]!==m?(p=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:m}),e[0]=l,e[1]=o,e[2]=s.description,e[3]=m,e[4]=p):p=e[4];const g=s.type==="integer"?"numeric":"decimal";let x;e[5]!==i||e[6]!==s.type?(x=L=>{const _=L.target.value,y=s.type==="integer";if(_!==""&&!JZ(_,y))return;u(_);const S=Number(_);i(_===""||Number.isNaN(S)?void 0:S)},e[5]=i,e[6]=s.type,e[7]=x):x=e[7];let b;e[8]!==o||e[9]!==d||e[10]!==g||e[11]!==x?(b=r.jsx(gt,{id:o,type:"text",inputMode:g,value:d,onChange:x,className:"h-10"}),e[8]=o,e[9]=d,e[10]=g,e[11]=x,e[12]=b):b=e[12];let v;return e[13]!==p||e[14]!==b?(v=r.jsxs("div",{className:"space-y-2",children:[p,b]}),e[13]=p,e[14]=b,e[15]=v):v=e[15],v}function XZ(t){const e=z.c(14),{value:s,onChange:n,path:i,label:o,schema:l,sandbox:a}=t,c=typeof s=="boolean"?s:!1,d=a?.virtualMcpId;let u;e[0]!==o||e[1]!==i||e[2]!==l.description||e[3]!==d?(u=r.jsx(Gs,{htmlFor:i,label:o,description:l.description,virtualMcpId:d}),e[0]=o,e[1]=i,e[2]=l.description,e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=p=>n(p),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==c||e[8]!==i||e[9]!==h?(f=r.jsx(Mr,{id:i,checked:c,onCheckedChange:h}),e[7]=c,e[8]=i,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==u||e[12]!==f?(m=r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u,f]}),e[11]=u,e[12]=f,e[13]=m):m=e[13],m}const k3="__enum_empty__",jS="__enum_clear__";function j3(t){return t===""?k3:String(t)}function ZZ(t,e){if(t===k3)return"";const s=e.find(n=>j3(n)===t);return s!==void 0?s:t}function eee(t,e){if(t!==jS)return ZZ(t,e)}function tee(t,e){return t==null?e.some(s=>s==="")?k3:void 0:j3(t)}function see(t){return t===""?"":String(t)}function nee(t){const e=z.c(39),{schema:s,value:n,onChange:i,path:o,label:l,required:a,sandbox:c}=t,d=re();let u;e[0]!==s.enum?(u=s.enum??[],e[0]=s.enum,e[1]=u):u=e[1];const h=u;let f;e[2]!==h||e[3]!==n?(f=tee(n,h),e[2]=h,e[3]=n,e[4]=f):f=e[4];const m=f;let p;e[5]!==h||e[6]!==a?(p=!a&&!h.some(ree),e[5]=h,e[6]=a,e[7]=p):p=e[7];const g=p,x=c?.virtualMcpId;let b;e[8]!==l||e[9]!==o||e[10]!==s.description||e[11]!==x?(b=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:x}),e[8]=l,e[9]=o,e[10]=s.description,e[11]=x,e[12]=b):b=e[12];let v;e[13]!==i||e[14]!==h?(v=T=>i(eee(T,h)),e[13]=i,e[14]=h,e[15]=v):v=e[15];let L;e[16]!==d?(L=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=L):L=e[17];let _;e[18]!==L?(_=r.jsx(Ns,{placeholder:L}),e[18]=L,e[19]=_):_=e[19];let y;e[20]!==o||e[21]!==_?(y=r.jsx(gs,{id:o,className:"h-10",children:_}),e[20]=o,e[21]=_,e[22]=y):y=e[22];let S;e[23]!==g||e[24]!==d?(S=g&&r.jsx(It,{value:jS,className:"text-muted-foreground",children:d("sectionsEditor.enumField.clearOption")}),e[23]=g,e[24]=d,e[25]=S):S=e[25];let k;e[26]!==h?(k=h.map(iee),e[26]=h,e[27]=k):k=e[27];let w;e[28]!==S||e[29]!==k?(w=r.jsxs(xs,{children:[S,k]}),e[28]=S,e[29]=k,e[30]=w):w=e[30];let j;e[31]!==m||e[32]!==w||e[33]!==v||e[34]!==y?(j=r.jsxs(ps,{value:m,onValueChange:v,children:[y,w]}),e[31]=m,e[32]=w,e[33]=v,e[34]=y,e[35]=j):j=e[35];let N;return e[36]!==j||e[37]!==b?(N=r.jsxs("div",{className:"space-y-2",children:[b,j]}),e[36]=j,e[37]=b,e[38]=N):N=e[38],N}function iee(t){const e=j3(t);return r.jsx(It,{value:e,children:see(t)},e)}function ree(t){return t===""}const CS={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function NS(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function tu(t){return NS(t)?.variants?.[0]?.rule?.__resolveType===Jc}function K5(t){return{__resolveType:$o,variants:[{value:t,rule:{__resolveType:Jc}}]}}function TS(t){return tu(t)?NS(t)?.variants?.[0]?.value:t}function uc(t){return tu(t)?TS(t):t}function C3(t){const e=t.__resolveType;if(typeof e!="string")return null;if(zs(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function oee(t){return t.includes("flags/multivariate")}function lee(t){return fs(t)}function aee(t){const e=t.title?_m(t.title)?.blockId:void 0;return e||(t.title&&!t.title.includes("/")?t.title:Lm(t.resolveType)??fs(t.resolveType))}function cee(t,e){const s=[...t],n=new Set(s.map(o=>o.resolveType)),i=(o,l)=>{!o||n.has(o)||(n.add(o),s.push({resolveType:o,title:l??lee(o)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const o=C3(e.editorValue);o?.includes("/")&&i(o)}return s}function dee(t,e,s){const n=e[0]?.resolveType??"";if(s)return s;if(!t||typeof t!="object"||Array.isArray(t))return n;const i=t,o=i.__resolveType;if(typeof o=="string"){if(oi(o)){const h=e.find(f=>f.resolveType===o);return h?h.resolveType:o}const d=e.find(h=>x4(h.resolveType,o));if(d)return d.resolveType;const u=e.find(h=>h.resolveType===o);if(u)return u.resolveType;if(o.includes("/"))return o}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(u=>u.discriminatorValue===l||u.resolveType===l||x4(u.resolveType,l));if(d)return d.resolveType}let a=n,c=-1;for(const d of e){if(!d.schema?.properties)continue;const h=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>i[f]!==void 0).length;h>0&&h>c&&(c=h,a=d.resolveType)}return c>0,a}function W5(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=C3(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=Rn(n,e);return i||(n.includes("/")?null:s??null)}function uee(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const s={...t.properties};return delete s[e],{...t,properties:s}}function VS(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!zs(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function hee(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=C3(s);return n&&oee(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function N3(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return"";const e=t;if(Array.isArray(e.variants)){const s=e.variants,n=s.find(o=>o.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const i=s.find(o=>typeof o.value=="string");if(i)return i.value}return typeof e.src=="string"?e.src:typeof e.url=="string"?e.url:typeof e.value=="string"?e.value:""}const fee=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),mee=5,pee=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function q5(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!n&&!i)return null;const o=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:pee.format(d)},l=o(n),a=o(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function Ic(t,e=0){if(!t)return"Default";if(e>mee)return"...";const s=t.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(s)||s==="")return"Default";switch(s){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:i,tablet:o,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),o&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(fee).join(" & "):fs(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return q5(t)??fs(s);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:i}=t;return typeof i=="number"?`${Math.ceil(i*100)}% of sessions`:fs(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:o}=t,l=[];return i&&l.push(i),o&&l.push(o),l.length>0?l.join(" - "):fs(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:o,pathname:l}=i??{};return o&&l?`Pathname ${o} ${l}`:fs(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:o}=t,l=d=>[d.city,d.regionCode,d.country].filter(Boolean).join(" - "),a=i?.[0];if(a){const d=(i?.length??0)-1;return`${l(a)}${d>0?` +${d}`:""}`}const c=o?.[0];if(c){const d=(o?.length??0)-1;return`Except ${l(c)}${d>0?` +${d}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:i,op:o="AND"}=t;if(i&&i.length>0){const l=o==="OR"?"OR":"AND";return i.map(a=>Ic(a,e+1)).join(` ${l} `)}return fs(s)}default:{const i=q5(t);return i||fs(s)||"Default"}}}function AS(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function PS(t,e){if(e.length===0)return 0;const s=AS(t);for(let o=0;o<e.length;o++){const l=e[o].discriminators;if(l&&Object.keys(l).length>0&&Object.entries(l).every(([c,d])=>s[c]===d))return o}let n=0,i=-1;for(let o=0;o<e.length;o++){const l=e[o],a=new Set(Object.keys(l.discriminators??{})),d=l.propertyKeys.filter(u=>!a.has(u)).filter(u=>s[u]!==void 0&&s[u]!==null&&s[u]!=="").length;d>i&&(i=d,n=o)}return n}function gee(t,e){const s=AS(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}function xee(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}const bee="$live/matchers/MatchAlways.ts";function vee(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType===Lg||i.rule?.__resolveType===bee)??e.find(i=>i.value!=null);if(n&&n.value!=null)return n.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function qm(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(qm);const e=t;if(e.__resolveType){const s=vee(e);return s===void 0?t:qm(s)}return ES(e)}function ES(t){const e={};for(const[s,n]of Object.entries(t))e[s]=qm(n);return e}function yee(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function DS(t){return t==null?"":Array.isArray(t)?t.map(DS).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Yh(t,e){if(!t.includes("{"))return;const s=ES(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,o,l)=>{const a=(o??l??"").trim();return DS(yee(s,a))}).trim()||void 0}function _ee(t){return t.replace(/<[^>]*>/g,"").trim()}function Lee(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function wee(t){return/^Option \d+$/.test(t)}function See(t,e){if(e.includes("{"))return Yh(e,t);const s=t[e];if(typeof s=="string"&&s)return s;if(Array.isArray(s)){const n=s.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(n)return n}}function RS(t,e,s){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let n=uc(t);const i=VS(n);if(i&&(n=i,n=uc(n)),s?.titleBy){const l=See(n,s.titleBy);if(l)return l}if(s?.inlineUnionBranches?.length){const l=PS(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),a=s.inlineUnionBranches[l]?.title;if(a&&!wee(a)){const c=Yh(a,n);if(c)return c;if(!a.includes("{"))return a}}for(const l of["name","label","title","alt","text","href","id","key"]){const a=n[l];if(typeof a=="string"&&a.trim()){const c=s?.properties?.[l]?.format;if(c==="rich-text"||c==="html"){const d=_ee(a);if(d)return d;continue}return a}if(Array.isArray(a)){const c=a.map(d=>d==null?"":String(d)).filter(Boolean).join(",");if(c)return c}}const o=n.__resolveType;if(typeof o=="string"&&o)return o.includes("/matchers/")?Ic(n):fs(o);if(s?.title){const l=Yh(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function Jh(t,e){return t.map((s,n)=>RS(s,n,e))}function IS(t,e,s){return RS(t,e,s)}function kee(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const s=e.properties;return s?.mobile?"{{{image.mobile}}}":s?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function G5(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=kee(e);if(!s)return;const n=Yh(s,t);if(!n)return;const i=N3(n)||n;return xee(i)}function T3(t){return t===Br||t===$o}function S9(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function Qh(t,e){const s=t.__resolveType??"";if(!s)return null;if(zs(s)){const n=t.section??{};return MS(n,e)}if(T3(s)){const n=t.variants?.[0]?.value;return n?Qh(n,e):null}return!oi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:S9(s,e)}function MS(t,e){const s=t.__resolveType??"";if(!s)return null;if(T3(s)){const n=t.variants?.[0]?.value;return n?Qh(n,e):null}return!oi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:S9(s,e)}function $S(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!oi(n)||!Object.hasOwn(e,n))return null;const i=S9(n,e);return i?{blockKey:n,...i}:null}function jee(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock&&!e.isHidden){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return S9(n,s)}if(e.isHidden){const o=(zs(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t,l=o.__resolveType??"",a=zs(l)?o.section?.__resolveType??l:l;return T3(a)?null:Qh(o,s)}if(e.isLazy||zs(t.__resolveType)){const n=t.section??{};return MS(n,s)}return Qh(t,s)}function Sn(t){return typeof t=="string"?t:t.label}function rd(t){return typeof t=="object"}function Y5(t){return rd(t)?t.arrayLabel:void 0}function Cee(t){return rd(t)?t.fieldKey:void 0}function Nee(t){return rd(t)?t.ownerPath:void 0}function J5(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function wu(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Vl(t){return t.normalize("NFC").trim()}function Tee(t,e){return e.length>0&&Vl(Sn(e[0]))===Vl(t)?e:[t,...e]}function Vee(t,e){return e.map(s=>{if(!rd(s))return s;const n=s.ownerPath??[];return n[0]===t?s:{...s,ownerPath:[t,...n]}})}function ss(t,e){return Vl(t)===Vl(e)}function Xh(t,e){return Vl(t).replace(/\s+/g,"").toLowerCase()===Vl(e).replace(/\s+/g,"").toLowerCase()}function Aee(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||ss(e,t)||s?.arrayKey!=null&&ss(e,s.arrayKey)}function H0(t,e,s,n,i){const o=Vl(s);if(t.some(a=>ss(Sn(a),o)||ss(Sn(a),s)))return t;const l={label:s,itemIndex:n};return Aee(e,s,i)&&(l.arrayLabel=e),i?.arrayKey&&(l.fieldKey=i.arrayKey),[...t,l]}function Pee(t,e){return t.slice(0,t.length-e.length)}function Eee(t,e,s,n){if(s.length===0)return s;const i=s[0];if(rd(i))return s;const o=n??Al(t,e),l=Sn(i);return ss(l,o)||ss(l,t)?s.slice(1):s}function Al(t,e){return e.title??wu(t)}function Su(t,e,s){const n=s[t];if(!n)return wu(t);const i=Al(t,n);return e.some(l=>{if(l===t)return!1;const a=s[l];return a!=null&&Al(l,a)===i})?wu(t):i}function $me(t,e){return e.isMultivariateSectionTop?0:t-2}function Ome(t,e){return e<=0?[]:t.slice(0,e)}function _c(t,e){return t.type==="array"&&t.items||_9(t)?!0:Array.isArray(e)}function OS(t,e=0){if(e>6||!t.properties)return!1;for(const s of Object.keys(t.properties)){const n=t.properties[s];if(n&&(_c(n)||n.type==="object"&&OS(n,e+1)))return!0}return!1}function BS(t,e=0){if(e>6||t==null||typeof t!="object")return!1;if(Array.isArray(t))return t.some(s=>s!=null&&typeof s=="object"&&!Array.isArray(s));for(const[s,n]of Object.entries(t))if(!s.startsWith("__")&&BS(n,e+1))return!0;return!1}function Dee(t,e,s={}){const n=t.filter(i=>{const o=e[i];if(!o)return!1;if(o.type==="object"&&OS(o))return!0;const l=s[i];return l!=null&&typeof l=="object"&&!Array.isArray(l)?BS(l):!1});return n.length>1?new Set(n):new Set}function Q5(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Ree(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=IS(t,e);return s===`Item ${e+1}`?void 0:s}function Zh(t,e,s={n:4e3},n=0){if(n>4||s.n<=0||t==null||typeof t!="object")return!1;if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];if(--s.n<=0)return!1;const l=Ree(o,i);if(l&&ss(l,e)||Zh(o,e,s,n+1))return!0}return!1}for(const[i,o]of Object.entries(t))if(!i.startsWith("__")){if(--s.n<=0)return!1;if((Array.isArray(o)||o!=null&&typeof o=="object")&&(Xh(wu(i),e)||Xh(i,e))||Zh(o,e,s,n+1))return!0}return!1}function zS(t,e,s,n=0){if(!s||n>4||t==null||typeof t!="object")return!1;const i=t.__resolveType;if(typeof i!="string"||!i)return!1;const o=Rn(i,s)?.properties;if(!o)return!1;const l=Object.keys(o);for(const a of l){const c=o[a];if(!c)continue;if(_c(c)){const u=Su(a,l,o);if(ss(u,e)||ss(a,e))return!0}const d=t[a];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&zS(d,e,s,n+1))return!0}return!1}function ml(t,e,s,n,i,o){if(n.length===0)return null;const l=Sn(n[0]),a=Cee(n[0]);if(a!=null)for(const x of t){const b=e[x];if(!(!b||!_c(b,s[x]))&&x===a)return x}const c=n.flatMap(x=>Nee(x)??[]);if(c.length>0){const x=t.filter(b=>e[b]?.type==="block-ref"&&c.includes(b));if(x.length===1)return x[0]}for(const x of t){const b=e[x];if(!b||!_c(b,s[x]))continue;const v=Su(x,t,e);if(ss(l,v)||ss(l,x)||n.some(L=>{if(ss(Sn(L),v)||ss(Sn(L),x))return!0;const _=Y5(L);return _!=null&&(ss(_,v)||ss(_,x))}))return x}for(const x of t){const b=e[x];if(!b||!_c(b,s[x]))continue;const v=s[x];if(!Array.isArray(v))continue;if(Jh(v,b.items).some(_=>ss(_,l)))return x}let d=null,u=!1,h=null,f=!1;for(const x of t){const b=e[x];if(b?.type!=="object"||!b.properties)continue;const v=Object.keys(b.properties),L=Q5(s[x]),_=Su(x,t,e);if((ss(l,_)||ss(l,x))&&ml(v,b.properties,L,n.slice(1),i,o)!=null){d===null?d=x:u=!0;continue}ml(v,b.properties,L,n,i,o)!=null&&(h===null?h=x:f=!0)}if(d!==null)return u?null:d;if(h!==null)return f?null:h;for(const x of t){const b=e[x];if(b?.type!=="inline-union"||!b.inlineUnionBranches?.length)continue;const v=Q5(s[x]),L=Al(x,b);for(const _ of b.inlineUnionBranches){const y=_.schema?.properties;if(!y)continue;const S=Object.keys(y);if(ml(S,y,v,n,i,o)||(ss(l,L)||ss(l,x))&&ml(S,y,v,n.slice(1),i,o))return x}}let m=null;const p=[],g=n.map(Y5).filter(x=>x!=null);for(const x of t){const b=e[x];if(b?.type!=="block-ref")continue;const v=Al(x,b);if(l!==v&&l!==x){const L=s[x],y=(i?$S(L,i):null)?.data??L;(Zh(y,l)||g.some(S=>Zh(y,S)||zS(y,S,o)))&&p.push(x);continue}if(n.length>1){const L=s[x];if(L&&typeof L=="object"&&!Array.isArray(L)){const _=Sn(n[1]);if(Object.keys(L).some(S=>!S.startsWith("__")&&(Xh(wu(S),_)||Xh(S,_))))return x}}m||(m=x)}return m||(p.length===1?p[0]:(p.length>1,null))}function Iee(t,e,s,n,i,o){return ml(t,e,s,n,i,o)}function Mee(t,e,s,n,i,o,l){if(i.length===0||!s.properties)return!1;const a=Object.keys(s.properties);if(ml(a,s.properties,n,i,o,l))return!0;const c=Sn(i[0]);return!ss(c,e)&&!ss(c,t)?!1:i.length>1||ml(a,s.properties,n,i.slice(1),o,l)!==null}function X5(t,e,s,n,i){if(!rd(s))return-1;if(s.fieldKey!=null&&i!=null)return s.fieldKey!==i?-1:s.itemIndex>=0&&s.itemIndex<t.length?s.itemIndex:-1;const o=Jh(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&ss(o[s.itemIndex],s.label))return s.itemIndex;if(n!=null&&n===s.itemIndex&&n>=0&&n<t.length)return n;const l=n!=null?o[n]:void 0;return l!==void 0&&ss(l,s.label)?n:o.findIndex(a=>ss(a,s.label))}function $ee(t,e,s,n,i,o){if(e.length===0)return null;for(let a=0;a<e.length;a++){const c=e[a],d=X5(s,n,c,i,o);if(d>=0)return{index:d,innerPath:e.slice(a+1),crumbIndex:a}}const l=e.findIndex(a=>ss(Sn(a),t));if(l>=0&&e.length>l+1){const a=e[l+1],c=X5(s,n,a,i,o);if(c>=0)return{index:c,innerPath:e.slice(l+2),crumbIndex:l+1}}return null}function w1(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===Br}function Oee(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>w1(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>w1(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>w1(s.resolveType)):!1}function Bee(t,e){if(e==="global"||e==="sections"||_9(t))return!0;const s=t.type==="array"?t.items:void 0;return s?Oee(s):!1}function Z5(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function FS(t){return t.map((e,s)=>({...e,index:s}))}function zee(t,e){if(e===t.length)return t;if(e<t.length)return FS(t.slice(0,e));const s=Array.from({length:e-t.length},(n,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...s]}function Fee(t,e){const s=t.findIndex(o=>o.index===e),n=t.map(o=>o.index>e?{...o,index:o.index+1}:o),i={id:crypto.randomUUID(),index:e+1};return s===-1?[...n,i]:[...n.slice(0,s+1),i,...n.slice(s+1)]}function Uee(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const Hee="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",Kee="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-6 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-6 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",Wee="w-6 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function eb(t,e){return ie("h-6 shrink-0 overflow-hidden",e?Hee:t?Wee:Kee)}function qee(t){const e=z.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Uc,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n&&r.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==s?(l=r.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=r.jsxs(r.Fragment,{children:[i,r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[o,l]})]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function Gee(t){const e=z.c(67),{sortableId:s,labelText:n,imageSrc:i,hidden:o,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,u=re();let h;e[0]!==s?(h={id:s,animateLayoutChanges:Xee},e[0]=s,e[1]=h):h=e[1];const{attributes:f,listeners:m,setNodeRef:p,transform:g,isDragging:x}=h9(h);let b;e[2]!==g?(b=ki.Transform.toString(g?{...g,x:0}:null),e[2]=g,e[3]=b):b=e[3];const v=x?0:void 0;let L;e[4]!==b||e[5]!==v?(L={transform:b,opacity:v},e[4]=b,e[5]=v,e[6]=L):L=e[6];const _=L;let y;e[7]!==a?(y=Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),a())},e[7]=a,e[8]=y):y=e[8];const S=x?"cursor-grabbing":"cursor-pointer";let k;e[9]!==S?(k=ie("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",S),e[9]=S,e[10]=k):k=e[10];let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=r.jsx(Uc,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=w):w=e[11];let j;e[12]!==i?(j=i&&r.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=j):j=e[13];const N=o&&"line-through opacity-50";let T;e[14]!==N?(T=ie("min-w-0 flex-1 truncate text-sm",N),e[14]=N,e[15]=T):T=e[15];let C;e[16]!==n||e[17]!==T?(C=r.jsx("span",{className:T,children:n}),e[16]=n,e[17]=T,e[18]=C):C=e[18];let V;e[19]!==o||e[20]!==l||e[21]!==u?(V=l&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":u(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:ie(eb(o===!0,o===!0)),onClick:Y=>{Y.stopPropagation(),l()},onPointerDown:Qee,children:o?r.jsx(xA,{size:14}):r.jsx(Bu,{size:14})})}),r.jsx(Ke,{side:"bottom",children:u(o?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[19]=o,e[20]=l,e[21]=u,e[22]=V):V=e[22];let A;e[23]!==n||e[24]!==u?(A=u("sectionsEditor.arrayField.openActionsFor",{label:n}),e[23]=n,e[24]=u,e[25]=A):A=e[25];let E;e[26]!==o?(E=ie(eb(o===!0,!1),"data-[state=open]:ml-0 data-[state=open]:w-6 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]"),e[26]=o,e[27]=E):E=e[27];let D;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=r.jsx(Gn,{size:14}),e[28]=D):D=e[28];let I;e[29]!==A||e[30]!==E?(I=r.jsx(Zt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":A,className:E,onClick:Jee,onPointerDown:Yee,children:D})}),e[29]=A,e[30]=E,e[31]=I):I=e[31];let R;e[32]!==c?(R=Y=>{Y.stopPropagation(),c()},e[32]=c,e[33]=R):R=e[33];let $;e[34]===Symbol.for("react.memo_cache_sentinel")?($=r.jsx(dn,{size:14}),e[34]=$):$=e[34];let B;e[35]!==u?(B=u("sectionsEditor.arrayField.duplicate"),e[35]=u,e[36]=B):B=e[36];let M;e[37]!==R||e[38]!==B?(M=r.jsxs(Xe,{onClick:R,children:[$,B]}),e[37]=R,e[38]=B,e[39]=M):M=e[39];let O;e[40]!==d?(O=Y=>{Y.stopPropagation(),d()},e[40]=d,e[41]=O):O=e[41];let F;e[42]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsx(rn,{size:14}),e[42]=F):F=e[42];let U;e[43]!==u?(U=u("sectionsEditor.arrayField.delete"),e[43]=u,e[44]=U):U=e[44];let K;e[45]!==O||e[46]!==U?(K=r.jsxs(Xe,{className:"text-destructive focus:text-destructive",onClick:O,children:[F,U]}),e[45]=O,e[46]=U,e[47]=K):K=e[47];let q;e[48]!==M||e[49]!==K?(q=r.jsxs(es,{align:"end",children:[M,K]}),e[48]=M,e[49]=K,e[50]=q):q=e[50];let W;e[51]!==I||e[52]!==q?(W=r.jsxs(Xt,{children:[I,q]}),e[51]=I,e[52]=q,e[53]=W):W=e[53];let G;return e[54]!==f||e[55]!==n||e[56]!==m||e[57]!==a||e[58]!==p||e[59]!==_||e[60]!==C||e[61]!==V||e[62]!==W||e[63]!==y||e[64]!==k||e[65]!==j?(G=r.jsxs("div",{ref:p,style:_,...f,...m,role:"button",tabIndex:0,onClick:a,onKeyDown:y,className:k,title:n,children:[w,j,C,V,W]}),e[54]=f,e[55]=n,e[56]=m,e[57]=a,e[58]=p,e[59]=_,e[60]=C,e[61]=V,e[62]=W,e[63]=y,e[64]=k,e[65]=j,e[66]=G):G=e[66],G}function Yee(t){return t.stopPropagation()}function Jee(t){return t.stopPropagation()}function Qee(t){return t.stopPropagation()}function Xee(){return!1}function Zee(t,e,s,n,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const o=t.__resolveType;if(typeof o=="string"&&s){const l=Rn(o,s);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(s&&n&&i){const l=Rn(n,s)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function ete(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function K0({schema:t,value:e,onChange:s,path:n,label:i,breadcrumbPath:o=[],onBreadcrumbChange:l,hasSiblingDrillDownFields:a,meta:c,decofile:d,onSaveReferencedBlock:u,containerResolveType:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}){const x=re(),b=w9(g?.virtualMcpId),v=Array.isArray(e)?e:[],L=t.items,_=ete(n),y={arrayKey:_,hasSiblingDrillDownFields:a,itemLabelFromSchema:!!(L?.titleBy||L?.inlineUnionBranches?.length)},S=Bee(t,_),k=!S&&L?.type==="object",[w,j]=P.useState(null),N=$ee(i,o,v,L,w,_),T=N?.index??null;N===null?w!==null&&j(null):N.index!==w&&j(N.index);const[C,V]=P.useState(()=>Z5(v.length)),[A,E]=P.useState(null),[D,I]=P.useState(n),[R,$]=P.useState(v.length),B=P.useRef(!1),M=P.useRef(null);D!==n?(I(n),$(v.length),V(Z5(v.length)),j(null)):R!==v.length&&($(v.length),V(le=>zee(le,v.length)));const O=(le,ue)=>IS(uc(le),ue,L),F=le=>{if(B.current)return;const ue=O(v[le],le);j(le),l?.(H0(o,i,ue,le,y))},U=le=>{const ue=[...v,le];s(ue);const fe=ue.length-1;j(fe);const ae=O(le,fe);l?.(H0(o,i,ae,fe,y))},K=()=>{const le=L?.type,ue=L?.default!==void 0?L.default:le==="object"?{}:le==="block-ref"?(()=>{const X=L?.anyOfRefs?.[0]?.resolveType;return typeof X!="string"||Jd(X)?{}:{__resolveType:X}})():le==="number"||le==="integer"?0:le==="boolean"?!1:le==="array"?[]:"",fe=[...v,ue];s(fe);const ae=fe.length-1;j(ae);const de=O(ue,ae);l?.(H0(o,i,de,ae,y))},q=()=>{if(S){if(!f){ge.error(x("sectionsEditor.arrayField.startPreviewServer"));return}if(p){p({append:U});return}ge.error(x("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}K()},W=le=>{const ue=v[le],fe=typeof structuredClone=="function"?structuredClone(ue):JSON.parse(JSON.stringify(ue??null)),ae=[...v.slice(0,le+1),fe,...v.slice(le+1)];s(ae),V(de=>Fee(de,le))},G=le=>{const ue=v[le],fe=[...v];fe[le]=tu(ue)?TS(ue):K5(ue),s(fe)},Y=le=>{s(v.filter((ue,fe)=>fe!==le)),V(ue=>Uee(ue,le))},ee=(le,ue)=>{const fe=[...v];if(fe[le]=tu(v[le])?K5(ue):ue,s(fe),le===T&&N){const ae=O(v[le],le),de=O(fe[le],le);if(M.current={path:n,index:le,label:de},ae!==de){const X=[...o];X[N.crumbIndex]=J5(o[N.crumbIndex],de,le),l?.(X)}}},ne=Qu(ar(Kl,{activationConstraint:{distance:8}}),ar(Hl,{coordinateGetter:f9})),oe=C.map(le=>le.id),Z=le=>{E(String(le.active.id))},J=le=>{E(null);const{active:ue,over:fe}=le;if(!fe||ue.id===fe.id)return;const ae=oe.indexOf(String(ue.id)),de=oe.indexOf(String(fe.id));ae===-1||de===-1||(V(X=>FS(Nl([...X],ae,de))),s(Nl([...v],ae,de)),B.current=!0,requestAnimationFrame(()=>{B.current=!1}))},H=()=>{E(null)},se=A?C.find(le=>le.id===A):null,Q=se!=null?v[se.index]:void 0,ce=se!=null&&Q!==void 0?Jh(v,L)[se.index]:null,te=se!=null&&Q!==void 0?G5(uc(Q),L):void 0;if(T!==null&&T<v.length){const le=uc(v[T]),ue=Zee(le,L,c,h,_),fe=()=>{if(!N)return H0(o,i,O(le,T),T,y);const ae=o.slice(0,N.crumbIndex+1),de=M.current,X=de?.path===n&&de.index===T?de.label:O(le,T);return ae[N.crumbIndex]=J5(ae[N.crumbIndex],X,T),ae};return r.jsx("div",{className:"min-w-0",children:ue?.type==="object"&&ue.properties?r.jsx(Ri,{schema:ue,value:le,onChange:ae=>ee(T,ae),basePath:`${n}.${T}`,breadcrumbPath:N?.innerPath??[],onBreadcrumbChange:ae=>{l?.([...fe(),...ae])},meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):ue?Pl({schema:ue,value:le,onChange:ae=>ee(T,ae),path:`${n}.${T}`,required:!0,label:ue.title&&!ue.title.includes("{{")?ue.title:O(le,T),breadcrumbPath:N?.innerPath??[],onBreadcrumbChange:ae=>{l?.([...fe(),...ae])},meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):null})}return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(S3,{description:t.description,virtualMcpId:g?.virtualMcpId,children:r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:i})}),v.length>0&&r.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:v.length})]}),!b&&t.description&&r.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:t.description}),v.length>0&&r.jsx("div",{className:ie(A&&"cursor-grabbing"),children:r.jsxs(Zu,{sensors:ne,collisionDetection:Ig,onDragStart:Z,onDragEnd:J,onDragCancel:H,children:[r.jsx(u9,{items:oe,strategy:d9,children:r.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const le=Jh(v,L);return C.map(ue=>{const fe=v[ue.index];if(fe===void 0)return null;const ae=le[ue.index]??O(fe,ue.index),de=G5(uc(fe),L);return r.jsx(Gee,{sortableId:ue.id,labelText:ae,imageSrc:de,hidden:tu(fe),onToggleHidden:k?()=>G(ue.index):void 0,onOpen:()=>F(ue.index),onDuplicate:()=>W(ue.index),onRemove:()=>Y(ue.index)},ue.id)})})()})}),_n.createPortal(r.jsx(c9,{dropAnimation:CS,children:ce?r.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:r.jsx(qee,{labelText:ce,imageSrc:te})}):null}),document.body)]})}),r.jsxs("button",{type:"button",onClick:q,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[r.jsx(Ht,{size:14}),x(S?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function tte(t){const e=z.c(53),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,focused:d,meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}=t;let b;e[0]!==a?(b=a===void 0?[]:a,e[0]=a,e[1]=b):b=e[1];const v=b,[L,_]=P.useState(!1),y=w9(x?.virtualMcpId);let S;e[2]!==n?(S=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=S):S=e[3];const k=S;if(!s.properties)return null;let w;e[4]!==v||e[5]!==h||e[6]!==u||e[7]!==k||e[8]!==p||e[9]!==c||e[10]!==i||e[11]!==g||e[12]!==f||e[13]!==o||e[14]!==m||e[15]!==x||e[16]!==s?(w=r.jsx(Ri,{schema:s,value:k,onChange:i,basePath:o,breadcrumbPath:v,onBreadcrumbChange:c,meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}),e[4]=v,e[5]=h,e[6]=u,e[7]=k,e[8]=p,e[9]=c,e[10]=i,e[11]=g,e[12]=f,e[13]=o,e[14]=m,e[15]=x,e[16]=s,e[17]=w):w=e[17];const j=w;if(d)return j;let N;e[18]!==o?(N=o.split(".").pop()??o,e[18]=o,e[19]=N):N=e[19];const T=N;let C;e[20]!==v||e[21]!==h||e[22]!==T||e[23]!==l||e[24]!==u||e[25]!==k||e[26]!==s?(C=Mee(T,l,s,k,v,h,u),e[20]=v,e[21]=h,e[22]=T,e[23]=l,e[24]=u,e[25]=k,e[26]=s,e[27]=C):C=e[27];const A=L||C,E=`${o}-fields`;let D;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=()=>_(ste),e[28]=D):D=e[28];let I;e[29]!==A?(I=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:A?r.jsx(_s,{size:16}):r.jsx(nn,{size:16})}),e[29]=A,e[30]=I):I=e[30];const R=x?.virtualMcpId;let $;e[31]!==l?($=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[31]=l,e[32]=$):$=e[32];let B;e[33]!==s.description||e[34]!==$||e[35]!==R?(B=r.jsx(S3,{description:s.description,virtualMcpId:R,children:$}),e[33]=s.description,e[34]=$,e[35]=R,e[36]=B):B=e[36];let M;e[37]!==E||e[38]!==A||e[39]!==B||e[40]!==I?(M=r.jsxs("button",{type:"button","aria-expanded":A,"aria-controls":E,onClick:D,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[I,B]}),e[37]=E,e[38]=A,e[39]=B,e[40]=I,e[41]=M):M=e[41];let O;e[42]!==s.description||e[43]!==y?(O=!y&&s.description&&r.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:s.description}),e[42]=s.description,e[43]=y,e[44]=O):O=e[44];let F;e[45]!==E||e[46]!==j||e[47]!==A?(F=A&&r.jsx("div",{id:E,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:j}),e[45]=E,e[46]=j,e[47]=A,e[48]=F):F=e[48];let U;return e[49]!==M||e[50]!==O||e[51]!==F?(U=r.jsxs("div",{className:"min-w-0 space-y-2",children:[M,O,F]}),e[49]=M,e[50]=O,e[51]=F,e[52]=U):U=e[52],U}function ste(t){return!t}function Bme(t,e,s,n,i){const o={...t[e]};if(i.length>1){const l=o.sections,a=[...l?.variants??[]];a[n]&&(a[n]={...a[n],value:s}),o.sections={...l,variants:a}}else o.sections=s;return o}function zme(t){return structuredClone(t)}function Fme(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function US(t){const e=t.replace(/[^A-Za-z0-9_ -]/g,"").replace(/\s+/g," ").trim();return/^[A-Za-z]/.test(e)?e:e?`Block ${e}`:""}function V3(t,e){const s=t.trim();return s?s.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,s)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_ -]*$/.test(s)?null:"Use letters, numbers, spaces, hyphens, or underscores. Must start with a letter.":"Block name is required."}function A3(t){const e=z.c(61),{open:s,onOpenChange:n,defaultBlockId:i,isPending:o,onSubmit:l}=t,a=i===void 0?"":i,c=o===void 0?!1:o,[d,u]=P.useState(a),[h,f]=P.useState(s);s!==h&&(f(s),s&&u(a));let m;e[0]!==c||e[1]!==n?(m=O=>{!O&&!c&&n(!1)},e[0]=c,e[1]=n,e[2]=m):m=e[2];const p=m;let g;e[3]!==d||e[4]!==c||e[5]!==l?(g=async O=>{O.preventDefault();const F=d.trim();!F||c||await l(F)},e[3]=d,e[4]=c,e[5]=l,e[6]=g):g=e[6];const x=g,b=re();let v;e[7]!==b?(v=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=v):v=e[8];let L;e[9]!==v?(L=r.jsx(Kt,{children:v}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==b?(_=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=_):_=e[12];let y;e[13]!==_?(y=r.jsx(kn,{children:_}),e[13]=_,e[14]=y):y=e[14];let S;e[15]!==L||e[16]!==y?(S=r.jsxs(os,{children:[L,y]}),e[15]=L,e[16]=y,e[17]=S):S=e[17];let k;e[18]!==b?(k=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=k):k=e[19];let w;e[20]!==k?(w=r.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:k}),e[20]=k,e[21]=w):w=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=O=>u(O.target.value),e[22]=j):j=e[22];let N;e[23]!==b?(N=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=N):N=e[24];let T;e[25]!==d||e[26]!==c||e[27]!==N?(T=r.jsx(gt,{id:"block-id",value:d,onChange:j,placeholder:N,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=N,e[28]=T):T=e[28];let C;e[29]!==w||e[30]!==T?(C=r.jsxs("div",{className:"py-4 space-y-2",children:[w,T]}),e[29]=w,e[30]=T,e[31]=C):C=e[31];let V;e[32]!==n?(V=()=>n(!1),e[32]=n,e[33]=V):V=e[33];let A;e[34]!==b?(A=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=A):A=e[35];let E;e[36]!==c||e[37]!==V||e[38]!==A?(E=r.jsx(he,{type:"button",variant:"outline",onClick:V,disabled:c,children:A}),e[36]=c,e[37]=V,e[38]=A,e[39]=E):E=e[39];let D;e[40]!==d||e[41]!==c?(D=!d.trim()||c,e[40]=d,e[41]=c,e[42]=D):D=e[42];let I;e[43]!==c||e[44]!==b?(I=c?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=I):I=e[45];let R;e[46]!==D||e[47]!==I?(R=r.jsx(he,{type:"submit",disabled:D,children:I}),e[46]=D,e[47]=I,e[48]=R):R=e[48];let $;e[49]!==E||e[50]!==R?($=r.jsxs(qn,{children:[E,R]}),e[49]=E,e[50]=R,e[51]=$):$=e[51];let B;e[52]!==x||e[53]!==C||e[54]!==$||e[55]!==S?(B=r.jsx(Bt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:x,children:[S,C,$]})}),e[52]=x,e[53]=C,e[54]=$,e[55]=S,e[56]=B):B=e[56];let M;return e[57]!==p||e[58]!==s||e[59]!==B?(M=r.jsx(zt,{open:s,onOpenChange:p,children:B}),e[57]=p,e[58]=s,e[59]=B,e[60]=M):M=e[60],M}function nte(t){if(!t?.properties)return{};const e={};for(const[s,n]of Object.entries(t.properties))s.startsWith("__")||s==="@type"||(n.default!==void 0?e[s]=n.default:n.type==="boolean"?e[s]=!1:n.type==="string"?e[s]="":n.type==="number"||n.type==="integer"?e[s]=0:n.type==="object"&&(e[s]={}));return e}function ite(t){const e=z.c(13),{blockKey:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Mn,{size:11}),e[0]=i):i=e[0];let o;e[1]!==n?(o=n("sectionsEditor.anyOfField.global"),e[1]=n,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx(He,{asChild:!0,children:r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[i,o]})}),e[3]=o,e[4]=l):l=e[4];let a;e[5]!==s||e[6]!==n?(a=n("sectionsEditor.anyOfField.globalLoaderTooltip",{blockKey:s}),e[5]=s,e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=r.jsx(Ke,{side:"top",className:"max-w-[260px]",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=r.jsxs(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function rte(t){const e=z.c(36),{path:s,open:n,onOpenChange:i,title:o,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:u}=t,h=re(),f=`${s}-loader-config`,m=a&&"ml-1";let p;e[0]!==m?(p=ie("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=p):p=e[1];let g;e[2]!==i||e[3]!==n?(g=()=>i(!n),e[2]=i,e[3]=n,e[4]=g):g=e[4];let x;e[5]!==n?(x=r.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?r.jsx(_s,{size:16}):r.jsx(nn,{size:16})}),e[5]=n,e[6]=x):x=e[6];let b;e[7]!==o?(b=r.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:o}),e[7]=o,e[8]=b):b=e[8];let v;e[9]!==c?(v=c&&r.jsx(ite,{blockKey:c}),e[9]=c,e[10]=v):v=e[10];let L;e[11]!==b||e[12]!==v?(L=r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,v]}),e[11]=b,e[12]=v,e[13]=L):L=e[13];let _;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==L?(_=r.jsxs("button",{type:"button","aria-expanded":n,"aria-controls":f,onClick:g,className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-3 py-2.5 text-left",children:[x,L]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=L,e[19]=_):_=e[19];let y;e[20]!==c||e[21]!==d||e[22]!==u||e[23]!==h?(y=(d||u)&&r.jsxs(Xt,{children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":h("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:r.jsx(Gn,{size:16})})}),r.jsxs(es,{align:"end",className:"w-48",children:[c&&d&&r.jsxs(Xe,{onClick:d,children:[r.jsx(_o,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.detach")]}),!c&&u&&r.jsxs(Xe,{onClick:u,children:[r.jsx(Mn,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=u,e[23]=h,e[24]=y):y=e[24];let S;e[25]!==_||e[26]!==y?(S=r.jsxs("div",{className:"group flex w-full min-w-0 items-center gap-1 rounded-lg pr-2 transition-colors hover:bg-accent/50",children:[_,y]}),e[25]=_,e[26]=y,e[27]=S):S=e[27];let k;e[28]!==f||e[29]!==l||e[30]!==n?(k=n&&r.jsx("div",{id:f,className:"border-t border-border/60 px-4 pb-4 pt-3",children:r.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[28]=f,e[29]=l,e[30]=n,e[31]=k):k=e[31];let w;return e[32]!==S||e[33]!==k||e[34]!==p?(w=r.jsxs("div",{className:p,children:[S,k]}),e[32]=S,e[33]=k,e[34]=p,e[35]=w):w=e[35],w}function tb(t){const e=z.c(42),{schema:s,value:n,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}=t,g=re(),x=(s.anyOfRefs??[]).filter(ate),b=u&&n?$S(n,u):null,v=b?.data??n,L=b?null:VS(v),_=L??v,y=cee(x,{savedBlockKey:b?.blockKey,editorValue:v}),S=y.length>0?dee(v,y,b?.blockKey):y[0]?.resolveType??"",w=s.type==="block-ref"&&y.some(lte);let j;e[0]!==l||e[1]!==o?(j=l??(o.includes(".")?o.split(".")[0]:o),e[0]=l,e[1]=o,e[2]=j):j=e[2];const N=j;let T;e[3]!==a?(T=a??[],e[3]=a,e[4]=T):T=e[4];const C=T,V=w&&C.length>0&&Sn(C[0])===N,A=V?C.slice(1):C,E=V?ne=>{c?.([N,...ne])}:c,[D,I]=P.useState(S),[R,$]=P.useState(S);R!==S&&($(S),I(S));const[B,M]=P.useState(()=>hee(v,b?.blockKey)),[O,F]=P.useState(!1);if(y.length>0){const ne=D||S;let oe;e[5]!==ne?(oe=Te=>Te.resolveType===ne,e[5]=ne,e[6]=oe):oe=e[6];const Z=y.find(oe),J=W5(v,d,Z?.schema),H=uee(J??Z?.schema??null,s.discriminatorKey),se=s.discriminatorKey,Q=Te=>{I(Te);const ve=y.find(ze=>ze.resolveType===Te),ke=W5(v,d,ve?.schema),Le=new Set(Object.keys((ke??ve?.schema)?.properties??{})),Ne=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},et=Object.fromEntries(Object.entries(Ne).filter(ze=>{const[Me]=ze;return Le.has(Me)})),Ye={...nte(ve?.schema),...et};if(se){const ze=ve?.discriminatorValue??Te;i({...Ye,[se]:ze});return}if(Jd(Te)){i(Ye);return}i({...Ye,__resolveType:Te})};let ce;e[7]!==ne||e[8]!==se||e[9]!==i?(ce=Te=>{if(se||!Jd(ne)||Te===null||typeof Te!="object"||Array.isArray(Te)){i(Te);return}const{__resolveType:ve,...ke}=Te;i(ke)},e[7]=ne,e[8]=se,e[9]=i,e[10]=ce):ce=e[10];const te=ce,le=H?.properties?r.jsx(Ri,{schema:H,value:_,onChange:Te=>{if(b&&h){h(b.blockKey,Te);return}if(L){i({...v,section:Te});return}te(Te)},basePath:o,breadcrumbPath:A,onBreadcrumbChange:E,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}):null;if(w&&le&&A.length>0){let Te;return e[11]!==le?(Te=r.jsx("div",{className:"min-w-0",children:le}),e[11]=le,e[12]=Te):Te=e[12],Te}let ue;e[13]!==o?(ue=o.includes("."),e[13]=o,e[14]=ue):ue=e[14];const fe=ue,ae=b?()=>{const{name:Te,...ve}=b.data;i(ve)}:void 0,de=!b&&!L&&!!h&&w&&!Jd(ne)&&ne.includes("/"),X=_&&typeof _=="object"&&!Array.isArray(_)?_:{},pe=Te=>{if(!h)return;const ve=Te.trim(),ke=u?V3(ve,u):null;if(ke){ge.error(ke);return}h(ve,{...X,__resolveType:ne,name:ve}),i({__resolveType:ve}),F(!1),ge.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:ve}))},ye=f?.virtualMcpId;let we;e[15]!==l||e[16]!==o||e[17]!==s.description||e[18]!==ye?(we=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:ye}),e[15]=l,e[16]=o,e[17]=s.description,e[18]=ye,e[19]=we):we=e[19];let _e;e[20]!==g?(_e=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=_e):_e=e[21];let Pe;e[22]!==_e?(Pe=r.jsx(Ns,{placeholder:_e}),e[22]=_e,e[23]=Pe):Pe=e[23];let Se;return e[24]!==o||e[25]!==Pe?(Se=r.jsx(gs,{id:o,children:Pe}),e[24]=o,e[25]=Pe,e[26]=Se):Se=e[26],r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[we,r.jsxs(ps,{value:ne||void 0,onValueChange:Q,children:[Se,r.jsx(xs,{children:y.map(ote)})]})]}),le&&(w?r.jsx(rte,{path:o,open:B,onOpenChange:M,title:g(fe?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:le,nestedBlockRef:fe,globalBlockKey:b?.blockKey,onDetach:ae,onMakeGlobal:de?()=>F(!0):void 0}):le),de&&r.jsx(A3,{open:O,onOpenChange:F,defaultBlockId:US(fs(ne)),onSubmit:pe})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const U=f?.virtualMcpId;let K;e[27]!==l||e[28]!==o||e[29]!==s.description||e[30]!==U?(K=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:U}),e[27]=l,e[28]=o,e[29]=s.description,e[30]=U,e[31]=K):K=e[31];const q=n!=null?String(n):"";let W;e[32]!==i?(W=ne=>i(ne.target.value),e[32]=i,e[33]=W):W=e[33];const G=s.description??"";let Y;e[34]!==o||e[35]!==q||e[36]!==W||e[37]!==G?(Y=r.jsx("input",{id:o,type:"text",value:q,onChange:W,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:G}),e[34]=o,e[35]=q,e[36]=W,e[37]=G,e[38]=Y):Y=e[38];let ee;return e[39]!==K||e[40]!==Y?(ee=r.jsxs("div",{className:"space-y-1.5",children:[K,Y]}),e[39]=K,e[40]=Y,e[41]=ee):ee=e[41],ee}function ote(t){const e=aee(t);return r.jsx(It,{value:t.resolveType,children:e},t.resolveType)}function lte(t){return t.resolveType.includes("/")&&!Jd(t.resolveType)}function ate(t){return t.resolveType!==""}const S1=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function cte(t){const e={};if(typeof t!="string")return e;const s=/<symbol\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/symbol>/gi;for(const n of t.matchAll(s)){const i=n[1]??"",o=n[2]??"",l=S1(i,"id");if(!l)continue;const a=S1(i,"viewBox"),c=S1(i,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',a?`viewBox="${a}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[l]=`<svg ${d}>${o}</svg>`}return e}async function dte(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return cte(await e.text())}function ute(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)if(typeof s=="string")e.push({value:s,label:s});else if(s&&typeof s=="object"&&"value"in s){const n=s;e.push({value:String(n.value),label:typeof n.label=="string"?n.label:String(n.value),image:typeof n.image=="string"?n.image:void 0,icon:typeof n.icon=="string"?n.icon:void 0})}return e}function hte(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)typeof s=="string"&&e.push({value:s,label:s});return e}function fte(t,e){return t.length>0?t:e}function mte(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function pte({loaderPath:t,isIconSelect:e,enumFallbackCount:s,trimmedSearch:n,optionValues:i,optionsSettled:o}){return!!t&&!e&&s===0&&o&&n.length>0&&!i.includes(n)}function HS(t,e){const n=`<style>${e?`svg{color:${e}}`:""}.fill-current{fill:currentColor}.stroke-current{stroke:currentColor}.text-current{color:currentColor}</style>`,i=t.replace(/(<svg[^>]*>)/i,`$1${n}`);return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function gte(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function xte(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return HS(t.icon,e)}async function bte(t,e,s){const n={};s&&(n.term=s);const o=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(o,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new Error(`Failed to fetch dynamic options: ${l.status}`);const a=await l.json();return ute(a)}function sb(t){const e=z.c(9),{option:s,className:n,fg:i}=t;let o;e[0]!==i||e[1]!==s?(o=xte(s,i),e[0]=i,e[1]=s,e[2]=o):o=e[2];const l=o;if(!l)return null;const a=s.image?"rounded object-cover":"object-contain";let c;e[3]!==n||e[4]!==a?(c=ie("shrink-0",a,n),e[3]=n,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=r.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function vte(t){const e=z.c(53),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=re(),d=s.options,u=a?.previewUrl,[h,f]=P.useState(!1),[m,p]=P.useState(""),[g,x]=P.useState(""),b=P.useRef(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=te=>{p(te),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(te)},300)},e[0]=v):v=e[0];const L=v,_=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",y=typeof n=="string"?n:"",S=s.format==="icon-select";let k;e[1]!==g||e[2]!==d||e[3]!==_?(k=Qe.sandboxInvoke(_,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=_,e[4]=k):k=e[4];let w;e[5]!==g||e[6]!==d||e[7]!==u?(w=()=>bte(u,d,g||void 0),e[5]=g,e[6]=d,e[7]=u,e[8]=w):w=e[8];const j=!!u&&!!d&&(h||!!y);let N;e[9]!==k||e[10]!==w||e[11]!==j?(N={queryKey:k,queryFn:w,enabled:j,staleTime:6e4,retry:1},e[9]=k,e[10]=w,e[11]=j,e[12]=N):N=e[12];const T=Pt(N),C=T.data??[];let V;e[13]!==_?(V=Qe.sandboxSprite(_),e[13]=_,e[14]=V):V=e[14];let A;e[15]!==u||e[16]!==a?(A=()=>dte(O7({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,threadId:a.threadId,previewUrl:u},"/sprites.svg")),e[15]=u,e[16]=a,e[17]=A):A=e[17];const E=S&&!!a&&(h||!!y)&&(!d||T.isFetched&&C.length===0);let D;e[18]!==V||e[19]!==A||e[20]!==E?(D={queryKey:V,queryFn:A,enabled:E,staleTime:3e5,retry:1},e[18]=V,e[19]=A,e[20]=E,e[21]=D):D=e[21];const I=Pt(D),R=hte(s.enum),$=I.data??{},B=gte(),M=Object.fromEntries(Object.entries($).map(te=>{const[le,ue]=te;return[le,HS(ue,B)]})),O=S&&Object.keys(M).length>0?R.map(te=>({...te,previewSrc:M[te.value]})):R,F=fte(C,O),U=mte(F,m);let K;e[22]!==y?(K=te=>te.value===y,e[22]=y,e[23]=K):K=e[23];const q=F.find(K),W=m.trim(),G=T.isFetched&&!T.isFetching&&m===g,Y=pte({loaderPath:d,isIconSelect:S,enumFallbackCount:R.length,trimmedSearch:W,optionValues:F.map(yte),optionsSettled:G});if((!u||!d)&&R.length===0){const te=a?.virtualMcpId;let le;e[24]!==l||e[25]!==o||e[26]!==s.description||e[27]!==te?(le=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:te}),e[24]=l,e[25]=o,e[26]=s.description,e[27]=te,e[28]=le):le=e[28];let ue;e[29]!==i?(ue=de=>i(de.target.value),e[29]=i,e[30]=ue):ue=e[30];let fe;e[31]!==y||e[32]!==o||e[33]!==ue?(fe=r.jsx(gt,{id:o,type:"text",value:y,onChange:ue}),e[31]=y,e[32]=o,e[33]=ue,e[34]=fe):fe=e[34];let ae;return e[35]!==le||e[36]!==fe?(ae=r.jsxs("div",{className:"space-y-2",children:[le,fe]}),e[35]=le,e[36]=fe,e[37]=ae):ae=e[37],ae}const ne=a?.virtualMcpId;let oe;e[38]!==l||e[39]!==o||e[40]!==s.description||e[41]!==ne?(oe=r.jsx(Gs,{htmlFor:o,label:l,description:s.description,virtualMcpId:ne}),e[38]=l,e[39]=o,e[40]=s.description,e[41]=ne,e[42]=oe):oe=e[42];const Z=q?r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(sb,{option:q,className:"h-6 w-6",fg:B}),r.jsx("span",{className:"truncate",children:q.label??q.value})]}):y?r.jsx("span",{className:"truncate",children:y}):r.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let J;e[43]===Symbol.for("react.memo_cache_sentinel")?(J=r.jsx(Uf,{className:"size-4 shrink-0 opacity-50"}),e[43]=J):J=e[43];let H;e[44]!==h||e[45]!==Z?(H=r.jsx(ms,{asChild:!0,children:r.jsxs(he,{variant:"outline",role:"combobox","aria-expanded":h,className:"h-10 w-full justify-between font-normal",children:[Z,J]})}),e[44]=h,e[45]=Z,e[46]=H):H=e[46];let se;e[47]===Symbol.for("react.memo_cache_sentinel")?(se={width:"var(--radix-popover-trigger-width)"},e[47]=se):se=e[47];let Q;e[48]!==c?(Q=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=Q):Q=e[49];let ce;return e[50]!==m||e[51]!==Q?(ce=r.jsx(Pi,{placeholder:Q,className:"h-9",value:m,onValueChange:L}),e[50]=m,e[51]=Q,e[52]=ce):ce=e[52],r.jsxs("div",{className:"space-y-2",children:[oe,r.jsxs(vs,{open:h,onOpenChange:f,children:[H,r.jsx(bs,{className:"p-0",style:se,children:r.jsxs(hr,{shouldFilter:!1,children:[ce,r.jsxs(Ei,{children:[!Y&&r.jsx(di,{children:T.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),r.jsx(qs,{children:U.map(te=>r.jsxs(Cs,{value:te.value,className:"cursor-pointer",onSelect:()=>{i(te.value===y?"":te.value),f(!1)},children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(sb,{option:te,className:ie(te.image?"h-9 w-9":"h-6 w-6"),fg:B}),r.jsx("span",{className:"truncate",children:te.label??te.value})]}),r.jsx(qt,{className:ie("ml-auto size-4 shrink-0",y===te.value?"opacity-100":"opacity-0")})]},te.value))}),Y&&r.jsx(qs,{children:r.jsx(Cs,{value:W,className:"cursor-pointer",onSelect:()=>{i(W),p(""),x(""),f(!1)},children:r.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:W})})})})]})]})})]})]})}function yte(t){return t.value}function KS(t){const e=z.c(17),{org:s}=Fe(),n=ys();let i,o,l,a;e[0]!==s.id||e[1]!==t.configId||e[2]!==t.imageOnly||e[3]!==t.search?(o=t.search?.trim()||void 0,i=t.imageOnly??!1,a=o8,l=Qe.filePickerObjects(s.id,t.configId,o,i),e[0]=s.id,e[1]=t.configId,e[2]=t.imageOnly,e[3]=t.search,e[4]=i,e[5]=o,e[6]=l,e[7]=a):(i=e[4],o=e[5],l=e[6],a=e[7]);const c=t.enabled!==!1&&!!t.configId;let d;e[8]!==i||e[9]!==t.configId||e[10]!==o||e[11]!==n?(d=async h=>{const{pageParam:f}=h;return await n.call("FILE_OBJECTS_LIST",{configId:t.configId,cursor:f??void 0,search:o,imageOnly:i||void 0})},e[8]=i,e[9]=t.configId,e[10]=o,e[11]=n,e[12]=d):d=e[12];let u;return e[13]!==l||e[14]!==c||e[15]!==d?(u={queryKey:l,enabled:c,staleTime:3e4,initialPageParam:null,queryFn:d,getNextPageParam:_te},e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],a(u)}function _te(t){return t.nextCursor??void 0}function k9(){const t=z.c(2),{org:e}=Fe();let s;return t[0]!==e?(s={mutationFn:async n=>{const i=n.file.type||"application/octet-stream",o=await fetch(`/api/${encodeURIComponent(e.slug)}/file-configs/${encodeURIComponent(n.configId)}/upload?filename=${encodeURIComponent(n.file.name)}`,{method:"POST",headers:{"Content-Type":i},body:n.file});if(!o.ok){const l=await o.text().catch(Lte);let a=`${o.status} ${o.statusText}`;try{const c=JSON.parse(l);c.message&&(a=c.message)}catch{l&&(a=l.slice(0,200))}throw new Error(`Upload failed: ${a}`)}return await o.json()}},t[0]=e,t[1]=s):s=t[1],Rs(s)}function Lte(){return""}function wte(){const t=z.c(8),{org:e}=Fe(),s=ys(),n=as();let i;t[0]!==s?(i=a=>s.call("FILE_OBJECT_DELETE",a),t[0]=s,t[1]=i):i=t[1];let o;t[2]!==e||t[3]!==n?(o=(a,c)=>{n.invalidateQueries({queryKey:Qe.filePickerObjectsByConfig(e.id,c.configId)})},t[2]=e,t[3]=n,t[4]=o):o=t[4];let l;return t[5]!==i||t[6]!==o?(l={mutationFn:i,onSuccess:o},t[5]=i,t[6]=o,t[7]=l):l=t[7],Rs(l)}function P3(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function WS(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function ef(t){const e=t.split("/");return e[e.length-1]??t}function qS(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const j9="file-picker:last-config-id";function GS(t){const e=z.c(31),s=re(),n=t.open,i=t.onOpenChange;let o;e[0]!==t.mode||e[1]!==s?(o=t.mode==="image"?s("filePicker.filePickerDialog.pickAnImage"):s("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=s,e[2]=o):o=e[2];let l;e[3]!==o?(l=r.jsx(Kt,{children:o}),e[3]=o,e[4]=l):l=e[4];let a;e[5]!==s?(a=s("filePicker.filePickerDialog.description"),e[5]=s,e[6]=a):a=e[6];let c;e[7]!==a?(c=r.jsx(kn,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=r.jsxs(os,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==s?(u=b=>{const{error:v}=b;return r.jsx(Ste,{error:v??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=u):u=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(bt,{className:"h-64 w-full"}),e[14]=h):h=e[14];let f;e[15]!==t?(f=b=>{t.onSelect(b),t.onOpenChange(!1)},e[15]=t,e[16]=f):f=e[16];let m;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==f?(m=r.jsx(P.Suspense,{fallback:h,children:r.jsx(kte,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:f})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=f,e[20]=m):m=e[20];let p;e[21]!==m||e[22]!==u?(p=r.jsx(Ws,{fallback:u,children:m}),e[21]=m,e[22]=u,e[23]=p):p=e[23];let g;e[24]!==p||e[25]!==d?(g=r.jsxs(Bt,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[d,p]}),e[24]=p,e[25]=d,e[26]=g):g=e[26];let x;return e[27]!==t.onOpenChange||e[28]!==t.open||e[29]!==g?(x=r.jsx(zt,{open:n,onOpenChange:i,children:g}),e[27]=t.onOpenChange,e[28]=t.open,e[29]=g,e[30]=x):x=e[30],x}function Ste(t){const e=z.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=r.jsx(bn,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=r.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,r.jsx("span",{className:"text-sm font-medium",children:s.message})]}),e[1]=s.message,e[2]=i):i=e[2],i}function kte(t){const e=z.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,o=$6();if(o.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(Nte,{}),e[0]=p):p=e[0],p}if(n){let p;if(e[1]!==o||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],p=o.find(x),e[1]=o,e[2]=n,e[3]=p}else p=e[3];const g=p;if(g){let x;return e[6]!==g||e[7]!==s||e[8]!==i?(x=r.jsx(k1,{config:g,mode:s,onSelect:i}),e[6]=g,e[7]=s,e[8]=i,e[9]=x):x=e[9],x}}if(o.length===1){const p=o[0];let g;return e[10]!==p||e[11]!==s||e[12]!==i?(g=r.jsx(k1,{config:p,mode:s,onSelect:i}),e[10]=p,e[11]=s,e[12]=i,e[13]=g):g=e[13],g}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=typeof window<"u"?window.localStorage.getItem(j9):null,e[14]=l):l=e[14];const a=l;let c;e[15]!==o?(c=o.find(p=>p.id===a)?.id??o[0].id,e[15]=o,e[16]=c):c=e[16];const d=c;let u;e[17]!==o?(u=o.map(jte),e[17]=o,e[18]=u):u=e[18];let h;e[19]!==u?(h=r.jsx(Du,{className:"self-start",children:u}),e[19]=u,e[20]=h):h=e[20];let f;if(e[21]!==o||e[22]!==s||e[23]!==i){let p;e[25]!==s||e[26]!==i?(p=g=>r.jsx(gl,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:r.jsx(k1,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=p):p=e[27],f=o.map(p),e[21]=o,e[22]=s,e[23]=i,e[24]=f}else f=e[24];let m;return e[28]!==d||e[29]!==h||e[30]!==f?(m=r.jsxs(Hc,{defaultValue:d,onValueChange:Cte,className:"min-h-0 flex-1 flex flex-col",children:[h,f]}),e[28]=d,e[29]=h,e[30]=f,e[31]=m):m=e[31],m}function jte(t){return r.jsx(tr,{value:t.id,children:t.name},t.id)}function Cte(t){typeof window<"u"&&window.localStorage.setItem(j9,t)}function Nte(){const t=z.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:r.jsx(Yn,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noBucketConfigured"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=r.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[s,r.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function k1({config:t,mode:e,onSelect:s}){const n=re(),[i,o]=P.useState(""),l=Kf(i,300),a=KS({configId:t.id,search:l,imageOnly:e==="image"}),c=k9(),[d,u]=P.useState(!1),h=P.useRef(null),f=e==="image"?"image/*":void 0;async function m(k){if(!k)return;const w=Array.from(k);if(w.length===0)return;let j=null;const N=[];for(const T of w)try{const C=await c.mutateAsync({configId:t.id,file:T});j??=C.publicUrl}catch(C){N.push(`${T.name} (${C instanceof Error?C.message:"upload failed"})`)}await a.refetch(),N.length>0&&ge.error(N.length===w.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:N.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:N.join("; ")})),j&&s(j)}function p(k){k.preventDefault(),u(!0)}function g(){u(!1)}function x(k){k.preventDefault(),k.stopPropagation(),u(!1),m(k.dataTransfer.files)}const v=(a.data?.pages??[]).flatMap(k=>k.items),L=v.filter(k=>e==="image"?P3(k.key):!0),_=l.trim(),y=v.length>0||i.trim().length>0,S=i!==l||a.isFetching&&!a.isFetchingNextPage;return r.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[r.jsxs("button",{type:"button",onClick:()=>h.current?.click(),onDragOver:p,onDragLeave:g,onDrop:x,className:ie("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",d&&"border-primary bg-primary/5",c.isPending&&"opacity-60 pointer-events-none"),children:[r.jsx(Yn,{size:18,className:"text-muted-foreground"}),r.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),r.jsx("input",{ref:h,type:"file",accept:f,multiple:!0,className:"hidden",onChange:k=>{const w=Array.from(k.target.files??[]);k.target.value="",m(w)}})]}),y?r.jsx(Of,{value:i,onChange:o,isSearching:S,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[L.length===0?_?r.jsx(Ate,{query:_}):e==="image"&&v.length>0?r.jsx(Vte,{}):r.jsx(Tte,{}):e==="image"?r.jsx(Pte,{items:L,onSelect:s}):r.jsx(Ete,{items:L,onSelect:s}),a.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function Tte(){const t=z.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(_i,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noFilesYet"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,i,l]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Vte(){const t=z.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(_i,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noImagesYet"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,i,l]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Ate(t){const e=z.c(13),{query:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(_i,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let o;e[1]!==s||e[2]!==n?(o=n("filePicker.filePickerDialog.noMatches",{query:s}),e[1]=s,e[2]=n,e[3]=o):o=e[3];let l;e[4]!==o?(l=r.jsx("p",{className:"text-sm font-medium",children:o}),e[4]=o,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=r.jsx("p",{className:"text-xs text-muted-foreground",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=r.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function Pte(t){const e=z.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>r.jsx(YS,{item:a,variant:"image",onSelect:n},a.key),e[3]=n,e[4]=l):l=e[4],i=s.map(l),e[0]=s,e[1]=n,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=o):o=e[6],o}function Ete(t){const e=z.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>r.jsx("li",{children:r.jsx(YS,{item:a,variant:"row",onSelect:n})},a.key),e[3]=n,e[4]=l):l=e[4],i=s.map(l),e[0]=s,e[1]=n,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=r.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=o):o=e[6],o}function YS(t){const e=z.c(58),{item:s,variant:n,onSelect:i}=t;let o;e[0]!==s.key?(o=WS(s.key),e[0]=s.key,e[1]=o):o=e[1];const l=o;if(n==="image"){let L;e[2]!==s.publicUrl||e[3]!==i?(L=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=L):L=e[4];let _;e[5]!==s.key||e[6]!==s.publicUrl?(_=r.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:Dte}),e[5]=s.key,e[6]=s.publicUrl,e[7]=_):_=e[7];let y;e[8]!==s.key||e[9]!==L||e[10]!==_?(y=r.jsx("button",{type:"button",onClick:L,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:_}),e[8]=s.key,e[9]=L,e[10]=_,e[11]=y):y=e[11];let S;e[12]!==l?(S=r.jsx("span",{className:"pointer-events-none absolute left-1.5 top-1.5 rounded bg-background/80 px-1.5 py-0.5 text-[10px] font-medium uppercase text-foreground opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100",children:l}),e[12]=l,e[13]=S):S=e[13];let k;e[14]!==s||e[15]!==i?(k=r.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:r.jsx(nb,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=k):k=e[16];let w;e[17]!==s.key?(w=ef(s.key),e[17]=s.key,e[18]=w):w=e[18];let j;e[19]!==w?(j=r.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 transition-opacity group-hover:opacity-100",children:r.jsx("p",{className:"truncate text-xs text-white",children:w})}),e[19]=w,e[20]=j):j=e[20];let N;return e[21]!==y||e[22]!==S||e[23]!==k||e[24]!==j?(N=r.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[y,S,k,j]}),e[21]=y,e[22]=S,e[23]=k,e[24]=j,e[25]=N):N=e[25],N}let a;e[26]!==s.publicUrl||e[27]!==i?(a=()=>i(s.publicUrl),e[26]=s.publicUrl,e[27]=i,e[28]=a):a=e[28];let c;e[29]!==s.key?(c=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:P3(s.key)?r.jsx(_i,{size:16,className:"text-muted-foreground"}):r.jsx(yi,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=ef(s.key),e[31]=s.key,e[32]=d):d=e[32];let u;e[33]!==d?(u=r.jsx("p",{className:"truncate text-sm font-medium",children:d}),e[33]=d,e[34]=u):u=e[34];let h;e[35]!==s.key?(h=r.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:s.key}),e[35]=s.key,e[36]=h):h=e[36];let f;e[37]!==u||e[38]!==h?(f=r.jsxs("div",{className:"min-w-0 flex-1",children:[u,h]}),e[37]=u,e[38]=h,e[39]=f):f=e[39];let m;e[40]!==l?(m=r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:l}),e[40]=l,e[41]=m):m=e[41];let p;e[42]!==s.size?(p=qS(s.size),e[42]=s.size,e[43]=p):p=e[43];let g;e[44]!==p?(g=r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:p}),e[44]=p,e[45]=g):g=e[45];let x;e[46]!==g||e[47]!==a||e[48]!==c||e[49]!==f||e[50]!==m?(x=r.jsxs("button",{type:"button",onClick:a,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[c,f,m,g]}),e[46]=g,e[47]=a,e[48]=c,e[49]=f,e[50]=m,e[51]=x):x=e[51];let b;e[52]!==s||e[53]!==i?(b=r.jsx(nb,{item:s,onSelect:i}),e[52]=s,e[53]=i,e[54]=b):b=e[54];let v;return e[55]!==x||e[56]!==b?(v=r.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[x,b]}),e[55]=x,e[56]=b,e[57]=v):v=e[57],v}function Dte(t){t.target.style.display="none"}function nb(t){const e=z.c(39),{item:s,onSelect:n}=t,i=re(),[o,l]=P.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(N){N.preventDefault(),N.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{ge.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(F2,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=r.jsx(Zt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:Mte,"aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==s.publicUrl||e[9]!==n?(f=()=>n(s.publicUrl),e[8]=s.publicUrl,e[9]=n,e[10]=f):f=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(qt,{size:14}),e[11]=m):m=e[11];let p;e[12]!==i?(p=i("filePicker.filePickerDialog.useThis"),e[12]=i,e[13]=p):p=e[13];let g;e[14]!==f||e[15]!==p?(g=r.jsxs(Xe,{onClick:f,children:[m,p]}),e[14]=f,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==o?(x=o?r.jsx(qt,{size:14}):r.jsx(dn,{size:14}),e[17]=o,e[18]=x):x=e[18];let b;e[19]!==o||e[20]!==i?(b=i(o?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=o,e[20]=i,e[21]=b):b=e[21];let v;e[22]!==c||e[23]!==b||e[24]!==x?(v=r.jsxs(Xe,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=v):v=e[25];const L=s.publicUrl;let _;e[26]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(xn,{size:14}),e[26]=_):_=e[26];let y;e[27]!==i?(y=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=y):y=e[28];let S;e[29]!==s.publicUrl||e[30]!==y?(S=r.jsx(Xe,{asChild:!0,children:r.jsxs("a",{href:L,target:"_blank",rel:"noreferrer",onClick:Rte,children:[_,y]})}),e[29]=s.publicUrl,e[30]=y,e[31]=S):S=e[31];let k;e[32]!==v||e[33]!==S||e[34]!==g?(k=r.jsxs(es,{align:"end",onClick:Ite,children:[g,v,S]}),e[32]=v,e[33]=S,e[34]=g,e[35]=k):k=e[35];let w;return e[36]!==k||e[37]!==h?(w=r.jsxs(Xt,{children:[h,k]}),e[36]=k,e[37]=h,e[38]=w):w=e[38],w}function Rte(t){return t.stopPropagation()}function Ite(t){return t.stopPropagation()}function Mte(t){return t.stopPropagation()}function JS(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:r.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:[r.jsx(Yn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function QS(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function XS(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const $te=["low","medium","high","original"];function ZS(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function ek(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=Ote(t);for(const n of s){const i=n.indexOf("=");if((i>=0?n.slice(0,i):n)===e)return i>=0?n.slice(i+1):""}return null}}function tk(t,e,s){const n=t.indexOf("#"),i=n>=0?t.slice(n):"",o=n>=0?t.slice(0,n):t,l=o.indexOf("?"),a=l>=0?o.slice(0,l):o,c=(l>=0?o.slice(l+1).split("&"):[]).filter(Boolean).filter(d=>{const u=d.indexOf("=");return(u>=0?d.slice(0,u):d)!==e});return s!==void 0&&c.push(`${e}=${s}`),`${a}${c.length?`?${c.join("&")}`:""}${i}`}function Ote(t){const e=t.indexOf("#"),s=e>=0?t.slice(0,e):t,n=s.indexOf("?");return n<0?[]:s.slice(n+1).split("&").filter(Boolean)}function Bte(t){if(!t)return;const e=ek(t,"quality");return ZS(e)?e:void 0}function zte(t,e){return tk(t,"quality",e)}function Fte(t){return t?ek(t,"muted")!=="false":!0}function Ute(t,e){return tk(t,"muted",e?void 0:"false")}function sk(t){const e=z.c(36),{value:s,onChange:n,showMuted:i}=t,o=i===void 0?!1:i,l=re(),a=P.useId();let c;e[0]!==s?(c=Bte(s),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==s?(u=Fte(s),e[2]=s,e[3]=u):u=e[3];const h=u;let f;e[4]!==l?(f=l("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=l,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(F2,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f?(p=r.jsx(ms,{asChild:!0,children:r.jsx(he,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":f,children:m})}),e[7]=f,e[8]=p):p=e[8];let g;e[9]!==l?(g=l("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=l,e[10]=g):g=e[10];let x;e[11]!==g?(x=r.jsx(Ut,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let v;e[13]!==n||e[14]!==s?(v=j=>n(zte(s,ZS(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=v):v=e[15];let L;e[16]===Symbol.for("react.memo_cache_sentinel")?(L=$te.map(Hte),e[16]=L):L=e[16];let _;e[17]!==v||e[18]!==b?(_=r.jsx(Ef,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:v,children:L}),e[17]=v,e[18]=b,e[19]=_):_=e[19];let y;e[20]!==_||e[21]!==x?(y=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,_]}),e[20]=_,e[21]=x,e[22]=y):y=e[22];let S;e[23]!==h||e[24]!==a||e[25]!==n||e[26]!==o||e[27]!==l||e[28]!==s?(S=o&&r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Ut,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),r.jsx(Mr,{id:a,checked:h,onCheckedChange:j=>n(Ute(s,j))})]}),e[23]=h,e[24]=a,e[25]=n,e[26]=o,e[27]=l,e[28]=s,e[29]=S):S=e[29];let k;e[30]!==y||e[31]!==S?(k=r.jsx(bs,{align:"end",className:"w-auto min-w-52 p-3",children:r.jsxs("div",{className:"flex flex-col gap-3",children:[y,S]})}),e[30]=y,e[31]=S,e[32]=k):k=e[32];let w;return e[33]!==k||e[34]!==p?(w=r.jsxs(vs,{children:[p,k]}),e[33]=k,e[34]=p,e[35]=w):w=e[35],w}function Hte(t){return r.jsx(Cc,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function nk(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function ib(t){const e=z.c(2),{ext:s}=t;if(!s)return null;let n;return e[0]!==s?(n=r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Kte(t){const e=z.c(81),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=re(),d=s.format==="video-uri",u=N3(n),[h,f]=P.useState(!1),[m,p]=P.useState(!1),g=u?QS(u):"",x=g?XS(g):"",b=R2(),v=k9();let L;e[0]!==b.data?.configs?(L=b.data?.configs??[],e[0]=b.data?.configs,e[1]=L):L=e[1];const _=a?.siteSlug;let y;e[2]!==L||e[3]!==_?(y=s9(L,_),e[2]=L,e[3]=_,e[4]=y):y=e[4];const S=y;let k;e[5]!==b.data?.configs||e[6]!==d||e[7]!==S?.id||e[8]!==i||e[9]!==f||e[10]!==c||e[11]!==v?(k=async function(J){if(!J)return;let H=Array.from(J);if(H.length===0)return;if(d&&(H=H.filter(Wte),H.length===0)){ge.error(c("sectionsEditor.fileField.videoFileError"));return}const se=nk(b.data?.configs??[],S?.id,typeof window<"u"?window.localStorage.getItem(j9):null);if(!se){f(!0);return}try{const Q=await v.mutateAsync({configId:se,file:H[0]});i(Q.publicUrl),H.length>1&&ge.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:H[0].name}))}catch(Q){const ce=Q;ge.error(ce instanceof Error?ce.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=S?.id,e[8]=i,e[9]=f,e[10]=c,e[11]=v,e[12]=k):k=e[12];const w=k;let j;e[13]!==p?(j=function(J){J.preventDefault(),J.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const N=j;let T;e[15]!==p?(T=function(J){J.currentTarget===J.target&&p(!1)},e[15]=p,e[16]=T):T=e[16];const C=T;let V;e[17]!==w||e[18]!==p?(V=function(J){J.preventDefault(),J.stopPropagation(),p(!1),w(J.dataTransfer.files)},e[17]=w,e[18]=p,e[19]=V):V=e[19];const A=V,E=a?.virtualMcpId;let D;e[20]!==l||e[21]!==o||e[22]!==s.description||e[23]!==E?(D=r.jsx("div",{className:"min-w-0",children:r.jsx(Gs,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:E})}),e[20]=l,e[21]=o,e[22]=s.description,e[23]=E,e[24]=D):D=e[24];const I=m&&"border-primary ring-2 ring-primary/30",R=v.isPending&&"pointer-events-none opacity-60";let $;e[25]!==I||e[26]!==R?($=ie("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",I,R),e[25]=I,e[26]=R,e[27]=$):$=e[27];let B;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==u||e[33]!==c||e[34]!==v.isPending?(B=u?d?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceVideoLabel"),className:"relative block h-40 w-full cursor-pointer overflow-hidden bg-black",children:[r.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u),r.jsx(JS,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx(xx,{size:14,className:"shrink-0 text-muted-foreground"}),r.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:g}),r.jsx(ib,{ext:x})]})]}):r.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceFileLabel"),className:"flex w-full cursor-pointer items-center gap-3 px-3 py-2.5 text-left hover:bg-muted/60",children:[r.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:r.jsx(yi,{size:18,className:"text-muted-foreground"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium",children:g}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),r.jsx(ib,{ext:x})]}):r.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[d?r.jsx(xx,{size:20}):r.jsx(yi,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:v.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.fileField.sizeLimit")})]}),e[28]=x,e[29]=g,e[30]=d,e[31]=f,e[32]=u,e[33]=c,e[34]=v.isPending,e[35]=B):B=e[35];let M;e[36]!==m||e[37]!==c?(M=m&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.fileField.dropToUpload")})}),e[36]=m,e[37]=c,e[38]=M):M=e[38];let O;e[39]!==C||e[40]!==N||e[41]!==A||e[42]!==$||e[43]!==B||e[44]!==M?(O=r.jsxs("div",{onDragOver:N,onDragLeave:C,onDrop:A,className:$,children:[B,M]}),e[39]=C,e[40]=N,e[41]=A,e[42]=$,e[43]=B,e[44]=M,e[45]=O):O=e[45];let F;e[46]!==i?(F=Z=>i(Z.target.value),e[46]=i,e[47]=F):F=e[47];let U;e[48]!==o||e[49]!==u||e[50]!==F?(U=r.jsx(gt,{id:o,type:"url",value:u,onChange:F,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=o,e[49]=u,e[50]=F,e[51]=U):U=e[51];let K;e[52]!==f||e[53]!==u||e[54]!==c?(K=!u&&r.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[r.jsx(Yn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=u,e[54]=c,e[55]=K):K=e[55];let q;e[56]!==d||e[57]!==i||e[58]!==u?(q=d&&u&&r.jsx(sk,{value:u,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=u,e[59]=q):q=e[59];let W;e[60]!==i||e[61]!==u||e[62]!==c?(W=u&&r.jsx(he,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:r.jsx(rn,{size:14})}),e[60]=i,e[61]=u,e[62]=c,e[63]=W):W=e[63];let G;e[64]!==U||e[65]!==K||e[66]!==q||e[67]!==W?(G=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,K,q,W]}),e[64]=U,e[65]=K,e[66]=q,e[67]=W,e[68]=G):G=e[68];let Y;e[69]!==i?(Y=Z=>i(Z),e[69]=i,e[70]=Y):Y=e[70];const ee=S?.id??null;let ne;e[71]!==h||e[72]!==f||e[73]!==Y||e[74]!==ee?(ne=r.jsx(GS,{open:h,onOpenChange:f,mode:"any",onSelect:Y,lockedConfigId:ee}),e[71]=h,e[72]=f,e[73]=Y,e[74]=ee,e[75]=ne):ne=e[75];let oe;return e[76]!==O||e[77]!==G||e[78]!==ne||e[79]!==D?(oe=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[D,O,G,ne]}),e[76]=O,e[77]=G,e[78]=ne,e[79]=D,e[80]=oe):oe=e[80],oe}function Wte(t){return t.type.startsWith("video/")}const qte=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function Gte(t){const e=z.c(86),{schema:s,value:n,onChange:i,path:o,label:l,sandbox:a}=t,c=re(),d=N3(n),[u,h]=P.useState(!1),[f,m]=P.useState(!1),[p,g]=P.useState(!1),[x,b]=P.useState(!1),v=d?QS(d):"",L=v?XS(v):"",_=R2(),y=k9();let S;e[0]!==_.data?.configs?(S=_.data?.configs??[],e[0]=_.data?.configs,e[1]=S):S=e[1];const k=a?.siteSlug;let w;e[2]!==S||e[3]!==k?(w=s9(S,k),e[2]=S,e[3]=k,e[4]=w):w=e[4];const j=w;let N;e[5]!==i||e[6]!==b||e[7]!==g?(N=function(te){g(!1),b(!1),i(te)},e[5]=i,e[6]=b,e[7]=g,e[8]=N):N=e[8];const T=N;let C;e[9]!==_.data?.configs||e[10]!==j?.id||e[11]!==h||e[12]!==T||e[13]!==c||e[14]!==y?(C=async function(te){if(!te)return;const le=Array.from(te).filter(Yte);if(le.length===0){ge.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const ue=nk(_.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(j9):null);if(!ue){h(!0);return}try{const fe=await y.mutateAsync({configId:ue,file:le[0]});T(fe.publicUrl),le.length>1&&ge.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:le[0].name}))}catch(fe){const ae=fe;ge.error(ae instanceof Error?ae.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=_.data?.configs,e[10]=j?.id,e[11]=h,e[12]=T,e[13]=c,e[14]=y,e[15]=C):C=e[15];const V=C;let A;e[16]!==m?(A=function(te){te.preventDefault(),te.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=A):A=e[17];const E=A;let D;e[18]!==m?(D=function(te){te.currentTarget===te.target&&m(!1)},e[18]=m,e[19]=D):D=e[19];const I=D;let R;e[20]!==V||e[21]!==m?(R=function(te){te.preventDefault(),te.stopPropagation(),m(!1),V(te.dataTransfer.files)},e[20]=V,e[21]=m,e[22]=R):R=e[22];const $=R,B=a?.virtualMcpId;let M;e[23]!==l||e[24]!==o||e[25]!==s.description||e[26]!==B?(M=r.jsx("div",{className:"min-w-0",children:r.jsx(Gs,{htmlFor:o,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:B})}),e[23]=l,e[24]=o,e[25]=s.description,e[26]=B,e[27]=M):M=e[27];const O=f&&"border-primary ring-2 ring-primary/30",F=y.isPending&&"pointer-events-none opacity-60";let U;e[28]!==O||e[29]!==F?(U=ie("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",O,F),e[28]=O,e[29]=F,e[30]=U):U=e[30];let K;e[31]!==L||e[32]!==v||e[33]!==x||e[34]!==p||e[35]!==l||e[36]!==b||e[37]!==g||e[38]!==h||e[39]!==d||e[40]!==c||e[41]!==y.isPending?(K=d?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>h(!0),"aria-label":c("sectionsEditor.imageField.replaceImage"),className:"relative block h-40 w-full cursor-pointer bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!x&&r.jsx("img",{src:d,alt:l,className:ie("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&r.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[r.jsx(_i,{size:20}),r.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!x&&r.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),r.jsx(JS,{})]}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:v}),L&&r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:L})]})]}):r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[r.jsx(_i,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:y.isPending?c("sectionsEditor.imageField.uploading"):c("sectionsEditor.imageField.dropImageOrClickToBrowse")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[31]=L,e[32]=v,e[33]=x,e[34]=p,e[35]=l,e[36]=b,e[37]=g,e[38]=h,e[39]=d,e[40]=c,e[41]=y.isPending,e[42]=K):K=e[42];let q;e[43]!==f||e[44]!==c?(q=f&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.imageField.dropToUpload")})}),e[43]=f,e[44]=c,e[45]=q):q=e[45];let W;e[46]!==I||e[47]!==E||e[48]!==$||e[49]!==U||e[50]!==K||e[51]!==q?(W=r.jsxs("div",{onDragOver:E,onDragLeave:I,onDrop:$,className:U,children:[K,q]}),e[46]=I,e[47]=E,e[48]=$,e[49]=U,e[50]=K,e[51]=q,e[52]=W):W=e[52];let G;e[53]!==T?(G=ce=>T(ce.target.value),e[53]=T,e[54]=G):G=e[54];let Y;e[55]!==c?(Y=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=Y):Y=e[56];let ee;e[57]!==o||e[58]!==d||e[59]!==G||e[60]!==Y?(ee=r.jsx(gt,{id:o,type:"url",value:d,onChange:G,placeholder:Y,className:"h-9 min-w-0 flex-1"}),e[57]=o,e[58]=d,e[59]=G,e[60]=Y,e[61]=ee):ee=e[61];let ne;e[62]!==h||e[63]!==d||e[64]!==c?(ne=!d&&r.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),className:"h-9 shrink-0",children:[r.jsx(Yn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=h,e[63]=d,e[64]=c,e[65]=ne):ne=e[65];let oe;e[66]!==T||e[67]!==d||e[68]!==c?(oe=d&&r.jsxs(r.Fragment,{children:[r.jsx(sk,{value:d,onChange:T}),r.jsx(he,{type:"button",variant:"ghost",size:"sm",onClick:()=>T(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:r.jsx(rn,{size:14})})]}),e[66]=T,e[67]=d,e[68]=c,e[69]=oe):oe=e[69];let Z;e[70]!==ee||e[71]!==ne||e[72]!==oe?(Z=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[ee,ne,oe]}),e[70]=ee,e[71]=ne,e[72]=oe,e[73]=Z):Z=e[73];let J;e[74]!==T?(J=ce=>T(ce),e[74]=T,e[75]=J):J=e[75];const H=j?.id??null;let se;e[76]!==u||e[77]!==h||e[78]!==J||e[79]!==H?(se=r.jsx(GS,{open:u,onOpenChange:h,mode:"image",onSelect:J,lockedConfigId:H}),e[76]=u,e[77]=h,e[78]=J,e[79]=H,e[80]=se):se=e[80];let Q;return e[81]!==M||e[82]!==W||e[83]!==Z||e[84]!==se?(Q=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[M,W,Z,se]}),e[81]=M,e[82]=W,e[83]=Z,e[84]=se,e[85]=Q):Q=e[85],Q}function Yte(t){return qte.has(t.type||"")}const Jte="0 0 1080 1080",Qte="matrix(1 0 0 1 540 540)",E3=[{code:"AC",name:"Acre",gTransform:"matrix(1 0 0 1 -248.53 -95.16)",pathTransform:"translate(-57.47, -224.1)",d:"M 30.47 237.77 L 28.39 237.73 L 28.93 235.92 L 28.72 235.09 L 28.47 234.6 L 27.22 233.9 L 27.08 233.45 L 27.35 232.3 L 26.58 230.35 L 25.49 229.71 L 19.89 228.46 L 12.55 228.27 L 12.82 227.71 L 15.31 225.45 L 16.2 224.22 L 16.49 223.02 L 16.27 221.79 L 15.59 220.88 L 14.76 220.44 L 13.08 217.49 L 12.31 217.05 L 11.41 216.86 L 10.28 215.73 L 9.36 213.35 L 7.36 211.82 L 6.38 208.2 L 5.51 206.56 L 3.63 205.48 L 3.55 204.31 L 4.36 204.41 L 4.78 203.89 L 4.85 203.22 L 4.65 202.8 L 2.53 201.87 L 2.17 201.21 L 0 199.32 L 0.04 198.95 L 0.66 198.9 L 1.16 197.58 L 1.15 196.27 L 4.16 195.88 L 4.66 195.49 L 4.44 194.14 L 3.27 192.57 L 3.27 192.57 L 21.22 200.05 L 44.88 205.71 L 57.02 208.85 L 83.46 223.02 L 111.97 235.15 L 111.97 235.15 L 114.94 236.41 L 114.94 236.41 L 114.64 236.89 L 113.07 237.55 L 110.98 239.14 L 108.12 241.93 L 106.47 242.79 L 105.81 242.61 L 104.28 242.79 L 104.23 243.35 L 102.31 244.65 L 100.23 245.64 L 98.79 247.47 L 98.35 248.65 L 97.74 248.93 L 96.57 248.18 L 95.81 248.05 L 93.44 248.1 L 92.76 248.36 L 92.13 248.81 L 91.77 249.67 L 89.33 253.15 L 85.56 254.4 L 84.72 255.09 L 82.78 255.6 L 81.75 255.63 L 81.83 253.52 L 80.47 253.72 L 76.92 252.95 L 71.68 252.48 L 66.59 252.86 L 65.93 252.28 L 63.66 252.11 L 60.1 253.94 L 57.37 254.56 L 55.69 253.89 L 54.29 252.45 L 52.65 253.61 L 52.69 236.06 L 52.74 234.96 L 53.21 234.25 L 53.28 231.9 L 53.02 231.02 L 53.99 229.84 L 54.47 228.7 L 53.31 228.9 L 50.34 231.49 L 48.74 232.5 L 46.68 234.88 L 44.73 235.55 L 44.08 236.63 L 42.27 237.62 z"},{code:"AL",name:"Alagoas",gTransform:"matrix(1 0 0 1 276.36 -86.82)",pathTransform:"translate(-582.36, -232.44)",d:"M 561.91 230.3 L 561.71 229.57 L 560.29 228.79 L 559.84 228.88 L 558.82 228.59 L 558.28 227.19 L 558.28 227.19 L 559.6 226.12 L 560.24 225.03 L 562.41 224.27 L 564.79 220.98 L 564.88 220.29 L 565.7 219.69 L 566.7 220.91 L 568.37 221.21 L 569.45 221.09 L 572 223.11 L 573.9 225.23 L 575.68 226.28 L 577.59 226.76 L 580.09 226.11 L 583.23 226.4 L 584.4 226.29 L 586.26 225.23 L 587.42 225.28 L 589.23 224.17 L 591.41 221.88 L 591.53 221.43 L 593.08 220.19 L 595.08 219.95 L 597.32 220.8 L 599.88 219.51 L 601.35 219.32 L 603.27 220.13 L 606.17 220.4 L 606.44 220.61 L 606.44 220.61 L 603.66 225.57 L 599.11 230.7 L 595.53 234.28 L 592.49 238.86 L 589.16 241.74 L 588.16 243.77 L 586.84 245.56 L 586.84 245.56 L 586.24 244.25 L 582.65 242.02 L 582.19 241.99 L 580.53 241.2 L 578.77 239.75 L 577.47 237.3 L 572.05 234.23 L 568.37 233.28 z"},{code:"AM",name:"Amazonas",gTransform:"matrix(1 0 0 1 -166.8 -178.05)",pathTransform:"translate(-139.2, -141.22)",d:"M 165.82 47.29 L 166.54 48.07 L 167.29 48.41 L 167.9 48.42 L 169.03 48 L 169.66 48.11 L 169.72 49.07 L 170.93 50.24 L 171.9 50.61 L 172.78 50.4 L 174.14 50.51 L 176.09 51.46 L 176.58 52.12 L 175.67 55.44 L 174.96 56.94 L 177.69 60.68 L 179.35 65.44 L 179.54 67.7 L 180.41 68.82 L 180.46 69.27 L 178.84 70.73 L 179.2 72.32 L 179.86 73.9 L 179.09 76.94 L 178.52 77.9 L 178.81 82.88 L 179.69 85.05 L 180.91 85.89 L 181.49 86.79 L 182.62 91.12 L 182.56 91.7 L 181.42 93.02 L 179.58 92.69 L 179.44 93.83 L 184.45 98.25 L 184.97 98.29 L 186.93 99.6 L 188.41 101.25 L 189.45 103.29 L 189.98 103.36 L 191.32 102.94 L 193.68 103.98 L 193.24 101.87 L 193.99 99.58 L 194.24 97.85 L 193.87 96.05 L 194.69 93.08 L 195.71 91.82 L 196.99 91.13 L 199.08 90.42 L 199.63 89.53 L 201.23 89.47 L 204.06 90.4 L 205.93 92.44 L 206.85 94.95 L 208.67 95.18 L 209.92 94.72 L 211.33 93.31 L 213.36 92.76 L 213.78 92.37 L 213.8 91.84 L 212.66 90.43 L 212.43 89.7 L 212.54 89.04 L 213.69 86.4 L 213.76 85.27 L 215.42 82.24 L 217.75 78.98 L 217.72 78.3 L 236.21 78.37 L 236.21 78.37 L 236.61 83.23 L 236.18 84.68 L 236.36 86.95 L 236.6 87.63 L 238.3 88.48 L 238.48 88.89 L 238.13 89.58 L 238.08 91.69 L 239.91 93.68 L 240.27 93.87 L 240.97 93.69 L 242.81 94.92 L 243.36 96.75 L 243.4 97.68 L 243.7 98.13 L 248.34 101.9 L 252.92 104.44 L 253.55 105.34 L 254.9 106.43 L 256.78 107.1 L 259.15 108.41 L 261.41 109.06 L 262.77 109.21 L 264.09 110.03 L 264.17 110.64 L 265.44 111.98 L 268.14 113.42 L 269.24 115.59 L 271.11 116.38 L 271.96 115.77 L 273.34 115.42 L 273.53 115.9 L 273.4 116.68 L 275.21 118.35 L 245.31 182.59 L 244.53 183.9 L 243.08 185.03 L 242.5 186 L 242.47 187.13 L 243.29 189.46 L 243.67 190.03 L 244.74 190.61 L 246.32 192.17 L 246.96 193.43 L 247.11 195.39 L 247.68 195.96 L 247.68 195.96 L 246.5 197.16 L 246.3 197.77 L 246.24 198.53 L 246.58 199.37 L 246.31 200.38 L 245.11 202.2 L 244.25 202.84 L 243.83 203.69 L 243.93 204.54 L 244.59 205.91 L 245.05 207.85 L 243.67 212.07 L 242.49 217.29 L 241.28 218.02 L 193.43 218.34 L 193.43 218.34 L 193.47 217.64 L 193.11 217.26 L 191.72 216.98 L 189.8 218.06 L 189.26 219.8 L 188.58 219.99 L 185.34 218.51 L 184.66 215.63 L 184.04 215.43 L 183.06 215.56 L 182.6 215.35 L 181.35 212.08 L 178.81 211.1 L 177.48 209.83 L 176.68 207.92 L 176.23 207.43 L 174.08 206.3 L 163.29 206.36 L 161.91 208.92 L 160.19 209.42 L 160.28 210.59 L 160.02 210.81 L 157.54 211.34 L 156.35 212.93 L 156.3 213.6 L 157.2 214.3 L 157.37 214.75 L 157.01 215.77 L 156.2 216.92 L 154.14 218.13 L 154.03 219.94 L 154.27 221.4 L 150.4 220.94 L 148.27 221.32 L 147.07 222.39 L 145.28 222.29 L 144.44 221.74 L 143.98 221.72 L 142.23 222.98 L 141.7 223.82 L 141.96 225.57 L 139.42 228.73 L 138.74 228.81 L 138.06 228.28 L 137.42 226.02 L 137.04 225.93 L 135.2 226.95 L 133.9 228.16 L 132.53 228.55 L 131.76 228.42 L 130.68 228.92 L 130.27 229.45 L 130.14 230.17 L 128.92 230.96 L 128.55 230.98 L 126.24 228.65 L 125.52 228.28 L 122.65 228.61 L 118.69 228.35 L 118.85 229.64 L 118.7 230.2 L 117.15 232.01 L 115.23 232.59 L 111.97 235.15 L 111.97 235.15 L 83.46 223.02 L 57.02 208.85 L 44.88 205.71 L 21.22 200.05 L 3.27 192.57 L 3.27 192.57 L 3.2 191.92 L 3.9 189 L 5.12 187.6 L 10.04 184.13 L 12.3 183.89 L 12.77 183.59 L 13.75 182.03 L 13.83 181 L 12.09 176.51 L 12.47 175.32 L 13.65 173.13 L 14.93 171.81 L 15.85 170.56 L 16.27 169.58 L 16.57 167.84 L 16.28 166.52 L 16.95 164.48 L 17.26 162.17 L 17.99 161.42 L 21.65 159.79 L 23.84 158.56 L 24.99 157.52 L 25.43 156.12 L 26.21 155.75 L 27.62 155.64 L 29.27 154.71 L 32.81 151.98 L 35.23 151.55 L 36.74 151.84 L 40.93 150.62 L 42.43 149.85 L 44.25 149.49 L 47.58 149.87 L 48.88 148.28 L 49.51 146.83 L 50.6 146.22 L 52.74 146.42 L 53.38 146.96 L 54.7 146.72 L 55.8 145.98 L 57.51 146.1 L 57.82 146.63 L 57.8 147.81 L 59.41 149.1 L 62.24 149.18 L 62.82 148.78 L 63.28 148 L 63.17 147.61 L 64.34 142.69 L 71.04 105.52 L 72.2 102.6 L 71.21 97.64 L 71.33 97.38 L 70.03 96.33 L 68.55 93.58 L 68.51 93.09 L 69.16 91.7 L 68.64 89.92 L 68.27 89.52 L 66.57 88.93 L 63.54 86.58 L 61.6 84.3 L 61.8 72.79 L 65.69 72.53 L 67.44 71.36 L 70.94 70.44 L 73.62 72.2 L 74.84 72.31 L 76.11 71.88 L 75.62 70.19 L 75.92 68.47 L 74.55 66.37 L 73.98 65.83 L 72.83 65.23 L 71.32 65.76 L 68.53 65.15 L 64.96 65.24 L 64.9 55.34 L 65.86 55.38 L 67.18 54.8 L 69.46 54.2 L 72.3 55.07 L 91.33 55.13 L 90.87 54.47 L 90.08 54.33 L 89.7 53.13 L 90.65 51.2 L 92.08 51.6 L 92.69 53.12 L 93.56 54.44 L 94.22 54.79 L 95.05 54.8 L 96.66 54.19 L 98.6 52.1 L 98.92 51.26 L 100.18 50.02 L 102.73 48.63 L 104.02 49.09 L 105.19 51.67 L 106.81 53.66 L 107.55 54.96 L 108.21 56.74 L 108.44 58.29 L 107.95 61.92 L 108.15 63.68 L 111.35 62.93 L 119.66 69.99 L 120.45 70.27 L 122.95 70.48 L 125.25 69.48 L 126.95 67.78 L 129.06 66.62 L 131.25 66.51 L 131.81 66.8 L 132.58 67.88 L 132.56 68.85 L 131.45 70.55 L 131.82 71.53 L 132.4 71.8 L 133.73 71.08 L 134.29 70.17 L 134.52 68.88 L 135.52 67.72 L 135.99 67.49 L 136.99 67.67 L 137.54 67.49 L 137.95 66.83 L 138.41 64.52 L 138.92 64.15 L 140.43 63.79 L 143.36 62.02 L 144.33 62.57 L 145.26 62.28 L 146.86 61.24 L 147.88 59.63 L 149.99 58.42 L 152.02 58.97 L 154.38 57.32 L 154.93 56.5 L 155.37 53.84 L 155.34 52.55 L 156.11 51.63 L 157.14 51.21 L 158.88 51.19 L 160.22 50.8 L 162.28 49.2 L 163.24 48.83 L 165.52 48.53 z"},{code:"AP",name:"Amapá",gTransform:"matrix(1 0 0 1 32.29 -262.31)",pathTransform:"translate(-338.29, -56.97)",d:"M 344.98 99.7 L 344.04 99.64 L 343.27000000000004 99.98 L 341.97 100.10000000000001 L 339.18 99.42 L 337.73 98.39 L 337.3 96.89 L 335.43 95.5 L 335.32 94.2 L 335.53 93.51 L 335.21999999999997 91.93 L 334.89 91.46000000000001 L 333.94 91.27000000000001 L 333.53 90.33000000000001 L 333.60999999999996 87.9 L 330.67999999999995 84.62 L 329.9 84.98 L 329.08 84.79 L 327.58 81.31 L 327.71 79.73 L 327.12 77.92 L 326.5 77.36 L 325.83 75.85 L 325.64 73.74 L 326.07 70.6 L 325.9 70.27 L 323.33 69.53999999999999 L 321.31 67.27999999999999 L 320.55 64.44999999999999 L 320.74 63.72999999999999 L 321.42 63.49999999999999 L 320.93 62.31999999999999 L 320.25 62.349999999999994 L 317.41 59.69 L 316.47 59.83 L 316.09000000000003 60.25 L 314.76000000000005 60.39 L 313.9200000000001 60.12 L 313.12000000000006 59.14 L 311.9800000000001 58.3 L 310.7900000000001 58.18 L 310.30000000000007 56.9 L 309.63000000000005 56.1 L 307.70000000000005 55.050000000000004 L 306.41 54.56 L 303.02000000000004 54.190000000000005 L 301.94000000000005 54.480000000000004 L 300.77000000000004 54.46 L 300.46000000000004 53.92 L 300.22 52.480000000000004 L 300.47 47.940000000000005 L 301.09000000000003 46.64000000000001 L 300.72 44.34000000000001 L 300.1 43.77000000000001 L 300.1 43.77000000000001 L 300.45000000000005 43.56000000000001 L 301.44000000000005 43.86000000000001 L 301.43000000000006 44.67000000000001 L 301.14000000000004 44.85000000000001 L 301.48 45.82000000000001 L 302.95000000000005 45.760000000000005 L 303.77000000000004 45.99 L 304.12000000000006 46.89 L 304.96000000000004 47.6 L 307.21000000000004 48.38 L 310.50000000000006 49.13 L 313.26000000000005 47.35 L 313.61000000000007 46.59 L 315.3400000000001 45.42 L 316.1700000000001 45.13 L 316.86000000000007 46.07 L 319.57000000000005 47.01 L 320.65000000000003 46.89 L 322.37000000000006 45.88 L 322.49000000000007 45.46 L 322.81000000000006 45.49 L 324.27000000000004 46.79 L 324.07000000000005 47.66 L 326.44000000000005 47.489999999999995 L 326.95000000000005 47.989999999999995 L 327.90000000000003 48.16 L 328.52000000000004 48.15 L 329.43000000000006 47.67 L 331.1000000000001 46.17 L 332.88000000000005 45.07 L 334.63000000000005 42.77 L 335.00000000000006 41.77 L 334.80000000000007 41.230000000000004 L 337.93000000000006 34.730000000000004 L 338.0400000000001 32.910000000000004 L 339.1500000000001 31.610000000000003 L 339.8800000000001 31.42 L 343.48000000000013 25.630000000000003 L 343.71000000000015 24.480000000000004 L 344.5500000000001 23.280000000000005 L 346.34000000000015 21.730000000000004 L 346.97000000000014 20.070000000000004 L 349.08000000000015 18.930000000000003 L 349.5500000000002 18.01 L 350.5900000000002 17.430000000000003 L 351.1500000000002 18.890000000000004 L 352.0300000000002 20.250000000000004 L 350.3600000000002 15.450000000000003 L 350.2900000000002 14.160000000000004 L 350.4700000000002 13.830000000000004 L 353.8400000000002 16.250000000000004 L 354.9800000000002 17.460000000000004 L 355.8900000000002 18.680000000000003 L 356.4100000000002 19.870000000000005 L 356.44000000000017 21.450000000000003 L 356.88000000000017 21.76 L 357.20000000000016 21.28 L 357.58000000000015 21.18 L 357.79000000000013 21.58 L 358.0000000000001 29.47 L 358.66000000000014 33.339999999999996 L 361.3700000000001 39.38999999999999 L 364.03000000000014 48.32999999999999 L 367.35000000000014 53.32999999999999 L 368.3600000000001 53.67999999999999 L 371.6300000000001 53.599999999999994 L 374.4100000000001 54.53999999999999 L 375.7000000000001 55.38999999999999 L 376.4700000000001 58.03999999999999 L 376.31000000000006 61.36999999999999 L 375.02000000000004 62.32999999999999 L 373.29 62.75999999999999 L 372.91 63.08999999999999 L 374.70000000000005 62.93999999999999 L 375.74000000000007 62.51999999999999 L 376.02000000000004 62.749999999999986 L 376.14000000000004 63.33999999999999 L 375.97 64.07 L 370.94000000000005 68.13 L 369.77000000000004 70.22999999999999 L 367.62000000000006 71.63999999999999 L 365.68000000000006 75.35999999999999 L 362.77000000000004 78.85999999999999 L 362.07000000000005 79.31999999999998 L 361.13000000000005 79.22999999999998 L 359.68000000000006 79.74999999999997 L 357.6000000000001 82.72999999999998 L 357.6000000000001 82.72999999999998 L 356.2600000000001 82.79999999999997 L 355.5100000000001 83.69999999999997 L 355.5100000000001 83.69999999999997 L 354.0400000000001 85.37999999999998 L 353.07000000000005 87.59999999999998 L 351.95000000000005 89.46999999999998 L 351.11000000000007 90.11999999999999 L 348.1000000000001 93.57 L 347.74000000000007 95.97 L 347.9100000000001 97.77 L 345.9600000000001 99.58 L 344.98 99.7 z M 368.34 52.71 L 367.89 52.38 L 366.78999999999996 50.52 L 366.85999999999996 49.64 L 367.09 49.230000000000004 L 368.75 48.78 L 369.18 49.17 L 370.01 51.440000000000005 L 369.02 52.540000000000006 L 368.34 52.71 z M 370.83 70.32 L 370.43 70.07 L 370.35 69.36 L 371.46000000000004 68.26 L 372.34000000000003 68.11 L 373.59000000000003 68.35 L 374.05 68.24 L 374.49 67.6 L 374.54 68.19 L 373.57 69.63 L 372.58 70.13 L 370.83 70.32 z M 374.27 67.45 L 373.49 67.22 L 373.49 66.66 L 374.21000000000004 65.61999999999999 L 375.46000000000004 65.52 L 375.64000000000004 65.86999999999999 L 375.54 66.38 L 374.27 67.45 z M 367.08 49.03 L 366.32 48.53 L 366.58 47.7 L 367.46 47.53 L 368.32 47.85 L 368.33 48.58 L 367.08 49.03 z"},{code:"BA",name:"Bahia",gTransform:"matrix(1 0 0 1 193.52 -26.39)",pathTransform:"translate(-499.52, -292.87)",d:"M 527.5 365.33 L 527.14 364.5 L 527.8199999999999 363.15 L 527.81 362.62 L 527.28 361.58 L 523.15 358.53 L 523 358.02 L 523.22 356.51 L 522.65 355.28 L 522 355.52 L 521.8 355.96999999999997 L 521.4599999999999 356.15 L 521.2399999999999 355.9 L 521.7699999999999 351.5 L 522.5899999999999 348.2 L 523.41 347.32 L 525.88 347.56 L 526.9 346.85 L 526.9 346.43 L 526.34 345.41 L 526.5 342.76000000000005 L 531.46 338.54 L 532.9300000000001 335.46000000000004 L 532.5100000000001 334.29 L 531.7300000000001 333.27000000000004 L 530.8400000000001 333.21000000000004 L 530.1100000000001 332.83000000000004 L 527.2800000000001 330.36 L 525.1600000000001 330.38 L 522.97 329.78 L 520.7 328.7 L 517.97 328.14 L 515.99 328 L 514.67 328.99 L 513.1999999999999 329.49 L 510.5899999999999 329.04 L 510.0199999999999 329.25 L 509.5799999999999 325.29 L 503.05999999999995 319.09000000000003 L 502.67999999999995 318.91 L 498.28999999999996 320.14000000000004 L 496.76 318.90000000000003 L 496.25 319.11 L 495.32 318.89 L 492.78 317.66999999999996 L 490.60999999999996 316.04999999999995 L 489.62999999999994 316.22999999999996 L 485.2799999999999 312.59999999999997 L 484.1799999999999 312.05999999999995 L 481.4499999999999 311.30999999999995 L 479.6799999999999 311.55999999999995 L 477.7999999999999 312.4599999999999 L 476.9899999999999 313.5799999999999 L 476.3499999999999 313.75999999999993 L 471.0199999999999 312.2899999999999 L 470.4099999999999 311.7999999999999 L 470.1499999999999 310.2999999999999 L 470.2899999999999 309.4099999999999 L 471.5799999999999 306.6699999999999 L 470.7199999999999 306.2099999999999 L 468.43999999999994 305.68999999999994 L 466.25999999999993 305.6499999999999 L 465.05999999999995 305.1499999999999 L 463.2699999999999 305.06999999999994 L 459.43999999999994 306.6499999999999 L 455.17999999999995 309.6799999999999 L 454.53999999999996 310.7899999999999 L 451.16999999999996 312.6599999999999 L 449.15 313.0599999999999 L 448.2 314.2399999999999 L 446.39 315.7899999999999 L 444.96 316.3099999999999 L 443.96 316.1599999999999 L 442.10999999999996 318.7399999999999 L 441.06999999999994 319.5099999999999 L 438.93999999999994 319.1299999999999 L 438.2199999999999 319.2599999999999 L 437.5299999999999 320.2599999999999 L 436.18999999999994 321.1799999999999 L 435.78999999999996 320.9399999999999 L 437.21999999999997 317.5099999999999 L 436.71 315.09999999999985 L 436.71 315.09999999999985 L 438.19 313.1299999999998 L 438.44 312.35999999999984 L 438.21 311.08999999999986 L 437.53999999999996 309.36999999999983 L 437.64 308.6999999999998 L 438.34999999999997 307.2799999999998 L 438.29999999999995 306.8199999999998 L 435.09 304.1999999999998 L 433.4 300.73999999999984 L 432.78 297.21999999999986 L 432.83 295.66999999999985 L 434.03 291.83999999999986 L 435.61999999999995 290.8099999999999 L 435.84999999999997 290.4299999999999 L 435.90999999999997 289.4899999999999 L 434.28 288.6499999999999 L 434.16999999999996 288.31999999999994 L 434.65 285.79999999999995 L 436.08 284.73999999999995 L 436.06 284.36999999999995 L 433.34 281.90999999999997 L 433.34 281.90999999999997 L 433.29999999999995 280.97999999999996 L 434.65999999999997 278.59999999999997 L 434.61999999999995 277.53 L 434.44999999999993 277.10999999999996 L 432.98999999999995 276.61999999999995 L 432.04999999999995 275.96999999999997 L 431.69999999999993 274.71 L 431.75999999999993 271.78999999999996 L 431.94999999999993 270.93999999999994 L 433.8999999999999 269.2699999999999 L 435.0399999999999 268.8499999999999 L 435.9999999999999 268.1299999999999 L 435.70999999999987 267.4999999999999 L 435.1299999999999 266.9799999999999 L 434.20999999999987 266.6899999999999 L 433.1799999999999 266.8699999999999 L 432.82999999999987 266.5399999999999 L 432.7399999999999 266.0399999999999 L 433.1599999999999 265.0799999999999 L 435.19999999999993 264.25999999999993 L 435.75999999999993 263.80999999999995 L 435.7199999999999 263.04999999999995 L 433.8399999999999 262.06999999999994 L 430.25999999999993 261.3999999999999 L 428.3999999999999 259.43999999999994 L 428.1699999999999 258.5199999999999 L 428.6699999999999 257.3599999999999 L 429.6799999999999 256.6299999999999 L 431.1999999999999 253.1499999999999 L 432.09999999999985 252.53999999999988 L 433.10999999999984 252.26999999999987 L 433.45999999999987 251.88999999999987 L 432.16999999999985 250.08999999999986 L 432.35999999999984 249.71999999999986 L 435.5699999999998 247.09999999999985 L 439.3899999999998 245.07999999999984 L 439.9499999999998 244.60999999999984 L 440.16999999999985 243.62999999999985 L 440.85999999999984 242.97999999999985 L 440.85999999999984 242.97999999999985 L 443.1899999999998 242.95999999999984 L 444.6299999999998 244.29999999999984 L 445.28999999999985 245.33999999999983 L 445.8199999999998 247.54999999999984 L 447.5799999999998 250.03999999999985 L 451.7599999999998 251.89999999999986 L 453.55999999999983 251.37999999999985 L 455.66999999999985 251.55999999999986 L 455.99999999999983 251.34999999999985 L 456.74999999999983 249.89999999999986 L 457.8899999999998 249.52999999999986 L 458.55999999999983 248.65999999999985 L 459.72999999999985 247.76999999999987 L 461.9399999999998 247.01999999999987 L 463.2699999999998 247.18999999999986 L 464.74999999999983 247.71999999999986 L 466.09999999999985 247.29999999999987 L 469.0699999999999 244.87999999999988 L 472.01999999999987 239.82999999999987 L 472.7399999999999 238.96999999999986 L 472.9799999999999 238.04999999999987 L 473.2799999999999 235.48999999999987 L 473.1599999999999 234.32999999999987 L 470.9199999999999 229.89999999999986 L 470.9699999999999 228.96999999999986 L 474.2099999999999 227.31999999999985 L 476.1599999999999 227.29999999999984 L 477.6599999999999 227.75999999999985 L 478.06999999999994 228.68999999999986 L 478.38999999999993 228.86999999999986 L 480.50999999999993 228.43999999999986 L 481.8999999999999 227.89999999999986 L 483.2299999999999 228.27999999999986 L 484.9399999999999 229.26999999999987 L 484.8099999999999 229.91999999999987 L 484.9999999999999 230.20999999999987 L 485.8199999999999 230.48999999999987 L 488.8199999999999 230.37999999999985 L 490.2899999999999 229.73999999999987 L 491.9899999999999 229.63999999999987 L 492.8099999999999 228.41999999999987 L 494.3199999999999 227.07999999999987 L 497.0499999999999 226.73999999999987 L 497.8199999999999 226.37999999999985 L 498.6299999999999 225.39999999999986 L 500.7999999999999 225.40999999999985 L 501.4199999999999 226.03999999999985 L 501.7299999999999 226.08999999999986 L 503.5899999999999 224.27999999999986 L 503.4899999999999 221.87999999999985 L 505.4799999999999 221.49999999999986 L 506.2699999999999 221.67999999999986 L 507.31999999999994 221.01999999999987 L 508.81999999999994 218.70999999999987 L 509.2799999999999 217.55999999999986 L 509.2799999999999 217.55999999999986 L 510.1699999999999 217.95999999999987 L 511.3299999999999 217.68999999999986 L 513.53 217.97999999999985 L 516.35 219.36999999999983 L 516.7900000000001 219.87999999999982 L 516.7300000000001 222.60999999999981 L 517.4500000000002 224.5499999999998 L 519.6600000000002 225.4599999999998 L 519.9300000000002 227.4599999999998 L 519.0100000000002 229.13999999999982 L 520.8400000000003 229.75999999999982 L 521.8000000000003 229.53999999999982 L 522.6200000000003 228.61999999999983 L 525.4900000000004 227.73999999999984 L 526.2600000000003 224.15999999999983 L 526.7600000000003 223.28999999999982 L 527.5100000000003 223.12999999999982 L 528.2900000000003 223.65999999999983 L 528.9200000000003 223.70999999999984 L 531.3100000000003 222.68999999999983 L 532.4100000000003 221.44999999999982 L 532.5800000000003 220.85999999999981 L 532.3300000000003 219.4999999999998 L 532.6200000000002 219.2499999999998 L 534.8600000000002 218.7999999999998 L 535.6300000000002 216.7499999999998 L 537.2800000000002 216.3099999999998 L 539.8100000000002 214.8499999999998 L 540.4000000000002 214.7499999999998 L 541.8900000000002 215.3099999999998 L 542.7200000000003 216.7499999999998 L 544.0800000000003 217.5599999999998 L 546.4400000000003 218.3399999999998 L 549.4300000000003 218.7399999999998 L 551.0100000000003 219.88999999999982 L 551.5500000000003 221.53999999999982 L 551.9400000000003 221.80999999999983 L 552.3700000000002 221.65999999999983 L 552.6600000000002 219.90999999999983 L 553.0900000000001 219.46999999999983 L 554.0900000000001 219.45999999999984 L 554.5400000000002 219.77999999999983 L 554.5600000000002 220.40999999999983 L 553.9400000000002 221.28999999999982 L 554.3900000000002 222.11999999999983 L 554.8900000000002 222.48999999999984 L 556.9900000000002 223.34999999999985 L 557.0100000000002 224.28999999999985 L 558.2300000000002 227.33999999999986 L 558.2300000000002 227.33999999999986 L 558.7700000000002 228.73999999999987 L 559.7900000000002 229.02999999999986 L 560.2400000000002 228.93999999999986 L 561.6700000000002 229.72999999999985 L 561.8700000000002 230.44999999999985 L 561.8700000000002 230.44999999999985 L 561.2000000000003 231.60999999999984 L 561.4100000000003 233.74999999999983 L 562.6900000000003 236.24999999999983 L 564.6800000000003 238.19999999999982 L 565.4300000000003 239.34999999999982 L 565.3500000000003 242.46999999999983 L 564.6900000000003 244.08999999999983 L 564.6000000000003 244.96999999999983 L 565.3600000000002 247.71999999999983 L 565.0600000000003 248.29999999999984 L 564.3700000000002 248.84999999999985 L 561.8200000000003 249.84999999999985 L 560.6900000000003 249.09999999999985 L 558.9800000000002 249.08999999999986 L 558.6600000000002 249.38999999999987 L 558.0700000000002 250.96999999999989 L 558.0900000000001 251.7399999999999 L 559.0400000000002 253.3399999999999 L 560.1400000000002 253.9999999999999 L 560.6600000000002 255.4899999999999 L 562.0900000000001 256.9999999999999 L 562.2400000000001 257.3899999999999 L 562.1100000000001 258.8099999999999 L 561.7700000000001 259.1999999999999 L 561.8900000000001 259.6199999999999 L 562.4800000000001 260.1399999999999 L 564.4100000000001 261.0599999999999 L 564.8900000000001 261.76999999999987 L 565.4300000000001 262.10999999999984 L 566.98 262.74999999999983 L 569.87 261.86999999999983 L 569.87 261.86999999999983 L 570.51 261.84999999999985 L 570.87 262.2599999999999 L 566.79 271.08999999999986 L 562.9599999999999 276.27999999999986 L 561.93 278.60999999999984 L 556.9 284.34999999999985 L 554.4499999999999 285.60999999999984 L 553.5799999999999 285.59999999999985 L 553.8799999999999 284.16999999999985 L 554.2499999999999 284.01999999999987 L 554.3899999999999 282.91999999999985 L 553.9399999999998 280.98999999999984 L 552.0699999999998 280.73999999999984 L 551.6399999999999 279.4399999999998 L 550.9599999999999 278.6899999999998 L 550.5899999999999 279.28999999999985 L 550.1299999999999 281.61999999999983 L 549.6299999999999 282.48999999999984 L 549.0799999999999 282.86999999999983 L 548.52 282.5799999999998 L 548.03 280.8399999999998 L 548.14 280.5199999999998 L 548.4499999999999 280.3899999999998 L 548.42 279.99999999999983 L 547.55 281.28999999999985 L 548.4799999999999 282.97999999999985 L 548.9399999999999 283.20999999999987 L 549.31 283.0599999999999 L 550.4599999999999 283.3199999999999 L 549.9999999999999 285.1299999999999 L 548.7899999999998 286.27999999999986 L 548.5399999999998 288.09999999999985 L 547.2899999999998 289.0699999999999 L 546.9399999999998 289.7399999999999 L 546.7399999999998 290.57999999999987 L 546.9199999999997 291.4299999999999 L 545.5699999999997 291.0399999999999 L 545.3599999999997 291.4299999999999 L 544.9999999999997 293.9499999999999 L 545.3599999999997 293.22999999999985 L 546.1099999999997 293.4399999999998 L 546.3499999999997 293.97999999999985 L 546.1199999999997 294.3899999999999 L 546.1799999999996 295.0099999999999 L 546.4799999999996 295.3099999999999 L 546.8099999999996 296.3099999999999 L 545.7699999999996 298.8199999999999 L 546.3399999999997 302.2599999999999 L 545.7899999999997 302.7499999999999 L 545.2199999999997 302.52999999999986 L 545.0799999999997 303.65999999999985 L 545.6699999999997 304.11999999999983 L 546.8799999999998 302.3999999999998 L 546.4099999999997 300.1899999999998 L 547.2299999999998 299.5799999999998 L 547.4799999999998 300.11999999999983 L 547.4199999999998 301.8799999999998 L 546.4599999999998 304.48999999999984 L 545.7199999999998 309.91999999999985 L 545.2099999999998 311.72999999999985 L 545.4099999999999 314.1999999999999 L 546.1899999999998 317.0499999999999 L 546.3799999999999 321.5899999999999 L 547.2499999999999 327.99999999999994 L 548.2399999999999 331.41999999999996 L 546.0299999999999 338.08 L 544.6799999999998 344.72999999999996 L 544.2099999999998 345.73999999999995 L 544.0499999999998 348.59999999999997 L 542.9899999999999 352.32 L 542.8999999999999 354.65 L 543.2899999999998 359.07 L 544.1799999999998 360.78 L 541.9399999999998 363.76 L 540.1299999999999 364.43 L 539.1899999999998 365.07 L 536.4699999999998 368.96 L 535.9 371 L 535.9 371 L 527.81 365.86 L 527.5 365.33 z M 549.78 287.33 L 549.55 286.13 L 550.29 285.71999999999997 L 551.3499999999999 284.67999999999995 L 551.5099999999999 284.03999999999996 L 551.1399999999999 283.30999999999995 L 551.8999999999999 283.44999999999993 L 552.7199999999999 284.49999999999994 L 552.67 285.0299999999999 L 549.78 287.33 z M 547.25 294.18 L 546.62 294.15000000000003 L 546.63 293.48 L 546.89 293.12 L 546.09 292.9 L 545.6700000000001 292.5 L 545.8000000000001 291.43 L 547.6700000000001 291.28000000000003 L 547.83 291.48 L 547.94 292.61 L 547.25 294.18 z"},{code:"CE",name:"Ceará",gTransform:"matrix(1 0 0 1 235.04 -154.64)",pathTransform:"translate(-541.04, -164.62)",d:"M 573.79 156.85 L 568.9 158.44 L 566.29 160.45 L 562.99 167.14 L 562.15 168.26 L 561.28 168.83 L 560.63 170.5 L 560.78 171.24 L 559.38 173.68 L 557.92 175.19 L 557.35 176.29 L 556.32 176.55 L 555.54 176.04 L 555.03 176.11 L 554.19 176.99 L 552.78 179.24 L 552.44 181.21 L 553.08 181.38 L 553.74 181 L 553.74 181 L 553.66 181.54 L 552.82 182.69 L 551.79 185.69 L 552.31 187 L 551.65 188.31 L 550.56 188.94 L 550.39 189.32 L 550.27 190.25 L 550.51 190.66 L 551.09 190.95 L 551.44 191.67 L 551.42 193.33 L 552.66 194.22 L 553.35 194.3 L 553.69 195.49 L 552.08 198.98 L 550.89 200.1 L 551.06 200.35 L 551.06 200.35 L 549.47 200.84 L 548.4 201.67 L 546.86 203.96 L 545.21 204.01 L 544.58 202.37 L 543.8 201.8 L 542.44 201.32 L 541.43 200.25 L 540.97 199.26 L 539.14 198.43 L 536.29 196.53 L 533.21 196.11 L 531.92 196.21 L 529.78 197.01 L 528.15 197.2 L 527.26 196.96 L 522.33 196.76 L 522.33 196.76 L 522.39 195.44 L 521.71 194.76 L 521.63 193.79 L 522.77 190.68 L 524.27 188.43 L 524.28 187.74 L 523.51 186.58 L 520.95 186.11 L 519.64 185.46 L 518.63 182.79 L 517.58 177.59 L 516.82 175.02 L 517.06 174.57 L 516.12 166.41 L 516.01 166.03 L 515.09 165.34 L 515.89 164.76 L 516.48 163.18 L 515.88 160.19 L 514.88 158.18 L 515.36 156.58 L 514.57 152.71 L 515.31 151.35 L 515.33 150.59 L 513.97 149 L 513.53 147.27 L 510.38 140.85 L 508.58 136.13 L 508.29 134.84 L 508.47 133.38 L 510.05 131.41 L 511.14 129.56 L 511.25 128.76 L 511.25 128.76 L 511.44 128.62 L 511.4 128 L 511 127.34 L 511.65 126.53 L 518.39 126.31 L 521.28 125.88 L 523.35 125.22 L 530.75 126.01 L 532.87 127.13 L 534.81 128.63 L 538.93 130.81 L 540.39 131.33 L 545.21 134.33 L 546.42 134.53 L 548.64 136.82 L 551.63 138.93 L 554.2 139.65 L 556.64 142.56 L 557.86 143.17 L 560.82 146.98 L 564.98 150.06 L 566.44 152.06 L 567.48 153.05 L 568.98 153.87 L 570.13 153.9 L 572.5 154.82 L 573.29 155.49 z"},{code:"DF",name:"Distrito Federal",gTransform:"matrix(1 0 0 1 103.1 10.18)",pathTransform:"translate(-409.11, -329.45)",d:"M 416.71 333.87 L 402.02 333.85 L 401.5 330.59 L 402.42 328.76 L 402.8 325.03 L 414.75 325.04 L 416.58 327.02 L 416.64 329.23 L 416.05 330.42 L 415.84 332.86 z"},{code:"ES",name:"Espírito Santo",gTransform:"matrix(1 0 0 1 212.62 72.56)",pathTransform:"translate(-518.62, -391.82)",d:"M 501.63 411.37 L 501.34 411.23 L 501.78 408.89 L 502.35 407.59 L 501.76 404.47 L 501.92 404.05 L 503.64 401.99 L 508.79 402.02 L 509.34 401.7 L 510.31 398.46 L 511.42 397.19 L 512.3 394.9 L 512.54 393.18 L 512.8 392.74 L 514.04 391.88 L 515.75 389.79 L 516.29 386.82 L 516 384.39 L 514.73 381.58 L 513.63 380.31 L 513.11 380.22 L 512.66 380.51 L 511.9 380.23 L 511.41 379.52 L 511.84 378.97 L 513.32 378.88 L 514.12 379.23 L 515.09 379.26 L 516.04 379.02 L 516.36 378.6 L 516.19 376.88 L 514.88 376.53 L 514.67 376.12 L 514.97 374.58 L 515 372.66 L 514.48 372 L 513.15 371.33 L 512.85 370.63 L 514.02 368.7 L 516.19 367.39 L 516.5 367.37 L 517.55 368.11 L 518.68 368.22 L 518.7 367.41 L 517.03 365.14 L 518.37 365.27 L 520.55 364.98 L 521.39 364.37 L 522.47 364.05 L 524.05 363.97 L 526.59 364.78 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.8 365.86 L 535.9 371 L 535.9 371 L 534.97 374.35 L 534.66 377.21 L 534.78 380.8 L 535.5 386.95 L 535.19 389.42 L 533.7 392.6 L 530.95 393.99 L 530.4 394.59 L 528.73 397.92 L 527.75 401.72 L 526.98 403.19 L 526.15 402.51 L 525.27 402.38 L 524.98 403.66 L 526.33 404.18 L 524.39 408.42 L 520.94 412.26 L 520.7 411.99 L 518.84 412.65 L 518.04 413.88 L 517.98 415.27 L 517.56 416.52 L 515.97 418.54 L 515.68 419.67 L 515.68 419.67 L 514.06 418.61 L 511.07 418.98 L 506.73 417.97 L 504.23 416.84 L 503.56 412.13 z"},{code:"GO",name:"Goiás",gTransform:"matrix(1 0 0 1 75.37 14.13)",pathTransform:"translate(-381.37, -333.38)",d:"M 416.71 333.87 L 415.84 332.86 L 416.05 330.42 L 416.64 329.23 L 416.58 327.02 L 414.75 325.04 L 402.8 325.03 L 402.42 328.76 L 401.5 330.59 L 402.02 333.85 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.18 335.39 L 416.49 336.96 L 415.81 338.55 L 414.77 339.8 L 414.36 341.27 L 415.21 342.48 L 416.06 342.82 L 417.48 343.85 L 419.13 348.41 L 419.13 349.01 L 416.81 351.72 L 413.57 354.73 L 413.14 356.87 L 414.23 357.98 L 415.13 357.51 L 416.71 358.08 L 417.18 358.69 L 417.36 359.69 L 417.19 360.4 L 416.46 361.3 L 415.95 363.19 L 417.14 366.65 L 414.05 368.71 L 412.89 368.91 L 412.03 369.81 L 411.55 370.93 L 406.66 373.67 L 405.96 372.9 L 401.61 371.04 L 401.06 371.52 L 400.48 371.61 L 398.73 371.62 L 397.25 371.34 L 393.39 371.5 L 391.38 370.61 L 387.25 373.25 L 384.34 376.17 L 384.01 376.17 L 382.7 374.75 L 381.18 374.45 L 377.99 376.09 L 374.28 375.47 L 371.8 376.43 L 369.57 376.97 L 368.16 379.07 L 366.95 381.53 L 367.01 382.53 L 366.17 383.83 L 365.35 384.11 L 364.51 383.95 L 364.06 384.09 L 363.12 384.83 L 361.48 386.93 L 360.91 388.83 L 361.47 389.44 L 361.46 389.78 L 361.1 390.01 L 360.24 389.55 L 360.24 389.55 L 360 389.1 L 357.34 386.86 L 354.19 386.25 L 352.57 384.7 L 350.67 384.27 L 349.18 384.23 L 345.83 382.89 L 345.15 382.04 L 342.08 380.48 L 341.41 379.87 L 339.97 379.16 L 338.83 378.99 L 336.13 377.31 L 333.35 377.47 L 329.55 376.77 L 329.42 376.44 L 329.68 375.6 L 330.25 374.43 L 331.56 372.67 L 331.48 372.25 L 329.23 371.35 L 328.09 372.02 L 327.43 371.83 L 327.15 371.42 L 326.92 370.31 L 327.18 367.73 L 326.99 365.96 L 326.99 365.96 L 326.04 363.76 L 325.86 360.33 L 324.45 358.14 L 324.29 357.43 L 324.69 354.02 L 327.24 350.17 L 327.62 347.26 L 328.32 346.49 L 330.34 345.65 L 332.26 343.88 L 333.51 341.86 L 333.84 339.91 L 334.34 338.9 L 335.62 337.86 L 336.44 336.43 L 336.52 334.89 L 338.27 333.92 L 339.67 331.3 L 342.32 331.17 L 345.04 330.31 L 345.36 330.03 L 347.34 325.84 L 348.05 324.88 L 348.69 320.78 L 349.07 320.04 L 350.99 318.1 L 352.64 317.09 L 353.71 316.83 L 354.94 317.51 L 356.15 316.78 L 357.54 315.35 L 358.38 312.42 L 359.55 309.55 L 359.54 308.75 L 359.06 307.61 L 359.64 304.87 L 361.24 301.78 L 361.12 296.6 L 362.33 295.82 L 363.36 293.19 L 365.36 290.02 L 365.75 288.95 L 365.59 286.23 L 365.94 285.33 L 366.91 284.47 L 367.18 283.34 L 367.1 282.71 L 367.1 282.71 L 367.44 282.26 L 367.64 280.38 L 368.3 279.15 L 370.11 277.06 L 370.67 276.76 L 370.64 278.47 L 369.42 280.35 L 368.9 282.69 L 371.3 283.09 L 373.5 284.12 L 377.43 284.52 L 380.52 286.23 L 384.59 287.66 L 385.22 287.43 L 386.85 281.49 L 388.32 279.1 L 389.5 278.13 L 390.65 279.44 L 391.69 281.32 L 392.8 285.03 L 393.41 288.13 L 394.55 288.18 L 395.3 287.43 L 395.6 286.43 L 396.16 285.89 L 398.92 286.23 L 403.45 285.7 L 403.67 286.44 L 403.11 288 L 406.24 289.47 L 409.59 290.15 L 410.28 290.07 L 410.79 286.77 L 411.34 286.8 L 412.85 289.42 L 413.31 289.66 L 415.09 288.76 L 417.61 286.68 L 422.14 285.68 L 423.69 285.68 L 426.25 284.58 L 427.99 283.24 L 433.35 281.82 L 433.35 281.82 L 436.07 284.28 L 436.09 284.66 L 434.66 285.72 L 434.18 288.24 L 434.28 288.57 L 435.91 289.41 L 435.85 290.35 L 435.62 290.73 L 434.03 291.76 L 432.84 295.59 L 432.79 297.14 L 433.41 300.66 L 435.11 304.12 L 438.32 306.74 L 438.37 307.21 L 437.65 308.63 L 437.55 309.3 L 438.22 311.02 L 438.45 312.3 L 438.2 313.07 L 436.72 315.04 L 436.72 315.04 L 435.72 316.05 L 432.49 315.71 L 431.59 313.95 L 429.17 312.47 L 428 313.96 L 428.58 317.73 L 428.01 318.27 L 427.61 318.4 L 424.83 317.26 L 423.66 317.49 L 423.29 317.77 L 422.57 320.95 L 423.29 321.05 L 423.78 322.21 L 423.21 323.15 L 422.48 323.85 L 422.52 325.75 L 422.94 326.36 L 423.47 326.55 L 424.16 330.81 L 423.63 331.34 L 420.27 332.24 L 417.98 333.75 z"},{code:"MA",name:"Maranhão",gTransform:"matrix(1 0 0 1 142.22 -148.63)",pathTransform:"translate(-448.22, -170.64)",d:"M 458.57 128.92 L 458.53 129.25 L 456.48999999999995 131.4 L 456.05999999999995 131.57 L 456.0199999999999 133.01 L 457.98999999999995 131.31 L 458.66999999999996 130.1 L 460.78999999999996 128.51999999999998 L 461.67999999999995 127.37999999999998 L 462.7099999999999 121.04999999999998 L 463.8599999999999 120.34999999999998 L 464.9699999999999 120.22999999999998 L 466.63999999999993 119.30999999999997 L 467.2899999999999 119.17999999999998 L 467.7499999999999 119.29999999999998 L 467.82999999999987 120.92999999999998 L 467.6299999999999 121.37999999999998 L 466.20999999999987 123.24999999999999 L 462.9999999999999 124.99999999999999 L 462.9699999999999 125.71999999999998 L 463.69999999999993 125.83999999999999 L 464.1499999999999 125.02999999999999 L 465.2999999999999 124.71999999999998 L 465.5199999999999 125.54999999999998 L 464.92999999999995 126.05999999999999 L 465.17999999999995 126.35999999999999 L 469.38999999999993 121.38999999999999 L 470.24999999999994 121.71999999999998 L 472.8299999999999 120.78999999999998 L 476.86999999999995 121.21999999999998 L 476.40999999999997 118.80999999999999 L 477.02 118.57999999999998 L 479.44 118.65999999999998 L 481.21999999999997 119.03999999999998 L 483.84999999999997 120.08999999999997 L 484.89 120.19999999999997 L 487.03999999999996 121.57999999999997 L 488.43999999999994 121.60999999999997 L 489.69999999999993 122.90999999999997 L 491.5899999999999 124.22999999999996 L 494.0899999999999 124.80999999999996 L 495.24999999999994 124.61999999999996 L 495.80999999999995 125.37999999999997 L 496.1499999999999 125.42999999999996 L 497.7399999999999 125.33999999999996 L 500.1999999999999 125.99999999999996 L 500.45999999999987 125.09999999999995 L 499.78999999999985 124.62999999999995 L 501.45999999999987 124.24999999999996 L 502.02999999999986 124.35999999999996 L 501.9399999999999 124.77999999999996 L 501.9399999999999 124.77999999999996 L 501.4799999999999 126.20999999999997 L 501.7099999999999 126.92999999999996 L 502.3399999999999 127.46999999999997 L 501.9599999999999 128.99999999999997 L 500.1699999999999 131.26999999999998 L 496.0399999999999 135.23999999999998 L 492.7199999999999 135.7 L 491.9199999999999 135.54 L 488.9999999999999 138.94 L 489.0399999999999 140.74 L 488.1599999999999 142.57000000000002 L 486.2699999999999 144.42000000000002 L 485.44999999999993 146.4 L 484.80999999999995 146.57 L 484.03999999999996 147.62 L 484.4 149.54 L 485.63 150.37 L 486.01 151.65 L 485.73 153.11 L 484.59000000000003 155.98000000000002 L 486.17 158.79000000000002 L 486.72 161.77 L 486.61 164.20000000000002 L 486.40000000000003 164.75000000000003 L 482.3 169.17000000000002 L 482.13 171.65 L 482.25 173.76000000000002 L 482.76 176.06000000000003 L 484.53999999999996 178.10000000000002 L 486.15 179.01000000000002 L 486.32 179.51000000000002 L 486.45 180.35000000000002 L 486.06 182.55 L 485.77 182.99 L 485.65 184.20000000000002 L 485.15 185.66000000000003 L 483.94 186.97000000000003 L 481.65 187.26000000000002 L 481 186.98000000000002 L 480.17 187.02 L 477.74 187.88000000000002 L 476.22 187.99000000000004 L 473.72 186.17000000000004 L 472.71000000000004 185.96000000000004 L 471.25000000000006 186.15000000000003 L 470.24000000000007 186.75000000000003 L 469.12000000000006 187.01000000000002 L 468.89000000000004 186.71 L 468.05000000000007 186.95000000000002 L 467.55000000000007 187.17000000000002 L 465.6500000000001 189.08 L 465.6600000000001 189.54000000000002 L 465.0300000000001 190.41000000000003 L 463.0200000000001 192.41000000000003 L 460.6800000000001 193.32000000000002 L 457.8100000000001 195.88000000000002 L 456.48000000000013 196.41000000000003 L 455.4300000000001 196.45000000000002 L 453.73000000000013 197.98000000000002 L 452.65000000000015 198.34000000000003 L 450.04000000000013 198.66000000000003 L 447.3200000000001 199.42000000000002 L 445.1900000000001 201.37 L 444.2100000000001 204.34 L 443.8200000000001 207.31 L 443.1900000000001 209.63 L 441.7400000000001 212.37 L 441.4400000000001 212.59 L 441.10000000000014 213.41 L 440.97000000000014 214.93 L 439.77000000000015 217.41 L 438.07000000000016 218.81 L 437.34000000000015 220.81 L 438.0500000000001 222.75 L 438.52000000000015 225.93 L 440.25000000000017 228.99 L 440.21000000000015 229.51000000000002 L 439.45000000000016 230.91000000000003 L 439.32000000000016 237.27000000000004 L 438.1700000000002 239.72000000000003 L 437.9100000000002 240.78000000000003 L 437.8600000000002 242.70000000000002 L 437.8600000000002 242.70000000000002 L 436.5800000000002 242.04000000000002 L 435.9700000000002 241.22000000000003 L 435.1500000000002 240.77000000000004 L 434.1600000000002 240.48000000000005 L 432.3800000000002 240.68000000000004 L 431.67000000000024 240.50000000000003 L 430.3200000000002 238.50000000000003 L 429.3300000000002 235.64000000000001 L 427.2000000000002 234.02 L 427.06000000000023 232.37 L 428.7000000000002 230.56 L 428.62000000000023 230.03 L 424.74000000000024 228.08 L 424.12000000000023 227.03 L 424.06000000000023 225.37 L 423.31000000000023 223.78 L 422.37000000000023 223.09 L 420.29000000000025 222.81 L 420.09000000000026 222.39000000000001 L 420.35000000000025 221.68 L 422.98000000000025 219.14000000000001 L 422.61000000000024 217.83 L 423.34000000000026 215.15 L 424.03000000000026 213.72 L 424.60000000000025 213.17 L 425.9400000000002 212.63 L 429.3300000000002 212.28 L 428.9400000000002 210.93 L 429.5800000000002 207.68 L 429.5000000000002 205.92000000000002 L 427.7000000000002 204.71 L 423.43000000000023 205.65 L 421.28000000000026 206.99 L 419.0100000000003 203.97 L 418.10000000000025 203.12 L 415.10000000000025 198.97 L 414.22000000000025 199.04 L 413.3800000000003 197.6 L 413.9900000000003 196.41 L 413.8800000000003 195.53 L 413.6300000000003 195.19 L 412.2600000000003 194.95 L 411.84000000000026 195.22 L 409.91000000000025 193.89 L 410.09000000000026 193.17999999999998 L 411.85000000000025 192.51999999999998 L 413.60000000000025 190.48 L 413.85000000000025 188.89 L 413.5700000000003 187.89 L 413.8800000000003 185.52999999999997 L 415.65000000000026 179.36999999999998 L 415.66000000000025 178.93999999999997 L 414.98000000000025 177.79999999999998 L 414.7500000000002 176.71999999999997 L 414.9600000000002 172.99999999999997 L 414.3200000000002 171.49999999999997 L 413.8500000000002 168.00999999999996 L 413.0100000000002 166.97999999999996 L 409.61000000000024 165.53999999999996 L 408.3900000000002 165.51999999999995 L 408.11000000000024 165.19999999999996 L 408.03000000000026 164.16999999999996 L 407.4400000000003 163.47999999999996 L 405.7000000000003 163.18999999999997 L 404.7400000000003 163.70999999999998 L 403.3400000000003 163.61999999999998 L 400.56000000000034 162.10999999999999 L 399.70000000000033 162.04999999999998 L 397.74000000000035 162.57999999999998 L 395.12000000000035 164.42999999999998 L 394.5900000000004 165.06999999999996 L 394.5900000000004 165.06999999999996 L 394.10000000000036 164.98999999999995 L 408.81000000000034 153.15999999999994 L 411.16000000000037 153.38999999999993 L 412.3300000000004 152.46999999999994 L 413.8800000000004 150.29999999999995 L 414.3100000000004 149.14999999999995 L 415.8600000000004 147.97999999999996 L 416.4800000000004 145.09999999999997 L 417.6000000000004 144.63999999999996 L 420.0400000000004 142.31999999999996 L 420.51000000000045 141.10999999999996 L 420.80000000000047 139.20999999999995 L 422.4000000000005 134.51999999999995 L 424.36000000000047 132.97999999999996 L 425.8400000000005 131.21999999999997 L 426.67000000000047 129.76999999999998 L 427.13000000000045 128.48999999999998 L 426.95000000000044 126.66999999999999 L 427.74000000000046 125.85999999999999 L 426.70000000000044 124.27999999999999 L 430.38000000000045 121.18999999999998 L 430.25000000000045 119.54999999999998 L 430.75000000000045 117.16999999999999 L 432.49000000000046 115.6 L 432.8500000000005 114.89 L 433.75000000000045 111.87 L 433.83000000000044 110.26 L 433.40000000000043 109.73 L 432.4100000000004 109.89 L 432.14000000000044 109.4 L 432.19000000000045 108.78 L 433.33000000000044 108.63 L 433.90000000000043 107.89 L 434.6100000000004 103.5 L 434.4500000000004 102.12 L 434.9200000000004 101.09 L 435.6900000000004 100.64 L 435.6900000000004 100.64 L 436.3200000000004 100.64 L 436.5600000000004 100.4 L 436.5000000000004 99.86 L 436.8400000000004 99.11 L 437.42000000000036 98.58 L 438.76000000000033 99.56 L 439.2100000000003 101.4 L 440.4000000000003 101.52000000000001 L 441.1700000000003 100.16000000000001 L 441.7800000000003 103.09000000000002 L 442.7700000000003 103.13000000000002 L 443.06000000000034 102.64000000000003 L 443.13000000000034 101.70000000000003 L 443.98000000000036 101.66000000000003 L 445.67000000000036 102.19000000000003 L 446.17000000000036 102.88000000000002 L 444.74000000000035 104.58000000000003 L 445.41000000000037 105.28000000000003 L 445.43000000000035 105.83000000000003 L 446.6400000000003 103.79000000000002 L 447.13000000000034 102.25000000000001 L 447.5800000000003 102.25000000000001 L 447.9800000000003 103.27000000000001 L 447.9800000000003 103.85000000000001 L 447.1100000000003 104.77000000000001 L 446.8400000000003 105.76 L 446.9200000000003 108.47 L 447.1800000000003 108.8 L 447.6500000000003 108.92 L 448.2300000000003 108.78 L 449.1900000000003 107.85 L 448.72000000000025 106.85 L 448.86000000000024 106.25 L 450.18000000000023 104.82 L 451.23000000000025 104.57 L 453.36000000000024 105.16 L 454.86000000000024 104.05 L 454.91000000000025 104.97 L 454.55000000000024 105.17999999999999 L 453.42000000000024 106.71 L 454.0100000000002 107.28999999999999 L 454.11000000000024 106.91999999999999 L 455.36000000000024 106.32 L 455.9400000000002 107.11 L 455.80000000000024 108.32 L 457.43000000000023 110.07 L 458.29000000000025 109.63 L 459.87000000000023 110.3 L 460.6400000000002 112.7 L 460.5300000000002 113.65 L 458.3400000000002 116.38000000000001 L 457.9600000000002 117.27000000000001 L 458.06000000000023 117.93 L 458.66000000000025 116.9 L 460.41000000000025 115.22 L 461.24000000000024 115.19 L 462.11000000000024 116 L 462.6300000000002 117.89 L 462.36000000000024 119.12 L 461.3900000000002 119.31 L 460.36000000000024 120.22 L 459.2000000000002 121.71 L 459.2700000000002 122.47999999999999 L 458.1100000000002 124.82999999999998 L 457.4900000000002 128.35 L 457.70000000000016 128.69 L 458.57 128.92 z M 459.09 129.37 L 459.03 128.58 L 459.55999999999995 127.05000000000001 L 459.1499999999999 125.98000000000002 L 459.2799999999999 125.32000000000002 L 460.18999999999994 124.08000000000003 L 460.73999999999995 123.89000000000003 L 460.78999999999996 126.24000000000002 L 460.56999999999994 127.58000000000003 L 459.7699999999999 128.18000000000004 L 459.09 129.37 z M 452.79 103.61 L 452.35 103.15 L 452.27000000000004 102.55000000000001 L 453.07000000000005 101.43 L 453.91 101.4 L 454.59000000000003 101.82000000000001 L 454.69000000000005 102.16000000000001 L 454.50000000000006 102.52000000000001 L 452.79 103.61 z M 456.29 107.79 L 456 107.49000000000001 L 456.06 106.96000000000001 L 457.12 106.07000000000001 L 457.6 106.14 L 458.1 106.99 L 457.96000000000004 107.6 L 457.56000000000006 107.42999999999999 L 456.29 107.79 z M 442.13 102.98 L 441.92 102.93 L 442.87 99.35000000000001 L 443.17 99.44000000000001 L 443.2 99.67000000000002 L 442.78999999999996 102.73000000000002 L 442.13 102.98 z"},{code:"MG",name:"Minas Gerais",gTransform:"matrix(1 0 0 1 139.79 56.66)",pathTransform:"translate(-445.79, -375.93)",d:"M 527.5 365.33 L 526.59 364.78 L 524.05 363.97 L 522.47 364.05 L 521.39 364.37 L 520.55 364.98 L 518.37 365.27 L 517.03 365.14 L 518.7 367.41 L 518.68 368.22 L 517.55 368.11 L 516.5 367.37 L 516.19 367.39 L 514.02 368.7 L 512.85 370.63 L 513.15 371.33 L 514.48 372 L 515 372.66 L 514.97 374.58 L 514.67 376.12 L 514.88 376.53 L 516.19 376.88 L 516.36 378.6 L 516.04 379.02 L 515.09 379.26 L 514.12 379.23 L 513.32 378.88 L 511.84 378.97 L 511.41 379.52 L 511.9 380.23 L 512.66 380.51 L 513.11 380.22 L 513.63 380.31 L 514.73 381.58 L 516 384.39 L 516.29 386.82 L 515.75 389.79 L 514.04 391.88 L 512.8 392.74 L 512.54 393.18 L 512.3 394.9 L 511.42 397.19 L 510.31 398.46 L 509.34 401.7 L 508.79 402.02 L 503.64 401.99 L 501.92 404.05 L 501.76 404.47 L 502.35 407.59 L 501.78 408.89 L 501.34 411.23 L 501.63 411.37 L 501.63 411.37 L 499.1 413.72 L 497.86 413.99 L 497.3 414.49 L 498.04 415.19 L 495.68 421.24 L 493.78 424.95 L 493.69 425.7 L 495.13 425.83 L 495.42 426.44 L 495.21 426.96 L 492.68 427.94 L 483.17 432.47 L 481.8 432.67 L 481.82 432.21 L 481.33 432.04 L 478.8 431.77 L 478.23 431.83 L 476.61 432.77 L 475.36 432.93 L 472.16 433.01 L 471.8 432.69 L 471.29 432.77 L 467.19 434.55 L 466.14 435.32 L 464.43 436.09 L 463.93 435.81 L 461.34 435.98 L 458.43 437.32 L 456.01 438.06 L 455.33 438.55 L 455.33 438.55 L 454.08 439.28 L 451.88 439.5 L 449.95 440.52 L 448.72 441.76 L 446.93 442.43 L 444.55 442.68 L 442.21 442.6 L 442.2 442.11 L 442.55 441.62 L 442.46 441.27 L 441.27 441.6 L 441.09 443.9 L 441.33 444.13 L 441.28 444.97 L 440.53 445.95 L 439.23 446.27 L 438.66 445.84 L 435.05 446.84 L 434.86 446.31 L 432.85 446.55 L 431.73 446.3 L 429.7 442.99 L 430.92 442.28 L 430.4 440.57 L 428.6 439.74 L 426.81 438.51 L 426.1 436.9 L 426.63 435.34 L 426.82 431.89 L 426.56 428.95 L 428.42 426.23 L 429.12 424.05 L 429.17 422.78 L 428.94 422.41 L 425.24 421.09 L 424.24 421.14 L 423.96 421.5 L 423.18 421.81 L 421.57 421.86 L 421.6 421.01 L 420.77 419.02 L 419.47 417.23 L 419.1 415.02 L 418.79 414.4 L 418 413.66 L 418.19 411.72 L 419.71 409.69 L 419.77 409.13 L 419.37 407.58 L 417.49 406.37 L 416.91 405.76 L 417.2 403.39 L 417.77 402.38 L 417.57 401.34 L 414.3 397.99 L 413 398.28 L 412.15 398.92 L 410.5 398.14 L 408.12 398.25 L 407.81 398.86 L 408.01 399.32 L 407.57 400.31 L 404.79 400.99 L 403.68 400.56 L 402.17 399.11 L 401.16 400.36 L 392.98 401.04 L 392.52 401.52 L 392.04 402.71 L 392.31 405.25 L 391.9 405.69 L 390.71 405.17 L 390.7 402.39 L 390.45 401.43 L 390.09 401.04 L 389.53 400.99 L 389.27 401.18 L 388.86 402.31 L 388.19 403.25 L 387.65 403.57 L 387.03 403.55 L 385.82 401.45 L 385.49 400.03 L 385.63 399.12 L 383.95 398.33 L 381.77 396.91 L 379.78 397.5 L 378.16 397.28 L 376.49 397.63 L 372.2 396.67 L 369.65 396.59 L 367.92 395.04 L 367.17 394.9 L 365.67 395.51 L 364.24 397.2 L 362.32 397.57 L 360.17 398.68 L 358.95 399.81 L 358.95 399.81 L 359.26 397.19 L 358.67 393.98 L 359.66 389.8 L 360.24 389.55 L 360.24 389.55 L 361.1 390.01 L 361.46 389.78 L 361.47 389.44 L 360.91 388.83 L 361.48 386.93 L 363.12 384.83 L 364.06 384.09 L 364.51 383.95 L 365.35 384.11 L 366.17 383.83 L 367.01 382.53 L 366.95 381.53 L 368.16 379.07 L 369.57 376.97 L 371.8 376.43 L 374.28 375.47 L 377.99 376.09 L 381.18 374.45 L 382.7 374.75 L 384.01 376.17 L 384.34 376.17 L 387.25 373.25 L 391.38 370.61 L 393.39 371.5 L 397.25 371.34 L 398.73 371.62 L 400.48 371.61 L 401.06 371.52 L 401.61 371.04 L 405.96 372.9 L 406.66 373.67 L 411.55 370.93 L 412.03 369.81 L 412.89 368.91 L 414.05 368.71 L 417.14 366.65 L 415.95 363.19 L 416.46 361.3 L 417.19 360.4 L 417.36 359.69 L 417.18 358.69 L 416.71 358.08 L 415.13 357.51 L 414.23 357.98 L 413.14 356.87 L 413.57 354.73 L 416.81 351.72 L 419.13 349.01 L 419.13 348.41 L 417.48 343.85 L 416.06 342.82 L 415.21 342.48 L 414.36 341.27 L 414.77 339.8 L 415.81 338.55 L 416.49 336.96 L 416.18 335.39 L 416.71 333.87 L 417.98 333.75 L 420.27 332.24 L 423.63 331.34 L 424.16 330.81 L 423.47 326.55 L 422.94 326.36 L 422.52 325.75 L 422.48 323.85 L 423.21 323.15 L 423.78 322.21 L 423.29 321.05 L 422.57 320.95 L 423.29 317.77 L 423.66 317.49 L 424.83 317.26 L 427.61 318.4 L 428.01 318.27 L 428.58 317.73 L 428 313.96 L 429.17 312.47 L 431.59 313.95 L 432.49 315.71 L 435.72 316.05 L 436.72 315.04 L 436.72 315.04 L 437.23 317.45 L 435.8 320.89 L 436.2 321.12 L 437.54 320.21 L 438.24 319.21 L 438.96 319.08 L 441.09 319.46 L 442.13 318.69 L 443.98 316.12 L 444.97 316.27 L 446.4 315.74 L 448.21 314.19 L 449.16 313.02 L 451.18 312.61 L 454.55 310.75 L 455.19 309.64 L 459.46 306.61 L 463.28 305.03 L 465.08 305.12 L 466.28 305.62 L 468.46 305.65 L 470.74 306.18 L 471.59 306.64 L 470.3 309.38 L 470.15 310.27 L 470.41 311.76 L 471.02 312.26 L 476.35 313.72 L 476.99 313.55 L 477.8 312.43 L 479.68 311.54 L 481.45 311.28 L 484.18 312.03 L 485.28 312.57 L 489.63 316.21 L 490.61 316.03 L 492.78 317.65 L 495.31 318.87 L 496.24 319.09 L 496.75 318.88 L 498.28 320.12 L 502.67 318.89 L 503.05 319.07 L 509.57 325.27 L 510.01 329.23 L 510.58 329.02 L 513.19 329.47 L 514.66 328.97 L 515.98 327.98 L 517.97 328.13 L 520.7 328.69 L 522.96 329.77 L 525.15 330.38 L 527.27 330.35 L 530.1 332.82 L 530.83 333.2 L 531.72 333.27 L 532.5 334.29 L 532.92 335.46 L 531.45 338.54 L 526.49 342.76 L 526.34 345.41 L 526.9 346.43 L 526.9 346.85 L 525.88 347.56 L 523.4 347.32 L 522.58 348.2 L 521.76 351.5 L 521.23 355.9 L 521.45 356.15 L 521.8 355.96 L 522 355.51 L 522.64 355.27 L 523.22 356.5 L 523 358.01 L 523.15 358.52 L 527.29 361.58 L 527.82 362.62 L 527.83 363.15 L 527.15 364.5 z"},{code:"MS",name:"Mato Grosso do Sul",gTransform:"matrix(1 0 0 1 -2.22 90.13)",pathTransform:"translate(-303.77, -409.4)",d:"M 358.95 399.81 L 358.55 402.27 L 358.27 402.67 L 356.77 403.45 L 355.45 403.49 L 354.98 403.71 L 353.76 404.74 L 351.77 407.42 L 351.04 408.07 L 350.03 408.37 L 349.41 410.05 L 349.25 412.98 L 346.66 416.62 L 345.7 417.14 L 345.47 417.52 L 345.78 419.45 L 345.7 420.4 L 344.49 422.74 L 342.49 425 L 342.84 425.85 L 342.56 427.06 L 341.12 428.09 L 340.72 429.3 L 338.99 430.99 L 337.73 433.43 L 335.78 435.3 L 328.22 439.83 L 326.96 440.97 L 326.22 442.51 L 325.38 443.59 L 325.38 443.59 L 319.97 445.86 L 318.86 446.68 L 317.93 449.01 L 317.95 450.16 L 316.5 453.72 L 315.83 454.4 L 314.17 455.41 L 313.06 455.73 L 312.73 456.08 L 311.16 464 L 310.8 464.82 L 308.42 466.38 L 308.42 466.38 L 305.87 464.05 L 302.46 462.16 L 298.47 464.13 L 297.79 464.88 L 296.13 465.37 L 293.55 465.8 L 291.19 465.34 L 290.18 464.69 L 289.71 460.42 L 289.39 459.72 L 288.49 458.77 L 288.26 456.3 L 288.77 454.96 L 288.13 454.17 L 288.04 453.73 L 288.04 450.86 L 287.15 448.89 L 286.55 446.15 L 286.5 445.43 L 287.09 444.07 L 287.11 442.46 L 285.54 441.37 L 285.16 440.57 L 285 438.41 L 283.35 436.59 L 281.18 436.33 L 279.67 436.64 L 277.84 436.35 L 275.38 434.39 L 274.82 432.9 L 273.28 433.23 L 271.11 435.97 L 270.11 435.37 L 268.39 436.18 L 267.31 436.34 L 265.57 435.65 L 263.01 435.16 L 259.55 435.39 L 255.89 434.68 L 255.41 433.77 L 253.42 433.64 L 252.53 434.16 L 250.03 433.28 L 250.94 426.01 L 250.51 423.63 L 251.11 422.21 L 252.09 420.75 L 252.69 414.72 L 252.03 412.39 L 251.98 410.66 L 251.22 409.7 L 250.79 409.61 L 250.3 410.26 L 249.66 407 L 248.87 405.13 L 247.66 403.11 L 247.31 401.28 L 251.34 398.98 L 252.1 398.1 L 247.9 394.24 L 253.28 382.82 L 254.4 382.76 L 254.12 380.63 L 253.38 380.5 L 256.61 370.17 L 257.27 369.01 L 254.18 363.16 L 254.21 361.25 L 254.21 361.25 L 254.91 361.45 L 255.93 362.55 L 258.08 364.07 L 263.7 362.1 L 265.75 360.1 L 267.77 357.15 L 267.86 355.98 L 269.26 354.53 L 271.85 354.56 L 273.41 354.34 L 274.18 354.68 L 275.84 354.17 L 277.19 352.92 L 279.21 352.43 L 280.48 352.63 L 281.24 353.78 L 284.03 355.03 L 286.65 355.5 L 287.3 355.85 L 287.57 356.71 L 288.35 357.73 L 291.38 358.89 L 292.64 360 L 293.88 360.57 L 298.4 359.94 L 299.66 359.14 L 300.15 358.29 L 301.58 357.68 L 304.02 357.75 L 305.61 358.79 L 305.91 360.16 L 306.15 360.41 L 307.14 360.45 L 309.27 359.57 L 310.28 359.63 L 315.9 353.62 L 317.24 353.49 L 316.01 360.1 L 314.21 360.8 L 312.55 363.63 L 312.36 364.09 L 312.51 364.62 L 313.81 364.73 L 315.55 366 L 320.17 366.27 L 320.74 365.7 L 323.4 365.62 L 324.27 365.7 L 325.44 366.27 L 326.99 365.96 L 326.99 365.96 L 327.18 367.73 L 326.92 370.31 L 327.15 371.42 L 327.43 371.83 L 328.09 372.02 L 329.23 371.35 L 331.48 372.25 L 331.56 372.67 L 330.25 374.43 L 329.68 375.6 L 329.42 376.44 L 329.55 376.77 L 333.35 377.47 L 336.13 377.31 L 338.83 378.99 L 339.97 379.16 L 341.41 379.87 L 342.08 380.48 L 345.15 382.04 L 345.83 382.89 L 349.18 384.23 L 350.67 384.27 L 352.57 384.7 L 354.19 386.25 L 357.34 386.86 L 360 389.1 L 360.24 389.55 L 360.24 389.55 L 359.66 389.8 L 358.67 393.98 L 359.26 397.19 z"},{code:"MT",name:"Mato Grosso",gTransform:"matrix(1 0 0 1 -23.8 -38.15)",pathTransform:"translate(-282.2, -281.12)",d:"M 206.96 296.05 L 208.43 294.62 L 212.54 292.05 L 213.06 289.6 L 214.49 285.82 L 215.42 284.74 L 217.06 284.21 L 217.49 283.8 L 218.07 282.96 L 218.59 280.71 L 220.25 278.7 L 220.81 276.46 L 220.88 274.75 L 220.3 273.26 L 220.34 271.21 L 218.81 267.87 L 217.91 267.9 L 217.33 267.39 L 216.9 264.14 L 217.04 262.82 L 218.4 261.74 L 219.8 259.99 L 219.97 259.24 L 218.56 255.65 L 217.49 255.22 L 216.38 255.11 L 212.88 255.2 L 211.66 254.09 L 211.9 253.53 L 194.74 253.48 L 195.64 244.48 L 194.14 241.73 L 193.87 239.97 L 193.9 239.17 L 194.9 235.65 L 194.52 233.72 L 195.46 232.05 L 194.63 229.78 L 194.48 228.39 L 194.22 227.78 L 193.44 227.31 L 193.38 226.96 L 194.67 221.97 L 195.43 220.55 L 194.83 219.31 L 193.43 218.34 L 193.43 218.34 L 241.28 218.02 L 242.49 217.29 L 243.67 212.07 L 245.05 207.85 L 244.59 205.91 L 243.93 204.54 L 243.83 203.69 L 244.25 202.84 L 245.11 202.2 L 246.31 200.38 L 246.58 199.37 L 246.24 198.53 L 246.3 197.77 L 246.5 197.16 L 247.68 195.96 L 247.68 195.96 L 248.85 197.04 L 251.3 201.1 L 251.7 202.86 L 253.07 206.82 L 254.39 208.75 L 255.16 210.37 L 254.93 212.81 L 255.41 215.21 L 256.14 217.41 L 257.67 218.52 L 260.67 221.27 L 264.05 222.97 L 264.28 223.91 L 264.24 225.01 L 264.47 225.5 L 265.42 225.9 L 266.24 225.73 L 267.87 226.18 L 268.41 226.9 L 268.61 227.98 L 268.96 228.3 L 270.33 227.85 L 274.02 229.34 L 308.06 231.76 L 371.03 235.24 L 371.03 235.24 L 370.38 236.26 L 369.82 238.15 L 368.72 239.4 L 368.28 242.54 L 367.85 243.39 L 367.48 243.66 L 365.54 248.95 L 365 251.92 L 364.96 254.87 L 363.08 260.86 L 363.14 261.72 L 364.53 263.06 L 364.37 263.93 L 363.55 264.82 L 363.5 265.32 L 364.6 267.57 L 364.13 270.88 L 364.14 272.45 L 364.66 273.03 L 365.1 276.08 L 364.36 278.84 L 365.34 282.18 L 366.3 282.69 L 367.1 282.71 L 367.1 282.71 L 367.18 283.34 L 366.91 284.47 L 365.94 285.33 L 365.59 286.23 L 365.75 288.95 L 365.36 290.02 L 363.36 293.19 L 362.33 295.82 L 361.12 296.6 L 361.24 301.78 L 359.64 304.87 L 359.06 307.61 L 359.54 308.75 L 359.55 309.55 L 358.38 312.42 L 357.54 315.35 L 356.15 316.78 L 354.94 317.51 L 353.71 316.83 L 352.64 317.09 L 350.99 318.1 L 349.07 320.04 L 348.69 320.78 L 348.05 324.88 L 347.34 325.84 L 345.36 330.03 L 345.04 330.31 L 342.32 331.17 L 339.67 331.3 L 338.27 333.92 L 336.52 334.89 L 336.44 336.43 L 335.62 337.86 L 334.34 338.9 L 333.84 339.91 L 333.51 341.86 L 332.26 343.88 L 330.34 345.65 L 328.32 346.49 L 327.62 347.26 L 327.24 350.17 L 324.69 354.02 L 324.29 357.43 L 324.45 358.14 L 325.86 360.33 L 326.04 363.76 L 326.99 365.96 L 326.99 365.96 L 325.44 366.27 L 324.27 365.7 L 323.4 365.62 L 320.74 365.7 L 320.17 366.27 L 315.55 366 L 313.81 364.73 L 312.51 364.62 L 312.36 364.09 L 312.55 363.63 L 314.21 360.8 L 316.01 360.1 L 317.24 353.49 L 315.9 353.62 L 310.28 359.63 L 309.27 359.57 L 307.14 360.45 L 306.15 360.41 L 305.91 360.16 L 305.61 358.79 L 304.02 357.75 L 301.58 357.68 L 300.15 358.29 L 299.66 359.14 L 298.4 359.94 L 293.88 360.57 L 292.64 360 L 291.38 358.89 L 288.35 357.73 L 287.57 356.71 L 287.3 355.85 L 286.65 355.5 L 284.03 355.03 L 281.24 353.78 L 280.48 352.63 L 279.21 352.43 L 277.19 352.92 L 275.84 354.17 L 274.18 354.68 L 273.41 354.34 L 271.85 354.56 L 269.26 354.53 L 267.86 355.98 L 267.77 357.15 L 265.75 360.1 L 263.7 362.1 L 258.08 364.07 L 255.93 362.55 L 254.91 361.45 L 254.21 361.25 L 254.21 361.25 L 253.55 360.58 L 253.23 359.78 L 253.77 359.07 L 251.33 356.92 L 250.05 357.55 L 249.53 357.5 L 248.36 356.82 L 247.91 356.12 L 245.89 354.71 L 244 353.95 L 243.7 353.63 L 243.4 352.51 L 243.17 349.58 L 242.56 347.81 L 242.37 344.15 L 243.25 342.51 L 244.39 341.42 L 244.73 339.64 L 244.68 337.75 L 243.72 337.81 L 243.32 338.41 L 242.94 338.57 L 216.08 337.49 L 215.03 324.84 L 209.66 318.71 L 214.54 318.65 L 214.19 311.1 L 211.55 305.78 L 211.06 303.81 L 211.32 302.75 L 211.93 302.2 L 212.58 300.92 L 211.14 297.99 L 208.03 296.95 z"},{code:"PA",name:"Pará",gTransform:"matrix(1 0 0 1 29.16 -180.48)",pathTransform:"translate(-335.15, -138.78)",d:"M 371.03 235.24 L 308.05999999999995 231.76000000000002 L 274.0199999999999 229.34000000000003 L 270.3299999999999 227.85000000000002 L 268.9599999999999 228.3 L 268.6099999999999 227.99 L 268.4099999999999 226.9 L 267.8599999999999 226.18 L 266.2299999999999 225.73000000000002 L 265.4099999999999 225.9 L 264.4599999999999 225.51000000000002 L 264.2299999999999 225.01000000000002 L 264.2699999999999 223.91000000000003 L 264.0399999999999 222.97000000000003 L 260.6599999999999 221.27000000000004 L 257.6599999999999 218.51000000000005 L 256.1199999999999 217.40000000000003 L 255.3999999999999 215.20000000000005 L 254.9199999999999 212.81000000000006 L 255.1499999999999 210.37000000000006 L 254.37999999999988 208.74000000000007 L 253.04999999999987 206.81000000000006 L 251.67999999999986 202.86000000000007 L 251.28999999999988 201.10000000000008 L 248.8399999999999 197.04000000000008 L 247.65999999999988 195.96000000000006 L 247.65999999999988 195.96000000000006 L 247.0899999999999 195.40000000000006 L 246.93999999999988 193.44000000000005 L 246.2999999999999 192.18000000000006 L 244.7099999999999 190.62000000000006 L 243.6399999999999 190.04000000000005 L 243.2699999999999 189.47000000000006 L 242.43999999999988 187.13000000000005 L 242.46999999999989 186.00000000000006 L 243.0499999999999 185.03000000000006 L 244.4999999999999 183.90000000000006 L 245.2799999999999 182.59000000000006 L 275.1799999999999 118.35000000000007 L 273.3699999999999 116.68000000000006 L 273.4999999999999 115.90000000000006 L 273.3099999999999 115.42000000000006 L 271.9199999999999 115.77000000000005 L 271.0699999999999 116.38000000000005 L 269.1999999999999 115.60000000000005 L 268.09999999999985 113.43000000000005 L 265.40999999999985 111.98000000000005 L 264.1399999999999 110.64000000000004 L 264.0599999999999 110.04000000000005 L 262.7399999999999 109.22000000000006 L 261.3699999999999 109.07000000000005 L 259.1199999999999 108.42000000000004 L 256.7399999999999 107.11000000000004 L 254.8599999999999 106.44000000000004 L 253.5099999999999 105.35000000000004 L 252.8799999999999 104.45000000000003 L 248.2999999999999 101.91000000000003 L 243.6599999999999 98.14000000000003 L 243.3599999999999 97.70000000000003 L 243.3199999999999 96.77000000000002 L 242.7699999999999 94.94000000000003 L 240.9299999999999 93.71000000000002 L 240.2299999999999 93.90000000000002 L 239.8699999999999 93.70000000000002 L 238.03999999999988 91.72000000000001 L 238.0899999999999 89.61000000000001 L 238.43999999999988 88.92000000000002 L 238.25999999999988 88.51000000000002 L 236.56999999999988 87.66000000000003 L 236.32999999999987 86.98000000000002 L 236.14999999999986 84.71000000000002 L 236.57999999999987 83.26000000000002 L 236.17999999999986 78.40000000000002 L 236.17999999999986 78.40000000000002 L 234.58999999999986 61.43000000000002 L 234.58999999999986 61.43000000000002 L 235.33999999999986 61.75000000000002 L 235.76999999999987 62.33000000000002 L 235.74999999999986 62.81000000000002 L 236.19999999999985 63.210000000000015 L 237.11999999999983 63.490000000000016 L 238.48999999999984 62.780000000000015 L 238.95999999999984 61.97000000000001 L 241.66999999999985 62.20000000000001 L 242.47999999999985 61.15000000000001 L 241.93999999999986 59.34000000000001 L 243.72999999999985 58.98000000000001 L 245.13999999999984 57.35000000000001 L 247.77999999999983 58.36000000000001 L 249.65999999999983 58.39000000000001 L 250.19999999999982 56.870000000000005 L 253.52999999999983 55.25000000000001 L 255.49999999999983 55.64000000000001 L 256.65999999999985 55.53000000000001 L 257.14999999999986 55.28000000000001 L 258.34999999999985 53.80000000000001 L 258.74999999999983 52.40000000000001 L 260.2099999999998 51.30000000000001 L 261.0699999999998 51.19000000000001 L 261.7199999999998 51.65000000000001 L 263.8299999999998 50.52000000000001 L 264.23999999999984 50.63000000000001 L 264.60999999999984 51.62000000000001 L 265.33999999999986 52.070000000000014 L 267.36999999999983 52.55000000000001 L 268.97999999999985 52.80000000000001 L 269.53999999999985 52.20000000000001 L 271.20999999999987 51.81000000000001 L 271.98999999999984 52.09000000000001 L 272.80999999999983 52.08000000000001 L 273.66999999999985 51.74000000000001 L 275.90999999999985 52.040000000000006 L 280.57999999999987 53.42000000000001 L 281.53999999999985 53.28000000000001 L 282.53999999999985 52.41000000000001 L 282.5099999999999 50.13000000000001 L 280.4399999999999 47.63000000000001 L 279.1999999999999 47.00000000000001 L 279.6899999999999 45.32000000000001 L 280.9999999999999 43.870000000000005 L 281.27999999999986 42.760000000000005 L 281.58999999999986 42.59 L 282.29999999999984 42.78 L 283.1299999999998 43.54 L 285.47999999999985 44.65 L 297.09999999999985 42.32 L 298.66999999999985 44.01 L 299.6899999999998 44.07 L 300.1299999999998 43.78 L 300.1299999999998 43.78 L 300.74999999999983 44.35 L 301.11999999999983 46.65 L 300.49999999999983 47.949999999999996 L 300.24999999999983 52.489999999999995 L 300.48999999999984 53.92999999999999 L 300.79999999999984 54.46999999999999 L 301.96999999999986 54.489999999999995 L 303.04999999999984 54.199999999999996 L 306.4399999999998 54.56999999999999 L 307.72999999999985 55.059999999999995 L 309.65999999999985 56.10999999999999 L 310.32999999999987 56.90999999999999 L 310.8199999999999 58.18999999999999 L 312.0099999999999 58.30999999999999 L 313.14999999999986 59.14999999999999 L 313.9499999999999 60.12999999999999 L 314.78999999999985 60.39999999999999 L 316.11999999999983 60.25999999999999 L 316.49999999999983 59.83999999999999 L 317.4399999999998 59.69999999999999 L 320.2799999999998 62.359999999999985 L 320.9599999999998 62.329999999999984 L 321.4499999999998 63.509999999999984 L 320.7699999999998 63.73999999999998 L 320.5799999999998 64.45999999999998 L 321.3399999999998 67.28999999999998 L 323.3599999999998 69.54999999999998 L 325.9299999999998 70.27999999999999 L 326.0999999999998 70.60999999999999 L 325.6699999999998 73.74999999999999 L 325.8599999999998 75.85999999999999 L 326.5299999999998 77.36999999999999 L 327.1499999999998 77.92999999999999 L 327.7399999999998 79.74 L 327.6099999999998 81.32 L 329.1099999999998 84.8 L 329.9299999999998 84.99 L 330.70999999999975 84.63 L 333.63999999999976 87.91 L 333.5599999999998 90.34 L 333.9699999999998 91.28 L 334.9199999999998 91.47 L 335.2499999999998 91.94 L 335.5599999999998 93.52 L 335.3499999999998 94.21 L 335.4599999999998 95.50999999999999 L 337.3299999999998 96.89999999999999 L 337.7599999999998 98.39999999999999 L 339.2099999999998 99.42999999999999 L 341.99999999999983 100.11 L 343.29999999999984 99.99 L 344.0699999999998 99.64999999999999 L 345.0099999999998 99.71 L 345.0099999999998 99.71 L 344.47999999999985 100.44999999999999 L 344.76999999999987 102.03999999999999 L 344.59999999999985 102.57 L 343.30999999999983 103.67999999999999 L 341.91999999999985 103.85 L 341.41999999999985 103.66999999999999 L 340.57999999999987 102.87999999999998 L 339.91999999999985 102.72999999999998 L 336.53999999999985 104.30999999999997 L 336.16999999999985 104.84999999999998 L 334.5699999999998 105.56999999999998 L 333.9399999999998 105.54999999999998 L 332.3899999999998 106.13999999999999 L 332.42999999999984 106.71999999999998 L 338.8899999999998 105.65999999999998 L 339.7699999999998 106.31999999999998 L 339.8999999999998 106.77999999999997 L 339.8999999999998 107.43999999999997 L 339.2799999999998 107.93999999999997 L 339.5799999999998 108.29999999999997 L 340.2099999999998 108.09999999999997 L 341.0699999999998 107.09999999999997 L 342.0899999999998 107.08999999999996 L 342.6199999999998 106.81999999999996 L 343.2199999999998 106.93999999999997 L 344.2899999999998 106.51999999999997 L 345.4299999999998 105.94999999999997 L 348.70999999999975 103.60999999999997 L 350.20999999999975 103.25999999999998 L 352.0499999999997 102.44999999999997 L 355.20999999999975 100.60999999999997 L 355.7499999999998 99.60999999999997 L 356.4199999999998 99.08999999999997 L 358.50999999999976 98.07999999999997 L 359.1699999999998 97.35999999999997 L 358.9199999999998 96.68999999999997 L 359.12999999999977 96.27999999999997 L 360.25999999999976 95.99999999999997 L 361.34999999999974 96.05999999999997 L 361.75999999999976 96.26999999999997 L 362.13999999999976 100.06999999999996 L 361.6199999999998 102.64999999999996 L 361.94999999999976 104.26999999999997 L 362.75999999999976 105.86999999999996 L 364.06999999999977 107.21999999999996 L 364.3699999999998 108.85999999999996 L 364.2499999999998 109.32999999999996 L 362.4099999999998 111.16999999999996 L 361.93999999999977 111.29999999999995 L 361.06999999999977 110.77999999999996 L 359.2499999999998 110.25999999999996 L 357.9899999999998 109.94999999999996 L 357.0599999999998 110.08999999999996 L 354.9299999999998 109.04999999999995 L 354.6699999999998 107.92999999999995 L 353.7899999999998 107.39999999999995 L 351.5099999999998 111.21999999999994 L 350.8999999999998 113.58999999999995 L 351.5799999999998 116.55999999999995 L 352.05999999999983 117.19999999999995 L 352.97999999999985 117.81999999999995 L 351.96999999999986 116.67999999999995 L 351.53999999999985 113.98999999999995 L 351.65999999999985 113.46999999999996 L 354.22999999999985 109.24999999999996 L 356.53999999999985 110.42999999999996 L 356.64999999999986 110.87999999999997 L 359.17999999999984 113.32999999999997 L 358.92999999999984 115.34999999999997 L 358.1899999999998 115.89999999999996 L 358.5899999999998 118.22999999999996 L 359.1099999999998 119.35999999999996 L 360.2299999999998 120.10999999999996 L 360.9699999999998 120.25999999999996 L 361.4899999999998 120.74999999999996 L 361.1499999999998 120.10999999999996 L 360.3799999999998 119.86999999999996 L 359.17999999999984 118.82999999999996 L 358.9599999999998 118.14999999999995 L 359.2999999999998 113.94999999999995 L 360.1199999999998 112.75999999999995 L 361.5499999999998 113.48999999999995 L 362.37999999999977 114.68999999999996 L 362.2899999999998 115.47999999999996 L 363.4899999999998 116.33999999999996 L 363.7399999999998 116.04999999999995 L 362.7399999999998 114.78999999999995 L 361.81999999999977 112.68999999999996 L 361.81999999999977 112.24999999999996 L 364.07999999999976 109.92999999999996 L 365.69999999999976 110.01999999999997 L 367.62999999999977 110.65999999999997 L 367.96999999999974 111.21999999999997 L 367.35999999999973 111.80999999999997 L 367.6799999999997 112.08999999999997 L 368.15999999999974 112.11999999999998 L 369.1899999999997 111.94999999999997 L 370.5199999999997 111.04999999999997 L 374.6099999999997 110.08999999999997 L 375.37999999999965 110.28999999999998 L 377.11999999999966 111.34999999999998 L 380.2899999999997 110.92999999999998 L 381.3599999999997 110.51999999999998 L 382.37999999999965 109.50999999999998 L 383.3599999999997 108.91999999999997 L 385.0999999999997 108.40999999999997 L 385.86999999999966 108.47999999999996 L 385.92999999999967 109.22999999999996 L 383.88999999999965 113.24999999999996 L 383.64999999999964 114.74999999999996 L 383.18999999999966 115.81999999999995 L 382.3599999999997 116.84999999999995 L 382.3499999999997 117.72999999999995 L 382.92999999999967 119.14999999999995 L 382.6099999999997 121.61999999999995 L 383.48999999999967 120.42999999999995 L 383.49999999999966 119.02999999999994 L 385.0399999999997 116.02999999999994 L 386.1699999999997 112.83999999999995 L 387.2899999999997 111.27999999999994 L 387.55999999999966 111.00999999999995 L 388.31999999999965 110.95999999999995 L 388.89999999999964 110.60999999999996 L 390.71999999999963 110.37999999999995 L 391.5999999999996 109.02999999999996 L 393.1099999999996 107.33999999999996 L 394.46999999999963 105.07999999999996 L 394.9899999999996 104.61999999999996 L 395.77999999999963 105.10999999999996 L 396.39999999999964 104.64999999999996 L 398.01999999999964 106.98999999999997 L 399.20999999999964 107.57999999999997 L 399.1599999999996 106.83999999999997 L 398.8099999999996 106.08999999999997 L 399.4299999999996 105.07999999999997 L 402.9399999999996 104.56999999999996 L 401.9099999999996 104.24999999999997 L 398.39999999999964 104.70999999999997 L 398.08999999999963 104.49999999999997 L 398.37999999999965 102.06999999999996 L 398.88999999999965 101.77999999999996 L 399.55999999999966 102.15999999999995 L 400.57999999999964 102.26999999999995 L 401.64999999999964 99.16999999999996 L 400.96999999999963 97.77999999999996 L 400.9999999999996 97.09999999999995 L 402.1699999999996 95.28999999999995 L 405.0099999999996 92.80999999999995 L 405.3699999999996 92.72999999999995 L 406.4799999999996 93.86999999999995 L 409.4099999999996 91.77999999999994 L 409.8699999999996 91.70999999999995 L 410.2699999999996 92.15999999999995 L 410.3699999999996 92.72999999999995 L 410.0499999999996 93.39999999999995 L 411.1199999999996 93.23999999999995 L 411.9299999999996 92.65999999999995 L 412.2899999999996 91.87999999999995 L 412.9199999999996 91.68999999999996 L 413.1999999999996 91.83999999999996 L 413.9399999999996 93.22999999999996 L 415.2699999999996 94.42999999999996 L 415.4699999999996 93.86999999999996 L 415.35999999999956 93.48999999999997 L 414.4 93 L 414.26 92.71 L 414.13 91.50999999999999 L 414.3 91.08999999999999 L 414.74 90.89999999999999 L 417.02 91.16 L 418.2 91.81 L 418.82 92.83 L 420.45 93.53999999999999 L 422.09999999999997 92.75999999999999 L 422.62999999999994 94.89999999999999 L 422.12999999999994 95.21 L 422.09999999999997 95.8 L 423.02 95.28 L 424.18 92.93 L 424.56 93.16000000000001 L 424.33 94.49000000000001 L 424.74 94.93 L 427.25 94.67 L 427.7 95.32000000000001 L 428.15999999999997 97.00000000000001 L 427.55999999999995 97.95000000000002 L 428.40999999999997 97.45000000000002 L 428.66999999999996 97.82000000000002 L 430.55999999999995 97.96000000000002 L 434.0899999999999 96.72000000000003 L 433.7799999999999 98.30000000000003 L 433.0299999999999 100.13000000000002 L 434.49999999999994 99.64000000000003 L 435.0899999999999 99.02000000000002 L 435.7199999999999 100.64000000000003 L 435.7199999999999 100.64000000000003 L 434.94999999999993 101.09000000000003 L 434.4799999999999 102.12000000000003 L 434.63999999999993 103.50000000000003 L 433.92999999999995 107.89000000000003 L 433.35999999999996 108.63000000000002 L 432.21999999999997 108.78000000000003 L 432.16999999999996 109.40000000000003 L 432.43999999999994 109.89000000000003 L 433.42999999999995 109.73000000000003 L 433.85999999999996 110.26000000000003 L 433.78 111.87000000000003 L 432.88 114.89000000000003 L 432.52 115.60000000000002 L 430.78 117.17000000000002 L 430.28 119.55000000000001 L 430.40999999999997 121.19000000000001 L 426.72999999999996 124.28000000000002 L 427.77 125.86000000000001 L 426.97999999999996 126.67000000000002 L 427.15999999999997 128.49 L 426.7 129.77 L 425.87 131.22 L 424.39 132.98 L 422.43 134.51999999999998 L 420.83 139.20999999999998 L 420.53999999999996 141.10999999999999 L 420.06999999999994 142.32 L 417.62999999999994 144.64 L 416.50999999999993 145.1 L 415.88999999999993 147.98 L 414.3399999999999 149.14999999999998 L 413.9099999999999 150.29999999999998 L 412.3599999999999 152.46999999999997 L 411.1899999999999 153.38999999999996 L 408.83999999999986 153.15999999999997 L 394.1299999999999 164.98999999999998 L 394.6199999999999 165.07 L 394.6199999999999 165.07 L 396.9099999999999 165.88 L 398.7799999999999 165.64 L 400.06999999999994 165.76 L 401.0899999999999 167.42 L 401.4799999999999 167.73 L 402.3499999999999 167.86999999999998 L 403.6099999999999 169.03999999999996 L 403.5699999999999 169.66999999999996 L 403.1999999999999 170.33999999999995 L 402.47999999999985 170.70999999999995 L 401.5099999999998 170.77999999999994 L 401.2199999999998 171.05999999999995 L 401.3099999999998 172.46999999999994 L 402.31999999999977 173.80999999999995 L 401.39999999999975 176.55999999999995 L 400.75999999999976 177.03999999999994 L 399.2999999999998 177.49999999999994 L 399.0499999999998 177.95999999999995 L 399.3399999999998 179.15999999999994 L 399.1499999999998 180.49999999999994 L 397.8499999999998 180.64999999999995 L 396.3399999999998 181.98999999999995 L 395.4899999999998 183.25999999999996 L 395.63999999999976 184.76999999999995 L 395.39999999999975 185.26999999999995 L 392.89999999999975 186.46999999999994 L 389.4899999999997 187.60999999999993 L 387.0199999999997 189.38999999999993 L 386.8299999999997 189.73999999999992 L 387.2599999999997 191.92999999999992 L 387.3199999999997 194.5999999999999 L 386.03999999999974 196.6999999999999 L 384.6299999999997 198.3799999999999 L 384.47999999999973 198.9499999999999 L 384.64999999999975 199.8299999999999 L 385.2399999999997 200.7899999999999 L 386.90999999999974 202.52999999999992 L 387.65999999999974 202.8499999999999 L 387.8099999999997 203.14999999999992 L 387.1499999999997 207.1899999999999 L 385.3899999999997 212.33999999999992 L 384.3099999999997 213.14999999999992 L 382.60999999999973 216.38999999999993 L 382.4299999999997 217.37999999999994 L 381.4899999999997 218.91999999999993 L 380.7499999999997 219.76999999999992 L 379.6999999999997 219.92999999999992 L 378.3299999999997 220.8499999999999 L 377.2999999999997 222.7699999999999 L 376.08999999999975 224.4499999999999 L 374.90999999999974 225.5399999999999 L 373.75999999999976 227.11999999999992 L 372.62999999999977 231.57999999999993 L 371.03 235.24 z M 392.19 104.93 L 387.67 106.89 L 384.28000000000003 107.41 L 382.26000000000005 107.1 L 381.61000000000007 108.22999999999999 L 379.7700000000001 109.41999999999999 L 379.05000000000007 108.80999999999999 L 378.44000000000005 107.27999999999999 L 378.21000000000004 107.55999999999999 L 378.63000000000005 108.78999999999999 L 378.2900000000001 109.6 L 377.5800000000001 110.00999999999999 L 373.8100000000001 108.36999999999999 L 373.0100000000001 109.08999999999999 L 368.8200000000001 110.35 L 365.6200000000001 109.78 L 364.8100000000001 109.17 L 364.5700000000001 107.32000000000001 L 364.3400000000001 106.91000000000001 L 363.2300000000001 105.89000000000001 L 362.1700000000001 104.29000000000002 L 361.9600000000001 102.51000000000002 L 362.4800000000001 99.76000000000002 L 363.1000000000001 99.38000000000002 L 364.86000000000007 99.74000000000002 L 365.7900000000001 98.99000000000002 L 365.87000000000006 98.43000000000002 L 364.57000000000005 98.86000000000003 L 363.35 98.73000000000003 L 362.41 98.02000000000004 L 362.23 96.97000000000004 L 362.57 91.89000000000004 L 363.3 91.13000000000004 L 363.65000000000003 91.88000000000004 L 365.41 92.48000000000003 L 365.96000000000004 92.42000000000003 L 365.50000000000006 92.00000000000003 L 364.2300000000001 91.78000000000003 L 363.3300000000001 89.62000000000003 L 363.6900000000001 87.94000000000003 L 364.5800000000001 85.97000000000003 L 365.9100000000001 84.64000000000003 L 366.87000000000006 84.07000000000004 L 368.21000000000004 83.58000000000004 L 369.53000000000003 83.45000000000005 L 372.99 83.97000000000004 L 380.2 85.74000000000004 L 383.9 85.28000000000004 L 384.01 84.98000000000005 L 385.15 84.36000000000004 L 387.31 83.99000000000004 L 390.2 84.28000000000004 L 393 85.10000000000004 L 399.48 85.95000000000003 L 400.11 86.42000000000003 L 400.06 87.65000000000003 L 399.36 88.39000000000003 L 398.68 89.89000000000003 L 398.32 92.54000000000003 L 397.46 95.84000000000003 L 396.16999999999996 96.52000000000004 L 395.81999999999994 97.21000000000004 L 396.04999999999995 98.40000000000003 L 394.06999999999994 100.98000000000003 L 392.67999999999995 104.48000000000003 L 392.19 104.93 z M 344.98 104.76 L 344.23 104.25 L 345.33000000000004 102 L 345.24000000000007 100.21 L 345.49000000000007 100 L 347.82000000000005 99.52 L 348.72 98.66 L 348.87 98.16 L 348.67 95.82 L 349.53000000000003 93.24 L 350.79 91.75 L 353.08000000000004 90.28 L 355.95000000000005 90.08 L 356.6700000000001 92.44 L 355.57000000000005 94.63 L 354.72 97.67 L 353.62 98.34 L 352.28000000000003 100.37 L 351.50000000000006 101.09 L 346.56000000000006 104.4 L 344.98 104.76 z M 373.46 81.86 L 372.43 81.61 L 369.98 81.69 L 369.19 81.53 L 368.9 81.27 L 368.52 80.17999999999999 L 368.53 78.94 L 370.03999999999996 78.52 L 371.92999999999995 78.56 L 374.11999999999995 77.27 L 378.92999999999995 76.67 L 379.69999999999993 76.93 L 380.37999999999994 77.61000000000001 L 380.19999999999993 78.63000000000001 L 377.63999999999993 80.02000000000001 L 375.85999999999996 82.50000000000001 L 374.76 83 L 373.46 81.86 z M 378.25 81.86 L 380.11 80.66 L 382.09000000000003 80.69 L 383.74 81.31 L 384.27 82.3 L 384.32 82.92 L 383.44 83.69 L 380.59 83.97 L 379.41999999999996 84.28999999999999 L 377.15999999999997 83.39999999999999 L 376.96 82.86999999999999 L 378.25 81.86 z M 361.27 86.25 L 360.77 85.99 L 360.15999999999997 86.03 L 358.61999999999995 85.34 L 358.8299999999999 84.18 L 359.4699999999999 83.26 L 361.38999999999993 82.86 L 363.74999999999994 81.96 L 365.06999999999994 82.03999999999999 L 365.86999999999995 82.72 L 365.9599999999999 82.85 L 364.0299999999999 84.46 L 362.9599999999999 84.8 L 361.27 86.25 z M 370.69 76.56 L 369.87 76.26 L 369.7 74.60000000000001 L 369.84999999999997 74.00000000000001 L 371.02 72.69000000000001 L 373.46999999999997 71.77000000000001 L 373.71999999999997 71.89000000000001 L 374.24999999999994 72.57000000000002 L 374.28999999999996 73.46000000000002 L 372.34 75.45000000000002 L 370.69 76.56 z M 356.86 96.78 L 356.72 96.37 L 356.91 95.44 L 357.95000000000005 92.63 L 360.54 90.94 L 361.26000000000005 90.66 L 361.95000000000005 90.8 L 361.79 92.59 L 360.23 93.03 L 358.61 95.22 L 356.86 96.78 z M 367.77 79.21 L 366.58 78.89999999999999 L 366.28 78.41999999999999 L 367.15999999999997 77.46 L 367.86999999999995 73.50999999999999 L 368.75999999999993 72.27999999999999 L 369.04999999999995 72.40999999999998 L 369.11999999999995 72.72999999999998 L 369.09999999999997 75.20999999999998 L 369.7 77.07999999999998 L 369.38 77.95999999999998 L 368.35 78.35999999999999 L 367.77 79.21 z M 352.96 89.4 L 352.69 89.21000000000001 L 352.81 88.60000000000001 L 353.36 88.24000000000001 L 354.55 86.53000000000002 L 355.31 84.99000000000001 L 356.04 84.33000000000001 L 357.49 83.79 L 357.29 85.28 L 356.89000000000004 86.28 L 355.17 87.94 L 352.96 89.4 z M 366.83 82.37 L 366.22999999999996 82.22 L 365.39 81.51 L 364.43 79.87 L 364.38 79.49000000000001 L 364.61 79.2 L 365.42 78.62 L 367.27000000000004 79.46000000000001 L 367.56000000000006 79.89000000000001 L 367.80000000000007 81.98000000000002 L 366.83 82.37 z M 361.45 112.93 L 360.8 112.82000000000001 L 359.92 112.30000000000001 L 359.23 112.76 L 358.48 112.48 L 356.8 110.74000000000001 L 356.8 110.13000000000001 L 358.08 110.12 L 361.14 111.44 L 361.45 112.93 z M 340.3 107.39 L 340.34000000000003 106.36 L 340.14000000000004 106.06 L 340.74000000000007 105.07000000000001 L 343.1000000000001 104.19000000000001 L 343.88000000000005 104.57000000000001 L 344.75000000000006 105.43 L 344.46000000000004 105.78 L 343.43000000000006 106.25 L 340.89000000000004 106.66 L 340.3 107.39 z M 353 100.7 L 352.82 100.67 L 352.83 100.32000000000001 L 353.37 99.38000000000001 L 355.16 97.76 L 355.58000000000004 96.52000000000001 L 355.63000000000005 95.22000000000001 L 355.87000000000006 94.92000000000002 L 356.19000000000005 95.36000000000001 L 356.19000000000005 96.87000000000002 L 355.30000000000007 99.60000000000002 L 354.68000000000006 100.25000000000003 L 353 100.7 z M 359.3 90.8 L 360.95 87.84 L 361.83 87.63000000000001 L 362.53999999999996 87.82000000000001 L 362.80999999999995 88.69000000000001 L 362.22999999999996 89.4 L 359.3 90.8 z M 390.72 109.77 L 389.88000000000005 109.42 L 389.5400000000001 108.36 L 390.5800000000001 106.64 L 391.6500000000001 106.31 L 391.8400000000001 106.41 L 391.8200000000001 107.14999999999999 L 391.0800000000001 109.38999999999999 L 390.72 109.77 z M 357.24 90.3 L 356.7 90.1 L 357.02 88.05999999999999 L 358.34999999999997 86.24999999999999 L 358.58 86.28999999999999 L 359.87 87.16999999999999 L 359.86 87.41999999999999 L 358.31 88.05999999999999 L 357.24 90.3 z M 359.47 95.33 L 360.19000000000005 95.36 L 359.7900000000001 95.81 L 358.8500000000001 96.12 L 358.74000000000007 97.24000000000001 L 357.95000000000005 97.95 L 356.26000000000005 98.79 L 356.1 98.61 L 356.37 97.78 L 356.84000000000003 97.15 L 358.57000000000005 95.48 L 359.47 95.33 z M 336.91 105.54 L 336.36 105.35000000000001 L 336.29 105.00000000000001 L 336.72 104.60000000000001 L 340.28000000000003 103.00000000000001 L 340.82000000000005 103.70000000000002 L 340.81000000000006 103.90000000000002 L 339.4100000000001 104.63000000000002 L 336.91 105.54 z M 400.44 100.76 L 399.41 100.57000000000001 L 398.59000000000003 99.78 L 399.46000000000004 98.53 L 400.8 98.52 L 400.99 99.71 L 400.89 100.3 L 400.44 100.76 z M 363.19 81.86 L 360.83 82.56 L 360.24 82.57000000000001 L 360.06 82.36000000000001 L 361.09 81.32000000000001 L 362.13 80.81 L 363.17 80.98 L 363.61 81.32000000000001 L 363.76 81.55000000000001 L 363.61 81.76 L 363.19 81.86 z M 357.92 90.45 L 357.84000000000003 89.69 L 358.09000000000003 89.19 L 360.57000000000005 87.73 L 359.6700000000001 89.73 L 358.86000000000007 90.36 L 357.92 90.45 z M 360.06 94.98 L 359.61 94.86 L 359.54 94.63 L 360.32 93.13 L 361.51 93.14999999999999 L 361.39 94.49999999999999 L 360.06 94.98 z M 388.1 110.81 L 387.82000000000005 110.58 L 388.72 108.98 L 389.40000000000003 108.58 L 389.63000000000005 109.33 L 390.14000000000004 109.7 L 389.88000000000005 110.22 L 389.45000000000005 110.56 L 388.82000000000005 110.38 L 388.1 110.81 z M 361.44 87.49 L 360.55 87.42 L 360.57 87.23 L 362.93 85.39 L 362.97 86.35 L 362.74 86.97999999999999 L 362.49 87.32 L 361.44 87.49 z M 428.9 97.71 L 428.52 97.17999999999999 L 428.71 96.41999999999999 L 429.72999999999996 95.50999999999999 L 429.97999999999996 95.66 L 430.21 97.41 L 428.9 97.71 z"},{code:"PB",name:"Paraíba",gTransform:"matrix(1 0 0 1 275.13 -126.21)",pathTransform:"translate(-581.13, -193.05)",d:"M 610.43 199.15 L 607.93 197.09 L 607.11 196.83 L 604.46 196.62 L 602.15 197.69 L 600.67 198.97 L 600.22 200.77 L 598.32 201.8 L 596.31 202.25 L 595.17 202.23 L 595.17 202.83 L 594.37 203.36 L 592.19 203.65 L 588.31 203.39 L 586.7 204.27 L 586.15 204.91 L 584.33 205.01 L 583.44 205.7 L 582.9 206.46 L 583.29 207.19 L 583.3 207.73 L 582.9 208.21 L 581.12 209.74 L 579.78 209.9 L 578.13 210.74 L 576.53 209.95 L 575.58 209.01 L 575.23 206.77 L 575.47 206.28 L 575.29 205.98 L 574.15 205.66 L 573.71 205.95 L 572.2 206.2 L 572.24 205.75 L 574.77 203.11 L 574.94 202.68 L 574.22 200.81 L 574.18 200.34 L 574.55 199.56 L 577.55 198.49 L 577.66 198.19 L 577.16 196.8 L 573.66 194.88 L 572.18 195.29 L 569.96 196.55 L 569.03 198.06 L 567.55 198.93 L 566.5 199.24 L 563.8 201.12 L 562.28 202.76 L 560.65 202.99 L 558.02 203.96 L 557.25 203.63 L 557.3 202.95 L 556.67 201.71 L 556.29 201.63 L 555.36 202.36 L 553.85 202.68 L 552.86 202.35 L 551.46 200.44 L 551.06 200.35 L 551.06 200.35 L 550.89 200.1 L 552.08 198.98 L 553.69 195.49 L 553.35 194.3 L 552.66 194.22 L 551.42 193.33 L 551.44 191.67 L 551.09 190.95 L 550.51 190.66 L 550.27 190.25 L 550.39 189.32 L 550.56 188.94 L 551.65 188.31 L 552.31 187 L 551.79 185.69 L 552.82 182.69 L 553.66 181.54 L 553.74 181 L 553.74 181 L 554.31 180.54 L 556.24 182.18 L 557.14 182.6 L 560.02 183.21 L 561.18 182.08 L 564.41 180.42 L 565.23 179.71 L 565.33 178.67 L 565.74 177.72 L 568.92 176.51 L 570.35 176.39 L 573.61 175.35 L 574.25 175.43 L 574.78 175.87 L 574.79 177.06 L 571.8 180.27 L 571.36 181.23 L 570.98 182.97 L 570.57 183.35 L 569.72 183.6 L 569.51 183.91 L 569.43 185.63 L 572.96 186.15 L 573.28 186.38 L 573.59 187.76 L 573.88 187.99 L 577.03 186.73 L 578.8 186.65 L 580.75 186.95 L 581.64 188.12 L 581.12 189.66 L 581.95 190.4 L 584.3 189.47 L 584.8 188.73 L 585.35 187.52 L 584.88 186.58 L 584.72 185.16 L 585.2 184.57 L 586.21 184.89 L 585.68 183.36 L 584.96 182.58 L 585.27 181.1 L 587.09 179.75 L 588.47 179.7 L 588.89 180.09 L 588.79 181.09 L 589.41 181.58 L 592.83 181.98 L 593.36 182.33 L 599.19 181.94 L 601.36 182.24 L 603.82 183.34 L 604.86 182.94 L 608.36 183.15 L 609.29 182.91 L 609.29 182.91 L 609.38 185.31 L 610.83 189.7 L 610.89 190.34 L 610.71 191.28 L 610.34 191.73 L 610.31 192.61 L 610.89 191.87 L 611.4 190.37 L 611.41 192.35 L 612 193.36 L 611.73 198.54 L 611.37 199.14 z"},{code:"PE",name:"Pernambuco",gTransform:"matrix(1 0 0 1 254.6 -106.99)",pathTransform:"translate(-560.6, -212.26)",d:"M 558.28 227.19 L 557.06 224.15 L 557.05 223.21 L 554.94 222.35 L 554.44 221.98 L 553.99 221.15 L 554.6 220.26 L 554.58 219.64 L 554.13 219.32 L 553.13 219.33 L 552.7 219.77 L 552.41 221.51 L 551.98 221.66 L 551.59 221.4 L 551.05 219.75 L 549.47 218.6 L 546.48 218.2 L 544.12 217.43 L 542.77 216.62 L 541.94 215.18 L 540.45 214.62 L 539.86 214.73 L 537.33 216.19 L 535.68 216.63 L 534.91 218.68 L 532.68 219.13 L 532.39 219.38 L 532.64 220.74 L 532.47 221.33 L 531.37 222.57 L 528.98 223.6 L 528.34 223.54 L 527.57 223.01 L 526.81 223.18 L 526.31 224.05 L 525.54 227.62 L 522.67 228.5 L 521.85 229.42 L 520.89 229.65 L 519.05 229.03 L 519.97 227.35 L 519.71 225.35 L 517.5 224.44 L 516.78 222.5 L 516.84 219.77 L 516.4 219.26 L 513.59 217.88 L 511.39 217.59 L 510.23 217.85 L 509.33 217.45 L 509.33 217.45 L 511.95 216.18 L 513.92 214.47 L 514.46 213.6 L 516.75 212.27 L 517.72 211.99 L 521.61 208.12 L 522.35 206.36 L 522.41 204.09 L 522.12 203.55 L 520.5 201.97 L 520.57 199.78 L 519.97 198.65 L 519.91 197.7 L 520.02 197.25 L 520.54 196.92 L 522.33 196.76 L 522.33 196.76 L 527.26 196.96 L 528.15 197.2 L 529.78 197.01 L 531.92 196.21 L 533.21 196.11 L 536.29 196.53 L 539.14 198.43 L 540.97 199.26 L 541.43 200.25 L 542.44 201.32 L 543.8 201.8 L 544.58 202.37 L 545.21 204.01 L 546.86 203.96 L 548.4 201.67 L 549.47 200.84 L 551.06 200.35 L 551.06 200.35 L 551.46 200.44 L 552.86 202.35 L 553.85 202.68 L 555.36 202.36 L 556.29 201.63 L 556.67 201.71 L 557.3 202.95 L 557.25 203.63 L 558.02 203.96 L 560.65 202.99 L 562.28 202.76 L 563.8 201.12 L 566.5 199.24 L 567.55 198.93 L 569.03 198.06 L 569.96 196.55 L 572.18 195.29 L 573.66 194.88 L 577.16 196.8 L 577.66 198.19 L 577.55 198.49 L 574.55 199.56 L 574.18 200.34 L 574.22 200.81 L 574.94 202.68 L 574.77 203.11 L 572.24 205.75 L 572.2 206.2 L 573.71 205.95 L 574.15 205.66 L 575.29 205.98 L 575.47 206.28 L 575.23 206.77 L 575.58 209.01 L 576.53 209.95 L 578.13 210.74 L 579.78 209.9 L 581.12 209.74 L 582.9 208.21 L 583.3 207.73 L 583.29 207.19 L 582.9 206.46 L 583.44 205.7 L 584.33 205.01 L 586.15 204.91 L 586.7 204.27 L 588.31 203.39 L 592.19 203.65 L 594.37 203.36 L 595.17 202.83 L 595.17 202.23 L 596.31 202.25 L 598.32 201.8 L 600.22 200.77 L 600.67 198.97 L 602.15 197.69 L 604.46 196.62 L 607.11 196.83 L 607.93 197.09 L 610.43 199.15 L 610.43 199.15 L 611.31 199.38 L 611.86 200.6 L 610.59 202.32 L 610.48 202.87 L 610.49 203.35 L 611.19 203.72 L 611.46 204.22 L 611.65 205.28 L 609.69 211.66 L 606.44 220.61 L 606.44 220.61 L 606.17 220.4 L 603.27 220.13 L 601.35 219.32 L 599.88 219.51 L 597.32 220.8 L 595.08 219.95 L 593.08 220.19 L 591.53 221.43 L 591.41 221.88 L 589.23 224.17 L 587.42 225.28 L 586.26 225.23 L 584.4 226.29 L 583.23 226.4 L 580.09 226.11 L 577.59 226.76 L 575.68 226.28 L 573.9 225.23 L 572 223.11 L 569.45 221.09 L 568.37 221.21 L 566.7 220.91 L 565.7 219.69 L 564.88 220.29 L 564.79 220.98 L 562.41 224.27 L 560.24 225.03 L 559.6 226.12 z"},{code:"PI",name:"Piauí",gTransform:"matrix(1 0 0 1 174.84 -130.97)",pathTransform:"translate(-480.85, -188.29)",d:"M 505.7 126.91 L 507.01 127.03 L 507.7 126.8 L 509.94 127.31 L 510.93 128.16 L 511.25 128.76 L 511.25 128.76 L 511.14 129.56 L 510.05 131.41 L 508.47 133.38 L 508.29 134.84 L 508.58 136.13 L 510.38 140.85 L 513.53 147.27 L 513.97 149 L 515.33 150.59 L 515.31 151.35 L 514.57 152.71 L 515.36 156.58 L 514.88 158.18 L 515.88 160.19 L 516.48 163.18 L 515.89 164.76 L 515.09 165.34 L 516.01 166.03 L 516.12 166.41 L 517.06 174.57 L 516.82 175.02 L 517.58 177.59 L 518.63 182.79 L 519.64 185.46 L 520.95 186.11 L 523.51 186.58 L 524.28 187.74 L 524.27 188.43 L 522.77 190.68 L 521.63 193.79 L 521.71 194.76 L 522.39 195.44 L 522.33 196.76 L 522.33 196.76 L 520.54 196.92 L 520.02 197.25 L 519.91 197.7 L 519.97 198.65 L 520.57 199.78 L 520.5 201.97 L 522.12 203.55 L 522.41 204.09 L 522.35 206.36 L 521.61 208.12 L 517.72 211.99 L 516.75 212.27 L 514.46 213.6 L 513.92 214.47 L 511.95 216.18 L 509.33 217.45 L 509.33 217.45 L 508.88 218.61 L 507.38 220.91 L 506.33 221.58 L 505.54 221.4 L 503.54 221.78 L 503.65 224.18 L 501.79 225.98 L 501.47 225.93 L 500.85 225.31 L 498.69 225.3 L 497.87 226.28 L 497.1 226.64 L 494.37 226.98 L 492.86 228.32 L 492.04 229.54 L 490.34 229.64 L 488.86 230.28 L 485.86 230.39 L 485.04 230.11 L 484.85 229.83 L 484.98 229.17 L 483.27 228.19 L 481.94 227.8 L 480.55 228.35 L 478.42 228.78 L 478.1 228.6 L 477.69 227.67 L 476.19 227.21 L 474.24 227.23 L 471 228.88 L 470.94 229.81 L 473.18 234.25 L 473.3 235.4 L 473.01 237.97 L 472.76 238.88 L 472.04 239.74 L 469.09 244.79 L 466.12 247.21 L 464.77 247.63 L 463.29 247.1 L 461.95 246.93 L 459.75 247.68 L 458.58 248.57 L 457.91 249.44 L 456.77 249.82 L 456.02 251.27 L 455.69 251.48 L 453.58 251.3 L 451.78 251.82 L 447.6 249.97 L 445.83 247.48 L 445.3 245.27 L 444.64 244.23 L 443.2 242.89 L 440.87 242.91 L 440.87 242.91 L 437.93 242.7 L 437.93 242.7 L 437.98 240.78 L 438.24 239.72 L 439.39 237.27 L 439.52 230.91 L 440.28 229.51 L 440.31 229 L 438.58 225.94 L 438.11 222.75 L 437.41 220.81 L 438.14 218.81 L 439.84 217.41 L 441.04 214.93 L 441.17 213.42 L 441.51 212.59 L 441.81 212.38 L 443.25 209.64 L 443.88 207.32 L 444.27 204.35 L 445.25 201.37 L 447.38 199.42 L 450.1 198.66 L 452.71 198.35 L 453.78 197.98 L 455.48 196.45 L 456.53 196.41 L 457.87 195.89 L 460.73 193.32 L 463.07 192.41 L 465.08 190.41 L 465.71 189.54 L 465.71 189.08 L 467.61 187.16 L 468.11 186.94 L 468.95 186.7 L 469.18 187 L 470.3 186.74 L 471.3 186.14 L 472.76 185.95 L 473.77 186.16 L 476.28 187.98 L 477.79 187.88 L 480.23 187.02 L 481.06 186.98 L 481.71 187.26 L 483.99 186.97 L 485.2 185.66 L 485.7 184.2 L 485.82 182.99 L 486.11 182.55 L 486.5 180.35 L 486.37 179.5 L 486.2 179 L 484.59 178.09 L 482.81 176.06 L 482.3 173.76 L 482.19 171.65 L 482.36 169.17 L 486.46 164.74 L 486.67 164.19 L 486.77 161.76 L 486.22 158.78 L 484.64 155.98 L 485.78 153.11 L 486.06 151.64 L 485.68 150.37 L 484.45 149.53 L 484.1 147.61 L 484.87 146.56 L 485.51 146.39 L 486.33 144.41 L 488.22 142.56 L 489.1 140.73 L 489.06 138.94 L 491.98 135.53 L 492.79 135.69 L 496.1 135.23 L 500.23 131.26 L 502.02 128.99 L 502.41 127.46 L 501.77 126.93 L 501.55 126.21 L 502.01 124.77 L 502.01 124.77 L 502.74 124.89 L 504.21 125.76 L 504.72 126.27 L 504.59 126.58 z"},{code:"PR",name:"Paraná",gTransform:"matrix(1 0 0 1 47.59 157)",pathTransform:"translate(-353.59, -476.27)",d:"M 396.75 499.4 L 391.51 499.37 L 391.18 499.81 L 389.44 500.05 L 388.68 499.98 L 388.57 499.59 L 387 500.16 L 385.65 501.59 L 382.3 503.72 L 380.86 503.56 L 379.63 502.94 L 376.5 500.34 L 375.47 499.95 L 374.71 499.94 L 371.87 500.67 L 369.54 500.84 L 368.73 500.81 L 367.31 500.05 L 366.2 500.19 L 364.67 500.84 L 364.08 502.31 L 363.35 503.18 L 361.48 504.16 L 357.91 503.75 L 355.91 504.9 L 355.19 505.67 L 354.5 507.26 L 355.35 510.25 L 354.48 511.11 L 353.56 511.13 L 352.81 511.51 L 352.64 512 L 351.31 510.11 L 347.06 510.24 L 343.3 509.81 L 341.72 508.63 L 341.56 508.22 L 340.53 507.59 L 336.27 507.23 L 330.98 505.55 L 328.64 506.12 L 325.95 506.09 L 323.93 504.68 L 323.61 504.17 L 322.55 503.93 L 322.02 503.92 L 321.31 504.29 L 317.68 504.27 L 317.68 504.27 L 317.46 503.06 L 314.93 498.88 L 314.95 496.29 L 313.96 493.41 L 310.54 491.04 L 309.45 492.17 L 307.33 492.06 L 306.23 492.49 L 305.16 493.39 L 303.7 492.31 L 302.88 492.37 L 302.6 490.17 L 303.26 488.6 L 304.33 487.33 L 305.55 485.15 L 305.61 484.81 L 305.12 484.06 L 305.14 482.82 L 306.04 479.18 L 307.3 476.16 L 307.05 473.86 L 308.33 471.48 L 308.12 470.46 L 307.28 469.58 L 306.97 467.98 L 307.63 466.92 L 308.42 466.38 L 308.42 466.38 L 310.8 464.82 L 311.16 464 L 312.73 456.08 L 313.06 455.73 L 314.17 455.41 L 315.83 454.4 L 316.5 453.72 L 317.95 450.16 L 317.93 449.01 L 318.86 446.68 L 319.97 445.86 L 325.38 443.59 L 325.38 443.59 L 328.64 441.3 L 332.47 441.95 L 336.48 441.84 L 339.75 442.13 L 340.96 441.51 L 341.31 440.91 L 342.04 440.54 L 343.21 440.83 L 344.69 441.61 L 347.21 442.07 L 349.85 443.16 L 351.16 443.29 L 352.23 442.75 L 354.81 442.74 L 355.59 443.74 L 357.34 444.58 L 360.85 445.38 L 361.48 445.89 L 362.19 447.21 L 363.92 447.28 L 364.34 446.94 L 365.99 447.09 L 366.65 447.63 L 371.96 447.76 L 374.93 446.91 L 376.06 448.46 L 379.65 451.29 L 380.54 453.05 L 380.55 455.79 L 380.16 456.37 L 380 457.18 L 380.38 459.02 L 381.68 460.53 L 381.6 462.29 L 381.24 462.85 L 382.73 465.85 L 383.94 467 L 384.61 467.28 L 385.11 467.96 L 385.06 468.85 L 385.98 470.82 L 386.58 471.11 L 386.83 471.55 L 386.58 472.6 L 385.31 474.73 L 385.63 476.77 L 386.23 477.15 L 387.24 477.36 L 389.62 477.24 L 393.04 476.71 L 393.54 477.1 L 395.12 476.91 L 396.71 477.04 L 398.32 478.3 L 398.18 478.71 L 397.29 479.36 L 396.6 482.66 L 396.95 483.44 L 398.02 483.97 L 398.67 483.12 L 399.77 480.36 L 400.53 480.19 L 402.67 480.77 L 402.27 482.72 L 403 486.02 L 404.42 486.6 L 404.58 487.92 L 404.58 487.92 L 403.23 488.94 L 402.62 490.42 L 402.07 490.3 L 402.34 488.36 L 403.78 487.41 L 402.37 487.69 L 401.48 488.18 L 400.61 488.16 L 400.27 487.77 L 399.7 487.6 L 399.16 487.97 L 398.88 488.9 L 399.4 489.7 L 398.67 490.66 L 398.37 490.76 L 395.89 490.23 L 395.1 489.69 L 394.65 489.81 L 394.47 490.71 L 394.81 491.08 L 396.42 491.64 L 397.82 491.39 L 399.95 491.99 L 400.22 492.47 L 399.25 493.15 L 397.71 495.93 L 396.47 496.7 L 394.05 497.27 L 393.85 497.72 L 396.8 497.52 L 396.95 498.71 z"},{code:"RJ",name:"Rio de Janeiro",gTransform:"matrix(1 0 0 1 179.27 113.69)",pathTransform:"translate(-485.28, -432.95)",d:"M 468.35 450.28 L 468.28000000000003 449.5 L 468.66 449.23 L 471.85 449.45000000000005 L 474.44 448.86000000000007 L 471.91 447.31000000000006 L 470.51000000000005 446.81000000000006 L 467.70000000000005 447.49000000000007 L 466.34000000000003 449.0900000000001 L 465.31000000000006 449.4100000000001 L 464.61000000000007 449.36000000000007 L 463.26000000000005 447.2100000000001 L 462.78000000000003 447.2100000000001 L 461.88000000000005 447.6300000000001 L 460.9200000000001 448.6900000000001 L 457.7700000000001 449.4900000000001 L 457.4300000000001 450.40000000000015 L 457.2400000000001 452.3000000000001 L 459.4300000000001 452.4300000000001 L 460.5000000000001 453.4400000000001 L 459.35000000000014 454.5200000000001 L 458.41000000000014 454.3500000000001 L 456.9900000000001 454.5200000000001 L 456.9900000000001 454.5200000000001 L 456.5100000000001 454.2600000000001 L 454.8800000000001 452.5300000000001 L 454.8300000000001 452.12000000000006 L 455.9200000000001 448.62000000000006 L 457.01000000000005 447.4700000000001 L 459.36000000000007 446.4600000000001 L 459.86000000000007 446.61000000000007 L 462.63000000000005 446.25000000000006 L 464.13000000000005 445.5400000000001 L 465.78000000000003 443.3900000000001 L 465.03000000000003 441.7500000000001 L 463.33000000000004 441.7400000000001 L 460.18000000000006 442.2700000000001 L 458.4100000000001 441.8800000000001 L 457.18000000000006 440.29000000000013 L 456.62000000000006 439.1200000000001 L 455.3500000000001 438.5800000000001 L 455.3500000000001 438.5800000000001 L 456.0300000000001 438.0900000000001 L 458.4500000000001 437.3500000000001 L 461.3600000000001 436.0100000000001 L 463.9400000000001 435.8400000000001 L 464.4400000000001 436.11000000000007 L 466.16000000000014 435.3400000000001 L 467.21000000000015 434.5700000000001 L 471.3000000000001 432.7800000000001 L 471.8200000000001 432.7100000000001 L 472.1800000000001 433.0200000000001 L 475.3800000000001 432.9500000000001 L 476.6300000000001 432.7800000000001 L 478.2600000000001 431.8400000000001 L 478.8300000000001 431.7800000000001 L 481.36000000000007 432.05000000000007 L 481.8500000000001 432.2200000000001 L 481.8300000000001 432.6900000000001 L 483.2100000000001 432.4900000000001 L 492.7200000000001 427.96000000000015 L 495.25000000000006 426.97000000000014 L 495.46000000000004 426.45000000000016 L 495.18000000000006 425.84000000000015 L 493.74000000000007 425.71000000000015 L 493.83000000000004 424.96000000000015 L 495.72 421.25000000000017 L 498.08000000000004 415.21000000000015 L 497.35 414.50000000000017 L 497.91 414.01000000000016 L 499.15000000000003 413.7400000000002 L 501.68 411.38000000000017 L 501.68 411.38000000000017 L 503.61 412.14000000000016 L 504.28000000000003 416.85000000000014 L 506.78000000000003 417.98000000000013 L 511.11 418.9900000000001 L 514.1 418.6200000000001 L 515.72 419.6800000000001 L 515.72 419.6800000000001 L 515.64 420.9500000000001 L 514.6999999999999 422.5600000000001 L 514.4799999999999 424.6900000000001 L 515.6199999999999 431.4700000000001 L 515.1199999999999 432.1500000000001 L 512.0399999999998 433.9000000000001 L 506.0699999999998 435.8400000000001 L 503.23999999999984 437.5600000000001 L 499.73999999999984 441.2500000000001 L 499.6299999999998 442.91000000000014 L 499.9399999999998 444.10000000000014 L 499.74999999999983 445.72000000000014 L 499.0199999999998 447.20000000000016 L 497.1999999999998 447.71000000000015 L 490.6499999999998 447.54000000000013 L 484.8599999999998 448.2400000000001 L 482.4699999999998 447.78000000000014 L 481.9799999999998 447.40000000000015 L 481.9199999999998 446.72000000000014 L 482.94999999999976 445.2400000000001 L 483.6199999999998 443.79000000000013 L 483.5299999999998 443.17000000000013 L 482.74999999999983 442.9900000000001 L 479.9599999999998 444.1400000000001 L 479.6999999999998 444.8300000000001 L 480.0099999999998 445.6200000000001 L 481.3899999999998 446.79000000000013 L 481.6399999999998 447.76000000000016 L 481.04999999999984 448.28000000000014 L 479.41999999999985 448.79000000000013 L 477.84999999999985 448.76000000000016 L 469.80999999999983 449.83000000000015 L 468.35 450.28 z M 463.24 452.27 L 462.57 451.29999999999995 L 464.68 449.74999999999994 L 466.54 450.68999999999994 L 466.97 451.38999999999993 L 464.51000000000005 451.88999999999993 L 464.1 451.5399999999999 L 463.63 451.5399999999999 L 463.24 452.27 z"},{code:"RN",name:"Rio Grande do Norte",gTransform:"matrix(1 0 0 1 274.86 -145.63)",pathTransform:"translate(-580.87, -173.63)",d:"M 609.29 182.91 L 608.36 183.15 L 604.86 182.94 L 603.82 183.34 L 601.36 182.24 L 599.19 181.94 L 593.36 182.33 L 592.83 181.98 L 589.41 181.58 L 588.79 181.09 L 588.89 180.09 L 588.47 179.7 L 587.09 179.75 L 585.27 181.1 L 584.96 182.58 L 585.68 183.36 L 586.21 184.89 L 585.2 184.57 L 584.72 185.16 L 584.88 186.58 L 585.35 187.52 L 584.8 188.73 L 584.3 189.47 L 581.95 190.4 L 581.12 189.66 L 581.64 188.12 L 580.75 186.95 L 578.8 186.65 L 577.03 186.73 L 573.88 187.99 L 573.59 187.76 L 573.28 186.38 L 572.96 186.15 L 569.43 185.63 L 569.51 183.91 L 569.72 183.6 L 570.57 183.35 L 570.98 182.97 L 571.36 181.23 L 571.8 180.27 L 574.79 177.06 L 574.78 175.87 L 574.25 175.43 L 573.61 175.35 L 570.35 176.39 L 568.92 176.51 L 565.74 177.72 L 565.33 178.67 L 565.23 179.71 L 564.41 180.42 L 561.18 182.08 L 560.02 183.21 L 557.14 182.6 L 556.24 182.18 L 554.31 180.54 L 553.74 181 L 553.74 181 L 553.08 181.38 L 552.44 181.21 L 552.78 179.24 L 554.19 176.99 L 555.03 176.11 L 555.54 176.04 L 556.32 176.55 L 557.35 176.29 L 557.92 175.19 L 559.38 173.68 L 560.78 171.24 L 560.63 170.5 L 561.28 168.83 L 562.15 168.26 L 562.99 167.14 L 566.29 160.45 L 568.9 158.44 L 573.79 156.85 L 573.79 156.85 L 574.26 157.61 L 575.12 158.36 L 578.25 158.35 L 579.47 158.76 L 581.16 160.51 L 582.48 161.01 L 585.81 160.69 L 588.69 161.21 L 591.23 160.97 L 593.56 160.24 L 598.06 161.16 L 599.33 161.2 L 601.28 162.06 L 602.3 162.88 L 602.94 163.82 L 605.25 168.56 L 605.75 170.35 L 605.71 171.1 L 607.19 176.48 L 607.4 178.16 L 608.12 178.7 L 609.08 181.39 z"},{code:"RO",name:"Rondônia",gTransform:"matrix(1 0 0 1 -139.57 -68.08)",pathTransform:"translate(-166.43, -251.18)",d:"M 187.32 290.95 L 186.03 289.5 L 185.59 287.62 L 184.03 287.1 L 183.17 287.42 L 181.36 287.5 L 177.29 285.69 L 177.28 285.29 L 176.62 284.68 L 175.35 285.27 L 173.37 283.59 L 171.85 282.62 L 170.99 281.16 L 170.71 279.77 L 169.67 279.38 L 167.9 280.5 L 166.68 280.47 L 165.27 279.67 L 164.4 278.34 L 161.27 276.76 L 159.31 276.59 L 158.17 277.13 L 157.27 277.98 L 155.84 277.81 L 155.53 277.51 L 153.39 277 L 150.33 276.72 L 149.57 276.29 L 148.39 275.1 L 148.09 273.13 L 146.51 272.64 L 144.62 271.67 L 143.8 269.95 L 143.51 269.75 L 140.79 269.47 L 140.41 269.12 L 139.57 265.41 L 138.69 264.52 L 138.21 265.68 L 137.55 265.36 L 137.28 264.72 L 137.9 263.19 L 137.06 261.67 L 135.7 261.28 L 134.44 257.81 L 134.27 256.15 L 135.82 253.24 L 135.61 251.58 L 134.45 249.61 L 133.7 247.45 L 133.64 245.16 L 134.26 244.66 L 134.64 243.29 L 135.68 242.24 L 136.04 240.77 L 135.8 239.28 L 135.38 238.39 L 135.29 236.86 L 135.83 235.21 L 134.66 233.03 L 133.64 232.65 L 132.55 233.63 L 132.49 234.14 L 131.65 235.1 L 131.08 235.1 L 128.9 234.08 L 123.72 234.16 L 118.11 235.94 L 116.42 235.93 L 114.94 236.41 L 114.94 236.41 L 111.97 235.15 L 111.97 235.15 L 115.23 232.59 L 117.15 232.01 L 118.7 230.2 L 118.85 229.64 L 118.69 228.35 L 122.65 228.61 L 125.52 228.28 L 126.24 228.65 L 128.55 230.98 L 128.92 230.96 L 130.14 230.17 L 130.27 229.45 L 130.68 228.92 L 131.76 228.42 L 132.53 228.55 L 133.9 228.16 L 135.2 226.95 L 137.04 225.93 L 137.42 226.02 L 138.06 228.28 L 138.74 228.81 L 139.42 228.73 L 141.96 225.57 L 141.7 223.82 L 142.23 222.98 L 143.98 221.72 L 144.44 221.74 L 145.28 222.29 L 147.07 222.39 L 148.27 221.32 L 150.4 220.94 L 154.27 221.4 L 154.03 219.94 L 154.14 218.13 L 156.2 216.92 L 157.01 215.77 L 157.37 214.75 L 157.2 214.3 L 156.3 213.6 L 156.35 212.93 L 157.54 211.34 L 160.02 210.81 L 160.28 210.59 L 160.19 209.42 L 161.91 208.92 L 163.29 206.36 L 174.08 206.3 L 176.23 207.43 L 176.68 207.92 L 177.48 209.83 L 178.81 211.1 L 181.35 212.08 L 182.6 215.35 L 183.06 215.56 L 184.04 215.43 L 184.66 215.63 L 185.34 218.51 L 188.58 219.99 L 189.26 219.8 L 189.8 218.06 L 191.72 216.98 L 193.11 217.26 L 193.47 217.64 L 193.43 218.34 L 193.43 218.34 L 194.83 219.31 L 195.43 220.55 L 194.67 221.97 L 193.38 226.96 L 193.44 227.31 L 194.22 227.78 L 194.48 228.39 L 194.63 229.78 L 195.46 232.05 L 194.52 233.72 L 194.9 235.65 L 193.9 239.17 L 193.87 239.97 L 194.14 241.73 L 195.64 244.48 L 194.74 253.48 L 211.9 253.53 L 211.66 254.09 L 212.88 255.2 L 216.38 255.11 L 217.49 255.22 L 218.56 255.65 L 219.97 259.24 L 219.8 259.99 L 218.4 261.74 L 217.04 262.82 L 216.9 264.14 L 217.33 267.39 L 217.91 267.9 L 218.81 267.87 L 220.34 271.21 L 220.3 273.26 L 220.88 274.75 L 220.81 276.46 L 220.25 278.7 L 218.59 280.71 L 218.07 282.96 L 217.49 283.8 L 217.06 284.21 L 215.42 284.74 L 214.49 285.82 L 213.06 289.6 L 212.54 292.05 L 208.43 294.62 L 206.96 296.05 L 206.96 296.05 L 206.22 296.01 L 203.63 294.46 L 202.36 293.03 L 195.28 293.99 L 193.96 293.56 L 193.71 293.26 L 190.33 293.92 L 189.85 293.76 L 189.33 292.41 z"},{code:"RR",name:"Roraima",gTransform:"matrix(1 0 0 1 -116.08 -267.27)",pathTransform:"translate(-189.92, -51.99)",d:"M 234.61 61.4 L 236.21 78.37 L 236.21 78.37 L 217.72 78.3 L 217.75 78.98 L 215.42 82.24 L 213.76 85.27 L 213.69 86.4 L 212.54 89.04 L 212.43 89.7 L 212.66 90.43 L 213.8 91.84 L 213.78 92.37 L 213.36 92.76 L 211.33 93.31 L 209.92 94.72 L 208.67 95.18 L 206.85 94.95 L 205.93 92.44 L 204.06 90.4 L 201.23 89.47 L 199.63 89.53 L 199.08 90.42 L 196.99 91.13 L 195.71 91.82 L 194.69 93.08 L 193.87 96.05 L 194.24 97.85 L 193.99 99.58 L 193.24 101.87 L 193.68 103.98 L 191.32 102.94 L 189.98 103.36 L 189.45 103.29 L 188.41 101.25 L 186.93 99.6 L 184.97 98.29 L 184.45 98.25 L 179.44 93.83 L 179.58 92.69 L 181.42 93.02 L 182.56 91.7 L 182.62 91.12 L 181.49 86.79 L 180.91 85.89 L 179.69 85.05 L 178.81 82.88 L 178.52 77.9 L 179.09 76.94 L 179.86 73.9 L 179.2 72.32 L 178.84 70.73 L 180.46 69.27 L 180.41 68.82 L 179.54 67.7 L 179.35 65.44 L 177.69 60.68 L 174.96 56.94 L 175.67 55.44 L 176.58 52.12 L 176.09 51.46 L 174.14 50.51 L 172.78 50.4 L 171.9 50.61 L 170.93 50.24 L 169.72 49.07 L 169.66 48.11 L 169.03 48 L 167.9 48.42 L 167.29 48.41 L 166.54 48.07 L 165.82 47.29 L 165.82 47.29 L 166.12 46.83 L 166.35 44.55 L 166.05 44.33 L 162.68 44.1 L 158.93 44.24 L 155.62 43.54 L 155.42 42.94 L 156.22 41.18 L 156.34 39.7 L 155.61 37.93 L 153.67 34.39 L 152.94 32.33 L 152.47 28.61 L 153.26 27.13 L 153.18 26.17 L 151.34 24.17 L 149.18 23.11 L 146.37 20.33 L 145.31 18.52 L 145.02 17.56 L 143.88 16.91 L 143.63 16.52 L 143.66 15.68 L 143.95 15.35 L 144.85 15.42 L 145.97 16.08 L 146.91 17.81 L 147.52 17.9 L 150.91 17.4 L 152.26 17.5 L 154.17 18.09 L 154.78 19.29 L 155.33 21.22 L 155.87 21.57 L 156.83 21.49 L 157.57 20.84 L 158.52 20.44 L 161.7 20.6 L 162.17 20.65 L 163.48 21.86 L 164.08 22.01 L 164.6 21.87 L 165.21 20.31 L 166.52 20.45 L 167.97 21.38 L 171.9 25.95 L 172.95 26.52 L 173.66 26.63 L 175.17 25.95 L 175.91 24.82 L 176.01 23.98 L 175.18 21.22 L 175.54 19.48 L 176 19.2 L 177.93 19.15 L 178.94 18.05 L 180.49 16.96 L 181.24 17.01 L 185.14 18.35 L 185.73 18.18 L 186.53 17.46 L 187.56 17.16 L 188.69 17.51 L 189.72 17.3 L 191.06 16.02 L 192.06 15.77 L 193.21 16 L 194.32 15.93 L 195 15.08 L 195.05 13.73 L 198.08 11.92 L 200.41 12.11 L 203.17 11.72 L 204.06 10.59 L 204.15 9.88 L 204.74 8.76 L 205.49 8.63 L 207.34 7.73 L 208.44 6.69 L 209.55 4.98 L 208.35 1.42 L 207.18 1.06 L 207.82 0.88 L 209.25 0.95 L 210.05 1.27 L 213.62 1.17 L 214.68 0.22 L 215.42 0 L 216.79 0.42 L 217.32 1.73 L 218.36 2.53 L 218.84 3.9 L 218.17 8.8 L 217.45 10.18 L 216.2 10.88 L 216.26 11.71 L 217.87 12.12 L 219.49 11.9 L 221.84 12.71 L 223.66 13.81 L 222.78 15.24 L 222.77 16.39 L 225.11 19.81 L 225.31 21.36 L 223.8 24.28 L 221.92 25.69 L 221.2 27.19 L 221.47 27.58 L 221.53 29.75 L 220.06 32.16 L 219.16 34.93 L 218.85 37.5 L 218.76 40.17 L 219.74 42.04 L 220.25 43.8 L 220.24 45.2 L 221.81 46.23 L 222.71 46.43 L 222.84 47.11 L 222.38 52.26 L 222.5 53 L 224.31 53.29 L 223.65 54.46 L 224.11 54.96 L 226.26 55.7 L 227.72 57.62 L 230.38 60.36 z"},{code:"RS",name:"Rio Grande do Sul",gTransform:"matrix(1 0 0 1 11.62 259.25)",pathTransform:"translate(-317.63, -578.5)",d:"M 321.99 638.52 L 321.63 638.53 L 319.69 637.42 L 319.49 636.96 L 320.01 632.69 L 319.55 628.44 L 319.7 627.37 L 320.33 626.13 L 323.17 623.75 L 324 622.19 L 326.3 619.63 L 324.84 617.98 L 323.77 617.36 L 321.52 616.76 L 319.2 614.51 L 317.99 612.89 L 317.89 611.3 L 317.46 610.12 L 316.23 608.09 L 314.17 605.85 L 313.5 605.26 L 311.11 604.05 L 309.66 604.26 L 307.76 602.75 L 306.24 601.12 L 304.99 600.34 L 304.85 598.64 L 302.95 596.48 L 299.63 596.02 L 298.71 595.55 L 296.98 593.89 L 295.22 594.02 L 293.05 592.64 L 291.14 588.93 L 290.03 587.44 L 287.5 585.32 L 286.8 585.4 L 286.13 587.19 L 283.54 589.43 L 280.87 589.55 L 280.97 586.69 L 281.37 585.41 L 280.98 584.41 L 277.33 580.12 L 274.96 578.35 L 272.78 576.29 L 271.03 574.18 L 268.34 571.97 L 266.44 571.83 L 264.29 572.04 L 263.15 573.4 L 263.09 574.36 L 262.06 575.33 L 260.95 575.35 L 260.37 574.87 L 257.21 575.01 L 256.56 574.53 L 256.4 573.62 L 255.91 573.4 L 256.76 573.18 L 257.8 572.46 L 260.32 569.69 L 260.43 567.85 L 261.03 566.6 L 261.85 566.15 L 263.14 566.08 L 263.78 565.82 L 264.7 564.82 L 270.15 558.34 L 270.78 556.92 L 270.95 555.81 L 271.77 554.74 L 272.97 553.89 L 274.34 553.48 L 276.3 549.26 L 276.4 548.65 L 276.71 548.28 L 278.35 547.42 L 279.98 545.62 L 280.83 544.47 L 281.34 543.18 L 282.68 541.08 L 283.61 540.79 L 285.18 540.97 L 285.73 541.76 L 286.2 540.48 L 285.99 539.9 L 284.64 539.08 L 284.59 538.72 L 284.94 538.39 L 286.02 538.01 L 286.84 537.05 L 289.63 536.1 L 290.68 535.03 L 290.78 534.11 L 291.6 533.2 L 293.81 532.05 L 296.28 531.65 L 298.05 529.84 L 298.2 528.78 L 299.52 526.42 L 299.85 526.38 L 299.9 526.74 L 300.19 526.94 L 301.52 526.77 L 303.96 525.64 L 306.64 525.05 L 307.85 524.48 L 309.95 522.13 L 310.45 522.14 L 311.12 521.75 L 312.13 520.4 L 314.44 519.67 L 314.74 520.05 L 314.74 520.05 L 318.26 520.44 L 321.52 519.29 L 322.08 518.48 L 323.43 519.06 L 323.28 519.98 L 326.36 519.95 L 327.99 520.94 L 330.55 520.57 L 332.47 521.72 L 335.05 521.31 L 336.59 521.49 L 339.39 521.33 L 341.65 522.25 L 344.13 523.65 L 345.13 526.09 L 346.72 526.28 L 346.81 525.8 L 348.62 525.45 L 354.18 528.99 L 355.55 530.54 L 356.26 530.51 L 357.82 531.49 L 360.85 534.98 L 362.49 537.19 L 362.97 538.67 L 365.14 541.33 L 366.31 541.88 L 373 542.94 L 375.11 542.54 L 378.46 542.88 L 379.34 545.22 L 377.26 546.8 L 375.99 547.21 L 375.26 549.07 L 375.48 551.26 L 375.1 552.82 L 374.58 554.12 L 373.4 554.32 L 372.11 556.01 L 372.08 557.42 L 373.88 558.59 L 374.15 558.39 L 373.87 557.42 L 373.88 556.46 L 375.37 555.64 L 376.95 556.28 L 377.68 557.19 L 378.85 558.04 L 379.3 558.01 L 379.3 558.01 L 377.9 559.74 L 374 566.78 L 369.79 578.38 L 363.49 588.86 L 358.05 595.52 L 351.54 601.48 L 345.45 605.16 L 342.35 609.47 L 342.17 609.04 L 342.82 607.46 L 343.16 605.28 L 341.98 603.57 L 342.08 603.15 L 343.01 602.98 L 344.02 603.38 L 344.58 603.96 L 345.6 604 L 348.18 602.59 L 349 601.91 L 351.85 598.2 L 352.6 597.51 L 353.05 597.7 L 354.07 597.51 L 355.12 596.67 L 356.05 595.4 L 356.42 593.92 L 356.6 592.99 L 356.37 590.89 L 356.57 589.52 L 358.14 589.45 L 358.88 589.75 L 359.15 590.58 L 359.5 590.32 L 359.21 588.92 L 359.72 586.85 L 360.2 586.28 L 362.94 584.69 L 363.67 583.61 L 364.14 580.86 L 363.93 578.58 L 364.49 577.9 L 364.99 578.7 L 365.36 578.73 L 365.79 578.31 L 366.26 575.23 L 366.16 574.79 L 365.21 573.57 L 364.54 573.54 L 364.28 574.23 L 364.45 574.62 L 364.31 575.19 L 363.96 575.39 L 362.45 575.37 L 360.44 575.77 L 360.1 577.38 L 359.57 577.43 L 358.76 576.99 L 358.86 575.28 L 358.04 574.39 L 357 574.72 L 356.4 574.24 L 355.67 572.98 L 355.27 571.53 L 355.39 570.96 L 354.75 570.27 L 354.14 572.98 L 354.58 575.23 L 355.83 577.34 L 355.26 578.15 L 354.52 580.69 L 354.9 583.72 L 354.72 584.49 L 354.24 584.12 L 354.5 583.88 L 354.47 583.17 L 354 581.89 L 353.55 581.5 L 353.02 582.16 L 352.99 583.53 L 351.58 586.8 L 351.53 588.69 L 351.75 589.21 L 351.03 589.91 L 349.42 590.55 L 348.81 592.13 L 344.72 593.7 L 344 594.23 L 343.47 595.82 L 343.37 598.09 L 342.4 600.36 L 340.04 601.66 L 339.93 603.42 L 340.41 604.25 L 340.66 605.27 L 339.71 605.83 L 339.46 607.34 L 339.89 607.94 L 340.57 607.8 L 341.87 608.43 L 342.02 609.34 L 339.89 610.99 L 337.57 615.51 L 335.64 622.39 L 333.63 626.88 L 331.95 629.4 L 324.16 636.93 z"},{code:"SC",name:"Santa Catarina",gTransform:"matrix(1 0 0 1 51.41 209.71)",pathTransform:"translate(-357.4, -528.97)",d:"M 379.3 558.01 L 378.85 558.04 L 377.68 557.1899999999999 L 376.95 556.27 L 375.36 555.64 L 373.88 556.46 L 373.87 557.4200000000001 L 374.15 558.3900000000001 L 373.88 558.5900000000001 L 372.08 557.4200000000002 L 372.12 556.0100000000002 L 373.4 554.3200000000002 L 374.58 554.1200000000001 L 375.10999999999996 552.8100000000002 L 375.47999999999996 551.2600000000002 L 375.25999999999993 549.0700000000002 L 375.98999999999995 547.2100000000002 L 377.25999999999993 546.7900000000002 L 379.3399999999999 545.2100000000002 L 378.4599999999999 542.8700000000001 L 375.1099999999999 542.5300000000001 L 372.9999999999999 542.9300000000001 L 366.3099999999999 541.8700000000001 L 365.14999999999986 541.3300000000002 L 362.97999999999985 538.6700000000002 L 362.48999999999984 537.1900000000002 L 360.85999999999984 534.9800000000001 L 357.82999999999987 531.4900000000001 L 356.2599999999999 530.5000000000001 L 355.5499999999999 530.5300000000001 L 354.1799999999999 528.9800000000001 L 348.6199999999999 525.4400000000002 L 346.8099999999999 525.7800000000002 L 346.7199999999999 526.2600000000002 L 345.1199999999999 526.0700000000002 L 344.1199999999999 523.6300000000001 L 341.64999999999986 522.2400000000001 L 339.3799999999999 521.3100000000002 L 336.58999999999986 521.4700000000001 L 335.04999999999984 521.2900000000002 L 332.45999999999987 521.7000000000002 L 330.54999999999984 520.5500000000002 L 327.97999999999985 520.9100000000002 L 326.34999999999985 519.9300000000002 L 323.26999999999987 519.9600000000002 L 323.41999999999985 519.0300000000002 L 322.0699999999998 518.4500000000002 L 321.5099999999998 519.2600000000001 L 318.24999999999983 520.4200000000001 L 314.72999999999985 520.0300000000001 L 314.72999999999985 520.0300000000001 L 316.17999999999984 517.1000000000001 L 316.90999999999985 515.0100000000001 L 316.32999999999987 511.7600000000001 L 316.7399999999999 508.5500000000001 L 316.6999999999999 506.0000000000001 L 317.65999999999985 504.2500000000001 L 317.65999999999985 504.2500000000001 L 321.28999999999985 504.2700000000001 L 321.99999999999983 503.8900000000001 L 322.5299999999998 503.9000000000001 L 323.5899999999998 504.1400000000001 L 323.8999999999998 504.6500000000001 L 325.9299999999998 506.0600000000001 L 328.6099999999998 506.0900000000001 L 330.94999999999976 505.5100000000001 L 336.2399999999998 507.1900000000001 L 340.4999999999998 507.5500000000001 L 341.51999999999975 508.1800000000001 L 341.68999999999977 508.59000000000015 L 343.25999999999976 509.77000000000015 L 347.02999999999975 510.19000000000017 L 351.27999999999975 510.0600000000002 L 352.60999999999973 511.96000000000015 L 352.78999999999974 511.46000000000015 L 353.52999999999975 511.08000000000015 L 354.44999999999976 511.0600000000002 L 355.31999999999977 510.20000000000016 L 354.46999999999974 507.21000000000015 L 355.15999999999974 505.63000000000017 L 355.87999999999977 504.8500000000002 L 357.87999999999977 503.7100000000002 L 361.44999999999976 504.1100000000002 L 363.31999999999977 503.14000000000016 L 364.0499999999998 502.27000000000015 L 364.63999999999976 500.79000000000013 L 366.16999999999973 500.14000000000016 L 367.27999999999975 500.00000000000017 L 368.69999999999976 500.76000000000016 L 369.50999999999976 500.79000000000013 L 371.83999999999975 500.6200000000001 L 374.6799999999997 499.8900000000001 L 375.4299999999997 499.9000000000001 L 376.46999999999974 500.30000000000007 L 379.58999999999975 502.9000000000001 L 380.81999999999977 503.5200000000001 L 382.25999999999976 503.6800000000001 L 385.6099999999998 501.5500000000001 L 386.9599999999998 500.1200000000001 L 388.5199999999998 499.5500000000001 L 388.6399999999998 499.9400000000001 L 389.3999999999998 500.0100000000001 L 391.1399999999998 499.7800000000001 L 391.4699999999998 499.3400000000001 L 396.7099999999998 499.37000000000006 L 396.7099999999998 499.37000000000006 L 396.3199999999998 500.69000000000005 L 396.8299999999998 502.34000000000003 L 396.7599999999998 502.73 L 395.2599999999998 503.87 L 394.2799999999998 503.39 L 393.4599999999998 500.86 L 393.4399999999998 501.98 L 394.0299999999998 504.70000000000005 L 395.7399999999998 506.36000000000007 L 396.2999999999998 507.31000000000006 L 395.2899999999998 509.6000000000001 L 395.12999999999977 511.9200000000001 L 395.2299999999998 512.35 L 395.9899999999998 513.08 L 396.2499999999998 518.94 L 396.5599999999998 519.49 L 396.9899999999998 519.69 L 397.75999999999976 519.1800000000001 L 398.1099999999998 519.9000000000001 L 398.2099999999998 520.7700000000001 L 397.7399999999998 520.83 L 397.3099999999998 520.5500000000001 L 396.1199999999998 521.1800000000001 L 395.7799999999998 525.0200000000001 L 396.3499999999998 527.6100000000001 L 395.7799999999998 528.3600000000001 L 396.0899999999998 530.2900000000001 L 396.99999999999983 532.1700000000001 L 396.1399999999998 534.5100000000001 L 395.61999999999983 538.5200000000001 L 393.90999999999985 543.2 L 393.5699999999999 543.1 L 393.20999999999987 542.34 L 393.41999999999985 541.37 L 392.49999999999983 540.19 L 392.23999999999984 540.5200000000001 L 392.41999999999985 542.95 L 393.57999999999987 543.7800000000001 L 392.65999999999985 545.44 L 391.01999999999987 546.09 L 386.8899999999999 549.13 L 384.08999999999986 551.6899999999999 L 380.33999999999986 556.13 L 379.3 558.01 z M 397.18 531.46 L 397.03000000000003 530.99 L 397.28000000000003 529.24 L 398.04 526.84 L 397.64000000000004 525.6600000000001 L 397.80000000000007 524.6400000000001 L 399.20000000000005 523.8800000000001 L 399.4200000000001 523.94 L 400.0800000000001 524.8800000000001 L 399.5400000000001 527.44 L 398.7200000000001 528.3000000000001 L 398.1300000000001 529.5200000000001 L 398.3300000000001 530.69 L 397.18 531.46 z M 396.73 507.09 L 394.86 505.07 L 397.41 502.63 L 397.66 502.67 L 398.31 503.72 L 397.45 505.04 L 396.73 507.09 z"},{code:"SE",name:"Sergipe",gTransform:"matrix(1 0 0 1 266.49 -72.82)",pathTransform:"translate(-572.49, -246.44)",d:"M 569.94 261.69 L 567.04 262.58 L 565.49 261.94 L 564.95 261.6 L 564.47 260.88 L 562.55 259.96 L 561.95 259.44 L 561.83 259.03 L 562.17 258.64 L 562.3 257.22 L 562.15 256.83 L 560.72 255.32 L 560.2 253.83 L 559.11 253.16 L 558.15 251.56 L 558.13 250.79 L 558.72 249.21 L 559.04 248.91 L 560.74 248.92 L 561.87 249.67 L 564.42 248.68 L 565.11 248.13 L 565.41 247.55 L 564.65 244.8 L 564.73 243.92 L 565.39 242.3 L 565.47 239.19 L 564.72 238.04 L 562.73 236.09 L 561.46 233.59 L 561.24 231.45 L 561.91 230.3 L 561.91 230.3 L 568.37 233.28 L 572.05 234.23 L 577.47 237.3 L 578.77 239.75 L 580.53 241.2 L 582.19 241.99 L 582.65 242.02 L 586.24 244.25 L 586.84 245.56 L 586.84 245.56 L 584.46 246.32 L 579.89 249.26 L 578.92 250.15 L 577.37 252.36 L 577.05 252.34 L 577.16 251.24 L 576.11 249.42 L 575.12 249.58 L 575.46 250.74 L 576.7 250.74 L 576.93 250.98 L 576.41 252.95 L 575.14 255.04 L 574.61 254.69 L 574.24 254.02 L 573.25 253.86 L 573.45 254.54 L 574.58 255.16 L 574.32 256.93 L 573.46 258.08 L 572.53 260.11 L 571.75 260.26 L 571.45 259.8 L 571.93 258.4 L 572.34 258.27 L 572.65 257.84 L 573.02 256.8 L 572.21 256.43 L 572.31 257.11 L 571.86 258.24 L 571.38 258.74 L 571.12 259.83 L 571.4 260.55 L 571.14 261.07 z"},{code:"SP",name:"São Paulo",gTransform:"matrix(1 0 0 1 89.6 122.15)",pathTransform:"translate(-395.6, -441.42)",d:"M 404.58 487.92 L 404.41999999999996 486.59000000000003 L 402.99999999999994 486.02000000000004 L 402.2699999999999 482.72 L 402.6699999999999 480.77000000000004 L 400.5299999999999 480.19000000000005 L 399.7699999999999 480.36000000000007 L 398.6699999999999 483.13000000000005 L 398.0099999999999 483.9800000000001 L 396.9499999999999 483.4500000000001 L 396.59999999999985 482.67000000000013 L 397.28999999999985 479.3700000000001 L 398.17999999999984 478.7100000000001 L 398.3199999999998 478.3100000000001 L 396.7099999999998 477.04000000000013 L 395.11999999999983 476.91000000000014 L 393.53999999999985 477.10000000000014 L 393.03999999999985 476.72000000000014 L 389.6299999999998 477.2500000000001 L 387.24999999999983 477.3700000000001 L 386.23999999999984 477.16000000000014 L 385.6399999999998 476.77000000000015 L 385.30999999999983 474.73000000000013 L 386.5899999999998 472.6100000000001 L 386.8399999999998 471.5600000000001 L 386.5899999999998 471.1200000000001 L 385.9899999999998 470.8200000000001 L 385.06999999999977 468.8500000000001 L 385.12999999999977 467.9600000000001 L 384.62999999999977 467.2800000000001 L 383.95999999999975 466.99000000000007 L 382.7499999999998 465.8500000000001 L 381.25999999999976 462.8400000000001 L 381.6199999999998 462.2900000000001 L 381.69999999999976 460.5300000000001 L 380.39999999999975 459.0100000000001 L 380.01999999999975 457.17000000000013 L 380.18999999999977 456.3600000000001 L 380.57999999999976 455.78000000000014 L 380.5599999999998 453.04000000000013 L 379.6699999999998 451.28000000000014 L 376.0799999999998 448.45000000000016 L 374.9499999999998 446.90000000000015 L 371.9799999999998 447.76000000000016 L 366.6699999999998 447.63000000000017 L 366.00999999999976 447.09000000000015 L 364.3599999999998 446.95000000000016 L 363.93999999999977 447.29000000000013 L 362.21999999999974 447.22000000000014 L 361.4999999999997 445.90000000000015 L 360.8699999999997 445.39000000000016 L 357.35999999999973 444.59000000000015 L 355.60999999999973 443.75000000000017 L 354.82999999999976 442.75000000000017 L 352.2499999999998 442.76000000000016 L 351.1799999999998 443.3000000000002 L 349.8599999999998 443.1700000000002 L 347.2199999999998 442.0800000000002 L 344.6899999999998 441.62000000000023 L 343.2099999999998 440.8300000000002 L 342.0399999999998 440.5400000000002 L 341.3099999999998 440.9100000000002 L 340.9699999999998 441.5100000000002 L 339.7599999999998 442.1300000000002 L 336.47999999999985 441.8400000000002 L 332.46999999999986 441.9500000000002 L 328.6399999999999 441.30000000000024 L 325.3899999999999 443.59000000000026 L 325.3899999999999 443.59000000000026 L 326.22999999999985 442.5100000000003 L 326.95999999999987 440.97000000000025 L 328.21999999999986 439.83000000000027 L 335.77999999999986 435.29000000000025 L 337.72999999999985 433.42000000000024 L 338.98999999999984 430.99000000000024 L 340.71999999999986 429.30000000000024 L 341.11999999999983 428.09000000000026 L 342.55999999999983 427.0600000000003 L 342.8399999999998 425.84000000000026 L 342.4899999999998 425.0000000000003 L 344.4899999999998 422.7400000000003 L 345.69999999999976 420.4000000000003 L 345.76999999999975 419.4600000000003 L 345.45999999999975 417.5300000000003 L 345.68999999999977 417.1400000000003 L 346.64999999999975 416.62000000000035 L 349.2499999999998 412.98000000000036 L 349.4099999999998 410.05000000000035 L 350.0299999999998 408.37000000000035 L 351.0399999999998 408.07000000000033 L 351.7699999999998 407.43000000000035 L 353.7599999999998 404.75000000000034 L 354.97999999999985 403.73000000000036 L 355.4499999999999 403.50000000000034 L 356.7599999999999 403.4600000000003 L 358.2599999999999 402.68000000000035 L 358.53999999999985 402.28000000000037 L 358.9399999999998 399.8200000000004 L 358.9399999999998 399.8200000000004 L 360.15999999999985 398.6900000000004 L 362.30999999999983 397.5800000000004 L 364.22999999999985 397.2100000000004 L 365.65999999999985 395.5200000000004 L 367.15999999999985 394.91000000000037 L 367.90999999999985 395.05000000000035 L 369.6399999999999 396.60000000000036 L 372.1899999999999 396.68000000000035 L 376.4799999999999 397.6400000000003 L 378.1499999999999 397.2800000000003 L 379.7699999999999 397.50000000000034 L 381.7699999999999 396.91000000000037 L 383.94999999999993 398.3300000000004 L 385.61999999999995 399.1200000000004 L 385.48999999999995 400.0400000000004 L 385.81999999999994 401.46000000000043 L 387.0299999999999 403.5500000000004 L 387.6599999999999 403.5800000000004 L 388.19999999999993 403.2600000000004 L 388.86999999999995 402.3200000000004 L 389.28 401.1900000000004 L 389.53999999999996 401.0000000000004 L 390.09 401.0500000000004 L 390.45 401.4400000000004 L 390.7 402.4000000000004 L 390.71 405.18000000000035 L 391.90999999999997 405.7100000000003 L 392.32 405.26000000000033 L 392.05 402.7200000000003 L 392.54 401.5300000000003 L 392.99 401.0500000000003 L 401.17 400.3800000000003 L 402.18 399.1300000000003 L 403.68 400.59000000000026 L 404.8 401.02000000000027 L 407.58 400.33000000000027 L 408.02 399.34000000000026 L 407.82 398.8800000000003 L 408.13 398.27000000000027 L 410.51 398.16000000000025 L 412.17 398.9400000000002 L 413.02000000000004 398.30000000000024 L 414.33000000000004 398.0100000000002 L 417.59000000000003 401.36000000000024 L 417.79 402.40000000000026 L 417.22 403.41000000000025 L 416.93 405.78000000000026 L 417.51 406.39000000000027 L 419.4 407.60000000000025 L 419.79999999999995 409.15000000000026 L 419.73999999999995 409.71000000000026 L 418.21999999999997 411.74000000000024 L 418.03999999999996 413.68000000000023 L 418.83 414.42000000000024 L 419.14 415.03000000000026 L 419.51 417.24000000000024 L 420.81 419.04000000000025 L 421.64 421.03000000000026 L 421.61 421.8800000000003 L 423.22 421.83000000000027 L 424 421.52000000000027 L 424.28 421.16000000000025 L 425.28 421.11000000000024 L 428.97999999999996 422.43000000000023 L 429.21 422.80000000000024 L 429.15999999999997 424.0700000000002 L 428.46 426.2500000000002 L 426.59999999999997 428.97000000000025 L 426.85999999999996 431.91000000000025 L 426.66999999999996 435.36000000000024 L 426.14 436.92000000000024 L 426.86 438.52000000000027 L 428.64 439.7600000000003 L 430.45 440.59000000000026 L 430.96 442.3100000000003 L 429.75 443.0100000000003 L 431.77 446.3200000000003 L 432.9 446.5700000000003 L 434.90999999999997 446.33000000000027 L 435.09 446.86000000000024 L 438.71 445.86000000000024 L 439.27 446.28000000000026 L 440.58 445.96000000000026 L 441.33 444.98000000000025 L 441.38 444.14000000000027 L 441.14 443.90000000000026 L 441.31 441.60000000000025 L 442.5 441.27000000000027 L 442.59 441.6200000000003 L 442.23999999999995 442.1100000000003 L 442.24999999999994 442.5900000000003 L 444.5899999999999 442.6700000000003 L 446.9799999999999 442.4200000000003 L 448.7699999999999 441.7500000000003 L 449.99999999999994 440.5100000000003 L 451.92999999999995 439.4900000000003 L 454.13999999999993 439.27000000000027 L 455.37999999999994 438.54000000000025 L 455.37999999999994 438.54000000000025 L 456.6499999999999 439.08000000000027 L 457.2099999999999 440.2500000000003 L 458.43999999999994 441.84000000000026 L 460.2099999999999 442.23000000000025 L 463.3599999999999 441.7000000000003 L 465.0599999999999 441.71000000000026 L 465.8099999999999 443.35000000000025 L 464.1599999999999 445.5000000000002 L 462.6599999999999 446.2100000000002 L 459.88999999999993 446.5700000000002 L 459.38999999999993 446.42000000000024 L 457.0399999999999 447.43000000000023 L 455.94999999999993 448.5800000000002 L 454.85999999999996 452.0800000000002 L 454.90999999999997 452.49000000000024 L 456.53999999999996 454.22000000000025 L 457.02 454.48000000000025 L 457.02 454.48000000000025 L 456.96 454.68000000000023 L 455.27 455.10000000000025 L 454.21 454.28000000000026 L 452.72999999999996 455.39000000000027 L 452.29999999999995 456.04000000000025 L 452.56999999999994 456.2600000000003 L 451.80999999999995 456.90000000000026 L 448.5899999999999 458.4500000000003 L 446.3399999999999 459.15000000000026 L 446.05999999999995 459.59000000000026 L 446.09999999999997 460.55000000000024 L 446.59999999999997 462.10000000000025 L 446.28 462.52000000000027 L 444.88 462.78000000000026 L 444.18 462.14000000000027 L 442.84000000000003 461.85000000000025 L 439.72 461.35000000000025 L 438.86 461.5000000000002 L 437.54 461.8400000000002 L 435.81 462.6600000000002 L 435.31 463.1700000000002 L 434.1 465.32000000000016 L 432.79 465.89000000000016 L 432.29 465.77000000000015 L 432.87 465.3000000000001 L 432.39 464.0800000000001 L 431.21999999999997 463.2300000000001 L 430.39 464.4600000000001 L 430.65 465.2100000000001 L 430.34999999999997 465.8200000000001 L 422.72999999999996 470.0600000000001 L 421.78 470.8800000000001 L 421.46999999999997 472.04000000000013 L 418.2 475.04000000000013 L 414.95 476.9900000000001 L 413.03 477.5200000000001 L 408.53 480.7300000000001 L 406.2 482.69000000000005 L 405.53 482.77000000000004 L 405.09 483.39000000000004 L 405.98999999999995 483.82000000000005 L 406.65 483.88000000000005 L 407.58 483.52000000000004 L 407.58 484.28000000000003 L 406.96 485.59000000000003 L 405.64 486.44000000000005 L 404.58 487.92 z M 448.89 464.91 L 447.34999999999997 464.26000000000005 L 446.18999999999994 464.44000000000005 L 445.69999999999993 464.06000000000006 L 445.79999999999995 463.2800000000001 L 446.74999999999994 462.6300000000001 L 447.8399999999999 460.7800000000001 L 448.55999999999995 461.0300000000001 L 449.21999999999997 461.68000000000006 L 449.34999999999997 464.5900000000001 L 448.89 464.91 z"},{code:"TO",name:"Tocantins",gTransform:"matrix(1 0 0 1 95.98 -93.17)",pathTransform:"translate(-401.98, -226.09)",d:"M 433.35 281.82 L 427.99 283.24 L 426.25 284.58 L 423.69 285.68 L 422.14 285.68 L 417.61 286.68 L 415.09 288.76 L 413.31 289.66 L 412.85 289.42 L 411.34 286.8 L 410.79 286.77 L 410.28 290.07 L 409.59 290.15 L 406.24 289.47 L 403.11 288 L 403.67 286.44 L 403.45 285.7 L 398.92 286.23 L 396.16 285.89 L 395.6 286.43 L 395.3 287.43 L 394.55 288.18 L 393.41 288.13 L 392.8 285.03 L 391.69 281.32 L 390.65 279.44 L 389.5 278.13 L 388.32 279.1 L 386.85 281.49 L 385.22 287.43 L 384.59 287.66 L 380.52 286.23 L 377.43 284.52 L 373.5 284.12 L 371.3 283.09 L 368.9 282.69 L 369.42 280.35 L 370.64 278.47 L 370.67 276.76 L 370.11 277.06 L 368.3 279.15 L 367.64 280.38 L 367.44 282.26 L 367.1 282.71 L 367.1 282.71 L 366.3 282.69 L 365.34 282.18 L 364.36 278.84 L 365.1 276.08 L 364.66 273.03 L 364.14 272.45 L 364.13 270.88 L 364.6 267.57 L 363.5 265.32 L 363.55 264.82 L 364.37 263.93 L 364.53 263.06 L 363.14 261.72 L 363.08 260.86 L 364.96 254.87 L 365 251.92 L 365.54 248.95 L 367.48 243.66 L 367.85 243.39 L 368.28 242.54 L 368.72 239.4 L 369.82 238.15 L 370.38 236.26 L 371.03 235.24 L 371.03 235.24 L 372.65 231.55 L 373.78 227.1 L 374.93 225.52 L 376.12 224.42 L 377.33 222.74 L 378.36 220.82 L 379.73 219.9 L 380.78 219.74 L 381.51 218.89 L 382.45 217.35 L 382.63 216.36 L 384.33 213.12 L 385.42 212.32 L 387.18 207.17 L 387.84 203.13 L 387.69 202.83 L 386.95 202.51 L 385.28 200.77 L 384.68 199.82 L 384.52 198.94 L 384.66 198.37 L 386.07 196.68 L 387.36 194.58 L 387.3 191.91 L 386.87 189.73 L 387.06 189.38 L 389.53 187.6 L 392.94 186.46 L 395.44 185.25 L 395.68 184.75 L 395.53 183.24 L 396.39 181.97 L 397.9 180.63 L 399.19 180.48 L 399.38 179.14 L 399.09 177.94 L 399.34 177.48 L 400.8 177.02 L 401.44 176.54 L 402.37 173.79 L 401.35 172.45 L 401.26 171.05 L 401.55 170.77 L 402.52 170.69 L 403.24 170.32 L 403.61 169.66 L 403.64 169.02 L 402.38 167.85 L 401.51 167.71 L 401.12 167.4 L 400.1 165.74 L 398.81 165.62 L 396.94 165.87 L 394.65 165.06 L 394.65 165.06 L 395.18 164.42 L 397.8 162.57 L 399.76 162.04 L 400.63 162.09 L 403.41 163.61 L 404.81 163.69 L 405.76 163.17 L 407.5 163.46 L 408.09 164.15 L 408.17 165.18 L 408.45 165.5 L 409.67 165.53 L 413.07 166.96 L 413.91 167.99 L 414.38 171.49 L 415.02 172.99 L 414.81 176.71 L 415.04 177.79 L 415.71 178.92 L 415.7 179.36 L 413.93 185.51 L 413.62 187.88 L 413.9 188.88 L 413.65 190.47 L 411.9 192.51 L 410.14 193.18 L 409.96 193.89 L 411.9 195.21 L 412.32 194.94 L 413.69 195.18 L 413.94 195.53 L 414.05 196.41 L 413.43 197.6 L 414.28 199.04 L 415.16 198.97 L 418.16 203.13 L 419.07 203.98 L 421.35 207 L 423.49 205.66 L 427.76 204.72 L 429.56 205.94 L 429.64 207.69 L 429 210.94 L 429.39 212.29 L 426 212.64 L 424.66 213.18 L 424.09 213.73 L 423.41 215.16 L 422.68 217.84 L 423.05 219.14 L 420.42 221.69 L 420.16 222.39 L 420.36 222.81 L 422.44 223.1 L 423.38 223.79 L 424.12 225.38 L 424.18 227.04 L 424.8 228.08 L 428.68 230.03 L 428.77 230.56 L 427.13 232.37 L 427.26 234.02 L 429.4 235.64 L 430.39 238.51 L 431.73 240.51 L 432.44 240.69 L 434.22 240.48 L 435.22 240.78 L 436.04 241.22 L 436.65 242.04 L 437.93 242.7 L 437.93 242.7 L 440.87 242.91 L 440.87 242.91 L 440.18 243.56 L 439.96 244.54 L 439.4 245.01 L 435.58 247.03 L 432.37 249.65 L 432.18 250.02 L 433.47 251.82 L 433.11 252.21 L 432.1 252.48 L 431.2 253.09 L 429.68 256.58 L 428.67 257.3 L 428.17 258.46 L 428.4 259.38 L 430.26 261.33 L 433.85 262 L 435.72 262.99 L 435.77 263.75 L 435.21 264.2 L 433.17 265.01 L 432.74 265.97 L 432.83 266.47 L 433.18 266.8 L 434.21 266.62 L 435.13 266.91 L 435.71 267.42 L 436 268.06 L 435.04 268.77 L 433.89 269.19 L 431.94 270.86 L 431.75 271.71 L 431.7 274.63 L 432.05 275.88 L 432.99 276.54 L 434.04 276.78 L 434.45 277.03 L 434.62 277.45 L 434.67 278.51 L 433.31 280.89 z"}];function Xte({selected:t,onSelect:e}){const s=re(),[n,i]=P.useState(Jte),o=l=>{if(l)try{const a=l.getBBox();if(!a.width||!a.height)return;const c=Math.max(a.width,a.height)*.04,d=`${a.x-c} ${a.y-c} ${a.width+c*2} ${a.height+c*2}`;i(u=>u===d?u:d)}catch{}};return r.jsx("svg",{ref:o,viewBox:n,role:"group","aria-label":s("sectionsEditor.brazilMap.ariaLabel"),className:"h-72 w-full rounded-md border border-border/60 bg-muted/20",children:r.jsx("g",{transform:Qte,children:E3.map(l=>{const a=l.code===t;return r.jsx("g",{transform:l.gTransform,children:r.jsx("path",{d:l.d,transform:l.pathTransform,role:"button",tabIndex:0,"aria-label":l.name,"aria-pressed":a,onClick:()=>e(l.code),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),e(l.code))},className:ie("cursor-pointer stroke-background outline-none transition-colors [stroke-width:1] [vector-effect:non-scaling-stroke]","hover:fill-primary/50 focus-visible:fill-primary/50",a?"fill-primary":"fill-muted-foreground/40")})},l.code)})})})}const Zte=[{code:"AF",name:"Afghanistan"},{code:"AX",name:"Åland Islands"},{code:"AL",name:"Albania"},{code:"DZ",name:"Algeria"},{code:"AS",name:"American Samoa"},{code:"AD",name:"Andorra"},{code:"AO",name:"Angola"},{code:"AI",name:"Anguilla"},{code:"AQ",name:"Antarctica"},{code:"AG",name:"Antigua & Barbuda"},{code:"AR",name:"Argentina"},{code:"AM",name:"Armenia"},{code:"AW",name:"Aruba"},{code:"AU",name:"Australia"},{code:"AT",name:"Austria"},{code:"AZ",name:"Azerbaijan"},{code:"BS",name:"Bahamas"},{code:"BH",name:"Bahrain"},{code:"BD",name:"Bangladesh"},{code:"BB",name:"Barbados"},{code:"BY",name:"Belarus"},{code:"BE",name:"Belgium"},{code:"BZ",name:"Belize"},{code:"BJ",name:"Benin"},{code:"BM",name:"Bermuda"},{code:"BT",name:"Bhutan"},{code:"BO",name:"Bolivia"},{code:"BA",name:"Bosnia & Herzegovina"},{code:"BW",name:"Botswana"},{code:"BV",name:"Bouvet Island"},{code:"BR",name:"Brazil"},{code:"VG",name:"British Virgin Islands"},{code:"BN",name:"Brunei"},{code:"BG",name:"Bulgaria"},{code:"BF",name:"Burkina Faso"},{code:"BI",name:"Burundi"},{code:"KH",name:"Cambodia"},{code:"CM",name:"Cameroon"},{code:"CA",name:"Canada"},{code:"CV",name:"Cape Verde"},{code:"BQ",name:"Caribbean Netherlands"},{code:"KY",name:"Cayman Islands"},{code:"CF",name:"Central African Republic"},{code:"TD",name:"Chad"},{code:"IO",name:"Chagos Archipelago"},{code:"CL",name:"Chile"},{code:"CN",name:"China mainland"},{code:"CX",name:"Christmas Island"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CO",name:"Colombia"},{code:"KM",name:"Comoros"},{code:"CG",name:"Congo - Brazzaville"},{code:"CD",name:"Congo - Kinshasa"},{code:"CK",name:"Cook Islands"},{code:"CR",name:"Costa Rica"},{code:"CI",name:"Côte d’Ivoire"},{code:"HR",name:"Croatia"},{code:"CU",name:"Cuba"},{code:"CW",name:"Curaçao"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czechia"},{code:"DK",name:"Denmark"},{code:"DJ",name:"Djibouti"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"EC",name:"Ecuador"},{code:"EG",name:"Egypt"},{code:"SV",name:"El Salvador"},{code:"GQ",name:"Equatorial Guinea"},{code:"ER",name:"Eritrea"},{code:"EE",name:"Estonia"},{code:"SZ",name:"Eswatini"},{code:"ET",name:"Ethiopia"},{code:"FK",name:"Falkland Islands"},{code:"FO",name:"Faroe Islands"},{code:"FJ",name:"Fiji"},{code:"FI",name:"Finland"},{code:"FR",name:"France"},{code:"GF",name:"French Guiana"},{code:"PF",name:"French Polynesia"},{code:"TF",name:"French Southern Territories"},{code:"GA",name:"Gabon"},{code:"GM",name:"Gambia"},{code:"GE",name:"Georgia"},{code:"DE",name:"Germany"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GR",name:"Greece"},{code:"GL",name:"Greenland"},{code:"GD",name:"Grenada"},{code:"GP",name:"Guadeloupe"},{code:"GU",name:"Guam"},{code:"GT",name:"Guatemala"},{code:"GG",name:"Guernsey"},{code:"GN",name:"Guinea"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HT",name:"Haiti"},{code:"HM",name:"Heard & McDonald Islands"},{code:"HN",name:"Honduras"},{code:"HK",name:"Hong Kong"},{code:"HU",name:"Hungary"},{code:"IS",name:"Iceland"},{code:"IN",name:"India"},{code:"ID",name:"Indonesia"},{code:"IR",name:"Iran"},{code:"IQ",name:"Iraq"},{code:"IE",name:"Ireland"},{code:"IM",name:"Isle of Man"},{code:"IL",name:"Israel"},{code:"IT",name:"Italy"},{code:"JM",name:"Jamaica"},{code:"JP",name:"Japan"},{code:"JE",name:"Jersey"},{code:"JO",name:"Jordan"},{code:"KZ",name:"Kazakhstan"},{code:"KE",name:"Kenya"},{code:"KI",name:"Kiribati"},{code:"KW",name:"Kuwait"},{code:"KG",name:"Kyrgyzstan"},{code:"LA",name:"Laos"},{code:"LV",name:"Latvia"},{code:"LB",name:"Lebanon"},{code:"LS",name:"Lesotho"},{code:"LR",name:"Liberia"},{code:"LY",name:"Libya"},{code:"LI",name:"Liechtenstein"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"MO",name:"Macao"},{code:"MG",name:"Madagascar"},{code:"MW",name:"Malawi"},{code:"MY",name:"Malaysia"},{code:"MV",name:"Maldives"},{code:"ML",name:"Mali"},{code:"MT",name:"Malta"},{code:"MH",name:"Marshall Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MU",name:"Mauritius"},{code:"YT",name:"Mayotte"},{code:"MX",name:"Mexico"},{code:"FM",name:"Micronesia"},{code:"MD",name:"Moldova"},{code:"MC",name:"Monaco"},{code:"MN",name:"Mongolia"},{code:"ME",name:"Montenegro"},{code:"MS",name:"Montserrat"},{code:"MA",name:"Morocco"},{code:"MZ",name:"Mozambique"},{code:"MM",name:"Myanmar (Burma)"},{code:"NA",name:"Namibia"},{code:"NR",name:"Nauru"},{code:"NP",name:"Nepal"},{code:"NL",name:"Netherlands"},{code:"NC",name:"New Caledonia"},{code:"NZ",name:"New Zealand"},{code:"NI",name:"Nicaragua"},{code:"NE",name:"Niger"},{code:"NG",name:"Nigeria"},{code:"NU",name:"Niue"},{code:"NF",name:"Norfolk Island"},{code:"KP",name:"North Korea"},{code:"MK",name:"North Macedonia"},{code:"MP",name:"Northern Mariana Islands"},{code:"NO",name:"Norway"},{code:"OM",name:"Oman"},{code:"PK",name:"Pakistan"},{code:"PW",name:"Palau"},{code:"PS",name:"Palestinian Territories"},{code:"PA",name:"Panama"},{code:"PG",name:"Papua New Guinea"},{code:"PY",name:"Paraguay"},{code:"PE",name:"Peru"},{code:"PH",name:"Philippines"},{code:"PN",name:"Pitcairn Islands"},{code:"PL",name:"Poland"},{code:"PT",name:"Portugal"},{code:"PR",name:"Puerto Rico"},{code:"QA",name:"Qatar"},{code:"RE",name:"Réunion"},{code:"RO",name:"Romania"},{code:"RU",name:"Russia"},{code:"RW",name:"Rwanda"},{code:"WS",name:"Samoa"},{code:"SM",name:"San Marino"},{code:"ST",name:"São Tomé & Príncipe"},{code:"SA",name:"Saudi Arabia"},{code:"SN",name:"Senegal"},{code:"RS",name:"Serbia"},{code:"SC",name:"Seychelles"},{code:"SL",name:"Sierra Leone"},{code:"SG",name:"Singapore"},{code:"SX",name:"Sint Maarten"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"GS",name:"So. Georgia & So. Sandwich Isl."},{code:"SB",name:"Solomon Islands"},{code:"SO",name:"Somalia"},{code:"ZA",name:"South Africa"},{code:"KR",name:"South Korea"},{code:"SS",name:"South Sudan"},{code:"ES",name:"Spain"},{code:"LK",name:"Sri Lanka"},{code:"BL",name:"St. Barthélemy"},{code:"SH",name:"St. Helena"},{code:"KN",name:"St. Kitts & Nevis"},{code:"LC",name:"St. Lucia"},{code:"MF",name:"St. Martin"},{code:"PM",name:"St. Pierre & Miquelon"},{code:"VC",name:"St. Vincent & Grenadines"},{code:"SD",name:"Sudan"},{code:"SR",name:"Suriname"},{code:"SJ",name:"Svalbard & Jan Mayen"},{code:"SE",name:"Sweden"},{code:"CH",name:"Switzerland"},{code:"SY",name:"Syria"},{code:"TW",name:"Taiwan"},{code:"TJ",name:"Tajikistan"},{code:"TZ",name:"Tanzania"},{code:"TH",name:"Thailand"},{code:"TL",name:"Timor-Leste"},{code:"TG",name:"Togo"},{code:"TK",name:"Tokelau"},{code:"TO",name:"Tonga"},{code:"T1",name:"Tor network (Cloudflare)"},{code:"TT",name:"Trinidad & Tobago"},{code:"TN",name:"Tunisia"},{code:"TR",name:"Türkiye"},{code:"TM",name:"Turkmenistan"},{code:"TC",name:"Turks & Caicos Islands"},{code:"TV",name:"Tuvalu"},{code:"UM",name:"U.S. Outlying Islands"},{code:"VI",name:"U.S. Virgin Islands"},{code:"UG",name:"Uganda"},{code:"UA",name:"Ukraine"},{code:"AE",name:"United Arab Emirates"},{code:"GB",name:"United Kingdom"},{code:"US",name:"United States"},{code:"XX",name:"Unknown (Cloudflare could not determine)"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VU",name:"Vanuatu"},{code:"VA",name:"Vatican City"},{code:"VE",name:"Venezuela"},{code:"VN",name:"Vietnam"},{code:"WF",name:"Wallis & Futuna"},{code:"EH",name:"Western Sahara"},{code:"YE",name:"Yemen"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}],ese="BR";function tse(t){if(!t)return!1;const e=Object.keys(t).sort();return e.length===3&&e[0]==="city"&&e[1]==="country"&&e[2]==="regionCode"}function sse(t){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return{city:typeof e.city=="string"?e.city:"",regionCode:typeof e.regionCode=="string"?e.regionCode:"",country:typeof e.country=="string"?e.country:""}}function nse(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function rb(t){const e=z.c(37),{id:s,options:n,value:i,placeholder:o,emptyMessage:l,onChange:a}=t,[c,d]=P.useState(!1);let u;if(e[0]!==n||e[1]!==i){let k;e[3]!==i?(k=w=>w.value===i,e[3]=i,e[4]=k):k=e[4],u=n.find(k),e[0]=n,e[1]=i,e[2]=u}else u=e[2];const h=u;let f;e[5]!==o||e[6]!==h?(f=h?r.jsx("span",{className:"truncate",children:h.label}):r.jsx("span",{className:"text-muted-foreground",children:o}),e[5]=o,e[6]=h,e[7]=f):f=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(Uf,{className:"size-4 shrink-0 opacity-50"}),e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==c||e[11]!==f?(p=r.jsx(ms,{asChild:!0,children:r.jsxs(he,{id:s,variant:"outline",role:"combobox","aria-expanded":c,className:"h-10 w-full justify-between font-normal",children:[f,m]})}),e[9]=s,e[10]=c,e[11]=f,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g={width:"var(--radix-popover-trigger-width)"},e[13]=g):g=e[13];let x;e[14]!==o?(x=r.jsx(Pi,{placeholder:o,className:"h-9"}),e[14]=o,e[15]=x):x=e[15];let b;e[16]!==l?(b=r.jsx(di,{children:l}),e[16]=l,e[17]=b):b=e[17];let v;if(e[18]!==a||e[19]!==n||e[20]!==i){let k;e[22]!==a||e[23]!==i?(k=w=>r.jsxs(Cs,{value:`${w.label} ${w.value}`,onSelect:()=>{a(w.value===i?"":w.value),d(!1)},children:[r.jsx("span",{className:"truncate",children:w.label}),r.jsx(qt,{className:ie("ml-auto size-4 shrink-0",i===w.value?"opacity-100":"opacity-0")})]},w.value),e[22]=a,e[23]=i,e[24]=k):k=e[24],v=n.map(k),e[18]=a,e[19]=n,e[20]=i,e[21]=v}else v=e[21];let L;e[25]!==v?(L=r.jsx(qs,{children:v}),e[25]=v,e[26]=L):L=e[26];let _;e[27]!==b||e[28]!==L?(_=r.jsxs(Ei,{children:[b,L]}),e[27]=b,e[28]=L,e[29]=_):_=e[29];let y;e[30]!==_||e[31]!==x?(y=r.jsx(bs,{className:"p-0",style:g,children:r.jsxs(hr,{children:[x,_]})}),e[30]=_,e[31]=x,e[32]=y):y=e[32];let S;return e[33]!==c||e[34]!==y||e[35]!==p?(S=r.jsxs(vs,{open:c,onOpenChange:d,children:[p,y]}),e[33]=c,e[34]=y,e[35]=p,e[36]=S):S=e[36],S}const ise=Zte.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),rse=E3.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function ik(t){const e=z.c(66),{schema:s,value:n,onChange:i,path:o,sandbox:l}=t,a=re();let c;e[0]!==n?(c=sse(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:u,regionCode:h,country:f}=d;let m;e[2]!==s.properties?(m=s.properties??{},e[2]=s.properties,e[3]=m):m=e[3];const p=m;let g;e[4]!==p.country?.title||e[5]!==a?(g=p.country?.title??a("sectionsEditor.locationField.countryDefault"),e[4]=p.country?.title,e[5]=a,e[6]=g):g=e[6];const x=g;let b;e[7]!==p.regionCode?.title||e[8]!==a?(b=p.regionCode?.title??a("sectionsEditor.locationField.regionDefault"),e[7]=p.regionCode?.title,e[8]=a,e[9]=b):b=e[9];const v=b;let L;e[10]!==p.city?.title||e[11]!==a?(L=p.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=a,e[12]=L):L=e[12];const _=L;let y;e[13]!==d||e[14]!==i?(y=j=>{i(nse(d,j))},e[13]=d,e[14]=i,e[15]=y):y=e[15];const S=y,k=f===ese;let w;if(e[16]!==u||e[17]!==_||e[18]!==f||e[19]!==x||e[20]!==S||e[21]!==k||e[22]!==o||e[23]!==h||e[24]!==v||e[25]!==l?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==a){let j;e[30]!==h?(j=U=>U.code===h,e[30]=h,e[31]=j):j=e[31];const N=E3.find(j),T=`${o}.country`;let C;e[32]!==s.title||e[33]!==a?(C=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=C):C=e[34];const V=l?.virtualMcpId;let A;e[35]!==s.description||e[36]!==C||e[37]!==V||e[38]!==T?(A=r.jsx(Gs,{htmlFor:T,label:C,description:s.description,virtualMcpId:V}),e[35]=s.description,e[36]=C,e[37]=V,e[38]=T,e[39]=A):A=e[39];const E=`${o}.country`;let D;e[40]!==x||e[41]!==E?(D=r.jsx(Ut,{htmlFor:E,className:"text-xs",children:x}),e[40]=x,e[41]=E,e[42]=D):D=e[42];const I=`${o}.country`;let R;e[43]!==a?(R=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=R):R=e[44];let $;e[45]!==a?($=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=$):$=e[46];let B;e[47]!==S?(B=U=>S({country:U,regionCode:"",city:""}),e[47]=S,e[48]=B):B=e[48];let M;e[49]!==f||e[50]!==I||e[51]!==R||e[52]!==$||e[53]!==B?(M=r.jsx(rb,{id:I,options:ise,value:f,placeholder:R,emptyMessage:$,onChange:B}),e[49]=f,e[50]=I,e[51]=R,e[52]=$,e[53]=B,e[54]=M):M=e[54];let O;e[55]!==D||e[56]!==M?(O=r.jsxs("div",{className:"space-y-1.5",children:[D,M]}),e[55]=D,e[56]=M,e[57]=O):O=e[57];let F;e[58]!==f||e[59]!==S||e[60]!==k||e[61]!==o||e[62]!==h||e[63]!==v||e[64]!==a?(F=f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ut,{htmlFor:`${o}.regionCode`,className:"text-xs",children:v}),k?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xte,{selected:h,onSelect:U=>S({regionCode:U===h?"":U,city:""})}),r.jsx(rb,{id:`${o}.regionCode`,options:rse,value:h,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:U=>S({regionCode:U,city:""})})]}):r.jsxs(r.Fragment,{children:[r.jsx(gt,{id:`${o}.regionCode`,type:"text",value:h,placeholder:a("sectionsEditor.locationField.regionCodePlaceholder"),onChange:U=>S({regionCode:U.target.value})}),r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=f,e[59]=S,e[60]=k,e[61]=o,e[62]=h,e[63]=v,e[64]=a,e[65]=F):F=e[65],w=r.jsxs("div",{className:"space-y-4",children:[A,O,F,f&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ut,{htmlFor:`${o}.city`,className:"text-xs",children:_}),r.jsx(gt,{id:`${o}.city`,type:"text",value:u,placeholder:k&&N?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:N.name}):a("sectionsEditor.locationField.cityPlaceholder"),onChange:U=>S({city:U.target.value})}),r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=u,e[17]=_,e[18]=f,e[19]=x,e[20]=S,e[21]=k,e[22]=o,e[23]=h,e[24]=v,e[25]=l?.virtualMcpId,e[26]=s.description,e[27]=s.title,e[28]=a,e[29]=w}else w=e[29];return w}function ose(t){const e=t.schema;if(!e?.properties)return null;const s=new Set(Object.keys(t.discriminators??{}));if(s.size===0)return e;const n={};for(const[i,o]of Object.entries(e.properties))s.has(i)||(n[i]=o);return Object.keys(n).length===0?null:{...e,properties:n}}function lse(t){const e=z.c(52),s=re(),{schema:n,value:i,onChange:o,path:l,label:a}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==i?(c=n.inlineUnionBranches??[],d=PS(i,c.map(ase)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const u=d,[h,f]=P.useState(u),[m,p]=P.useState(u);m!==u&&(p(u),f(u));const g=Math.min(h,c.length-1),x=c[g];let b;e[4]!==c||e[5]!==o?(b=R=>{const $=Number(R);f($),o({...c[$]?.discriminators??{}})},e[4]=c,e[5]=o,e[6]=b):b=e[6];const v=b;if(c.length===0)return null;let L;e[7]!==x?(L=x?ose(x):null,e[7]=x,e[8]=L):L=e[8];const _=L;let y;if(e[9]!==x?.schema?.properties||e[10]!==i){let R;e[12]!==x?.schema?.properties?(R=x?.schema?.properties??{},e[12]=x?.schema?.properties,e[13]=R):R=e[13],y=gee(i,Object.keys(R)),e[9]=x?.schema?.properties,e[10]=i,e[11]=y}else y=e[11];const S=y;let k;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(k=a&&r.jsx(Gs,{htmlFor:l,label:a,description:n.description,virtualMcpId:t.sandbox?.virtualMcpId}),e[14]=a,e[15]=l,e[16]=t.sandbox?.virtualMcpId,e[17]=n.description,e[18]=k):k=e[18];const w=String(g);let j;e[19]!==s?(j=s("sectionsEditor.inlineUnionField.selectPlaceholder"),e[19]=s,e[20]=j):j=e[20];let N;e[21]!==j?(N=r.jsx(Ns,{placeholder:j}),e[21]=j,e[22]=N):N=e[22];let T;e[23]!==l||e[24]!==N?(T=r.jsx(gs,{id:l,children:N}),e[23]=l,e[24]=N,e[25]=T):T=e[25];let C;if(e[26]!==c||e[27]!==s){let R;e[29]!==s?(R=($,B)=>r.jsx(It,{value:String(B),children:Lee($.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:B+1})},$.title),e[29]=s,e[30]=R):R=e[30],C=c.map(R),e[26]=c,e[27]=s,e[28]=C}else C=e[28];let V;e[31]!==C?(V=r.jsx(xs,{children:C}),e[31]=C,e[32]=V):V=e[32];let A;e[33]!==v||e[34]!==V||e[35]!==w||e[36]!==T?(A=r.jsxs(ps,{value:w,onValueChange:v,children:[T,V]}),e[33]=v,e[34]=V,e[35]=w,e[36]=T,e[37]=A):A=e[37];let E;e[38]!==A||e[39]!==k?(E=r.jsxs("div",{className:"space-y-1.5",children:[k,A]}),e[38]=A,e[39]=k,e[40]=E):E=e[40];let D;e[41]!==x||e[42]!==_||e[43]!==o||e[44]!==l||e[45]!==S||e[46]!==t||e[47]!==i?(D=x&&(tse(x.schema?.properties)?r.jsx(ik,{...t,schema:x.schema,onChange:R=>o({...S,...R,...x.discriminators??{}})}):_?r.jsx(Ri,{schema:_,value:i,onChange:R=>o({...R,...x.discriminators??{}}),basePath:l,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:t.meta,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,sandbox:t.sandbox,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection}):null),e[41]=x,e[42]=_,e[43]=o,e[44]=l,e[45]=S,e[46]=t,e[47]=i,e[48]=D):D=e[48];let I;return e[49]!==E||e[50]!==D?(I=r.jsxs("div",{className:"space-y-3",children:[E,D]}),e[49]=E,e[50]=D,e[51]=I):I=e[51],I}function ase(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const cse={lat:-21.9,lng:-41.42},Gm=1e5;let W0=null;function dse(t){return W0||(W0=new Promise((e,s)=>{if(typeof window>"u"){s(new Error("Google Maps requires a browser environment"));return}const n=window;if(n.google?.maps){e(n.google.maps);return}const i=()=>{const a=window.google?.maps;a?e(a):s(new Error("Google Maps script loaded without google.maps"))},o=document.querySelector("script[data-google-maps-loader]");if(o){o.addEventListener("load",i),o.addEventListener("error",()=>s(new Error("Failed to load Google Maps")));return}const l=document.createElement("script");l.src=`https://maps.googleapis.com/maps/api/js?key=${t}&v=weekly&libraries=maps`,l.async=!0,l.defer=!0,l.dataset.googleMapsLoader="true",l.addEventListener("load",i),l.addEventListener("error",()=>s(new Error("Failed to load Google Maps"))),document.head.appendChild(l)}),W0)}function use(t){if(typeof t!="string"||!t)return null;const e=t.split(",").map(Number),[s,n,i]=e;return!Number.isFinite(s)||!Number.isFinite(n)?null:{lat:s,lng:n,radius:Number.isFinite(i)?i:Gm}}function hse({schema:t,value:e,onChange:s,path:n,label:i,sandbox:o}){const l=WC().googleMapsApiKey,a=P.useRef(s);a.current=s;const c=P.useRef(use(e)),[d,u]=P.useState(null),h=P.useRef(null),f=m=>{if(!m||!l)return;const p={disposed:!1,circle:null,listeners:[]};return dse(l).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:cse,v=x?.radius??Gm,L=new g.Map(m,{center:b,zoom:v?Math.round(Math.log2(768e4/v))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),_=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:L,center:b,radius:v});p.circle=_;const y=()=>{const k=_.getCenter(),w=_.getRadius();k&&a.current(`${k.lat()},${k.lng()},${w}`)},S=k=>{k&&p.listeners.push(k)};S(L.addListener("click",k=>{k.latLng&&(_.setCenter({lat:k.latLng.lat(),lng:k.latLng.lng()}),_.getRadius()||_.setRadius(Gm),y())})),S(_.addListener("radius_changed",y)),S(_.addListener("dragend",y))},g=>{p.disposed||u(g instanceof Error?g.message:"Failed to load map")}),()=>{p.disposed=!0;for(const g of p.listeners)try{g?.remove()}catch{}if(p.listeners=[],p.circle){try{p.circle.setMap(null)}catch{}p.circle=null}}};return h.current||(h.current=f),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Gs,{htmlFor:n,label:i,description:t.description,virtualMcpId:o?.virtualMcpId}),l?d?r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:d}):r.jsx("div",{ref:h.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):r.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["The map picker is unavailable — set"," ",r.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const fse="oklch(0.65 0.15 160)",mse="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",rk="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",Ume="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function ob(t){return t.map(e=>e.label).join(`
|
|
541
|
-
`)}function lb(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function pse(t,e){const s=new Map;for(const n of t){const i=s.get(n.label);i?i.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function gse(t){return t.map((e,s)=>({...e,index:s}))}function ok(t){const e=z.c(19),{label:s,canDelete:n,dragging:i,onRename:o,onDuplicate:l,onDelete:a}=t,c=re(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=ie("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=u):u=e[1];let h;e[2]!==u?(h=r.jsx(Uc,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(_o,{className:"h-4 w-4 shrink-0",style:{color:fse}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==o||e[13]!==c?(p=!i&&r.jsxs(Xt,{children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:bse,onPointerDown:xse,children:r.jsx(Gn,{size:14})})}),r.jsxs(es,{align:"end",children:[o&&r.jsxs(Xe,{onClick:x=>{x.stopPropagation(),o()},children:[r.jsx(m6,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),r.jsxs(Xe,{onClick:x=>{x.stopPropagation(),l?.()},children:[r.jsx(dn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),r.jsxs(Xe,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[r.jsx(rn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=o,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==h||e[16]!==m||e[17]!==p?(g=r.jsxs(r.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function xse(t){return t.stopPropagation()}function bse(t){return t.stopPropagation()}function vse(t){const e=z.c(27),{entry:s,selected:n,canDelete:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:yse},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=h9(d);let g;e[2]!==m?(g=ki.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let L;e[7]!==o?(L=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o())},e[7]=o,e[8]=L):L=e[8];const _=p?"cursor-grabbing":"cursor-grab",y=n?rk:mse;let S;e[9]!==_||e[10]!==y?(S=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",_,y),e[9]=_,e[10]=y,e[11]=S):S=e[11];let k;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(k=r.jsx(ok,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=k):k=e[17];let w;return e[18]!==u||e[19]!==h||e[20]!==o||e[21]!==f||e[22]!==v||e[23]!==L||e[24]!==S||e[25]!==k?(w=r.jsx("div",{ref:f,style:v,...u,...h,onClick:o,onKeyDown:L,className:S,children:k}),e[18]=u,e[19]=h,e[20]=o,e[21]=f,e[22]=v,e[23]=L,e[24]=S,e[25]=k,e[26]=w):w=e[26],w}function yse(){return!1}function _se(t){const e=z.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=re(),m=n.length>1;let p;e[0]!==n?(p=()=>lb(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=P.useState(p),[b,v]=P.useState(null),[L,_]=P.useState(s),[y,S]=P.useState(n.length);let k;e[2]!==n?(k=()=>ob(n),e[2]=n,e[3]=k):k=e[3];const[w,j]=P.useState(k),N=P.useRef(!1),T=ob(n);L!==s?(_(s),S(n.length),j(T),x(lb(n))):(y!==n.length||w!==T)&&(S(n.length),j(T),x(fe=>pse(fe,n)));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:f9},e[5]=V):V=e[5];const A=Qu(ar(Kl,C),ar(Hl,V));let E;e[6]!==g?(E=g.map(Lse),e[6]=g,e[7]=E):E=e[7];const D=E;let I;e[8]!==g?(I=fe=>{const ae=String(fe.active.id);v(g.find(de=>de.id===ae)??null)},e[8]=g,e[9]=I):I=e[9];const R=I;let $;e[10]!==D||e[11]!==u?($=fe=>{v(null);const{active:ae,over:de}=fe;if(!de||ae.id===de.id)return;const X=D.indexOf(String(ae.id)),pe=D.indexOf(String(de.id));X===-1||pe===-1||(x(ye=>gse(Nl([...ye],X,pe))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),u(X,pe))},e[10]=D,e[11]=u,e[12]=$):$=e[12];const B=$;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const O=M;let F,U,K,q,W,G,Y,ee,ne,oe,Z,J,H;if(e[14]!==m||e[15]!==g||e[16]!==D||e[17]!==B||e[18]!==R||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==o||e[25]!==i||e[26]!==A||e[27]!==f){const fe=Ye=>{N.current||o(Ye)};Z="space-y-1 border-b p-2";let ae;e[41]!==f?(ae=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ae):ae=e[42];let de;e[43]!==ae?(de=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ae}),e[43]=ae,e[44]=de):de=e[44];let X;e[45]!==f?(X=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=X):X=e[46];let pe;e[47]===Symbol.for("react.memo_cache_sentinel")?(pe=r.jsx(Ht,{size:14}),e[47]=pe):pe=e[47];let ye;e[48]!==h||e[49]!==X?(ye=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":X,className:"size-6",onClick:h,children:pe})}),e[48]=h,e[49]=X,e[50]=ye):ye=e[50];let we;e[51]!==f?(we=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=we):we=e[52];let _e;e[53]!==we?(_e=r.jsx(Ke,{children:we}),e[53]=we,e[54]=_e):_e=e[54];let Pe;e[55]!==ye||e[56]!==_e?(Pe=r.jsxs(We,{children:[ye,_e]}),e[55]=ye,e[56]=_e,e[57]=Pe):Pe=e[57];let Se;e[58]!==f?(Se=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Se):Se=e[59];let Te;e[60]===Symbol.for("react.memo_cache_sentinel")?(Te=r.jsx(rn,{size:14}),e[60]=Te):Te=e[60];let ve;e[61]!==d||e[62]!==Se?(ve=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":Se,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Te})}),e[61]=d,e[62]=Se,e[63]=ve):ve=e[63];let ke;e[64]!==f?(ke=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=ke):ke=e[65];let Le;e[66]!==ke?(Le=r.jsx(Ke,{children:ke}),e[66]=ke,e[67]=Le):Le=e[67];let Ne;e[68]!==ve||e[69]!==Le?(Ne=r.jsxs(We,{children:[ve,Le]}),e[68]=ve,e[69]=Le,e[70]=Ne):Ne=e[70];let et;e[71]!==Pe||e[72]!==Ne?(et=r.jsxs("div",{className:"flex items-center gap-0.5",children:[Pe,Ne]}),e[71]=Pe,e[72]=Ne,e[73]=et):et=e[73],e[74]!==de||e[75]!==et?(J=r.jsxs("div",{className:"flex items-center justify-between",children:[de,et]}),e[74]=de,e[75]=et,e[76]=J):J=e[76],U=Zu,G=A,Y=Ig,ee=R,ne=B,oe=O,F=u9,q=D,W=d9,H="space-y-0.5",K=g.map(Ye=>r.jsx(vse,{entry:Ye,selected:Ye.index===i,canDelete:m,onSelect:()=>fe(Ye.index),onRename:l?()=>l(Ye.index):void 0,onDuplicate:()=>a(Ye.index),onDelete:()=>c(Ye.index)},Ye.id)),e[14]=m,e[15]=g,e[16]=D,e[17]=B,e[18]=R,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=o,e[25]=i,e[26]=A,e[27]=f,e[28]=F,e[29]=U,e[30]=K,e[31]=q,e[32]=W,e[33]=G,e[34]=Y,e[35]=ee,e[36]=ne,e[37]=oe,e[38]=Z,e[39]=J,e[40]=H}else F=e[28],U=e[29],K=e[30],q=e[31],W=e[32],G=e[33],Y=e[34],ee=e[35],ne=e[36],oe=e[37],Z=e[38],J=e[39],H=e[40];let se;e[77]!==K||e[78]!==H?(se=r.jsx("div",{className:H,children:K}),e[77]=K,e[78]=H,e[79]=se):se=e[79];let Q;e[80]!==F||e[81]!==q||e[82]!==W||e[83]!==se?(Q=r.jsx(F,{items:q,strategy:W,children:se}),e[80]=F,e[81]=q,e[82]=W,e[83]=se,e[84]=Q):Q=e[84];let ce;e[85]!==b||e[86]!==m?(ce=b?r.jsx("div",{className:ie("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",rk),children:r.jsx(ok,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=ce):ce=e[87];let te;e[88]!==ce?(te=_n.createPortal(r.jsx(c9,{dropAnimation:CS,children:ce}),document.body),e[88]=ce,e[89]=te):te=e[89];let le;e[90]!==U||e[91]!==G||e[92]!==Y||e[93]!==ee||e[94]!==ne||e[95]!==oe||e[96]!==Q||e[97]!==te?(le=r.jsxs(U,{sensors:G,collisionDetection:Y,onDragStart:ee,onDragEnd:ne,onDragCancel:oe,children:[Q,te]}),e[90]=U,e[91]=G,e[92]=Y,e[93]=ee,e[94]=ne,e[95]=oe,e[96]=Q,e[97]=te,e[98]=le):le=e[98];let ue;return e[99]!==Z||e[100]!==J||e[101]!==le?(ue=r.jsxs("div",{className:Z,children:[J,le]}),e[99]=Z,e[100]=J,e[101]=le,e[102]=ue):ue=e[102],ue}function Lse(t){return t.id}const wse=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Sse={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function j1(t){return $l(t)!==void 0}function D3(t,e){if(e){if(j1(e))return e;const s=Sse[e];if(s&&j1(s))return s}for(const[s,n]of wse)if(s.test(t)&&j1(n))return n;return"FilterLines"}function kse(t){return $l(t)??l8}function C1(t){const e=z.c(11),{iconName:s,size:n,className:i}=t,o=n===void 0?"md":n;let l;e[0]!==s?(l=kse(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o==="sm"?"size-7":"size-9",d=o==="sm"?16:18;let u;e[2]!==c||e[3]!==i?(u=ie("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let h;e[5]!==a||e[6]!==d?(h=r.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function Hme(t,e){return kQ(t,e).map(s=>{const n=e[s.blockKey]??{},i=Fw(NQ(s.blockKey),e,t);return{blockKey:s.blockKey,title:Cl(s.blockKey,n),description:Ic(i),iconName:D3(s.matcherResolveType)}})}const lk="Users03";function jse(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function Cse(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,o]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(o)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=Yo(l,t);s.push({resolveType:l,title:a.title??fs(l),description:a.description,iconName:D3(l,a.icon)})}return s}function Nse(t,e){if(!t)return lk;const s=e.find(n=>n.resolveType===t);return s?s.iconName:D3(t)}function Tse(t){const e=z.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:o,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=P.useState(!1),f=re(),p=(i?d.find(J=>J.blockKey===i):void 0)?.iconName??Nse(s,o),g=$l(p);let x;e[0]!==a||e[1]!==h?(x=J=>{a(J),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==h?(v=J=>{c?.(J),h(!1)},e[3]=c,e[4]=h,e[5]=v):v=e[5];const L=v;let _;e[6]!==h?(_=()=>h(!0),e[6]=h,e[7]=_):_=e[7];let y;e[8]!==g?(y=g&&r.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=y):y=e[9];let S;e[10]!==n?(S=r.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=S):S=e[11];let k;e[12]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(_s,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=k):k=e[12];let w;e[13]!==_||e[14]!==y||e[15]!==S?(w=r.jsxs("button",{type:"button",onClick:_,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[y,S,k]}),e[13]=_,e[14]=y,e[15]=S,e[16]=w):w=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let N;e[19]!==f?(N=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=N):N=e[20];let T;e[21]!==f?(T=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=T):T=e[22];let C;e[23]!==T?(C=r.jsx(Pi,{placeholder:T}),e[23]=T,e[24]=C):C=e[24];let V;e[25]!==f?(V=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=V):V=e[26];let A;e[27]!==V?(A=r.jsx(di,{children:V}),e[27]=V,e[28]=A):A=e[28];let E;e[29]!==f?(E=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=E):E=e[30];let D;e[31]!==f?(D=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=D):D=e[32];const I=`${E} ${D}`;let R;e[33]!==b?(R=()=>b(""),e[33]=b,e[34]=R):R=e[34];const $=!s&&!i&&"bg-accent/60";let B;e[35]!==$?(B=ie("gap-2.5",$),e[35]=$,e[36]=B):B=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(C1,{iconName:lk,size:"sm"}),e[37]=M):M=e[37];let O;e[38]!==f?(O=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=O):O=e[39];let F;e[40]!==O?(F=r.jsx("span",{className:"text-sm",children:O}),e[40]=O,e[41]=F):F=e[41];let U;e[42]!==f?(U=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=U):U=e[43];let K;e[44]!==U?(K=r.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[44]=U,e[45]=K):K=e[45];let q;e[46]!==F||e[47]!==K?(q=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,K]}),e[46]=F,e[47]=K,e[48]=q):q=e[48];let W;e[49]!==I||e[50]!==R||e[51]!==B||e[52]!==q?(W=r.jsxs(Cs,{value:I,onSelect:R,className:B,children:[M,q]}),e[49]=I,e[50]=R,e[51]=B,e[52]=q,e[53]=W):W=e[53];let G;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==o){let J;e[59]!==i||e[60]!==s||e[61]!==b?(J=H=>r.jsxs(Cs,{value:`${H.title} ${H.resolveType} ${H.description??""}`,onSelect:()=>b(H.resolveType),className:ie("gap-2.5",!i&&s===H.resolveType&&"bg-accent/60"),children:[r.jsx(C1,{iconName:H.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm",children:H.title}),H.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:H.description})]})]},H.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=J):J=e[62],G=o.map(J),e[54]=i,e[55]=s,e[56]=b,e[57]=o,e[58]=G}else G=e[58];let Y;e[63]!==W||e[64]!==G?(Y=r.jsxs(qs,{children:[W,G]}),e[63]=W,e[64]=G,e[65]=Y):Y=e[65];let ee;e[66]!==i||e[67]!==d||e[68]!==L||e[69]!==f?(ee=d.length>0&&r.jsx(qs,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(J=>r.jsxs(Cs,{value:`${J.title} ${J.blockKey} ${J.description??""}`,onSelect:()=>L(J.blockKey),className:ie("gap-2.5",i===J.blockKey&&"bg-accent/60"),children:[r.jsx(C1,{iconName:J.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate text-sm",children:J.title}),J.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.blockKey))}),e[66]=i,e[67]=d,e[68]=L,e[69]=f,e[70]=ee):ee=e[70];let ne;e[71]!==A||e[72]!==Y||e[73]!==ee?(ne=r.jsxs(Ei,{children:[A,Y,ee]}),e[71]=A,e[72]=Y,e[73]=ee,e[74]=ne):ne=e[74];let oe;e[75]!==u||e[76]!==h||e[77]!==N||e[78]!==C||e[79]!==ne||e[80]!==j?(oe=r.jsxs(ZA,{open:u,onOpenChange:h,title:j,description:N,className:"sm:max-w-lg",filter:jse,children:[C,ne]}),e[75]=u,e[76]=h,e[77]=N,e[78]=C,e[79]=ne,e[80]=j,e[81]=oe):oe=e[81];let Z;return e[82]!==oe||e[83]!==w?(Z=r.jsxs(r.Fragment,{children:[w,oe]}),e[82]=oe,e[83]=w,e[84]=Z):Z=e[84],Z}const Vse="website/sections/Rendering/Lazy.tsx";function tf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function R3(t){if(!tf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&zs(e)}function Ase(t){return t!=null}function Ym(t){if(t==null)return t;if(R3(t)){const e=t.section;return e==null?null:tf(e)?e:{}}return tf(t)?t:void 0}function Pse(t,e){return t===null?null:R3(e)?{...e,section:t}:t}function Kme(t){return{__resolveType:t}}function Wme(t,e){if(!Ase(e))return null;if(t){const s=Ym(e)??{};return{__resolveType:Vse,section:s}}return R3(e)?Ym(e)??null:tf(e)?e:null}const Ese="General";function Mc(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function ak(t,e){return t===Oo?Ese:e}function ck(t){const e=Vh(t),s=new Set,n=[];for(const i of e)Mc(i.resolveType)&&(oi(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:ak(i.resolveType,i.title),description:i.description})));return n}function I3(t){const e=Th(t),s=Rn(e,t),n=ck(s?.properties?.seo);return n.length>0?n:Dse(t)}function Dse(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const o of Object.keys(i)){if(!Mc(o))continue;const l=o.split("/").pop()?.replace(/\.tsx?$/,"")??o;s.push({resolveType:o,title:ak(o,l)})}return s}function dk(t){const e=I3(t),s=e.find(n=>n.resolveType===Oo);return s?s.resolveType:e[0]?.resolveType??Oo}function uk(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=Rn(s,t),i=ck(n?.properties?.seo);if(i.length>0)return i}return I3(t)}function Rse(t,e){const s=uk(t,e),n=s.find(i=>i.resolveType===Oo);return n?n.resolveType:s[0]?.resolveType??dk(t)}function Ise(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:dk(t)}function Mse(t,e,s){const n=s.__resolveType;return typeof n=="string"&&Mc(n)?n:Rse(t,e)}const $se=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),Oo="website/sections/Seo/SeoV2.tsx",Ose=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function su(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Bse(t){return typeof t.__resolveType=="string"&&Mc(t.__resolveType)?!0:Ose.some(e=>e in t)}function zse(t,e){for(const[s,n]of Object.entries(t)){if(!su(n))continue;const i=n,o=i.__resolveType;if(typeof o=="string"&&$se.has(o))continue;const l=i.seo;if(su(l)){const a=l;if(Bse(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Mse(e,i,a):typeof a.__resolveType=="string"&&Mc(a.__resolveType)?a.__resolveType:Oo}}}for(const[s,n]of Object.entries(t)){if(!su(n))continue;const i=n;if(typeof i.__resolveType=="string"&&Mc(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Fse(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function qme(t,e,s){if(e.kind==="site"){const c=zse(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?uk(s,c.blockData):void 0,build:d=>Fse(c,d)}:null}const n=t[e.pageKey];if(!su(n))return null;const i=n,o=i.seo,l=Ym(o),a=l&&su(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:o,seoResolveType:s?Ise(s,a):typeof a?.__resolveType=="string"?a.__resolveType:Oo,seoTypeOptions:s?I3(s):void 0,build:c=>({...i,seo:c===null?null:Pse(c,o)})}}const M3=["type","title","description","canonical","favicon","image","themeColor"],Use=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Hse=["jsonLD","title","description","noIndexing","configJsonLD"];function hk(t){return t===Oo||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Kse(t){switch(t){case"general":return M3;case"pdp":return Use;case"plp":return Hse;default:return null}}function fk(t,e){const s=Kse(hk(e));if(!s||!t.properties)return t;const n={};for(const i of s){const o=t.properties[i];o&&(n[i]=o)}return{...t,properties:n}}function Wse(){return M3.filter(t=>t!=="type")}function qse(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function Gse(t,e){return t[e]===void 0}function Yse(t){const e=z.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:o,formResetKey:l}=t,a=re(),d=fk(s,Oo).properties??{},u=Wse();let h;e[0]!==o?(h=!!o&&Object.keys(o).length>0,e[0]=o,e[1]=h):h=e[1];const f=h,[m,p]=P.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=P.useState(g);m!==l&&(p(l),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:Gse(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const L=v;let _;e[6]!==i||e[7]!==o||e[8]!==n?(_=(j,N)=>{b(C=>({...C,[j]:N}));const T={...n};if(N)delete T[j];else{const C=o?.[j];T[j]=C??(j==="type"?"website":"")}i(T)},e[6]=i,e[7]=o,e[8]=n,e[9]=_):_=e[9];const y=_,S="min-w-0 space-y-6",k=M3.map(j=>{const N=d[j];if(!N)return null;const T=f&&u.includes(j),C=T&&L(j),V=C?o?.[j]??n[j]:n[j],A=N.title??qse(j);return r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:ie(C&&"pointer-events-none opacity-60"),children:Pl({schema:N,value:V,onChange:E=>{C||i({...n,[j]:E})},path:j,label:A,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:Jse})}),T&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Mr,{id:`seo-use-default-${j}`,checked:C,onCheckedChange:E=>y(j,E)}),r.jsx(Ut,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let w;return e[10]!==l||e[11]!==k?(w=r.jsx("div",{className:S,children:k},l),e[10]=l,e[11]=k,e[12]=w):w=e[12],w}function Jse(){}function Qse(t){const e=z.c(18),{schema:s,resolveType:n,value:i,formResetKey:o,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(hk(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,e[1]=g):g=e[1];let x;return e[2]!==o||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=r.jsx(Yse,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:o}),e[2]=o,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let u;e[8]!==n||e[9]!==s?(u=fk(s,n),e[8]=n,e[9]=s,e[10]=u):u=e[10];const h=u;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=a??Xse;let p;return e[12]!==h||e[13]!==o||e[14]!==l||e[15]!==m||e[16]!==i?(p=r.jsx(Ri,{schema:h,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},o),e[12]=h,e[13]=o,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function Xse(){}function Zse(t){const e=z.c(16),{schema:s,value:n,onChange:i,meta:o,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=re();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=P.useState(u);let m;e[1]!==h||e[2]!==d?(m=h.length>0&&r.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[r.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:r.jsx(rm,{className:"size-3.5"})}),h.map((x,b)=>{const v=b===h.length-1,L=Sn(x);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,b+1)),title:L,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",v?"font-medium text-foreground":"text-muted-foreground"),children:L})]},`${L}-${b}`)})]}),e[1]=h,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==h||e[5]!==l||e[6]!==o||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=r.jsx(Ri,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:h,onBreadcrumbChange:f,meta:o,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=h,e[5]=l,e[6]=o,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=r.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Gme(t){const e=z.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:o,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:u,siteDefaultSeo:h,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const L=v;let _;e[2]!==s||e[3]!==L||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==o||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==u||e[15]!==h?(_=s&&n?u?r.jsx(Qse,{schema:s,resolveType:u,value:n,formResetKey:i,onChange:o,onBreadcrumbChange:l,siteDefaultSeo:h}):r.jsx(Ri,{schema:s,value:n,onChange:o,basePath:"",breadcrumbPath:L,onBreadcrumbChange:l,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=L,e[4]=m,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=o,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=u,e[15]=h,e[16]=_):_=e[16];const y=_;let S;e[17]!==c||e[18]!==y?(S=y??r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=y,e[19]=S):S=e[19];let k;return e[20]!==d||e[21]!==S?(k=r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,S]})}),e[20]=d,e[21]=S,e[22]=k):k=e[22],k}const Yme="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function Jme(t,e){return oX(t,e,Ic)}function Qme(t){const e=z.c(66),{pageKey:s,initialName:n,initialPath:i,onFieldChange:o}=t,l=re(),[a,c]=P.useState(n),[d,u]=P.useState(i),[h,f]=P.useState(s),[m,p]=P.useState(null),g=P.useRef(!1);h!==s&&(f(s),c(n),u(i),p(null));let x;e[0]!==i||e[1]!==d?(x=()=>{if(g.current){g.current=!1;return}const ee=d.trim();if(ee===i.trim()){u(i);return}p(ee)},e[0]=i,e[1]=d,e[2]=x):x=e[2];const b=x;let v;e[3]!==o||e[4]!==m?(v=()=>{m!==null&&(u(m),o("path",m),p(null))},e[3]=o,e[4]=m,e[5]=v):v=e[5];const L=v;let _;e[6]!==i?(_=()=>{u(i),p(null)},e[6]=i,e[7]=_):_=e[7];const y=_;let S;e[8]!==o?(S=ee=>{c(ee.target.value),o("name",ee.target.value)},e[8]=o,e[9]=S):S=e[9];let k;e[10]!==l?(k=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=k):k=e[11];let w;e[12]!==a||e[13]!==S||e[14]!==k?(w=r.jsx("input",{type:"text",value:a,onChange:S,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:k}),e[12]=a,e[13]=S,e[14]=k,e[15]=w):w=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=ee=>u(ee.target.value),e[16]=j):j=e[16];let N;e[17]!==i?(N=ee=>{ee.key==="Enter"?(ee.preventDefault(),ee.currentTarget.blur()):ee.key==="Escape"&&(ee.preventDefault(),g.current=!0,u(i),ee.currentTarget.blur())},e[17]=i,e[18]=N):N=e[18];let T;e[19]!==l?(T=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[19]=l,e[20]=T):T=e[20];let C;e[21]!==b||e[22]!==d||e[23]!==N||e[24]!==T?(C=r.jsx("input",{type:"text",value:d,onChange:j,onBlur:b,onKeyDown:N,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:T}),e[21]=b,e[22]=d,e[23]=N,e[24]=T,e[25]=C):C=e[25];const V=m!==null;let A;e[26]!==y?(A=ee=>{ee||y()},e[26]=y,e[27]=A):A=e[27];let E;e[28]!==l?(E=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[28]=l,e[29]=E):E=e[29];let D;e[30]!==E?(D=r.jsx(Po,{children:E}),e[30]=E,e[31]=D):D=e[31];const I=m??"";let R;e[32]!==i||e[33]!==l||e[34]!==I?(R=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:I}),e[32]=i,e[33]=l,e[34]=I,e[35]=R):R=e[35];let $;e[36]!==R?($=r.jsx(Eo,{children:R}),e[36]=R,e[37]=$):$=e[37];let B;e[38]!==D||e[39]!==$?(B=r.jsxs(Ao,{children:[D,$]}),e[38]=D,e[39]=$,e[40]=B):B=e[40];let M;e[41]!==l?(M=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[41]=l,e[42]=M):M=e[42];let O;e[43]!==M?(O=r.jsx(Ro,{children:M}),e[43]=M,e[44]=O):O=e[44];let F;e[45]!==L?(F=ee=>{ee.preventDefault(),L()},e[45]=L,e[46]=F):F=e[46];let U;e[47]!==l?(U=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[47]=l,e[48]=U):U=e[48];let K;e[49]!==F||e[50]!==U?(K=r.jsx(Io,{onClick:F,children:U}),e[49]=F,e[50]=U,e[51]=K):K=e[51];let q;e[52]!==O||e[53]!==K?(q=r.jsxs(Do,{children:[O,K]}),e[52]=O,e[53]=K,e[54]=q):q=e[54];let W;e[55]!==B||e[56]!==q?(W=r.jsxs(Vo,{children:[B,q]}),e[55]=B,e[56]=q,e[57]=W):W=e[57];let G;e[58]!==V||e[59]!==A||e[60]!==W?(G=r.jsx(To,{open:V,onOpenChange:A,children:W}),e[58]=V,e[59]=A,e[60]=W,e[61]=G):G=e[61];let Y;return e[62]!==C||e[63]!==G||e[64]!==w?(Y=r.jsxs("div",{className:"space-y-1",children:[w,C,G]}),e[62]=C,e[63]=G,e[64]=w,e[65]=Y):Y=e[65],Y}function Xme(t){const e=z.c(13),{onClick:s}=t,n=re();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(zf,{size:14}),e[2]=o):o=e[2];let l;e[3]!==s||e[4]!==i?(l=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:o})}),e[3]=s,e[4]=i,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=r.jsx(Ke,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=r.jsxs(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const ab=new WeakMap;function ene(t,e){let s=ab.get(e);s||(s=new Map,ab.set(e,s));let n=s.get(t);return n===void 0&&(n=Rn(t,e),s.set(t,n)),n}function tne(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function sne(t,e){return{__resolveType:e,variants:[{rule:Pc(),value:structuredClone(t)},{rule:Pc(),value:structuredClone(t)}]}}function nne(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>b3(n.rule));return s?s.value:e[e.length-1]?.value}function ine(t){const e=[...t.variants],s=e[e.length-1],n={rule:Pc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function rne(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function one(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function lne(t,e,s){return e<t?t-1:Math.min(t,s-1)}function ane(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[i]=n.splice(e,1);return i?(n.splice(s,0,i),{...t,variants:n}):t}function cne(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function cb(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const db=new WeakMap;function dne(t){let e=db.get(t);return e||(e=Cse(t),db.set(t,e)),e}function mk(t){const e=z.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,o=re(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=P.useState(0);if(!tne(l)){let B;e[0]!==o?(B=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=o,e[1]=B):B=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(zf,{size:14}),e[2]=M):M=e[2];let O;e[3]!==o?(O=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=o,e[4]=O):O=e[4];let F;return e[5]!==O?(F=r.jsx(Ke,{children:O}),e[5]=O,e[6]=F):F=e[6],r.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":B,onClick:()=>{a(sne(l,s)),h(0)},children:M})}),F]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==o?(g=(B,M)=>({index:M,label:Ic(B.rule)||o("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=o,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},L=v.__resolveType??"",_=b?.value,y=c?dne(c):[],S=L&&c?ene(L,c):null,{__resolveType:k,...w}=v,j=()=>{a(nne(f)),h(0)},N=()=>{const B=ine(f);a(B),h(B.variants.length-1)},T=B=>{const M=rne(f,B);M&&(a(M),h(lne(p,B,M.variants.length)))},C=B=>{const M=one(f,B);a(M),h(B+1)},V=(B,M)=>{const O=ane(f,B,M);a(O),p===B&&h(M)},A=B=>{const M=B?TQ(B,c):{__resolveType:Lg};a(cb(f,p,M))},E=B=>{const M=B,O=L?{...M,__resolveType:L}:{...M};a(cb(f,p,O))},D=B=>{a(cne(f,p,B))},I=`${d}-${f.__resolveType}`;let R;e[9]!==o?(R=o("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=o,e[10]=R):R=e[10];let $;return e[11]!==R?($=r.jsx(Ut,{className:"text-xs text-muted-foreground",children:R}),e[11]=R,e[12]=$):$=e[12],r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[r.jsx(_se,{listKey:I,variants:x,selectedIndex:p,onSelect:h,onDuplicate:C,onDelete:T,onRemoveAll:j,onReorder:V,onAdd:N}),r.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[$,r.jsx(Tse,{currentRt:L,currentLabel:Ic(v),matchers:y,onSelect:A}),S&&r.jsx("div",{className:"pt-1",children:r.jsx(Zse,{schema:S,value:w,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${L}`)})]}),n({...i,value:_,onChange:D})]})]})}const une="website/loaders/secret.ts";function nu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function hne(){return{__resolveType:une,name:"",encrypted:""}}function fne(t){const{value:e,...s}=t;return s}function N1(t){const e=z.c(53),{schema:s,value:n,onChange:i,label:o,path:l,sandbox:a}=t,c=re();if(typeof n=="string"||n==null&&!nu(n)){const N=typeof n=="string"?n:"",T=a?.virtualMcpId;let C;e[0]!==o||e[1]!==l||e[2]!==s.description||e[3]!==T?(C=r.jsx(Gs,{htmlFor:l,label:o,description:s.description,virtualMcpId:T}),e[0]=o,e[1]=l,e[2]=s.description,e[3]=T,e[4]=C):C=e[4];let V;e[5]!==c?(V=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=V):V=e[6];let A;e[7]!==i?(A=I=>i(I.target.value),e[7]=i,e[8]=A):A=e[8];let E;e[9]!==l||e[10]!==N||e[11]!==V||e[12]!==A?(E=r.jsx(gt,{id:l,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:V,onChange:A,className:"h-10"}),e[9]=l,e[10]=N,e[11]=V,e[12]=A,e[13]=E):E=e[13];let D;return e[14]!==C||e[15]!==E?(D=r.jsxs("div",{className:"space-y-2",children:[C,E]}),e[14]=C,e[15]=E,e[16]=D):D=e[16],D}let d;e[17]!==n?(d=nu(n)?n:hne(),e[17]=n,e[18]=d):d=e[18];const u=d,h=typeof u.name=="string"?u.name:"",f=typeof u.encrypted=="string"&&u.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==o||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=r.jsx(Gs,{htmlFor:m,label:o,description:s.description,virtualMcpId:p}),e[19]=o,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==u||e[27]!==i?(v=N=>i({...u,name:N.target.value}),e[26]=u,e[27]=i,e[28]=v):v=e[28];let L;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==v?(L=r.jsx(gt,{id:x,value:h,placeholder:b,onChange:v,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=v,e[33]=L):L=e[33];const _=`${l}-value`;let y;e[34]!==f||e[35]!==c?(y=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=y):y=e[36];let S;e[37]!==u||e[38]!==f||e[39]!==i?(S=N=>{const T=N.target.value;if(!T){i(f?fne(u):u);return}i({...u,value:T})},e[37]=u,e[38]=f,e[39]=i,e[40]=S):S=e[40];let k;e[41]!==y||e[42]!==S||e[43]!==_?(k=r.jsx(gt,{id:_,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:y,onChange:S,className:"h-10"}),e[41]=y,e[42]=S,e[43]=_,e[44]=k):k=e[44];let w;e[45]!==f||e[46]!==c?(w=f&&r.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=w):w=e[47];let j;return e[48]!==k||e[49]!==w||e[50]!==g||e[51]!==L?(j=r.jsxs("div",{className:"space-y-2",children:[g,L,k,w]}),e[48]=k,e[49]=w,e[50]=g,e[51]=L,e[52]=j):j=e[52],j}function mne(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),i=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],o=[],l=d=>{d?.type==="object"&&d.properties&&o.push(d)};for(const d of s){const u=d.schema;if(u&&(u.type==="array"&&l(u.items),u.properties))for(const h of Object.values(u.properties))h?.type==="array"&&l(h.items)}if(o.length===0)return;if(i.length===0)return o.length===1?o[0]:void 0;let a,c=-1;for(const d of o){const u=d.properties??{},h=i.filter(f=>f in u).length*2+(d.titleBy?1:0);h>c&&(c=h,a=d)}return c>=2?a:void 0}function pne(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,i]of Object.entries(e))n.startsWith("__")||(typeof i=="string"?s[n]={type:"string"}:typeof i=="number"?s[n]={type:"number"}:typeof i=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const gne=new Set(["__resolveType","@type"]);function xne(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function bne(t){if(_9(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function ub(t){if(t.type==="array"&&t.items)return t;const e=t.items??bne(t);return e?{...t,type:"array",items:e}:null}function vne(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function pk(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const i=Rn(n,s);return i?r.jsx(Ri,{schema:i,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function Pl(t){const{schema:e,value:s}=t;if(Gh(s)){const l=nX(s),a=ub(e);if(l!==null&&a)return r.jsx(K0,{...t,schema:a,value:l,onChange:c=>t.onChange(iX(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&_9(e)){const l=ub(e);if(l)return r.jsx(K0,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Gh(s)&&e.type==="block-ref"){const l=mne(e,s)??pne(s);if(l){const a={...e,type:"array",items:l};return r.jsx(K0,{...t,schema:a,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(xne(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},d=u=>Pl({...u,schema:c});return r.jsx(mk,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?r.jsx(tb,{...t},t.path):null}if(e.type==="inline-union")return r.jsx(lse,{...t},t.path);if(e.format==="image-uri")return r.jsx(Gte,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(Kte,{...t},t.path);if(e.format==="map")return r.jsx(hse,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return r.jsx(vte,{...t},t.path);if(e.format==="location")return r.jsx(ik,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(nee,{...t},t.path);if(e.type==="anyOf")return r.jsx(tb,{...t},t.path);if(nu(s)||e.format==="password"||s==null&&e.format==="password")return r.jsx(N1,{...t},t.path);if(!e.format&&!e.enum){const l=pk(t);if(l)return l}const n=s??vne(e.type,e.default);if(n==null)return nu(s)?r.jsx(N1,{...t},t.path):null;if(nu(n))return r.jsx(N1,{...t,value:n},t.path);const i={...t,value:n},o=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(o==="array"||Array.isArray(n))return r.jsx(K0,{...i},t.path);switch(o){case"boolean":return r.jsx(XZ,{...i},t.path);case"number":case"integer":return r.jsx(QZ,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?r.jsx(U0,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?r.jsx(U0,{...i},t.path):r.jsx(U0,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?r.jsx(tte,{...i},t.path):null;default:return r.jsx(U0,{...i},t.path)}}function yne(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Pl({...t,schema:e});const s=pk(t);return s||Pl(e?{...t,schema:e}:t)}function Ri({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}){const m=re(),p=t.properties;if(!p)return t.type==="inline-union"?Pl({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}):null;if(sX(e)&&p.variants){const C=p.variants.items?.properties?.value;return r.jsx(mk,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:V=>yne(V,C)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(C=>!gne.has(C)&&p[C]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const v=(C,V)=>{if(V===void 0){const{[C]:A,...E}=g;s(E);return}s({...g,[C]:V})},L=typeof g.__resolveType=="string"?g.__resolveType:void 0,_=x.filter(C=>{const V=p[C];return V!=null&&_c(V,g[C])}).length>1,y=Dee(x,p,g),S=i.length>0?Iee(x,p,g,i,a,l):null,k=S?p[S]:null,w=S&&k?[S]:x,j=S&&k?Eee(S,k,i,Su(S,x,p)):i,N=Pee(i,j),T=N.length>0&&o?C=>o([...N,...C]):o;return r.jsx("div",{className:"min-w-0 space-y-6",children:w.map(C=>{const V=p[C];if(!V)return null;const A=n?`${n}.${C}`:C,E=Su(C,x,p),D=Al(C,V),$=(N.length===0&&x.some(B=>{const M=p[B];return B!==C&&M!=null&&Al(B,M)===D})||N.length===0&&y.has(C))&&T?V.type==="block-ref"?B=>T(Vee(C,B)):B=>T(Tee(E,B)):T;return Pl({schema:V,value:g[C],onChange:B=>v(C,B),path:A,label:E,required:b.has(C),breadcrumbPath:j,onBreadcrumbChange:$,hasSiblingDrillDownFields:_,focused:S===C,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:L,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f})})})}function _ne(t){const e=z.c(3),{isPending:s,isError:n}=t;if(n){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[r.jsx(bn,{size:13}),"Couldn't save"]}),e[0]=o):o=e[0],o}if(s){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(lt,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=o):o=e[1],o}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[r.jsx(qt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const hb=3e4;function Lne(t,e,s,n){const i=new URL(`/deco/invoke/${e}`,t);return i.searchParams.set("__cb",n.toString(36)),i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",`run-${n.toString(36)}`),i.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),i.href}async function wne(t,{resolveType:e,props:s}){let n;try{n=await fetch(M7(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(hb)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${hb/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let o=null,l=!1;try{o=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&o&&typeof o=="object"&&"error"in o&&typeof o.error=="string"?o.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?o:i}function Sne(t){const e=z.c(2);let s;return e[0]!==t?(s={mutationFn:n=>wne(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function gk({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f,showRun:m=!0}){const p=Ts()?.taskId??null,g=re(),x=Kr(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=Rn(a.resolveType,i),L=!v&&Q$(a.resolveType,i),_=L?X$(c):null,y=v??_,[S,k]=P.useState(c),[w,j]=P.useState([]),[N,T]=P.useState(0),[C,V]=P.useState(!1),[A,E]=P.useState(null),[D,I]=P.useState(!1),[R,$]=P.useState(!1),[B,M]=P.useState(!1),O=A!==null,{save:F,flush:U,isPending:K}=Yw({orgSlug:t,virtualMcpId:e,branch:s}),q=Sne({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});P.useEffect(()=>()=>{U()},[]);const W=fS(l),G=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},ee=ce=>{k(ce),a.mode==="saved"&&F(a.blockKey,{__resolveType:a.resolveType,...ce})},ne=()=>{O?(E(null),V(!1),T(ce=>ce+1)):E(JSON.stringify(S,null,2))},oe=ce=>{const te=ce??"";try{const le=JSON.parse(te);if(le&&typeof le=="object"&&!Array.isArray(le)){V(!1),ee(le);return}V(!0)}catch{V(!0)}},Z=async ce=>{const te=V3(ce,o);if(te){ge.error(te);return}await u(ce,{__resolveType:a.resolveType,...S}),I(!1)},J=()=>{$(!0),q.mutate({resolveType:a.resolveType,props:S})},H=()=>{n&&window.open(Lne(n,a.resolveType,S,Date.now()),"_blank","noopener")},se=[a.title,...w],Q=ce=>{j(w.slice(0,ce)),T(te=>te+1)};return r.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:r.jsx(Pf,{size:14})}),r.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:se.map((ce,te)=>{const le=te===se.length-1,ue=Sn(ce);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[te>0&&r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>Q(te),title:ue,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",le?"font-medium text-foreground":"text-muted-foreground"),children:ue})]},`${ue}-${te}`)})}),a.mode==="saved"&&r.jsx(_ne,{isPending:K,isError:!1}),m&&r.jsxs(he,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:J,disabled:q.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:W}),children:[q.isPending?r.jsx(lt,{size:14,className:"animate-spin"}):r.jsx(wl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:W}),children:r.jsx(d2,{size:14})})}),r.jsx(Ke,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:W})})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:O?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:ne,"aria-label":g(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":O,children:O?r.jsx(Is,{size:14}):r.jsx(qo,{size:14})})}),r.jsx(Ke,{side:"bottom",children:g(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:W}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:G,singular:W})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:ie("relative min-h-0 flex-1",R&&B&&"hidden"),children:[r.jsx(Go,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[_&&y===_&&r.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:W})}),y?r.jsx(Ri,{schema:y,value:S,onChange:ce=>ee(ce),basePath:"",breadcrumbPath:w,onBreadcrumbChange:j,meta:i,decofile:o,onSaveReferencedBlock:h,sandbox:Y},N):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:L?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:W}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:W})})]})})}),A!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[C&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx($u,{language:"json",height:"100%",code:A,onChange:oe,onSave:ce=>{oe(ce),U()}})})]})]}),R&&r.jsx(kne,{singular:W,result:{isPending:q.isPending,error:q.error,data:q.data,hasRun:q.status!=="idle"},expanded:B,onToggleExpand:()=>M(ce=>!ce),onOpenInNewTab:n?H:void 0,onClose:()=>{$(!1),M(!1)}})]}),r.jsx(A3,{open:D,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:Z})]})}function kne(t){const e=z.c(54),{singular:s,result:n,expanded:i,onToggleExpand:o,onOpenInNewTab:l,onClose:a}=t,c=re();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const u=d,h=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==h?(f=ie("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:r.jsx(xn,{size:14})})}),r.jsx(Ke,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=l,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==i||e[13]!==c?(x=c(i?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=i,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==i?(b=i?r.jsx(nV,{size:14}):r.jsx(c6,{size:14}),e[15]=i,e[16]=b):b=e[16];let v;e[17]!==i||e[18]!==o||e[19]!==x||e[20]!==b?(v=r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:o,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=o,e[19]=x,e[20]=b,e[21]=v):v=e[21];let L;e[22]!==i||e[23]!==c?(L=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=L):L=e[24];let _;e[25]!==L?(_=r.jsx(Ke,{side:"bottom",children:L}),e[25]=L,e[26]=_):_=e[26];let y;e[27]!==_||e[28]!==v?(y=r.jsxs(We,{children:[v,_]}),e[27]=_,e[28]=v,e[29]=y):y=e[29];let S;e[30]!==c?(S=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=S):S=e[31];let k;e[32]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Is,{size:14}),e[32]=k):k=e[32];let w;e[33]!==a||e[34]!==S?(w=r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":S,children:k}),e[33]=a,e[34]=S,e[35]=w):w=e[35];let j;e[36]!==y||e[37]!==w||e[38]!==g?(j=r.jsxs("div",{className:"flex items-center gap-0.5",children:[g,y,w]}),e[36]=y,e[37]=w,e[38]=g,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==p?(N=r.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=N):N=e[42];let T;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(T=r.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?r.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[r.jsx(lt,{size:16,className:"animate-spin"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?r.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[r.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),r.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?r.jsx($u,{language:"json",height:"100%",code:u,readOnly:!0}):r.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=u,e[47]=s,e[48]=c,e[49]=T):T=e[49];let C;return e[50]!==N||e[51]!==T||e[52]!==f?(C=r.jsxs("div",{className:f,children:[N,T]}),e[50]=N,e[51]=T,e[52]=f,e[53]=C):C=e[53],C}function jne(t){const e=z.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,blockKey:c}=t,d=re();let u;e[0]!==i||e[1]!==s||e[2]!==n?(u={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=u):u=e[3];const h=n0(u);let f;e[4]!==h?(f=w3((y,S)=>h.mutate({blockKey:y,data:S})),e[4]=h,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=bS(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let y;e[9]!==d?(y=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=y):y=e[10];let S;return e[11]!==y?(S=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:y}),e[11]=y,e[12]=S):S=e[12],S}const v=`loader:${c}`;let L;e[13]!==c||e[14]!==g||e[15]!==b?(L={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=L):L=e[16];let _;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==o||e[22]!==x||e[23]!==h.isPending||e[24]!==m||e[25]!==v||e[26]!==L||e[27]!==n?(_=r.jsx(gk,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:"loaders",target:L,initialValue:x,isCreating:h.isPending,onCreate:Cne,onSaveReferencedBlock:m,showRun:!1},v),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=o,e[22]=x,e[23]=h.isPending,e[24]=m,e[25]=v,e[26]=L,e[27]=n,e[28]=_):_=e[28],_}async function Cne(){}const Nne="https://github.com/decocms/blocks";function Tne(){const t=z.c(14),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(iV,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=o):o=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(xn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==o?(a=r.jsx(he,{size:"sm",asChild:!0,children:r.jsxs("a",{href:Nne,target:"_blank",rel:"noreferrer",children:[o,l]})}),t[8]=o,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=r.jsx(Co,{className:"h-full w-full",image:s,title:n,description:i,actions:a}),t[10]=n,t[11]=i,t[12]=a,t[13]=c):c=t[13],c}function Vne(t){const e=z.c(15),{source:s,onRetry:n}=t,i=re();let o;e[0]!==s||e[1]!==i?(o=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=o):o=e[2];const l=o;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(bn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let u;e[8]!==n||e[9]!==d?(u=r.jsx(he,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=u):u=e[10];let h;return e[11]!==l||e[12]!==c||e[13]!==u?(h=r.jsx(Co,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}function zr(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Ane=P.lazy(()=>jn(()=>import("./sections-editor-B1dtTQTT.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,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.SectionsEditor})));function fb(t){const e=z.c(47),{virtualMcpId:s,externalSelection:n}=t,i=n===void 0?null:n,{org:o}=Fe(),{currentBranch:l,taskId:a}=un(),c=Qn(),d=Ul(),u=_S(),h=c.lifecycle.phase==="running",f=d.previewUrl;let m;e[0]!==l||e[1]!==o||e[2]!==f||e[3]!==a||e[4]!==s?(m=l?{orgSlug:o.slug,virtualMcpId:s,branch:l,threadId:a??null,previewUrl:f}:null,e[0]=l,e[1]=o,e[2]=f,e[3]=a,e[4]=s,e[5]=m):m=e[5];const p=m;let g;e[6]!==h?(g={fetchEnabled:h},e[6]=h,e[7]=g):g=e[7];const x=Qf(p,g);let b;e[8]!==h?(b={fetchEnabled:h},e[8]=h,e[9]=b):b=e[9];const v=Xf(p,b),L=Hw({lifecyclePhase:c.lifecycle.phase,decofile:Wh(x),meta:Wh(v),hasEditableContent:t9(x.data,v.data),fastPreviewActive:Cn(s).runtime==="cms"});if(L.kind==="loading"){let I;return e[10]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(zr,{}),e[10]=I):I=e[10],I}if(L.kind==="empty"){let I;return e[11]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(Tne,{}),e[11]=I):I=e[11],I}if(L.kind==="error"){let I;e[12]!==x||e[13]!==d||e[14]!==v||e[15]!==L.source?(I=()=>{if(L.source==="sandbox"){d.retry();return}Promise.all([x.refetch(),v.refetch()])},e[12]=x,e[13]=d,e[14]=v,e[15]=L.source,e[16]=I):I=e[16];const R=I;let $;return e[17]!==R||e[18]!==L.source?($=r.jsx(Vne,{source:L.source,onRetry:R}),e[17]=R,e[18]=L.source,e[19]=$):$=e[19],$}const _=u.state.target;if(_?.kind==="loader"&&x.data&&v.data){const I=l??"",R=f??null;let $;return e[20]!==x.data||e[21]!==v.data||e[22]!==o.slug||e[23]!==I||e[24]!==R||e[25]!==_.key||e[26]!==s?($=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(jne,{orgSlug:o.slug,virtualMcpId:s,branch:I,previewUrl:R,meta:v.data,decofile:x.data,blockKey:_.key})}),e[20]=x.data,e[21]=v.data,e[22]=o.slug,e[23]=I,e[24]=R,e[25]=_.key,e[26]=s,e[27]=$):$=e[27],$}let y;e[28]!==l||e[29]!==o.slug||e[30]!==_||e[31]!==s?(y=_||!l?null:y3(v3(o.slug,s,l)),e[28]=l,e[29]=o.slug,e[30]=_,e[31]=s,e[32]=y):y=e[32];const S=y;let k="/",w=null,j=null;_?.kind==="page"?(k=_.path,w=_.key):_?.kind==="section"?j=_.key:S&&(k=S.path,w=S.pageKey);const N=w?`page:${w}`:j?`section:${j}`:`path:${k}`;let T;e[33]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})}),e[33]=T):T=e[33];const C=l??"",V=f??void 0,A=j?null:i,E=!!w&&u.state.editSeoPageKey===w;let D;return e[34]!==j||e[35]!==w||e[36]!==k||e[37]!==N||e[38]!==o.slug||e[39]!==E||e[40]!==C||e[41]!==V||e[42]!==A||e[43]!==s||e[44]!==u.consumeEditSeo||e[45]!==u.setVariantOverride?(D=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(P.Suspense,{fallback:T,children:r.jsx(Ane,{orgSlug:o.slug,virtualMcpId:s,branch:C,previewReady:!0,previewUrl:V,currentPath:k,activePageBlockKey:w,activeGlobalBlockKey:j,externalSelection:A,initialEditSeo:E,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride},N)})}),e[34]=j,e[35]=w,e[36]=k,e[37]=N,e[38]=o.slug,e[39]=E,e[40]=C,e[41]=V,e[42]=A,e[43]=s,e[44]=u.consumeEditSeo,e[45]=u.setVariantOverride,e[46]=D):D=e[46],D}function Pne(t,e){return t===e?"preview":e}function Ene(t){return t.autoOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const Dne=500,Rne={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},mb=1,T1=["desktop","mobile","tablet"],pb={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function gb(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Ine(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.searchParams.set("__deco_ssr","1"),e.href}catch{return t}}function q0(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function V1(t,e){try{return new URL(t,e).href}catch{return null}}function Mne(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),o=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let u=40;return d===0?u+=30:/[\s/-]/.test(c[d-1]??"")&&(u+=20),u+=Math.round(s.length/c.length*20),u};let a=Math.max(l(n),l(i));return o.at(-1)===s?a=Math.max(a,95):o.includes(s)&&(a=Math.max(a,90)),a}function $ne(t){const{onOpen:e}=t,[s,n]=P.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function One(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Bne({virtualMcpId:t}){const e=re(),s=qc(),n=zo(),i=LQ(),o=Yt(),{currentBranch:l,taskId:a}=un(),c=_S(),d=xe=>{o({to:".",search:De=>({...De,main:xe}),replace:!0})},[u,h]=P.useState("preview"),[f,m]=P.useState(!1),[p,g]=P.useState("desktop"),[x,b]=P.useState(null),[v,L]=P.useState(null),_=P.useRef(null),y=P.useRef(null),[S,k]=P.useState({width:0,height:0}),[w,j]=P.useState(null),[N,T]=P.useState(!1),[C,V]=P.useState(""),A=P.useRef(null),[E,D]=P.useState(!1),[I,R]=P.useState(),[$,B]=P.useState(null),[M,O]=P.useState(null),[F,U]=P.useState(null),[K,q]=P.useState("/"),[W,G]=P.useState(null),[Y,ee]=P.useState({}),[ne,oe]=P.useState(!1),Z=P.useRef(null),J=()=>{oe(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>oe(!1),15e3)},H=()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),oe(!1)},{org:se}=Fe(),Q=Qn(),ce=Ul(),te=ce.vmEntry,le=ce.previewUrl,ue=Q.lifecycle.phase,fe=ue==="running",ae=s;vS({orgSlug:se.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:ae});const de=null,X=Kr(),pe=X?.entity?.id===t?o2(X.entity.metadata):null,ye=Cn(t),we=X?.entity?.id===t&&ye.runtime==="cms",_e=ye.projectDefault==="cms",Pe=RQ({sandboxUrl:le,previewServerUrl:pe,fastPreviewActive:we}),Se=t&&l?{orgSlug:se.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:le}:null,Te=Qf(Se,{fetchEnabled:fe}),ve=Xf(Se,{fetchEnabled:fe}),ke=Te.data,Le=ve.data,Ne=`${t}:${l??""}`,[et,Ye]=P.useState(null),ze=Hw({lifecyclePhase:ue,decofile:Wh(Te),meta:Wh(ve),hasEditableContent:t9(ke,Le),fastPreviewActive:we,frameworkKnownMissing:et===Ne});ze.kind==="empty"&&ze.reason==="framework-missing"&&et!==Ne&&Ye(Ne);const Me=ze.kind==="content",at=t&&l?{orgSlug:se.slug,virtualMcpId:t,branch:l}:null,Ze=zQ(at),it=ke?Ph(ke).sort((xe,De)=>xe.name.localeCompare(De.name)):[],rt=ke&&Le?Tg(ke,Le):[],dt=ke&&Le?xS(Le,ke,"loaders"):[],nt=wo,Re=C?(()=>{const xe=C.toLowerCase();return it.map(De=>({page:De,score:Mne(De.name,De.path,xe)})).filter(({score:De})=>De>0).sort((De,vt)=>vt.score-De.score||De.page.path.length-vt.page.path.length).map(({page:De})=>De)})():it,ft=rt.filter(xe=>{if(!C)return!0;const De=C.toLowerCase();return xe.name.toLowerCase().includes(De)||xe.key.toLowerCase().includes(De)||xe.resolveType.toLowerCase().includes(De)}),ut=dt.filter(xe=>{if(!C)return!0;const De=C.toLowerCase();return xe.title.toLowerCase().includes(De)||xe.key.toLowerCase().includes(De)||xe.resolveType.toLowerCase().includes(De)}),be=M?dt.find(xe=>xe.key===M)??null:null,qe=$||M?null:wm(it,K,W),tt=$?$.name:be?.title??qe?.name,Ue=qe?.key??null,Lt=qe?.path??null,wt=(Ue?Y[Ue]:void 0)??{},ht=jr(K,wt),Tt={};if(fe&&le&&Le&&ke){const xe=mZ(Le,"loaders"),De=Ue?ke[Ue]:void 0,vt=$X(De,ke,ws=>xe.has(ws)),Vt=EX(vt);for(const ws of Nh(K)){if(ws.type!=="param")continue;const zn=VX(K,ws.name,vt),vn=IX(zn,xe,Vt);vn.length>0&&(Tt[ws.name]=vn)}}const $e=t&&l?{orgSlug:se.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,ct=ke&&Ue?sS(ke,Ue,0):[],kt=ke?Qw(ct,ke):[],xt=kt.map(xe=>xe.isSavedBlock?xe.label:""),yt=kt.map(xe=>xe.isSavedBlock?"global":xe.isMultivariate?"variant":"normal"),me=ct.map(xe=>Hm(xe,ke??{})),Ae=P.useRef(null),Oe=P.useRef(null),je=Q.status.state==="paused",ot=Q.phase,mt=oS({claimPhase:ot,lifecycle:Q.lifecycle}),$t=ce.previewState,At=ce.userStopped,hn=Fu(X?.entity?.id===t?X.entity.metadata?.ui?.layout??null:null),Ot=g3(se.slug,t??"",l??""),{url:As}=qw(we&&t&&l?{orgSlug:se.slug,virtualMcpId:t,branch:l,previewServerUrl:pe??null,path:ht}:null),$n=_e&&ye.runtime==="sandbox",_t=dQ({previewState:$t,progressStatus:mt.status,previewServerUrl:pe,fastPreviewActive:we,fastPreviewReady:!!As,codingSession:$n}),Fs=_t.mode!=="none",fn=_t.mode==="production"&&_t.iframeBase?q0(_t.iframeBase):null,ln=!s,mn=_t.mode==="production"?fn:q0(le),Ce=Ine(_t.mode==="sandbox"?_1(gb(F??V1(ht,_t.iframeBase)??_t.iframeBase,p),c.state.variantOverride??[]):_t.mode==="production"&&ln?_1(gb(Ww(F??As??V1(ht,_t.iframeBase)??_t.iframeBase,_t.showWakingPill?DQ:null),p),c.state.variantOverride??[]):null);P.useEffect(()=>{},[s,fn,w]);const st="sandbox.preview.openInNewTab",Dt=As??(_t.iframeBase?V1(ht,_t.iframeBase):null),Ls=_t.mode==="production"?Dt?_1(Dt,c.state.variantOverride??[]):null:Ce??_t.iframeBase,Js=async()=>{const xe=Ls;if(xe){window.open(xe,"_blank","noopener");return}},an=t&&l?v3(se.slug,t,l):null,On=xe=>{an&&CX(an,xe)},cs=c.state.target;P.useEffect(()=>{if(!(!cs||!Pe||!Le))if(cs.kind==="page"){const xe=Y[cs.key]??{};Oe.current=jr(cs.path,xe),B(null),O(null),U(null),G(cs.key),q(cs.path),On({path:cs.path,pageKey:cs.key,params:xe})}else if(cs.kind==="loader")Oe.current=null,B(null),O(cs.key),U(null);else{const xe=rt.find(De=>De.key===cs.key);if(xe){Oe.current=null;const De=Th(Le);O(null),B(xe),U(D5(Pe,De,xe.key))}}},[cs,Pe,Le,Y]),P.useEffect(()=>{!Ue||Lt===null||cs?.kind==="page"&&cs.key===Ue&&cs.path===Lt||c.selectTarget({kind:"page",key:Ue,path:Lt})},[Ue,Lt,cs]);const[fr,Wr]=P.useState(null);if($t.kind==="iframe"&&fr!==$t.previewUrl){const xe=fr!==null;Wr($t.previewUrl);const De=an?y3(an):null;if(De){if(Oe.current=jr(De.path,De.params),q(De.path),G(De.pageKey),U(null),B(null),O(null),De.pageKey&&Object.keys(De.params).length>0){const vt=De.pageKey;ee(Vt=>({...Vt,[vt]:De.params}))}}else xe&&(Oe.current=null,q("/"),U(null),G(null),B(null),O(null))}Ae.current=Ce;const Ql=mQ({iframeRef:_,src:_t.mode==="sandbox"?Ce:null,active:_t.mode==="sandbox"}),mr=P.useRef(null);P.useEffect(()=>{if(!As||!Ce||mr.current===As)return;mr.current=As;const xe=_.current;xe&&xe.getAttribute("src")!==Ce&&(J(),xe.src=Ce)},[As,Ce]);const qr=!!t&&!!l&&!Q.notFound&&!At&&!je&&(ot?.kind==="ready"||ue!=="idle"),Bn=_t.mode!=="sandbox"&&u==="visual"?"preview":u;P.useEffect(()=>{const xe=mn;if(!xe)return;const De=vt=>{if(vt.origin===xe){if(vt.data?.type==="visual-editor::element-clicked"){const Vt=HQ.safeParse(vt.data.payload);Vt.success&&b(Vt.data)}else if(vt.data?.type==="cms-editor::section-clicked"){const Vt=qQ.safeParse(vt.data.payload);Vt.success&&L({index:Vt.data.sectionIndex,seq:Vt.data.clickSeq})}}};return window.addEventListener("message",De),()=>window.removeEventListener("message",De)},[mn]),P.useEffect(()=>{if(!N)return;const xe=De=>{A.current?.contains(De.target)||(T(!1),V(""))};return document.addEventListener("pointerdown",xe),()=>document.removeEventListener("pointerdown",xe)},[N]);const pr=()=>{const xe=_.current?.contentWindow,De=q0(le);!xe||!De||xe.postMessage({type:"visual-editor::activate",script:KQ},De)},Gr=()=>{const xe=_.current?.contentWindow,De=q0(le);!xe||!De||xe.postMessage({type:"visual-editor::deactivate"},De)},Xo=()=>{const xe=_.current?.contentWindow,De=mn;!xe||!De||(xe.postMessage(_t.mode==="production"?{type:"editor::inject",args:{script:M5}}:{type:"visual-editor::activate",script:M5},De),xe.postMessage({type:"cms-editor::set-labels",labels:xt,kinds:yt,keys:me},De))},Yr=()=>{const xe=_.current?.contentWindow,De=mn;!xe||!De||xe.postMessage({type:"cms-editor::deactivate"},De)},Xn=xe=>{const De=u;!n&&xe!==De&&(xe==="blocks"?y.current?.resize("30%"):y.current?.collapse()),h(xe),b(null),L(null),xe!=="blocks"&&O(null),De==="visual"&&Gr(),xe==="visual"&&pr(),De==="blocks"&&xe!=="blocks"&&Yr(),xe==="blocks"&&Xo()},gr=xe=>{m(!0),Xn(Pne(u,xe))},Jr=Ene({autoOpen:hn==="auto",blocksReady:Me,autoOpenResolved:f,editingMode:u}),Qr=()=>{m(!0),Xn("blocks")},Xr=()=>{if(!_.current||!Ce)return;J();const xe=_.current;xe.src=Ce};wO(()=>{const xe=_.current;if(!xe)return;J();const De=document.activeElement,vt=xe.tabIndex;xe.tabIndex=-1,xe.style.pointerEvents="none",xe.blur(),One(xe,Ae.current);let Vt;const ws=()=>{clearTimeout(Vt),xe.tabIndex=vt,xe.style.pointerEvents="";const zn=document.activeElement;(!zn||zn===document.body||zn===xe)&&De?.focus(),xe.removeEventListener("load",ws)};xe.addEventListener("load",ws),Vt=setTimeout(ws,3e3)});const Zr=()=>{const xe=T1.indexOf(p);g(T1[(xe+1)%T1.length])},eo=async()=>{let xe=null;try{xe=_.current?.contentWindow?.location?.href??null}catch{}const De=xe??Ce??le;if(De)try{await navigator.clipboard.writeText(De),ge.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{ge.error(e("sandbox.preview.failedToCopyUrl"))}},D9=pQ({iframeBase:_t.iframeBase,resolvedPath:ht,activeGlobalSectionName:$?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Ii=xe=>{const De=Y[xe.key]??{},vt=jr(xe.path,De);($||nt(vt)!==nt(ht))&&J(),Oe.current=vt,B(null),O(null),U(null),L(null),G(xe.key),q(xe.path),On({path:xe.path,pageKey:xe.key,params:De}),c.selectTarget({kind:"page",key:xe.key,path:xe.path})},el=(xe,De)=>{if(!Ue)return;const vt=Ue,Vt={...wt,[xe]:De};Oe.current=jr(K,Vt),ee(ws=>({...ws,[vt]:Vt})),On({path:K,pageKey:vt,params:Vt})},to=xe=>{if(!Pe||!Le){ge.error(e("sandbox.preview.previewMetadataNotReady"));return}J(),Oe.current=null;const De=Th(Le),vt=D5(Pe,De,xe.key);B(xe),O(null),U(vt),L(null),c.selectTarget({kind:"section",key:xe.key})},so=xe=>{B(null),O(xe.key),U(null),Xn("blocks"),c.selectTarget({kind:"loader",key:xe.key})},no=async({name:xe,path:De,templateKey:vt})=>{if(!t||!l)return;const Vt=jg(De);if(Vt){R(Vt);return}const ws=De.trim().startsWith("/")?De.trim():`/${De.trim()}`;if(it.some(vn=>nt(vn.path)===nt(ws))){R(e("sandbox.preview.pageAlreadyExists",{path:ws}));return}let zn;if(vt&&(zn=ke?.[vt],!zn)){R(e("sandbox.preview.templateNoLongerExists"));return}R(void 0);try{const vn=await Ze.mutateAsync({name:xe,path:ws,template:zn});D(!1),ge.success(e("sandbox.preview.pageCreated",{name:xe})),await Yc(Dne),Ii({key:vn.key,name:vn.name,path:vn.path}),Xn("blocks")}catch(vn){R(vn instanceof Error?vn.message:e("sandbox.preview.failedToCreatePage"))}},Mi=Fs&&(qr||_t.mode==="production"),xr=u==="blocks",br=GQ({showPreviewToolbar:Mi,blocksState:ze}),$i=br&&hn!=="off"?r.jsx(Ow,{title:e("sandbox.preview.cms"),tooltip:e(xr?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:rV},active:xr,onClick:()=>gr("blocks"),testId:"preview-blocks-toggle",dataTour:So.edit}):null,vr=Mi?r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(go,{onClick:Xr,"aria-label":e("sandbox.preview.refresh"),children:r.jsx(Dn,{size:16})})}),r.jsx(Ke,{side:"bottom",children:e("sandbox.preview.refresh")})]}),br&&r.jsxs("div",{ref:A,className:"relative min-w-0 w-64 shrink",children:[r.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[r.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>T(xe=>!xe),children:[$&&r.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[r.jsx(Rr,{size:11}),"Global"]}),be&&r.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx(jc,{size:11}),e("sandbox.preview.loaderBadge")]}),r.jsx("span",{className:ie("text-[13px] font-medium text-foreground",tt==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:tt??D9}),!$&&!M&&tt!=null&&K&&r.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:Nh(K).map((xe,De)=>{if(xe.type==="text")return r.jsx("span",{className:ie(De===0?"min-w-0 truncate":"shrink-0"),children:xe.text},`text-${De}`);const vt=Tt[xe.name];return vt&&$e?r.jsx(ZX,{sources:vt,template:K,paramName:xe.name,value:wt[xe.name]??"",sandboxRef:$e,onCommit:Vt=>el(xe.name,Vt)},`${Ue}:${xe.name}`):r.jsx(dZ,{name:xe.name,value:wt[xe.name]??"",onCommit:Vt=>el(xe.name,Vt)},`${Ue}:${xe.name}`)})})]}),r.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>T(xe=>!xe),"aria-label":e("sandbox.preview.choosePage"),children:r.jsx(_s,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",N&&"rotate-180")})})]}),N&&r.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[r.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[r.jsx(Hf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),r.jsx("input",{type:"text",value:C,onChange:xe=>V(xe.target.value),onKeyDown:xe=>{if(xe.key!=="Enter")return;const De=C.trim();if(!De)return;const vt=Re.find(Vt=>nt(Vt.path)===nt(De));vt&&(xe.preventDefault(),T(!1),V(""),Ii(vt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),r.jsx("div",{className:"p-1.5 border-b",children:r.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:xe=>{xe.preventDefault(),T(!1),V(""),R(void 0),D(!0)},children:[r.jsx(Ht,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),Re.length===0&&ft.length===0&&ut.length===0?r.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:it.length===0&&rt.length===0&&dt.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):r.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[Re.length>0&&r.jsx("div",{className:"p-1.5",children:Re.map(xe=>r.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),T(!1),V(""),Ii(xe)},children:[r.jsx(_o,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.path})]},xe.key))}),ft.length>0&&r.jsxs("div",{className:ie("p-1.5",Re.length>0&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),ft.map(xe=>r.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),T(!1),V(""),to(xe)},children:[r.jsx(Rr,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},xe.key))]}),ut.length>0&&r.jsxs("div",{className:ie("p-1.5",(Re.length>0||ft.length>0)&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),ut.map(xe=>r.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),T(!1),V(""),so(xe)},children:[r.jsx(jc,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.title}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},xe.key))]})]})]})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(go,{"aria-label":e(st),onClick:()=>{Js()},children:r.jsx(xn,{size:16})})}),r.jsx(Ke,{side:"bottom",children:e(st)})]})]}):null,io=Mi?r.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[$i,$i&&r.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),vr]}):null,Oi=Mi?r.jsx("div",{className:"flex shrink-0 items-center",children:r.jsxs(Xt,{children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:r.jsx(Gn,{size:14})})}),r.jsxs(es,{align:"end",className:"w-44",children:[r.jsxs(Xe,{onClick:eo,children:[r.jsx(dn,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),ke&&Le&&r.jsxs(r.Fragment,{children:[r.jsx(Pr,{}),Ue&&r.jsxs(Xe,{onClick:()=>{c.editSeo({kind:"page",key:Ue,path:K}),Xn("blocks")},children:[r.jsx(m2,{size:14}),e("sandbox.preview.editSeo")]}),Ue&&r.jsxs(Xe,{onClick:()=>{try{d(wT(C$(Ue)))}catch{ge.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[r.jsx(qo,{size:14}),e("sandbox.preview.viewJson")]})]}),de,r.jsx(Pr,{}),r.jsxs(Xe,{onClick:()=>lQ(e),children:[r.jsx(oV,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,cd=_t.mode==="sandbox",fi=Rne[p],ro=p==="desktop"&&(S.width===0||S.width>=fi.width+2*mb),tl=ro?1:Math.min(S.width>0?S.width/(fi.width+2*mb):1,1),dd=ro?{width:"100%",height:"100%"}:{width:`${fi.width}px`,height:S.height>0?`${S.height/tl}px`:`${fi.height}px`,transform:`scale(${tl})`,transformOrigin:"top center"},Xl=Fs?r.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:r.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[cd&&r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(go,{onClick:()=>gr("visual"),"aria-pressed":u==="visual","aria-label":e("sandbox.preview.visualEditor"),active:u==="visual",className:"rounded-full","data-tour":So.visualEditor,children:r.jsx(bx,{size:16})})}),r.jsx(Ke,{side:"top",children:e("sandbox.preview.visualEditor")})]}),r.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(go,{onClick:Zr,"aria-label":e(pb[p]),className:"rounded-full","data-tour":So.device,children:r.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[p==="mobile"&&r.jsx(lV,{size:16}),p==="tablet"&&r.jsx(aV,{size:16}),p==="desktop"&&r.jsx(cV,{size:16})]},p)})}),r.jsx(Ke,{side:"top",children:e(pb[p])})]})]})}):null,oo=(n||!!M)&&Bn==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[Jr&&r.jsx($ne,{onOpen:Qr}),$e&&Object.entries(Tt).map(([xe,De])=>(wt[xe]??"")===""?r.jsx(aZ,{sources:De,template:K,paramName:xe,sandboxRef:$e,onFill:vt=>el(xe,vt)},`${Ue}:${xe}`):null),i?r.jsxs(r.Fragment,{children:[Mi&&r.jsx(yQ,{children:io}),r.jsx(_Q,{children:Oi})]}):(Mi||Oi)&&r.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[r.jsx("div",{className:"flex flex-1 items-center justify-start",children:$i}),r.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:vr}),r.jsx("div",{className:"flex flex-1 items-center justify-end",children:Oi})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:oo?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(fb,{virtualMcpId:t,externalSelection:v}),n&&Xl]}):r.jsxs(S7,{orientation:"horizontal",disabled:Bn!=="blocks",children:[r.jsx(Ch,{ref:y,id:"preview-blocks-editor",defaultSize:Bn==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Bn==="blocks"&&r.jsx(fb,{virtualMcpId:t,externalSelection:v})}),Bn==="blocks"&&r.jsx(k7,{withHandle:!0}),r.jsx(Ch,{id:"preview-canvas",defaultSize:Bn==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:xe=>{if(!xe)return;const De=()=>k(Vt=>Vt.width===xe.clientWidth&&Vt.height===xe.clientHeight?Vt:{width:xe.clientWidth,height:xe.clientHeight});De();const vt=new ResizeObserver(De);return vt.observe(xe),()=>vt.disconnect()},className:ie("h-full relative overflow-clip flex justify-center",Fs&&!ro&&"bg-muted/30"),children:[(ne||Ot)&&Fs&&r.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:r.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),_t.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(yc,{kind:"starting",progress:mt,claimPhase:ot})}),$t.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(yc,{kind:"suspended",onResume:ce.resume})}),$t.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(yc,{kind:"errored",error:$t.error,onRetry:ce.retry,connectionsHref:`/${se.slug}/settings/connections`})}),_t.showWakingPill&&r.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[r.jsx(lt,{size:18,className:"mt-0.5 shrink-0 animate-spin text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Bn==="visual"&&!x&&r.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[r.jsx(bx,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Bn==="visual"&&x&&r.jsx(uX,{element:x,onDismiss:()=>b(null)}),Xl,Fs&&Ce&&r.jsx("div",{className:ie("shrink-0",!ro&&"border-x border-border bg-background shadow-sm"),style:dd,children:r.jsx("iframe",{ref:_,src:Ce,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Ql.handleError,onLoad:()=>{if(Ql.handleLoad(),H(),_t.mode!=="sandbox"){_t.mode==="production"&&!_t.showWakingPill&&u==="blocks"&&Xo();return}if(Je("vm_preview_loaded",{view_mode:u,vm_id:te?.sandboxHandle??null}),!$)try{const xe=_.current?.contentWindow?.location?.pathname;if(!xe)return;const De=Oe.current;if(De!==null&&(Oe.current=null,nt(xe)!==nt(De))||nt(xe)===nt(ht))return;q(xe),On({path:xe,pageKey:W,params:wt})}catch{}u==="visual"&&pr(),u==="blocks"&&Xo()}},_t.iframeBase)})]})})]})}),r.jsx(UQ,{open:E,onOpenChange:D,isPending:Ze.isPending,error:I,templates:it,onSubmit:no})]})}function zne(t){const e=z.c(22),{virtualMcpId:s}=t,n=re(),i=Ms(s),{activeTask:o,taskId:l,currentBranch:a}=un(),c=h_(l),[d,u]=P.useState(!1);if(f_({threadId:l,sandboxBranch:o?.branch??a,agentHasRepo:sn(i?.metadata),threadHasRepo:sn(c)||sn(o?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(Jn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>u(!0),b=r.jsx(Jn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let L;e[9]!==v?(L=r.jsxs(he,{onClick:x,children:[b,v]}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==p||e[12]!==g||e[13]!==L?(_=r.jsx(Co,{className:"h-full",image:m,title:p,description:g,actions:L}),e[11]=p,e[12]=g,e[13]=L,e[14]=_):_=e[14];let y;e[15]!==d?(y=r.jsx(I2,{open:d,onOpenChange:u,mode:"agent"}),e[15]=d,e[16]=y):y=e[16];let S;return e[17]!==_||e[18]!==y?(S=r.jsxs(r.Fragment,{children:[_,y]}),e[17]=_,e[18]=y,e[19]=S):S=e[19],S}let f;return e[20]!==s?(f=r.jsx(Bne,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const Fne=P.lazy(()=>jn(()=>import("./file-explorer-BbAtNM55.js"),__vite__mapDeps([160,1,2,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,95,96,98,91,99,100,75,115,81,82,83,84,85,86,87,88,89,90,92,93,94,97,101,102,103,104,105,106,78,107,108,109,110,111,112,113,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.FileExplorer})));function Une(t){const e=z.c(23),{openPath:s}=t,n=re(),i=Kr(),{org:o}=Fe(),{currentBranch:l,taskId:a}=un(),c=i?.entity?.id??null,d=qc(),u=Ul(),h=Qn();u.vmEntry,h.lifecycle.phase;const f=d,m=c??"",p=l??"",g=a??null,x=f;let b;e[0]!==o.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:o.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=o.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],vS(b);const v=null;if(!c||!l){let w;e[6]!==n?(w=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=w):w=e[7];let j;return e[8]!==w?(j=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:w}),e[8]=w,e[9]=j):j=e[9],j}let L;e[10]!==v||e[11]!==n?(L=v,e[10]=v,e[11]=n,e[12]=L):L=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})}),e[13]=_):_=e[13];const y=a??null;let S;e[14]!==l||e[15]!==s||e[16]!==o.slug||e[17]!==y||e[18]!==c?(S=r.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:r.jsx(P.Suspense,{fallback:_,children:r.jsx(Fne,{orgSlug:o.slug,virtualMcpId:c,branch:l,threadId:y,openPath:s})})}),e[14]=l,e[15]=s,e[16]=o.slug,e[17]=y,e[18]=c,e[19]=S):S=e[19];let k;return e[20]!==L||e[21]!==S?(k=r.jsxs("div",{className:"flex flex-col w-full h-full",children:[L,S]}),e[20]=L,e[21]=S,e[22]=k):k=e[22],k}function Hne(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function Kne(t,e,s){return typeof t!="string"?null:Hne(Rn(t,e),s)}function xk(t,e,s){if(!e||typeof t!="string")return!1;const n=Kne(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Wne({orgSlug:t,virtualMcpId:e,branch:s}){const n=as(),i=Ts()?.taskId??null,o=qu(e),l=Cn(e).runtime==="cms";return Rs({mutationKey:mg(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const u=await R7({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return gg(n,{orgSlug:t,virtualMcpId:e,branch:s},u),await n.invalidateQueries({queryKey:s0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=Wu(o,xg(a)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():pg(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=Qe.decofile(c);await n.cancelQueries({queryKey:d});const u=n.getQueryData(d),h=!!u&&a in u,f=u?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:h,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>d.hadKey?{...u??{},[d.blockKey]:d.previousValue}:u)},onSuccess:()=>{n.invalidateQueries({queryKey:Qe.liveMeta(t,e,s)})}})}function ec(t){const e=z.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let o;e[0]!==i||e[1]!==n||e[2]!==s?(o=s?"No results match your search.":r.jsxs(r.Fragment,{children:[r.jsx("div",{children:n}),r.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==o?(l=r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=l):l=e[5],l}function C9(t,e){return`${t}-${e}`}function bk(t,e){return`site/apps/${t}/${e}.ts`}function vk(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function qne(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Gne(t){return t==="local"?"Custom":"Installed"}function yk(t,e,s){const n=new Set([C9(t,e),e].map(o=>o.toLowerCase())),i=bk(t,e);for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(o.toLowerCase())||a.__resolveType===i)return o}return null}function Yne(t,e){const s=t.vendor.alias,n=t.name,i=yk(s,n,e);return{id:C9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:bk(s,n),blockKey:i,installed:i!==null}}function Jne(t,e,s){if(t===Ng)return null;const n=vk(t);if(!n)return null;const{vendor:i,app:o}=n,l=yk(i,o,s),a=Yo(t,e);return{id:C9(i,o),app:o,vendor:i,title:a.title??o,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function Qne(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Ec(t,e)||!W7(n))return null;const i=vk(n)??qne(t);if(!i)return null;const o=Yo(n,s),{vendor:l,app:a}=i;return{id:C9(l,a),app:a,vendor:l,title:o.title??Eh(t,e,s),description:o.description??"",category:Gne(l),logo:o.logo??o.icon,resolveType:n,blockKey:t,installed:!0}}function Xne(t,e,s){const n=new Map;for(const o of t){const l=Yne(o,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const o of Object.keys(i)){const l=Jne(o,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=Qne(o,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(Zne)}function Zne(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function eie(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function tie(t,e,s){const n=z.c(12),i=s?.enabled??!0;let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=Qe.decoApps(),n[0]=o):o=n[0];let l;n[1]!==i?(l={queryKey:o,queryFn:eie,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Pt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?Xne(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,u=a.isLoading&&!a.isError;let h;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==u?(h={catalog:d,isLoading:u,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=u,n[11]=h):h=n[11],h}function sie(t){const e=z.c(86),{active:s,counts:n,showBlog:i,onSelect:o}=t,l=re();let a;e[0]!==l?(a=l("sandbox.collectionsSidebar.content"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=r.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:r.jsx("span",{className:"text-sm font-medium",children:a})}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("sandbox.collectionsSidebar.pages"),e[4]=l,e[5]=d):d=e[5];const u=s==="pages";let h;e[6]!==n.pages||e[7]!==o||e[8]!==d||e[9]!==u?(h=r.jsx(Fn,{id:"pages",icon:_o,label:d,count:n.pages,active:u,onSelect:o}),e[6]=n.pages,e[7]=o,e[8]=d,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==o||e[15]!==f||e[16]!==m?(p=r.jsx(Fn,{id:"sections",icon:Rr,label:f,count:n.sections,active:m,onSelect:o}),e[13]=n.sections,e[14]=o,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==o||e[22]!==x||e[23]!==g?(b=r.jsx(Fn,{id:"apps",icon:i8,label:g,count:n.apps,active:x,onSelect:o}),e[20]=n.apps,e[21]=o,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==l?(v=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=v):v=e[26];const L=s==="redirects";let _;e[27]!==n.redirects||e[28]!==o||e[29]!==v||e[30]!==L?(_=r.jsx(Fn,{id:"redirects",icon:p6,label:v,count:n.redirects,active:L,onSelect:o}),e[27]=n.redirects,e[28]=o,e[29]=v,e[30]=L,e[31]=_):_=e[31];let y;e[32]!==l?(y=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=y):y=e[33];const S=s==="loaders";let k;e[34]!==n.loaders||e[35]!==o||e[36]!==y||e[37]!==S?(k=r.jsx(Fn,{id:"loaders",icon:jc,label:y,count:n.loaders,active:S,onSelect:o}),e[34]=n.loaders,e[35]=o,e[36]=y,e[37]=S,e[38]=k):k=e[38];let w;e[39]!==l?(w=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=w):w=e[40];const j=s==="actions";let N;e[41]!==n.actions||e[42]!==o||e[43]!==w||e[44]!==j?(N=r.jsx(Fn,{id:"actions",icon:wi,label:w,count:n.actions,active:j,onSelect:o}),e[41]=n.actions,e[42]=o,e[43]=w,e[44]=j,e[45]=N):N=e[45];let T;e[46]!==l?(T=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=T):T=e[47];const C=s==="site";let V;e[48]!==o||e[49]!==T||e[50]!==C?(V=r.jsx(Fn,{id:"site",icon:y2,label:T,active:C,onSelect:o}),e[48]=o,e[49]=T,e[50]=C,e[51]=V):V=e[51];let A;e[52]!==l?(A=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=A):A=e[53];const E=s==="seo";let D;e[54]!==o||e[55]!==A||e[56]!==E?(D=r.jsx(Fn,{id:"seo",icon:m2,label:A,active:E,onSelect:o}),e[54]=o,e[55]=A,e[56]=E,e[57]=D):D=e[57];let I;e[58]!==l?(I=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=I):I=e[59];const R=s==="calendar";let $;e[60]!==o||e[61]!==I||e[62]!==R?($=r.jsx(Fn,{id:"calendar",icon:Bl,label:I,active:R,onSelect:o}),e[60]=o,e[61]=I,e[62]=R,e[63]=$):$=e[63];let B;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==o||e[69]!==i||e[70]!==l?(B=i&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[r.jsx(kc,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),r.jsx(Fn,{id:"posts",icon:yi,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:o}),r.jsx(Fn,{id:"authors",icon:M2,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:o}),r.jsx(Fn,{id:"categories",icon:$2,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:o}),r.jsx(Fn,{id:"post-schedule",icon:dV,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:o})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=o,e[69]=i,e[70]=l,e[71]=B):B=e[71];let M;e[72]!==b||e[73]!==_||e[74]!==k||e[75]!==N||e[76]!==V||e[77]!==D||e[78]!==$||e[79]!==B||e[80]!==h||e[81]!==p?(M=r.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,_,k,N,V,D,$,B]}),e[72]=b,e[73]=_,e[74]=k,e[75]=N,e[76]=V,e[77]=D,e[78]=$,e[79]=B,e[80]=h,e[81]=p,e[82]=M):M=e[82];let O;return e[83]!==c||e[84]!==M?(O=r.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=O):O=e[85],O}function Fn(t){const e=z.c(18),{id:s,icon:n,label:i,count:o,active:l,onSelect:a}=t;let c;e[0]!==s||e[1]!==a?(c=()=>a(s),e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let u;e[3]!==d?(u=ie("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=r.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==i?(f=r.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==o?(m=o!==void 0&&r.jsx("span",{className:ie("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=l,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==u||e[14]!==h||e[15]!==f||e[16]!==m?(p=r.jsxs("button",{type:"button",onClick:c,className:u,children:[h,f,m]}),e[12]=c,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function nie(t){const e=z.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:o,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=oS({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==a?(c=r.jsx(yc,{kind:"starting",progress:a,claimPhase:n}),e[3]=n,e[4]=a,e[5]=c):c=e[5],c}case"suspended":{let a;return e[6]!==o?(a=r.jsx(yc,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==o||e[10]!==s.error?(a=r.jsx(yc,{kind:"errored",error:s.error,onRetry:o,connectionsHref:l}),e[8]=l,e[9]=o,e[10]=s.error,e[11]=a):a=e[11],a}}}const iie=new Set(["clone-failed","install-failed","start-failed","crashed"]);function rie(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!iie.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function xb(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let i=2;i<1e3;i++){const o=`${s} (copy ${i})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function oie(t,e){const s=wo,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let o=2;o<1e3;o++){const l=`${n}-copy-${o}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function lie(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let i=2;i<1e3;i++){const o=`${s}_copy_${i}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function aie(t){const e=x3(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function cie(t,e){return Gw(t,e)}const die=1e3;function uie(t,e){for(let s=0;s<die;s++){const n=x3(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const hie={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},fie={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},mie={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function pie(t){const e=z.c(88),{open:s,mode:n,initialName:i,initialPath:o,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=re(),[p,g]=P.useState(i),[x,b]=P.useState(o),[v,L]=P.useState(ko),[_,y]=P.useState(null),[S,k]=P.useState(s);s!==S&&(k(s),s&&(g(i),b(o),L(ko),y(null)));const w=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=ue=>{!ue&&!f&&(y(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const N=j;let T;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==w||e[8]!==v||e[9]!==d?(T=async ue=>{ue.preventDefault();const fe=p.trim(),ae=x.trim();if(!fe||!ae||f)return;const de=jg(ae);if(de){y(de);return}const X=d?.({name:fe,path:ae});if(X){y(X);return}y(null),await u({name:fe,path:ae,templateKey:w&&v!==ko?v:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=w,e[8]=v,e[9]=d,e[10]=T):T=e[10];const C=T,V=_??a,A=hie[n];let E;e[11]!==m||e[12]!==A?(E=m(A),e[11]=m,e[12]=A,e[13]=E):E=e[13];let D;e[14]!==E?(D=r.jsx(os,{children:r.jsx(Kt,{children:E})}),e[14]=E,e[15]=D):D=e[15];let I;e[16]!==f||e[17]!==w||e[18]!==m||e[19]!==v||e[20]!==c?(I=w&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),r.jsx(Jw,{id:"page-form-template",value:v,onChange:L,templates:c??[],disabled:f})]}),e[16]=f,e[17]=w,e[18]=m,e[19]=v,e[20]=c,e[21]=I):I=e[21];let R;e[22]!==m?(R=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=R):R=e[23];let $;e[24]!==R?($=r.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:R}),e[24]=R,e[25]=$):$=e[25];let B;e[26]===Symbol.for("react.memo_cache_sentinel")?(B=ue=>g(ue.target.value),e[26]=B):B=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let O;e[29]!==f||e[30]!==p||e[31]!==M?(O=r.jsx(gt,{id:"page-form-name",value:p,onChange:B,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=M,e[32]=O):O=e[32];let F;e[33]!==O||e[34]!==$?(F=r.jsxs("div",{className:"space-y-1.5",children:[$,O]}),e[33]=O,e[34]=$,e[35]=F):F=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=U):U=e[37];let K;e[38]!==U?(K=r.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=K):K=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=ue=>b(ue.target.value),e[40]=q):q=e[40];let W;e[41]!==m?(W=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=W):W=e[42];let G;e[43]!==f||e[44]!==x||e[45]!==W?(G=r.jsx(gt,{id:"page-form-path",value:x,onChange:q,placeholder:W,disabled:f}),e[43]=f,e[44]=x,e[45]=W,e[46]=G):G=e[46];let Y;e[47]!==K||e[48]!==G?(Y=r.jsxs("div",{className:"space-y-1.5",children:[K,G]}),e[47]=K,e[48]=G,e[49]=Y):Y=e[49];let ee;e[50]!==V?(ee=V&&r.jsx("p",{className:"text-xs text-destructive",children:V}),e[50]=V,e[51]=ee):ee=e[51];let ne;e[52]!==F||e[53]!==Y||e[54]!==ee||e[55]!==I?(ne=r.jsxs("div",{className:"space-y-4 py-4",children:[I,F,Y,ee]}),e[52]=F,e[53]=Y,e[54]=ee,e[55]=I,e[56]=ne):ne=e[56];let oe;e[57]!==h?(oe=()=>h(!1),e[57]=h,e[58]=oe):oe=e[58];let Z;e[59]!==m?(Z=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=Z):Z=e[60];let J;e[61]!==f||e[62]!==oe||e[63]!==Z?(J=r.jsx(he,{type:"button",variant:"outline",onClick:oe,disabled:f,children:Z}),e[61]=f,e[62]=oe,e[63]=Z,e[64]=J):J=e[64];let H;e[65]!==f||e[66]!==p||e[67]!==x?(H=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=H):H=e[68];let se;e[69]!==f||e[70]!==n||e[71]!==m?(se=f?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),m(mie[n])]}):m(fie[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=se):se=e[72];let Q;e[73]!==H||e[74]!==se?(Q=r.jsx(he,{type:"submit",disabled:H,children:se}),e[73]=H,e[74]=se,e[75]=Q):Q=e[75];let ce;e[76]!==J||e[77]!==Q?(ce=r.jsxs(qn,{children:[J,Q]}),e[76]=J,e[77]=Q,e[78]=ce):ce=e[78];let te;e[79]!==C||e[80]!==ne||e[81]!==ce||e[82]!==D?(te=r.jsx(Bt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:C,children:[D,ne,ce]})}),e[79]=C,e[80]=ne,e[81]=ce,e[82]=D,e[83]=te):te=e[83];let le;return e[84]!==N||e[85]!==s||e[86]!==te?(le=r.jsx(zt,{open:s,onOpenChange:N,children:te}),e[84]=N,e[85]=s,e[86]=te,e[87]=le):le=e[87],le}function gie(t){const e=z.c(70),{open:s,blockKey:n,initialName:i,isPending:o,onSubmit:l,onOpenChange:a}=t,c=o===void 0?!1:o,d=re(),[u,h]=P.useState(i),[f,m]=P.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=q=>{!q&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==u||e[5]!==l?(x=async q=>{q.preventDefault();const W=u.trim();!W||c||await l(W)},e[3]=c,e[4]=u,e[5]=l,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let L;e[9]!==v?(L=r.jsx(Kt,{children:v}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==d?(_=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=_):_=e[12];let y;e[13]!==_?(y=r.jsx(kn,{children:_}),e[13]=_,e[14]=y):y=e[14];let S;e[15]!==L||e[16]!==y?(S=r.jsxs(os,{children:[L,y]}),e[15]=L,e[16]=y,e[17]=S):S=e[17];let k;e[18]!==d?(k=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=k):k=e[19];let w;e[20]!==k?(w=r.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:k}),e[20]=k,e[21]=w):w=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=q=>h(q.target.value),e[22]=j):j=e[22];let N;e[23]!==c||e[24]!==u?(N=r.jsx(gt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=N):N=e[25];let T;e[26]!==w||e[27]!==N?(T=r.jsxs("div",{className:"space-y-1.5",children:[w,N]}),e[26]=w,e[27]=N,e[28]=T):T=e[28];let C;e[29]!==d?(C=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=C):C=e[30];let V;e[31]!==C?(V=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:C}),e[31]=C,e[32]=V):V=e[32];let A;e[33]!==n?(A=r.jsx(gt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=A):A=e[34];let E;e[35]!==V||e[36]!==A?(E=r.jsxs("div",{className:"space-y-1.5",children:[V,A]}),e[35]=V,e[36]=A,e[37]=E):E=e[37];let D;e[38]!==T||e[39]!==E?(D=r.jsxs("div",{className:"space-y-4 py-4",children:[T,E]}),e[38]=T,e[39]=E,e[40]=D):D=e[40];let I;e[41]!==a?(I=()=>a(!1),e[41]=a,e[42]=I):I=e[42];let R;e[43]!==d?(R=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=R):R=e[44];let $;e[45]!==c||e[46]!==I||e[47]!==R?($=r.jsx(he,{type:"button",variant:"outline",onClick:I,disabled:c,children:R}),e[45]=c,e[46]=I,e[47]=R,e[48]=$):$=e[48];let B;e[49]!==c||e[50]!==u?(B=!u.trim()||c,e[49]=c,e[50]=u,e[51]=B):B=e[51];let M;e[52]!==c||e[53]!==d?(M=c?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let O;e[55]!==B||e[56]!==M?(O=r.jsx(he,{type:"submit",disabled:B,children:M}),e[55]=B,e[56]=M,e[57]=O):O=e[57];let F;e[58]!==$||e[59]!==O?(F=r.jsxs(qn,{children:[$,O]}),e[58]=$,e[59]=O,e[60]=F):F=e[60];let U;e[61]!==b||e[62]!==D||e[63]!==F||e[64]!==S?(U=r.jsx(Bt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:b,children:[S,D,F]})}),e[61]=b,e[62]=D,e[63]=F,e[64]=S,e[65]=U):U=e[65];let K;return e[66]!==g||e[67]!==s||e[68]!==U?(K=r.jsx(zt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=K):K=e[69],K}function xie(t){const e=z.c(7),{type:s}=t,n=oO[s];let i;e[0]!==n?(i=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=i):i=e[1];const o=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==o?(l=r.jsx(Ke,{side:"left",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=r.jsxs(We,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const A1={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},$3=["posts","authors","categories"],iu={posts:"post",authors:"author",categories:"category"};function ru(t){return $3.includes(t)}const O3={posts:"post",authors:"author",categories:"category"},_k={posts:A1.post,authors:A1.author,categories:A1.category},bie=Object.fromEntries(Object.entries(_k).map(([t,e])=>[e,t]));function vie(t){return typeof t=="string"?bie[t]??null:null}function Bo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function rs(t){return typeof t=="string"?t:""}function yie(t,e){switch(t){case"posts":return{label:rs(e.title)||"Untitled post",subtitle:rs(e.slug)};case"authors":return{label:rs(e.name)||"Unnamed author",subtitle:rs(e.email)};case"categories":return{label:rs(e.name)||"Unnamed category",subtitle:rs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Lk(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=Bo(n);if(!i)continue;const o=vie(i.__resolveType);if(!o)continue;const l=Bo(i[O3[o]])??{},{label:a,subtitle:c}=yie(o,l);e[o].push({key:s,kind:o,label:a,subtitle:c})}for(const s of $3)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function _ie(t,e){return Lk(t)[e]}function ku(t,e){return _ie(t,e).map(s=>({key:s.key,payload:Bd(Bo(t[s.key])??void 0,e)}))}const bb=Object.freeze({});function Bd(t,e){return t?Bo(t[O3[e]])??bb:bb}function tc(t,e,s){return{name:t,__resolveType:_k[e],[O3[e]]:s}}function Zme({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],o=f=>typeof f=="string"?f:rs(Bo(f)?.[s]),l=f=>typeof f=="string"?f:rs(Bo(f)?.name),a=f=>{const m=o(f),p=m?t.find(({payload:x})=>rs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>rs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:rs(m.name)||rs(m[s])||f})),d=new Map,u=[];return i.forEach((f,m)=>{const p=a(f);if(p){u.includes(p.key)||u.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),u.push(g),c.push({value:g,label:l(f)||o(f)||"Unknown"})}),{options:c,selectedValues:u,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function El(t){return Array.isArray(t)?t:[]}function Er(t){if(typeof t=="string")return t;const e=Bo(t);return e?rs(e.slug):""}function Lie(t){if(typeof t=="string")return t;const e=Bo(t);return e?rs(e.email):""}function wk(t){const e=[];return rs(t.title).trim()||e.push("Title"),rs(t.slug).trim()||e.push("Slug"),El(t.categories).map(Er).filter(Boolean).length===0&&e.push("Category"),rs(t.excerpt).trim()||e.push("Excerpt"),rs(t.image).trim()||e.push("Cover image"),e}const Sk=8;function kk(t){const e=rs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function epe(t,e){return e!=="published"||kk(t)==="published"?!1:wk(t).length>0}function wie(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Sk).toISOString()}function tpe(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=rs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?wie(s):n}}function jk(t){return ku(t,"posts").map(({key:e,payload:s})=>({key:e,title:rs(s.title)||"Untitled post",slug:rs(s.slug),date:rs(s.date),scheduledDatetime:rs(s.scheduledDatetime),categorySlugs:El(s.categories).map(Er).filter(Boolean),authorEmails:El(s.authors).map(Lie).filter(Boolean),missing:wk(s),status:kk(s)}))}function Sie(t,e){const s=El(t.categories);return s.some(n=>Er(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function kie(t,e){const s=El(t.categories);return s.length===1&&Er(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function spe(t,e,s){const n=El(t.categories);if(!n.some(a=>Er(a)===e))return t;const i=n.map(a=>{const c=Er(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),o=new Set,l=i.filter(a=>{const c=Er(a);return c?o.has(c)?!1:(o.add(c),!0):!0});return{...t,categories:l}}function jie(t,e){const s=El(t.categories);return s.some(n=>Er(n)===e)?{...t,categories:s.filter(n=>Er(n)!==e)}:t}function vb(t){return{...t,dateModified:new Date().toISOString()}}function Jm(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function P1(t,e){const s=`collections/blog/${e}/${Jm(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Ck(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Jm(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Jm(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Cie={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},yb="Box";function Nie(t){return t.startsWith("site/")?"site":"app"}function Tie(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Ld(...t){for(const e of t)if(e!==void 0)return e}function npe(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const o of Object.keys(i)){if(!Pie(o)||e.has(o))continue;e.add(o);const l=Yo(o,t),a=Vie(o),c=Cie[a],d=Nie(o),u=(d==="site"?Ld(l.title,c?.title):Ld(c?.title,l.title))??a,h=d==="site"?Ld(l.description,c?.description):Ld(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&Tie(f)?f:void 0,p=m!==void 0?c?.iconName??yb:Ld(f,c?.iconName)??yb;s.push({resolveType:o,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,o)=>i.title.localeCompare(o.title))}function Vie(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Aie=["blog/sections/blocks/","site/sections/Blog/Post/"];function Pie(t){return Aie.some(e=>t.startsWith(e))}const ipe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],rpe=["January","February","March","April","May","June","July","August","September","October","November","December"],Nk=1440*60*1e3;function bl(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function ope(t){return new Date(t.getFullYear(),t.getMonth(),1)}function lpe(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function sf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function Qm(t,e){return Math.round((bl(t).getTime()-bl(e).getTime())/Nk)}function Eie(t){const e=(t.getTime()-bl(t).getTime())/Nk;return Math.min(Math.max(e,0),1)}function _b(t,e){return Qm(t,e)+Eie(t)}function ape(t){const e=sf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let o=0;o<7;o++)i.push(sf(e,n*7+o));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function cpe(t,e){const s=bl(t[0]),n=sf(s,7),i=s.getTime(),o=n.getTime(),l=[];for(const d of e){const u=bl(d.start),h=bl(d.end);if(h.getTime()<s.getTime()||u.getTime()>=n.getTime())continue;const f=u.getTime()<s.getTime()?s:u,m=h.getTime()>=n.getTime()?sf(n,-1):h,p=Qm(f,s),g=Qm(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),o),v=_b(new Date(x),s),L=Math.max(_b(new Date(b),s)-v,0);L<=0||l.push({variant:d,startCol:p,span:g,leftUnits:v,widthUnits:L})}l.sort((d,u)=>d.startCol-u.startCol||u.span-d.span||d.variant.blockKey.localeCompare(u.variant.blockKey));const a=[],c=[];for(const d of l){let u=a.findIndex(h=>h<=d.startCol);u===-1&&(u=a.length,a.push(0)),a[u]=d.startCol+d.span,c.push({...d,lane:u})}return c}function nf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const Tk=/^(\d{4})-(\d{2})-(\d{2})$/;function rf(t){const e=t.trim();if(!e)return null;const s=Tk.exec(e);if(s){const i=Number(s[1]),o=Number(s[2])-1,l=Number(s[3]),a=new Date(i,o,l);return a.getMonth()===o&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:bl(n)}function Die(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Sk);return{...Ck("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:nf(t)}}function Rie(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(Tk.test(e))return rf(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Iie(t,e){const s=Rie(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===nf(s)&&(i.date=nf(n)),i}function Mie(t){return rf(t.scheduledDatetime)??rf(t.date)}function dpe(t){const e=new Map,s=[];for(const i of t){const o={post:i,scheduled:rf(i.scheduledDatetime)!==null},l=Mie(i);if(!l){s.push(o);continue}const a=nf(l),c=e.get(a);c?c.push(o):e.set(a,[o])}const n=(i,o)=>Number(o.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(o.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const $ie="0.161.0",Oie="0.162.0",upe="deno task update";function Lb(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function wb(t,e){const s=Lb(t),n=Lb(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const o=s[i]-n[i];if(o!==0)return o}return 0}const Vk=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Bie(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=Vk.exec(s)?.[1];if(n)return n}return null}function zie(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=Vk.exec(n)?.[1];if(i)return i}return null}function Fie(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Bie(t.denoJson)??zie(t.meta);return!e||wb(e,$ie)<0?{kind:"outdated",version:e}:wb(e,Oie)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function hpe(t){return t.kind==="publish-only"||t.kind==="full"}function fpe(t){return t.kind==="full"}function Uie(t){const e=z.c(16),s=Ms(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=qu(t.virtualMcpId),i=Ts()?.taskId??null;let o;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(o=Qe.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=o):o=e[3];let l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const f=await bg({...t,threadId:i},Wu(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==o||e[9]!==l||e[10]!==a?(c={queryKey:o,queryFn:l,enabled:a,staleTime:3e5},e[8]=o,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Pt(c),u=d??null;let h;return e[12]!==s||e[13]!==t.meta||e[14]!==u?(h=Fie({packageManager:s,denoJson:u,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=u,e[15]=h):h=e[15],h}function Hie({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const o=re(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=P.useState(!1),[h,f]=P.useState(c),[m,p]=P.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},v=async L=>{if(!i||m)return;let _;try{_=JSON.parse(L)}catch{ge.error(o("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(_),ge.success(o("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(y){ge.error(o("sectionsEditor.pageJsonDialog.saveError",{error:y instanceof Error?y.message:String(y)}))}finally{p(!1)}};return r.jsx(zt,{open:t,onOpenChange:e,children:r.jsxs(Bt,{className:"max-w-3xl p-0 gap-0",children:[r.jsxs(os,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[r.jsx(Kt,{className:"text-sm font-semibold",children:o("sectionsEditor.pageJsonDialog.title")}),r.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[r.jsxs(he,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?r.jsx(hi,{size:12}):r.jsx(dn,{size:12}),o(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&r.jsx(he,{size:"sm",onClick:()=>v(h),disabled:!x||m,className:"h-7 text-xs",children:o(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",o("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"h-[70vh]",children:r.jsx($u,{code:c,language:"json",readOnly:g,height:"100%",onChange:L=>f(L??""),onSave:L=>{v(L)}})})]})})}function pi(t){const e=z.c(45),{icon:s,logoUrl:n,title:i,subtitle:o,active:l,accent:a,variantCount:c,trailing:d,selectable:u,selectionActive:h,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=a==="global";let L;e[0]!==s||e[1]!==l||e[2]!==v||e[3]!==n||e[4]!==c?(L=c&&c>1?r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(s,{size:16,className:"shrink-0 text-success"})}),r.jsxs(Ke,{side:"right",children:[c," variants"]})]})}):n?r.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):r.jsx("span",{className:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",v?"bg-global-section/15":"bg-muted"),children:r.jsx(s,{size:16,className:ie("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:_g}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=L):L=e[5];const _=L,y=l?v?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":v?"hover:bg-global-section/10":"hover:bg-muted";let S;e[6]!==y?(S=ie("group relative flex min-w-0 items-center rounded-md transition-colors",y),e[6]=y,e[7]=S):S=e[7];let k;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==i?(k=u&&r.jsx("span",{className:ie("flex shrink-0 items-center pl-2.5 transition-opacity",f||h?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Kie,children:r.jsx(Gc,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=i,e[13]=k):k=e[13];const w=m&&!l&&"text-destructive";let j;e[14]!==w?(j=ie("block truncate text-sm font-medium",w),e[14]=w,e[15]=j):j=e[15];let N;e[16]!==j||e[17]!==i?(N=r.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=N):N=e[18];const T=l?"text-accent-foreground/70":"text-muted-foreground";let C;e[19]!==T?(C=ie("block truncate text-xs",T),e[19]=T,e[20]=C):C=e[20];let V;e[21]!==o||e[22]!==C?(V=r.jsx("span",{className:C,children:o}),e[21]=o,e[22]=C,e[23]=V):V=e[23];let A;e[24]!==V||e[25]!==N?(A=r.jsxs("span",{className:"min-w-0 flex-1",children:[N,V]}),e[24]=V,e[25]=N,e[26]=A):A=e[26];let E;e[27]!==l||e[28]!==m||e[29]!==p?(E=m&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:r.jsx(bn,{size:14})})}),p&&r.jsx(Ke,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=E):E=e[30];let D;e[31]!==x||e[32]!==_||e[33]!==A||e[34]!==E||e[35]!==d?(D=r.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[_,A,E,d]}),e[31]=x,e[32]=_,e[33]=A,e[34]=E,e[35]=d,e[36]=D):D=e[36];let I;e[37]!==l||e[38]!==b?(I=b&&r.jsx("div",{className:ie("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=I):I=e[39];let R;return e[40]!==D||e[41]!==I||e[42]!==S||e[43]!==k?(R=r.jsxs("div",{className:S,children:[k,D,I]}),e[40]=D,e[41]=I,e[42]=S,e[43]=k,e[44]=R):R=e[44],R}function Kie(t){return t.stopPropagation()}function bo(t){const e=z.c(10),{icon:s,title:n,description:i}=t;let o;e[0]!==s?(o=s&&r.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let l;e[2]!==n?(l=r.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&r.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==o||e[7]!==l||e[8]!==a?(c=r.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[o,l,a]}),e[6]=o,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Wie={loaders:jc,actions:wi},qie={loaders:"Loaders",actions:"Actions"},Gie={analytics:lA,blog:kc,commerce:D2,site:uV,website:Mn};function Yie(t,e){return e===0?Gie[t.toLowerCase()]??No:No}function G0(t,e){return e===0?xZ(t):t}function Jie(t){const e=z.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c}=t,d=re();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=P.useState(u),[m,p]=P.useState(null),[g,x]=P.useState(""),[b,v]=P.useState(ire),[L,_]=P.useState(c);L!==c&&(_(c),f([]),p(null),x(""),v(new Set));let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=U=>{v(K=>{const q=new Set(K);return q.has(U)?q.delete(U):q.add(U),q})},e[1]=y):y=e[1];const S=y;let k;e[2]!==i||e[3]!==s||e[4]!==n?(k={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=k):k=e[5];const w=n0(k);let j;e[6]!==w?(j=w3((U,K)=>w.mutate({blockKey:U,data:K})),e[6]=w,e[7]=j):j=e[7];const N=j;let T;e[8]!==c?(T=fS(c),e[8]=c,e[9]=T):T=e[9];const C=T,V=Wie[c];let A,E,D,I,R,$,B;if(e[10]!==V||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==o||e[19]!==w||e[20]!==N||e[21]!==g||e[22]!==m||e[23]!==C||e[24]!==d||e[25]!==n){D=Symbol.for("react.early_return_sentinel");e:{const U=[...xS(l,a,c).map(nre),...pS(l,c).map(sre)],K=g.trim().toLowerCase(),q=K.length>0,W=q?U.filter(ve=>ve.title.toLowerCase().includes(K)||ve.resolveType.toLowerCase().includes(K)):[],G=new Map,Y=[],ee=new Map;if(!q){for(const ve of U){const ke=ve.folderPath;if(!(ke.length<h.length)&&h.every((Le,Ne)=>ke[Ne]===Le))if(ke.length===h.length)if(ve.savedKey!==void 0){const Le=ee.get(ve.resolveType);Le?Le.push(ve):ee.set(ve.resolveType,[ve])}else Y.push(ve);else{const Le=ke[h.length],Ne=G.get(Le)??{count:0,savedCount:0};ve.savedKey!==void 0?Ne.savedCount=Ne.savedCount+1:Ne.count=Ne.count+1,G.set(Le,Ne)}}Y.sort(tre);for(const ve of ee.values())ve.sort(ere)}const ne=[...ee.entries()].filter(ve=>{const[ke]=ve;return!Y.some(Le=>Le.resolveType===ke)}).flatMap(Zie).sort(Xie);let oe;e[33]!==h?(oe=(ve,ke)=>G0(ve.name,h.length).localeCompare(G0(ke.name,h.length)),e[33]=h,e[34]=oe):oe=e[34];const Z=[...G.entries()].map(Qie).sort(oe);let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=ve=>{p(ve.savedKey!==void 0?{mode:"saved",key:ve.savedKey}:{mode:"available",resolveType:ve.resolveType,title:ve.title})},e[35]=J):J=e[35];const H=J;let se;e[36]!==w||e[37]!==C||e[38]!==d?(se=async(ve,ke)=>{await w.mutateAsync({blockKey:ve,data:ke}),ge.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:C,blockId:ve})),p({mode:"saved",key:ve})},e[36]=w,e[37]=C,e[38]=d,e[39]=se):se=e[39];const Q=se;let ce;e[40]!==a||e[41]!==m?(ce=rre(m,a),e[40]=a,e[41]=m,e[42]=ce):ce=e[42];const te=ce;if(te){const ve=`${te.mode}:${te.mode==="saved"?te.blockKey:te.resolveType}`;let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=()=>p(null),e[43]=ke):ke=e[43];let Le;e[44]!==i||e[45]!==a||e[46]!==Q||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==o||e[51]!==w.isPending||e[52]!==N||e[53]!==ve||e[54]!==te.editorTarget||e[55]!==te.initialValue||e[56]!==n?(Le=r.jsx(gk,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c,target:te.editorTarget,initialValue:te.initialValue,isCreating:w.isPending,onCreate:Q,onSaveReferencedBlock:N,onBack:ke},ve),e[44]=i,e[45]=a,e[46]=Q,e[47]=c,e[48]=l,e[49]=s,e[50]=o,e[51]=w.isPending,e[52]=N,e[53]=ve,e[54]=te.editorTarget,e[55]=te.initialValue,e[56]=n,e[57]=Le):Le=e[57],D=Le;break e}B="flex h-full w-full min-w-0 flex-col";let le;e[58]!==d?(le=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=le):le=e[59];let ue;e[60]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>f([]),e[60]=ue):ue=e[60];const fe=h.length===0?"font-medium text-foreground":"text-muted-foreground";let ae;e[61]!==fe?(ae=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",fe),e[61]=fe,e[62]=ae):ae=e[62];const de=qie[c];let X;e[63]!==ae||e[64]!==de?(X=r.jsx("button",{type:"button",onClick:ue,className:ae,children:de}),e[63]=ae,e[64]=de,e[65]=X):X=e[65];let pe;e[66]!==h?(pe=h.map((ve,ke)=>{const Le=ke===h.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,ke+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Le?"font-medium text-foreground":"text-muted-foreground"),children:G0(ve,ke)})]},`${ve}-${ke}`)}),e[66]=h,e[67]=pe):pe=e[67];let ye;e[68]!==le||e[69]!==X||e[70]!==pe?(ye=r.jsxs("nav",{"aria-label":le,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[X,pe]}),e[68]=le,e[69]=X,e[70]=pe,e[71]=ye):ye=e[71];let we;e[72]===Symbol.for("react.memo_cache_sentinel")?(we=r.jsx(Hf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=we):we=e[72];let _e;e[73]===Symbol.for("react.memo_cache_sentinel")?(_e=ve=>x(ve.target.value),e[73]=_e):_e=e[73];let Pe;e[74]!==c||e[75]!==d?(Pe=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Pe):Pe=e[76];let Se;e[77]!==c||e[78]!==d?(Se=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Se):Se=e[79];let Te;e[80]!==g||e[81]!==Pe||e[82]!==Se?(Te=r.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[we,r.jsx("input",{type:"text",value:g,onChange:_e,placeholder:Pe,"aria-label":Se,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Pe,e[82]=Se,e[83]=Te):Te=e[83],e[84]!==ye||e[85]!==Te?(E=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ye,Te]}),e[84]=ye,e[85]=Te,e[86]=E):E=e[86],A=Go,$="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",R=q?W.length===0?r.jsx(bo,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):r.jsx("div",{className:"flex flex-col gap-1",children:W.map(ve=>r.jsx(pi,{icon:V,accent:ve.savedKey!==void 0?"global":void 0,title:ve.title,subtitle:ve.resolveType,active:!1,onClick:()=>H(ve)},ve.savedKey??ve.resolveType))}):Z.length===0&&Y.length===0&&ne.length===0?r.jsx(bo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):r.jsxs(r.Fragment,{children:[Z.length>0&&r.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:Z.map(ve=>{const ke=Yie(ve.name,h.length);return r.jsxs("button",{type:"button",onClick:()=>f([...h,ve.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[r.jsx(ke,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium",children:G0(ve.name,h.length)}),r.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[ve.count," ",ve.count===1?C:c,ve.savedCount>0&&r.jsxs(r.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:ve.savedCount})]})]})]})]},ve.name)})}),(Y.length>0||ne.length>0)&&r.jsxs("div",{className:ie("flex flex-col gap-1",Z.length>0&&"mt-4"),children:[Y.map(ve=>{const ke=ee.get(ve.resolveType)??[],Le=b.has(ve.resolveType);return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(pi,{icon:V,title:ve.title,subtitle:ve.resolveType,active:!1,onClick:()=>H(ve)}),ke.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>S(ve.resolveType),"aria-expanded":Le,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:_g},children:[Le?r.jsx(_s,{size:12,className:"shrink-0"}):r.jsx(nn,{size:12,className:"shrink-0"}),d(Le?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ke.length,")"]}),Le&&r.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ke.map(Ne=>r.jsx(pi,{icon:V,accent:"global",title:Ne.title,subtitle:Ne.resolveType,active:!1,onClick:()=>H(Ne)},Ne.savedKey))})]})]},ve.resolveType)}),ne.map(ve=>r.jsx(pi,{icon:V,accent:"global",title:ve.title,subtitle:ve.resolveType,active:!1,onClick:()=>H(ve)},ve.savedKey))]})]})}e[10]=V,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=o,e[19]=w,e[20]=N,e[21]=g,e[22]=m,e[23]=C,e[24]=d,e[25]=n,e[26]=A,e[27]=E,e[28]=D,e[29]=I,e[30]=R,e[31]=$,e[32]=B}else A=e[26],E=e[27],D=e[28],I=e[29],R=e[30],$=e[31],B=e[32];if(D!==Symbol.for("react.early_return_sentinel"))return D;let M;e[87]!==I||e[88]!==R?(M=r.jsx("div",{className:I,children:R}),e[87]=I,e[88]=R,e[89]=M):M=e[89];let O;e[90]!==A||e[91]!==M||e[92]!==$?(O=r.jsx(A,{className:$,children:M}),e[90]=A,e[91]=M,e[92]=$,e[93]=O):O=e[93];let F;return e[94]!==E||e[95]!==O||e[96]!==B?(F=r.jsxs("div",{className:B,children:[E,O]}),e[94]=E,e[95]=O,e[96]=B,e[97]=F):F=e[97],F}function Qie(t){const[e,s]=t;return{name:e,...s}}function Xie(t,e){return t.title.localeCompare(e.title)}function Zie(t){const[,e]=t;return e}function ere(t,e){return t.title.localeCompare(e.title)}function tre(t,e){return t.title.localeCompare(e.title)}function sre(t){return{resolveType:t.resolveType,title:t.title,folderPath:gS(t.resolveType)}}function nre(t){return{resolveType:t.resolveType,title:t.title,folderPath:gS(t.resolveType),savedKey:t.key}}function ire(){return new Set}function rre(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:i}=bS(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function ore(t){const e=z.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=re(),g=Kr(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,L]=P.useState(b);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[1]=_):_=e[1];const[y,S]=P.useState(_),[k,w]=P.useState(0),[j,N]=P.useState(!1);let T;e[2]!==l||e[3]!==c?(T=Rn(c,l),e[2]=l,e[3]=c,e[4]=T):T=e[4];const C=T,V=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,A=Ts()?.taskId??null,E=o??void 0;let D;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==A||e[10]!==n?(D={orgSlug:s,virtualMcpId:n,branch:i,threadId:A,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=A,e[10]=n,e[11]=D):D=e[11];const I=D;let R,$,B,M,O,F,U,K;if(e[12]!==a||e[13]!==y||e[14]!==v||e[15]!==f||e[16]!==p||e[17]!==d){const ae=[d,...y],de=pe=>{S(y.slice(0,pe)),w(lre)};let X;e[26]!==a||e[27]!==v||e[28]!==f?(X=async pe=>{const ye=V3(pe,a);if(ye){ge.error(ye);return}await f(pe,v),N(!1)},e[26]=a,e[27]=v,e[28]=f,e[29]=X):X=e[29],R=X,M="flex h-full w-full min-w-0",B="flex min-w-0 flex-1 flex-col",$="shrink-0 border-b px-3 py-2.5",K="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?(O=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=O):O=e[31],F="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ae.map((pe,ye)=>{const we=ye===ae.length-1,_e=Sn(pe);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ye>0&&r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>de(ye),title:_e,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",we?"font-medium text-foreground":"text-muted-foreground"),children:_e})]},`${_e}-${ye}`)}),e[12]=a,e[13]=y,e[14]=v,e[15]=f,e[16]=p,e[17]=d,e[18]=R,e[19]=$,e[20]=B,e[21]=M,e[22]=O,e[23]=F,e[24]=U,e[25]=K}else R=e[18],$=e[19],B=e[20],M=e[21],O=e[22],F=e[23],U=e[24],K=e[25];let q;e[32]!==O||e[33]!==F||e[34]!==U?(q=r.jsx("nav",{"aria-label":O,className:F,children:U}),e[32]=O,e[33]=F,e[34]=U,e[35]=q):q=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=()=>N(!0),e[36]=W):W=e[36];let G;e[37]!==p?(G=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=G):G=e[38];let Y;e[39]===Symbol.for("react.memo_cache_sentinel")?(Y=r.jsx(d2,{size:14}),e[39]=Y):Y=e[39];let ee;e[40]!==h||e[41]!==G?(ee=r.jsx(He,{asChild:!0,children:r.jsx(he,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:W,"aria-label":G,children:Y})}),e[40]=h,e[41]=G,e[42]=ee):ee=e[42];let ne;e[43]!==p?(ne=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=ne):ne=e[44];let oe;e[45]!==ne?(oe=r.jsx(Ke,{side:"bottom",children:ne}),e[45]=ne,e[46]=oe):oe=e[46];let Z;e[47]!==ee||e[48]!==oe?(Z=r.jsxs(We,{children:[ee,oe]}),e[47]=ee,e[48]=oe,e[49]=Z):Z=e[49];let J;e[50]!==q||e[51]!==Z||e[52]!==K?(J=r.jsxs("div",{className:K,children:[q,Z]}),e[50]=q,e[51]=Z,e[52]=K,e[53]=J):J=e[53];const H="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",se=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:V});let Q;e[54]!==se?(Q=r.jsx("p",{className:H,children:se}),e[54]=se,e[55]=Q):Q=e[55];let ce;e[56]!==$||e[57]!==J||e[58]!==Q?(ce=r.jsxs("div",{className:$,children:[J,Q]}),e[56]=$,e[57]=J,e[58]=Q,e[59]=ce):ce=e[59];let te;e[60]!==a||e[61]!==y||e[62]!==k||e[63]!==v||e[64]!==l||e[65]!==m||e[66]!==I||e[67]!==C||e[68]!==p?(te=r.jsx(Go,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:C?r.jsx(Ri,{schema:C,value:v,onChange:ae=>L(ae),basePath:"",breadcrumbPath:y,onBreadcrumbChange:S,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:I},k):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=y,e[62]=k,e[63]=v,e[64]=l,e[65]=m,e[66]=I,e[67]=C,e[68]=p,e[69]=te):te=e[69];let le;e[70]!==B||e[71]!==ce||e[72]!==te?(le=r.jsxs("div",{className:B,children:[ce,te]}),e[70]=B,e[71]=ce,e[72]=te,e[73]=le):le=e[73];let ue;e[74]!==u||e[75]!==R||e[76]!==h||e[77]!==j?(ue=r.jsx(A3,{open:j,onOpenChange:N,defaultBlockId:u,isPending:h,onSubmit:R}),e[74]=u,e[75]=R,e[76]=h,e[77]=j,e[78]=ue):ue=e[78];let fe;return e[79]!==M||e[80]!==le||e[81]!==ue?(fe=r.jsxs("div",{className:M,children:[le,ue]}),e[79]=M,e[80]=le,e[81]=ue,e[82]=fe):fe=e[82],fe}function lre(t){return t+1}var are=Object.prototype.toString,od=Array.isArray||function(e){return are.call(e)==="[object Array]"};function B3(t){return typeof t=="function"}function cre(t){return od(t)?"array":typeof t}function E1(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Sb(t,e){return t!=null&&typeof t=="object"&&e in t}function dre(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var ure=RegExp.prototype.test;function hre(t,e){return ure.call(t,e)}var fre=/\S/;function mre(t){return!hre(fre,t)}var pre={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gre(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return pre[s]})}var xre=/\s*/,bre=/\s+/,kb=/\s*=/,vre=/\s*\}/,yre=/#|\^|\/|>|\{|&|=|!/;function _re(t,e){if(!t)return[];var s=!1,n=[],i=[],o=[],l=!1,a=!1,c="",d=0;function u(){if(l&&!a)for(;o.length;)delete i[o.pop()];else o=[];l=!1,a=!1}var h,f,m;function p(w){if(typeof w=="string"&&(w=w.split(bre,2)),!od(w)||w.length!==2)throw new Error("Invalid tags: "+w);h=new RegExp(E1(w[0])+"\\s*"),f=new RegExp("\\s*"+E1(w[1])),m=new RegExp("\\s*"+E1("}"+w[1]))}p(e||Ni.tags);for(var g=new i0(t),x,b,v,L,_,y;!g.eos();){if(x=g.pos,v=g.scanUntil(h),v)for(var S=0,k=v.length;S<k;++S)L=v.charAt(S),mre(L)?(o.push(i.length),c+=L):(a=!0,s=!0,c+=" "),i.push(["text",L,x,x+1]),x+=1,L===`
|
|
541
|
+
`)}function lb(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function pse(t,e){const s=new Map;for(const n of t){const i=s.get(n.label);i?i.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function gse(t){return t.map((e,s)=>({...e,index:s}))}function ok(t){const e=z.c(19),{label:s,canDelete:n,dragging:i,onRename:o,onDuplicate:l,onDelete:a}=t,c=re(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=ie("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=u):u=e[1];let h;e[2]!==u?(h=r.jsx(Uc,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(_o,{className:"h-4 w-4 shrink-0",style:{color:fse}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==o||e[13]!==c?(p=!i&&r.jsxs(Xt,{children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:bse,onPointerDown:xse,children:r.jsx(Gn,{size:14})})}),r.jsxs(es,{align:"end",children:[o&&r.jsxs(Xe,{onClick:x=>{x.stopPropagation(),o()},children:[r.jsx(m6,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),r.jsxs(Xe,{onClick:x=>{x.stopPropagation(),l?.()},children:[r.jsx(dn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),r.jsxs(Xe,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[r.jsx(rn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=o,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==h||e[16]!==m||e[17]!==p?(g=r.jsxs(r.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function xse(t){return t.stopPropagation()}function bse(t){return t.stopPropagation()}function vse(t){const e=z.c(27),{entry:s,selected:n,canDelete:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:yse},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=h9(d);let g;e[2]!==m?(g=ki.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let L;e[7]!==o?(L=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),o())},e[7]=o,e[8]=L):L=e[8];const _=p?"cursor-grabbing":"cursor-grab",y=n?rk:mse;let S;e[9]!==_||e[10]!==y?(S=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",_,y),e[9]=_,e[10]=y,e[11]=S):S=e[11];let k;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(k=r.jsx(ok,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=k):k=e[17];let w;return e[18]!==u||e[19]!==h||e[20]!==o||e[21]!==f||e[22]!==v||e[23]!==L||e[24]!==S||e[25]!==k?(w=r.jsx("div",{ref:f,style:v,...u,...h,onClick:o,onKeyDown:L,className:S,children:k}),e[18]=u,e[19]=h,e[20]=o,e[21]=f,e[22]=v,e[23]=L,e[24]=S,e[25]=k,e[26]=w):w=e[26],w}function yse(){return!1}function _se(t){const e=z.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:o,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=re(),m=n.length>1;let p;e[0]!==n?(p=()=>lb(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=P.useState(p),[b,v]=P.useState(null),[L,_]=P.useState(s),[y,S]=P.useState(n.length);let k;e[2]!==n?(k=()=>ob(n),e[2]=n,e[3]=k):k=e[3];const[w,j]=P.useState(k),N=P.useRef(!1),T=ob(n);L!==s?(_(s),S(n.length),j(T),x(lb(n))):(y!==n.length||w!==T)&&(S(n.length),j(T),x(fe=>pse(fe,n)));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:f9},e[5]=V):V=e[5];const A=Qu(ar(Kl,C),ar(Hl,V));let E;e[6]!==g?(E=g.map(Lse),e[6]=g,e[7]=E):E=e[7];const D=E;let I;e[8]!==g?(I=fe=>{const ae=String(fe.active.id);v(g.find(de=>de.id===ae)??null)},e[8]=g,e[9]=I):I=e[9];const R=I;let $;e[10]!==D||e[11]!==u?($=fe=>{v(null);const{active:ae,over:de}=fe;if(!de||ae.id===de.id)return;const X=D.indexOf(String(ae.id)),pe=D.indexOf(String(de.id));X===-1||pe===-1||(x(ye=>gse(Nl([...ye],X,pe))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),u(X,pe))},e[10]=D,e[11]=u,e[12]=$):$=e[12];const B=$;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const O=M;let F,U,K,q,W,G,Y,ee,ne,oe,Z,J,H;if(e[14]!==m||e[15]!==g||e[16]!==D||e[17]!==B||e[18]!==R||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==o||e[25]!==i||e[26]!==A||e[27]!==f){const fe=Ye=>{N.current||o(Ye)};Z="space-y-1 border-b p-2";let ae;e[41]!==f?(ae=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ae):ae=e[42];let de;e[43]!==ae?(de=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ae}),e[43]=ae,e[44]=de):de=e[44];let X;e[45]!==f?(X=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=X):X=e[46];let pe;e[47]===Symbol.for("react.memo_cache_sentinel")?(pe=r.jsx(Ht,{size:14}),e[47]=pe):pe=e[47];let ye;e[48]!==h||e[49]!==X?(ye=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":X,className:"size-6",onClick:h,children:pe})}),e[48]=h,e[49]=X,e[50]=ye):ye=e[50];let we;e[51]!==f?(we=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=we):we=e[52];let _e;e[53]!==we?(_e=r.jsx(Ke,{children:we}),e[53]=we,e[54]=_e):_e=e[54];let Pe;e[55]!==ye||e[56]!==_e?(Pe=r.jsxs(We,{children:[ye,_e]}),e[55]=ye,e[56]=_e,e[57]=Pe):Pe=e[57];let Se;e[58]!==f?(Se=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Se):Se=e[59];let Te;e[60]===Symbol.for("react.memo_cache_sentinel")?(Te=r.jsx(rn,{size:14}),e[60]=Te):Te=e[60];let ve;e[61]!==d||e[62]!==Se?(ve=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":Se,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Te})}),e[61]=d,e[62]=Se,e[63]=ve):ve=e[63];let ke;e[64]!==f?(ke=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=ke):ke=e[65];let Le;e[66]!==ke?(Le=r.jsx(Ke,{children:ke}),e[66]=ke,e[67]=Le):Le=e[67];let Ne;e[68]!==ve||e[69]!==Le?(Ne=r.jsxs(We,{children:[ve,Le]}),e[68]=ve,e[69]=Le,e[70]=Ne):Ne=e[70];let et;e[71]!==Pe||e[72]!==Ne?(et=r.jsxs("div",{className:"flex items-center gap-0.5",children:[Pe,Ne]}),e[71]=Pe,e[72]=Ne,e[73]=et):et=e[73],e[74]!==de||e[75]!==et?(J=r.jsxs("div",{className:"flex items-center justify-between",children:[de,et]}),e[74]=de,e[75]=et,e[76]=J):J=e[76],U=Zu,G=A,Y=Ig,ee=R,ne=B,oe=O,F=u9,q=D,W=d9,H="space-y-0.5",K=g.map(Ye=>r.jsx(vse,{entry:Ye,selected:Ye.index===i,canDelete:m,onSelect:()=>fe(Ye.index),onRename:l?()=>l(Ye.index):void 0,onDuplicate:()=>a(Ye.index),onDelete:()=>c(Ye.index)},Ye.id)),e[14]=m,e[15]=g,e[16]=D,e[17]=B,e[18]=R,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=o,e[25]=i,e[26]=A,e[27]=f,e[28]=F,e[29]=U,e[30]=K,e[31]=q,e[32]=W,e[33]=G,e[34]=Y,e[35]=ee,e[36]=ne,e[37]=oe,e[38]=Z,e[39]=J,e[40]=H}else F=e[28],U=e[29],K=e[30],q=e[31],W=e[32],G=e[33],Y=e[34],ee=e[35],ne=e[36],oe=e[37],Z=e[38],J=e[39],H=e[40];let se;e[77]!==K||e[78]!==H?(se=r.jsx("div",{className:H,children:K}),e[77]=K,e[78]=H,e[79]=se):se=e[79];let Q;e[80]!==F||e[81]!==q||e[82]!==W||e[83]!==se?(Q=r.jsx(F,{items:q,strategy:W,children:se}),e[80]=F,e[81]=q,e[82]=W,e[83]=se,e[84]=Q):Q=e[84];let ce;e[85]!==b||e[86]!==m?(ce=b?r.jsx("div",{className:ie("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",rk),children:r.jsx(ok,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=ce):ce=e[87];let te;e[88]!==ce?(te=_n.createPortal(r.jsx(c9,{dropAnimation:CS,children:ce}),document.body),e[88]=ce,e[89]=te):te=e[89];let le;e[90]!==U||e[91]!==G||e[92]!==Y||e[93]!==ee||e[94]!==ne||e[95]!==oe||e[96]!==Q||e[97]!==te?(le=r.jsxs(U,{sensors:G,collisionDetection:Y,onDragStart:ee,onDragEnd:ne,onDragCancel:oe,children:[Q,te]}),e[90]=U,e[91]=G,e[92]=Y,e[93]=ee,e[94]=ne,e[95]=oe,e[96]=Q,e[97]=te,e[98]=le):le=e[98];let ue;return e[99]!==Z||e[100]!==J||e[101]!==le?(ue=r.jsxs("div",{className:Z,children:[J,le]}),e[99]=Z,e[100]=J,e[101]=le,e[102]=ue):ue=e[102],ue}function Lse(t){return t.id}const wse=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Sse={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function j1(t){return $l(t)!==void 0}function D3(t,e){if(e){if(j1(e))return e;const s=Sse[e];if(s&&j1(s))return s}for(const[s,n]of wse)if(s.test(t)&&j1(n))return n;return"FilterLines"}function kse(t){return $l(t)??l8}function C1(t){const e=z.c(11),{iconName:s,size:n,className:i}=t,o=n===void 0?"md":n;let l;e[0]!==s?(l=kse(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=o==="sm"?"size-7":"size-9",d=o==="sm"?16:18;let u;e[2]!==c||e[3]!==i?(u=ie("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let h;e[5]!==a||e[6]!==d?(h=r.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=r.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function Hme(t,e){return kQ(t,e).map(s=>{const n=e[s.blockKey]??{},i=Fw(NQ(s.blockKey),e,t);return{blockKey:s.blockKey,title:Cl(s.blockKey,n),description:Ic(i),iconName:D3(s.matcherResolveType)}})}const lk="Users03";function jse(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function Cse(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,o]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const l of Object.keys(o)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=Yo(l,t);s.push({resolveType:l,title:a.title??fs(l),description:a.description,iconName:D3(l,a.icon)})}return s}function Nse(t,e){if(!t)return lk;const s=e.find(n=>n.resolveType===t);return s?s.iconName:D3(t)}function Tse(t){const e=z.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:o,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=P.useState(!1),f=re(),p=(i?d.find(J=>J.blockKey===i):void 0)?.iconName??Nse(s,o),g=$l(p);let x;e[0]!==a||e[1]!==h?(x=J=>{a(J),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==h?(v=J=>{c?.(J),h(!1)},e[3]=c,e[4]=h,e[5]=v):v=e[5];const L=v;let _;e[6]!==h?(_=()=>h(!0),e[6]=h,e[7]=_):_=e[7];let y;e[8]!==g?(y=g&&r.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=y):y=e[9];let S;e[10]!==n?(S=r.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=S):S=e[11];let k;e[12]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(_s,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=k):k=e[12];let w;e[13]!==_||e[14]!==y||e[15]!==S?(w=r.jsxs("button",{type:"button",onClick:_,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[y,S,k]}),e[13]=_,e[14]=y,e[15]=S,e[16]=w):w=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let N;e[19]!==f?(N=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=N):N=e[20];let T;e[21]!==f?(T=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=T):T=e[22];let C;e[23]!==T?(C=r.jsx(Pi,{placeholder:T}),e[23]=T,e[24]=C):C=e[24];let V;e[25]!==f?(V=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=V):V=e[26];let A;e[27]!==V?(A=r.jsx(di,{children:V}),e[27]=V,e[28]=A):A=e[28];let E;e[29]!==f?(E=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=E):E=e[30];let D;e[31]!==f?(D=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=D):D=e[32];const I=`${E} ${D}`;let R;e[33]!==b?(R=()=>b(""),e[33]=b,e[34]=R):R=e[34];const $=!s&&!i&&"bg-accent/60";let B;e[35]!==$?(B=ie("gap-2.5",$),e[35]=$,e[36]=B):B=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(C1,{iconName:lk,size:"sm"}),e[37]=M):M=e[37];let O;e[38]!==f?(O=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=O):O=e[39];let F;e[40]!==O?(F=r.jsx("span",{className:"text-sm",children:O}),e[40]=O,e[41]=F):F=e[41];let U;e[42]!==f?(U=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=U):U=e[43];let K;e[44]!==U?(K=r.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[44]=U,e[45]=K):K=e[45];let q;e[46]!==F||e[47]!==K?(q=r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[F,K]}),e[46]=F,e[47]=K,e[48]=q):q=e[48];let W;e[49]!==I||e[50]!==R||e[51]!==B||e[52]!==q?(W=r.jsxs(Cs,{value:I,onSelect:R,className:B,children:[M,q]}),e[49]=I,e[50]=R,e[51]=B,e[52]=q,e[53]=W):W=e[53];let G;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==o){let J;e[59]!==i||e[60]!==s||e[61]!==b?(J=H=>r.jsxs(Cs,{value:`${H.title} ${H.resolveType} ${H.description??""}`,onSelect:()=>b(H.resolveType),className:ie("gap-2.5",!i&&s===H.resolveType&&"bg-accent/60"),children:[r.jsx(C1,{iconName:H.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"text-sm",children:H.title}),H.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:H.description})]})]},H.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=J):J=e[62],G=o.map(J),e[54]=i,e[55]=s,e[56]=b,e[57]=o,e[58]=G}else G=e[58];let Y;e[63]!==W||e[64]!==G?(Y=r.jsxs(qs,{children:[W,G]}),e[63]=W,e[64]=G,e[65]=Y):Y=e[65];let ee;e[66]!==i||e[67]!==d||e[68]!==L||e[69]!==f?(ee=d.length>0&&r.jsx(qs,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(J=>r.jsxs(Cs,{value:`${J.title} ${J.blockKey} ${J.description??""}`,onSelect:()=>L(J.blockKey),className:ie("gap-2.5",i===J.blockKey&&"bg-accent/60"),children:[r.jsx(C1,{iconName:J.iconName,size:"sm"}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsx("span",{className:"truncate text-sm",children:J.title}),J.description&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.blockKey))}),e[66]=i,e[67]=d,e[68]=L,e[69]=f,e[70]=ee):ee=e[70];let ne;e[71]!==A||e[72]!==Y||e[73]!==ee?(ne=r.jsxs(Ei,{children:[A,Y,ee]}),e[71]=A,e[72]=Y,e[73]=ee,e[74]=ne):ne=e[74];let oe;e[75]!==u||e[76]!==h||e[77]!==N||e[78]!==C||e[79]!==ne||e[80]!==j?(oe=r.jsxs(ZA,{open:u,onOpenChange:h,title:j,description:N,className:"sm:max-w-lg",filter:jse,children:[C,ne]}),e[75]=u,e[76]=h,e[77]=N,e[78]=C,e[79]=ne,e[80]=j,e[81]=oe):oe=e[81];let Z;return e[82]!==oe||e[83]!==w?(Z=r.jsxs(r.Fragment,{children:[w,oe]}),e[82]=oe,e[83]=w,e[84]=Z):Z=e[84],Z}const Vse="website/sections/Rendering/Lazy.tsx";function tf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function R3(t){if(!tf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&zs(e)}function Ase(t){return t!=null}function Ym(t){if(t==null)return t;if(R3(t)){const e=t.section;return e==null?null:tf(e)?e:{}}return tf(t)?t:void 0}function Pse(t,e){return t===null?null:R3(e)?{...e,section:t}:t}function Kme(t){return{__resolveType:t}}function Wme(t,e){if(!Ase(e))return null;if(t){const s=Ym(e)??{};return{__resolveType:Vse,section:s}}return R3(e)?Ym(e)??null:tf(e)?e:null}const Ese="General";function Mc(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function ak(t,e){return t===Oo?Ese:e}function ck(t){const e=Vh(t),s=new Set,n=[];for(const i of e)Mc(i.resolveType)&&(oi(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:ak(i.resolveType,i.title),description:i.description})));return n}function I3(t){const e=Th(t),s=Rn(e,t),n=ck(s?.properties?.seo);return n.length>0?n:Dse(t)}function Dse(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const o of Object.keys(i)){if(!Mc(o))continue;const l=o.split("/").pop()?.replace(/\.tsx?$/,"")??o;s.push({resolveType:o,title:ak(o,l)})}return s}function dk(t){const e=I3(t),s=e.find(n=>n.resolveType===Oo);return s?s.resolveType:e[0]?.resolveType??Oo}function uk(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=Rn(s,t),i=ck(n?.properties?.seo);if(i.length>0)return i}return I3(t)}function Rse(t,e){const s=uk(t,e),n=s.find(i=>i.resolveType===Oo);return n?n.resolveType:s[0]?.resolveType??dk(t)}function Ise(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:dk(t)}function Mse(t,e,s){const n=s.__resolveType;return typeof n=="string"&&Mc(n)?n:Rse(t,e)}const $se=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),Oo="website/sections/Seo/SeoV2.tsx",Ose=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function su(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Bse(t){return typeof t.__resolveType=="string"&&Mc(t.__resolveType)?!0:Ose.some(e=>e in t)}function zse(t,e){for(const[s,n]of Object.entries(t)){if(!su(n))continue;const i=n,o=i.__resolveType;if(typeof o=="string"&&$se.has(o))continue;const l=i.seo;if(su(l)){const a=l;if(Bse(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Mse(e,i,a):typeof a.__resolveType=="string"&&Mc(a.__resolveType)?a.__resolveType:Oo}}}for(const[s,n]of Object.entries(t)){if(!su(n))continue;const i=n;if(typeof i.__resolveType=="string"&&Mc(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Fse(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function qme(t,e,s){if(e.kind==="site"){const c=zse(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?uk(s,c.blockData):void 0,build:d=>Fse(c,d)}:null}const n=t[e.pageKey];if(!su(n))return null;const i=n,o=i.seo,l=Ym(o),a=l&&su(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:o,seoResolveType:s?Ise(s,a):typeof a?.__resolveType=="string"?a.__resolveType:Oo,seoTypeOptions:s?I3(s):void 0,build:c=>({...i,seo:c===null?null:Pse(c,o)})}}const M3=["type","title","description","canonical","favicon","image","themeColor"],Use=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Hse=["jsonLD","title","description","noIndexing","configJsonLD"];function hk(t){return t===Oo||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Kse(t){switch(t){case"general":return M3;case"pdp":return Use;case"plp":return Hse;default:return null}}function fk(t,e){const s=Kse(hk(e));if(!s||!t.properties)return t;const n={};for(const i of s){const o=t.properties[i];o&&(n[i]=o)}return{...t,properties:n}}function Wse(){return M3.filter(t=>t!=="type")}function qse(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function Gse(t,e){return t[e]===void 0}function Yse(t){const e=z.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:o,formResetKey:l}=t,a=re(),d=fk(s,Oo).properties??{},u=Wse();let h;e[0]!==o?(h=!!o&&Object.keys(o).length>0,e[0]=o,e[1]=h):h=e[1];const f=h,[m,p]=P.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=P.useState(g);m!==l&&(p(l),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:Gse(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const L=v;let _;e[6]!==i||e[7]!==o||e[8]!==n?(_=(j,N)=>{b(C=>({...C,[j]:N}));const T={...n};if(N)delete T[j];else{const C=o?.[j];T[j]=C??(j==="type"?"website":"")}i(T)},e[6]=i,e[7]=o,e[8]=n,e[9]=_):_=e[9];const y=_,S="min-w-0 space-y-6",k=M3.map(j=>{const N=d[j];if(!N)return null;const T=f&&u.includes(j),C=T&&L(j),V=C?o?.[j]??n[j]:n[j],A=N.title??qse(j);return r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:ie(C&&"pointer-events-none opacity-60"),children:Pl({schema:N,value:V,onChange:E=>{C||i({...n,[j]:E})},path:j,label:A,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:Jse})}),T&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Mr,{id:`seo-use-default-${j}`,checked:C,onCheckedChange:E=>y(j,E)}),r.jsx(Ut,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let w;return e[10]!==l||e[11]!==k?(w=r.jsx("div",{className:S,children:k},l),e[10]=l,e[11]=k,e[12]=w):w=e[12],w}function Jse(){}function Qse(t){const e=z.c(18),{schema:s,resolveType:n,value:i,formResetKey:o,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(hk(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,e[1]=g):g=e[1];let x;return e[2]!==o||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=r.jsx(Yse,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:o}),e[2]=o,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let u;e[8]!==n||e[9]!==s?(u=fk(s,n),e[8]=n,e[9]=s,e[10]=u):u=e[10];const h=u;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=a??Xse;let p;return e[12]!==h||e[13]!==o||e[14]!==l||e[15]!==m||e[16]!==i?(p=r.jsx(Ri,{schema:h,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},o),e[12]=h,e[13]=o,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function Xse(){}function Zse(t){const e=z.c(16),{schema:s,value:n,onChange:i,meta:o,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=re();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=P.useState(u);let m;e[1]!==h||e[2]!==d?(m=h.length>0&&r.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[r.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:r.jsx(rm,{className:"size-3.5"})}),h.map((x,b)=>{const v=b===h.length-1,L=Sn(x);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,b+1)),title:L,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",v?"font-medium text-foreground":"text-muted-foreground"),children:L})]},`${L}-${b}`)})]}),e[1]=h,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==h||e[5]!==l||e[6]!==o||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=r.jsx(Ri,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:h,onBreadcrumbChange:f,meta:o,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=h,e[5]=l,e[6]=o,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=r.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Gme(t){const e=z.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:o,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:u,siteDefaultSeo:h,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const L=v;let _;e[2]!==s||e[3]!==L||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==o||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==u||e[15]!==h?(_=s&&n?u?r.jsx(Qse,{schema:s,resolveType:u,value:n,formResetKey:i,onChange:o,onBreadcrumbChange:l,siteDefaultSeo:h}):r.jsx(Ri,{schema:s,value:n,onChange:o,basePath:"",breadcrumbPath:L,onBreadcrumbChange:l,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=L,e[4]=m,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=o,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=u,e[15]=h,e[16]=_):_=e[16];const y=_;let S;e[17]!==c||e[18]!==y?(S=y??r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=y,e[19]=S):S=e[19];let k;return e[20]!==d||e[21]!==S?(k=r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,S]})}),e[20]=d,e[21]=S,e[22]=k):k=e[22],k}const Yme="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function Jme(t,e){return oX(t,e,Ic)}function Qme(t){const e=z.c(66),{pageKey:s,initialName:n,initialPath:i,onFieldChange:o}=t,l=re(),[a,c]=P.useState(n),[d,u]=P.useState(i),[h,f]=P.useState(s),[m,p]=P.useState(null),g=P.useRef(!1);h!==s&&(f(s),c(n),u(i),p(null));let x;e[0]!==i||e[1]!==d?(x=()=>{if(g.current){g.current=!1;return}const ee=d.trim();if(ee===i.trim()){u(i);return}p(ee)},e[0]=i,e[1]=d,e[2]=x):x=e[2];const b=x;let v;e[3]!==o||e[4]!==m?(v=()=>{m!==null&&(u(m),o("path",m),p(null))},e[3]=o,e[4]=m,e[5]=v):v=e[5];const L=v;let _;e[6]!==i?(_=()=>{u(i),p(null)},e[6]=i,e[7]=_):_=e[7];const y=_;let S;e[8]!==o?(S=ee=>{c(ee.target.value),o("name",ee.target.value)},e[8]=o,e[9]=S):S=e[9];let k;e[10]!==l?(k=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=k):k=e[11];let w;e[12]!==a||e[13]!==S||e[14]!==k?(w=r.jsx("input",{type:"text",value:a,onChange:S,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:k}),e[12]=a,e[13]=S,e[14]=k,e[15]=w):w=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=ee=>u(ee.target.value),e[16]=j):j=e[16];let N;e[17]!==i?(N=ee=>{ee.key==="Enter"?(ee.preventDefault(),ee.currentTarget.blur()):ee.key==="Escape"&&(ee.preventDefault(),g.current=!0,u(i),ee.currentTarget.blur())},e[17]=i,e[18]=N):N=e[18];let T;e[19]!==l?(T=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[19]=l,e[20]=T):T=e[20];let C;e[21]!==b||e[22]!==d||e[23]!==N||e[24]!==T?(C=r.jsx("input",{type:"text",value:d,onChange:j,onBlur:b,onKeyDown:N,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:T}),e[21]=b,e[22]=d,e[23]=N,e[24]=T,e[25]=C):C=e[25];const V=m!==null;let A;e[26]!==y?(A=ee=>{ee||y()},e[26]=y,e[27]=A):A=e[27];let E;e[28]!==l?(E=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[28]=l,e[29]=E):E=e[29];let D;e[30]!==E?(D=r.jsx(Po,{children:E}),e[30]=E,e[31]=D):D=e[31];const I=m??"";let R;e[32]!==i||e[33]!==l||e[34]!==I?(R=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:I}),e[32]=i,e[33]=l,e[34]=I,e[35]=R):R=e[35];let $;e[36]!==R?($=r.jsx(Eo,{children:R}),e[36]=R,e[37]=$):$=e[37];let B;e[38]!==D||e[39]!==$?(B=r.jsxs(Ao,{children:[D,$]}),e[38]=D,e[39]=$,e[40]=B):B=e[40];let M;e[41]!==l?(M=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[41]=l,e[42]=M):M=e[42];let O;e[43]!==M?(O=r.jsx(Ro,{children:M}),e[43]=M,e[44]=O):O=e[44];let F;e[45]!==L?(F=ee=>{ee.preventDefault(),L()},e[45]=L,e[46]=F):F=e[46];let U;e[47]!==l?(U=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[47]=l,e[48]=U):U=e[48];let K;e[49]!==F||e[50]!==U?(K=r.jsx(Io,{onClick:F,children:U}),e[49]=F,e[50]=U,e[51]=K):K=e[51];let q;e[52]!==O||e[53]!==K?(q=r.jsxs(Do,{children:[O,K]}),e[52]=O,e[53]=K,e[54]=q):q=e[54];let W;e[55]!==B||e[56]!==q?(W=r.jsxs(Vo,{children:[B,q]}),e[55]=B,e[56]=q,e[57]=W):W=e[57];let G;e[58]!==V||e[59]!==A||e[60]!==W?(G=r.jsx(To,{open:V,onOpenChange:A,children:W}),e[58]=V,e[59]=A,e[60]=W,e[61]=G):G=e[61];let Y;return e[62]!==C||e[63]!==G||e[64]!==w?(Y=r.jsxs("div",{className:"space-y-1",children:[w,C,G]}),e[62]=C,e[63]=G,e[64]=w,e[65]=Y):Y=e[65],Y}function Xme(t){const e=z.c(13),{onClick:s}=t,n=re();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(zf,{size:14}),e[2]=o):o=e[2];let l;e[3]!==s||e[4]!==i?(l=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:o})}),e[3]=s,e[4]=i,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=r.jsx(Ke,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=r.jsxs(We,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const ab=new WeakMap;function ene(t,e){let s=ab.get(e);s||(s=new Map,ab.set(e,s));let n=s.get(t);return n===void 0&&(n=Rn(t,e),s.set(t,n)),n}function tne(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function sne(t,e){return{__resolveType:e,variants:[{rule:Pc(),value:structuredClone(t)},{rule:Pc(),value:structuredClone(t)}]}}function nne(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>b3(n.rule));return s?s.value:e[e.length-1]?.value}function ine(t){const e=[...t.variants],s=e[e.length-1],n={rule:Pc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function rne(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function one(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function lne(t,e,s){return e<t?t-1:Math.min(t,s-1)}function ane(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[i]=n.splice(e,1);return i?(n.splice(s,0,i),{...t,variants:n}):t}function cne(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function cb(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const db=new WeakMap;function dne(t){let e=db.get(t);return e||(e=Cse(t),db.set(t,e)),e}function mk(t){const e=z.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,o=re(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=P.useState(0);if(!tne(l)){let B;e[0]!==o?(B=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=o,e[1]=B):B=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(zf,{size:14}),e[2]=M):M=e[2];let O;e[3]!==o?(O=o("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=o,e[4]=O):O=e[4];let F;return e[5]!==O?(F=r.jsx(Ke,{children:O}),e[5]=O,e[6]=F):F=e[6],r.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":B,onClick:()=>{a(sne(l,s)),h(0)},children:M})}),F]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==o?(g=(B,M)=>({index:M,label:Ic(B.rule)||o("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=o,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},L=v.__resolveType??"",_=b?.value,y=c?dne(c):[],S=L&&c?ene(L,c):null,{__resolveType:k,...w}=v,j=()=>{a(nne(f)),h(0)},N=()=>{const B=ine(f);a(B),h(B.variants.length-1)},T=B=>{const M=rne(f,B);M&&(a(M),h(lne(p,B,M.variants.length)))},C=B=>{const M=one(f,B);a(M),h(B+1)},V=(B,M)=>{const O=ane(f,B,M);a(O),p===B&&h(M)},A=B=>{const M=B?TQ(B,c):{__resolveType:Lg};a(cb(f,p,M))},E=B=>{const M=B,O=L?{...M,__resolveType:L}:{...M};a(cb(f,p,O))},D=B=>{a(cne(f,p,B))},I=`${d}-${f.__resolveType}`;let R;e[9]!==o?(R=o("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=o,e[10]=R):R=e[10];let $;return e[11]!==R?($=r.jsx(Ut,{className:"text-xs text-muted-foreground",children:R}),e[11]=R,e[12]=$):$=e[12],r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[r.jsx(_se,{listKey:I,variants:x,selectedIndex:p,onSelect:h,onDuplicate:C,onDelete:T,onRemoveAll:j,onReorder:V,onAdd:N}),r.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[$,r.jsx(Tse,{currentRt:L,currentLabel:Ic(v),matchers:y,onSelect:A}),S&&r.jsx("div",{className:"pt-1",children:r.jsx(Zse,{schema:S,value:w,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${L}`)})]}),n({...i,value:_,onChange:D})]})]})}const une="website/loaders/secret.ts";function nu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function hne(){return{__resolveType:une,name:"",encrypted:""}}function fne(t){const{value:e,...s}=t;return s}function N1(t){const e=z.c(53),{schema:s,value:n,onChange:i,label:o,path:l,sandbox:a}=t,c=re();if(typeof n=="string"||n==null&&!nu(n)){const N=typeof n=="string"?n:"",T=a?.virtualMcpId;let C;e[0]!==o||e[1]!==l||e[2]!==s.description||e[3]!==T?(C=r.jsx(Gs,{htmlFor:l,label:o,description:s.description,virtualMcpId:T}),e[0]=o,e[1]=l,e[2]=s.description,e[3]=T,e[4]=C):C=e[4];let V;e[5]!==c?(V=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=V):V=e[6];let A;e[7]!==i?(A=I=>i(I.target.value),e[7]=i,e[8]=A):A=e[8];let E;e[9]!==l||e[10]!==N||e[11]!==V||e[12]!==A?(E=r.jsx(gt,{id:l,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:V,onChange:A,className:"h-10"}),e[9]=l,e[10]=N,e[11]=V,e[12]=A,e[13]=E):E=e[13];let D;return e[14]!==C||e[15]!==E?(D=r.jsxs("div",{className:"space-y-2",children:[C,E]}),e[14]=C,e[15]=E,e[16]=D):D=e[16],D}let d;e[17]!==n?(d=nu(n)?n:hne(),e[17]=n,e[18]=d):d=e[18];const u=d,h=typeof u.name=="string"?u.name:"",f=typeof u.encrypted=="string"&&u.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==o||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=r.jsx(Gs,{htmlFor:m,label:o,description:s.description,virtualMcpId:p}),e[19]=o,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==u||e[27]!==i?(v=N=>i({...u,name:N.target.value}),e[26]=u,e[27]=i,e[28]=v):v=e[28];let L;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==v?(L=r.jsx(gt,{id:x,value:h,placeholder:b,onChange:v,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=v,e[33]=L):L=e[33];const _=`${l}-value`;let y;e[34]!==f||e[35]!==c?(y=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=y):y=e[36];let S;e[37]!==u||e[38]!==f||e[39]!==i?(S=N=>{const T=N.target.value;if(!T){i(f?fne(u):u);return}i({...u,value:T})},e[37]=u,e[38]=f,e[39]=i,e[40]=S):S=e[40];let k;e[41]!==y||e[42]!==S||e[43]!==_?(k=r.jsx(gt,{id:_,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:y,onChange:S,className:"h-10"}),e[41]=y,e[42]=S,e[43]=_,e[44]=k):k=e[44];let w;e[45]!==f||e[46]!==c?(w=f&&r.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=w):w=e[47];let j;return e[48]!==k||e[49]!==w||e[50]!==g||e[51]!==L?(j=r.jsxs("div",{className:"space-y-2",children:[g,L,k,w]}),e[48]=k,e[49]=w,e[50]=g,e[51]=L,e[52]=j):j=e[52],j}function mne(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),i=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],o=[],l=d=>{d?.type==="object"&&d.properties&&o.push(d)};for(const d of s){const u=d.schema;if(u&&(u.type==="array"&&l(u.items),u.properties))for(const h of Object.values(u.properties))h?.type==="array"&&l(h.items)}if(o.length===0)return;if(i.length===0)return o.length===1?o[0]:void 0;let a,c=-1;for(const d of o){const u=d.properties??{},h=i.filter(f=>f in u).length*2+(d.titleBy?1:0);h>c&&(c=h,a=d)}return c>=2?a:void 0}function pne(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,i]of Object.entries(e))n.startsWith("__")||(typeof i=="string"?s[n]={type:"string"}:typeof i=="number"?s[n]={type:"number"}:typeof i=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const gne=new Set(["__resolveType","@type"]);function xne(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function bne(t){if(_9(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function ub(t){if(t.type==="array"&&t.items)return t;const e=t.items??bne(t);return e?{...t,type:"array",items:e}:null}function vne(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function pk(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const i=Rn(n,s);return i?r.jsx(Ri,{schema:i,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function Pl(t){const{schema:e,value:s}=t;if(Gh(s)){const l=nX(s),a=ub(e);if(l!==null&&a)return r.jsx(K0,{...t,schema:a,value:l,onChange:c=>t.onChange(iX(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&_9(e)){const l=ub(e);if(l)return r.jsx(K0,{...t,schema:l,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Gh(s)&&e.type==="block-ref"){const l=mne(e,s)??pne(s);if(l){const a={...e,type:"array",items:l};return r.jsx(K0,{...t,schema:a,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(xne(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},d=u=>Pl({...u,schema:c});return r.jsx(mk,{...t,multivariateResolveType:l.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?r.jsx(tb,{...t},t.path):null}if(e.type==="inline-union")return r.jsx(lse,{...t},t.path);if(e.format==="image-uri")return r.jsx(Gte,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(Kte,{...t},t.path);if(e.format==="map")return r.jsx(hse,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return r.jsx(vte,{...t},t.path);if(e.format==="location")return r.jsx(ik,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(nee,{...t},t.path);if(e.type==="anyOf")return r.jsx(tb,{...t},t.path);if(nu(s)||e.format==="password"||s==null&&e.format==="password")return r.jsx(N1,{...t},t.path);if(!e.format&&!e.enum){const l=pk(t);if(l)return l}const n=s??vne(e.type,e.default);if(n==null)return nu(s)?r.jsx(N1,{...t},t.path):null;if(nu(n))return r.jsx(N1,{...t,value:n},t.path);const i={...t,value:n},o=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(o==="array"||Array.isArray(n))return r.jsx(K0,{...i},t.path);switch(o){case"boolean":return r.jsx(XZ,{...i},t.path);case"number":case"integer":return r.jsx(QZ,{...i},t.path);case"string":{const l=e.format;return l==="color-input"||l==="color"?r.jsx(U0,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?r.jsx(U0,{...i},t.path):r.jsx(U0,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?r.jsx(tte,{...i},t.path):null;default:return r.jsx(U0,{...i},t.path)}}function yne(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Pl({...t,schema:e});const s=pk(t);return s||Pl(e?{...t,schema:e}:t)}function Ri({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}){const m=re(),p=t.properties;if(!p)return t.type==="inline-union"?Pl({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}):null;if(sX(e)&&p.variants){const C=p.variants.items?.properties?.value;return r.jsx(mk,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:o,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:V=>yne(V,C)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(p).filter(C=>!gne.has(C)&&p[C]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const v=(C,V)=>{if(V===void 0){const{[C]:A,...E}=g;s(E);return}s({...g,[C]:V})},L=typeof g.__resolveType=="string"?g.__resolveType:void 0,_=x.filter(C=>{const V=p[C];return V!=null&&_c(V,g[C])}).length>1,y=Dee(x,p,g),S=i.length>0?Iee(x,p,g,i,a,l):null,k=S?p[S]:null,w=S&&k?[S]:x,j=S&&k?Eee(S,k,i,Su(S,x,p)):i,N=Pee(i,j),T=N.length>0&&o?C=>o([...N,...C]):o;return r.jsx("div",{className:"min-w-0 space-y-6",children:w.map(C=>{const V=p[C];if(!V)return null;const A=n?`${n}.${C}`:C,E=Su(C,x,p),D=Al(C,V),$=(N.length===0&&x.some(B=>{const M=p[B];return B!==C&&M!=null&&Al(B,M)===D})||N.length===0&&y.has(C))&&T?V.type==="block-ref"?B=>T(Vee(C,B)):B=>T(Tee(E,B)):T;return Pl({schema:V,value:g[C],onChange:B=>v(C,B),path:A,label:E,required:b.has(C),breadcrumbPath:j,onBreadcrumbChange:$,hasSiblingDrillDownFields:_,focused:S===C,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:L,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f})})})}function _ne(t){const e=z.c(3),{isPending:s,isError:n}=t;if(n){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[r.jsx(bn,{size:13}),"Couldn't save"]}),e[0]=o):o=e[0],o}if(s){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(lt,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=o):o=e[1],o}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[r.jsx(qt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const hb=3e4;function Lne(t,e,s,n){const i=new URL(`/deco/invoke/${e}`,t);return i.searchParams.set("__cb",n.toString(36)),i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",`run-${n.toString(36)}`),i.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),i.href}async function wne(t,{resolveType:e,props:s}){let n;try{n=await fetch(M7(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(hb)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${hb/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let o=null,l=!1;try{o=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&o&&typeof o=="object"&&"error"in o&&typeof o.error=="string"?o.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?o:i}function Sne(t){const e=z.c(2);let s;return e[0]!==t?(s={mutationFn:n=>wne(t,n)},e[0]=t,e[1]=s):s=e[1],Rs(s)}function gk({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f,showRun:m=!0}){const p=Ts()?.taskId??null,g=re(),x=Kr(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=Rn(a.resolveType,i),L=!v&&Q$(a.resolveType,i),_=L?X$(c):null,y=v??_,[S,k]=P.useState(c),[w,j]=P.useState([]),[N,T]=P.useState(0),[C,V]=P.useState(!1),[A,E]=P.useState(null),[D,I]=P.useState(!1),[R,$]=P.useState(!1),[B,M]=P.useState(!1),O=A!==null,{save:F,flush:U,isPending:K}=Yw({orgSlug:t,virtualMcpId:e,branch:s}),q=Sne({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});P.useEffect(()=>()=>{U()},[]);const W=fS(l),G=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},ee=ce=>{k(ce),a.mode==="saved"&&F(a.blockKey,{__resolveType:a.resolveType,...ce})},ne=()=>{O?(E(null),V(!1),T(ce=>ce+1)):E(JSON.stringify(S,null,2))},oe=ce=>{const te=ce??"";try{const le=JSON.parse(te);if(le&&typeof le=="object"&&!Array.isArray(le)){V(!1),ee(le);return}V(!0)}catch{V(!0)}},Z=async ce=>{const te=V3(ce,o);if(te){ge.error(te);return}await u(ce,{__resolveType:a.resolveType,...S}),I(!1)},J=()=>{$(!0),q.mutate({resolveType:a.resolveType,props:S})},H=()=>{n&&window.open(Lne(n,a.resolveType,S,Date.now()),"_blank","noopener")},se=[a.title,...w],Q=ce=>{j(w.slice(0,ce)),T(te=>te+1)};return r.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:r.jsx(Pf,{size:14})}),r.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:se.map((ce,te)=>{const le=te===se.length-1,ue=Sn(ce);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[te>0&&r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>Q(te),title:ue,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",le?"font-medium text-foreground":"text-muted-foreground"),children:ue})]},`${ue}-${te}`)})}),a.mode==="saved"&&r.jsx(_ne,{isPending:K,isError:!1}),m&&r.jsxs(he,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:J,disabled:q.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:W}),children:[q.isPending?r.jsx(lt,{size:14,className:"animate-spin"}):r.jsx(wl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:W}),children:r.jsx(d2,{size:14})})}),r.jsx(Ke,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:W})})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:O?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:ne,"aria-label":g(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":O,children:O?r.jsx(Is,{size:14}):r.jsx(qo,{size:14})})}),r.jsx(Ke,{side:"bottom",children:g(O?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:a.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:W}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:G,singular:W})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:ie("relative min-h-0 flex-1",R&&B&&"hidden"),children:[r.jsx(Go,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[_&&y===_&&r.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:W})}),y?r.jsx(Ri,{schema:y,value:S,onChange:ce=>ee(ce),basePath:"",breadcrumbPath:w,onBreadcrumbChange:j,meta:i,decofile:o,onSaveReferencedBlock:h,sandbox:Y},N):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:L?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:W}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:W})})]})})}),A!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[C&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx($u,{language:"json",height:"100%",code:A,onChange:oe,onSave:ce=>{oe(ce),U()}})})]})]}),R&&r.jsx(kne,{singular:W,result:{isPending:q.isPending,error:q.error,data:q.data,hasRun:q.status!=="idle"},expanded:B,onToggleExpand:()=>M(ce=>!ce),onOpenInNewTab:n?H:void 0,onClose:()=>{$(!1),M(!1)}})]}),r.jsx(A3,{open:D,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:Z})]})}function kne(t){const e=z.c(54),{singular:s,result:n,expanded:i,onToggleExpand:o,onOpenInNewTab:l,onClose:a}=t,c=re();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const u=d,h=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==h?(f=ie("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:r.jsx(xn,{size:14})})}),r.jsx(Ke,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=l,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==i||e[13]!==c?(x=c(i?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=i,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==i?(b=i?r.jsx(nV,{size:14}):r.jsx(c6,{size:14}),e[15]=i,e[16]=b):b=e[16];let v;e[17]!==i||e[18]!==o||e[19]!==x||e[20]!==b?(v=r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:o,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=o,e[19]=x,e[20]=b,e[21]=v):v=e[21];let L;e[22]!==i||e[23]!==c?(L=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=L):L=e[24];let _;e[25]!==L?(_=r.jsx(Ke,{side:"bottom",children:L}),e[25]=L,e[26]=_):_=e[26];let y;e[27]!==_||e[28]!==v?(y=r.jsxs(We,{children:[v,_]}),e[27]=_,e[28]=v,e[29]=y):y=e[29];let S;e[30]!==c?(S=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=S):S=e[31];let k;e[32]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Is,{size:14}),e[32]=k):k=e[32];let w;e[33]!==a||e[34]!==S?(w=r.jsx(he,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":S,children:k}),e[33]=a,e[34]=S,e[35]=w):w=e[35];let j;e[36]!==y||e[37]!==w||e[38]!==g?(j=r.jsxs("div",{className:"flex items-center gap-0.5",children:[g,y,w]}),e[36]=y,e[37]=w,e[38]=g,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==p?(N=r.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=N):N=e[42];let T;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(T=r.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?r.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[r.jsx(lt,{size:16,className:"animate-spin"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?r.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[r.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),r.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?r.jsx($u,{language:"json",height:"100%",code:u,readOnly:!0}):r.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=u,e[47]=s,e[48]=c,e[49]=T):T=e[49];let C;return e[50]!==N||e[51]!==T||e[52]!==f?(C=r.jsxs("div",{className:f,children:[N,T]}),e[50]=N,e[51]=T,e[52]=f,e[53]=C):C=e[53],C}function jne(t){const e=z.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,blockKey:c}=t,d=re();let u;e[0]!==i||e[1]!==s||e[2]!==n?(u={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=u):u=e[3];const h=n0(u);let f;e[4]!==h?(f=w3((y,S)=>h.mutate({blockKey:y,data:S})),e[4]=h,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=bS(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let y;e[9]!==d?(y=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=y):y=e[10];let S;return e[11]!==y?(S=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:y}),e[11]=y,e[12]=S):S=e[12],S}const v=`loader:${c}`;let L;e[13]!==c||e[14]!==g||e[15]!==b?(L={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=L):L=e[16];let _;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==o||e[22]!==x||e[23]!==h.isPending||e[24]!==m||e[25]!==v||e[26]!==L||e[27]!==n?(_=r.jsx(gk,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:"loaders",target:L,initialValue:x,isCreating:h.isPending,onCreate:Cne,onSaveReferencedBlock:m,showRun:!1},v),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=o,e[22]=x,e[23]=h.isPending,e[24]=m,e[25]=v,e[26]=L,e[27]=n,e[28]=_):_=e[28],_}async function Cne(){}const Nne="https://github.com/decocms/blocks";function Tne(){const t=z.c(14),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(iV,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=o):o=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx(xn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==o?(a=r.jsx(he,{size:"sm",asChild:!0,children:r.jsxs("a",{href:Nne,target:"_blank",rel:"noreferrer",children:[o,l]})}),t[8]=o,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=r.jsx(Co,{className:"h-full w-full",image:s,title:n,description:i,actions:a}),t[10]=n,t[11]=i,t[12]=a,t[13]=c):c=t[13],c}function Vne(t){const e=z.c(15),{source:s,onRetry:n}=t,i=re();let o;e[0]!==s||e[1]!==i?(o=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=o):o=e[2];const l=o;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx(bn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let u;e[8]!==n||e[9]!==d?(u=r.jsx(he,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=u):u=e[10];let h;return e[11]!==l||e[12]!==c||e[13]!==u?(h=r.jsx(Co,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}function zr(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Ane=P.lazy(()=>jn(()=>import("./sections-editor-BZXQsXK6.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,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.SectionsEditor})));function fb(t){const e=z.c(47),{virtualMcpId:s,externalSelection:n}=t,i=n===void 0?null:n,{org:o}=Fe(),{currentBranch:l,taskId:a}=un(),c=Qn(),d=Ul(),u=_S(),h=c.lifecycle.phase==="running",f=d.previewUrl;let m;e[0]!==l||e[1]!==o||e[2]!==f||e[3]!==a||e[4]!==s?(m=l?{orgSlug:o.slug,virtualMcpId:s,branch:l,threadId:a??null,previewUrl:f}:null,e[0]=l,e[1]=o,e[2]=f,e[3]=a,e[4]=s,e[5]=m):m=e[5];const p=m;let g;e[6]!==h?(g={fetchEnabled:h},e[6]=h,e[7]=g):g=e[7];const x=Qf(p,g);let b;e[8]!==h?(b={fetchEnabled:h},e[8]=h,e[9]=b):b=e[9];const v=Xf(p,b),L=Hw({lifecyclePhase:c.lifecycle.phase,decofile:Wh(x),meta:Wh(v),hasEditableContent:t9(x.data,v.data),fastPreviewActive:Cn(s).runtime==="cms"});if(L.kind==="loading"){let I;return e[10]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(zr,{}),e[10]=I):I=e[10],I}if(L.kind==="empty"){let I;return e[11]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(Tne,{}),e[11]=I):I=e[11],I}if(L.kind==="error"){let I;e[12]!==x||e[13]!==d||e[14]!==v||e[15]!==L.source?(I=()=>{if(L.source==="sandbox"){d.retry();return}Promise.all([x.refetch(),v.refetch()])},e[12]=x,e[13]=d,e[14]=v,e[15]=L.source,e[16]=I):I=e[16];const R=I;let $;return e[17]!==R||e[18]!==L.source?($=r.jsx(Vne,{source:L.source,onRetry:R}),e[17]=R,e[18]=L.source,e[19]=$):$=e[19],$}const _=u.state.target;if(_?.kind==="loader"&&x.data&&v.data){const I=l??"",R=f??null;let $;return e[20]!==x.data||e[21]!==v.data||e[22]!==o.slug||e[23]!==I||e[24]!==R||e[25]!==_.key||e[26]!==s?($=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(jne,{orgSlug:o.slug,virtualMcpId:s,branch:I,previewUrl:R,meta:v.data,decofile:x.data,blockKey:_.key})}),e[20]=x.data,e[21]=v.data,e[22]=o.slug,e[23]=I,e[24]=R,e[25]=_.key,e[26]=s,e[27]=$):$=e[27],$}let y;e[28]!==l||e[29]!==o.slug||e[30]!==_||e[31]!==s?(y=_||!l?null:y3(v3(o.slug,s,l)),e[28]=l,e[29]=o.slug,e[30]=_,e[31]=s,e[32]=y):y=e[32];const S=y;let k="/",w=null,j=null;_?.kind==="page"?(k=_.path,w=_.key):_?.kind==="section"?j=_.key:S&&(k=S.path,w=S.pageKey);const N=w?`page:${w}`:j?`section:${j}`:`path:${k}`;let T;e[33]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})}),e[33]=T):T=e[33];const C=l??"",V=f??void 0,A=j?null:i,E=!!w&&u.state.editSeoPageKey===w;let D;return e[34]!==j||e[35]!==w||e[36]!==k||e[37]!==N||e[38]!==o.slug||e[39]!==E||e[40]!==C||e[41]!==V||e[42]!==A||e[43]!==s||e[44]!==u.consumeEditSeo||e[45]!==u.setVariantOverride?(D=r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:r.jsx(P.Suspense,{fallback:T,children:r.jsx(Ane,{orgSlug:o.slug,virtualMcpId:s,branch:C,previewReady:!0,previewUrl:V,currentPath:k,activePageBlockKey:w,activeGlobalBlockKey:j,externalSelection:A,initialEditSeo:E,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride},N)})}),e[34]=j,e[35]=w,e[36]=k,e[37]=N,e[38]=o.slug,e[39]=E,e[40]=C,e[41]=V,e[42]=A,e[43]=s,e[44]=u.consumeEditSeo,e[45]=u.setVariantOverride,e[46]=D):D=e[46],D}function Pne(t,e){return t===e?"preview":e}function Ene(t){return t.autoOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const Dne=500,Rne={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},mb=1,T1=["desktop","mobile","tablet"],pb={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function gb(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Ine(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.searchParams.set("__deco_ssr","1"),e.href}catch{return t}}function q0(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function V1(t,e){try{return new URL(t,e).href}catch{return null}}function Mne(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),o=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let u=40;return d===0?u+=30:/[\s/-]/.test(c[d-1]??"")&&(u+=20),u+=Math.round(s.length/c.length*20),u};let a=Math.max(l(n),l(i));return o.at(-1)===s?a=Math.max(a,95):o.includes(s)&&(a=Math.max(a,90)),a}function $ne(t){const{onOpen:e}=t,[s,n]=P.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function One(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Bne({virtualMcpId:t}){const e=re(),s=qc(),n=zo(),i=LQ(),o=Yt(),{currentBranch:l,taskId:a}=un(),c=_S(),d=xe=>{o({to:".",search:De=>({...De,main:xe}),replace:!0})},[u,h]=P.useState("preview"),[f,m]=P.useState(!1),[p,g]=P.useState("desktop"),[x,b]=P.useState(null),[v,L]=P.useState(null),_=P.useRef(null),y=P.useRef(null),[S,k]=P.useState({width:0,height:0}),[w,j]=P.useState(null),[N,T]=P.useState(!1),[C,V]=P.useState(""),A=P.useRef(null),[E,D]=P.useState(!1),[I,R]=P.useState(),[$,B]=P.useState(null),[M,O]=P.useState(null),[F,U]=P.useState(null),[K,q]=P.useState("/"),[W,G]=P.useState(null),[Y,ee]=P.useState({}),[ne,oe]=P.useState(!1),Z=P.useRef(null),J=()=>{oe(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>oe(!1),15e3)},H=()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),oe(!1)},{org:se}=Fe(),Q=Qn(),ce=Ul(),te=ce.vmEntry,le=ce.previewUrl,ue=Q.lifecycle.phase,fe=ue==="running",ae=s;vS({orgSlug:se.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:ae});const de=null,X=Kr(),pe=X?.entity?.id===t?o2(X.entity.metadata):null,ye=Cn(t),we=X?.entity?.id===t&&ye.runtime==="cms",_e=ye.projectDefault==="cms",Pe=RQ({sandboxUrl:le,previewServerUrl:pe,fastPreviewActive:we}),Se=t&&l?{orgSlug:se.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:le}:null,Te=Qf(Se,{fetchEnabled:fe}),ve=Xf(Se,{fetchEnabled:fe}),ke=Te.data,Le=ve.data,Ne=`${t}:${l??""}`,[et,Ye]=P.useState(null),ze=Hw({lifecyclePhase:ue,decofile:Wh(Te),meta:Wh(ve),hasEditableContent:t9(ke,Le),fastPreviewActive:we,frameworkKnownMissing:et===Ne});ze.kind==="empty"&&ze.reason==="framework-missing"&&et!==Ne&&Ye(Ne);const Me=ze.kind==="content",at=t&&l?{orgSlug:se.slug,virtualMcpId:t,branch:l}:null,Ze=zQ(at),it=ke?Ph(ke).sort((xe,De)=>xe.name.localeCompare(De.name)):[],rt=ke&&Le?Tg(ke,Le):[],dt=ke&&Le?xS(Le,ke,"loaders"):[],nt=wo,Re=C?(()=>{const xe=C.toLowerCase();return it.map(De=>({page:De,score:Mne(De.name,De.path,xe)})).filter(({score:De})=>De>0).sort((De,vt)=>vt.score-De.score||De.page.path.length-vt.page.path.length).map(({page:De})=>De)})():it,ft=rt.filter(xe=>{if(!C)return!0;const De=C.toLowerCase();return xe.name.toLowerCase().includes(De)||xe.key.toLowerCase().includes(De)||xe.resolveType.toLowerCase().includes(De)}),ut=dt.filter(xe=>{if(!C)return!0;const De=C.toLowerCase();return xe.title.toLowerCase().includes(De)||xe.key.toLowerCase().includes(De)||xe.resolveType.toLowerCase().includes(De)}),be=M?dt.find(xe=>xe.key===M)??null:null,qe=$||M?null:wm(it,K,W),tt=$?$.name:be?.title??qe?.name,Ue=qe?.key??null,Lt=qe?.path??null,wt=(Ue?Y[Ue]:void 0)??{},ht=jr(K,wt),Tt={};if(fe&&le&&Le&&ke){const xe=mZ(Le,"loaders"),De=Ue?ke[Ue]:void 0,vt=$X(De,ke,ws=>xe.has(ws)),Vt=EX(vt);for(const ws of Nh(K)){if(ws.type!=="param")continue;const zn=VX(K,ws.name,vt),vn=IX(zn,xe,Vt);vn.length>0&&(Tt[ws.name]=vn)}}const $e=t&&l?{orgSlug:se.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,ct=ke&&Ue?sS(ke,Ue,0):[],kt=ke?Qw(ct,ke):[],xt=kt.map(xe=>xe.isSavedBlock?xe.label:""),yt=kt.map(xe=>xe.isSavedBlock?"global":xe.isMultivariate?"variant":"normal"),me=ct.map(xe=>Hm(xe,ke??{})),Ae=P.useRef(null),Oe=P.useRef(null),je=Q.status.state==="paused",ot=Q.phase,mt=oS({claimPhase:ot,lifecycle:Q.lifecycle}),$t=ce.previewState,At=ce.userStopped,hn=Fu(X?.entity?.id===t?X.entity.metadata?.ui?.layout??null:null),Ot=g3(se.slug,t??"",l??""),{url:As}=qw(we&&t&&l?{orgSlug:se.slug,virtualMcpId:t,branch:l,previewServerUrl:pe??null,path:ht}:null),$n=_e&&ye.runtime==="sandbox",_t=dQ({previewState:$t,progressStatus:mt.status,previewServerUrl:pe,fastPreviewActive:we,fastPreviewReady:!!As,codingSession:$n}),Fs=_t.mode!=="none",fn=_t.mode==="production"&&_t.iframeBase?q0(_t.iframeBase):null,ln=!s,mn=_t.mode==="production"?fn:q0(le),Ce=Ine(_t.mode==="sandbox"?_1(gb(F??V1(ht,_t.iframeBase)??_t.iframeBase,p),c.state.variantOverride??[]):_t.mode==="production"&&ln?_1(gb(Ww(F??As??V1(ht,_t.iframeBase)??_t.iframeBase,_t.showWakingPill?DQ:null),p),c.state.variantOverride??[]):null);P.useEffect(()=>{},[s,fn,w]);const st="sandbox.preview.openInNewTab",Dt=As??(_t.iframeBase?V1(ht,_t.iframeBase):null),Ls=_t.mode==="production"?Dt?_1(Dt,c.state.variantOverride??[]):null:Ce??_t.iframeBase,Js=async()=>{const xe=Ls;if(xe){window.open(xe,"_blank","noopener");return}},an=t&&l?v3(se.slug,t,l):null,On=xe=>{an&&CX(an,xe)},cs=c.state.target;P.useEffect(()=>{if(!(!cs||!Pe||!Le))if(cs.kind==="page"){const xe=Y[cs.key]??{};Oe.current=jr(cs.path,xe),B(null),O(null),U(null),G(cs.key),q(cs.path),On({path:cs.path,pageKey:cs.key,params:xe})}else if(cs.kind==="loader")Oe.current=null,B(null),O(cs.key),U(null);else{const xe=rt.find(De=>De.key===cs.key);if(xe){Oe.current=null;const De=Th(Le);O(null),B(xe),U(D5(Pe,De,xe.key))}}},[cs,Pe,Le,Y]),P.useEffect(()=>{!Ue||Lt===null||cs?.kind==="page"&&cs.key===Ue&&cs.path===Lt||c.selectTarget({kind:"page",key:Ue,path:Lt})},[Ue,Lt,cs]);const[fr,Wr]=P.useState(null);if($t.kind==="iframe"&&fr!==$t.previewUrl){const xe=fr!==null;Wr($t.previewUrl);const De=an?y3(an):null;if(De){if(Oe.current=jr(De.path,De.params),q(De.path),G(De.pageKey),U(null),B(null),O(null),De.pageKey&&Object.keys(De.params).length>0){const vt=De.pageKey;ee(Vt=>({...Vt,[vt]:De.params}))}}else xe&&(Oe.current=null,q("/"),U(null),G(null),B(null),O(null))}Ae.current=Ce;const Ql=mQ({iframeRef:_,src:_t.mode==="sandbox"?Ce:null,active:_t.mode==="sandbox"}),mr=P.useRef(null);P.useEffect(()=>{if(!As||!Ce||mr.current===As)return;mr.current=As;const xe=_.current;xe&&xe.getAttribute("src")!==Ce&&(J(),xe.src=Ce)},[As,Ce]);const qr=!!t&&!!l&&!Q.notFound&&!At&&!je&&(ot?.kind==="ready"||ue!=="idle"),Bn=_t.mode!=="sandbox"&&u==="visual"?"preview":u;P.useEffect(()=>{const xe=mn;if(!xe)return;const De=vt=>{if(vt.origin===xe){if(vt.data?.type==="visual-editor::element-clicked"){const Vt=HQ.safeParse(vt.data.payload);Vt.success&&b(Vt.data)}else if(vt.data?.type==="cms-editor::section-clicked"){const Vt=qQ.safeParse(vt.data.payload);Vt.success&&L({index:Vt.data.sectionIndex,seq:Vt.data.clickSeq})}}};return window.addEventListener("message",De),()=>window.removeEventListener("message",De)},[mn]),P.useEffect(()=>{if(!N)return;const xe=De=>{A.current?.contains(De.target)||(T(!1),V(""))};return document.addEventListener("pointerdown",xe),()=>document.removeEventListener("pointerdown",xe)},[N]);const pr=()=>{const xe=_.current?.contentWindow,De=q0(le);!xe||!De||xe.postMessage({type:"visual-editor::activate",script:KQ},De)},Gr=()=>{const xe=_.current?.contentWindow,De=q0(le);!xe||!De||xe.postMessage({type:"visual-editor::deactivate"},De)},Xo=()=>{const xe=_.current?.contentWindow,De=mn;!xe||!De||(xe.postMessage(_t.mode==="production"?{type:"editor::inject",args:{script:M5}}:{type:"visual-editor::activate",script:M5},De),xe.postMessage({type:"cms-editor::set-labels",labels:xt,kinds:yt,keys:me},De))},Yr=()=>{const xe=_.current?.contentWindow,De=mn;!xe||!De||xe.postMessage({type:"cms-editor::deactivate"},De)},Xn=xe=>{const De=u;!n&&xe!==De&&(xe==="blocks"?y.current?.resize("30%"):y.current?.collapse()),h(xe),b(null),L(null),xe!=="blocks"&&O(null),De==="visual"&&Gr(),xe==="visual"&&pr(),De==="blocks"&&xe!=="blocks"&&Yr(),xe==="blocks"&&Xo()},gr=xe=>{m(!0),Xn(Pne(u,xe))},Jr=Ene({autoOpen:hn==="auto",blocksReady:Me,autoOpenResolved:f,editingMode:u}),Qr=()=>{m(!0),Xn("blocks")},Xr=()=>{if(!_.current||!Ce)return;J();const xe=_.current;xe.src=Ce};wO(()=>{const xe=_.current;if(!xe)return;J();const De=document.activeElement,vt=xe.tabIndex;xe.tabIndex=-1,xe.style.pointerEvents="none",xe.blur(),One(xe,Ae.current);let Vt;const ws=()=>{clearTimeout(Vt),xe.tabIndex=vt,xe.style.pointerEvents="";const zn=document.activeElement;(!zn||zn===document.body||zn===xe)&&De?.focus(),xe.removeEventListener("load",ws)};xe.addEventListener("load",ws),Vt=setTimeout(ws,3e3)});const Zr=()=>{const xe=T1.indexOf(p);g(T1[(xe+1)%T1.length])},eo=async()=>{let xe=null;try{xe=_.current?.contentWindow?.location?.href??null}catch{}const De=xe??Ce??le;if(De)try{await navigator.clipboard.writeText(De),ge.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{ge.error(e("sandbox.preview.failedToCopyUrl"))}},D9=pQ({iframeBase:_t.iframeBase,resolvedPath:ht,activeGlobalSectionName:$?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Ii=xe=>{const De=Y[xe.key]??{},vt=jr(xe.path,De);($||nt(vt)!==nt(ht))&&J(),Oe.current=vt,B(null),O(null),U(null),L(null),G(xe.key),q(xe.path),On({path:xe.path,pageKey:xe.key,params:De}),c.selectTarget({kind:"page",key:xe.key,path:xe.path})},el=(xe,De)=>{if(!Ue)return;const vt=Ue,Vt={...wt,[xe]:De};Oe.current=jr(K,Vt),ee(ws=>({...ws,[vt]:Vt})),On({path:K,pageKey:vt,params:Vt})},to=xe=>{if(!Pe||!Le){ge.error(e("sandbox.preview.previewMetadataNotReady"));return}J(),Oe.current=null;const De=Th(Le),vt=D5(Pe,De,xe.key);B(xe),O(null),U(vt),L(null),c.selectTarget({kind:"section",key:xe.key})},so=xe=>{B(null),O(xe.key),U(null),Xn("blocks"),c.selectTarget({kind:"loader",key:xe.key})},no=async({name:xe,path:De,templateKey:vt})=>{if(!t||!l)return;const Vt=jg(De);if(Vt){R(Vt);return}const ws=De.trim().startsWith("/")?De.trim():`/${De.trim()}`;if(it.some(vn=>nt(vn.path)===nt(ws))){R(e("sandbox.preview.pageAlreadyExists",{path:ws}));return}let zn;if(vt&&(zn=ke?.[vt],!zn)){R(e("sandbox.preview.templateNoLongerExists"));return}R(void 0);try{const vn=await Ze.mutateAsync({name:xe,path:ws,template:zn});D(!1),ge.success(e("sandbox.preview.pageCreated",{name:xe})),await Yc(Dne),Ii({key:vn.key,name:vn.name,path:vn.path}),Xn("blocks")}catch(vn){R(vn instanceof Error?vn.message:e("sandbox.preview.failedToCreatePage"))}},Mi=Fs&&(qr||_t.mode==="production"),xr=u==="blocks",br=GQ({showPreviewToolbar:Mi,blocksState:ze}),$i=br&&hn!=="off"?r.jsx(Ow,{title:e("sandbox.preview.cms"),tooltip:e(xr?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:rV},active:xr,onClick:()=>gr("blocks"),testId:"preview-blocks-toggle",dataTour:So.edit}):null,vr=Mi?r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(go,{onClick:Xr,"aria-label":e("sandbox.preview.refresh"),children:r.jsx(Dn,{size:16})})}),r.jsx(Ke,{side:"bottom",children:e("sandbox.preview.refresh")})]}),br&&r.jsxs("div",{ref:A,className:"relative min-w-0 w-64 shrink",children:[r.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[r.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>T(xe=>!xe),children:[$&&r.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[r.jsx(Rr,{size:11}),"Global"]}),be&&r.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx(jc,{size:11}),e("sandbox.preview.loaderBadge")]}),r.jsx("span",{className:ie("text-[13px] font-medium text-foreground",tt==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:tt??D9}),!$&&!M&&tt!=null&&K&&r.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:Nh(K).map((xe,De)=>{if(xe.type==="text")return r.jsx("span",{className:ie(De===0?"min-w-0 truncate":"shrink-0"),children:xe.text},`text-${De}`);const vt=Tt[xe.name];return vt&&$e?r.jsx(ZX,{sources:vt,template:K,paramName:xe.name,value:wt[xe.name]??"",sandboxRef:$e,onCommit:Vt=>el(xe.name,Vt)},`${Ue}:${xe.name}`):r.jsx(dZ,{name:xe.name,value:wt[xe.name]??"",onCommit:Vt=>el(xe.name,Vt)},`${Ue}:${xe.name}`)})})]}),r.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>T(xe=>!xe),"aria-label":e("sandbox.preview.choosePage"),children:r.jsx(_s,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",N&&"rotate-180")})})]}),N&&r.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[r.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[r.jsx(Hf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),r.jsx("input",{type:"text",value:C,onChange:xe=>V(xe.target.value),onKeyDown:xe=>{if(xe.key!=="Enter")return;const De=C.trim();if(!De)return;const vt=Re.find(Vt=>nt(Vt.path)===nt(De));vt&&(xe.preventDefault(),T(!1),V(""),Ii(vt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),r.jsx("div",{className:"p-1.5 border-b",children:r.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:xe=>{xe.preventDefault(),T(!1),V(""),R(void 0),D(!0)},children:[r.jsx(Ht,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),Re.length===0&&ft.length===0&&ut.length===0?r.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:it.length===0&&rt.length===0&&dt.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):r.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[Re.length>0&&r.jsx("div",{className:"p-1.5",children:Re.map(xe=>r.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),T(!1),V(""),Ii(xe)},children:[r.jsx(_o,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.path})]},xe.key))}),ft.length>0&&r.jsxs("div",{className:ie("p-1.5",Re.length>0&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),ft.map(xe=>r.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),T(!1),V(""),to(xe)},children:[r.jsx(Rr,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.name}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},xe.key))]}),ut.length>0&&r.jsxs("div",{className:ie("p-1.5",(Re.length>0||ft.length>0)&&"border-t"),children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),ut.map(xe=>r.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:De=>{De.preventDefault(),T(!1),V(""),so(xe)},children:[r.jsx(jc,{size:16,className:"shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:xe.title}),r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},xe.key))]})]})]})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(go,{"aria-label":e(st),onClick:()=>{Js()},children:r.jsx(xn,{size:16})})}),r.jsx(Ke,{side:"bottom",children:e(st)})]})]}):null,io=Mi?r.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[$i,$i&&r.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),vr]}):null,Oi=Mi?r.jsx("div",{className:"flex shrink-0 items-center",children:r.jsxs(Xt,{children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:r.jsx(Gn,{size:14})})}),r.jsxs(es,{align:"end",className:"w-44",children:[r.jsxs(Xe,{onClick:eo,children:[r.jsx(dn,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),ke&&Le&&r.jsxs(r.Fragment,{children:[r.jsx(Pr,{}),Ue&&r.jsxs(Xe,{onClick:()=>{c.editSeo({kind:"page",key:Ue,path:K}),Xn("blocks")},children:[r.jsx(m2,{size:14}),e("sandbox.preview.editSeo")]}),Ue&&r.jsxs(Xe,{onClick:()=>{try{d(wT(C$(Ue)))}catch{ge.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[r.jsx(qo,{size:14}),e("sandbox.preview.viewJson")]})]}),de,r.jsx(Pr,{}),r.jsxs(Xe,{onClick:()=>lQ(e),children:[r.jsx(oV,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,cd=_t.mode==="sandbox",fi=Rne[p],ro=p==="desktop"&&(S.width===0||S.width>=fi.width+2*mb),tl=ro?1:Math.min(S.width>0?S.width/(fi.width+2*mb):1,1),dd=ro?{width:"100%",height:"100%"}:{width:`${fi.width}px`,height:S.height>0?`${S.height/tl}px`:`${fi.height}px`,transform:`scale(${tl})`,transformOrigin:"top center"},Xl=Fs?r.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:r.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[cd&&r.jsxs(r.Fragment,{children:[r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(go,{onClick:()=>gr("visual"),"aria-pressed":u==="visual","aria-label":e("sandbox.preview.visualEditor"),active:u==="visual",className:"rounded-full","data-tour":So.visualEditor,children:r.jsx(bx,{size:16})})}),r.jsx(Ke,{side:"top",children:e("sandbox.preview.visualEditor")})]}),r.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(go,{onClick:Zr,"aria-label":e(pb[p]),className:"rounded-full","data-tour":So.device,children:r.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[p==="mobile"&&r.jsx(lV,{size:16}),p==="tablet"&&r.jsx(aV,{size:16}),p==="desktop"&&r.jsx(cV,{size:16})]},p)})}),r.jsx(Ke,{side:"top",children:e(pb[p])})]})]})}):null,oo=(n||!!M)&&Bn==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[Jr&&r.jsx($ne,{onOpen:Qr}),$e&&Object.entries(Tt).map(([xe,De])=>(wt[xe]??"")===""?r.jsx(aZ,{sources:De,template:K,paramName:xe,sandboxRef:$e,onFill:vt=>el(xe,vt)},`${Ue}:${xe}`):null),i?r.jsxs(r.Fragment,{children:[Mi&&r.jsx(yQ,{children:io}),r.jsx(_Q,{children:Oi})]}):(Mi||Oi)&&r.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[r.jsx("div",{className:"flex flex-1 items-center justify-start",children:$i}),r.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:vr}),r.jsx("div",{className:"flex flex-1 items-center justify-end",children:Oi})]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:oo?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(fb,{virtualMcpId:t,externalSelection:v}),n&&Xl]}):r.jsxs(S7,{orientation:"horizontal",disabled:Bn!=="blocks",children:[r.jsx(Ch,{ref:y,id:"preview-blocks-editor",defaultSize:Bn==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Bn==="blocks"&&r.jsx(fb,{virtualMcpId:t,externalSelection:v})}),Bn==="blocks"&&r.jsx(k7,{withHandle:!0}),r.jsx(Ch,{id:"preview-canvas",defaultSize:Bn==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:xe=>{if(!xe)return;const De=()=>k(Vt=>Vt.width===xe.clientWidth&&Vt.height===xe.clientHeight?Vt:{width:xe.clientWidth,height:xe.clientHeight});De();const vt=new ResizeObserver(De);return vt.observe(xe),()=>vt.disconnect()},className:ie("h-full relative overflow-clip flex justify-center",Fs&&!ro&&"bg-muted/30"),children:[(ne||Ot)&&Fs&&r.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:r.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),_t.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(yc,{kind:"starting",progress:mt,claimPhase:ot})}),$t.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(yc,{kind:"suspended",onResume:ce.resume})}),$t.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(yc,{kind:"errored",error:$t.error,onRetry:ce.retry,connectionsHref:`/${se.slug}/settings/connections`})}),_t.showWakingPill&&r.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[r.jsx(lt,{size:18,className:"mt-0.5 shrink-0 animate-spin text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Bn==="visual"&&!x&&r.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[r.jsx(bx,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Bn==="visual"&&x&&r.jsx(uX,{element:x,onDismiss:()=>b(null)}),Xl,Fs&&Ce&&r.jsx("div",{className:ie("shrink-0",!ro&&"border-x border-border bg-background shadow-sm"),style:dd,children:r.jsx("iframe",{ref:_,src:Ce,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Ql.handleError,onLoad:()=>{if(Ql.handleLoad(),H(),_t.mode!=="sandbox"){_t.mode==="production"&&!_t.showWakingPill&&u==="blocks"&&Xo();return}if(Je("vm_preview_loaded",{view_mode:u,vm_id:te?.sandboxHandle??null}),!$)try{const xe=_.current?.contentWindow?.location?.pathname;if(!xe)return;const De=Oe.current;if(De!==null&&(Oe.current=null,nt(xe)!==nt(De))||nt(xe)===nt(ht))return;q(xe),On({path:xe,pageKey:W,params:wt})}catch{}u==="visual"&&pr(),u==="blocks"&&Xo()}},_t.iframeBase)})]})})]})}),r.jsx(UQ,{open:E,onOpenChange:D,isPending:Ze.isPending,error:I,templates:it,onSubmit:no})]})}function zne(t){const e=z.c(22),{virtualMcpId:s}=t,n=re(),i=Ms(s),{activeTask:o,taskId:l,currentBranch:a}=un(),c=h_(l),[d,u]=P.useState(!1);if(f_({threadId:l,sandboxBranch:o?.branch??a,agentHasRepo:sn(i?.metadata),threadHasRepo:sn(c)||sn(o?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(Jn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>u(!0),b=r.jsx(Jn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let L;e[9]!==v?(L=r.jsxs(he,{onClick:x,children:[b,v]}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==p||e[12]!==g||e[13]!==L?(_=r.jsx(Co,{className:"h-full",image:m,title:p,description:g,actions:L}),e[11]=p,e[12]=g,e[13]=L,e[14]=_):_=e[14];let y;e[15]!==d?(y=r.jsx(I2,{open:d,onOpenChange:u,mode:"agent"}),e[15]=d,e[16]=y):y=e[16];let S;return e[17]!==_||e[18]!==y?(S=r.jsxs(r.Fragment,{children:[_,y]}),e[17]=_,e[18]=y,e[19]=S):S=e[19],S}let f;return e[20]!==s?(f=r.jsx(Bne,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const Fne=P.lazy(()=>jn(()=>import("./file-explorer-6_ZvOUKC.js"),__vite__mapDeps([160,1,2,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,95,96,98,91,99,100,75,115,81,82,83,84,85,86,87,88,89,90,92,93,94,97,101,102,103,104,105,106,78,107,108,109,110,111,112,113,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.FileExplorer})));function Une(t){const e=z.c(23),{openPath:s}=t,n=re(),i=Kr(),{org:o}=Fe(),{currentBranch:l,taskId:a}=un(),c=i?.entity?.id??null,d=qc(),u=Ul(),h=Qn();u.vmEntry,h.lifecycle.phase;const f=d,m=c??"",p=l??"",g=a??null,x=f;let b;e[0]!==o.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:o.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=o.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],vS(b);const v=null;if(!c||!l){let w;e[6]!==n?(w=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=w):w=e[7];let j;return e[8]!==w?(j=r.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:w}),e[8]=w,e[9]=j):j=e[9],j}let L;e[10]!==v||e[11]!==n?(L=v,e[10]=v,e[11]=n,e[12]=L):L=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})}),e[13]=_):_=e[13];const y=a??null;let S;e[14]!==l||e[15]!==s||e[16]!==o.slug||e[17]!==y||e[18]!==c?(S=r.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:r.jsx(P.Suspense,{fallback:_,children:r.jsx(Fne,{orgSlug:o.slug,virtualMcpId:c,branch:l,threadId:y,openPath:s})})}),e[14]=l,e[15]=s,e[16]=o.slug,e[17]=y,e[18]=c,e[19]=S):S=e[19];let k;return e[20]!==L||e[21]!==S?(k=r.jsxs("div",{className:"flex flex-col w-full h-full",children:[L,S]}),e[20]=L,e[21]=S,e[22]=k):k=e[22],k}function Hne(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function Kne(t,e,s){return typeof t!="string"?null:Hne(Rn(t,e),s)}function xk(t,e,s){if(!e||typeof t!="string")return!1;const n=Kne(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Wne({orgSlug:t,virtualMcpId:e,branch:s}){const n=as(),i=Ts()?.taskId??null,o=qu(e),l=Cn(e).runtime==="cms";return Rs({mutationKey:mg(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const u=await R7({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return gg(n,{orgSlug:t,virtualMcpId:e,branch:s},u),await n.invalidateQueries({queryKey:s0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=Wu(o,xg(a)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():pg(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=Qe.decofile(c);await n.cancelQueries({queryKey:d});const u=n.getQueryData(d),h=!!u&&a in u,f=u?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:h,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>d.hadKey?{...u??{},[d.blockKey]:d.previousValue}:u)},onSuccess:()=>{n.invalidateQueries({queryKey:Qe.liveMeta(t,e,s)})}})}function ec(t){const e=z.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let o;e[0]!==i||e[1]!==n||e[2]!==s?(o=s?"No results match your search.":r.jsxs(r.Fragment,{children:[r.jsx("div",{children:n}),r.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==o?(l=r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=l):l=e[5],l}function C9(t,e){return`${t}-${e}`}function bk(t,e){return`site/apps/${t}/${e}.ts`}function vk(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function qne(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Gne(t){return t==="local"?"Custom":"Installed"}function yk(t,e,s){const n=new Set([C9(t,e),e].map(o=>o.toLowerCase())),i=bk(t,e);for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(o.toLowerCase())||a.__resolveType===i)return o}return null}function Yne(t,e){const s=t.vendor.alias,n=t.name,i=yk(s,n,e);return{id:C9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:bk(s,n),blockKey:i,installed:i!==null}}function Jne(t,e,s){if(t===Ng)return null;const n=vk(t);if(!n)return null;const{vendor:i,app:o}=n,l=yk(i,o,s),a=Yo(t,e);return{id:C9(i,o),app:o,vendor:i,title:a.title??o,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function Qne(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Ec(t,e)||!W7(n))return null;const i=vk(n)??qne(t);if(!i)return null;const o=Yo(n,s),{vendor:l,app:a}=i;return{id:C9(l,a),app:a,vendor:l,title:o.title??Eh(t,e,s),description:o.description??"",category:Gne(l),logo:o.logo??o.icon,resolveType:n,blockKey:t,installed:!0}}function Xne(t,e,s){const n=new Map;for(const o of t){const l=Yne(o,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const o of Object.keys(i)){const l=Jne(o,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[o,l]of Object.entries(s)){if(o.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=Qne(o,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(Zne)}function Zne(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function eie(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function tie(t,e,s){const n=z.c(12),i=s?.enabled??!0;let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o=Qe.decoApps(),n[0]=o):o=n[0];let l;n[1]!==i?(l={queryKey:o,queryFn:eie,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Pt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?Xne(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,u=a.isLoading&&!a.isError;let h;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==u?(h={catalog:d,isLoading:u,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=u,n[11]=h):h=n[11],h}function sie(t){const e=z.c(86),{active:s,counts:n,showBlog:i,onSelect:o}=t,l=re();let a;e[0]!==l?(a=l("sandbox.collectionsSidebar.content"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=r.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:r.jsx("span",{className:"text-sm font-medium",children:a})}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("sandbox.collectionsSidebar.pages"),e[4]=l,e[5]=d):d=e[5];const u=s==="pages";let h;e[6]!==n.pages||e[7]!==o||e[8]!==d||e[9]!==u?(h=r.jsx(Fn,{id:"pages",icon:_o,label:d,count:n.pages,active:u,onSelect:o}),e[6]=n.pages,e[7]=o,e[8]=d,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==o||e[15]!==f||e[16]!==m?(p=r.jsx(Fn,{id:"sections",icon:Rr,label:f,count:n.sections,active:m,onSelect:o}),e[13]=n.sections,e[14]=o,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==o||e[22]!==x||e[23]!==g?(b=r.jsx(Fn,{id:"apps",icon:i8,label:g,count:n.apps,active:x,onSelect:o}),e[20]=n.apps,e[21]=o,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==l?(v=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=v):v=e[26];const L=s==="redirects";let _;e[27]!==n.redirects||e[28]!==o||e[29]!==v||e[30]!==L?(_=r.jsx(Fn,{id:"redirects",icon:p6,label:v,count:n.redirects,active:L,onSelect:o}),e[27]=n.redirects,e[28]=o,e[29]=v,e[30]=L,e[31]=_):_=e[31];let y;e[32]!==l?(y=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=y):y=e[33];const S=s==="loaders";let k;e[34]!==n.loaders||e[35]!==o||e[36]!==y||e[37]!==S?(k=r.jsx(Fn,{id:"loaders",icon:jc,label:y,count:n.loaders,active:S,onSelect:o}),e[34]=n.loaders,e[35]=o,e[36]=y,e[37]=S,e[38]=k):k=e[38];let w;e[39]!==l?(w=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=w):w=e[40];const j=s==="actions";let N;e[41]!==n.actions||e[42]!==o||e[43]!==w||e[44]!==j?(N=r.jsx(Fn,{id:"actions",icon:wi,label:w,count:n.actions,active:j,onSelect:o}),e[41]=n.actions,e[42]=o,e[43]=w,e[44]=j,e[45]=N):N=e[45];let T;e[46]!==l?(T=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=T):T=e[47];const C=s==="site";let V;e[48]!==o||e[49]!==T||e[50]!==C?(V=r.jsx(Fn,{id:"site",icon:y2,label:T,active:C,onSelect:o}),e[48]=o,e[49]=T,e[50]=C,e[51]=V):V=e[51];let A;e[52]!==l?(A=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=A):A=e[53];const E=s==="seo";let D;e[54]!==o||e[55]!==A||e[56]!==E?(D=r.jsx(Fn,{id:"seo",icon:m2,label:A,active:E,onSelect:o}),e[54]=o,e[55]=A,e[56]=E,e[57]=D):D=e[57];let I;e[58]!==l?(I=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=I):I=e[59];const R=s==="calendar";let $;e[60]!==o||e[61]!==I||e[62]!==R?($=r.jsx(Fn,{id:"calendar",icon:Bl,label:I,active:R,onSelect:o}),e[60]=o,e[61]=I,e[62]=R,e[63]=$):$=e[63];let B;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==o||e[69]!==i||e[70]!==l?(B=i&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[r.jsx(kc,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),r.jsx(Fn,{id:"posts",icon:yi,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:o}),r.jsx(Fn,{id:"authors",icon:M2,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:o}),r.jsx(Fn,{id:"categories",icon:$2,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:o}),r.jsx(Fn,{id:"post-schedule",icon:dV,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:o})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=o,e[69]=i,e[70]=l,e[71]=B):B=e[71];let M;e[72]!==b||e[73]!==_||e[74]!==k||e[75]!==N||e[76]!==V||e[77]!==D||e[78]!==$||e[79]!==B||e[80]!==h||e[81]!==p?(M=r.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,_,k,N,V,D,$,B]}),e[72]=b,e[73]=_,e[74]=k,e[75]=N,e[76]=V,e[77]=D,e[78]=$,e[79]=B,e[80]=h,e[81]=p,e[82]=M):M=e[82];let O;return e[83]!==c||e[84]!==M?(O=r.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=O):O=e[85],O}function Fn(t){const e=z.c(18),{id:s,icon:n,label:i,count:o,active:l,onSelect:a}=t;let c;e[0]!==s||e[1]!==a?(c=()=>a(s),e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let u;e[3]!==d?(u=ie("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=r.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==i?(f=r.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==o?(m=o!==void 0&&r.jsx("span",{className:ie("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=l,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==u||e[14]!==h||e[15]!==f||e[16]!==m?(p=r.jsxs("button",{type:"button",onClick:c,className:u,children:[h,f,m]}),e[12]=c,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function nie(t){const e=z.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:o,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=oS({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==a?(c=r.jsx(yc,{kind:"starting",progress:a,claimPhase:n}),e[3]=n,e[4]=a,e[5]=c):c=e[5],c}case"suspended":{let a;return e[6]!==o?(a=r.jsx(yc,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==o||e[10]!==s.error?(a=r.jsx(yc,{kind:"errored",error:s.error,onRetry:o,connectionsHref:l}),e[8]=l,e[9]=o,e[10]=s.error,e[11]=a):a=e[11],a}}}const iie=new Set(["clone-failed","install-failed","start-failed","crashed"]);function rie(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!iie.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function xb(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let i=2;i<1e3;i++){const o=`${s} (copy ${i})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function oie(t,e){const s=wo,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let o=2;o<1e3;o++){const l=`${n}-copy-${o}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function lie(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let i=2;i<1e3;i++){const o=`${s}_copy_${i}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function aie(t){const e=x3(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function cie(t,e){return Gw(t,e)}const die=1e3;function uie(t,e){for(let s=0;s<die;s++){const n=x3(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const hie={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},fie={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},mie={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function pie(t){const e=z.c(88),{open:s,mode:n,initialName:i,initialPath:o,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=re(),[p,g]=P.useState(i),[x,b]=P.useState(o),[v,L]=P.useState(ko),[_,y]=P.useState(null),[S,k]=P.useState(s);s!==S&&(k(s),s&&(g(i),b(o),L(ko),y(null)));const w=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=ue=>{!ue&&!f&&(y(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const N=j;let T;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==w||e[8]!==v||e[9]!==d?(T=async ue=>{ue.preventDefault();const fe=p.trim(),ae=x.trim();if(!fe||!ae||f)return;const de=jg(ae);if(de){y(de);return}const X=d?.({name:fe,path:ae});if(X){y(X);return}y(null),await u({name:fe,path:ae,templateKey:w&&v!==ko?v:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=w,e[8]=v,e[9]=d,e[10]=T):T=e[10];const C=T,V=_??a,A=hie[n];let E;e[11]!==m||e[12]!==A?(E=m(A),e[11]=m,e[12]=A,e[13]=E):E=e[13];let D;e[14]!==E?(D=r.jsx(os,{children:r.jsx(Kt,{children:E})}),e[14]=E,e[15]=D):D=e[15];let I;e[16]!==f||e[17]!==w||e[18]!==m||e[19]!==v||e[20]!==c?(I=w&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:m("sandbox.pageFormDialog.labelTemplate")}),r.jsx(Jw,{id:"page-form-template",value:v,onChange:L,templates:c??[],disabled:f})]}),e[16]=f,e[17]=w,e[18]=m,e[19]=v,e[20]=c,e[21]=I):I=e[21];let R;e[22]!==m?(R=m("sandbox.pageFormDialog.labelName"),e[22]=m,e[23]=R):R=e[23];let $;e[24]!==R?($=r.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:R}),e[24]=R,e[25]=$):$=e[25];let B;e[26]===Symbol.for("react.memo_cache_sentinel")?(B=ue=>g(ue.target.value),e[26]=B):B=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let O;e[29]!==f||e[30]!==p||e[31]!==M?(O=r.jsx(gt,{id:"page-form-name",value:p,onChange:B,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=M,e[32]=O):O=e[32];let F;e[33]!==O||e[34]!==$?(F=r.jsxs("div",{className:"space-y-1.5",children:[$,O]}),e[33]=O,e[34]=$,e[35]=F):F=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,e[37]=U):U=e[37];let K;e[38]!==U?(K=r.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=K):K=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=ue=>b(ue.target.value),e[40]=q):q=e[40];let W;e[41]!==m?(W=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=W):W=e[42];let G;e[43]!==f||e[44]!==x||e[45]!==W?(G=r.jsx(gt,{id:"page-form-path",value:x,onChange:q,placeholder:W,disabled:f}),e[43]=f,e[44]=x,e[45]=W,e[46]=G):G=e[46];let Y;e[47]!==K||e[48]!==G?(Y=r.jsxs("div",{className:"space-y-1.5",children:[K,G]}),e[47]=K,e[48]=G,e[49]=Y):Y=e[49];let ee;e[50]!==V?(ee=V&&r.jsx("p",{className:"text-xs text-destructive",children:V}),e[50]=V,e[51]=ee):ee=e[51];let ne;e[52]!==F||e[53]!==Y||e[54]!==ee||e[55]!==I?(ne=r.jsxs("div",{className:"space-y-4 py-4",children:[I,F,Y,ee]}),e[52]=F,e[53]=Y,e[54]=ee,e[55]=I,e[56]=ne):ne=e[56];let oe;e[57]!==h?(oe=()=>h(!1),e[57]=h,e[58]=oe):oe=e[58];let Z;e[59]!==m?(Z=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=Z):Z=e[60];let J;e[61]!==f||e[62]!==oe||e[63]!==Z?(J=r.jsx(he,{type:"button",variant:"outline",onClick:oe,disabled:f,children:Z}),e[61]=f,e[62]=oe,e[63]=Z,e[64]=J):J=e[64];let H;e[65]!==f||e[66]!==p||e[67]!==x?(H=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=H):H=e[68];let se;e[69]!==f||e[70]!==n||e[71]!==m?(se=f?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),m(mie[n])]}):m(fie[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=se):se=e[72];let Q;e[73]!==H||e[74]!==se?(Q=r.jsx(he,{type:"submit",disabled:H,children:se}),e[73]=H,e[74]=se,e[75]=Q):Q=e[75];let ce;e[76]!==J||e[77]!==Q?(ce=r.jsxs(qn,{children:[J,Q]}),e[76]=J,e[77]=Q,e[78]=ce):ce=e[78];let te;e[79]!==C||e[80]!==ne||e[81]!==ce||e[82]!==D?(te=r.jsx(Bt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:C,children:[D,ne,ce]})}),e[79]=C,e[80]=ne,e[81]=ce,e[82]=D,e[83]=te):te=e[83];let le;return e[84]!==N||e[85]!==s||e[86]!==te?(le=r.jsx(zt,{open:s,onOpenChange:N,children:te}),e[84]=N,e[85]=s,e[86]=te,e[87]=le):le=e[87],le}function gie(t){const e=z.c(70),{open:s,blockKey:n,initialName:i,isPending:o,onSubmit:l,onOpenChange:a}=t,c=o===void 0?!1:o,d=re(),[u,h]=P.useState(i),[f,m]=P.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=q=>{!q&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==u||e[5]!==l?(x=async q=>{q.preventDefault();const W=u.trim();!W||c||await l(W)},e[3]=c,e[4]=u,e[5]=l,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let L;e[9]!==v?(L=r.jsx(Kt,{children:v}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==d?(_=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=_):_=e[12];let y;e[13]!==_?(y=r.jsx(kn,{children:_}),e[13]=_,e[14]=y):y=e[14];let S;e[15]!==L||e[16]!==y?(S=r.jsxs(os,{children:[L,y]}),e[15]=L,e[16]=y,e[17]=S):S=e[17];let k;e[18]!==d?(k=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=k):k=e[19];let w;e[20]!==k?(w=r.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:k}),e[20]=k,e[21]=w):w=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=q=>h(q.target.value),e[22]=j):j=e[22];let N;e[23]!==c||e[24]!==u?(N=r.jsx(gt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=N):N=e[25];let T;e[26]!==w||e[27]!==N?(T=r.jsxs("div",{className:"space-y-1.5",children:[w,N]}),e[26]=w,e[27]=N,e[28]=T):T=e[28];let C;e[29]!==d?(C=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=C):C=e[30];let V;e[31]!==C?(V=r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:C}),e[31]=C,e[32]=V):V=e[32];let A;e[33]!==n?(A=r.jsx(gt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=A):A=e[34];let E;e[35]!==V||e[36]!==A?(E=r.jsxs("div",{className:"space-y-1.5",children:[V,A]}),e[35]=V,e[36]=A,e[37]=E):E=e[37];let D;e[38]!==T||e[39]!==E?(D=r.jsxs("div",{className:"space-y-4 py-4",children:[T,E]}),e[38]=T,e[39]=E,e[40]=D):D=e[40];let I;e[41]!==a?(I=()=>a(!1),e[41]=a,e[42]=I):I=e[42];let R;e[43]!==d?(R=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=R):R=e[44];let $;e[45]!==c||e[46]!==I||e[47]!==R?($=r.jsx(he,{type:"button",variant:"outline",onClick:I,disabled:c,children:R}),e[45]=c,e[46]=I,e[47]=R,e[48]=$):$=e[48];let B;e[49]!==c||e[50]!==u?(B=!u.trim()||c,e[49]=c,e[50]=u,e[51]=B):B=e[51];let M;e[52]!==c||e[53]!==d?(M=c?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let O;e[55]!==B||e[56]!==M?(O=r.jsx(he,{type:"submit",disabled:B,children:M}),e[55]=B,e[56]=M,e[57]=O):O=e[57];let F;e[58]!==$||e[59]!==O?(F=r.jsxs(qn,{children:[$,O]}),e[58]=$,e[59]=O,e[60]=F):F=e[60];let U;e[61]!==b||e[62]!==D||e[63]!==F||e[64]!==S?(U=r.jsx(Bt,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:b,children:[S,D,F]})}),e[61]=b,e[62]=D,e[63]=F,e[64]=S,e[65]=U):U=e[65];let K;return e[66]!==g||e[67]!==s||e[68]!==U?(K=r.jsx(zt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=K):K=e[69],K}function xie(t){const e=z.c(7),{type:s}=t,n=oO[s];let i;e[0]!==n?(i=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=i):i=e[1];const o=s==="permanent"?"Permanent":"Temporary";let l;e[2]!==o?(l=r.jsx(Ke,{side:"left",children:o}),e[2]=o,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=r.jsxs(We,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const A1={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},$3=["posts","authors","categories"],iu={posts:"post",authors:"author",categories:"category"};function ru(t){return $3.includes(t)}const O3={posts:"post",authors:"author",categories:"category"},_k={posts:A1.post,authors:A1.author,categories:A1.category},bie=Object.fromEntries(Object.entries(_k).map(([t,e])=>[e,t]));function vie(t){return typeof t=="string"?bie[t]??null:null}function Bo(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function rs(t){return typeof t=="string"?t:""}function yie(t,e){switch(t){case"posts":return{label:rs(e.title)||"Untitled post",subtitle:rs(e.slug)};case"authors":return{label:rs(e.name)||"Unnamed author",subtitle:rs(e.email)};case"categories":return{label:rs(e.name)||"Unnamed category",subtitle:rs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Lk(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=Bo(n);if(!i)continue;const o=vie(i.__resolveType);if(!o)continue;const l=Bo(i[O3[o]])??{},{label:a,subtitle:c}=yie(o,l);e[o].push({key:s,kind:o,label:a,subtitle:c})}for(const s of $3)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function _ie(t,e){return Lk(t)[e]}function ku(t,e){return _ie(t,e).map(s=>({key:s.key,payload:Bd(Bo(t[s.key])??void 0,e)}))}const bb=Object.freeze({});function Bd(t,e){return t?Bo(t[O3[e]])??bb:bb}function tc(t,e,s){return{name:t,__resolveType:_k[e],[O3[e]]:s}}function Zme({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],o=f=>typeof f=="string"?f:rs(Bo(f)?.[s]),l=f=>typeof f=="string"?f:rs(Bo(f)?.name),a=f=>{const m=o(f),p=m?t.find(({payload:x})=>rs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>rs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:rs(m.name)||rs(m[s])||f})),d=new Map,u=[];return i.forEach((f,m)=>{const p=a(f);if(p){u.includes(p.key)||u.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),u.push(g),c.push({value:g,label:l(f)||o(f)||"Unknown"})}),{options:c,selectedValues:u,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function El(t){return Array.isArray(t)?t:[]}function Er(t){if(typeof t=="string")return t;const e=Bo(t);return e?rs(e.slug):""}function Lie(t){if(typeof t=="string")return t;const e=Bo(t);return e?rs(e.email):""}function wk(t){const e=[];return rs(t.title).trim()||e.push("Title"),rs(t.slug).trim()||e.push("Slug"),El(t.categories).map(Er).filter(Boolean).length===0&&e.push("Category"),rs(t.excerpt).trim()||e.push("Excerpt"),rs(t.image).trim()||e.push("Cover image"),e}const Sk=8;function kk(t){const e=rs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function epe(t,e){return e!=="published"||kk(t)==="published"?!1:wk(t).length>0}function wie(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Sk).toISOString()}function tpe(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=rs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?wie(s):n}}function jk(t){return ku(t,"posts").map(({key:e,payload:s})=>({key:e,title:rs(s.title)||"Untitled post",slug:rs(s.slug),date:rs(s.date),scheduledDatetime:rs(s.scheduledDatetime),categorySlugs:El(s.categories).map(Er).filter(Boolean),authorEmails:El(s.authors).map(Lie).filter(Boolean),missing:wk(s),status:kk(s)}))}function Sie(t,e){const s=El(t.categories);return s.some(n=>Er(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function kie(t,e){const s=El(t.categories);return s.length===1&&Er(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function spe(t,e,s){const n=El(t.categories);if(!n.some(a=>Er(a)===e))return t;const i=n.map(a=>{const c=Er(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),o=new Set,l=i.filter(a=>{const c=Er(a);return c?o.has(c)?!1:(o.add(c),!0):!0});return{...t,categories:l}}function jie(t,e){const s=El(t.categories);return s.some(n=>Er(n)===e)?{...t,categories:s.filter(n=>Er(n)!==e)}:t}function vb(t){return{...t,dateModified:new Date().toISOString()}}function Jm(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function P1(t,e){const s=`collections/blog/${e}/${Jm(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Ck(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Jm(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Jm(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Cie={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},yb="Box";function Nie(t){return t.startsWith("site/")?"site":"app"}function Tie(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Ld(...t){for(const e of t)if(e!==void 0)return e}function npe(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const o of Object.keys(i)){if(!Pie(o)||e.has(o))continue;e.add(o);const l=Yo(o,t),a=Vie(o),c=Cie[a],d=Nie(o),u=(d==="site"?Ld(l.title,c?.title):Ld(c?.title,l.title))??a,h=d==="site"?Ld(l.description,c?.description):Ld(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&Tie(f)?f:void 0,p=m!==void 0?c?.iconName??yb:Ld(f,c?.iconName)??yb;s.push({resolveType:o,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,o)=>i.title.localeCompare(o.title))}function Vie(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Aie=["blog/sections/blocks/","site/sections/Blog/Post/"];function Pie(t){return Aie.some(e=>t.startsWith(e))}const ipe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],rpe=["January","February","March","April","May","June","July","August","September","October","November","December"],Nk=1440*60*1e3;function bl(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function ope(t){return new Date(t.getFullYear(),t.getMonth(),1)}function lpe(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function sf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function Qm(t,e){return Math.round((bl(t).getTime()-bl(e).getTime())/Nk)}function Eie(t){const e=(t.getTime()-bl(t).getTime())/Nk;return Math.min(Math.max(e,0),1)}function _b(t,e){return Qm(t,e)+Eie(t)}function ape(t){const e=sf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let o=0;o<7;o++)i.push(sf(e,n*7+o));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function cpe(t,e){const s=bl(t[0]),n=sf(s,7),i=s.getTime(),o=n.getTime(),l=[];for(const d of e){const u=bl(d.start),h=bl(d.end);if(h.getTime()<s.getTime()||u.getTime()>=n.getTime())continue;const f=u.getTime()<s.getTime()?s:u,m=h.getTime()>=n.getTime()?sf(n,-1):h,p=Qm(f,s),g=Qm(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),o),v=_b(new Date(x),s),L=Math.max(_b(new Date(b),s)-v,0);L<=0||l.push({variant:d,startCol:p,span:g,leftUnits:v,widthUnits:L})}l.sort((d,u)=>d.startCol-u.startCol||u.span-d.span||d.variant.blockKey.localeCompare(u.variant.blockKey));const a=[],c=[];for(const d of l){let u=a.findIndex(h=>h<=d.startCol);u===-1&&(u=a.length,a.push(0)),a[u]=d.startCol+d.span,c.push({...d,lane:u})}return c}function nf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const Tk=/^(\d{4})-(\d{2})-(\d{2})$/;function rf(t){const e=t.trim();if(!e)return null;const s=Tk.exec(e);if(s){const i=Number(s[1]),o=Number(s[2])-1,l=Number(s[3]),a=new Date(i,o,l);return a.getMonth()===o&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:bl(n)}function Die(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Sk);return{...Ck("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:nf(t)}}function Rie(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(Tk.test(e))return rf(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Iie(t,e){const s=Rie(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===nf(s)&&(i.date=nf(n)),i}function Mie(t){return rf(t.scheduledDatetime)??rf(t.date)}function dpe(t){const e=new Map,s=[];for(const i of t){const o={post:i,scheduled:rf(i.scheduledDatetime)!==null},l=Mie(i);if(!l){s.push(o);continue}const a=nf(l),c=e.get(a);c?c.push(o):e.set(a,[o])}const n=(i,o)=>Number(o.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(o.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const $ie="0.161.0",Oie="0.162.0",upe="deno task update";function Lb(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function wb(t,e){const s=Lb(t),n=Lb(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const o=s[i]-n[i];if(o!==0)return o}return 0}const Vk=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Bie(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=Vk.exec(s)?.[1];if(n)return n}return null}function zie(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=Vk.exec(n)?.[1];if(i)return i}return null}function Fie(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Bie(t.denoJson)??zie(t.meta);return!e||wb(e,$ie)<0?{kind:"outdated",version:e}:wb(e,Oie)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function hpe(t){return t.kind==="publish-only"||t.kind==="full"}function fpe(t){return t.kind==="full"}function Uie(t){const e=z.c(16),s=Ms(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=qu(t.virtualMcpId),i=Ts()?.taskId??null;let o;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(o=Qe.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=o):o=e[3];let l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const f=await bg({...t,threadId:i},Wu(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==o||e[9]!==l||e[10]!==a?(c={queryKey:o,queryFn:l,enabled:a,staleTime:3e5},e[8]=o,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Pt(c),u=d??null;let h;return e[12]!==s||e[13]!==t.meta||e[14]!==u?(h=Fie({packageManager:s,denoJson:u,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=u,e[15]=h):h=e[15],h}function Hie({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const o=re(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=P.useState(!1),[h,f]=P.useState(c),[m,p]=P.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},v=async L=>{if(!i||m)return;let _;try{_=JSON.parse(L)}catch{ge.error(o("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(_),ge.success(o("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(y){ge.error(o("sectionsEditor.pageJsonDialog.saveError",{error:y instanceof Error?y.message:String(y)}))}finally{p(!1)}};return r.jsx(zt,{open:t,onOpenChange:e,children:r.jsxs(Bt,{className:"max-w-3xl p-0 gap-0",children:[r.jsxs(os,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[r.jsx(Kt,{className:"text-sm font-semibold",children:o("sectionsEditor.pageJsonDialog.title")}),r.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[r.jsxs(he,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?r.jsx(hi,{size:12}):r.jsx(dn,{size:12}),o(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&r.jsx(he,{size:"sm",onClick:()=>v(h),disabled:!x||m,className:"h-7 text-xs",children:o(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",o("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"h-[70vh]",children:r.jsx($u,{code:c,language:"json",readOnly:g,height:"100%",onChange:L=>f(L??""),onSave:L=>{v(L)}})})]})})}function pi(t){const e=z.c(45),{icon:s,logoUrl:n,title:i,subtitle:o,active:l,accent:a,variantCount:c,trailing:d,selectable:u,selectionActive:h,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=a==="global";let L;e[0]!==s||e[1]!==l||e[2]!==v||e[3]!==n||e[4]!==c?(L=c&&c>1?r.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(s,{size:16,className:"shrink-0 text-success"})}),r.jsxs(Ke,{side:"right",children:[c," variants"]})]})}):n?r.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):r.jsx("span",{className:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",v?"bg-global-section/15":"bg-muted"),children:r.jsx(s,{size:16,className:ie("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:_g}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=L):L=e[5];const _=L,y=l?v?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":v?"hover:bg-global-section/10":"hover:bg-muted";let S;e[6]!==y?(S=ie("group relative flex min-w-0 items-center rounded-md transition-colors",y),e[6]=y,e[7]=S):S=e[7];let k;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==i?(k=u&&r.jsx("span",{className:ie("flex shrink-0 items-center pl-2.5 transition-opacity",f||h?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Kie,children:r.jsx(Gc,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=i,e[13]=k):k=e[13];const w=m&&!l&&"text-destructive";let j;e[14]!==w?(j=ie("block truncate text-sm font-medium",w),e[14]=w,e[15]=j):j=e[15];let N;e[16]!==j||e[17]!==i?(N=r.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=N):N=e[18];const T=l?"text-accent-foreground/70":"text-muted-foreground";let C;e[19]!==T?(C=ie("block truncate text-xs",T),e[19]=T,e[20]=C):C=e[20];let V;e[21]!==o||e[22]!==C?(V=r.jsx("span",{className:C,children:o}),e[21]=o,e[22]=C,e[23]=V):V=e[23];let A;e[24]!==V||e[25]!==N?(A=r.jsxs("span",{className:"min-w-0 flex-1",children:[N,V]}),e[24]=V,e[25]=N,e[26]=A):A=e[26];let E;e[27]!==l||e[28]!==m||e[29]!==p?(E=m&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:r.jsx(bn,{size:14})})}),p&&r.jsx(Ke,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=E):E=e[30];let D;e[31]!==x||e[32]!==_||e[33]!==A||e[34]!==E||e[35]!==d?(D=r.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[_,A,E,d]}),e[31]=x,e[32]=_,e[33]=A,e[34]=E,e[35]=d,e[36]=D):D=e[36];let I;e[37]!==l||e[38]!==b?(I=b&&r.jsx("div",{className:ie("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=I):I=e[39];let R;return e[40]!==D||e[41]!==I||e[42]!==S||e[43]!==k?(R=r.jsxs("div",{className:S,children:[k,D,I]}),e[40]=D,e[41]=I,e[42]=S,e[43]=k,e[44]=R):R=e[44],R}function Kie(t){return t.stopPropagation()}function bo(t){const e=z.c(10),{icon:s,title:n,description:i}=t;let o;e[0]!==s?(o=s&&r.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let l;e[2]!==n?(l=r.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&r.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==o||e[7]!==l||e[8]!==a?(c=r.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[o,l,a]}),e[6]=o,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Wie={loaders:jc,actions:wi},qie={loaders:"Loaders",actions:"Actions"},Gie={analytics:lA,blog:kc,commerce:D2,site:uV,website:Mn};function Yie(t,e){return e===0?Gie[t.toLowerCase()]??No:No}function G0(t,e){return e===0?xZ(t):t}function Jie(t){const e=z.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c}=t,d=re();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=P.useState(u),[m,p]=P.useState(null),[g,x]=P.useState(""),[b,v]=P.useState(ire),[L,_]=P.useState(c);L!==c&&(_(c),f([]),p(null),x(""),v(new Set));let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=U=>{v(K=>{const q=new Set(K);return q.has(U)?q.delete(U):q.add(U),q})},e[1]=y):y=e[1];const S=y;let k;e[2]!==i||e[3]!==s||e[4]!==n?(k={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=k):k=e[5];const w=n0(k);let j;e[6]!==w?(j=w3((U,K)=>w.mutate({blockKey:U,data:K})),e[6]=w,e[7]=j):j=e[7];const N=j;let T;e[8]!==c?(T=fS(c),e[8]=c,e[9]=T):T=e[9];const C=T,V=Wie[c];let A,E,D,I,R,$,B;if(e[10]!==V||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==o||e[19]!==w||e[20]!==N||e[21]!==g||e[22]!==m||e[23]!==C||e[24]!==d||e[25]!==n){D=Symbol.for("react.early_return_sentinel");e:{const U=[...xS(l,a,c).map(nre),...pS(l,c).map(sre)],K=g.trim().toLowerCase(),q=K.length>0,W=q?U.filter(ve=>ve.title.toLowerCase().includes(K)||ve.resolveType.toLowerCase().includes(K)):[],G=new Map,Y=[],ee=new Map;if(!q){for(const ve of U){const ke=ve.folderPath;if(!(ke.length<h.length)&&h.every((Le,Ne)=>ke[Ne]===Le))if(ke.length===h.length)if(ve.savedKey!==void 0){const Le=ee.get(ve.resolveType);Le?Le.push(ve):ee.set(ve.resolveType,[ve])}else Y.push(ve);else{const Le=ke[h.length],Ne=G.get(Le)??{count:0,savedCount:0};ve.savedKey!==void 0?Ne.savedCount=Ne.savedCount+1:Ne.count=Ne.count+1,G.set(Le,Ne)}}Y.sort(tre);for(const ve of ee.values())ve.sort(ere)}const ne=[...ee.entries()].filter(ve=>{const[ke]=ve;return!Y.some(Le=>Le.resolveType===ke)}).flatMap(Zie).sort(Xie);let oe;e[33]!==h?(oe=(ve,ke)=>G0(ve.name,h.length).localeCompare(G0(ke.name,h.length)),e[33]=h,e[34]=oe):oe=e[34];const Z=[...G.entries()].map(Qie).sort(oe);let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=ve=>{p(ve.savedKey!==void 0?{mode:"saved",key:ve.savedKey}:{mode:"available",resolveType:ve.resolveType,title:ve.title})},e[35]=J):J=e[35];const H=J;let se;e[36]!==w||e[37]!==C||e[38]!==d?(se=async(ve,ke)=>{await w.mutateAsync({blockKey:ve,data:ke}),ge.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:C,blockId:ve})),p({mode:"saved",key:ve})},e[36]=w,e[37]=C,e[38]=d,e[39]=se):se=e[39];const Q=se;let ce;e[40]!==a||e[41]!==m?(ce=rre(m,a),e[40]=a,e[41]=m,e[42]=ce):ce=e[42];const te=ce;if(te){const ve=`${te.mode}:${te.mode==="saved"?te.blockKey:te.resolveType}`;let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=()=>p(null),e[43]=ke):ke=e[43];let Le;e[44]!==i||e[45]!==a||e[46]!==Q||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==o||e[51]!==w.isPending||e[52]!==N||e[53]!==ve||e[54]!==te.editorTarget||e[55]!==te.initialValue||e[56]!==n?(Le=r.jsx(gk,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,kind:c,target:te.editorTarget,initialValue:te.initialValue,isCreating:w.isPending,onCreate:Q,onSaveReferencedBlock:N,onBack:ke},ve),e[44]=i,e[45]=a,e[46]=Q,e[47]=c,e[48]=l,e[49]=s,e[50]=o,e[51]=w.isPending,e[52]=N,e[53]=ve,e[54]=te.editorTarget,e[55]=te.initialValue,e[56]=n,e[57]=Le):Le=e[57],D=Le;break e}B="flex h-full w-full min-w-0 flex-col";let le;e[58]!==d?(le=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=le):le=e[59];let ue;e[60]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>f([]),e[60]=ue):ue=e[60];const fe=h.length===0?"font-medium text-foreground":"text-muted-foreground";let ae;e[61]!==fe?(ae=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",fe),e[61]=fe,e[62]=ae):ae=e[62];const de=qie[c];let X;e[63]!==ae||e[64]!==de?(X=r.jsx("button",{type:"button",onClick:ue,className:ae,children:de}),e[63]=ae,e[64]=de,e[65]=X):X=e[65];let pe;e[66]!==h?(pe=h.map((ve,ke)=>{const Le=ke===h.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>f(h.slice(0,ke+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Le?"font-medium text-foreground":"text-muted-foreground"),children:G0(ve,ke)})]},`${ve}-${ke}`)}),e[66]=h,e[67]=pe):pe=e[67];let ye;e[68]!==le||e[69]!==X||e[70]!==pe?(ye=r.jsxs("nav",{"aria-label":le,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[X,pe]}),e[68]=le,e[69]=X,e[70]=pe,e[71]=ye):ye=e[71];let we;e[72]===Symbol.for("react.memo_cache_sentinel")?(we=r.jsx(Hf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=we):we=e[72];let _e;e[73]===Symbol.for("react.memo_cache_sentinel")?(_e=ve=>x(ve.target.value),e[73]=_e):_e=e[73];let Pe;e[74]!==c||e[75]!==d?(Pe=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Pe):Pe=e[76];let Se;e[77]!==c||e[78]!==d?(Se=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Se):Se=e[79];let Te;e[80]!==g||e[81]!==Pe||e[82]!==Se?(Te=r.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[we,r.jsx("input",{type:"text",value:g,onChange:_e,placeholder:Pe,"aria-label":Se,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Pe,e[82]=Se,e[83]=Te):Te=e[83],e[84]!==ye||e[85]!==Te?(E=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ye,Te]}),e[84]=ye,e[85]=Te,e[86]=E):E=e[86],A=Go,$="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",R=q?W.length===0?r.jsx(bo,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):r.jsx("div",{className:"flex flex-col gap-1",children:W.map(ve=>r.jsx(pi,{icon:V,accent:ve.savedKey!==void 0?"global":void 0,title:ve.title,subtitle:ve.resolveType,active:!1,onClick:()=>H(ve)},ve.savedKey??ve.resolveType))}):Z.length===0&&Y.length===0&&ne.length===0?r.jsx(bo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):r.jsxs(r.Fragment,{children:[Z.length>0&&r.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:Z.map(ve=>{const ke=Yie(ve.name,h.length);return r.jsxs("button",{type:"button",onClick:()=>f([...h,ve.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[r.jsx(ke,{size:18,className:"shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium",children:G0(ve.name,h.length)}),r.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[ve.count," ",ve.count===1?C:c,ve.savedCount>0&&r.jsxs(r.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:ve.savedCount})]})]})]})]},ve.name)})}),(Y.length>0||ne.length>0)&&r.jsxs("div",{className:ie("flex flex-col gap-1",Z.length>0&&"mt-4"),children:[Y.map(ve=>{const ke=ee.get(ve.resolveType)??[],Le=b.has(ve.resolveType);return r.jsxs("div",{className:"flex flex-col",children:[r.jsx(pi,{icon:V,title:ve.title,subtitle:ve.resolveType,active:!1,onClick:()=>H(ve)}),ke.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>S(ve.resolveType),"aria-expanded":Le,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:_g},children:[Le?r.jsx(_s,{size:12,className:"shrink-0"}):r.jsx(nn,{size:12,className:"shrink-0"}),d(Le?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ke.length,")"]}),Le&&r.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ke.map(Ne=>r.jsx(pi,{icon:V,accent:"global",title:Ne.title,subtitle:Ne.resolveType,active:!1,onClick:()=>H(Ne)},Ne.savedKey))})]})]},ve.resolveType)}),ne.map(ve=>r.jsx(pi,{icon:V,accent:"global",title:ve.title,subtitle:ve.resolveType,active:!1,onClick:()=>H(ve)},ve.savedKey))]})]})}e[10]=V,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=o,e[19]=w,e[20]=N,e[21]=g,e[22]=m,e[23]=C,e[24]=d,e[25]=n,e[26]=A,e[27]=E,e[28]=D,e[29]=I,e[30]=R,e[31]=$,e[32]=B}else A=e[26],E=e[27],D=e[28],I=e[29],R=e[30],$=e[31],B=e[32];if(D!==Symbol.for("react.early_return_sentinel"))return D;let M;e[87]!==I||e[88]!==R?(M=r.jsx("div",{className:I,children:R}),e[87]=I,e[88]=R,e[89]=M):M=e[89];let O;e[90]!==A||e[91]!==M||e[92]!==$?(O=r.jsx(A,{className:$,children:M}),e[90]=A,e[91]=M,e[92]=$,e[93]=O):O=e[93];let F;return e[94]!==E||e[95]!==O||e[96]!==B?(F=r.jsxs("div",{className:B,children:[E,O]}),e[94]=E,e[95]=O,e[96]=B,e[97]=F):F=e[97],F}function Qie(t){const[e,s]=t;return{name:e,...s}}function Xie(t,e){return t.title.localeCompare(e.title)}function Zie(t){const[,e]=t;return e}function ere(t,e){return t.title.localeCompare(e.title)}function tre(t,e){return t.title.localeCompare(e.title)}function sre(t){return{resolveType:t.resolveType,title:t.title,folderPath:gS(t.resolveType)}}function nre(t){return{resolveType:t.resolveType,title:t.title,folderPath:gS(t.resolveType),savedKey:t.key}}function ire(){return new Set}function rre(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:i}=bS(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function ore(t){const e=z.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:o,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=re(),g=Kr(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,L]=P.useState(b);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[1]=_):_=e[1];const[y,S]=P.useState(_),[k,w]=P.useState(0),[j,N]=P.useState(!1);let T;e[2]!==l||e[3]!==c?(T=Rn(c,l),e[2]=l,e[3]=c,e[4]=T):T=e[4];const C=T,V=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,A=Ts()?.taskId??null,E=o??void 0;let D;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==A||e[10]!==n?(D={orgSlug:s,virtualMcpId:n,branch:i,threadId:A,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=A,e[10]=n,e[11]=D):D=e[11];const I=D;let R,$,B,M,O,F,U,K;if(e[12]!==a||e[13]!==y||e[14]!==v||e[15]!==f||e[16]!==p||e[17]!==d){const ae=[d,...y],de=pe=>{S(y.slice(0,pe)),w(lre)};let X;e[26]!==a||e[27]!==v||e[28]!==f?(X=async pe=>{const ye=V3(pe,a);if(ye){ge.error(ye);return}await f(pe,v),N(!1)},e[26]=a,e[27]=v,e[28]=f,e[29]=X):X=e[29],R=X,M="flex h-full w-full min-w-0",B="flex min-w-0 flex-1 flex-col",$="shrink-0 border-b px-3 py-2.5",K="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==p?(O=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=O):O=e[31],F="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ae.map((pe,ye)=>{const we=ye===ae.length-1,_e=Sn(pe);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ye>0&&r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>de(ye),title:_e,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",we?"font-medium text-foreground":"text-muted-foreground"),children:_e})]},`${_e}-${ye}`)}),e[12]=a,e[13]=y,e[14]=v,e[15]=f,e[16]=p,e[17]=d,e[18]=R,e[19]=$,e[20]=B,e[21]=M,e[22]=O,e[23]=F,e[24]=U,e[25]=K}else R=e[18],$=e[19],B=e[20],M=e[21],O=e[22],F=e[23],U=e[24],K=e[25];let q;e[32]!==O||e[33]!==F||e[34]!==U?(q=r.jsx("nav",{"aria-label":O,className:F,children:U}),e[32]=O,e[33]=F,e[34]=U,e[35]=q):q=e[35];let W;e[36]===Symbol.for("react.memo_cache_sentinel")?(W=()=>N(!0),e[36]=W):W=e[36];let G;e[37]!==p?(G=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=G):G=e[38];let Y;e[39]===Symbol.for("react.memo_cache_sentinel")?(Y=r.jsx(d2,{size:14}),e[39]=Y):Y=e[39];let ee;e[40]!==h||e[41]!==G?(ee=r.jsx(He,{asChild:!0,children:r.jsx(he,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:W,"aria-label":G,children:Y})}),e[40]=h,e[41]=G,e[42]=ee):ee=e[42];let ne;e[43]!==p?(ne=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=ne):ne=e[44];let oe;e[45]!==ne?(oe=r.jsx(Ke,{side:"bottom",children:ne}),e[45]=ne,e[46]=oe):oe=e[46];let Z;e[47]!==ee||e[48]!==oe?(Z=r.jsxs(We,{children:[ee,oe]}),e[47]=ee,e[48]=oe,e[49]=Z):Z=e[49];let J;e[50]!==q||e[51]!==Z||e[52]!==K?(J=r.jsxs("div",{className:K,children:[q,Z]}),e[50]=q,e[51]=Z,e[52]=K,e[53]=J):J=e[53];const H="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",se=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:V});let Q;e[54]!==se?(Q=r.jsx("p",{className:H,children:se}),e[54]=se,e[55]=Q):Q=e[55];let ce;e[56]!==$||e[57]!==J||e[58]!==Q?(ce=r.jsxs("div",{className:$,children:[J,Q]}),e[56]=$,e[57]=J,e[58]=Q,e[59]=ce):ce=e[59];let te;e[60]!==a||e[61]!==y||e[62]!==k||e[63]!==v||e[64]!==l||e[65]!==m||e[66]!==I||e[67]!==C||e[68]!==p?(te=r.jsx(Go,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:C?r.jsx(Ri,{schema:C,value:v,onChange:ae=>L(ae),basePath:"",breadcrumbPath:y,onBreadcrumbChange:S,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:I},k):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=y,e[62]=k,e[63]=v,e[64]=l,e[65]=m,e[66]=I,e[67]=C,e[68]=p,e[69]=te):te=e[69];let le;e[70]!==B||e[71]!==ce||e[72]!==te?(le=r.jsxs("div",{className:B,children:[ce,te]}),e[70]=B,e[71]=ce,e[72]=te,e[73]=le):le=e[73];let ue;e[74]!==u||e[75]!==R||e[76]!==h||e[77]!==j?(ue=r.jsx(A3,{open:j,onOpenChange:N,defaultBlockId:u,isPending:h,onSubmit:R}),e[74]=u,e[75]=R,e[76]=h,e[77]=j,e[78]=ue):ue=e[78];let fe;return e[79]!==M||e[80]!==le||e[81]!==ue?(fe=r.jsxs("div",{className:M,children:[le,ue]}),e[79]=M,e[80]=le,e[81]=ue,e[82]=fe):fe=e[82],fe}function lre(t){return t+1}var are=Object.prototype.toString,od=Array.isArray||function(e){return are.call(e)==="[object Array]"};function B3(t){return typeof t=="function"}function cre(t){return od(t)?"array":typeof t}function E1(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Sb(t,e){return t!=null&&typeof t=="object"&&e in t}function dre(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var ure=RegExp.prototype.test;function hre(t,e){return ure.call(t,e)}var fre=/\S/;function mre(t){return!hre(fre,t)}var pre={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gre(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return pre[s]})}var xre=/\s*/,bre=/\s+/,kb=/\s*=/,vre=/\s*\}/,yre=/#|\^|\/|>|\{|&|=|!/;function _re(t,e){if(!t)return[];var s=!1,n=[],i=[],o=[],l=!1,a=!1,c="",d=0;function u(){if(l&&!a)for(;o.length;)delete i[o.pop()];else o=[];l=!1,a=!1}var h,f,m;function p(w){if(typeof w=="string"&&(w=w.split(bre,2)),!od(w)||w.length!==2)throw new Error("Invalid tags: "+w);h=new RegExp(E1(w[0])+"\\s*"),f=new RegExp("\\s*"+E1(w[1])),m=new RegExp("\\s*"+E1("}"+w[1]))}p(e||Ni.tags);for(var g=new i0(t),x,b,v,L,_,y;!g.eos();){if(x=g.pos,v=g.scanUntil(h),v)for(var S=0,k=v.length;S<k;++S)L=v.charAt(S),mre(L)?(o.push(i.length),c+=L):(a=!0,s=!0,c+=" "),i.push(["text",L,x,x+1]),x+=1,L===`
|
|
542
542
|
`&&(u(),c="",d=0,s=!1);if(!g.scan(h))break;if(l=!0,b=g.scan(yre)||"name",g.scan(xre),b==="="?(v=g.scanUntil(kb),g.scan(kb),g.scanUntil(f)):b==="{"?(v=g.scanUntil(m),g.scan(vre),g.scanUntil(f),b="&"):v=g.scanUntil(f),!g.scan(f))throw new Error("Unclosed tag at "+g.pos);if(b==">"?_=[b,v,x,g.pos,c,d,s]:_=[b,v,x,g.pos],d++,i.push(_),b==="#"||b==="^")n.push(_);else if(b==="/"){if(y=n.pop(),!y)throw new Error('Unopened section "'+v+'" at '+x);if(y[1]!==v)throw new Error('Unclosed section "'+y[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?a=!0:b==="="&&p(v)}if(u(),y=n.pop(),y)throw new Error('Unclosed section "'+y[1]+'" at '+g.pos);return wre(Lre(i))}function Lre(t){for(var e=[],s,n,i=0,o=t.length;i<o;++i)s=t[i],s&&(s[0]==="text"&&n&&n[0]==="text"?(n[1]+=s[1],n[3]=s[3]):(e.push(s),n=s));return e}function wre(t){for(var e=[],s=e,n=[],i,o,l=0,a=t.length;l<a;++l)switch(i=t[l],i[0]){case"#":case"^":s.push(i),n.push(i),s=i[4]=[];break;case"/":o=n.pop(),o[5]=i[2],s=n.length>0?n[n.length-1][4]:e;break;default:s.push(i)}return e}function i0(t){this.string=t,this.tail=t,this.pos=0}i0.prototype.eos=function(){return this.tail===""};i0.prototype.scan=function(e){var s=this.tail.match(e);if(!s||s.index!==0)return"";var n=s[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};i0.prototype.scanUntil=function(e){var s=this.tail.search(e),n;switch(s){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,s),this.tail=this.tail.substring(s)}return this.pos+=n.length,n};function $c(t,e){this.view=t,this.cache={".":this.view},this.parent=e}$c.prototype.push=function(e){return new $c(e,this)};$c.prototype.lookup=function(e){var s=this.cache,n;if(s.hasOwnProperty(e))n=s[e];else{for(var i=this,o,l,a,c=!1;i;){if(e.indexOf(".")>0)for(o=i.view,l=e.split("."),a=0;o!=null&&a<l.length;)a===l.length-1&&(c=Sb(o,l[a])||dre(o,l[a])),o=o[l[a++]];else o=i.view[e],c=Sb(i.view,e);if(c){n=o;break}i=i.parent}s[e]=n}return B3(n)&&(n=n.call(this.view)),n};function Tn(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Tn.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Tn.prototype.parse=function(e,s){var n=this.templateCache,i=e+":"+(s||Ni.tags).join(":"),o=typeof n<"u",l=o?n.get(i):void 0;return l==null&&(l=_re(e,s),o&&n.set(i,l)),l};Tn.prototype.render=function(e,s,n,i){var o=this.getConfigTags(i),l=this.parse(e,o),a=s instanceof $c?s:new $c(s,void 0);return this.renderTokens(l,a,n,e,i)};Tn.prototype.renderTokens=function(e,s,n,i,o){for(var l="",a,c,d,u=0,h=e.length;u<h;++u)d=void 0,a=e[u],c=a[0],c==="#"?d=this.renderSection(a,s,n,i,o):c==="^"?d=this.renderInverted(a,s,n,i,o):c===">"?d=this.renderPartial(a,s,n,o):c==="&"?d=this.unescapedValue(a,s):c==="name"?d=this.escapedValue(a,s,o):c==="text"&&(d=this.rawValue(a)),d!==void 0&&(l+=d);return l};Tn.prototype.renderSection=function(e,s,n,i,o){var l=this,a="",c=s.lookup(e[1]);function d(f){return l.render(f,s,n,o)}if(c){if(od(c))for(var u=0,h=c.length;u<h;++u)a+=this.renderTokens(e[4],s.push(c[u]),n,i,o);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(e[4],s.push(c),n,i,o);else if(B3(c)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(s.view,i.slice(e[3],e[5]),d),c!=null&&(a+=c)}else a+=this.renderTokens(e[4],s,n,i,o);return a}};Tn.prototype.renderInverted=function(e,s,n,i,o){var l=s.lookup(e[1]);if(!l||od(l)&&l.length===0)return this.renderTokens(e[4],s,n,i,o)};Tn.prototype.indentPartial=function(e,s,n){for(var i=s.replace(/[^ \t]/g,""),o=e.split(`
|
|
543
543
|
`),l=0;l<o.length;l++)o[l].length&&(l>0||!n)&&(o[l]=i+o[l]);return o.join(`
|
|
544
|
-
`)};Tn.prototype.renderPartial=function(e,s,n,i){if(n){var o=this.getConfigTags(i),l=B3(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],u=l;c==0&&d&&(u=this.indentPartial(l,d,a));var h=this.parse(u,o);return this.renderTokens(h,s,n,u,i)}}};Tn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Tn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ni.escape,o=s.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===Ni.escape?String(o):i(o)};Tn.prototype.rawValue=function(e){return e[1]};Tn.prototype.getConfigTags=function(e){return od(e)?e:e&&typeof e=="object"?e.tags:void 0};Tn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!od(e))return e.escape};var Ni={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){ju.templateCache=t},get templateCache(){return ju.templateCache}},ju=new Tn;Ni.clearCache=function(){return ju.clearCache()};Ni.parse=function(e,s){return ju.parse(e,s)};Ni.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+cre(e)+'" was given as the first argument for mustache#render(template, view, partials)');return ju.render(e,s,n,i)};Ni.escape=gre;Ni.Scanner=i0;Ni.Context=$c;Ni.Writer=Tn;function Sre(t,e){const s={__resolveType:t},n=Qw([s],e)[0];return n?jee(s,n,e):null}function kre({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,blockKey:l,onSaveReferencedBlock:a}){const c=re(),d=Kr(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=P.useState(()=>Sre(l,o)),[f,m]=P.useState(h?.data??{}),[p,g]=P.useState([]),[x,b]=P.useState(0),[v,L]=P.useState(!1),[_,y]=P.useState(null),S=_!==null,{save:k,flush:w}=Yw({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?Rn(h.resolveType,i):null,N=o[l],T=N?Cl(l,N):l,C=Ts()?.taskId??null,V={orgSlug:t,virtualMcpId:e,branch:s,threadId:C,previewUrl:n??void 0,siteSlug:u},A=$=>{m($),k(l,$)},E=()=>{S?(y(null),L(!1),b($=>$+1)):y(JSON.stringify(f,null,2))},D=$=>{const B=$??"";try{const M=JSON.parse(B);if(M&&typeof M=="object"&&!Array.isArray(M)){L(!1),A(M);return}L(!0)}catch{L(!0)}},I=[T,...p],R=$=>{g(p.slice(0,$)),b(B=>B+1)};return r.jsx("div",{className:"flex h-full w-full min-w-0",children:r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:_g},"aria-hidden":!0}),r.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:I.map(($,B)=>{const M=B===I.length-1,O=Sn($);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[B>0&&r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>R(B),title:O,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:O})]},`${O}-${B}`)})}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:S?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":S,children:S?r.jsx(Is,{size:14}):r.jsx(qo,{size:14})})}),r.jsx(Ke,{side:"bottom",children:c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),r.jsxs("div",{className:"relative min-h-0 flex-1",children:[r.jsx(Go,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:j?r.jsx(Ri,{schema:j,value:f,onChange:$=>A($),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:o,onSaveReferencedBlock:a,sandbox:V},x):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),_!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx($u,{language:"json",height:"100%",code:_,onChange:D,onSave:$=>{D($),w()}})})]})]})]})})}function jre(t){const e=z.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=re();if(!s){let g;e[0]!==f?(g=f("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=f,e[1]=g):g=e[1];let x;e[2]!==f?(x=f("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=f,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=r.jsx(bo,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let v;e[7]!==s.title?(v=US(s.title),e[7]=s.title,e[8]=v):v=e[8];let L;e[9]!==u||e[10]!==s.resolveType?(L=(y,S)=>u(s.resolveType,y,S),e[9]=u,e[10]=s.resolveType,e[11]=L):L=e[11];let _;return e[12]!==o||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==h||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==L||e[24]!==i?(_=r.jsx(ore,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:L,onSaveReferencedBlock:h},g),e[12]=o,e[13]=c,e[14]=d,e[15]=a,e[16]=h,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=L,e[24]=i,e[25]=_):_=e[25],_}const m=`saved:${s.key}`;let p;return e[26]!==o||e[27]!==c||e[28]!==a||e[29]!==h||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=r.jsx(kre,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=o,e[27]=c,e[28]=a,e[29]=h,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const jb="__all__",Cb={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Cre={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},dh={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Nb="status:";function Tb(t){if(!t.startsWith(Nb))return null;const e=t.slice(Nb.length);return e in dh?e:null}const Vb=P.forwardRef(function(e,s){const n=z.c(20);let i,o,l,a,c;n[0]!==e?({icon:i,active:o,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=o,n[3]=l,n[4]=a,n[5]=c):(i=n[1],o=n[2],l=n[3],a=n[4],c=n[5]);const d=o?"text-foreground":"text-muted-foreground";let u;n[6]!==l||n[7]!==d?(u=ie("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=u):u=n[8];let h;n[9]!==i?(h=r.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=n[10];let f;n[11]!==c?(f=c&&r.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(_s,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==u||n[17]!==h||n[18]!==f?(p=r.jsxs(he,{ref:s,type:"button",variant:"ghost",size:"sm",className:u,...a,children:[h,f,m]}),n[14]=a,n[15]=s,n[16]=u,n[17]=h,n[18]=f,n[19]=p):p=n[19],p});function z3(t){const e=z.c(2),{count:s}=t;let n;return e[0]!==s?(n=r.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Nre(t){const e=z.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:o,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onStatusFilterChange:h,onSortChange:f}=t,m=re();let p;if(e[0]!==s||e[1]!==o){let te;e[3]!==o?(te=le=>le.slug===o,e[3]=o,e[4]=te):te=e[4],p=s.find(te),e[0]=s,e[1]=o,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let te;e[8]!==l?(te=le=>le.email===l,e[8]=l,e[9]=te):te=e[9],x=n.find(te),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(o||l||a);let L;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(L=g?.name??b?.name??m(a?dh[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=L):L=e[14];const _=L,y=o?`cat:${o}`:l?`author:${l}`:a?`status:${a}`:jb;let S;e[15]!==u||e[16]!==d||e[17]!==h?(S=()=>{d(null),u(null),h(null)},e[15]=u,e[16]=d,e[17]=h,e[18]=S):S=e[18];const k=S;let w;e[19]!==k||e[20]!==u||e[21]!==d||e[22]!==h?(w=te=>{te.startsWith("cat:")?(u(null),h(null),d(te.slice(4))):te.startsWith("author:")?(d(null),h(null),u(te.slice(7))):Tb(te)?(d(null),u(null),h(Tb(te))):k()},e[19]=k,e[20]=u,e[21]=d,e[22]=h,e[23]=w):w=e[23];const j=w;let N;e[24]!==_||e[25]!==v?(N=r.jsx(Zt,{asChild:!0,children:r.jsx(Vb,{icon:hV,active:v,value:_,className:"min-w-0 shrink"})}),e[24]=_,e[25]=v,e[26]=N):N=e[26];let T;e[27]!==m?(T=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=T):T=e[28];let C;e[29]!==T?(C=r.jsx(hd,{children:T}),e[29]=T,e[30]=C):C=e[30];let V;e[31]!==m?(V=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=V):V=e[32];let A;e[33]!==V?(A=r.jsx(fc,{value:jb,children:V}),e[33]=V,e[34]=A):A=e[34];let E;e[35]!==m?(E=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=E):E=e[36];let D;e[37]!==E?(D=r.jsx(hd,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=D):D=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(dh),e[39]=I):I=e[39];let R;e[40]!==i||e[41]!==m?(R=I.map(te=>r.jsxs(fc,{value:`status:${te}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(dh[te])}),r.jsx(z3,{count:i[te]})]},`status:${te}`)),e[40]=i,e[41]=m,e[42]=R):R=e[42];let $;e[43]!==s.length||e[44]!==m?($=s.length>0&&r.jsx(hd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=$):$=e[45];let B;e[46]!==s?(B=s.map(Vre),e[46]=s,e[47]=B):B=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&r.jsx(hd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let O;e[51]!==n?(O=n.map(Tre),e[51]=n,e[52]=O):O=e[52];let F;e[53]!==y||e[54]!==j||e[55]!==A||e[56]!==D||e[57]!==R||e[58]!==$||e[59]!==B||e[60]!==M||e[61]!==O?(F=r.jsxs(cm,{value:y,onValueChange:j,children:[A,D,R,$,B,M,O]}),e[53]=y,e[54]=j,e[55]=A,e[56]=D,e[57]=R,e[58]=$,e[59]=B,e[60]=M,e[61]=O,e[62]=F):F=e[62];let U;e[63]!==F||e[64]!==C?(U=r.jsxs(es,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[C,F]}),e[63]=F,e[64]=C,e[65]=U):U=e[65];let K;e[66]!==U||e[67]!==N?(K=r.jsxs(Xt,{children:[N,U]}),e[66]=U,e[67]=N,e[68]=K):K=e[68];let q;e[69]!==k||e[70]!==v||e[71]!==m?(q=v&&r.jsx(Are,{label:m("sandbox.postToolbar.clearFilter"),onClick:k}),e[69]=k,e[70]=v,e[71]=m,e[72]=q):q=e[72];const W=Cre[c];let G;e[73]!==m||e[74]!==W?(G=m(W),e[73]=m,e[74]=W,e[75]=G):G=e[75];let Y;e[76]!==G?(Y=r.jsx(Zt,{asChild:!0,children:r.jsx(Vb,{icon:fV,active:!0,value:G})}),e[76]=G,e[77]=Y):Y=e[77];let ee;e[78]!==m?(ee=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=ee):ee=e[79];let ne;e[80]!==ee?(ne=r.jsx(hd,{children:ee}),e[80]=ee,e[81]=ne):ne=e[81];let oe;e[82]!==f?(oe=te=>f(te),e[82]=f,e[83]=oe):oe=e[83];let Z;e[84]===Symbol.for("react.memo_cache_sentinel")?(Z=Object.keys(Cb),e[84]=Z):Z=e[84];let J;e[85]!==m?(J=Z.map(te=>r.jsx(fc,{value:te,children:m(Cb[te])},te)),e[85]=m,e[86]=J):J=e[86];let H;e[87]!==c||e[88]!==oe||e[89]!==J?(H=r.jsx(cm,{value:c,onValueChange:oe,children:J}),e[87]=c,e[88]=oe,e[89]=J,e[90]=H):H=e[90];let se;e[91]!==ne||e[92]!==H?(se=r.jsxs(es,{align:"end",className:"w-44",children:[ne,H]}),e[91]=ne,e[92]=H,e[93]=se):se=e[93];let Q;e[94]!==Y||e[95]!==se?(Q=r.jsx("div",{className:"ml-auto shrink-0",children:r.jsxs(Xt,{children:[Y,se]})}),e[94]=Y,e[95]=se,e[96]=Q):Q=e[96];let ce;return e[97]!==K||e[98]!==q||e[99]!==Q?(ce=r.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[K,q,Q]}),e[97]=K,e[98]=q,e[99]=Q,e[100]=ce):ce=e[100],ce}function Tre(t){return r.jsxs(fc,{value:`author:${t.email}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(z3,{count:t.count})]},`author:${t.email}`)}function Vre(t){return r.jsxs(fc,{value:`cat:${t.slug}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(z3,{count:t.count})]},`cat:${t.slug}`)}function Are(t){const e=z.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Is,{size:12}),e[0]=i):i=e[0];let o;return e[1]!==s||e[2]!==n?(o=r.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:i}),e[1]=s,e[2]=n,e[3]=o):o=e[3],o}function Pre(t){const e=z.c(18),{checked:s,disabled:n,onToggle:i}=t,o=re();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o?(a=o(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=o,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Ere,children:r.jsx(Gc,{checked:s,disabled:n,onCheckedChange:l,"aria-label":a})})}),e[5]=s,e[6]=n,e[7]=l,e[8]=a,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==o?(d=o(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=o,e[12]=d):d=e[12];let u;e[13]!==d?(u=r.jsx(Ke,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=r.jsxs(We,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function Ere(t){return t.stopPropagation()}function Dre(t){const e=z.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:o,onExit:l}=t,a=re();let c;e[0]!==n||e[1]!==i?(c=r.jsx(Pre,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let u;e[6]!==d?(u=r.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=u):u=e[7];const h=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(rn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==o||e[12]!==h||e[13]!==f?(p=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:o,"aria-label":f,children:m})}),e[11]=o,e[12]=h,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=r.jsx(Ke,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=r.jsxs(We,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Is,{size:14}),e[24]=L):L=e[24];let _;e[25]!==l||e[26]!==v?(_=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:L})}),e[25]=l,e[26]=v,e[27]=_):_=e[27];let y;e[28]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=y):y=e[29];let S;e[30]!==y?(S=r.jsx(Ke,{side:"bottom",children:y}),e[30]=y,e[31]=S):S=e[31];let k;e[32]!==_||e[33]!==S?(k=r.jsxs(We,{children:[_,S]}),e[32]=_,e[33]=S,e[34]=k):k=e[34];let w;e[35]!==b||e[36]!==k?(w=r.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,k]}),e[35]=b,e[36]=k,e[37]=w):w=e[37];let j;return e[38]!==c||e[39]!==w||e[40]!==u?(j=r.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,u,w]}),e[38]=c,e[39]=w,e[40]=u,e[41]=j):j=e[41],j}function wd(t){const e=z.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:o,onViewJson:l,onDelete:a}=t,c=re();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(Gn,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=r.jsx(Zt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Rre,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&r.jsxs(Xe,{onClick:n,children:[r.jsx(p2,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&r.jsxs(Xe,{onClick:s,children:[r.jsx(dn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&r.jsxs(r.Fragment,{children:[r.jsx(Pr,{}),r.jsxs(Xe,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[r.jsx(zf,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==o||e[15]!==l||e[16]!==c?(g=(o||l)&&r.jsxs(r.Fragment,{children:[r.jsx(Pr,{}),o&&r.jsxs(Xe,{onClick:o,children:[r.jsx(m2,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&r.jsxs(Xe,{onClick:l,children:[r.jsx(qo,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=o,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Pr,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(rn,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let L;e[22]!==a||e[23]!==v?(L=r.jsxs(Xe,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=L):L=e[24];let _;e[25]!==L||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(_=r.jsxs(es,{align:"end",className:"w-44",children:[f,m,p,g,x,L]}),e[25]=L,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=_):_=e[30];let y;return e[31]!==_||e[32]!==h?(y=r.jsxs(Xt,{children:[h,_]}),e[31]=_,e[32]=h,e[33]=y):y=e[33],y}function Rre(t){return t.stopPropagation()}function Ire(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Mre(t){const e=new Map;for(const s of t){const n=Ire(s.resolveType),i=e.get(n);i?i.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function Ab(t){const e=z.c(8),{icon:s,label:n,className:i}=t;let o;e[0]!==i?(o=ie("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==s?(l=r.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:o,children:[l,n]}),e[4]=n,e[5]=o,e[6]=l,e[7]=a):a=e[7],a}const Pb=P.lazy(()=>jn(()=>import("./app-editor-Dq0blITG.js"),__vite__mapDeps([161,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,37,73,74,23,39,80,24,25,26,27,28,29,30,31,32,33,34,35,36,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,75,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,78,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.AppEditor}))),$re=P.lazy(()=>jn(()=>import("./post-editor--Zt9kpwk.js"),__vite__mapDeps([162,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,25,55,24,26,27,28,29,30,31,32,33,34,35,36,23,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,75,78,163,135,137,151,152,113,110,79,132,164,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,165,166,108,109,74,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,136,138,139,76,140,141,142,143,144,73,145,146,147,148,149,150,153,154,155,156,157,158,159])).then(t=>({default:t.PostEditor}))),Ore=P.lazy(()=>jn(()=>import("./record-editor-BK6RtSPc.js"),__vite__mapDeps([167,1,2,75,78,74,6,23,39,132,165,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,166,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,76,140,141,142,143,144,73,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.RecordEditor}))),Bre=P.lazy(()=>jn(()=>import("./category-editor-Cw-qgPeh.js"),__vite__mapDeps([168,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,31,24,25,26,27,28,29,30,32,33,34,35,36,23,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,115,75,78,164,151,152,113,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,165,166,108,109,74,110,111,112,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,73,145,146,79,147,148,149,150,153,154,155,156,157,158,159])).then(t=>({default:t.CategoryEditor}))),zre=P.lazy(()=>jn(()=>import("./bulk-category-panel-pYKTv68z.js"),__vite__mapDeps([169,1,2,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,78,170,74])).then(t=>({default:t.BulkCategoryPanel}))),Fre=P.lazy(()=>jn(()=>import("./sections-editor-B1dtTQTT.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,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.SectionsEditor}))),Ure=P.lazy(()=>jn(()=>import("./seo-editor-Drt9uDgy.js"),__vite__mapDeps([171,1,2,37,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,78,79,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,75,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.SeoEditor}))),Hre=P.lazy(()=>jn(()=>import("./variant-calendar-CK-1Nkq7.js"),__vite__mapDeps([172,1,2,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,78,73,74,79,173,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,75,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.VariantCalendar}))),Kre=P.lazy(()=>jn(()=>import("./post-calendar-BskyHDPL.js"),__vite__mapDeps([174,1,2,25,24,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,175,73,74,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,78,75,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.PostCalendar}))),Wre=P.lazy(()=>jn(()=>import("./redirect-editor-BMHZJK5a.js"),__vite__mapDeps([176,1,2,137,6,75,78,74,23,39,166,28,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,24,25,26,27,29,30,31,32,33,34,35,36,37,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,138,139,76,140,141,142,143,144,73,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.RedirectEditor})));function qre(t){const e=z.c(20),{deepLinkPage:s}=t,n=Kr(),{currentBranch:i}=un(),{org:o}=Fe(),l=n?.entity?.id??null,a=Qn(),c=Ul(),{runtime:d,previewServerUrl:u}=Cn(l),h=d==="cms";let f;e[0]!==h||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=rie({fastPreviewActive:h,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=h,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${o.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=r.jsx(nie,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(bo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=h?u:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==o.slug||e[17]!==p||e[18]!==l?(g=r.jsx(Yre,{orgSlug:o.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=o.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const Eb=2e3,Gre=15;function Db(t,e,s,n){return typeof e!="string"||s&&(xk(e,s,n)||t.state.dataUpdateCount>=Gre)?!1:Eb}function Yre({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:o,devServerReady:l,sandboxWarming:a}){const c=re(),d=Ts()?.taskId??null,u={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:h,isLoading:f}=Qf(u,{fetchEnabled:l}),[m,p]=P.useState("pages"),[g,x]=P.useState(null),[b,v]=P.useState(null),L=!!(o?.pageId||o?.path||o?.pathTemplate),[_,y]=P.useState(!1);if(L&&!_&&g===null&&h){y(!0);const me=hO(Ph(h),o??{});me&&(p("pages"),x({collection:"pages",key:me.key,path:me.path}))}const[S,k]=P.useState(""),[w,j]=P.useState(null),[N,T]=P.useState(null),[C,V]=P.useState(null),[A,E]=P.useState("date-desc"),[D,I]=P.useState(()=>new Set),[R,$]=P.useState(null),B=()=>{I(new Set),$(null)},M=me=>{x(me),v(null)},[O,F]=P.useState(m);O!==m&&(F(m),k(""),j(null),T(null),V(null),E("date-desc"),I(new Set),$(null));const{data:U,isLoading:K,isFetching:q}=Xf(u,{fetchEnabled:l,refetchInterval:me=>{const Ae=me.state.data;if(m==="apps"&&g&&g.collection==="apps"){const Oe=h?.[g.key];return Db(me,typeof Oe?.__resolveType=="string"?Oe.__resolveType:void 0,Ae)}if(m==="site"&&h){const Oe=Ae?Sm(h,Ae):null,je=h.site,ot=Oe?.resolveType??(typeof je?.__resolveType=="string"?je.__resolveType:void 0);return Db(me,ot,Ae,["seo"])}return!1}}),W=(me,Ae)=>!xk(me,U,Ae)&&(K||q),{catalog:G,isLoading:Y}=tie(U??void 0,h??void 0,{enabled:m==="apps"}),ee=Uie({orgSlug:t,virtualMcpId:e,branch:s,meta:U}),ne=n0(u),oe=Wne(u),[Z,J]=P.useState(null),[H,se]=P.useState(),[Q,ce]=P.useState(null),[te,le]=P.useState(null),[ue,fe]=P.useState(null),ae=!h||!U;if(f||K||ae&&a)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})});if(ae)return r.jsx(bo,{title:"Could not load site data."});const de=Ph(h).sort((me,Ae)=>me.name.localeCompare(Ae.name)),X=s_(h).sort((me,Ae)=>me.from.localeCompare(Ae.from)),pe=Tg(h,U),ye=m==="sections"?nO(U):[],we=Sm(h,U),_e=Lk(h),Pe=$3.some(me=>_e[me].length>0),Se=ru(m)?_e[m]:[],Te=(Pe?ku(h,"categories"):[]).map(({key:me,payload:Ae})=>{const Oe=typeof Ae.slug=="string"?Ae.slug:"",je=typeof Ae.name=="string"?Ae.name:"";return{slug:Oe||me,name:je||Oe||me}}).filter(me=>me.slug).sort((me,Ae)=>me.name.localeCompare(Ae.name)),ve=m==="posts"&&(D.size>0||R!==null),ke=ve?jk(h).filter(me=>D.has(me.key)):[],Le=F5(U,"loaders"),Ne=F5(U,"actions");if(!t9(h,U)&&!Pe&&Le===0&&Ne===0)return r.jsx(bo,{icon:bn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const et={pages:de.length,sections:pe.length,apps:G.length,loaders:Le,actions:Ne,redirects:X.length,posts:_e.posts.length,authors:_e.authors.length,categories:_e.categories.length},Ye=new Set(de.map(me=>wo(me.path))),ze=new Set(de.map(me=>me.name)),Me=new Set(pe.map(me=>me.name)),at=async me=>{const Ae=h[me.key];if(!Ae)return;const Oe=tS(h,me.key),je=sS(h,me.key,Math.max(0,Oe-1)),ot=lX(Ae.sections,je);if(ot)try{await ne.mutateAsync({blockKey:me.key,data:{...Ae,sections:ot}}),ge.success(`Variant added to "${me.name}"`),x({collection:"pages",key:me.key,path:me.path})}catch(mt){ge.error(mt instanceof Error?mt.message:"Could not add variant")}},Ze=()=>{se(void 0),J({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},it=me=>{se(void 0),J({mode:"duplicate",sourceKey:me.key,initialName:xb(ze,me.name),initialPath:oie(Ye,me.path)})},rt=me=>{se(void 0),J({mode:"rename",sourceKey:me.key,initialName:me.name,initialPath:me.path})},dt=async me=>{if(!Z)return;const{mode:Ae,sourceKey:Oe}=Z;try{if(Ae==="create"){let je;if(me.templateKey){const mt=h[me.templateKey];if(!mt)throw new Error("Selected template no longer exists.");je={...mt,name:me.name,path:me.path}}else je=cie(me.name,me.path);const ot=uie(h,me.name);await ne.mutateAsync({blockKey:ot,data:je}),ge.success(`Created "${me.name}"`),x({collection:"pages",key:ot,path:me.path})}else if(Ae==="duplicate"&&Oe){const je=h[Oe];if(!je)throw new Error("Source page not found");const{key:ot,data:mt}=aie({source:je,pages:de,newName:me.name,newPath:me.path});await ne.mutateAsync({blockKey:ot,data:mt}),ge.success(`Duplicated as "${me.name}"`),x({collection:"pages",key:ot,path:me.path})}else if(Ae==="rename"&&Oe){const je=h[Oe];if(!je)throw new Error("Page not found");const ot={...je,name:me.name,path:me.path};await ne.mutateAsync({blockKey:Oe,data:ot}),ge.success("Page updated"),g?.collection==="pages"&&g.key===Oe&&x({collection:"pages",key:Oe,path:me.path})}J(null)}catch(je){se(je instanceof Error?je.message:"Save failed")}},nt=({path:me})=>{if(!Z)return null;const Ae=wo(me);return(Z.mode==="rename"?wo(Z.initialPath):null)!==Ae&&Ye.has(Ae)?`A page with path "${me}" already exists.`:null},Re=async(me,Ae,Oe)=>{await ne.mutateAsync({blockKey:Ae,data:{...Oe,name:Ae,__resolveType:me}}),ge.success(c("sandbox.contentBrowser.createdSection",{name:Ae})),x({collection:"sections",key:Ae})},ft=w3((me,Ae)=>ne.mutate({blockKey:me,data:Ae})),ut=async me=>{const Ae=h[me.key];if(!Ae){ge.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Oe=lie(h,me.key),je=xb(Me,me.name),ot={...Ae,name:je};try{await ne.mutateAsync({blockKey:Oe,data:ot}),ge.success(c("sandbox.contentBrowser.duplicatedSection",{name:me.name})),x({collection:"sections",key:Oe})}catch(mt){ge.error(mt instanceof Error?mt.message:c("sandbox.contentBrowser.duplicateFailed"))}},be=async me=>{if(!Q)return;const Ae=h[Q];if(!Ae){ge.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await ne.mutateAsync({blockKey:Q,data:{...Ae,name:me}}),ge.success(c("sandbox.contentBrowser.sectionRenamed")),ce(null)}catch(Oe){ge.error(Oe instanceof Error?Oe.message:c("sandbox.contentBrowser.renameFailed"))}},qe=async()=>{const me="/redirect-from",Ae=uO(h,me),Oe=aO({from:me,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await ne.mutateAsync({blockKey:Ae,data:Oe}),ge.success("Created redirect"),x({collection:"redirects",key:Ae})}catch(je){ge.error(je instanceof Error?je.message:"Could not create redirect")}},tt=async me=>{const Ae=P1(h,me),Oe=tc(Ae,me,Ck(me));try{await ne.mutateAsync({blockKey:Ae,data:Oe}),ge.success(`Created ${iu[me]}`),x({collection:me,key:Ae})}catch(je){ge.error(je instanceof Error?je.message:"Could not create")}},Ue=async me=>{const Ae=P1(h,"posts"),Oe=tc(Ae,"posts",Die(me));try{await ne.mutateAsync({blockKey:Ae,data:Oe}),ge.success(c("sandbox.postCalendar.createdScheduledPost")),p("posts"),F("posts"),x({collection:"posts",key:Ae}),v(null)}catch(je){ge.error(je instanceof Error?je.message:c("sandbox.postCalendar.couldNotCreate"))}},Lt=async(me,Ae)=>{const Oe=h[me],je=Oe?Iie(Bd(Oe,"posts"),Ae):null;if(!je){ge.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await ne.mutateAsync({blockKey:me,data:tc(me,"posts",je)})}catch(ot){ge.error(ot instanceof Error?ot.message:c("sandbox.postCalendar.couldNotReschedule"))}},wt=async me=>{const Ae=h[me.key];if(!Ae){ge.error("Record not found.");return}const Oe=P1(h,me.kind),je=me.kind==="posts"?"title":"name",ot={...structuredClone(Bd(Ae,me.kind)),[je]:`${me.label} (copy)`};try{await ne.mutateAsync({blockKey:Oe,data:tc(Oe,me.kind,ot)}),ge.success(`Duplicated "${me.label}"`),x({collection:me.kind,key:Oe})}catch(mt){ge.error(mt instanceof Error?mt.message:"Duplicate failed")}},ht=me=>{I(Ae=>{const Oe=new Set(Ae);return Oe.has(me)?Oe.delete(me):Oe.add(me),Oe})},Tt=me=>{p("posts"),F("posts"),x(null),v(null),k(""),j(null),T(null),V(null),E("date-desc"),I(new Set),$(me||null)},$e=async(me,Ae)=>{const Oe=[...D];let je=0;for(const ot of Oe){const mt=h[ot],$t=Bd(mt,"posts"),At=me==="add"?Sie($t,Ae):kie($t,Ae);At!==$t&&(await ne.mutateAsync({blockKey:ot,data:tc(ot,"posts",vb(At))}),je+=1)}return je},ct=async(me,Ae)=>{const Oe=D.size;try{const je=await $e(me,Ae),ot=me==="add"?"Added to":"Moved",mt=Oe-je;ge.success(`${ot} ${je} ${je===1?"post":"posts"}`+(mt>0?` (${mt} already set)`:"")),B()}catch(je){ge.error(je instanceof Error?je.message:"Bulk update failed")}},kt=async()=>{if(te)try{if(te.kind==="blog-bulk"){for(const je of te.keys)await oe.mutateAsync({blockKey:je});ge.success(`Deleted ${te.count} ${te.count===1?"post":"posts"}`),g&&g.collection!=="available-section"&&te.keys.includes(g.key)&&x(null),B(),le(null);return}const{kind:me,key:Ae,label:Oe}=te;if(me==="blog"){if(te.blogKind==="categories"){const je=Bd(h[Ae],"categories").slug,ot=typeof je=="string"?je:"";if(ot)for(const{key:mt,payload:$t}of ku(h,"posts")){const At=jie($t,ot);At!==$t&&await ne.mutateAsync({blockKey:mt,data:tc(mt,"posts",vb(At))})}}await oe.mutateAsync({blockKey:Ae})}else await oe.mutateAsync({blockKey:Ae});ge.success(`Deleted "${Oe}"`),g&&g.collection!=="available-section"&&g.key===Ae&&x(null),le(null)}catch(me){ge.error(me instanceof Error?me.message:"Delete failed")}},xt=oe.isPending||ne.isPending,yt=te?.kind==="blog"?iu[te.blogKind]:te?.kind==="blog-bulk"?`${te.count} ${te.count===1?"post":"posts"}`:te?.kind??"item";return r.jsxs("div",{className:"flex h-full w-full",children:[r.jsx(sie,{active:m,counts:et,showBlog:Pe,onSelect:me=>{p(me),x(null),v(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&r.jsx(Jre,{activeCollection:m,pages:de,redirects:X,sections:pe,availableSections:ye,appCatalog:G,appCatalogLoading:Y,blogEntries:Se,decofile:h,searchQuery:S,onSearchChange:k,postCategoryFilter:w,postAuthorFilter:N,postStatusFilter:C,postSort:A,onPostCategoryFilterChange:me=>{j(me),I(new Set)},onPostAuthorFilterChange:me=>{T(me),I(new Set)},onPostStatusFilterChange:me=>{V(me),I(new Set)},onPostSortChange:E,selectedPostKeys:D,postBulkPanelOpen:ve,onTogglePostSelect:ht,onSelectAllPosts:me=>I(new Set(me)),onClearPostSelection:()=>I(new Set),onExitPostSelection:B,onBulkDeletePosts:()=>le({kind:"blog-bulk",keys:[...D],count:D.size}),selection:g,onSelect:M,onCreate:()=>{m==="pages"?Ze():m==="redirects"?qe():ru(m)&&tt(m)},onDuplicatePage:it,onRenamePage:rt,onAddPageVariant:at,onDeletePage:me=>le({kind:"page",key:me.key,label:me.name}),onEditPageSeo:me=>{const Ae={collection:"pages",key:me.key,path:me.path};x(Ae),v(me.key)},onViewPageJson:me=>fe(me.key),onDuplicateSection:ut,onRenameSection:me=>ce(me.key),onDeleteSection:me=>le({kind:"section",key:me.key,label:me.name}),onDeleteRedirect:me=>le({kind:"redirect",key:me.key,label:me.from||me.key}),onDuplicateBlog:wt,onDeleteBlog:me=>le({kind:"blog",blogKind:me.kind,key:me.key,label:me.label})}),r.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?r.jsx(Jie,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:h,kind:m}):r.jsx(P.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})}),children:m==="calendar"?r.jsx(Hre,{decofile:h}):m==="post-schedule"?r.jsx(Kre,{decofile:h,support:ee,isCreating:ne.isPending,onCreate:me=>{Ue(me)},onReschedule:(me,Ae)=>{Lt(me,Ae)},onSelect:me=>{p("posts"),F("posts"),x({collection:"posts",key:me}),v(null)}}):m==="site"?we?r.jsx(Pb,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:we.key,block:h[we.key],decofile:h,meta:U,title:"Site",excludeFields:["seo"],schemaPending:W(we.resolveType,["seo"]),previewBaseUrl:n},`site:${we.key}`):r.jsx(bo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?r.jsx(Ure,{orgSlug:t,virtualMcpId:e,branch:s,decofile:h,meta:U,target:{kind:"site"},previewBaseUrl:i}):m==="sections"?r.jsx(jre,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:h,isCreating:ne.isPending,onCreateAvailable:Re,onSaveReferencedBlock:ft}):ve?r.jsx(zre,{posts:ke,categories:Te,initialSlug:R,isPending:ne.isPending,onApply:(me,Ae)=>{ct(me,Ae)},onClose:B},R??"selection"):g&&g.collection!=="available-section"?g.collection==="apps"?r.jsx(Pb,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,previewBaseUrl:n,schemaPending:W(typeof h[g.key]?.__resolveType=="string"?String(h[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="posts"?r.jsx($re,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,previewBaseUrl:i},`post:${g.key}`):g.collection==="categories"?r.jsx(Bre,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,onManagePosts:Tt,onOpenPost:me=>{p("posts"),F("posts"),x({collection:"posts",key:me}),v(null)},previewBaseUrl:i},`category:${g.key}`):g.collection==="authors"?r.jsx(Ore,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:h[g.key]},`authors:${g.key}`):g.collection==="redirects"?r.jsx(Wre,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key]},`redirect:${g.key}`):r.jsx(Fre,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&b===g.key,onExitSeo:()=>v(null)},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):r.jsx(bo,{title:`Select ${ru(m)?`a ${iu[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),Z&&r.jsx(pie,{open:!!Z,mode:Z.mode,initialName:Z.initialName,initialPath:Z.initialPath,isPending:ne.isPending,error:H,templates:de,validate:nt,onSubmit:dt,onOpenChange:me=>{me||(J(null),se(void 0))}}),Q&&r.jsx(gie,{open:!!Q,blockKey:Q,initialName:pe.find(me=>me.key===Q)?.name??Q,isPending:ne.isPending,onSubmit:be,onOpenChange:me=>{me||ce(null)}}),ue&&r.jsx(Hie,{open:!!ue,onOpenChange:me=>{me||fe(null)},pageKey:ue,decofile:h,onSave:me=>ne.mutateAsync({blockKey:ue,data:me})}),r.jsx(To,{open:!!te,onOpenChange:me=>{!me&&!xt&&le(null)},children:r.jsxs(Vo,{children:[r.jsxs(Ao,{children:[r.jsx(Po,{children:`Delete ${yt}?`}),r.jsx(Eo,{children:te?.kind==="section"?`"${te.label}" will be removed. Pages that still reference it will lose this section.`:te?.kind==="blog-bulk"?`${te.count} ${te.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:te?`"${te.label}" will be removed permanently. This can't be undone.`:null})]}),r.jsxs(Do,{children:[r.jsx(Ro,{disabled:xt,children:"Cancel"}),r.jsx(Io,{onClick:me=>{me.preventDefault(),kt()},disabled:xt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:xt?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function Jre(t){const e=z.c(82),{activeCollection:s,pages:n,redirects:i,sections:o,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:u,searchQuery:h,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:L,onPostSortChange:_,selectedPostKeys:y,postBulkPanelOpen:S,onTogglePostSelect:k,onSelectAllPosts:w,onClearPostSelection:j,onExitPostSelection:N,onBulkDeletePosts:T,selection:C,onSelect:V,onCreate:A,onDuplicatePage:E,onRenamePage:D,onAddPageVariant:I,onDeletePage:R,onEditPageSeo:$,onViewPageJson:B,onDuplicateSection:M,onRenameSection:O,onDeleteSection:F,onDeleteRedirect:U,onDuplicateBlog:K,onDeleteBlog:q}=t;let W,G,Y,ee,ne,oe,Z;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==u||e[6]!==I||e[7]!==T||e[8]!==j||e[9]!==A||e[10]!==q||e[11]!==R||e[12]!==U||e[13]!==F||e[14]!==K||e[15]!==E||e[16]!==M||e[17]!==$||e[18]!==N||e[19]!==v||e[20]!==b||e[21]!==_||e[22]!==L||e[23]!==D||e[24]!==O||e[25]!==f||e[26]!==V||e[27]!==w||e[28]!==k||e[29]!==B||e[30]!==n||e[31]!==p||e[32]!==S||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==h||e[38]!==o||e[39]!==y||e[40]!==C){const Q=h.toLowerCase(),ce=n.filter(be=>!Q||be.name.toLowerCase().includes(Q)||be.path.toLowerCase().includes(Q)),te=i.filter(be=>!Q||be.from.toLowerCase().includes(Q)||be.to.toLowerCase().includes(Q)),le=o.filter(be=>!Q||be.name.toLowerCase().includes(Q)||be.key.toLowerCase().includes(Q)||be.resolveType.toLowerCase().includes(Q)),ue=l.filter(be=>!Q||be.title.toLowerCase().includes(Q)||be.resolveType.toLowerCase().includes(Q)||(be.description?.toLowerCase().includes(Q)??!1)),fe=Mre(le),ae=a.filter(be=>!Q||be.title.toLowerCase().includes(Q)||be.app.toLowerCase().includes(Q)||be.vendor.toLowerCase().includes(Q)||be.category.toLowerCase().includes(Q)),de=d.filter(be=>!Q||be.label.toLowerCase().includes(Q)||be.subtitle.toLowerCase().includes(Q)),X=s==="posts",pe=eoe,ye=X?jk(u):[],we=new Map,_e=new Map,Pe={published:0,scheduled:0,draft:0};for(const be of ye)Pe[be.status]=Pe[be.status]+1;for(const be of ye){for(const qe of be.categorySlugs)we.set(qe,(we.get(qe)??0)+1);for(const qe of be.authorEmails)_e.set(qe,(_e.get(qe)??0)+1)}const Se=(X?ku(u,"categories"):[]).map(be=>{const{key:qe,payload:tt}=be,Ue=pe(tt.slug)||qe;return{slug:Ue,name:pe(tt.name)||pe(tt.slug)||qe,count:we.get(Ue)??0}}).filter(Zre),Te=(X?ku(u,"authors"):[]).map(be=>{const{key:qe,payload:tt}=be,Ue=pe(tt.email);return{email:Ue,name:pe(tt.name)||pe(tt.email)||qe,count:_e.get(Ue)??0}}).filter(Xre);let ve;e[48]!==m?(ve=be=>!m||be.categorySlugs.includes(m),e[48]=m,e[49]=ve):ve=e[49];let ke;e[50]!==p?(ke=be=>!p||be.authorEmails.includes(p),e[50]=p,e[51]=ke):ke=e[51];let Le;e[52]!==g?(Le=be=>!g||be.status===g,e[52]=g,e[53]=Le):Le=e[53];let Ne;e[54]!==x?(Ne=(be,qe)=>{if(x==="az")return be.title.localeCompare(qe.title);if(x==="za")return qe.title.localeCompare(be.title);const tt=be.date.localeCompare(qe.date);return x==="date-asc"?tt:-tt},e[54]=x,e[55]=Ne):Ne=e[55];const et=ye.filter(be=>!Q||be.title.toLowerCase().includes(Q)||be.slug.toLowerCase().includes(Q)).filter(ve).filter(ke).filter(Le).sort(Ne),Ye=y.size,ze=et.map(Qre),Me=ze.length>0&&ze.every(be=>y.has(be)),at=Ye>0||S,Ze=()=>{Me?j():w(ze)},it=`Search ${s}…`,rt=ru(s)?`Create new ${iu[s]}`:s==="redirects"?"Create new redirect":"Create new page",dt=s!=="apps"&&s!=="sections";ne="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let nt;e[56]===Symbol.for("react.memo_cache_sentinel")?(nt=r.jsx(Hf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=nt):nt=e[56];let Re;e[57]!==f?(Re=be=>f(be.target.value),e[57]=f,e[58]=Re):Re=e[58];let ft;e[59]!==it||e[60]!==h||e[61]!==Re?(ft=r.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[nt,r.jsx("input",{type:"text",value:h,onChange:Re,placeholder:it,"aria-label":it,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=it,e[60]=h,e[61]=Re,e[62]=ft):ft=e[62];let ut;e[63]!==rt||e[64]!==A||e[65]!==dt?(ut=dt&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",onClick:A,"aria-label":rt,children:r.jsx(Ht,{size:14})})}),r.jsx(Ke,{side:"bottom",children:rt})]}),e[63]=rt,e[64]=A,e[65]=dt,e[66]=ut):ut=e[66],e[67]!==ft||e[68]!==ut?(oe=r.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[ft,ut]}),e[67]=ft,e[68]=ut,e[69]=oe):oe=e[69],Z=X&&(at?r.jsx(Dre,{count:Ye,allSelected:Me,onToggleSelectAll:Ze,onDelete:T,onExit:N}):r.jsx(Nre,{categories:Se,authors:Te,categoryFilter:m,statusCounts:Pe,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:L,onSortChange:_})),W=Go,ee="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",G="flex flex-col gap-1 p-1.5",Y=s==="pages"?ce.length===0?r.jsx(ec,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):ce.map(be=>{const qe=C?.collection==="pages"&&C.key===be.key,tt=tS(u,be.key);return r.jsx(pi,{icon:_o,title:be.name,subtitle:be.path,active:qe,variantCount:tt,onClick:()=>V({collection:"pages",key:be.key,path:be.path}),menu:r.jsx(wd,{onDuplicate:()=>E(be),onRename:()=>D(be),onAddVariant:()=>I(be),onEditSeo:()=>$(be),onViewJson:()=>B(be),onDelete:()=>R(be)})},be.key)}):s==="sections"?le.length===0&&ue.length===0?r.jsx(ec,{hasItems:o.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):r.jsxs(r.Fragment,{children:[fe.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Ab,{icon:Rr,label:"Saved sections"}),fe.map(be=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:be.label}),be.sections.map(qe=>{const tt=C?.collection==="sections"&&C.key===qe.key;return r.jsx(pi,{icon:Rr,accent:"global",title:qe.name,subtitle:be.label,active:tt,onClick:()=>V({collection:"sections",key:qe.key}),menu:r.jsx(wd,{onDuplicate:()=>M(qe),onRename:()=>O(qe),onDelete:()=>F(qe)})},qe.key)})]},be.label))]}),ue.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Ab,{icon:_o,label:"Available sections",className:ie(fe.length>0&&"mt-3")}),ue.map(be=>{const qe=C?.collection==="available-section"&&C.resolveType===be.resolveType,tt=be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return r.jsx(pi,{icon:_o,title:be.title,subtitle:tt??be.resolveType,active:qe,onClick:()=>V({collection:"available-section",resolveType:be.resolveType,title:be.title})},be.resolveType)})]})]}):s==="apps"?c?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(lt,{size:18,className:"animate-spin text-muted-foreground"})}):ae.length===0?r.jsx(ec,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ae.map(be=>{const qe=C?.collection==="apps"&&be.blockKey!==null&&C.key===be.blockKey;return r.jsx(pi,{icon:i8,logoUrl:be.logo,title:be.title,subtitle:be.category,active:qe,trailing:be.installed?r.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!be.installed||!be.blockKey){ge.message(`${be.title} is not installed on this site.`);return}V({collection:"apps",key:be.blockKey})}},be.id)}):s==="redirects"?te.length===0?r.jsx(ec,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):te.map(be=>r.jsx(pi,{icon:p6,title:be.from||"(no source)",subtitle:`→ ${be.to||"(no target)"}`,active:C?.collection==="redirects"&&C.key===be.key,trailing:r.jsx(xie,{type:be.type}),onClick:()=>V({collection:"redirects",key:be.key}),menu:r.jsx(wd,{onDelete:()=>U(be)})},be.key)):X?et.length===0?r.jsx(ec,{hasItems:ye.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):et.map(be=>{const qe={key:be.key,kind:"posts",label:be.title,subtitle:be.slug};return r.jsx(pi,{icon:yi,title:be.title,subtitle:be.slug||"no slug",invalid:be.missing.length>0,invalidReason:`Missing: ${be.missing.join(", ")}`,active:C?.collection==="posts"&&C.key===be.key,selectable:!0,selectionActive:at,selected:y.has(be.key),onToggleSelect:()=>k(be.key),onClick:()=>at?k(be.key):V({collection:"posts",key:be.key}),menu:r.jsx(wd,{onDuplicate:()=>K(qe),onDelete:()=>q(qe)})},be.key)}):de.length===0?r.jsx(ec,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${ru(s)?iu[s]:"item"}.`}):de.map(be=>{const qe=C?.collection===be.kind&&C.key===be.key;return r.jsx(pi,{icon:be.kind==="posts"?yi:be.kind==="authors"?M2:$2,title:be.label,subtitle:be.subtitle,active:qe,onClick:()=>V({collection:be.kind,key:be.key}),menu:r.jsx(wd,{onDuplicate:()=>K(be),onDelete:()=>q(be)})},be.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=u,e[6]=I,e[7]=T,e[8]=j,e[9]=A,e[10]=q,e[11]=R,e[12]=U,e[13]=F,e[14]=K,e[15]=E,e[16]=M,e[17]=$,e[18]=N,e[19]=v,e[20]=b,e[21]=_,e[22]=L,e[23]=D,e[24]=O,e[25]=f,e[26]=V,e[27]=w,e[28]=k,e[29]=B,e[30]=n,e[31]=p,e[32]=S,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=h,e[38]=o,e[39]=y,e[40]=C,e[41]=W,e[42]=G,e[43]=Y,e[44]=ee,e[45]=ne,e[46]=oe,e[47]=Z}else W=e[41],G=e[42],Y=e[43],ee=e[44],ne=e[45],oe=e[46],Z=e[47];let J;e[70]!==G||e[71]!==Y?(J=r.jsx("div",{className:G,children:Y}),e[70]=G,e[71]=Y,e[72]=J):J=e[72];let H;e[73]!==W||e[74]!==ee||e[75]!==J?(H=r.jsx(W,{className:ee,children:J}),e[73]=W,e[74]=ee,e[75]=J,e[76]=H):H=e[76];let se;return e[77]!==ne||e[78]!==oe||e[79]!==Z||e[80]!==H?(se=r.jsxs("div",{className:ne,children:[oe,Z,H]}),e[77]=ne,e[78]=oe,e[79]=Z,e[80]=H,e[81]=se):se=e[81],se}function Qre(t){return t.key}function Xre(t){return t.email}function Zre(t){return t.slug}function eoe(t){return typeof t=="string"?t:""}function toe(t){const e=z.c(17),{virtualMcpId:s}=t,n=re(),i=Ms(s),{activeTask:o}=un();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=ur(l);if(!(sn(i?.metadata)||sn(o?.metadata))){let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(bn,{size:24,className:"text-muted-foreground/60"}),e[1]=u):u=e[1];let h;e[2]!==n?(h=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=h):h=e[3];let f;e[4]!==h?(f=r.jsx("div",{children:h}),e[4]=h,e[5]=f):f=e[5];let m;e[6]!==n?(m=n("mainPanelTabs.contentTab.connectGithubDescription"),e[6]=n,e[7]=m):m=e[7];let p;e[8]!==m?(p=r.jsx("div",{className:"text-xs text-muted-foreground/80",children:m}),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==f||e[11]!==p?(g=r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[u,f,p]}),e[10]=f,e[11]=p,e[12]=g):g=e[12],g}let d;return e[13]!==a.contentPageId||e[14]!==a.contentPath||e[15]!==a.contentPathTemplate?(d=r.jsx(qre,{deepLinkPage:{pageId:a.contentPageId,path:a.contentPath,pathTemplate:a.contentPathTemplate}}),e[13]=a.contentPageId,e[14]=a.contentPath,e[15]=a.contentPathTemplate,e[16]=d):d=e[16],d}function soe(t){const e=z.c(6),{virtualMcpId:s}=t,n=Ms(s),i=$6();let o;e[0]!==i||e[1]!==n?(o=s9(i,p_(n)),e[0]=i,e[1]=n,e[2]=o):o=e[2];const l=o;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(noe,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=r.jsx(ooe,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function noe(){const t=z.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:r.jsx(E2,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,r.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function ioe(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function roe(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function ooe(t){const e=z.c(99),{config:s}=t,n=re(),[i,o]=P.useState(""),l=Kf(i,300);let a;e[0]!==s.id||e[1]!==l?(a={configId:s.id,search:l},e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const c=KS(a),d=k9(),[u,h]=P.useState(!1),[f,m]=P.useState(null),p=P.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const O=Array.from(M);if(O.length===0)return;const F=[];for(const U of O)try{await d.mutateAsync({configId:s.id,file:U})}catch(K){const q=K;F.push(`${U.name} (${q instanceof Error?q.message:"upload failed"})`)}await c.refetch(),F.length>0&&ge.error(F.length===O.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:F.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:F.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),h(!0)},e[8]=b):b=e[8];const v=b;let L;e[9]===Symbol.for("react.memo_cache_sentinel")?(L=function(){h(!1)},e[9]=L):L=e[9];const _=L;let y;e[10]!==x?(y=function(M){M.preventDefault(),M.stopPropagation(),h(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=y):y=e[11];const S=y,[k,w]=vm();let j,N,T,C,V,A;if(e[12]!==s.name||e[13]!==l||e[14]!==w||e[15]!==k||e[16]!==x||e[17]!==u||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==S||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(loe),O=roe(M,ioe(k)),F=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;V="flex h-full min-h-0 flex-col gap-3 p-4";let K;e[31]!==n?(K=n("assets.browser.title"),e[31]=n,e[32]=K):K=e[32];let q;e[33]!==K?(q=r.jsx("h2",{className:"text-sm font-semibold",children:K}),e[33]=K,e[34]=q):q=e[34];let W;e[35]!==s.name||e[36]!==n?(W=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=W):W=e[37];let G;e[38]!==W?(G=r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:W}),e[38]=W,e[39]=G):G=e[39];let Y;e[40]!==q||e[41]!==G?(Y=r.jsxs("div",{className:"min-w-0",children:[q,G]}),e[40]=q,e[41]=G,e[42]=Y):Y=e[42];let ee;e[43]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>p.current?.click(),e[43]=ee):ee=e[43];let ne;e[44]!==d.isPending?(ne=d.isPending?r.jsx(lt,{size:14,className:"animate-spin"}):r.jsx(Yn,{size:14}),e[44]=d.isPending,e[45]=ne):ne=e[45];let oe;e[46]!==n||e[47]!==d.isPending?(oe=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=oe):oe=e[48];let Z;e[49]!==ne||e[50]!==oe||e[51]!==d.isPending?(Z=r.jsxs(he,{type:"button",size:"sm",disabled:d.isPending,onClick:ee,children:[ne,oe]}),e[49]=ne,e[50]=oe,e[51]=d.isPending,e[52]=Z):Z=e[52];let J;e[53]!==x?(J=r.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:de=>{const X=Array.from(de.target.files??[]);de.target.value="",x(X)}}),e[53]=x,e[54]=J):J=e[54],e[55]!==Y||e[56]!==Z||e[57]!==J?(A=r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Y,Z,J]}),e[55]=Y,e[56]=Z,e[57]=J,e[58]=A):A=e[58];let H;e[59]!==n?(H=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=H):H=e[60],e[61]!==U||e[62]!==i||e[63]!==H?(j=r.jsx(Of,{value:i,onChange:o,isSearching:U,placeholder:H,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=H,e[64]=j):j=e[64];let se;e[65]===Symbol.for("react.memo_cache_sentinel")?(se=()=>p.current?.click(),e[65]=se):se=e[65];const Q=u&&"border-primary bg-primary/5",ce=d.isPending&&"pointer-events-none opacity-60";let te;e[66]!==Q||e[67]!==ce?(te=ie("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",Q,ce),e[66]=Q,e[67]=ce,e[68]=te):te=e[68];let le;e[69]===Symbol.for("react.memo_cache_sentinel")?(le=r.jsx(Yn,{size:16,className:"text-muted-foreground"}),e[69]=le):le=e[69];let ue;e[70]!==n?(ue=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ue):ue=e[71];let fe;e[72]!==n?(fe=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=fe):fe=e[73];let ae;e[74]!==ue||e[75]!==fe?(ae=r.jsxs("p",{className:"text-xs text-muted-foreground",children:[ue," ",fe]}),e[74]=ue,e[75]=fe,e[76]=ae):ae=e[76],e[77]!==S||e[78]!==te||e[79]!==ae?(N=r.jsxs("button",{type:"button",onClick:se,onDragOver:v,onDragLeave:_,onDrop:S,className:te,children:[le,ae]}),e[77]=S,e[78]=te,e[79]=ae,e[80]=N):N=e[80],T="min-h-0 flex-1 overflow-y-auto pr-1",C=M.length===0?F?r.jsx(Rb,{title:n("filePicker.filePickerDialog.noMatches",{query:F}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):r.jsx(Rb,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):r.jsx("div",{ref:w,className:"flex items-start gap-3",children:O.map((de,X)=>r.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:de.map(pe=>r.jsx(aoe,{item:pe,onDelete:()=>m(pe)},pe.key))},X))}),e[12]=s.name,e[13]=l,e[14]=w,e[15]=k,e[16]=x,e[17]=u,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=S,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=N,e[27]=T,e[28]=C,e[29]=V,e[30]=A}else j=e[25],N=e[26],T=e[27],C=e[28],V=e[29],A=e[30];let E;e[81]!==c||e[82]!==n?(E=c.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=E):E=e[83];let D;e[84]!==E||e[85]!==T||e[86]!==C?(D=r.jsxs("div",{className:T,children:[C,E]}),e[84]=E,e[85]=T,e[86]=C,e[87]=D):D=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let R;e[89]!==s.id||e[90]!==f?(R=r.jsx(uoe,{configId:s.id,item:f,onClose:I}),e[89]=s.id,e[90]=f,e[91]=R):R=e[91];let $;return e[92]!==j||e[93]!==N||e[94]!==D||e[95]!==R||e[96]!==V||e[97]!==A?($=r.jsxs("div",{className:V,children:[A,j,N,D,R]}),e[92]=j,e[93]=N,e[94]=D,e[95]=R,e[96]=V,e[97]=A,e[98]=$):$=e[98],$}function loe(t){return t.items}function Rb(t){const e=z.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(_i,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let o;e[1]!==s?(o=r.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=o):o=e[2];let l;e[3]!==n?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function aoe(t){const e=z.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=WS(s.key),e[0]=s.key,e[1]=i):i=e[1];const o=i;let l;e[2]!==s.key?(l=P3(s.key),e[2]=s.key,e[3]=l):l=e[3];const a=l;let c;e[4]!==a||e[5]!==s.key||e[6]!==s.publicUrl?(c=a?r.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:coe}):r.jsx("div",{className:"flex aspect-square items-center justify-center",children:r.jsx(yi,{size:28,className:"text-muted-foreground"})}),e[4]=a,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=r.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const u=s.key;let h;e[12]!==s.key?(h=ef(s.key),e[12]=s.key,e[13]=h):h=e[13];let f;e[14]!==s.key||e[15]!==h?(f=r.jsx("p",{className:"truncate text-xs font-medium",title:u,children:h}),e[14]=s.key,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=qS(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==o||e[20]!==m?(p=r.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[o," · ",m]}),e[19]=o,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=r.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=r.jsx(doe,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=r.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let v;return e[31]!==b||e[32]!==d?(v=r.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=v):v=e[33],v}function coe(t){t.target.style.display="none"}function doe(t){const e=z.c(36),{item:s,onDelete:n}=t,i=re(),[o,l]=P.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{ge.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(F2,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=r.jsx(Zt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==o?(f=o?r.jsx(qt,{size:14}):r.jsx(dn,{size:14}),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==o||e[11]!==i?(m=i(o?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=o,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=r.jsxs(Xe,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(xn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let v;e[20]!==s.publicUrl||e[21]!==b?(v=r.jsx(Xe,{asChild:!0,children:r.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=v):v=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(rn,{size:14}),e[23]=L):L=e[23];let _;e[24]!==i?(_=i("assets.browser.deleteAction"),e[24]=i,e[25]=_):_=e[25];let y;e[26]!==n||e[27]!==_?(y=r.jsxs(Xe,{variant:"destructive",onClick:n,children:[L,_]}),e[26]=n,e[27]=_,e[28]=y):y=e[28];let S;e[29]!==v||e[30]!==y||e[31]!==p?(S=r.jsxs(es,{align:"end",children:[p,v,y]}),e[29]=v,e[30]=y,e[31]=p,e[32]=S):S=e[32];let k;return e[33]!==S||e[34]!==h?(k=r.jsxs(Xt,{children:[h,S]}),e[33]=S,e[34]=h,e[35]=k):k=e[35],k}function uoe(t){const e=z.c(47),{configId:s,item:n,onClose:i}=t,o=re(),l=wte();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==o?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),ge.success(o("assets.browser.deleted")),i()}catch{ge.error(o("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=o,e[5]=a):a=e[5];const c=a,d=!!n;let u;e[6]!==i?(u=C=>!C&&i(),e[6]=i,e[7]=u):u=e[7];let h;e[8]!==o?(h=o("assets.browser.deleteConfirmTitle"),e[8]=o,e[9]=h):h=e[9];let f;e[10]!==h?(f=r.jsx(Po,{children:h}),e[10]=h,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==o?(m=o("assets.browser.deleteConfirmDescription",{name:n?ef(n.key):""}),e[12]=n,e[13]=o,e[14]=m):m=e[14];let p;e[15]!==m?(p=r.jsx(Eo,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=r.jsxs(Ao,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==o?(b=o("assets.browser.deleteCancel"),e[20]=o,e[21]=b):b=e[21];let v;e[22]!==l.isPending||e[23]!==b?(v=r.jsx(Ro,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=v):v=e[24];let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=ie(Ny({variant:"destructive"})),e[25]=L):L=e[25];const _=l.isPending;let y;e[26]!==c?(y=C=>{C.preventDefault(),c()},e[26]=c,e[27]=y):y=e[27];let S;e[28]!==l.isPending?(S=l.isPending?r.jsx(lt,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=S):S=e[29];let k;e[30]!==o?(k=o("assets.browser.deleteConfirm"),e[30]=o,e[31]=k):k=e[31];let w;e[32]!==l.isPending||e[33]!==y||e[34]!==S||e[35]!==k?(w=r.jsxs(Io,{className:L,disabled:_,onClick:y,children:[S,k]}),e[32]=l.isPending,e[33]=y,e[34]=S,e[35]=k,e[36]=w):w=e[36];let j;e[37]!==v||e[38]!==w?(j=r.jsxs(Do,{children:[v,w]}),e[37]=v,e[38]=w,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==g?(N=r.jsxs(Vo,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=N):N=e[42];let T;return e[43]!==N||e[44]!==d||e[45]!==u?(T=r.jsx(To,{open:d,onOpenChange:u,children:N}),e[43]=N,e[44]=d,e[45]=u,e[46]=T):T=e[46],T}const D1={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:Ml},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Ar},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:t6}},hoe=["fast","smart","thinking"];function foe(t){const e=z.c(19),{tier:s,onSelect:n}=t,i=re(),[o,l]=P.useState(!1),a=D1[s].icon;let c;e[0]!==a?(c=r.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=D1[s];let u;e[2]!==i||e[3]!==d.labelKey?(u=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=u):u=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(_s,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=r.jsx(ms,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,u,h]})}),e[6]=c,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=hoe.map(x=>{const b=D1[x],v=b.icon;return r.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ie("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[r.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-sm",children:i(b.labelKey)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&r.jsx(qt,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=r.jsx(bs,{align:"start",className:"p-1 w-64",children:r.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==o||e[16]!==f||e[17]!==p?(g=r.jsxs(vs,{open:o,onOpenChange:l,children:[f,p]}),e[15]=o,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function moe(t){const e=z.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:o}=t,l=re(),[a,c]=P.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=u):u=e[3];let h;e[4]!==o||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?r.jsx(P.Suspense,{fallback:r.jsx(he,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:r.jsx(poe,{override:i,onOverrideChange:o})}):r.jsx(foe,{tier:s,onSelect:n}),e[4]=o,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=h):h=e[10];let f;e[11]!==o?(f=v=>{c(v),v||o(null)},e[11]=o,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=r.jsx(Mr,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=r.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==h||e[22]!==g?(x=r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h,g]}),e[21]=h,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==u||e[25]!==x?(b=r.jsxs("div",{className:"flex flex-col gap-2",children:[u,x]}),e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function poe(t){const e=z.c(25),{override:s,onOverrideChange:n}=t,i=re(),o=If(),l=o[0]?.id??null;let a;e[0]!==l||e[1]!==o||e[2]!==s?.credentialId?(a=o.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=o,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=P.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==o?(u=o.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=o,e[7]=u):u=e[7];const h=u;let f;e[8]!==o||e[9]!==s?(f=s&&o.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=o,e[9]=s,e[10]=f):f=e[10];const m=f;if(o.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let v;return e[13]!==b?(v=r.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}let p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==h||e[18]!==n?(g=b=>{const v=b.keyId??h??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=h,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==h||e[21]!==m||e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:r.jsx(DV,{variant:"bordered",placeholder:p,model:m,credentialId:h,onCredentialChange:d,onModelChange:g})}),e[20]=h,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const Ak=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:g2,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Mn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:_i},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:ri},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Eu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:No,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:Tf},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:p2},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:a2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:gu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:No},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:mV}]},{key:"context",headingKey:"automations.automationConfig.context",icon:jc,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:jc},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:kc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:kc}]},{key:"browser",headingKey:"automations.automationConfig.browser",icon:Rr,tools:[{name:"take_screenshot",titleKey:"automations.automationConfig.toolTakeScreenshot",descriptionKey:"automations.automationConfig.toolTakeScreenshotDesc",icon:R6},{name:"scrape_url",titleKey:"automations.automationConfig.toolScrapeUrl",descriptionKey:"automations.automationConfig.toolScrapeUrlDesc",icon:Rr},{name:"inspect_page",titleKey:"automations.automationConfig.toolInspectPage",descriptionKey:"automations.automationConfig.toolInspectPageDesc",icon:qo}]}],goe=Ak.flatMap(t=>t.tools.map(e=>e.name));function xoe(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function boe(t){const e=z.c(12),{agentId:s,value:n,onChange:i}=t,o=re();let l;e[0]!==o?(l=o("automations.automationConfig.toolsLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==o||e[7]!==n?(c=s?r.jsx(P.Suspense,{fallback:r.jsxs(he,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[r.jsx(g2,{size:14}),o("automations.automationConfig.loadingTools")]}),children:r.jsx(voe,{agentId:s,value:n,onChange:i})}):r.jsx("span",{className:"text-xs text-muted-foreground italic",children:o("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=o,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=r.jsxs("div",{className:"flex flex-col gap-2",children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Ib(t){const e=z.c(17),{value:s,checked:n,onToggle:i,title:o,description:l,leading:a}=t;let c;e[0]!==n?(c=r.jsx(Gc,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&r.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==o?(u=r.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&r.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]!==u||e[9]!==h?(f=r.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[u,h]}),e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=r.jsxs(Cs,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function Mb(t){const e=z.c(27),{conn:s,label:n,icon:i,on:o,total:l,onToggle:a}=t,c=re(),d=o===l;let u;e[0]!==i||e[1]!==s?(u=s?r.jsx(Ai,{icon:s.icon,name:s.title,size:"2xs"}):i?r.jsx(i,{size:14,className:"text-muted-foreground"}):r.jsx(WA,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=u):u=e[2];let h;e[3]!==s?.title||e[4]!==n||e[5]!==c?(h=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=h):h=e[6];let f;e[7]!==h?(f=r.jsx("span",{className:"truncate",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==l?(m=r.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",l]}),e[9]=o,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=L=>{L.stopPropagation(),a()},e[12]=a,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=r.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==u||e[24]!==f||e[25]!==b?(v=r.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function voe(t){const e=z.c(83),{agentId:s,value:n,onChange:i}=t,o=re(),{org:l}=Fe(),[a,c]=P.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const u=Gt(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=P2(h),p=ci();let g,x,b,v,L,_,y,S,k,w,j,N,T;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==o||e[12]!==n){const D=new Map(p.map(Soe)),I=new Map;for(const fe of f?.tools??[]){const ae=er(fe._meta)??"__other__",de=Bc(fe.name,ae==="__other__"?void 0:ae),X=fe.title,pe=X&&X!==fe.name?X:xoe(de);I.has(ae)||I.set(ae,{clientId:ae,conn:D.get(ae),tools:[]}),I.get(ae).tools.push({name:fe.name,display:pe,description:fe.description})}const R=[...I.values()].sort(woe),$=(f?.tools??[]).map(Loe),B=[...goe,...$],M=n===null?new Set(B):new Set(n),O=B.every(fe=>M.has(fe)),F=fe=>i(B.every(ae=>fe.has(ae))?null:[...fe]),U=fe=>{const ae=new Set(M);ae.has(fe)?ae.delete(fe):ae.add(fe),F(ae)},K=(fe,ae)=>{const de=new Set(M);for(const X of fe)ae?de.add(X):de.delete(X);F(de)};v=vs,T=a,L=c;let q;e[26]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx(g2,{size:14,className:"text-muted-foreground"}),e[26]=q):q=e[26];let W;e[27]!==O||e[28]!==o?(W=o(O?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=O,e[28]=o,e[29]=W):W=e[29];const G=!O&&r.jsxs(lP,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",B.length]});let Y;e[30]===Symbol.for("react.memo_cache_sentinel")?(Y=r.jsx(_s,{size:14,className:"text-muted-foreground"}),e[30]=Y):Y=e[30],e[31]!==W||e[32]!==G?(_=r.jsx(ms,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[q,W,G,Y]})}),e[31]=W,e[32]=G,e[33]=_):_=e[33],b=bs,j="p-0 w-80",N="start",x=hr;let ee;e[34]!==o?(ee=o("automations.automationConfig.searchToolsPlaceholder"),e[34]=o,e[35]=ee):ee=e[35],e[36]!==ee?(k=r.jsx(Pi,{placeholder:ee}),e[36]=ee,e[37]=k):k=e[37];const ne=O?o("automations.automationConfig.allToolsEnabled",{count:B.length}):o("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:B.length});let oe;e[38]!==ne?(oe=r.jsx("span",{className:"text-xs text-muted-foreground",children:ne}),e[38]=ne,e[39]=oe):oe=e[39];let Z;e[40]!==i?(Z=()=>i(null),e[40]=i,e[41]=Z):Z=e[41];let J;e[42]!==o?(J=o("automations.automationConfig.selectAll"),e[42]=o,e[43]=J):J=e[43];let H;e[44]!==O||e[45]!==Z||e[46]!==J?(H=r.jsx("button",{type:"button",onClick:Z,disabled:O,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:J}),e[44]=O,e[45]=Z,e[46]=J,e[47]=H):H=e[47];let se;e[48]===Symbol.for("react.memo_cache_sentinel")?(se=r.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=se):se=e[48];let Q;e[49]!==i?(Q=()=>i([]),e[49]=i,e[50]=Q):Q=e[50];const ce=M.size===0;let te;e[51]!==o?(te=o("automations.automationConfig.clear"),e[51]=o,e[52]=te):te=e[52];let le;e[53]!==Q||e[54]!==ce||e[55]!==te?(le=r.jsx("button",{type:"button",onClick:Q,disabled:ce,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:te}),e[53]=Q,e[54]=ce,e[55]=te,e[56]=le):le=e[56];let ue;e[57]!==H||e[58]!==le?(ue=r.jsxs("div",{className:"flex items-center gap-2",children:[H,se,le]}),e[57]=H,e[58]=le,e[59]=ue):ue=e[59],e[60]!==oe||e[61]!==ue?(w=r.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[oe,ue]}),e[60]=oe,e[61]=ue,e[62]=w):w=e[62],g=Ei,y="max-h-80",S=m?r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("automations.automationConfig.loadingTools")}):r.jsxs(r.Fragment,{children:[r.jsx(di,{children:o("automations.automationConfig.noToolsFound")}),Ak.map(fe=>{const ae=fe.tools.map(_oe),de=ae.filter(X=>M.has(X)).length;return r.jsx(qs,{heading:r.jsx(Mb,{label:o(fe.headingKey),icon:fe.icon,on:de,total:ae.length,onToggle:()=>K(ae,de!==ae.length)}),children:fe.tools.map(X=>r.jsx(Ib,{value:`${o(X.titleKey)} ${X.name}`,checked:M.has(X.name),onToggle:()=>U(X.name),title:o(X.titleKey),description:o(X.descriptionKey),leading:r.jsx(X.icon,{size:16,className:"text-muted-foreground"})},X.name))},fe.key)}),R.map(fe=>{const ae=fe.tools.map(yoe),de=ae.filter(X=>M.has(X)).length;return r.jsx(qs,{heading:r.jsx(Mb,{conn:fe.conn,on:de,total:ae.length,onToggle:()=>K(ae,de!==ae.length)}),children:fe.tools.map(X=>r.jsx(Ib,{value:`${X.display} ${X.name} ${fe.conn?.title??""}`,checked:M.has(X.name),onToggle:()=>U(X.name),title:X.display,description:X.description},X.name))},fe.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=o,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=L,e[18]=_,e[19]=y,e[20]=S,e[21]=k,e[22]=w,e[23]=j,e[24]=N,e[25]=T}else g=e[13],x=e[14],b=e[15],v=e[16],L=e[17],_=e[18],y=e[19],S=e[20],k=e[21],w=e[22],j=e[23],N=e[24],T=e[25];let C;e[63]!==g||e[64]!==y||e[65]!==S?(C=r.jsx(g,{className:y,children:S}),e[63]=g,e[64]=y,e[65]=S,e[66]=C):C=e[66];let V;e[67]!==x||e[68]!==C||e[69]!==k||e[70]!==w?(V=r.jsxs(x,{children:[k,w,C]}),e[67]=x,e[68]=C,e[69]=k,e[70]=w,e[71]=V):V=e[71];let A;e[72]!==b||e[73]!==V||e[74]!==j||e[75]!==N?(A=r.jsx(b,{className:j,align:N,children:V}),e[72]=b,e[73]=V,e[74]=j,e[75]=N,e[76]=A):A=e[76];let E;return e[77]!==v||e[78]!==L||e[79]!==_||e[80]!==A||e[81]!==T?(E=r.jsxs(v,{open:T,onOpenChange:L,children:[_,A]}),e[77]=v,e[78]=L,e[79]=_,e[80]=A,e[81]=T,e[82]=E):E=e[82],E}function yoe(t){return t.name}function _oe(t){return t.name}function Loe(t){return t.name}function woe(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function Soe(t){return[t.id,t]}function ou(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function koe(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(i){const a=parseInt(i[1]??"1");return a%7===0?`Every ${a/7} weeks`:`Every ${a} days`}const o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const a=(o[2]??"0").padStart(2,"0"),c=(o[1]??"0").padStart(2,"0");return`Every day at ${a}:${c} UTC`}const l=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(l){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(l[3]??"0")]??"day",d=(l[2]??"0").padStart(2,"0"),u=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${u} UTC`}return t}function joe(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function Coe(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return i?{count:parseInt(i[1]),unit:"days"}:null}function Noe(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Toe=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Voe({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:o}){const l=re(),{triggerAdd:a}=zu(),[c,d]=P.useState(!1),u=e??c,h=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),ge.success(l("automations.addStarterPopover.starterAdded")),h(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");ge.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});h(!1),p.webhook?o?.(p.webhook):ge.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");ge.error(g)}};return r.jsxs(Xt,{open:u,onOpenChange:h,children:[r.jsx(Zt,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",children:[r.jsx(Ht,{size:14}),l("automations.addStarterPopover.addStarter")]})}),r.jsxs(es,{align:"end",className:"w-[200px]",children:[r.jsxs(Yi,{children:[r.jsxs(Ji,{className:"gap-2.5",children:[r.jsx(Gd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),r.jsx(Qi,{className:"w-[160px]",children:Toe.map(p=>r.jsxs(Xe,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[r.jsx(Gd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),r.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[r.jsx(Gd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),r.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[r.jsx(wi,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),r.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[r.jsx(Mn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Pk(t){const e=z.c(39),{open:s,onOpenChange:n,url:i,token:o,title:l,description:a}=t,c=l===void 0?"Webhook ready":l,d=a===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":a,u=re(),[h,f]=P.useState(null),[m,p]=P.useState("curl"),[g,x]=P.useState("header"),b=P.useId();let v;e[0]!==u?(v=async(R,$)=>{try{await navigator.clipboard.writeText(R),f($),ge.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ge.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=v):v=e[1];const L=v;let _;e[2]!==g||e[3]!==o||e[4]!==i?(_=i&&o&&g==="url"?`${i.replace(/\/$/,"")}/${o}`:i??"",e[2]=g,e[3]=o,e[4]=i,e[5]=_):_=e[5];const y=_,S=i&&o?g==="header"?`curl -X POST "${y}" \\
|
|
544
|
+
`)};Tn.prototype.renderPartial=function(e,s,n,i){if(n){var o=this.getConfigTags(i),l=B3(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],u=l;c==0&&d&&(u=this.indentPartial(l,d,a));var h=this.parse(u,o);return this.renderTokens(h,s,n,u,i)}}};Tn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Tn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ni.escape,o=s.lookup(e[1]);if(o!=null)return typeof o=="number"&&i===Ni.escape?String(o):i(o)};Tn.prototype.rawValue=function(e){return e[1]};Tn.prototype.getConfigTags=function(e){return od(e)?e:e&&typeof e=="object"?e.tags:void 0};Tn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!od(e))return e.escape};var Ni={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){ju.templateCache=t},get templateCache(){return ju.templateCache}},ju=new Tn;Ni.clearCache=function(){return ju.clearCache()};Ni.parse=function(e,s){return ju.parse(e,s)};Ni.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+cre(e)+'" was given as the first argument for mustache#render(template, view, partials)');return ju.render(e,s,n,i)};Ni.escape=gre;Ni.Scanner=i0;Ni.Context=$c;Ni.Writer=Tn;function Sre(t,e){const s={__resolveType:t},n=Qw([s],e)[0];return n?jee(s,n,e):null}function kre({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:o,blockKey:l,onSaveReferencedBlock:a}){const c=re(),d=Kr(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=P.useState(()=>Sre(l,o)),[f,m]=P.useState(h?.data??{}),[p,g]=P.useState([]),[x,b]=P.useState(0),[v,L]=P.useState(!1),[_,y]=P.useState(null),S=_!==null,{save:k,flush:w}=Yw({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?Rn(h.resolveType,i):null,N=o[l],T=N?Cl(l,N):l,C=Ts()?.taskId??null,V={orgSlug:t,virtualMcpId:e,branch:s,threadId:C,previewUrl:n??void 0,siteSlug:u},A=$=>{m($),k(l,$)},E=()=>{S?(y(null),L(!1),b($=>$+1)):y(JSON.stringify(f,null,2))},D=$=>{const B=$??"";try{const M=JSON.parse(B);if(M&&typeof M=="object"&&!Array.isArray(M)){L(!1),A(M);return}L(!0)}catch{L(!0)}},I=[T,...p],R=$=>{g(p.slice(0,$)),b(B=>B+1)};return r.jsx("div",{className:"flex h-full w-full min-w-0",children:r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[r.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:_g},"aria-hidden":!0}),r.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:I.map(($,B)=>{const M=B===I.length-1,O=Sn($);return r.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[B>0&&r.jsx(nn,{className:"size-3 shrink-0 text-muted-foreground/60"}),r.jsx("button",{type:"button",onClick:()=>R(B),title:O,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:O})]},`${O}-${B}`)})}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:S?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":S,children:S?r.jsx(Is,{size:14}):r.jsx(qo,{size:14})})}),r.jsx(Ke,{side:"bottom",children:c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),r.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),r.jsxs("div",{className:"relative min-h-0 flex-1",children:[r.jsx(Go,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:j?r.jsx(Ri,{schema:j,value:f,onChange:$=>A($),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:o,onSaveReferencedBlock:a,sandbox:V},x):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),_!==null&&r.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&r.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx($u,{language:"json",height:"100%",code:_,onChange:D,onSave:$=>{D($),w()}})})]})]})]})})}function jre(t){const e=z.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=re();if(!s){let g;e[0]!==f?(g=f("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=f,e[1]=g):g=e[1];let x;e[2]!==f?(x=f("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=f,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=r.jsx(bo,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let v;e[7]!==s.title?(v=US(s.title),e[7]=s.title,e[8]=v):v=e[8];let L;e[9]!==u||e[10]!==s.resolveType?(L=(y,S)=>u(s.resolveType,y,S),e[9]=u,e[10]=s.resolveType,e[11]=L):L=e[11];let _;return e[12]!==o||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==h||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==L||e[24]!==i?(_=r.jsx(ore,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:L,onSaveReferencedBlock:h},g),e[12]=o,e[13]=c,e[14]=d,e[15]=a,e[16]=h,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=L,e[24]=i,e[25]=_):_=e[25],_}const m=`saved:${s.key}`;let p;return e[26]!==o||e[27]!==c||e[28]!==a||e[29]!==h||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=r.jsx(kre,{orgSlug:n,virtualMcpId:i,branch:o,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=o,e[27]=c,e[28]=a,e[29]=h,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const jb="__all__",Cb={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Cre={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},dh={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Nb="status:";function Tb(t){if(!t.startsWith(Nb))return null;const e=t.slice(Nb.length);return e in dh?e:null}const Vb=P.forwardRef(function(e,s){const n=z.c(20);let i,o,l,a,c;n[0]!==e?({icon:i,active:o,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=o,n[3]=l,n[4]=a,n[5]=c):(i=n[1],o=n[2],l=n[3],a=n[4],c=n[5]);const d=o?"text-foreground":"text-muted-foreground";let u;n[6]!==l||n[7]!==d?(u=ie("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=u):u=n[8];let h;n[9]!==i?(h=r.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=n[10];let f;n[11]!==c?(f=c&&r.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(_s,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==u||n[17]!==h||n[18]!==f?(p=r.jsxs(he,{ref:s,type:"button",variant:"ghost",size:"sm",className:u,...a,children:[h,f,m]}),n[14]=a,n[15]=s,n[16]=u,n[17]=h,n[18]=f,n[19]=p):p=n[19],p});function z3(t){const e=z.c(2),{count:s}=t;let n;return e[0]!==s?(n=r.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Nre(t){const e=z.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:o,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onStatusFilterChange:h,onSortChange:f}=t,m=re();let p;if(e[0]!==s||e[1]!==o){let te;e[3]!==o?(te=le=>le.slug===o,e[3]=o,e[4]=te):te=e[4],p=s.find(te),e[0]=s,e[1]=o,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let te;e[8]!==l?(te=le=>le.email===l,e[8]=l,e[9]=te):te=e[9],x=n.find(te),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(o||l||a);let L;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(L=g?.name??b?.name??m(a?dh[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=L):L=e[14];const _=L,y=o?`cat:${o}`:l?`author:${l}`:a?`status:${a}`:jb;let S;e[15]!==u||e[16]!==d||e[17]!==h?(S=()=>{d(null),u(null),h(null)},e[15]=u,e[16]=d,e[17]=h,e[18]=S):S=e[18];const k=S;let w;e[19]!==k||e[20]!==u||e[21]!==d||e[22]!==h?(w=te=>{te.startsWith("cat:")?(u(null),h(null),d(te.slice(4))):te.startsWith("author:")?(d(null),h(null),u(te.slice(7))):Tb(te)?(d(null),u(null),h(Tb(te))):k()},e[19]=k,e[20]=u,e[21]=d,e[22]=h,e[23]=w):w=e[23];const j=w;let N;e[24]!==_||e[25]!==v?(N=r.jsx(Zt,{asChild:!0,children:r.jsx(Vb,{icon:hV,active:v,value:_,className:"min-w-0 shrink"})}),e[24]=_,e[25]=v,e[26]=N):N=e[26];let T;e[27]!==m?(T=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=T):T=e[28];let C;e[29]!==T?(C=r.jsx(hd,{children:T}),e[29]=T,e[30]=C):C=e[30];let V;e[31]!==m?(V=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=V):V=e[32];let A;e[33]!==V?(A=r.jsx(fc,{value:jb,children:V}),e[33]=V,e[34]=A):A=e[34];let E;e[35]!==m?(E=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=E):E=e[36];let D;e[37]!==E?(D=r.jsx(hd,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=D):D=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(dh),e[39]=I):I=e[39];let R;e[40]!==i||e[41]!==m?(R=I.map(te=>r.jsxs(fc,{value:`status:${te}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(dh[te])}),r.jsx(z3,{count:i[te]})]},`status:${te}`)),e[40]=i,e[41]=m,e[42]=R):R=e[42];let $;e[43]!==s.length||e[44]!==m?($=s.length>0&&r.jsx(hd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=$):$=e[45];let B;e[46]!==s?(B=s.map(Vre),e[46]=s,e[47]=B):B=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&r.jsx(hd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let O;e[51]!==n?(O=n.map(Tre),e[51]=n,e[52]=O):O=e[52];let F;e[53]!==y||e[54]!==j||e[55]!==A||e[56]!==D||e[57]!==R||e[58]!==$||e[59]!==B||e[60]!==M||e[61]!==O?(F=r.jsxs(cm,{value:y,onValueChange:j,children:[A,D,R,$,B,M,O]}),e[53]=y,e[54]=j,e[55]=A,e[56]=D,e[57]=R,e[58]=$,e[59]=B,e[60]=M,e[61]=O,e[62]=F):F=e[62];let U;e[63]!==F||e[64]!==C?(U=r.jsxs(es,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[C,F]}),e[63]=F,e[64]=C,e[65]=U):U=e[65];let K;e[66]!==U||e[67]!==N?(K=r.jsxs(Xt,{children:[N,U]}),e[66]=U,e[67]=N,e[68]=K):K=e[68];let q;e[69]!==k||e[70]!==v||e[71]!==m?(q=v&&r.jsx(Are,{label:m("sandbox.postToolbar.clearFilter"),onClick:k}),e[69]=k,e[70]=v,e[71]=m,e[72]=q):q=e[72];const W=Cre[c];let G;e[73]!==m||e[74]!==W?(G=m(W),e[73]=m,e[74]=W,e[75]=G):G=e[75];let Y;e[76]!==G?(Y=r.jsx(Zt,{asChild:!0,children:r.jsx(Vb,{icon:fV,active:!0,value:G})}),e[76]=G,e[77]=Y):Y=e[77];let ee;e[78]!==m?(ee=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=ee):ee=e[79];let ne;e[80]!==ee?(ne=r.jsx(hd,{children:ee}),e[80]=ee,e[81]=ne):ne=e[81];let oe;e[82]!==f?(oe=te=>f(te),e[82]=f,e[83]=oe):oe=e[83];let Z;e[84]===Symbol.for("react.memo_cache_sentinel")?(Z=Object.keys(Cb),e[84]=Z):Z=e[84];let J;e[85]!==m?(J=Z.map(te=>r.jsx(fc,{value:te,children:m(Cb[te])},te)),e[85]=m,e[86]=J):J=e[86];let H;e[87]!==c||e[88]!==oe||e[89]!==J?(H=r.jsx(cm,{value:c,onValueChange:oe,children:J}),e[87]=c,e[88]=oe,e[89]=J,e[90]=H):H=e[90];let se;e[91]!==ne||e[92]!==H?(se=r.jsxs(es,{align:"end",className:"w-44",children:[ne,H]}),e[91]=ne,e[92]=H,e[93]=se):se=e[93];let Q;e[94]!==Y||e[95]!==se?(Q=r.jsx("div",{className:"ml-auto shrink-0",children:r.jsxs(Xt,{children:[Y,se]})}),e[94]=Y,e[95]=se,e[96]=Q):Q=e[96];let ce;return e[97]!==K||e[98]!==q||e[99]!==Q?(ce=r.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[K,q,Q]}),e[97]=K,e[98]=q,e[99]=Q,e[100]=ce):ce=e[100],ce}function Tre(t){return r.jsxs(fc,{value:`author:${t.email}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(z3,{count:t.count})]},`author:${t.email}`)}function Vre(t){return r.jsxs(fc,{value:`cat:${t.slug}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),r.jsx(z3,{count:t.count})]},`cat:${t.slug}`)}function Are(t){const e=z.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(Is,{size:12}),e[0]=i):i=e[0];let o;return e[1]!==s||e[2]!==n?(o=r.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:i}),e[1]=s,e[2]=n,e[3]=o):o=e[3],o}function Pre(t){const e=z.c(18),{checked:s,disabled:n,onToggle:i}=t,o=re();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o?(a=o(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=o,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=r.jsx(He,{asChild:!0,children:r.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Ere,children:r.jsx(Gc,{checked:s,disabled:n,onCheckedChange:l,"aria-label":a})})}),e[5]=s,e[6]=n,e[7]=l,e[8]=a,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==o?(d=o(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=o,e[12]=d):d=e[12];let u;e[13]!==d?(u=r.jsx(Ke,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=r.jsxs(We,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function Ere(t){return t.stopPropagation()}function Dre(t){const e=z.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:o,onExit:l}=t,a=re();let c;e[0]!==n||e[1]!==i?(c=r.jsx(Pre,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let u;e[6]!==d?(u=r.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=u):u=e[7];const h=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(rn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==o||e[12]!==h||e[13]!==f?(p=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:o,"aria-label":f,children:m})}),e[11]=o,e[12]=h,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=r.jsx(Ke,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=r.jsxs(We,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(Is,{size:14}),e[24]=L):L=e[24];let _;e[25]!==l||e[26]!==v?(_=r.jsx(He,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:L})}),e[25]=l,e[26]=v,e[27]=_):_=e[27];let y;e[28]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=y):y=e[29];let S;e[30]!==y?(S=r.jsx(Ke,{side:"bottom",children:y}),e[30]=y,e[31]=S):S=e[31];let k;e[32]!==_||e[33]!==S?(k=r.jsxs(We,{children:[_,S]}),e[32]=_,e[33]=S,e[34]=k):k=e[34];let w;e[35]!==b||e[36]!==k?(w=r.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,k]}),e[35]=b,e[36]=k,e[37]=w):w=e[37];let j;return e[38]!==c||e[39]!==w||e[40]!==u?(j=r.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,u,w]}),e[38]=c,e[39]=w,e[40]=u,e[41]=j):j=e[41],j}function wd(t){const e=z.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:o,onViewJson:l,onDelete:a}=t,c=re();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(Gn,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=r.jsx(Zt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Rre,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&r.jsxs(Xe,{onClick:n,children:[r.jsx(p2,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&r.jsxs(Xe,{onClick:s,children:[r.jsx(dn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&r.jsxs(r.Fragment,{children:[r.jsx(Pr,{}),r.jsxs(Xe,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[r.jsx(zf,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==o||e[15]!==l||e[16]!==c?(g=(o||l)&&r.jsxs(r.Fragment,{children:[r.jsx(Pr,{}),o&&r.jsxs(Xe,{onClick:o,children:[r.jsx(m2,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&r.jsxs(Xe,{onClick:l,children:[r.jsx(qo,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=o,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Pr,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(rn,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let L;e[22]!==a||e[23]!==v?(L=r.jsxs(Xe,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=L):L=e[24];let _;e[25]!==L||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(_=r.jsxs(es,{align:"end",className:"w-44",children:[f,m,p,g,x,L]}),e[25]=L,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=_):_=e[30];let y;return e[31]!==_||e[32]!==h?(y=r.jsxs(Xt,{children:[h,_]}),e[31]=_,e[32]=h,e[33]=y):y=e[33],y}function Rre(t){return t.stopPropagation()}function Ire(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Mre(t){const e=new Map;for(const s of t){const n=Ire(s.resolveType),i=e.get(n);i?i.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function Ab(t){const e=z.c(8),{icon:s,label:n,className:i}=t;let o;e[0]!==i?(o=ie("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==s?(l=r.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:o,children:[l,n]}),e[4]=n,e[5]=o,e[6]=l,e[7]=a):a=e[7],a}const Pb=P.lazy(()=>jn(()=>import("./app-editor-DekxMnA4.js"),__vite__mapDeps([161,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,37,73,74,23,39,80,24,25,26,27,28,29,30,31,32,33,34,35,36,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,75,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,78,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.AppEditor}))),$re=P.lazy(()=>jn(()=>import("./post-editor-eYS6wget.js"),__vite__mapDeps([162,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,25,55,24,26,27,28,29,30,31,32,33,34,35,36,23,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,75,78,163,135,137,151,152,113,110,79,132,164,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,165,166,108,109,74,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,136,138,139,76,140,141,142,143,144,73,145,146,147,148,149,150,153,154,155,156,157,158,159])).then(t=>({default:t.PostEditor}))),Ore=P.lazy(()=>jn(()=>import("./record-editor-DtcqJs15.js"),__vite__mapDeps([167,1,2,75,78,74,6,23,39,132,165,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,166,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,76,140,141,142,143,144,73,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.RecordEditor}))),Bre=P.lazy(()=>jn(()=>import("./category-editor-CLzVrD3c.js"),__vite__mapDeps([168,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,31,24,25,26,27,28,29,30,32,33,34,35,36,23,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,115,75,78,164,151,152,113,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,165,166,108,109,74,110,111,112,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,73,145,146,79,147,148,149,150,153,154,155,156,157,158,159])).then(t=>({default:t.CategoryEditor}))),zre=P.lazy(()=>jn(()=>import("./bulk-category-panel-vm5kaf3N.js"),__vite__mapDeps([169,1,2,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,78,170,74])).then(t=>({default:t.BulkCategoryPanel}))),Fre=P.lazy(()=>jn(()=>import("./sections-editor-BZXQsXK6.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,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.SectionsEditor}))),Ure=P.lazy(()=>jn(()=>import("./seo-editor-X38ED2ap.js"),__vite__mapDeps([171,1,2,37,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,77,78,79,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,75,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.SeoEditor}))),Hre=P.lazy(()=>jn(()=>import("./variant-calendar-DFnlHYZD.js"),__vite__mapDeps([172,1,2,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,78,73,74,79,173,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,75,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.VariantCalendar}))),Kre=P.lazy(()=>jn(()=>import("./post-calendar-B523IrUM.js"),__vite__mapDeps([174,1,2,25,24,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,175,73,74,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,78,75,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.PostCalendar}))),Wre=P.lazy(()=>jn(()=>import("./redirect-editor-CHSAyTcV.js"),__vite__mapDeps([176,1,2,137,6,75,78,74,23,39,166,28,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,81,24,25,26,27,29,30,31,32,33,34,35,36,37,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,138,139,76,140,141,142,143,144,73,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.RedirectEditor})));function qre(t){const e=z.c(20),{deepLinkPage:s}=t,n=Kr(),{currentBranch:i}=un(),{org:o}=Fe(),l=n?.entity?.id??null,a=Qn(),c=Ul(),{runtime:d,previewServerUrl:u}=Cn(l),h=d==="cms";let f;e[0]!==h||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=rie({fastPreviewActive:h,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=h,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${o.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=r.jsx(nie,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(bo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=h?u:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==o.slug||e[17]!==p||e[18]!==l?(g=r.jsx(Yre,{orgSlug:o.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=o.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const Eb=2e3,Gre=15;function Db(t,e,s,n){return typeof e!="string"||s&&(xk(e,s,n)||t.state.dataUpdateCount>=Gre)?!1:Eb}function Yre({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:o,devServerReady:l,sandboxWarming:a}){const c=re(),d=Ts()?.taskId??null,u={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:h,isLoading:f}=Qf(u,{fetchEnabled:l}),[m,p]=P.useState("pages"),[g,x]=P.useState(null),[b,v]=P.useState(null),L=!!(o?.pageId||o?.path||o?.pathTemplate),[_,y]=P.useState(!1);if(L&&!_&&g===null&&h){y(!0);const me=hO(Ph(h),o??{});me&&(p("pages"),x({collection:"pages",key:me.key,path:me.path}))}const[S,k]=P.useState(""),[w,j]=P.useState(null),[N,T]=P.useState(null),[C,V]=P.useState(null),[A,E]=P.useState("date-desc"),[D,I]=P.useState(()=>new Set),[R,$]=P.useState(null),B=()=>{I(new Set),$(null)},M=me=>{x(me),v(null)},[O,F]=P.useState(m);O!==m&&(F(m),k(""),j(null),T(null),V(null),E("date-desc"),I(new Set),$(null));const{data:U,isLoading:K,isFetching:q}=Xf(u,{fetchEnabled:l,refetchInterval:me=>{const Ae=me.state.data;if(m==="apps"&&g&&g.collection==="apps"){const Oe=h?.[g.key];return Db(me,typeof Oe?.__resolveType=="string"?Oe.__resolveType:void 0,Ae)}if(m==="site"&&h){const Oe=Ae?Sm(h,Ae):null,je=h.site,ot=Oe?.resolveType??(typeof je?.__resolveType=="string"?je.__resolveType:void 0);return Db(me,ot,Ae,["seo"])}return!1}}),W=(me,Ae)=>!xk(me,U,Ae)&&(K||q),{catalog:G,isLoading:Y}=tie(U??void 0,h??void 0,{enabled:m==="apps"}),ee=Uie({orgSlug:t,virtualMcpId:e,branch:s,meta:U}),ne=n0(u),oe=Wne(u),[Z,J]=P.useState(null),[H,se]=P.useState(),[Q,ce]=P.useState(null),[te,le]=P.useState(null),[ue,fe]=P.useState(null),ae=!h||!U;if(f||K||ae&&a)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})});if(ae)return r.jsx(bo,{title:"Could not load site data."});const de=Ph(h).sort((me,Ae)=>me.name.localeCompare(Ae.name)),X=s_(h).sort((me,Ae)=>me.from.localeCompare(Ae.from)),pe=Tg(h,U),ye=m==="sections"?nO(U):[],we=Sm(h,U),_e=Lk(h),Pe=$3.some(me=>_e[me].length>0),Se=ru(m)?_e[m]:[],Te=(Pe?ku(h,"categories"):[]).map(({key:me,payload:Ae})=>{const Oe=typeof Ae.slug=="string"?Ae.slug:"",je=typeof Ae.name=="string"?Ae.name:"";return{slug:Oe||me,name:je||Oe||me}}).filter(me=>me.slug).sort((me,Ae)=>me.name.localeCompare(Ae.name)),ve=m==="posts"&&(D.size>0||R!==null),ke=ve?jk(h).filter(me=>D.has(me.key)):[],Le=F5(U,"loaders"),Ne=F5(U,"actions");if(!t9(h,U)&&!Pe&&Le===0&&Ne===0)return r.jsx(bo,{icon:bn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const et={pages:de.length,sections:pe.length,apps:G.length,loaders:Le,actions:Ne,redirects:X.length,posts:_e.posts.length,authors:_e.authors.length,categories:_e.categories.length},Ye=new Set(de.map(me=>wo(me.path))),ze=new Set(de.map(me=>me.name)),Me=new Set(pe.map(me=>me.name)),at=async me=>{const Ae=h[me.key];if(!Ae)return;const Oe=tS(h,me.key),je=sS(h,me.key,Math.max(0,Oe-1)),ot=lX(Ae.sections,je);if(ot)try{await ne.mutateAsync({blockKey:me.key,data:{...Ae,sections:ot}}),ge.success(`Variant added to "${me.name}"`),x({collection:"pages",key:me.key,path:me.path})}catch(mt){ge.error(mt instanceof Error?mt.message:"Could not add variant")}},Ze=()=>{se(void 0),J({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},it=me=>{se(void 0),J({mode:"duplicate",sourceKey:me.key,initialName:xb(ze,me.name),initialPath:oie(Ye,me.path)})},rt=me=>{se(void 0),J({mode:"rename",sourceKey:me.key,initialName:me.name,initialPath:me.path})},dt=async me=>{if(!Z)return;const{mode:Ae,sourceKey:Oe}=Z;try{if(Ae==="create"){let je;if(me.templateKey){const mt=h[me.templateKey];if(!mt)throw new Error("Selected template no longer exists.");je={...mt,name:me.name,path:me.path}}else je=cie(me.name,me.path);const ot=uie(h,me.name);await ne.mutateAsync({blockKey:ot,data:je}),ge.success(`Created "${me.name}"`),x({collection:"pages",key:ot,path:me.path})}else if(Ae==="duplicate"&&Oe){const je=h[Oe];if(!je)throw new Error("Source page not found");const{key:ot,data:mt}=aie({source:je,pages:de,newName:me.name,newPath:me.path});await ne.mutateAsync({blockKey:ot,data:mt}),ge.success(`Duplicated as "${me.name}"`),x({collection:"pages",key:ot,path:me.path})}else if(Ae==="rename"&&Oe){const je=h[Oe];if(!je)throw new Error("Page not found");const ot={...je,name:me.name,path:me.path};await ne.mutateAsync({blockKey:Oe,data:ot}),ge.success("Page updated"),g?.collection==="pages"&&g.key===Oe&&x({collection:"pages",key:Oe,path:me.path})}J(null)}catch(je){se(je instanceof Error?je.message:"Save failed")}},nt=({path:me})=>{if(!Z)return null;const Ae=wo(me);return(Z.mode==="rename"?wo(Z.initialPath):null)!==Ae&&Ye.has(Ae)?`A page with path "${me}" already exists.`:null},Re=async(me,Ae,Oe)=>{await ne.mutateAsync({blockKey:Ae,data:{...Oe,name:Ae,__resolveType:me}}),ge.success(c("sandbox.contentBrowser.createdSection",{name:Ae})),x({collection:"sections",key:Ae})},ft=w3((me,Ae)=>ne.mutate({blockKey:me,data:Ae})),ut=async me=>{const Ae=h[me.key];if(!Ae){ge.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Oe=lie(h,me.key),je=xb(Me,me.name),ot={...Ae,name:je};try{await ne.mutateAsync({blockKey:Oe,data:ot}),ge.success(c("sandbox.contentBrowser.duplicatedSection",{name:me.name})),x({collection:"sections",key:Oe})}catch(mt){ge.error(mt instanceof Error?mt.message:c("sandbox.contentBrowser.duplicateFailed"))}},be=async me=>{if(!Q)return;const Ae=h[Q];if(!Ae){ge.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await ne.mutateAsync({blockKey:Q,data:{...Ae,name:me}}),ge.success(c("sandbox.contentBrowser.sectionRenamed")),ce(null)}catch(Oe){ge.error(Oe instanceof Error?Oe.message:c("sandbox.contentBrowser.renameFailed"))}},qe=async()=>{const me="/redirect-from",Ae=uO(h,me),Oe=aO({from:me,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await ne.mutateAsync({blockKey:Ae,data:Oe}),ge.success("Created redirect"),x({collection:"redirects",key:Ae})}catch(je){ge.error(je instanceof Error?je.message:"Could not create redirect")}},tt=async me=>{const Ae=P1(h,me),Oe=tc(Ae,me,Ck(me));try{await ne.mutateAsync({blockKey:Ae,data:Oe}),ge.success(`Created ${iu[me]}`),x({collection:me,key:Ae})}catch(je){ge.error(je instanceof Error?je.message:"Could not create")}},Ue=async me=>{const Ae=P1(h,"posts"),Oe=tc(Ae,"posts",Die(me));try{await ne.mutateAsync({blockKey:Ae,data:Oe}),ge.success(c("sandbox.postCalendar.createdScheduledPost")),p("posts"),F("posts"),x({collection:"posts",key:Ae}),v(null)}catch(je){ge.error(je instanceof Error?je.message:c("sandbox.postCalendar.couldNotCreate"))}},Lt=async(me,Ae)=>{const Oe=h[me],je=Oe?Iie(Bd(Oe,"posts"),Ae):null;if(!je){ge.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await ne.mutateAsync({blockKey:me,data:tc(me,"posts",je)})}catch(ot){ge.error(ot instanceof Error?ot.message:c("sandbox.postCalendar.couldNotReschedule"))}},wt=async me=>{const Ae=h[me.key];if(!Ae){ge.error("Record not found.");return}const Oe=P1(h,me.kind),je=me.kind==="posts"?"title":"name",ot={...structuredClone(Bd(Ae,me.kind)),[je]:`${me.label} (copy)`};try{await ne.mutateAsync({blockKey:Oe,data:tc(Oe,me.kind,ot)}),ge.success(`Duplicated "${me.label}"`),x({collection:me.kind,key:Oe})}catch(mt){ge.error(mt instanceof Error?mt.message:"Duplicate failed")}},ht=me=>{I(Ae=>{const Oe=new Set(Ae);return Oe.has(me)?Oe.delete(me):Oe.add(me),Oe})},Tt=me=>{p("posts"),F("posts"),x(null),v(null),k(""),j(null),T(null),V(null),E("date-desc"),I(new Set),$(me||null)},$e=async(me,Ae)=>{const Oe=[...D];let je=0;for(const ot of Oe){const mt=h[ot],$t=Bd(mt,"posts"),At=me==="add"?Sie($t,Ae):kie($t,Ae);At!==$t&&(await ne.mutateAsync({blockKey:ot,data:tc(ot,"posts",vb(At))}),je+=1)}return je},ct=async(me,Ae)=>{const Oe=D.size;try{const je=await $e(me,Ae),ot=me==="add"?"Added to":"Moved",mt=Oe-je;ge.success(`${ot} ${je} ${je===1?"post":"posts"}`+(mt>0?` (${mt} already set)`:"")),B()}catch(je){ge.error(je instanceof Error?je.message:"Bulk update failed")}},kt=async()=>{if(te)try{if(te.kind==="blog-bulk"){for(const je of te.keys)await oe.mutateAsync({blockKey:je});ge.success(`Deleted ${te.count} ${te.count===1?"post":"posts"}`),g&&g.collection!=="available-section"&&te.keys.includes(g.key)&&x(null),B(),le(null);return}const{kind:me,key:Ae,label:Oe}=te;if(me==="blog"){if(te.blogKind==="categories"){const je=Bd(h[Ae],"categories").slug,ot=typeof je=="string"?je:"";if(ot)for(const{key:mt,payload:$t}of ku(h,"posts")){const At=jie($t,ot);At!==$t&&await ne.mutateAsync({blockKey:mt,data:tc(mt,"posts",vb(At))})}}await oe.mutateAsync({blockKey:Ae})}else await oe.mutateAsync({blockKey:Ae});ge.success(`Deleted "${Oe}"`),g&&g.collection!=="available-section"&&g.key===Ae&&x(null),le(null)}catch(me){ge.error(me instanceof Error?me.message:"Delete failed")}},xt=oe.isPending||ne.isPending,yt=te?.kind==="blog"?iu[te.blogKind]:te?.kind==="blog-bulk"?`${te.count} ${te.count===1?"post":"posts"}`:te?.kind??"item";return r.jsxs("div",{className:"flex h-full w-full",children:[r.jsx(sie,{active:m,counts:et,showBlog:Pe,onSelect:me=>{p(me),x(null),v(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&r.jsx(Jre,{activeCollection:m,pages:de,redirects:X,sections:pe,availableSections:ye,appCatalog:G,appCatalogLoading:Y,blogEntries:Se,decofile:h,searchQuery:S,onSearchChange:k,postCategoryFilter:w,postAuthorFilter:N,postStatusFilter:C,postSort:A,onPostCategoryFilterChange:me=>{j(me),I(new Set)},onPostAuthorFilterChange:me=>{T(me),I(new Set)},onPostStatusFilterChange:me=>{V(me),I(new Set)},onPostSortChange:E,selectedPostKeys:D,postBulkPanelOpen:ve,onTogglePostSelect:ht,onSelectAllPosts:me=>I(new Set(me)),onClearPostSelection:()=>I(new Set),onExitPostSelection:B,onBulkDeletePosts:()=>le({kind:"blog-bulk",keys:[...D],count:D.size}),selection:g,onSelect:M,onCreate:()=>{m==="pages"?Ze():m==="redirects"?qe():ru(m)&&tt(m)},onDuplicatePage:it,onRenamePage:rt,onAddPageVariant:at,onDeletePage:me=>le({kind:"page",key:me.key,label:me.name}),onEditPageSeo:me=>{const Ae={collection:"pages",key:me.key,path:me.path};x(Ae),v(me.key)},onViewPageJson:me=>fe(me.key),onDuplicateSection:ut,onRenameSection:me=>ce(me.key),onDeleteSection:me=>le({kind:"section",key:me.key,label:me.name}),onDeleteRedirect:me=>le({kind:"redirect",key:me.key,label:me.from||me.key}),onDuplicateBlog:wt,onDeleteBlog:me=>le({kind:"blog",blogKind:me.kind,key:me.key,label:me.label})}),r.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?r.jsx(Jie,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:h,kind:m}):r.jsx(P.Suspense,{fallback:r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(lt,{size:20,className:"animate-spin text-muted-foreground"})}),children:m==="calendar"?r.jsx(Hre,{decofile:h}):m==="post-schedule"?r.jsx(Kre,{decofile:h,support:ee,isCreating:ne.isPending,onCreate:me=>{Ue(me)},onReschedule:(me,Ae)=>{Lt(me,Ae)},onSelect:me=>{p("posts"),F("posts"),x({collection:"posts",key:me}),v(null)}}):m==="site"?we?r.jsx(Pb,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:we.key,block:h[we.key],decofile:h,meta:U,title:"Site",excludeFields:["seo"],schemaPending:W(we.resolveType,["seo"]),previewBaseUrl:n},`site:${we.key}`):r.jsx(bo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?r.jsx(Ure,{orgSlug:t,virtualMcpId:e,branch:s,decofile:h,meta:U,target:{kind:"site"},previewBaseUrl:i}):m==="sections"?r.jsx(jre,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:U,decofile:h,isCreating:ne.isPending,onCreateAvailable:Re,onSaveReferencedBlock:ft}):ve?r.jsx(zre,{posts:ke,categories:Te,initialSlug:R,isPending:ne.isPending,onApply:(me,Ae)=>{ct(me,Ae)},onClose:B},R??"selection"):g&&g.collection!=="available-section"?g.collection==="apps"?r.jsx(Pb,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,previewBaseUrl:n,schemaPending:W(typeof h[g.key]?.__resolveType=="string"?String(h[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="posts"?r.jsx($re,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,previewBaseUrl:i},`post:${g.key}`):g.collection==="categories"?r.jsx(Bre,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key],decofile:h,meta:U,onManagePosts:Tt,onOpenPost:me=>{p("posts"),F("posts"),x({collection:"posts",key:me}),v(null)},previewBaseUrl:i},`category:${g.key}`):g.collection==="authors"?r.jsx(Ore,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:h[g.key]},`authors:${g.key}`):g.collection==="redirects"?r.jsx(Wre,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:h[g.key]},`redirect:${g.key}`):r.jsx(Fre,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&b===g.key,onExitSeo:()=>v(null)},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):r.jsx(bo,{title:`Select ${ru(m)?`a ${iu[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),Z&&r.jsx(pie,{open:!!Z,mode:Z.mode,initialName:Z.initialName,initialPath:Z.initialPath,isPending:ne.isPending,error:H,templates:de,validate:nt,onSubmit:dt,onOpenChange:me=>{me||(J(null),se(void 0))}}),Q&&r.jsx(gie,{open:!!Q,blockKey:Q,initialName:pe.find(me=>me.key===Q)?.name??Q,isPending:ne.isPending,onSubmit:be,onOpenChange:me=>{me||ce(null)}}),ue&&r.jsx(Hie,{open:!!ue,onOpenChange:me=>{me||fe(null)},pageKey:ue,decofile:h,onSave:me=>ne.mutateAsync({blockKey:ue,data:me})}),r.jsx(To,{open:!!te,onOpenChange:me=>{!me&&!xt&&le(null)},children:r.jsxs(Vo,{children:[r.jsxs(Ao,{children:[r.jsx(Po,{children:`Delete ${yt}?`}),r.jsx(Eo,{children:te?.kind==="section"?`"${te.label}" will be removed. Pages that still reference it will lose this section.`:te?.kind==="blog-bulk"?`${te.count} ${te.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:te?`"${te.label}" will be removed permanently. This can't be undone.`:null})]}),r.jsxs(Do,{children:[r.jsx(Ro,{disabled:xt,children:"Cancel"}),r.jsx(Io,{onClick:me=>{me.preventDefault(),kt()},disabled:xt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:xt?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function Jre(t){const e=z.c(82),{activeCollection:s,pages:n,redirects:i,sections:o,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:u,searchQuery:h,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:L,onPostSortChange:_,selectedPostKeys:y,postBulkPanelOpen:S,onTogglePostSelect:k,onSelectAllPosts:w,onClearPostSelection:j,onExitPostSelection:N,onBulkDeletePosts:T,selection:C,onSelect:V,onCreate:A,onDuplicatePage:E,onRenamePage:D,onAddPageVariant:I,onDeletePage:R,onEditPageSeo:$,onViewPageJson:B,onDuplicateSection:M,onRenameSection:O,onDeleteSection:F,onDeleteRedirect:U,onDuplicateBlog:K,onDeleteBlog:q}=t;let W,G,Y,ee,ne,oe,Z;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==u||e[6]!==I||e[7]!==T||e[8]!==j||e[9]!==A||e[10]!==q||e[11]!==R||e[12]!==U||e[13]!==F||e[14]!==K||e[15]!==E||e[16]!==M||e[17]!==$||e[18]!==N||e[19]!==v||e[20]!==b||e[21]!==_||e[22]!==L||e[23]!==D||e[24]!==O||e[25]!==f||e[26]!==V||e[27]!==w||e[28]!==k||e[29]!==B||e[30]!==n||e[31]!==p||e[32]!==S||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==h||e[38]!==o||e[39]!==y||e[40]!==C){const Q=h.toLowerCase(),ce=n.filter(be=>!Q||be.name.toLowerCase().includes(Q)||be.path.toLowerCase().includes(Q)),te=i.filter(be=>!Q||be.from.toLowerCase().includes(Q)||be.to.toLowerCase().includes(Q)),le=o.filter(be=>!Q||be.name.toLowerCase().includes(Q)||be.key.toLowerCase().includes(Q)||be.resolveType.toLowerCase().includes(Q)),ue=l.filter(be=>!Q||be.title.toLowerCase().includes(Q)||be.resolveType.toLowerCase().includes(Q)||(be.description?.toLowerCase().includes(Q)??!1)),fe=Mre(le),ae=a.filter(be=>!Q||be.title.toLowerCase().includes(Q)||be.app.toLowerCase().includes(Q)||be.vendor.toLowerCase().includes(Q)||be.category.toLowerCase().includes(Q)),de=d.filter(be=>!Q||be.label.toLowerCase().includes(Q)||be.subtitle.toLowerCase().includes(Q)),X=s==="posts",pe=eoe,ye=X?jk(u):[],we=new Map,_e=new Map,Pe={published:0,scheduled:0,draft:0};for(const be of ye)Pe[be.status]=Pe[be.status]+1;for(const be of ye){for(const qe of be.categorySlugs)we.set(qe,(we.get(qe)??0)+1);for(const qe of be.authorEmails)_e.set(qe,(_e.get(qe)??0)+1)}const Se=(X?ku(u,"categories"):[]).map(be=>{const{key:qe,payload:tt}=be,Ue=pe(tt.slug)||qe;return{slug:Ue,name:pe(tt.name)||pe(tt.slug)||qe,count:we.get(Ue)??0}}).filter(Zre),Te=(X?ku(u,"authors"):[]).map(be=>{const{key:qe,payload:tt}=be,Ue=pe(tt.email);return{email:Ue,name:pe(tt.name)||pe(tt.email)||qe,count:_e.get(Ue)??0}}).filter(Xre);let ve;e[48]!==m?(ve=be=>!m||be.categorySlugs.includes(m),e[48]=m,e[49]=ve):ve=e[49];let ke;e[50]!==p?(ke=be=>!p||be.authorEmails.includes(p),e[50]=p,e[51]=ke):ke=e[51];let Le;e[52]!==g?(Le=be=>!g||be.status===g,e[52]=g,e[53]=Le):Le=e[53];let Ne;e[54]!==x?(Ne=(be,qe)=>{if(x==="az")return be.title.localeCompare(qe.title);if(x==="za")return qe.title.localeCompare(be.title);const tt=be.date.localeCompare(qe.date);return x==="date-asc"?tt:-tt},e[54]=x,e[55]=Ne):Ne=e[55];const et=ye.filter(be=>!Q||be.title.toLowerCase().includes(Q)||be.slug.toLowerCase().includes(Q)).filter(ve).filter(ke).filter(Le).sort(Ne),Ye=y.size,ze=et.map(Qre),Me=ze.length>0&&ze.every(be=>y.has(be)),at=Ye>0||S,Ze=()=>{Me?j():w(ze)},it=`Search ${s}…`,rt=ru(s)?`Create new ${iu[s]}`:s==="redirects"?"Create new redirect":"Create new page",dt=s!=="apps"&&s!=="sections";ne="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let nt;e[56]===Symbol.for("react.memo_cache_sentinel")?(nt=r.jsx(Hf,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=nt):nt=e[56];let Re;e[57]!==f?(Re=be=>f(be.target.value),e[57]=f,e[58]=Re):Re=e[58];let ft;e[59]!==it||e[60]!==h||e[61]!==Re?(ft=r.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[nt,r.jsx("input",{type:"text",value:h,onChange:Re,placeholder:it,"aria-label":it,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=it,e[60]=h,e[61]=Re,e[62]=ft):ft=e[62];let ut;e[63]!==rt||e[64]!==A||e[65]!==dt?(ut=dt&&r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",onClick:A,"aria-label":rt,children:r.jsx(Ht,{size:14})})}),r.jsx(Ke,{side:"bottom",children:rt})]}),e[63]=rt,e[64]=A,e[65]=dt,e[66]=ut):ut=e[66],e[67]!==ft||e[68]!==ut?(oe=r.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[ft,ut]}),e[67]=ft,e[68]=ut,e[69]=oe):oe=e[69],Z=X&&(at?r.jsx(Dre,{count:Ye,allSelected:Me,onToggleSelectAll:Ze,onDelete:T,onExit:N}):r.jsx(Nre,{categories:Se,authors:Te,categoryFilter:m,statusCounts:Pe,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:L,onSortChange:_})),W=Go,ee="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",G="flex flex-col gap-1 p-1.5",Y=s==="pages"?ce.length===0?r.jsx(ec,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):ce.map(be=>{const qe=C?.collection==="pages"&&C.key===be.key,tt=tS(u,be.key);return r.jsx(pi,{icon:_o,title:be.name,subtitle:be.path,active:qe,variantCount:tt,onClick:()=>V({collection:"pages",key:be.key,path:be.path}),menu:r.jsx(wd,{onDuplicate:()=>E(be),onRename:()=>D(be),onAddVariant:()=>I(be),onEditSeo:()=>$(be),onViewJson:()=>B(be),onDelete:()=>R(be)})},be.key)}):s==="sections"?le.length===0&&ue.length===0?r.jsx(ec,{hasItems:o.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):r.jsxs(r.Fragment,{children:[fe.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Ab,{icon:Rr,label:"Saved sections"}),fe.map(be=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:be.label}),be.sections.map(qe=>{const tt=C?.collection==="sections"&&C.key===qe.key;return r.jsx(pi,{icon:Rr,accent:"global",title:qe.name,subtitle:be.label,active:tt,onClick:()=>V({collection:"sections",key:qe.key}),menu:r.jsx(wd,{onDuplicate:()=>M(qe),onRename:()=>O(qe),onDelete:()=>F(qe)})},qe.key)})]},be.label))]}),ue.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Ab,{icon:_o,label:"Available sections",className:ie(fe.length>0&&"mt-3")}),ue.map(be=>{const qe=C?.collection==="available-section"&&C.resolveType===be.resolveType,tt=be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return r.jsx(pi,{icon:_o,title:be.title,subtitle:tt??be.resolveType,active:qe,onClick:()=>V({collection:"available-section",resolveType:be.resolveType,title:be.title})},be.resolveType)})]})]}):s==="apps"?c?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(lt,{size:18,className:"animate-spin text-muted-foreground"})}):ae.length===0?r.jsx(ec,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ae.map(be=>{const qe=C?.collection==="apps"&&be.blockKey!==null&&C.key===be.blockKey;return r.jsx(pi,{icon:i8,logoUrl:be.logo,title:be.title,subtitle:be.category,active:qe,trailing:be.installed?r.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!be.installed||!be.blockKey){ge.message(`${be.title} is not installed on this site.`);return}V({collection:"apps",key:be.blockKey})}},be.id)}):s==="redirects"?te.length===0?r.jsx(ec,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):te.map(be=>r.jsx(pi,{icon:p6,title:be.from||"(no source)",subtitle:`→ ${be.to||"(no target)"}`,active:C?.collection==="redirects"&&C.key===be.key,trailing:r.jsx(xie,{type:be.type}),onClick:()=>V({collection:"redirects",key:be.key}),menu:r.jsx(wd,{onDelete:()=>U(be)})},be.key)):X?et.length===0?r.jsx(ec,{hasItems:ye.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):et.map(be=>{const qe={key:be.key,kind:"posts",label:be.title,subtitle:be.slug};return r.jsx(pi,{icon:yi,title:be.title,subtitle:be.slug||"no slug",invalid:be.missing.length>0,invalidReason:`Missing: ${be.missing.join(", ")}`,active:C?.collection==="posts"&&C.key===be.key,selectable:!0,selectionActive:at,selected:y.has(be.key),onToggleSelect:()=>k(be.key),onClick:()=>at?k(be.key):V({collection:"posts",key:be.key}),menu:r.jsx(wd,{onDuplicate:()=>K(qe),onDelete:()=>q(qe)})},be.key)}):de.length===0?r.jsx(ec,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${ru(s)?iu[s]:"item"}.`}):de.map(be=>{const qe=C?.collection===be.kind&&C.key===be.key;return r.jsx(pi,{icon:be.kind==="posts"?yi:be.kind==="authors"?M2:$2,title:be.label,subtitle:be.subtitle,active:qe,onClick:()=>V({collection:be.kind,key:be.key}),menu:r.jsx(wd,{onDuplicate:()=>K(be),onDelete:()=>q(be)})},be.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=u,e[6]=I,e[7]=T,e[8]=j,e[9]=A,e[10]=q,e[11]=R,e[12]=U,e[13]=F,e[14]=K,e[15]=E,e[16]=M,e[17]=$,e[18]=N,e[19]=v,e[20]=b,e[21]=_,e[22]=L,e[23]=D,e[24]=O,e[25]=f,e[26]=V,e[27]=w,e[28]=k,e[29]=B,e[30]=n,e[31]=p,e[32]=S,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=h,e[38]=o,e[39]=y,e[40]=C,e[41]=W,e[42]=G,e[43]=Y,e[44]=ee,e[45]=ne,e[46]=oe,e[47]=Z}else W=e[41],G=e[42],Y=e[43],ee=e[44],ne=e[45],oe=e[46],Z=e[47];let J;e[70]!==G||e[71]!==Y?(J=r.jsx("div",{className:G,children:Y}),e[70]=G,e[71]=Y,e[72]=J):J=e[72];let H;e[73]!==W||e[74]!==ee||e[75]!==J?(H=r.jsx(W,{className:ee,children:J}),e[73]=W,e[74]=ee,e[75]=J,e[76]=H):H=e[76];let se;return e[77]!==ne||e[78]!==oe||e[79]!==Z||e[80]!==H?(se=r.jsxs("div",{className:ne,children:[oe,Z,H]}),e[77]=ne,e[78]=oe,e[79]=Z,e[80]=H,e[81]=se):se=e[81],se}function Qre(t){return t.key}function Xre(t){return t.email}function Zre(t){return t.slug}function eoe(t){return typeof t=="string"?t:""}function toe(t){const e=z.c(17),{virtualMcpId:s}=t,n=re(),i=Ms(s),{activeTask:o}=un();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=ur(l);if(!(sn(i?.metadata)||sn(o?.metadata))){let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(bn,{size:24,className:"text-muted-foreground/60"}),e[1]=u):u=e[1];let h;e[2]!==n?(h=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=h):h=e[3];let f;e[4]!==h?(f=r.jsx("div",{children:h}),e[4]=h,e[5]=f):f=e[5];let m;e[6]!==n?(m=n("mainPanelTabs.contentTab.connectGithubDescription"),e[6]=n,e[7]=m):m=e[7];let p;e[8]!==m?(p=r.jsx("div",{className:"text-xs text-muted-foreground/80",children:m}),e[8]=m,e[9]=p):p=e[9];let g;return e[10]!==f||e[11]!==p?(g=r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[u,f,p]}),e[10]=f,e[11]=p,e[12]=g):g=e[12],g}let d;return e[13]!==a.contentPageId||e[14]!==a.contentPath||e[15]!==a.contentPathTemplate?(d=r.jsx(qre,{deepLinkPage:{pageId:a.contentPageId,path:a.contentPath,pathTemplate:a.contentPathTemplate}}),e[13]=a.contentPageId,e[14]=a.contentPath,e[15]=a.contentPathTemplate,e[16]=d):d=e[16],d}function soe(t){const e=z.c(6),{virtualMcpId:s}=t,n=Ms(s),i=$6();let o;e[0]!==i||e[1]!==n?(o=s9(i,p_(n)),e[0]=i,e[1]=n,e[2]=o):o=e[2];const l=o;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(noe,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=r.jsx(ooe,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function noe(){const t=z.c(12),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:r.jsx(E2,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=r.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let o;t[5]!==e?(o=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=o):o=t[6];let l;t[7]!==o?(l=r.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:o}),t[7]=o,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,r.jsxs("div",{children:[i,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function ioe(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function roe(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function ooe(t){const e=z.c(99),{config:s}=t,n=re(),[i,o]=P.useState(""),l=Kf(i,300);let a;e[0]!==s.id||e[1]!==l?(a={configId:s.id,search:l},e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const c=KS(a),d=k9(),[u,h]=P.useState(!1),[f,m]=P.useState(null),p=P.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const O=Array.from(M);if(O.length===0)return;const F=[];for(const U of O)try{await d.mutateAsync({configId:s.id,file:U})}catch(K){const q=K;F.push(`${U.name} (${q instanceof Error?q.message:"upload failed"})`)}await c.refetch(),F.length>0&&ge.error(F.length===O.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:F.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:F.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),h(!0)},e[8]=b):b=e[8];const v=b;let L;e[9]===Symbol.for("react.memo_cache_sentinel")?(L=function(){h(!1)},e[9]=L):L=e[9];const _=L;let y;e[10]!==x?(y=function(M){M.preventDefault(),M.stopPropagation(),h(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=y):y=e[11];const S=y,[k,w]=vm();let j,N,T,C,V,A;if(e[12]!==s.name||e[13]!==l||e[14]!==w||e[15]!==k||e[16]!==x||e[17]!==u||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==S||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(loe),O=roe(M,ioe(k)),F=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;V="flex h-full min-h-0 flex-col gap-3 p-4";let K;e[31]!==n?(K=n("assets.browser.title"),e[31]=n,e[32]=K):K=e[32];let q;e[33]!==K?(q=r.jsx("h2",{className:"text-sm font-semibold",children:K}),e[33]=K,e[34]=q):q=e[34];let W;e[35]!==s.name||e[36]!==n?(W=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=W):W=e[37];let G;e[38]!==W?(G=r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:W}),e[38]=W,e[39]=G):G=e[39];let Y;e[40]!==q||e[41]!==G?(Y=r.jsxs("div",{className:"min-w-0",children:[q,G]}),e[40]=q,e[41]=G,e[42]=Y):Y=e[42];let ee;e[43]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>p.current?.click(),e[43]=ee):ee=e[43];let ne;e[44]!==d.isPending?(ne=d.isPending?r.jsx(lt,{size:14,className:"animate-spin"}):r.jsx(Yn,{size:14}),e[44]=d.isPending,e[45]=ne):ne=e[45];let oe;e[46]!==n||e[47]!==d.isPending?(oe=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=oe):oe=e[48];let Z;e[49]!==ne||e[50]!==oe||e[51]!==d.isPending?(Z=r.jsxs(he,{type:"button",size:"sm",disabled:d.isPending,onClick:ee,children:[ne,oe]}),e[49]=ne,e[50]=oe,e[51]=d.isPending,e[52]=Z):Z=e[52];let J;e[53]!==x?(J=r.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:de=>{const X=Array.from(de.target.files??[]);de.target.value="",x(X)}}),e[53]=x,e[54]=J):J=e[54],e[55]!==Y||e[56]!==Z||e[57]!==J?(A=r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Y,Z,J]}),e[55]=Y,e[56]=Z,e[57]=J,e[58]=A):A=e[58];let H;e[59]!==n?(H=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=H):H=e[60],e[61]!==U||e[62]!==i||e[63]!==H?(j=r.jsx(Of,{value:i,onChange:o,isSearching:U,placeholder:H,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=H,e[64]=j):j=e[64];let se;e[65]===Symbol.for("react.memo_cache_sentinel")?(se=()=>p.current?.click(),e[65]=se):se=e[65];const Q=u&&"border-primary bg-primary/5",ce=d.isPending&&"pointer-events-none opacity-60";let te;e[66]!==Q||e[67]!==ce?(te=ie("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",Q,ce),e[66]=Q,e[67]=ce,e[68]=te):te=e[68];let le;e[69]===Symbol.for("react.memo_cache_sentinel")?(le=r.jsx(Yn,{size:16,className:"text-muted-foreground"}),e[69]=le):le=e[69];let ue;e[70]!==n?(ue=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ue):ue=e[71];let fe;e[72]!==n?(fe=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=fe):fe=e[73];let ae;e[74]!==ue||e[75]!==fe?(ae=r.jsxs("p",{className:"text-xs text-muted-foreground",children:[ue," ",fe]}),e[74]=ue,e[75]=fe,e[76]=ae):ae=e[76],e[77]!==S||e[78]!==te||e[79]!==ae?(N=r.jsxs("button",{type:"button",onClick:se,onDragOver:v,onDragLeave:_,onDrop:S,className:te,children:[le,ae]}),e[77]=S,e[78]=te,e[79]=ae,e[80]=N):N=e[80],T="min-h-0 flex-1 overflow-y-auto pr-1",C=M.length===0?F?r.jsx(Rb,{title:n("filePicker.filePickerDialog.noMatches",{query:F}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):r.jsx(Rb,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):r.jsx("div",{ref:w,className:"flex items-start gap-3",children:O.map((de,X)=>r.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:de.map(pe=>r.jsx(aoe,{item:pe,onDelete:()=>m(pe)},pe.key))},X))}),e[12]=s.name,e[13]=l,e[14]=w,e[15]=k,e[16]=x,e[17]=u,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=S,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=N,e[27]=T,e[28]=C,e[29]=V,e[30]=A}else j=e[25],N=e[26],T=e[27],C=e[28],V=e[29],A=e[30];let E;e[81]!==c||e[82]!==n?(E=c.hasNextPage&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?r.jsxs(r.Fragment,{children:[r.jsx(lt,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=E):E=e[83];let D;e[84]!==E||e[85]!==T||e[86]!==C?(D=r.jsxs("div",{className:T,children:[C,E]}),e[84]=E,e[85]=T,e[86]=C,e[87]=D):D=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let R;e[89]!==s.id||e[90]!==f?(R=r.jsx(uoe,{configId:s.id,item:f,onClose:I}),e[89]=s.id,e[90]=f,e[91]=R):R=e[91];let $;return e[92]!==j||e[93]!==N||e[94]!==D||e[95]!==R||e[96]!==V||e[97]!==A?($=r.jsxs("div",{className:V,children:[A,j,N,D,R]}),e[92]=j,e[93]=N,e[94]=D,e[95]=R,e[96]=V,e[97]=A,e[98]=$):$=e[98],$}function loe(t){return t.items}function Rb(t){const e=z.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:r.jsx(_i,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let o;e[1]!==s?(o=r.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=o):o=e[2];let l;e[3]!==n?(l=r.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=r.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function aoe(t){const e=z.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=WS(s.key),e[0]=s.key,e[1]=i):i=e[1];const o=i;let l;e[2]!==s.key?(l=P3(s.key),e[2]=s.key,e[3]=l):l=e[3];const a=l;let c;e[4]!==a||e[5]!==s.key||e[6]!==s.publicUrl?(c=a?r.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:coe}):r.jsx("div",{className:"flex aspect-square items-center justify-center",children:r.jsx(yi,{size:28,className:"text-muted-foreground"})}),e[4]=a,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=r.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const u=s.key;let h;e[12]!==s.key?(h=ef(s.key),e[12]=s.key,e[13]=h):h=e[13];let f;e[14]!==s.key||e[15]!==h?(f=r.jsx("p",{className:"truncate text-xs font-medium",title:u,children:h}),e[14]=s.key,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=qS(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==o||e[20]!==m?(p=r.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[o," · ",m]}),e[19]=o,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=r.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=r.jsx(doe,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=r.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let v;return e[31]!==b||e[32]!==d?(v=r.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=v):v=e[33],v}function coe(t){t.target.style.display="none"}function doe(t){const e=z.c(36),{item:s,onDelete:n}=t,i=re(),[o,l]=P.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{ge.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(F2,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=r.jsx(Zt,{asChild:!0,children:r.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==o?(f=o?r.jsx(qt,{size:14}):r.jsx(dn,{size:14}),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==o||e[11]!==i?(m=i(o?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=o,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=r.jsxs(Xe,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(xn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let v;e[20]!==s.publicUrl||e[21]!==b?(v=r.jsx(Xe,{asChild:!0,children:r.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=v):v=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=r.jsx(rn,{size:14}),e[23]=L):L=e[23];let _;e[24]!==i?(_=i("assets.browser.deleteAction"),e[24]=i,e[25]=_):_=e[25];let y;e[26]!==n||e[27]!==_?(y=r.jsxs(Xe,{variant:"destructive",onClick:n,children:[L,_]}),e[26]=n,e[27]=_,e[28]=y):y=e[28];let S;e[29]!==v||e[30]!==y||e[31]!==p?(S=r.jsxs(es,{align:"end",children:[p,v,y]}),e[29]=v,e[30]=y,e[31]=p,e[32]=S):S=e[32];let k;return e[33]!==S||e[34]!==h?(k=r.jsxs(Xt,{children:[h,S]}),e[33]=S,e[34]=h,e[35]=k):k=e[35],k}function uoe(t){const e=z.c(47),{configId:s,item:n,onClose:i}=t,o=re(),l=wte();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==o?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),ge.success(o("assets.browser.deleted")),i()}catch{ge.error(o("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=o,e[5]=a):a=e[5];const c=a,d=!!n;let u;e[6]!==i?(u=C=>!C&&i(),e[6]=i,e[7]=u):u=e[7];let h;e[8]!==o?(h=o("assets.browser.deleteConfirmTitle"),e[8]=o,e[9]=h):h=e[9];let f;e[10]!==h?(f=r.jsx(Po,{children:h}),e[10]=h,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==o?(m=o("assets.browser.deleteConfirmDescription",{name:n?ef(n.key):""}),e[12]=n,e[13]=o,e[14]=m):m=e[14];let p;e[15]!==m?(p=r.jsx(Eo,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=r.jsxs(Ao,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==o?(b=o("assets.browser.deleteCancel"),e[20]=o,e[21]=b):b=e[21];let v;e[22]!==l.isPending||e[23]!==b?(v=r.jsx(Ro,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=v):v=e[24];let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=ie(Ny({variant:"destructive"})),e[25]=L):L=e[25];const _=l.isPending;let y;e[26]!==c?(y=C=>{C.preventDefault(),c()},e[26]=c,e[27]=y):y=e[27];let S;e[28]!==l.isPending?(S=l.isPending?r.jsx(lt,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=S):S=e[29];let k;e[30]!==o?(k=o("assets.browser.deleteConfirm"),e[30]=o,e[31]=k):k=e[31];let w;e[32]!==l.isPending||e[33]!==y||e[34]!==S||e[35]!==k?(w=r.jsxs(Io,{className:L,disabled:_,onClick:y,children:[S,k]}),e[32]=l.isPending,e[33]=y,e[34]=S,e[35]=k,e[36]=w):w=e[36];let j;e[37]!==v||e[38]!==w?(j=r.jsxs(Do,{children:[v,w]}),e[37]=v,e[38]=w,e[39]=j):j=e[39];let N;e[40]!==j||e[41]!==g?(N=r.jsxs(Vo,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=N):N=e[42];let T;return e[43]!==N||e[44]!==d||e[45]!==u?(T=r.jsx(To,{open:d,onOpenChange:u,children:N}),e[43]=N,e[44]=d,e[45]=u,e[46]=T):T=e[46],T}const D1={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:Ml},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Ar},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:t6}},hoe=["fast","smart","thinking"];function foe(t){const e=z.c(19),{tier:s,onSelect:n}=t,i=re(),[o,l]=P.useState(!1),a=D1[s].icon;let c;e[0]!==a?(c=r.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=D1[s];let u;e[2]!==i||e[3]!==d.labelKey?(u=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=u):u=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx(_s,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=r.jsx(ms,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,u,h]})}),e[6]=c,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=hoe.map(x=>{const b=D1[x],v=b.icon;return r.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ie("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[r.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"text-sm",children:i(b.labelKey)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&r.jsx(qt,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=r.jsx(bs,{align:"start",className:"p-1 w-64",children:r.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==o||e[16]!==f||e[17]!==p?(g=r.jsxs(vs,{open:o,onOpenChange:l,children:[f,p]}),e[15]=o,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function moe(t){const e=z.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:o}=t,l=re(),[a,c]=P.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=u):u=e[3];let h;e[4]!==o||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?r.jsx(P.Suspense,{fallback:r.jsx(he,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:r.jsx(poe,{override:i,onOverrideChange:o})}):r.jsx(foe,{tier:s,onSelect:n}),e[4]=o,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=h):h=e[10];let f;e[11]!==o?(f=v=>{c(v),v||o(null)},e[11]=o,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=r.jsx(Mr,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=r.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==h||e[22]!==g?(x=r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h,g]}),e[21]=h,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==u||e[25]!==x?(b=r.jsxs("div",{className:"flex flex-col gap-2",children:[u,x]}),e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function poe(t){const e=z.c(25),{override:s,onOverrideChange:n}=t,i=re(),o=If(),l=o[0]?.id??null;let a;e[0]!==l||e[1]!==o||e[2]!==s?.credentialId?(a=o.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=o,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=P.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==o?(u=o.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=o,e[7]=u):u=e[7];const h=u;let f;e[8]!==o||e[9]!==s?(f=s&&o.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=o,e[9]=s,e[10]=f):f=e[10];const m=f;if(o.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let v;return e[13]!==b?(v=r.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}let p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==h||e[18]!==n?(g=b=>{const v=b.keyId??h??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=h,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==h||e[21]!==m||e[22]!==p||e[23]!==g?(x=r.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:r.jsx(DV,{variant:"bordered",placeholder:p,model:m,credentialId:h,onCredentialChange:d,onModelChange:g})}),e[20]=h,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const Ak=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:g2,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:Mn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:_i},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:ri},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Eu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:No,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:Tf},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:p2},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:a2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:gu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:No},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:mV}]},{key:"context",headingKey:"automations.automationConfig.context",icon:jc,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:jc},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:kc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:kc}]},{key:"browser",headingKey:"automations.automationConfig.browser",icon:Rr,tools:[{name:"take_screenshot",titleKey:"automations.automationConfig.toolTakeScreenshot",descriptionKey:"automations.automationConfig.toolTakeScreenshotDesc",icon:R6},{name:"scrape_url",titleKey:"automations.automationConfig.toolScrapeUrl",descriptionKey:"automations.automationConfig.toolScrapeUrlDesc",icon:Rr},{name:"inspect_page",titleKey:"automations.automationConfig.toolInspectPage",descriptionKey:"automations.automationConfig.toolInspectPageDesc",icon:qo}]}],goe=Ak.flatMap(t=>t.tools.map(e=>e.name));function xoe(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function boe(t){const e=z.c(12),{agentId:s,value:n,onChange:i}=t,o=re();let l;e[0]!==o?(l=o("automations.automationConfig.toolsLabel"),e[0]=o,e[1]=l):l=e[1];let a;e[2]!==l?(a=r.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==o||e[7]!==n?(c=s?r.jsx(P.Suspense,{fallback:r.jsxs(he,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[r.jsx(g2,{size:14}),o("automations.automationConfig.loadingTools")]}),children:r.jsx(voe,{agentId:s,value:n,onChange:i})}):r.jsx("span",{className:"text-xs text-muted-foreground italic",children:o("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=o,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==a||e[10]!==c?(d=r.jsxs("div",{className:"flex flex-col gap-2",children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Ib(t){const e=z.c(17),{value:s,checked:n,onToggle:i,title:o,description:l,leading:a}=t;let c;e[0]!==n?(c=r.jsx(Gc,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&r.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==o?(u=r.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&r.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]!==u||e[9]!==h?(f=r.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[u,h]}),e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=r.jsxs(Cs,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function Mb(t){const e=z.c(27),{conn:s,label:n,icon:i,on:o,total:l,onToggle:a}=t,c=re(),d=o===l;let u;e[0]!==i||e[1]!==s?(u=s?r.jsx(Ai,{icon:s.icon,name:s.title,size:"2xs"}):i?r.jsx(i,{size:14,className:"text-muted-foreground"}):r.jsx(WA,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=u):u=e[2];let h;e[3]!==s?.title||e[4]!==n||e[5]!==c?(h=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=h):h=e[6];let f;e[7]!==h?(f=r.jsx("span",{className:"truncate",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==l?(m=r.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",l]}),e[9]=o,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=L=>{L.stopPropagation(),a()},e[12]=a,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=r.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==u||e[24]!==f||e[25]!==b?(v=r.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function voe(t){const e=z.c(83),{agentId:s,value:n,onChange:i}=t,o=re(),{org:l}=Fe(),[a,c]=P.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const u=Gt(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=P2(h),p=ci();let g,x,b,v,L,_,y,S,k,w,j,N,T;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==o||e[12]!==n){const D=new Map(p.map(Soe)),I=new Map;for(const fe of f?.tools??[]){const ae=er(fe._meta)??"__other__",de=Bc(fe.name,ae==="__other__"?void 0:ae),X=fe.title,pe=X&&X!==fe.name?X:xoe(de);I.has(ae)||I.set(ae,{clientId:ae,conn:D.get(ae),tools:[]}),I.get(ae).tools.push({name:fe.name,display:pe,description:fe.description})}const R=[...I.values()].sort(woe),$=(f?.tools??[]).map(Loe),B=[...goe,...$],M=n===null?new Set(B):new Set(n),O=B.every(fe=>M.has(fe)),F=fe=>i(B.every(ae=>fe.has(ae))?null:[...fe]),U=fe=>{const ae=new Set(M);ae.has(fe)?ae.delete(fe):ae.add(fe),F(ae)},K=(fe,ae)=>{const de=new Set(M);for(const X of fe)ae?de.add(X):de.delete(X);F(de)};v=vs,T=a,L=c;let q;e[26]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx(g2,{size:14,className:"text-muted-foreground"}),e[26]=q):q=e[26];let W;e[27]!==O||e[28]!==o?(W=o(O?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=O,e[28]=o,e[29]=W):W=e[29];const G=!O&&r.jsxs(lP,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",B.length]});let Y;e[30]===Symbol.for("react.memo_cache_sentinel")?(Y=r.jsx(_s,{size:14,className:"text-muted-foreground"}),e[30]=Y):Y=e[30],e[31]!==W||e[32]!==G?(_=r.jsx(ms,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[q,W,G,Y]})}),e[31]=W,e[32]=G,e[33]=_):_=e[33],b=bs,j="p-0 w-80",N="start",x=hr;let ee;e[34]!==o?(ee=o("automations.automationConfig.searchToolsPlaceholder"),e[34]=o,e[35]=ee):ee=e[35],e[36]!==ee?(k=r.jsx(Pi,{placeholder:ee}),e[36]=ee,e[37]=k):k=e[37];const ne=O?o("automations.automationConfig.allToolsEnabled",{count:B.length}):o("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:B.length});let oe;e[38]!==ne?(oe=r.jsx("span",{className:"text-xs text-muted-foreground",children:ne}),e[38]=ne,e[39]=oe):oe=e[39];let Z;e[40]!==i?(Z=()=>i(null),e[40]=i,e[41]=Z):Z=e[41];let J;e[42]!==o?(J=o("automations.automationConfig.selectAll"),e[42]=o,e[43]=J):J=e[43];let H;e[44]!==O||e[45]!==Z||e[46]!==J?(H=r.jsx("button",{type:"button",onClick:Z,disabled:O,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:J}),e[44]=O,e[45]=Z,e[46]=J,e[47]=H):H=e[47];let se;e[48]===Symbol.for("react.memo_cache_sentinel")?(se=r.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=se):se=e[48];let Q;e[49]!==i?(Q=()=>i([]),e[49]=i,e[50]=Q):Q=e[50];const ce=M.size===0;let te;e[51]!==o?(te=o("automations.automationConfig.clear"),e[51]=o,e[52]=te):te=e[52];let le;e[53]!==Q||e[54]!==ce||e[55]!==te?(le=r.jsx("button",{type:"button",onClick:Q,disabled:ce,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:te}),e[53]=Q,e[54]=ce,e[55]=te,e[56]=le):le=e[56];let ue;e[57]!==H||e[58]!==le?(ue=r.jsxs("div",{className:"flex items-center gap-2",children:[H,se,le]}),e[57]=H,e[58]=le,e[59]=ue):ue=e[59],e[60]!==oe||e[61]!==ue?(w=r.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[oe,ue]}),e[60]=oe,e[61]=ue,e[62]=w):w=e[62],g=Ei,y="max-h-80",S=m?r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o("automations.automationConfig.loadingTools")}):r.jsxs(r.Fragment,{children:[r.jsx(di,{children:o("automations.automationConfig.noToolsFound")}),Ak.map(fe=>{const ae=fe.tools.map(_oe),de=ae.filter(X=>M.has(X)).length;return r.jsx(qs,{heading:r.jsx(Mb,{label:o(fe.headingKey),icon:fe.icon,on:de,total:ae.length,onToggle:()=>K(ae,de!==ae.length)}),children:fe.tools.map(X=>r.jsx(Ib,{value:`${o(X.titleKey)} ${X.name}`,checked:M.has(X.name),onToggle:()=>U(X.name),title:o(X.titleKey),description:o(X.descriptionKey),leading:r.jsx(X.icon,{size:16,className:"text-muted-foreground"})},X.name))},fe.key)}),R.map(fe=>{const ae=fe.tools.map(yoe),de=ae.filter(X=>M.has(X)).length;return r.jsx(qs,{heading:r.jsx(Mb,{conn:fe.conn,on:de,total:ae.length,onToggle:()=>K(ae,de!==ae.length)}),children:fe.tools.map(X=>r.jsx(Ib,{value:`${X.display} ${X.name} ${fe.conn?.title??""}`,checked:M.has(X.name),onToggle:()=>U(X.name),title:X.display,description:X.description},X.name))},fe.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=o,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=L,e[18]=_,e[19]=y,e[20]=S,e[21]=k,e[22]=w,e[23]=j,e[24]=N,e[25]=T}else g=e[13],x=e[14],b=e[15],v=e[16],L=e[17],_=e[18],y=e[19],S=e[20],k=e[21],w=e[22],j=e[23],N=e[24],T=e[25];let C;e[63]!==g||e[64]!==y||e[65]!==S?(C=r.jsx(g,{className:y,children:S}),e[63]=g,e[64]=y,e[65]=S,e[66]=C):C=e[66];let V;e[67]!==x||e[68]!==C||e[69]!==k||e[70]!==w?(V=r.jsxs(x,{children:[k,w,C]}),e[67]=x,e[68]=C,e[69]=k,e[70]=w,e[71]=V):V=e[71];let A;e[72]!==b||e[73]!==V||e[74]!==j||e[75]!==N?(A=r.jsx(b,{className:j,align:N,children:V}),e[72]=b,e[73]=V,e[74]=j,e[75]=N,e[76]=A):A=e[76];let E;return e[77]!==v||e[78]!==L||e[79]!==_||e[80]!==A||e[81]!==T?(E=r.jsxs(v,{open:T,onOpenChange:L,children:[_,A]}),e[77]=v,e[78]=L,e[79]=_,e[80]=A,e[81]=T,e[82]=E):E=e[82],E}function yoe(t){return t.name}function _oe(t){return t.name}function Loe(t){return t.name}function woe(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function Soe(t){return[t.id,t]}function ou(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function koe(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(i){const a=parseInt(i[1]??"1");return a%7===0?`Every ${a/7} weeks`:`Every ${a} days`}const o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const a=(o[2]??"0").padStart(2,"0"),c=(o[1]??"0").padStart(2,"0");return`Every day at ${a}:${c} UTC`}const l=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(l){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(l[3]??"0")]??"day",d=(l[2]??"0").padStart(2,"0"),u=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${u} UTC`}return t}function joe(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function Coe(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return i?{count:parseInt(i[1]),unit:"days"}:null}function Noe(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Toe=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Voe({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:o}){const l=re(),{triggerAdd:a}=zu(),[c,d]=P.useState(!1),u=e??c,h=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),ge.success(l("automations.addStarterPopover.starterAdded")),h(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");ge.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});h(!1),p.webhook?o?.(p.webhook):ge.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");ge.error(g)}};return r.jsxs(Xt,{open:u,onOpenChange:h,children:[r.jsx(Zt,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"sm",children:[r.jsx(Ht,{size:14}),l("automations.addStarterPopover.addStarter")]})}),r.jsxs(es,{align:"end",className:"w-[200px]",children:[r.jsxs(Yi,{children:[r.jsxs(Ji,{className:"gap-2.5",children:[r.jsx(Gd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),r.jsx(Qi,{className:"w-[160px]",children:Toe.map(p=>r.jsxs(Xe,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[r.jsx(Gd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),r.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[r.jsx(Gd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),r.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[r.jsx(wi,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),r.jsxs(Xe,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[r.jsx(Mn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Pk(t){const e=z.c(39),{open:s,onOpenChange:n,url:i,token:o,title:l,description:a}=t,c=l===void 0?"Webhook ready":l,d=a===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":a,u=re(),[h,f]=P.useState(null),[m,p]=P.useState("curl"),[g,x]=P.useState("header"),b=P.useId();let v;e[0]!==u?(v=async(R,$)=>{try{await navigator.clipboard.writeText(R),f($),ge.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ge.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=v):v=e[1];const L=v;let _;e[2]!==g||e[3]!==o||e[4]!==i?(_=i&&o&&g==="url"?`${i.replace(/\/$/,"")}/${o}`:i??"",e[2]=g,e[3]=o,e[4]=i,e[5]=_):_=e[5];const y=_,S=i&&o?g==="header"?`curl -X POST "${y}" \\
|
|
545
545
|
-H "Authorization: Bearer ${o}" \\
|
|
546
546
|
-H "Content-Type: application/json" \\
|
|
547
547
|
-d '{"hello":"world"}'`:`curl -X POST "${y}" \\
|
|
@@ -722,7 +722,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
722
722
|
<p class="cta">slides-create --theme …</p>
|
|
723
723
|
</section>`].join(`
|
|
724
724
|
|
|
725
|
-
`);function Ale(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Vle).replaceAll("{{title}}",Tle).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function Ple(t){const e=z.c(8),{readUrl:s,title:n,tokensUrl:i}=t,o=Ll(s),l=Ll(i??"");if(o.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(bt,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(o.isError||!o.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=u):u=e[1],u}const a=l.data??null;let c;e[2]!==a||e[3]!==o.data?(c=Ale(o.data,a),e[2]=a,e[3]=o.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=r.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function zd(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ele(t){const e=z.c(16),{family:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;let a;e[0]!==s?(a=r.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==o){let h;e[7]!==i||e[8]!==l||e[9]!==o?(h=f=>{const m=o(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?r.jsx("input",{type:"color","aria-label":f.name,title:p,value:GV(m),onChange:g=>l(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):r.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=i,e[8]=l,e[9]=o,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let u;return e[13]!==a||e[14]!==d?(u=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Dle(t){const e=z.c(9),{token:s,value:n}=t;if(s.kind==="space"){let o;return e[0]!==n?(o=r.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:r.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="radius"){let o;return e[2]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=o):o=e[3],o}if(s.kind==="shadow"){let o;return e[4]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=o):o=e[5],o}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const o=`min(${n}, 22px)`;let l;return e[6]!==o?(l=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:o},children:"Ag"}),e[6]=o,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function zk(t){const e=z.c(17),{token:s,value:n,editing:i,onEdit:o}=t;let l;e[0]!==s||e[1]!==n?(l=r.jsx(Dle,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=/^--brand-/,e[5]=h):h=e[5],a=s.name.replace(h,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==o||e[10]!==s.name||e[11]!==n?(d=i?r.jsx(gt,{value:n,onChange:h=>o(s.name,h.target.value),className:"h-8 w-40 font-mono text-xs"}):r.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=o,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let u;return e[13]!==l||e[14]!==c||e[15]!==d?(u=r.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],u}function Sd(t){const e=z.c(16),{label:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=r.jsx(zd,{children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==o){let h;e[7]!==i||e[8]!==l||e[9]!==o?(h=f=>r.jsx(zk,{token:f,value:o(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=o,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let u;return e[13]!==a||e[14]!==d?(u=r.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Rle({brandPath:t,onClose:e,variant:s}){const n=re(),{org:i}=Fe(),o=vf(t),l=o.volume??"",a=o.dirPath,c=is(a),d=o.readOnly,u=as(),h=Wc(),f=N6(l),{upload:m,remove:p}=pu(l),g=P.useRef(null),x=T2(l,a),b=x.data??[],v=X=>b.some(pe=>pe.kind==="file"&&is(pe.path)===X),L=v("tokens.css"),_=v("brand.md"),y=v("slides-theme.html"),S=HV(b),k=h(l,`${a}/tokens.css`),w=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),N=Ll(k,{enabled:L}),T=Ll(w,{enabled:_}),[C,V]=P.useState(!1),[A,E]=P.useState({}),[D,I]=P.useState(null),[R,$]=P.useState(!1),[B,M]=P.useState(!1),[O,F]=P.useState("deck"),U=N.data?KV(N.data):[],K=X=>U.find(pe=>pe.name===X)?.value,q=X=>A[X.name]??X.value,W=WV(U),G=U.filter(X=>X.kind==="font"),Y=U.filter(X=>X.kind==="type"),ee=U.filter(X=>X.kind==="space"),ne=U.filter(X=>X.kind==="radius"),oe=U.filter(X=>X.kind==="shadow"),Z=U.filter(X=>X.kind==="motion"),J=U.filter(X=>X.kind==="other"),H=(X,pe)=>E(ye=>({...ye,[X]:pe})),se=y&&O==="deck",Q=D??T.data??"",ce=Object.entries(A).filter(([X,pe])=>K(X)!==pe),te=D!==null&&D!==(T.data??""),le=ce.length>0||te;function ue(){E({}),I(null),V(!1)}async function fe(){$(!0);try{if(ce.length>0){let X=N.data??"";for(const[pe,ye]of ce)X=qV(X,pe,ye);await f.mutateAsync({path:`${a}/tokens.css`,body:X,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:Qe.fileText(k)})}te&&D!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:D,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:Qe.fileText(w)})),u.invalidateQueries({queryKey:Qe.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:Qe.orgFsRecent(i.id)}),E({}),I(null),V(!1),ge.success(n("library.brandPreview.brandSaved"))}catch(X){ge.error(X instanceof Error?X.message:n("library.brandPreview.failedSaveBrand"))}finally{$(!1)}}async function ae(X){const pe=X?.[0];if(!pe)return;const we=`logo.${(pe.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([pe],we,{type:pe.type})]}),S&&is(S)!==we&&await p.mutateAsync(S),ge.success(n("library.brandPreview.logoUpdated"))}catch(_e){ge.error(_e instanceof Error?_e.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const de=!x.isPending&&!L&&!_&&!S;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(hm,{size:18})}),s==="dialog"?r.jsx(Kt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(C?r.jsxs(r.Fragment,{children:[r.jsx(he,{variant:"ghost",size:"sm",onClick:ue,disabled:R,children:n("library.brandPreview.cancel")}),r.jsx(he,{size:"sm",disabled:!le||R,onClick:()=>{fe()},children:n(R?"library.brandPreview.saving":"library.brandPreview.save")})]}):r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[r.jsx(gV,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?r.jsx(Fy,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(Is,{size:16})})}):r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:r.jsx(Is,{size:16})})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?r.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[r.jsx(bt,{className:"h-40 w-full rounded-xl"}),r.jsx(bt,{className:"h-4 w-1/3"}),r.jsx(bt,{className:"h-4 w-2/3"})]}):de?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):r.jsxs(r.Fragment,{children:[(y||L)&&r.jsxs("div",{className:"shrink-0 border-b border-border",children:[r.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(B?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(X=>!X),onKeyDown:X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),M(pe=>!pe))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:X=>X.stopPropagation(),children:[y&&r.jsx("button",{type:"button",onClick:()=>{F("deck"),M(!1)},className:ie("rounded-md px-2.5 py-1",se?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),r.jsx("button",{type:"button",onClick:()=>{F("components"),M(!1)},className:ie("rounded-md px-2.5 py-1",se?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),B?r.jsx(_s,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(a8,{size:16,className:"shrink-0 text-muted-foreground"})]}),!B&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",se?"aspect-[16/9]":"h-96"),children:se?r.jsx(Ple,{readUrl:j,title:`${c} deck theme`,tokensUrl:k}):r.jsx(Nle,{tokensUrl:k})})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(zd,{children:n("library.brandPreview.logo")}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:S?r.jsx("img",{src:h(l,S),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(hm,{size:28,className:"text-muted-foreground/50"})}),C&&r.jsxs("div",{children:[r.jsxs(he,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[r.jsx(Yn,{size:14}),n(S?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),r.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:X=>{ae(X.target.files)}})]})]})]}),W.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(zd,{children:n("library.brandPreview.colors")}),W.map(X=>r.jsx(Ele,{family:X.family,tokens:X.tokens,editing:C,valueOf:q,onEdit:H},X.family))]}),(G.length>0||Y.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(zd,{children:n("library.brandPreview.typography")}),G.map(X=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:X.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),C?r.jsx(gt,{value:q(X),onChange:pe=>H(X.name,pe.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:q(X)},children:q(X)})]},X.name)),Y.map(X=>r.jsx(zk,{token:X,value:q(X),editing:C,onEdit:H},X.name))]}),r.jsx(Sd,{label:n("library.brandPreview.spacing"),tokens:ee,editing:C,valueOf:q,onEdit:H}),r.jsx(Sd,{label:n("library.brandPreview.radius"),tokens:ne,editing:C,valueOf:q,onEdit:H}),r.jsx(Sd,{label:n("library.brandPreview.shadows"),tokens:oe,editing:C,valueOf:q,onEdit:H}),r.jsx(Sd,{label:n("library.brandPreview.motion"),tokens:Z,editing:C,valueOf:q,onEdit:H}),r.jsx(Sd,{label:n("library.brandPreview.tokens"),tokens:J,editing:C,valueOf:q,onEdit:H}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(zd,{children:n("library.brandPreview.voiceGuidelines")}),C?r.jsx(Ir,{value:Q,onChange:X=>I(X.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):T.isPending&&_?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(bt,{className:"h-3 w-full"}),r.jsx(bt,{className:"h-3 w-5/6"})]}):Q.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(Fo,{id:`brand-preview-${t}`,text:Q})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Fk(t){const e=z.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==s||e[3]!==n?(o=r.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:r.jsx(Rle,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(zt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function Uk(t){const e=z.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,o=i===void 0?!1:i;let l;e[0]!==n?(l=d=>{d||n()},e[0]=n,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==s||e[4]!==o?(a=r.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(Bk,{previewPath:s,onClose:n,showSeeInLibrary:o,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=r.jsx(zt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function Ile(t){const e=z.c(18),{skillPath:s,onClose:n,variant:i}=t,o=vf(s),{volume:l,dirPath:a}=o,c=Wc(),d=c(l??"",`${a}/SKILL.md`),u=Ll(d),h=T2(l??"",a);let f;e[0]!==a?(f=is(a),e[0]=a,e[1]=f):f=e[1];const m=f;let p;e[2]!==u.data?(p=u.data?YV(u.data):null,e[2]=u.data,e[3]=p):p=e[3];const g=p,x=$le;let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=(E,D)=>x(E.path)?-1:x(D.path)?1:is(E.path).localeCompare(is(D.path)),e[4]=b):b=e[4];const v=(h.data??[]).filter(Mle).sort(b),[L,_]=P.useState(null),y=L===null?null:v.find(E=>E.path===L)??null,S=g?.name??m;let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(wi,{size:18})}),e[5]=k):k=e[5];let w;e[6]!==S||e[7]!==i?(w=i==="dialog"?r.jsx(Kt,{className:"flex-1 truncate text-base font-medium text-foreground",children:S}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:S}),e[6]=S,e[7]=i,e[8]=w):w=e[8];let j;e[9]!==n||e[10]!==i?(j=i==="dialog"?r.jsx(Fy,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(Is,{size:16})})}):r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:n,children:r.jsx(Is,{size:16})}),e[9]=n,e[10]=i,e[11]=j):j=e[11];let N;e[12]!==w||e[13]!==j?(N=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[k,w,j]}),e[12]=w,e[13]=j,e[14]=N):N=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[15]=T):T=e[15];const C="relative flex min-w-0 flex-1 flex-col overflow-y-auto",V=y?r.jsx(H3,{file:{key:y.path,filename:is(y.path),size:y.size,downloadUrl:c(l??"",y.path)}}):u.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(bt,{className:"h-4 w-1/3"}),r.jsx(bt,{className:"h-3 w-full"}),r.jsx(bt,{className:"h-3 w-5/6"}),r.jsx(bt,{className:"h-3 w-2/3"})]}):u.isError||!g?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-4 border-b border-border p-6",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Description"}),r.jsx("p",{className:"text-base text-muted-foreground",children:g.description??"Claude Code skill"})]}),r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none p-6",children:r.jsx(Fo,{id:`skill-preview-${s}`,text:g.body})})]});let A;return e[16]!==V?(A=r.jsx("div",{className:C,children:V}),e[16]=V,e[17]=A):A=e[17],r.jsxs(r.Fragment,{children:[N,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"flex w-[220px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted p-3",children:[T,h.isPending?r.jsx(bt,{className:"mx-2 h-4 w-24"}):v.map(E=>{const D=x(E.path)?y===null:L===E.path;return r.jsxs("button",{type:"button",onClick:()=>_(x(E.path)?null:E.path),className:ie("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",D?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(lr,{filename:is(E.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:ie("truncate text-sm",D?"text-foreground":"text-muted-foreground"),children:is(E.path)})]},E.path)})]}),A]})]})}function Mle(t){return t.kind==="file"}function $le(t){return is(t)==="SKILL.md"}function Hk(t){const e=z.c(8),{skillPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==n||e[3]!==s?(o=r.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",closeButtonClassName:"hidden",children:r.jsx(Ile,{skillPath:s,onClose:n,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(zt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function Ole(t){const e=z.c(11),{onOpenDir:s}=t,n=re(),i=pP();let o;e[0]!==i.data?(o=i.data??[],e[0]=i.data,e[1]=o):o=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==o){let c;e[6]!==s||e[7]!==n?(c=d=>r.jsx(Ru,{name:d.volume,glyph:Jn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:T6(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],l=o.map(c),e[2]=s,e[3]=n,e[4]=o,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=r.jsx(r.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function K3(t){return`${window.location.origin}${t}`}function lu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Ble=[hu,"uploads","outputs"],Kk=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Yn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Ar}],Zm=new Set([...Kk.map(t=>t.volume),Lc("public")]),zle=6;function Wk(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=Ay(t),o=i?`public/${i}`:t==="home"?fu(s):t;return n?`${o}/${n}`:o}function Y0(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const i=n.dataTransfer.getData("application/x-studio-library-path");i&&i!==t&&!t.startsWith(i+"/")&&s.onDrop(i,t)}:void 0}}function po(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Nr(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"@container",children:r.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function N9(t){const e=z.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=r.jsx(Nr,{children:Array.from({length:n*3},Fle)}),e[0]=n,e[1]=i):i=e[1],i}function Fle(t,e){return r.jsx(bt,{className:"h-16 rounded-2xl"},e)}function W3(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ule(t){const e=z.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:o}=t,l=re(),a=ZV(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==o||e[8]!==c||e[9]!==d||e[10]!==s?(u=r.jsx(Ru,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:o}),e[6]=i,e[7]=o,e[8]=c,e[9]=d,e[10]=s,e[11]=u):u=e[11],u}function Hle(t){const e=z.c(12),{onOpenDir:s}=t,n=re(),o=V6().data?.length??0;let l;e[0]!==s?(l=Kk.map(u=>r.jsx(Ule,{volume:u.volume,descriptionKey:u.descriptionKey,glyph:u.glyph,onOpen:()=>s(u.volume)},u.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o||e[4]!==n?(a=o>0&&r.jsx(Ru,{name:Lc("public"),meta:n("library.libraryViews.skillSetsCount",{count:o}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:wi,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=o,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==s?(c=r.jsx(Ole,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=r.jsxs(r.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Kle(t){const e=z.c(19),{segments:s,onNavigate:n}=t,{org:i}=Fe();let o;e[0]!==s?(o=s[0]===hu?s.slice(1):s,e[0]=s,e[1]=o):o=e[1];const l=o,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?r.jsx("span",{className:"truncate font-medium text-foreground",children:fu(i.slug)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(hu),children:fu(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let u;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let f;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(nn,{size:12,className:"shrink-0 text-muted-foreground"}),x?r.jsx("span",{className:"truncate font-medium text-foreground",children:Lc(m)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Lc(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],u=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=u}else u=e[10];let h;return e[16]!==d||e[17]!==u?(h=r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function Wle(t){const e=z.c(43),{query:s,scope:n,stale:i,onOpenFile:o,onShare:l,onDelete:a}=t,c=re(),{org:d}=Fe(),u=Wc(),h=JV(s,n);let f;e[0]!==u||e[1]!==l?(f=k=>l({volume:k.volume,path:k.path,kind:"file",shareMode:k.shareMode??"private",effectivePublic:k.effectivePublic??!1,url:K3(u(k.volume,k.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let k;return e[3]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(N9,{rows:2}),e[3]=k):k=e[3],k}let p,g,x,b,v;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=h.data??[],g.length===0){let w;e[14]!==s||e[15]!==c?(w=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=w):w=e[16];let j;e[17]!==w?(j=r.jsx(W3,{children:w}),e[17]=w,e[18]=j):j=e[18],v=j;break e}const k=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==k?(b=ie("flex flex-col gap-3",k),e[19]=k,e[20]=b):b=e[20],p=po,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=h.data,e[6]=h.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let L;e[21]!==p||e[22]!==x?(L=r.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=L):L=e[23];let _;if(e[24]!==u||e[25]!==a||e[26]!==o||e[27]!==d||e[28]!==g||e[29]!==m){let k;e[31]!==u||e[32]!==a||e[33]!==o||e[34]!==d||e[35]!==m?(k=w=>{const j=Ay(w.volume)!==null;return r.jsx(A6,{filename:is(w.path),updatedAt:w.updatedAt,downloadUrl:u(w.volume,w.path),subtitle:Wk(w.volume,w.path,d.slug),publicState:lu(w),onOpen:()=>o(Py(w.volume,w.path)),onShare:j?void 0:()=>m(w),onDelete:j?void 0:()=>a({volume:w.volume,path:w.path,kind:"file"})},`${w.volume}/${w.path}`)},e[31]=u,e[32]=a,e[33]=o,e[34]=d,e[35]=m,e[36]=k):k=e[36],_=g.map(k),e[24]=u,e[25]=a,e[26]=o,e[27]=d,e[28]=g,e[29]=m,e[30]=_}else _=e[30];let y;e[37]!==_?(y=r.jsx(Nr,{children:_}),e[37]=_,e[38]=y):y=e[38];let S;return e[39]!==b||e[40]!==L||e[41]!==y?(S=r.jsxs("div",{className:b,children:[L,y]}),e[39]=b,e[40]=L,e[41]=y,e[42]=S):S=e[42],S}function qle(t){const e=z.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,o=re(),{org:l}=Fe(),a=C6(),c=Wc();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:K3(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let v;e[3]!==o?(v=o("library.libraryViews.recentlyAdded"),e[3]=o,e[4]=v):v=e[4];let L;e[5]!==v?(L=r.jsx(po,{children:v}),e[5]=v,e[6]=L):L=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(N9,{}),e[7]=_):_=e[7];let y;return e[8]!==L?(y=r.jsxs("div",{className:"flex flex-col gap-3",children:[L,_]}),e[8]=L,e[9]=y):y=e[9],y}let h,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==u||e[16]!==o){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,zle);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let L;e[22]!==o?(L=o("library.libraryViews.recentlyAdded"),e[22]=o,e[23]=L):L=e[23],e[24]!==L?(p=r.jsx(po,{children:L}),e[24]=L,e[25]=p):p=e[25],h=Nr;let _;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(_=y=>r.jsx(eA,{filename:is(y.path),updatedAt:y.updatedAt,size:y.size,downloadUrl:c(y.volume,y.path),subtitle:Wk(y.volume,y.path,l.slug),publicState:lu(y),onOpen:()=>s(Py(y.volume,y.path)),onShare:()=>u(y),onDelete:()=>i({volume:y.volume,path:y.path,kind:"file"})},`${y.volume}/${y.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,e[31]=_):_=e[31],f=v.map(_)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=u,e[16]=o,e[17]=h,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else h=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==h||e[33]!==f?(x=r.jsx(h,{children:f}),e[32]=h,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=r.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Gle(t){const e=z.c(16),{onOpenDir:s}=t,n=re(),i=V6();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(N9,{}),e[0]=d):d=e[0],d}let o;e[1]!==i.data?(o=i.data??[],e[1]=i.data,e[2]=o):o=e[2];const l=o;if(l.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let u;return e[5]!==d?(u=r.jsx(W3,{children:d}),e[5]=d,e[6]=u):u=e[6],u}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=u=>r.jsx(Ru,{name:u,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${u}`)},u),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=r.jsx(Nr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Yle(t){const e=z.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:o,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=re(),{org:m}=Fe(),p=s.volume??"",g=T2(p,s.dirPath),x=Wc();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=C=>s.isHomeRoot&&Zm.has(C.toLowerCase())?`${fu(m.slug)}/${C}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let L;e[3]!==s.isHomeRoot||e[4]!==n?(L=s.isHomeRoot?r.jsx(Hle,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=L):L=e[5];const _=L;if(g.isPending){let C;e[6]!==_||e[7]!==f?(C=_&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.folders")}),r.jsx(Nr,{children:_})]}),e[6]=_,e[7]=f,e[8]=C):C=e[8];let V;e[9]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(N9,{rows:2}),e[9]=V):V=e[9];let A;return e[10]!==C?(A=r.jsxs(r.Fragment,{children:[C,V]}),e[10]=C,e[11]=A):A=e[11],A}if(g.isError){let C;e[12]!==g.error||e[13]!==f?(C=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=C):C=e[14];let V;return e[15]!==C?(V=r.jsx("p",{className:"text-sm text-destructive",children:C}),e[15]=C,e[16]=V):V=e[16],V}let y,S,k,w,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==h||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==o||e[29]!==a||e[30]!==_||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const C=g.data??[],V=C.filter(Zle),A=C.filter(Xle),E=C.filter(Qle),D=C.filter(Jle);if(C.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==f?(M=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=M):M=e[40];let O;e[41]!==M?(O=r.jsx(W3,{children:M}),e[41]=M,e[42]=O):O=e[42],j=O;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const R=I;let $;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?($=M=>s.readOnly?void 0:()=>a({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?K3(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=$):$=e[51];const B=$;y=V.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.skills")}),r.jsx(Nr,{children:V.map(M=>r.jsx(QV,{dirName:is(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:lu(M),onOpen:()=>o(Ja(s,M.path)),onBrowse:()=>n(Ja(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...Y0(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),S=A.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.brands")}),r.jsx(Nr,{children:A.map(M=>r.jsx(XV,{dirName:is(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>l(Ja(s,M.path)),onBrowse:()=>n(Ja(s,M.path)),onDelete:R(M),draggable:!s.readOnly,...Y0(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),k=(E.length>0||_)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.folders")}),r.jsxs(Nr,{children:[_,E.map(M=>r.jsx(Ru,{name:is(M.path),meta:T6(M.updatedAt),subtitle:v(is(M.path)),readOnly:s.readOnly,publicState:lu(M),onOpen:()=>n(Ja(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...Y0(M.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},M.path))]})]}),w=D.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.files")}),r.jsx(Nr,{children:D.map(M=>r.jsx(A6,{filename:is(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:lu(M),onOpen:()=>i(Ja(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...Y0(M.path,"file",{onDragStart:d,onContextMenu:u})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=u,e[22]=c,e[23]=d,e[24]=h,e[25]=l,e[26]=n,e[27]=i,e[28]=o,e[29]=a,e[30]=_,e[31]=f,e[32]=p,e[33]=y,e[34]=S,e[35]=k,e[36]=w,e[37]=j}else y=e[33],S=e[34],k=e[35],w=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let N;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(N=s.isHomeRoot&&r.jsx(qle,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=N):N=e[56];let T;return e[57]!==y||e[58]!==S||e[59]!==k||e[60]!==w||e[61]!==N?(T=r.jsxs(r.Fragment,{children:[y,S,k,w,N]}),e[57]=y,e[58]=S,e[59]=k,e[60]=w,e[61]=N,e[62]=T):T=e[62],T}function Jle(t){return t.kind==="file"}function Qle(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Xle(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Zle(t){return t.kind==="dir"&&t.hasSkill}function eae({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=re(),{org:i}=Fe(),o=as(),l=Yt(),a=zo(),c=ur({strict:!1}),d=c.path||hu,u=vf(d),h=gP(),f=u.volume!==null&&h.has(u.volume)?{...u,readOnly:!0}:u,m=(X,pe)=>l({to:".",search:ye=>({...ye,[X]:pe||void 0})}),p=X=>m("path",X),g=(X,pe)=>l({to:".",search:ye=>({...ye,preview:void 0,skill:void 0,brand:void 0,[X]:pe})}),x=t??(X=>g("preview",X)),b=e??(X=>g("skill",X)),v=s??(X=>g("brand",X)),[L,_]=P.useState(""),y=Kf(L.trim(),300),S=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,k=S?n("library.library.searchInPlaceholder",{folder:Lc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),w=f.isHomeRoot?fu(i.slug):Lc(f.segments.at(-1)??""),[j,N]=P.useState(null),[T,C]=P.useState(null),[V,A]=P.useState(!1),[E,D]=P.useState(""),[I,R]=P.useState(!1),[$,B]=P.useState(null),[M,O]=P.useState(""),F=P.useRef(null),[U,K]=P.useState(!1),q=P.useRef(0),W=f.readOnly?null:f.volume,{upload:G,mkdir:Y,move:ee}=pu(W??hu),{remove:ne}=pu(j?.volume??"uploads");async function oe(X){if(!(!W||!X||X.length===0))try{await G.mutateAsync({dir:f.dirPath,files:[...X]}),ge.success(X.length===1?n("library.library.uploadedSingle",{filename:X[0]?.name??""}):n("library.library.uploadedMultiple",{count:X.length}))}catch(pe){ge.error(pe instanceof Error?pe.message:n("library.library.uploadFailed"))}finally{F.current&&(F.current.value="")}}const Z=W!==null;function J(X){return X.dataTransfer.types.includes("Files")}function H(X){!Z||!J(X)||(X.preventDefault(),q.current+=1,K(!0))}function se(X){!Z||!J(X)||X.preventDefault()}function Q(){Z&&(q.current=Math.max(0,q.current-1),q.current===0&&K(!1))}function ce(X){Z&&(X.preventDefault(),X.stopPropagation(),q.current=0,K(!1),X.dataTransfer.files.length>0&&oe(X.dataTransfer.files))}async function te(){const X=E.trim();if(!(!W||!X)){if(f.isHomeRoot&&Zm.has(X.toLowerCase())){ge.error(n("library.library.folderNameReserved",{name:X}));return}try{const pe=f.dirPath;await Y.mutateAsync(pe?`${pe}/${X}`:X),ge.success(n("library.library.folderCreated",{name:X})),A(!1),D("")}catch(pe){ge.error(pe instanceof Error?pe.message:n("library.library.folderCreateFailed"))}}}async function le(){if(!j)return;const X=j;try{await ne.mutateAsync(X.path),ge.success(n("library.library.deleted",{name:is(X.path)}))}catch(pe){ge.error(pe instanceof Error?pe.message:n("library.library.deleteFailed"))}finally{N(null)}}async function ue(){if(!$)return;const X=M.trim();if(!X||X.includes("/")||X.includes("..")||X===is($.path)){R(!1),B(null),O("");return}if($.kind==="dir"&&f.isHomeRoot&&Zm.has(X.toLowerCase())){ge.error(n("library.library.folderNameReserved",{name:X}));return}try{const pe=$.path.includes("/")?$.path.slice(0,$.path.lastIndexOf("/")):"",ye=pe?`${pe}/${X}`:X;await ee.mutateAsync({from:$.path,to:ye});const we=X.replace(/[<>]/g,"");ge.success(n("library.library.renamed",{name:we}))}catch(pe){ge.error(pe instanceof Error?pe.message:n("library.library.renameFailed"))}finally{R(!1),B(null),O("")}}async function fe(X,pe){try{const ye=is(X),we=pe?`${pe}/${ye}`:ye;await ee.mutateAsync({from:X,to:we}),ge.success(n("library.library.moved",{name:ye,destination:pe||n("library.library.theLibrary")}))}catch(ye){ge.error(ye instanceof Error?ye.message:n("library.library.moveFailed"))}}function ae(){for(const X of Ble)o.invalidateQueries({queryKey:Qe.orgFsVolume(i.id,X)});f.volume&&o.invalidateQueries({queryKey:Qe.orgFsVolume(i.id,f.volume)}),o.invalidateQueries({queryKey:Qe.orgFsRecent(i.id)}),o.invalidateQueries({queryKey:Qe.orgFsSearchRoot(i.id)}),o.invalidateQueries({queryKey:Qe.orgFsPublicSets(i.id)})}function de(X){X.defaultPrevented||!W||X.target.closest("input, textarea, button, a, [role='button']")||(X.preventDefault(),A(!0))}return r.jsxs("div",{className:"relative h-full",onDragEnter:H,onDragOver:se,onDragLeave:Q,onDrop:ce,onContextMenu:de,children:[U&&r.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[r.jsx(Yn,{size:28,className:"text-primary"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:w})})]})}),r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:r.jsx(Kle,{segments:f.segments,onNavigate:p})}),r.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[r.jsx(Hf,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(gt,{value:L,onChange:X=>_(X.target.value),onKeyDown:X=>{X.key==="Escape"&&_("")},placeholder:k,className:"h-9 rounded-xl pr-9 pl-9"}),L&&r.jsx(he,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>_(""),"aria-label":n("library.library.clearSearch"),children:r.jsx(Li,{size:14})})]}),r.jsx(he,{variant:"ghost",size:"icon",onClick:ae,"aria-label":n("library.library.refresh"),children:r.jsx(Dn,{size:14})}),W&&r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[r.jsx(Ht,{size:14}),n("library.library.newFolder")]}),f.readOnly?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Bu,{size:12}),n("library.library.readOnly")]}):r.jsxs(he,{size:"sm",disabled:G.isPending,onClick:()=>F.current?.click(),children:[r.jsx(Yn,{size:14}),G.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),r.jsx("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:X=>{oe(X.target.files)}})]}),y?r.jsx(Wle,{query:y,scope:S,stale:L.trim()!==y,onOpenFile:x,onShare:C,onDelete:N}):f.volume===null?r.jsx(Gle,{onOpenDir:p}):r.jsx(Yle,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:C,onDelete:N,onContextMenu:(X,pe)=>{B({path:X,kind:pe}),O(is(X)),R(!0)},onMove:fe},f.volume)]})}),a&&(c.preview?r.jsx(Uk,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?r.jsx(Hk,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?r.jsx(Fk,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),r.jsx(zt,{open:V,onOpenChange:A,children:r.jsxs(Bt,{children:[r.jsxs(os,{children:[r.jsx(Kt,{children:n("library.library.newFolderTitle")}),r.jsx(kn,{children:n("library.library.newFolderDescription",{path:w||n("library.library.theLibrary")})})]}),r.jsx(gt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:X=>D(X.target.value),onKeyDown:X=>{X.key==="Enter"&&te()}}),r.jsxs(qn,{children:[r.jsx(he,{variant:"outline",onClick:()=>A(!1),children:n("library.library.cancel")}),r.jsx(he,{disabled:!E.trim()||Y.isPending,onClick:()=>{te()},children:n("library.library.create")})]})]})}),r.jsx(zt,{open:I,onOpenChange:X=>{R(X),X||(B(null),O(""))},children:r.jsxs(Bt,{children:[r.jsxs(os,{children:[r.jsx(Kt,{children:$&&n("library.library.renameTitle",{name:is($.path)})}),r.jsx(kn,{children:n("library.library.renameDescription")})]}),r.jsx(gt,{autoFocus:!0,value:M,onChange:X=>O(X.target.value),onKeyDown:X=>{X.key==="Enter"&&ue()}}),r.jsxs(qn,{children:[r.jsx(he,{variant:"outline",onClick:()=>R(!1),children:n("library.library.cancel")}),r.jsx(he,{disabled:!M.trim()||ee.isPending,onClick:()=>{ue()},children:n("library.library.rename")})]})]})}),r.jsx(xle,{target:T,onOpenChange:X=>{X||C(null)}}),r.jsx(To,{open:j!==null,onOpenChange:X=>{X||N(null)},children:r.jsxs(Vo,{children:[r.jsxs(Ao,{children:[r.jsx(Po,{children:n("library.library.deleteTitle",{name:j?is(j.path):""})}),r.jsx(Eo,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),r.jsxs(Do,{children:[r.jsx(Ro,{children:n("library.library.cancel")}),r.jsx(Io,{onClick:()=>{le()},children:n("library.library.delete")})]})]})})]})}function tae(){const t=z.c(12),e=Yt(),[s,n]=P.useState(null),[i,o]=P.useState(null);let l;t[0]!==e?(l=f=>e({to:".",search:m=>({...m,main:f}),replace:!0}),t[0]=e,t[1]=l):l=t[1];const a=l;let c;t[2]!==a?(c=r.jsx(eae,{onOpenFile:f=>a(ST(f)),onOpenSkill:n,onOpenBrand:o}),t[2]=a,t[3]=c):c=t[3];let d;t[4]!==s?(d=s&&r.jsx(Hk,{skillPath:s,onClose:()=>n(null)},s),t[4]=s,t[5]=d):d=t[5];let u;t[6]!==i?(u=i&&r.jsx(Fk,{brandPath:i,onClose:()=>o(null)},i),t[6]=i,t[7]=u):u=t[7];let h;return t[8]!==c||t[9]!==d||t[10]!==u?(h=r.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[c,d,u]}),t[8]=c,t[9]=d,t[10]=u,t[11]=h):h=t[11],h}const Fb=P.lazy(()=>jn(()=>import("./project-app-view-D9hKZwXZ.js"),__vite__mapDeps([177,1,2,81,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,82,83,84,11,12,13,19,85,86,87,88,89,90,91,92,93,94,5,4,10,14,15,16,17,3,9,18,20,21,22,95,96,97,98,99,100,101,102,103,104,105,106,78,75,107,126,114,115,116,117,118,119,120,121,122,108,109,74,110,111,112,113,123,124,125,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,73,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.AppViewContent})));function sae(t){const e=z.c(64),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:o,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let y;return e[0]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(PG,{}),e[0]=y):y=e[0],y}if(s==="board"){let y;return e[1]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:r.jsx(mY,{})}),e[1]=y):y=e[1],y}if(kT(s)){let y;return e[2]!==n?(y=r.jsx(A4,{virtualMcpId:n}),e[2]=n,e[3]=y):y=e[3],y}if(s==="git"){let y;return e[4]!==n?(y=r.jsx(XJ,{virtualMcpId:n}),e[4]=n,e[5]=y):y=e[5],y}if(s==="automations"){let y;return e[6]!==n?(y=r.jsx(qoe,{virtualMcpId:n}),e[6]=n,e[7]=y):y=e[7],y}if(s==="preview"){let y;return e[8]!==n?(y=r.jsx(zne,{virtualMcpId:n}),e[8]=n,e[9]=y):y=e[9],y}let c;e[10]!==s?(c=jT(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let y;return e[12]!==d.path?(y=r.jsx(Une,{openPath:d.path}),e[12]=d.path,e[13]=y):y=e[13],y}if(s==="content"){let y;return e[14]!==n?(y=r.jsx(toe,{virtualMcpId:n}),e[14]=n,e[15]=y):y=e[15],y}if(s==="assets"){let y;return e[16]!==n?(y=r.jsx(soe,{virtualMcpId:n}),e[16]=n,e[17]=y):y=e[17],y}if(s==="files"){let y;return e[18]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(tae,{}),e[18]=y):y=e[18],y}if(s==="reports"){let y;return e[19]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(rle,{}),e[19]=y):y=e[19],y}if(s==="connect-sources"){let y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(sle,{}),e[20]=y):y=e[20],y}if(a){let y;return e[21]!==s?(y=r.jsx(Foe,{tabId:s}),e[21]=s,e[22]=y):y=e[22],y}let u;e[23]!==s?(u=Jy(s),e[23]=s,e[24]=u):u=e[24];const h=u;if(h){let y;return e[25]!==h.path?(y=r.jsx(vle,{path:h.path},h.path),e[25]=h.path,e[26]=y):y=e[26],y}let f;e[27]!==s?(f=Yy(s),e[27]=s,e[28]=f):f=e[28];const m=f;if(m){let y;return e[29]!==m.key||e[30]!==i?(y=r.jsx(Zoe,{fileKey:m.key,taskId:i}),e[29]=m.key,e[30]=i,e[31]=y):y=e[31],y}let p;e[32]!==s?(p=Qy(s),e[32]=s,e[33]=p):p=e[33];const g=p;if(g){let y;return e[34]!==g.path?(y=r.jsx(wle,{path:g.path},g.path),e[34]=g.path,e[35]=y):y=e[35],y}let x;e[36]!==s?(x=CT(s),e[36]=s,e[37]=x):x=e[37];const b=x;if(b){let y;if(e[38]!==l||e[39]!==b.connectionId||e[40]!==b.toolName){let N;e[42]!==b.connectionId||e[43]!==b.toolName?(N=T=>T.appId===b.connectionId&&T.toolName===b.toolName,e[42]=b.connectionId,e[43]=b.toolName,e[44]=N):N=e[44],y=l.find(N),e[38]=l,e[39]=b.connectionId,e[40]=b.toolName,e[41]=y}else y=e[41];const S=y;let k;e[45]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(zr,{}),e[45]=k):k=e[45];const w=S?.args;let j;return e[46]!==s||e[47]!==b.connectionId||e[48]!==b.toolName||e[49]!==w?(j=r.jsx(P.Suspense,{fallback:k,children:r.jsx(Fb,{connectionId:b.connectionId,toolName:b.toolName,args:w},s)}),e[46]=s,e[47]=b.connectionId,e[48]=b.toolName,e[49]=w,e[50]=j):j=e[50],j}let v;if(e[51]!==s||e[52]!==o){let y;e[54]!==s?(y=S=>S.id===s,e[54]=s,e[55]=y):y=e[55],v=o.find(y),e[51]=s,e[52]=o,e[53]=v}else v=e[53];const L=v;if(L){let y;e[56]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(zr,{}),e[56]=y):y=e[56];let S;return e[57]!==s||e[58]!==L.id||e[59]!==L.view.appId||e[60]!==L.view.args?(S=r.jsx(P.Suspense,{fallback:y,children:r.jsx(Fb,{connectionId:L.view.appId,toolName:L.id,args:L.view.args},s)}),e[57]=s,e[58]=L.id,e[59]=L.view.appId,e[60]=L.view.args,e[61]=S):S=e[61],S}let _;return e[62]!==n?(_=r.jsx(A4,{virtualMcpId:n}),e[62]=n,e[63]=_):_=e[63],_}function nae(t){const e=z.c(14),{taskId:s,virtualMcpId:n}=t;let i;e[0]!==s||e[1]!==n?(i={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=i):i=e[2];const{activeTab:o,layoutTabs:l,expandedTools:a,automationTabParsed:c}=Vg(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(zr,{}),e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(u=r.jsx(P.Suspense,{fallback:d,children:r.jsx(sae,{activeTab:o,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=o,e[5]=c,e[6]=a,e[7]=l,e[8]=s,e[9]=n,e[10]=u):u=e[10];let h;return e[11]!==o||e[12]!==u?(h=r.jsx(Ws,{children:u},o),e[11]=o,e[12]=u,e[13]=h):h=e[13],h}function iae(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&NT.has(t.mainTab))}const vl="setup";function rae(t){const e=z.c(57),s=re();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let _;e[3]!==t.scriptTabs?(_=y=>!t.scriptTabs.includes(y),e[3]=t.scriptTabs,e[4]=_):_=e[4],n=t.scripts.filter(_),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let o;e[5]!==t?(o=()=>{t.active===vl?t.onToggle():t.onSelectTab(vl)},e[5]=t,e[6]=o):o=e[6];const l=o;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?r.jsx(_s,{className:"size-4"}):r.jsx(a8,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==c?(d=r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let h;e[20]!==u?(h=r.jsx(Ke,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=r.jsxs(We,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===vl;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=r.jsx(oae,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(_=>r.jsx(aae,{active:t.active===_,onClick:()=>{t.active===_?t.onToggle():t.onSelectTab(_)},onClose:()=>t.onCloseScript(_),t:s,children:_},_)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=r.jsx(cae,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let v;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(v=t.showScriptControls?r.jsx(dae,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):r.jsx(lae,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let L;return e[53]!==b||e[54]!==v||e[55]!==f?(L=r.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=L):L=e[56],L}function oae(t){const e=z.c(11),{active:s,open:n,onClick:i,t:o}=t,l=s&&n,a=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=ie("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(qA,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==o?(h=o("sandbox.toolbar.setupTab"),e[3]=o,e[4]=h):h=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==h?(f=r.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[u,h]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f):f=e[10],f}function lae(t){const e=z.c(40),{status:s,onStart:n,onStop:i,onRestart:o,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(wl,{className:"size-3.5"}),e[0]=d):d=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let h;return e[3]!==n||e[4]!==u?(h=r.jsxs(he,{variant:"outline",size:"xs",onClick:n,children:[d," ",u]}),e[3]=n,e[4]=u,e[5]=h):h=e[5],h}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(wl,{className:"size-3.5"}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let h;return e[9]!==l||e[10]!==u?(h=r.jsxs(he,{variant:"outline",size:"xs",onClick:l,children:[d," ",u]}),e[9]=l,e[10]=u,e[11]=h):h=e[11],h}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Dn,{className:"size-3.5"}),e[12]=d):d=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let h;return e[15]!==a||e[16]!==u?(h=r.jsxs(he,{variant:"outline",size:"xs",onClick:a,children:[d," ",u]}),e[15]=a,e[16]=u,e[17]=h):h=e[17],h}if(s==="starting"||s==="running"){const d=s==="running"&&!!o,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=ie(u),e[18]=u,e[19]=h):h=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==i||e[23]!==h||e[24]!==f?(m=r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",onClick:i,className:h,children:f})}),e[22]=i,e[23]=h,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=r.jsx(Ke,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=r.jsxs(We,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==o||e[34]!==d||e[35]!==c?(b=d&&r.jsxs(Xt,{children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:r.jsx(_s,{className:"size-3"})})}),r.jsx(es,{align:"end",children:r.jsxs(Xe,{onClick:o,children:[r.jsx(Dn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=o,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=r.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function aae(t){const e=z.c(17),{active:s,onClick:n,onClose:i,children:o,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=ie("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let h;e[2]!==d||e[3]!==u?(h=ie("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==o||e[6]!==n||e[7]!==h?(f=r.jsx("button",{type:"button",onClick:n,className:h,children:o}),e[5]=o,e[6]=n,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i||e[11]!==l?(m=i&&r.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(o)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:r.jsx(Is,{className:"size-3.5"})}),e[9]=o,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=r.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function cae(t){const e=z.c(27),{scripts:s,onRun:n}=t,i=re(),[o,l]=P.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Ht,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=r.jsx(He,{asChild:!0,children:r.jsx(ms,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let u;e[5]!==i?(u=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=r.jsx(Ke,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=r.jsxs(We,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=r.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(v=>r.jsxs("button",{type:"button",onClick:()=>{l(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=r.jsxs(bs,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==o||e[24]!==x||e[25]!==f?(b=r.jsxs(vs,{open:o,onOpenChange:l,children:[f,x]}),e[23]=o,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function dae(t){const e=z.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:o,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(lt,{className:"size-3.5 animate-spin"}),e[0]=f):f=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=r.jsxs(he,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(wl,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=r.jsx(He,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"xs",onClick:i,children:[f," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=r.jsx(Ke,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=r.jsxs(We,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==o||e[21]!==a?(c=r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",onClick:o,children:a})}),e[20]=o,e[21]=a,e[22]=c):c=e[22];let d;e[23]!==l?(d=l("sandbox.toolbar.stopProcess"),e[23]=l,e[24]=d):d=e[24];let u;e[25]!==d?(u=r.jsx(Ke,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=r.jsxs(We,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var qk=Object.defineProperty,uae=Object.getOwnPropertyDescriptor,hae=(t,e)=>{for(var s in e)qk(t,s,{get:e[s],enumerable:!0})},Vs=(t,e,s,n)=>{for(var i=n>1?void 0:n?uae(e,s):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&qk(e,s,i),i},Ge=(t,e)=>(s,n)=>e(s,n,t),Ub="Terminal input",ep={get:()=>Ub,set:t=>Ub=t},Hb="Too much output to announce, navigate to rows manually to read",tp={get:()=>Hb,set:t=>Hb=t};function fae(t){return t.replace(/\r?\n/g,"\r")}function mae(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function pae(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function gae(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");Gk(i,e,s,n)}}function Gk(t,e,s,n){t=fae(t),t=mae(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Yk(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,o=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function Kb(t,e,s,n,i){Yk(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function mo(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function T9(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let o=t[i];o>65535?(o-=65536,n+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):n+=String.fromCharCode(o)}return n}var xae=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i=0;if(this._interim){let o=t.charCodeAt(i++);56320<=o&&o<=57343?e[n++]=(this._interim-55296)*1024+o-56320+65536:(e[n++]=this._interim,e[n++]=o),this._interim=0}for(let o=i;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return this._interim=l,n;let a=t.charCodeAt(o);56320<=a&&a<=57343?e[n++]=(l-55296)*1024+a-56320+65536:(e[n++]=l,e[n++]=a);continue}l!==65279&&(e[n++]=l)}return n}},bae=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i,o,l,a,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let u=s-4,h=d;for(;h<s;){for(;h<u&&!((i=t[h])&128)&&!((o=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=o,e[n++]=l,e[n++]=a,h+=4;if(i=t[h++],i<128)e[n++]=i;else if((i&224)===192){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(c=(i&31)<<6|o&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(c=(i&15)<<12|(o&63)<<6|l&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(o&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Jk="",vo=" ",r0=class Qk{constructor(){this.fg=0,this.bg=0,this.extended=new of}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Qk;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},of=class Xk{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Xk(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},li=class Zk extends r0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new of,this.combinedData=""}static fromCharData(e){let s=new Zk;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?mo(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Wb="di$target",sp="di$dependencies",I1=new Map;function vae(t){return t[sp]||[]}function on(t){if(I1.has(t))return I1.get(t);let e=function(s,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");yae(e,s,i)};return e._id=t,I1.set(t,e),e}function yae(t,e,s){e[Wb]===e?e[sp].push({id:t,index:s}):(e[sp]=[{id:t,index:s}],e[Wb]=e)}var Vn=on("BufferService"),ej=on("CoreMouseService"),Jl=on("CoreService"),_ae=on("CharsetService"),q3=on("InstantiationService"),tj=on("LogService"),An=on("OptionsService"),sj=on("OscLinkService"),Lae=on("UnicodeService"),o0=on("DecorationService"),np=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,o=new li,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let u=0;u<l;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=u,a=o.extended.urlId;continue}else d=o.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&u===l-1){let h=this._oscLinkService.getLinkData(a)?.uri;if(h){let f={start:{x:c+1,y:t},end:{x:u+(!d&&u===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(h);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:h,range:f,activate:(p,g)=>i?i.activate(p,g,f):wae(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,a=o.extended.urlId):(c=-1,a=-1)}}e(n)}};np=Vs([Ge(0,Vn),Ge(1,An),Ge(2,sj)],np);function wae(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
725
|
+
`);function Ale(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Vle).replaceAll("{{title}}",Tle).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function Ple(t){const e=z.c(8),{readUrl:s,title:n,tokensUrl:i}=t,o=Ll(s),l=Ll(i??"");if(o.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:r.jsx(bt,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(o.isError||!o.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=u):u=e[1],u}const a=l.data??null;let c;e[2]!==a||e[3]!==o.data?(c=Ale(o.data,a),e[2]=a,e[3]=o.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=r.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function zd(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ele(t){const e=z.c(16),{family:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;let a;e[0]!==s?(a=r.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==o){let h;e[7]!==i||e[8]!==l||e[9]!==o?(h=f=>{const m=o(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?r.jsx("input",{type:"color","aria-label":f.name,title:p,value:GV(m),onChange:g=>l(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):r.jsx("span",{title:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=i,e[8]=l,e[9]=o,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let u;return e[13]!==a||e[14]!==d?(u=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Dle(t){const e=z.c(9),{token:s,value:n}=t;if(s.kind==="space"){let o;return e[0]!==n?(o=r.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:r.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=o):o=e[1],o}if(s.kind==="radius"){let o;return e[2]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=o):o=e[3],o}if(s.kind==="shadow"){let o;return e[4]!==n?(o=r.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=o):o=e[5],o}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const o=`min(${n}, 22px)`;let l;return e[6]!==o?(l=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:o},children:"Ag"}),e[6]=o,e[7]=l):l=e[7],l}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function zk(t){const e=z.c(17),{token:s,value:n,editing:i,onEdit:o}=t;let l;e[0]!==s||e[1]!==n?(l=r.jsx(Dle,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=/^--brand-/,e[5]=h):h=e[5],a=s.name.replace(h,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==o||e[10]!==s.name||e[11]!==n?(d=i?r.jsx(gt,{value:n,onChange:h=>o(s.name,h.target.value),className:"h-8 w-40 font-mono text-xs"}):r.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=o,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let u;return e[13]!==l||e[14]!==c||e[15]!==d?(u=r.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],u}function Sd(t){const e=z.c(16),{label:s,tokens:n,editing:i,valueOf:o,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=r.jsx(zd,{children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==o){let h;e[7]!==i||e[8]!==l||e[9]!==o?(h=f=>r.jsx(zk,{token:f,value:o(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=o,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,e[4]=n,e[5]=o,e[6]=c}else c=e[6];let d;e[11]!==c?(d=r.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let u;return e[13]!==a||e[14]!==d?(u=r.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Rle({brandPath:t,onClose:e,variant:s}){const n=re(),{org:i}=Fe(),o=vf(t),l=o.volume??"",a=o.dirPath,c=is(a),d=o.readOnly,u=as(),h=Wc(),f=N6(l),{upload:m,remove:p}=pu(l),g=P.useRef(null),x=T2(l,a),b=x.data??[],v=X=>b.some(pe=>pe.kind==="file"&&is(pe.path)===X),L=v("tokens.css"),_=v("brand.md"),y=v("slides-theme.html"),S=HV(b),k=h(l,`${a}/tokens.css`),w=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),N=Ll(k,{enabled:L}),T=Ll(w,{enabled:_}),[C,V]=P.useState(!1),[A,E]=P.useState({}),[D,I]=P.useState(null),[R,$]=P.useState(!1),[B,M]=P.useState(!1),[O,F]=P.useState("deck"),U=N.data?KV(N.data):[],K=X=>U.find(pe=>pe.name===X)?.value,q=X=>A[X.name]??X.value,W=WV(U),G=U.filter(X=>X.kind==="font"),Y=U.filter(X=>X.kind==="type"),ee=U.filter(X=>X.kind==="space"),ne=U.filter(X=>X.kind==="radius"),oe=U.filter(X=>X.kind==="shadow"),Z=U.filter(X=>X.kind==="motion"),J=U.filter(X=>X.kind==="other"),H=(X,pe)=>E(ye=>({...ye,[X]:pe})),se=y&&O==="deck",Q=D??T.data??"",ce=Object.entries(A).filter(([X,pe])=>K(X)!==pe),te=D!==null&&D!==(T.data??""),le=ce.length>0||te;function ue(){E({}),I(null),V(!1)}async function fe(){$(!0);try{if(ce.length>0){let X=N.data??"";for(const[pe,ye]of ce)X=qV(X,pe,ye);await f.mutateAsync({path:`${a}/tokens.css`,body:X,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:Qe.fileText(k)})}te&&D!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:D,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:Qe.fileText(w)})),u.invalidateQueries({queryKey:Qe.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:Qe.orgFsRecent(i.id)}),E({}),I(null),V(!1),ge.success(n("library.brandPreview.brandSaved"))}catch(X){ge.error(X instanceof Error?X.message:n("library.brandPreview.failedSaveBrand"))}finally{$(!1)}}async function ae(X){const pe=X?.[0];if(!pe)return;const we=`logo.${(pe.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([pe],we,{type:pe.type})]}),S&&is(S)!==we&&await p.mutateAsync(S),ge.success(n("library.brandPreview.logoUpdated"))}catch(_e){ge.error(_e instanceof Error?_e.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const de=!x.isPending&&!L&&!_&&!S;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(hm,{size:18})}),s==="dialog"?r.jsx(Kt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(C?r.jsxs(r.Fragment,{children:[r.jsx(he,{variant:"ghost",size:"sm",onClick:ue,disabled:R,children:n("library.brandPreview.cancel")}),r.jsx(he,{size:"sm",disabled:!le||R,onClick:()=>{fe()},children:n(R?"library.brandPreview.saving":"library.brandPreview.save")})]}):r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[r.jsx(gV,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?r.jsx(Fy,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(Is,{size:16})})}):r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:r.jsx(Is,{size:16})})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?r.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[r.jsx(bt,{className:"h-40 w-full rounded-xl"}),r.jsx(bt,{className:"h-4 w-1/3"}),r.jsx(bt,{className:"h-4 w-2/3"})]}):de?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):r.jsxs(r.Fragment,{children:[(y||L)&&r.jsxs("div",{className:"shrink-0 border-b border-border",children:[r.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(B?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(X=>!X),onKeyDown:X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),M(pe=>!pe))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:X=>X.stopPropagation(),children:[y&&r.jsx("button",{type:"button",onClick:()=>{F("deck"),M(!1)},className:ie("rounded-md px-2.5 py-1",se?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),r.jsx("button",{type:"button",onClick:()=>{F("components"),M(!1)},className:ie("rounded-md px-2.5 py-1",se?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),B?r.jsx(_s,{size:16,className:"shrink-0 text-muted-foreground"}):r.jsx(a8,{size:16,className:"shrink-0 text-muted-foreground"})]}),!B&&r.jsx("div",{className:"px-4 pb-4",children:r.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",se?"aspect-[16/9]":"h-96"),children:se?r.jsx(Ple,{readUrl:j,title:`${c} deck theme`,tokensUrl:k}):r.jsx(Nle,{tokensUrl:k})})})]}),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(zd,{children:n("library.brandPreview.logo")}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:S?r.jsx("img",{src:h(l,S),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):r.jsx(hm,{size:28,className:"text-muted-foreground/50"})}),C&&r.jsxs("div",{children:[r.jsxs(he,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[r.jsx(Yn,{size:14}),n(S?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),r.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:X=>{ae(X.target.files)}})]})]})]}),W.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(zd,{children:n("library.brandPreview.colors")}),W.map(X=>r.jsx(Ele,{family:X.family,tokens:X.tokens,editing:C,valueOf:q,onEdit:H},X.family))]}),(G.length>0||Y.length>0)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(zd,{children:n("library.brandPreview.typography")}),G.map(X=>r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:X.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),C?r.jsx(gt,{value:q(X),onChange:pe=>H(X.name,pe.target.value),className:"h-9"}):r.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:q(X)},children:q(X)})]},X.name)),Y.map(X=>r.jsx(zk,{token:X,value:q(X),editing:C,onEdit:H},X.name))]}),r.jsx(Sd,{label:n("library.brandPreview.spacing"),tokens:ee,editing:C,valueOf:q,onEdit:H}),r.jsx(Sd,{label:n("library.brandPreview.radius"),tokens:ne,editing:C,valueOf:q,onEdit:H}),r.jsx(Sd,{label:n("library.brandPreview.shadows"),tokens:oe,editing:C,valueOf:q,onEdit:H}),r.jsx(Sd,{label:n("library.brandPreview.motion"),tokens:Z,editing:C,valueOf:q,onEdit:H}),r.jsx(Sd,{label:n("library.brandPreview.tokens"),tokens:J,editing:C,valueOf:q,onEdit:H}),r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(zd,{children:n("library.brandPreview.voiceGuidelines")}),C?r.jsx(Ir,{value:Q,onChange:X=>I(X.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):T.isPending&&_?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(bt,{className:"h-3 w-full"}),r.jsx(bt,{className:"h-3 w-5/6"})]}):Q.trim()?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:r.jsx(Fo,{id:`brand-preview-${t}`,text:Q})}):r.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Fk(t){const e=z.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==s||e[3]!==n?(o=r.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:r.jsx(Rle,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(zt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function Uk(t){const e=z.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,o=i===void 0?!1:i;let l;e[0]!==n?(l=d=>{d||n()},e[0]=n,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==s||e[4]!==o?(a=r.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:r.jsx(Bk,{previewPath:s,onClose:n,showSeeInLibrary:o,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=r.jsx(zt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function Ile(t){const e=z.c(18),{skillPath:s,onClose:n,variant:i}=t,o=vf(s),{volume:l,dirPath:a}=o,c=Wc(),d=c(l??"",`${a}/SKILL.md`),u=Ll(d),h=T2(l??"",a);let f;e[0]!==a?(f=is(a),e[0]=a,e[1]=f):f=e[1];const m=f;let p;e[2]!==u.data?(p=u.data?YV(u.data):null,e[2]=u.data,e[3]=p):p=e[3];const g=p,x=$le;let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=(E,D)=>x(E.path)?-1:x(D.path)?1:is(E.path).localeCompare(is(D.path)),e[4]=b):b=e[4];const v=(h.data??[]).filter(Mle).sort(b),[L,_]=P.useState(null),y=L===null?null:v.find(E=>E.path===L)??null,S=g?.name??m;let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:r.jsx(wi,{size:18})}),e[5]=k):k=e[5];let w;e[6]!==S||e[7]!==i?(w=i==="dialog"?r.jsx(Kt,{className:"flex-1 truncate text-base font-medium text-foreground",children:S}):r.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:S}),e[6]=S,e[7]=i,e[8]=w):w=e[8];let j;e[9]!==n||e[10]!==i?(j=i==="dialog"?r.jsx(Fy,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:r.jsx(Is,{size:16})})}):r.jsx(he,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:n,children:r.jsx(Is,{size:16})}),e[9]=n,e[10]=i,e[11]=j):j=e[11];let N;e[12]!==w||e[13]!==j?(N=r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[k,w,j]}),e[12]=w,e[13]=j,e[14]=N):N=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[15]=T):T=e[15];const C="relative flex min-w-0 flex-1 flex-col overflow-y-auto",V=y?r.jsx(H3,{file:{key:y.path,filename:is(y.path),size:y.size,downloadUrl:c(l??"",y.path)}}):u.isPending?r.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[r.jsx(bt,{className:"h-4 w-1/3"}),r.jsx(bt,{className:"h-3 w-full"}),r.jsx(bt,{className:"h-3 w-5/6"}),r.jsx(bt,{className:"h-3 w-2/3"})]}):u.isError||!g?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-4 border-b border-border p-6",children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Description"}),r.jsx("p",{className:"text-base text-muted-foreground",children:g.description??"Claude Code skill"})]}),r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none p-6",children:r.jsx(Fo,{id:`skill-preview-${s}`,text:g.body})})]});let A;return e[16]!==V?(A=r.jsx("div",{className:C,children:V}),e[16]=V,e[17]=A):A=e[17],r.jsxs(r.Fragment,{children:[N,r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsxs("div",{className:"flex w-[220px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted p-3",children:[T,h.isPending?r.jsx(bt,{className:"mx-2 h-4 w-24"}):v.map(E=>{const D=x(E.path)?y===null:L===E.path;return r.jsxs("button",{type:"button",onClick:()=>_(x(E.path)?null:E.path),className:ie("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",D?"bg-background shadow-sm":"hover:bg-muted/60"),children:[r.jsx(lr,{filename:is(E.path),className:"h-6 w-5 shrink-0"}),r.jsx("span",{className:ie("truncate text-sm",D?"text-foreground":"text-muted-foreground"),children:is(E.path)})]},E.path)})]}),A]})]})}function Mle(t){return t.kind==="file"}function $le(t){return is(t)==="SKILL.md"}function Hk(t){const e=z.c(8),{skillPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let o;e[2]!==n||e[3]!==s?(o=r.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",closeButtonClassName:"hidden",children:r.jsx(Ile,{skillPath:s,onClose:n,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=o):o=e[4];let l;return e[5]!==i||e[6]!==o?(l=r.jsx(zt,{open:!0,onOpenChange:i,children:o}),e[5]=i,e[6]=o,e[7]=l):l=e[7],l}function Ole(t){const e=z.c(11),{onOpenDir:s}=t,n=re(),i=pP();let o;e[0]!==i.data?(o=i.data??[],e[0]=i.data,e[1]=o):o=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==o){let c;e[6]!==s||e[7]!==n?(c=d=>r.jsx(Ru,{name:d.volume,glyph:Jn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:T6(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],l=o.map(c),e[2]=s,e[3]=n,e[4]=o,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=r.jsx(r.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function K3(t){return`${window.location.origin}${t}`}function lu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Ble=[hu,"uploads","outputs"],Kk=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Yn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Ar}],Zm=new Set([...Kk.map(t=>t.volume),Lc("public")]),zle=6;function Wk(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=Ay(t),o=i?`public/${i}`:t==="home"?fu(s):t;return n?`${o}/${n}`:o}function Y0(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const i=n.dataTransfer.getData("application/x-studio-library-path");i&&i!==t&&!t.startsWith(i+"/")&&s.onDrop(i,t)}:void 0}}function po(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Nr(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("div",{className:"@container",children:r.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function N9(t){const e=z.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=r.jsx(Nr,{children:Array.from({length:n*3},Fle)}),e[0]=n,e[1]=i):i=e[1],i}function Fle(t,e){return r.jsx(bt,{className:"h-16 rounded-2xl"},e)}function W3(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Ule(t){const e=z.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:o}=t,l=re(),a=ZV(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==o||e[8]!==c||e[9]!==d||e[10]!==s?(u=r.jsx(Ru,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:o}),e[6]=i,e[7]=o,e[8]=c,e[9]=d,e[10]=s,e[11]=u):u=e[11],u}function Hle(t){const e=z.c(12),{onOpenDir:s}=t,n=re(),o=V6().data?.length??0;let l;e[0]!==s?(l=Kk.map(u=>r.jsx(Ule,{volume:u.volume,descriptionKey:u.descriptionKey,glyph:u.glyph,onOpen:()=>s(u.volume)},u.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==o||e[4]!==n?(a=o>0&&r.jsx(Ru,{name:Lc("public"),meta:n("library.libraryViews.skillSetsCount",{count:o}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:wi,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=o,e[4]=n,e[5]=a):a=e[5];let c;e[6]!==s?(c=r.jsx(Ole,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=r.jsxs(r.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Kle(t){const e=z.c(19),{segments:s,onNavigate:n}=t,{org:i}=Fe();let o;e[0]!==s?(o=s[0]===hu?s.slice(1):s,e[0]=s,e[1]=o):o=e[1];const l=o,a=s.length-l.length,c=l.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?r.jsx("span",{className:"truncate font-medium text-foreground",children:fu(i.slug)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(hu),children:fu(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let u;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let f;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(nn,{size:12,className:"shrink-0 text-muted-foreground"}),x?r.jsx("span",{className:"truncate font-medium text-foreground",children:Lc(m)}):r.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Lc(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],u=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=u}else u=e[10];let h;return e[16]!==d||e[17]!==u?(h=r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function Wle(t){const e=z.c(43),{query:s,scope:n,stale:i,onOpenFile:o,onShare:l,onDelete:a}=t,c=re(),{org:d}=Fe(),u=Wc(),h=JV(s,n);let f;e[0]!==u||e[1]!==l?(f=k=>l({volume:k.volume,path:k.path,kind:"file",shareMode:k.shareMode??"private",effectivePublic:k.effectivePublic??!1,url:K3(u(k.volume,k.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let k;return e[3]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(N9,{rows:2}),e[3]=k):k=e[3],k}let p,g,x,b,v;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=h.data??[],g.length===0){let w;e[14]!==s||e[15]!==c?(w=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=w):w=e[16];let j;e[17]!==w?(j=r.jsx(W3,{children:w}),e[17]=w,e[18]=j):j=e[18],v=j;break e}const k=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==k?(b=ie("flex flex-col gap-3",k),e[19]=k,e[20]=b):b=e[20],p=po,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=h.data,e[6]=h.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let L;e[21]!==p||e[22]!==x?(L=r.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=L):L=e[23];let _;if(e[24]!==u||e[25]!==a||e[26]!==o||e[27]!==d||e[28]!==g||e[29]!==m){let k;e[31]!==u||e[32]!==a||e[33]!==o||e[34]!==d||e[35]!==m?(k=w=>{const j=Ay(w.volume)!==null;return r.jsx(A6,{filename:is(w.path),updatedAt:w.updatedAt,downloadUrl:u(w.volume,w.path),subtitle:Wk(w.volume,w.path,d.slug),publicState:lu(w),onOpen:()=>o(Py(w.volume,w.path)),onShare:j?void 0:()=>m(w),onDelete:j?void 0:()=>a({volume:w.volume,path:w.path,kind:"file"})},`${w.volume}/${w.path}`)},e[31]=u,e[32]=a,e[33]=o,e[34]=d,e[35]=m,e[36]=k):k=e[36],_=g.map(k),e[24]=u,e[25]=a,e[26]=o,e[27]=d,e[28]=g,e[29]=m,e[30]=_}else _=e[30];let y;e[37]!==_?(y=r.jsx(Nr,{children:_}),e[37]=_,e[38]=y):y=e[38];let S;return e[39]!==b||e[40]!==L||e[41]!==y?(S=r.jsxs("div",{className:b,children:[L,y]}),e[39]=b,e[40]=L,e[41]=y,e[42]=S):S=e[42],S}function qle(t){const e=z.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,o=re(),{org:l}=Fe(),a=C6(),c=Wc();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:K3(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let v;e[3]!==o?(v=o("library.libraryViews.recentlyAdded"),e[3]=o,e[4]=v):v=e[4];let L;e[5]!==v?(L=r.jsx(po,{children:v}),e[5]=v,e[6]=L):L=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=r.jsx(N9,{}),e[7]=_):_=e[7];let y;return e[8]!==L?(y=r.jsxs("div",{className:"flex flex-col gap-3",children:[L,_]}),e[8]=L,e[9]=y):y=e[9],y}let h,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==u||e[16]!==o){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,zle);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let L;e[22]!==o?(L=o("library.libraryViews.recentlyAdded"),e[22]=o,e[23]=L):L=e[23],e[24]!==L?(p=r.jsx(po,{children:L}),e[24]=L,e[25]=p):p=e[25],h=Nr;let _;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(_=y=>r.jsx(eA,{filename:is(y.path),updatedAt:y.updatedAt,size:y.size,downloadUrl:c(y.volume,y.path),subtitle:Wk(y.volume,y.path,l.slug),publicState:lu(y),onOpen:()=>s(Py(y.volume,y.path)),onShare:()=>u(y),onDelete:()=>i({volume:y.volume,path:y.path,kind:"file"})},`${y.volume}/${y.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,e[31]=_):_=e[31],f=v.map(_)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=u,e[16]=o,e[17]=h,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else h=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==h||e[33]!==f?(x=r.jsx(h,{children:f}),e[32]=h,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=r.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function Gle(t){const e=z.c(16),{onOpenDir:s}=t,n=re(),i=V6();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(N9,{}),e[0]=d):d=e[0],d}let o;e[1]!==i.data?(o=i.data??[],e[1]=i.data,e[2]=o):o=e[2];const l=o;if(l.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let u;return e[5]!==d?(u=r.jsx(W3,{children:d}),e[5]=d,e[6]=u):u=e[6],u}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=u=>r.jsx(Ru,{name:u,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${u}`)},u),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=r.jsx(Nr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Yle(t){const e=z.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:o,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=re(),{org:m}=Fe(),p=s.volume??"",g=T2(p,s.dirPath),x=Wc();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=C=>s.isHomeRoot&&Zm.has(C.toLowerCase())?`${fu(m.slug)}/${C}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let L;e[3]!==s.isHomeRoot||e[4]!==n?(L=s.isHomeRoot?r.jsx(Hle,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=L):L=e[5];const _=L;if(g.isPending){let C;e[6]!==_||e[7]!==f?(C=_&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.folders")}),r.jsx(Nr,{children:_})]}),e[6]=_,e[7]=f,e[8]=C):C=e[8];let V;e[9]===Symbol.for("react.memo_cache_sentinel")?(V=r.jsx(N9,{rows:2}),e[9]=V):V=e[9];let A;return e[10]!==C?(A=r.jsxs(r.Fragment,{children:[C,V]}),e[10]=C,e[11]=A):A=e[11],A}if(g.isError){let C;e[12]!==g.error||e[13]!==f?(C=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=C):C=e[14];let V;return e[15]!==C?(V=r.jsx("p",{className:"text-sm text-destructive",children:C}),e[15]=C,e[16]=V):V=e[16],V}let y,S,k,w,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==h||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==o||e[29]!==a||e[30]!==_||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const C=g.data??[],V=C.filter(Zle),A=C.filter(Xle),E=C.filter(Qle),D=C.filter(Jle);if(C.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==f?(M=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=M):M=e[40];let O;e[41]!==M?(O=r.jsx(W3,{children:M}),e[41]=M,e[42]=O):O=e[42],j=O;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const R=I;let $;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?($=M=>s.readOnly?void 0:()=>a({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?K3(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=$):$=e[51];const B=$;y=V.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.skills")}),r.jsx(Nr,{children:V.map(M=>r.jsx(QV,{dirName:is(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:lu(M),onOpen:()=>o(Ja(s,M.path)),onBrowse:()=>n(Ja(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...Y0(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),S=A.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.brands")}),r.jsx(Nr,{children:A.map(M=>r.jsx(XV,{dirName:is(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>l(Ja(s,M.path)),onBrowse:()=>n(Ja(s,M.path)),onDelete:R(M),draggable:!s.readOnly,...Y0(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),k=(E.length>0||_)&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.folders")}),r.jsxs(Nr,{children:[_,E.map(M=>r.jsx(Ru,{name:is(M.path),meta:T6(M.updatedAt),subtitle:v(is(M.path)),readOnly:s.readOnly,publicState:lu(M),onOpen:()=>n(Ja(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...Y0(M.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},M.path))]})]}),w=D.length>0&&r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(po,{children:f("library.libraryViews.files")}),r.jsx(Nr,{children:D.map(M=>r.jsx(A6,{filename:is(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:lu(M),onOpen:()=>i(Ja(s,M.path)),onShare:B(M),onDelete:R(M),draggable:!s.readOnly,...Y0(M.path,"file",{onDragStart:d,onContextMenu:u})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=u,e[22]=c,e[23]=d,e[24]=h,e[25]=l,e[26]=n,e[27]=i,e[28]=o,e[29]=a,e[30]=_,e[31]=f,e[32]=p,e[33]=y,e[34]=S,e[35]=k,e[36]=w,e[37]=j}else y=e[33],S=e[34],k=e[35],w=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let N;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==a?(N=s.isHomeRoot&&r.jsx(qle,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=N):N=e[56];let T;return e[57]!==y||e[58]!==S||e[59]!==k||e[60]!==w||e[61]!==N?(T=r.jsxs(r.Fragment,{children:[y,S,k,w,N]}),e[57]=y,e[58]=S,e[59]=k,e[60]=w,e[61]=N,e[62]=T):T=e[62],T}function Jle(t){return t.kind==="file"}function Qle(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Xle(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Zle(t){return t.kind==="dir"&&t.hasSkill}function eae({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=re(),{org:i}=Fe(),o=as(),l=Yt(),a=zo(),c=ur({strict:!1}),d=c.path||hu,u=vf(d),h=gP(),f=u.volume!==null&&h.has(u.volume)?{...u,readOnly:!0}:u,m=(X,pe)=>l({to:".",search:ye=>({...ye,[X]:pe||void 0})}),p=X=>m("path",X),g=(X,pe)=>l({to:".",search:ye=>({...ye,preview:void 0,skill:void 0,brand:void 0,[X]:pe})}),x=t??(X=>g("preview",X)),b=e??(X=>g("skill",X)),v=s??(X=>g("brand",X)),[L,_]=P.useState(""),y=Kf(L.trim(),300),S=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,k=S?n("library.library.searchInPlaceholder",{folder:Lc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),w=f.isHomeRoot?fu(i.slug):Lc(f.segments.at(-1)??""),[j,N]=P.useState(null),[T,C]=P.useState(null),[V,A]=P.useState(!1),[E,D]=P.useState(""),[I,R]=P.useState(!1),[$,B]=P.useState(null),[M,O]=P.useState(""),F=P.useRef(null),[U,K]=P.useState(!1),q=P.useRef(0),W=f.readOnly?null:f.volume,{upload:G,mkdir:Y,move:ee}=pu(W??hu),{remove:ne}=pu(j?.volume??"uploads");async function oe(X){if(!(!W||!X||X.length===0))try{await G.mutateAsync({dir:f.dirPath,files:[...X]}),ge.success(X.length===1?n("library.library.uploadedSingle",{filename:X[0]?.name??""}):n("library.library.uploadedMultiple",{count:X.length}))}catch(pe){ge.error(pe instanceof Error?pe.message:n("library.library.uploadFailed"))}finally{F.current&&(F.current.value="")}}const Z=W!==null;function J(X){return X.dataTransfer.types.includes("Files")}function H(X){!Z||!J(X)||(X.preventDefault(),q.current+=1,K(!0))}function se(X){!Z||!J(X)||X.preventDefault()}function Q(){Z&&(q.current=Math.max(0,q.current-1),q.current===0&&K(!1))}function ce(X){Z&&(X.preventDefault(),X.stopPropagation(),q.current=0,K(!1),X.dataTransfer.files.length>0&&oe(X.dataTransfer.files))}async function te(){const X=E.trim();if(!(!W||!X)){if(f.isHomeRoot&&Zm.has(X.toLowerCase())){ge.error(n("library.library.folderNameReserved",{name:X}));return}try{const pe=f.dirPath;await Y.mutateAsync(pe?`${pe}/${X}`:X),ge.success(n("library.library.folderCreated",{name:X})),A(!1),D("")}catch(pe){ge.error(pe instanceof Error?pe.message:n("library.library.folderCreateFailed"))}}}async function le(){if(!j)return;const X=j;try{await ne.mutateAsync(X.path),ge.success(n("library.library.deleted",{name:is(X.path)}))}catch(pe){ge.error(pe instanceof Error?pe.message:n("library.library.deleteFailed"))}finally{N(null)}}async function ue(){if(!$)return;const X=M.trim();if(!X||X.includes("/")||X.includes("..")||X===is($.path)){R(!1),B(null),O("");return}if($.kind==="dir"&&f.isHomeRoot&&Zm.has(X.toLowerCase())){ge.error(n("library.library.folderNameReserved",{name:X}));return}try{const pe=$.path.includes("/")?$.path.slice(0,$.path.lastIndexOf("/")):"",ye=pe?`${pe}/${X}`:X;await ee.mutateAsync({from:$.path,to:ye});const we=X.replace(/[<>]/g,"");ge.success(n("library.library.renamed",{name:we}))}catch(pe){ge.error(pe instanceof Error?pe.message:n("library.library.renameFailed"))}finally{R(!1),B(null),O("")}}async function fe(X,pe){try{const ye=is(X),we=pe?`${pe}/${ye}`:ye;await ee.mutateAsync({from:X,to:we}),ge.success(n("library.library.moved",{name:ye,destination:pe||n("library.library.theLibrary")}))}catch(ye){ge.error(ye instanceof Error?ye.message:n("library.library.moveFailed"))}}function ae(){for(const X of Ble)o.invalidateQueries({queryKey:Qe.orgFsVolume(i.id,X)});f.volume&&o.invalidateQueries({queryKey:Qe.orgFsVolume(i.id,f.volume)}),o.invalidateQueries({queryKey:Qe.orgFsRecent(i.id)}),o.invalidateQueries({queryKey:Qe.orgFsSearchRoot(i.id)}),o.invalidateQueries({queryKey:Qe.orgFsPublicSets(i.id)})}function de(X){X.defaultPrevented||!W||X.target.closest("input, textarea, button, a, [role='button']")||(X.preventDefault(),A(!0))}return r.jsxs("div",{className:"relative h-full",onDragEnter:H,onDragOver:se,onDragLeave:Q,onDrop:ce,onContextMenu:de,children:[U&&r.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[r.jsx(Yn,{size:28,className:"text-primary"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:w})})]})}),r.jsx("div",{className:"h-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:r.jsx(Kle,{segments:f.segments,onNavigate:p})}),r.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[r.jsx(Hf,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),r.jsx(gt,{value:L,onChange:X=>_(X.target.value),onKeyDown:X=>{X.key==="Escape"&&_("")},placeholder:k,className:"h-9 rounded-xl pr-9 pl-9"}),L&&r.jsx(he,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>_(""),"aria-label":n("library.library.clearSearch"),children:r.jsx(Li,{size:14})})]}),r.jsx(he,{variant:"ghost",size:"icon",onClick:ae,"aria-label":n("library.library.refresh"),children:r.jsx(Dn,{size:14})}),W&&r.jsxs(he,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[r.jsx(Ht,{size:14}),n("library.library.newFolder")]}),f.readOnly?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Bu,{size:12}),n("library.library.readOnly")]}):r.jsxs(he,{size:"sm",disabled:G.isPending,onClick:()=>F.current?.click(),children:[r.jsx(Yn,{size:14}),G.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),r.jsx("input",{ref:F,type:"file",multiple:!0,className:"hidden",onChange:X=>{oe(X.target.files)}})]}),y?r.jsx(Wle,{query:y,scope:S,stale:L.trim()!==y,onOpenFile:x,onShare:C,onDelete:N}):f.volume===null?r.jsx(Gle,{onOpenDir:p}):r.jsx(Yle,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:C,onDelete:N,onContextMenu:(X,pe)=>{B({path:X,kind:pe}),O(is(X)),R(!0)},onMove:fe},f.volume)]})}),a&&(c.preview?r.jsx(Uk,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?r.jsx(Hk,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?r.jsx(Fk,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),r.jsx(zt,{open:V,onOpenChange:A,children:r.jsxs(Bt,{children:[r.jsxs(os,{children:[r.jsx(Kt,{children:n("library.library.newFolderTitle")}),r.jsx(kn,{children:n("library.library.newFolderDescription",{path:w||n("library.library.theLibrary")})})]}),r.jsx(gt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:X=>D(X.target.value),onKeyDown:X=>{X.key==="Enter"&&te()}}),r.jsxs(qn,{children:[r.jsx(he,{variant:"outline",onClick:()=>A(!1),children:n("library.library.cancel")}),r.jsx(he,{disabled:!E.trim()||Y.isPending,onClick:()=>{te()},children:n("library.library.create")})]})]})}),r.jsx(zt,{open:I,onOpenChange:X=>{R(X),X||(B(null),O(""))},children:r.jsxs(Bt,{children:[r.jsxs(os,{children:[r.jsx(Kt,{children:$&&n("library.library.renameTitle",{name:is($.path)})}),r.jsx(kn,{children:n("library.library.renameDescription")})]}),r.jsx(gt,{autoFocus:!0,value:M,onChange:X=>O(X.target.value),onKeyDown:X=>{X.key==="Enter"&&ue()}}),r.jsxs(qn,{children:[r.jsx(he,{variant:"outline",onClick:()=>R(!1),children:n("library.library.cancel")}),r.jsx(he,{disabled:!M.trim()||ee.isPending,onClick:()=>{ue()},children:n("library.library.rename")})]})]})}),r.jsx(xle,{target:T,onOpenChange:X=>{X||C(null)}}),r.jsx(To,{open:j!==null,onOpenChange:X=>{X||N(null)},children:r.jsxs(Vo,{children:[r.jsxs(Ao,{children:[r.jsx(Po,{children:n("library.library.deleteTitle",{name:j?is(j.path):""})}),r.jsx(Eo,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),r.jsxs(Do,{children:[r.jsx(Ro,{children:n("library.library.cancel")}),r.jsx(Io,{onClick:()=>{le()},children:n("library.library.delete")})]})]})})]})}function tae(){const t=z.c(12),e=Yt(),[s,n]=P.useState(null),[i,o]=P.useState(null);let l;t[0]!==e?(l=f=>e({to:".",search:m=>({...m,main:f}),replace:!0}),t[0]=e,t[1]=l):l=t[1];const a=l;let c;t[2]!==a?(c=r.jsx(eae,{onOpenFile:f=>a(ST(f)),onOpenSkill:n,onOpenBrand:o}),t[2]=a,t[3]=c):c=t[3];let d;t[4]!==s?(d=s&&r.jsx(Hk,{skillPath:s,onClose:()=>n(null)},s),t[4]=s,t[5]=d):d=t[5];let u;t[6]!==i?(u=i&&r.jsx(Fk,{brandPath:i,onClose:()=>o(null)},i),t[6]=i,t[7]=u):u=t[7];let h;return t[8]!==c||t[9]!==d||t[10]!==u?(h=r.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[c,d,u]}),t[8]=c,t[9]=d,t[10]=u,t[11]=h):h=t[11],h}const Fb=P.lazy(()=>jn(()=>import("./project-app-view-Dh8z705d.js"),__vite__mapDeps([177,1,2,81,24,25,26,27,28,29,30,31,32,33,34,35,36,6,23,37,38,39,40,41,42,7,43,44,8,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,82,83,84,11,12,13,19,85,86,87,88,89,90,91,92,93,94,5,4,10,14,15,16,17,3,9,18,20,21,22,95,96,97,98,99,100,101,102,103,104,105,106,78,75,107,126,114,115,116,117,118,119,120,121,122,108,109,74,110,111,112,113,123,124,125,127,128,129,130,131,132,133,134,135,136,137,138,139,76,140,141,142,143,144,73,145,146,79,147,148,149,150,151,152,153,154,155,156,157,158,159])).then(t=>({default:t.AppViewContent})));function sae(t){const e=z.c(64),{activeTab:s,virtualMcpId:n,taskId:i,layoutTabs:o,expandedTools:l,automationTabParsed:a}=t;if(s==="overview"){let y;return e[0]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(PG,{}),e[0]=y):y=e[0],y}if(s==="board"){let y;return e[1]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:r.jsx(mY,{})}),e[1]=y):y=e[1],y}if(kT(s)){let y;return e[2]!==n?(y=r.jsx(A4,{virtualMcpId:n}),e[2]=n,e[3]=y):y=e[3],y}if(s==="git"){let y;return e[4]!==n?(y=r.jsx(XJ,{virtualMcpId:n}),e[4]=n,e[5]=y):y=e[5],y}if(s==="automations"){let y;return e[6]!==n?(y=r.jsx(qoe,{virtualMcpId:n}),e[6]=n,e[7]=y):y=e[7],y}if(s==="preview"){let y;return e[8]!==n?(y=r.jsx(zne,{virtualMcpId:n}),e[8]=n,e[9]=y):y=e[9],y}let c;e[10]!==s?(c=jT(s),e[10]=s,e[11]=c):c=e[11];const d=c;if(d){let y;return e[12]!==d.path?(y=r.jsx(Une,{openPath:d.path}),e[12]=d.path,e[13]=y):y=e[13],y}if(s==="content"){let y;return e[14]!==n?(y=r.jsx(toe,{virtualMcpId:n}),e[14]=n,e[15]=y):y=e[15],y}if(s==="assets"){let y;return e[16]!==n?(y=r.jsx(soe,{virtualMcpId:n}),e[16]=n,e[17]=y):y=e[17],y}if(s==="files"){let y;return e[18]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(tae,{}),e[18]=y):y=e[18],y}if(s==="reports"){let y;return e[19]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(rle,{}),e[19]=y):y=e[19],y}if(s==="connect-sources"){let y;return e[20]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(sle,{}),e[20]=y):y=e[20],y}if(a){let y;return e[21]!==s?(y=r.jsx(Foe,{tabId:s}),e[21]=s,e[22]=y):y=e[22],y}let u;e[23]!==s?(u=Jy(s),e[23]=s,e[24]=u):u=e[24];const h=u;if(h){let y;return e[25]!==h.path?(y=r.jsx(vle,{path:h.path},h.path),e[25]=h.path,e[26]=y):y=e[26],y}let f;e[27]!==s?(f=Yy(s),e[27]=s,e[28]=f):f=e[28];const m=f;if(m){let y;return e[29]!==m.key||e[30]!==i?(y=r.jsx(Zoe,{fileKey:m.key,taskId:i}),e[29]=m.key,e[30]=i,e[31]=y):y=e[31],y}let p;e[32]!==s?(p=Qy(s),e[32]=s,e[33]=p):p=e[33];const g=p;if(g){let y;return e[34]!==g.path?(y=r.jsx(wle,{path:g.path},g.path),e[34]=g.path,e[35]=y):y=e[35],y}let x;e[36]!==s?(x=CT(s),e[36]=s,e[37]=x):x=e[37];const b=x;if(b){let y;if(e[38]!==l||e[39]!==b.connectionId||e[40]!==b.toolName){let N;e[42]!==b.connectionId||e[43]!==b.toolName?(N=T=>T.appId===b.connectionId&&T.toolName===b.toolName,e[42]=b.connectionId,e[43]=b.toolName,e[44]=N):N=e[44],y=l.find(N),e[38]=l,e[39]=b.connectionId,e[40]=b.toolName,e[41]=y}else y=e[41];const S=y;let k;e[45]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(zr,{}),e[45]=k):k=e[45];const w=S?.args;let j;return e[46]!==s||e[47]!==b.connectionId||e[48]!==b.toolName||e[49]!==w?(j=r.jsx(P.Suspense,{fallback:k,children:r.jsx(Fb,{connectionId:b.connectionId,toolName:b.toolName,args:w},s)}),e[46]=s,e[47]=b.connectionId,e[48]=b.toolName,e[49]=w,e[50]=j):j=e[50],j}let v;if(e[51]!==s||e[52]!==o){let y;e[54]!==s?(y=S=>S.id===s,e[54]=s,e[55]=y):y=e[55],v=o.find(y),e[51]=s,e[52]=o,e[53]=v}else v=e[53];const L=v;if(L){let y;e[56]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(zr,{}),e[56]=y):y=e[56];let S;return e[57]!==s||e[58]!==L.id||e[59]!==L.view.appId||e[60]!==L.view.args?(S=r.jsx(P.Suspense,{fallback:y,children:r.jsx(Fb,{connectionId:L.view.appId,toolName:L.id,args:L.view.args},s)}),e[57]=s,e[58]=L.id,e[59]=L.view.appId,e[60]=L.view.args,e[61]=S):S=e[61],S}let _;return e[62]!==n?(_=r.jsx(A4,{virtualMcpId:n}),e[62]=n,e[63]=_):_=e[63],_}function nae(t){const e=z.c(14),{taskId:s,virtualMcpId:n}=t;let i;e[0]!==s||e[1]!==n?(i={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=i):i=e[2];const{activeTab:o,layoutTabs:l,expandedTools:a,automationTabParsed:c}=Vg(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(zr,{}),e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(u=r.jsx(P.Suspense,{fallback:d,children:r.jsx(sae,{activeTab:o,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=o,e[5]=c,e[6]=a,e[7]=l,e[8]=s,e[9]=n,e[10]=u):u=e[10];let h;return e[11]!==o||e[12]!==u?(h=r.jsx(Ws,{children:u},o),e[11]=o,e[12]=u,e[13]=h):h=e[13],h}function iae(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&NT.has(t.mainTab))}const vl="setup";function rae(t){const e=z.c(57),s=re();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let _;e[3]!==t.scriptTabs?(_=y=>!t.scriptTabs.includes(y),e[3]=t.scriptTabs,e[4]=_):_=e[4],n=t.scripts.filter(_),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let o;e[5]!==t?(o=()=>{t.active===vl?t.onToggle():t.onSelectTab(vl)},e[5]=t,e[6]=o):o=e[6];const l=o;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?r.jsx(_s,{className:"size-4"}):r.jsx(a8,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==a||e[15]!==c?(d=r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let h;e[20]!==u?(h=r.jsx(Ke,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=r.jsxs(We,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===vl;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=r.jsx(oae,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(_=>r.jsx(aae,{active:t.active===_,onClick:()=>{t.active===_?t.onToggle():t.onSelectTab(_)},onClose:()=>t.onCloseScript(_),t:s,children:_},_)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=r.jsx(cae,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==p?(b=r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,e[39]=b):b=e[39];let v;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(v=t.showScriptControls?r.jsx(dae,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):r.jsx(lae,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let L;return e[53]!==b||e[54]!==v||e[55]!==f?(L=r.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=L):L=e[56],L}function oae(t){const e=z.c(11),{active:s,open:n,onClick:i,t:o}=t,l=s&&n,a=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=ie("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(qA,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==o?(h=o("sandbox.toolbar.setupTab"),e[3]=o,e[4]=h):h=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==h?(f=r.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[u,h]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f):f=e[10],f}function lae(t){const e=z.c(40),{status:s,onStart:n,onStop:i,onRestart:o,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(wl,{className:"size-3.5"}),e[0]=d):d=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let h;return e[3]!==n||e[4]!==u?(h=r.jsxs(he,{variant:"outline",size:"xs",onClick:n,children:[d," ",u]}),e[3]=n,e[4]=u,e[5]=h):h=e[5],h}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(wl,{className:"size-3.5"}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let h;return e[9]!==l||e[10]!==u?(h=r.jsxs(he,{variant:"outline",size:"xs",onClick:l,children:[d," ",u]}),e[9]=l,e[10]=u,e[11]=h):h=e[11],h}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Dn,{className:"size-3.5"}),e[12]=d):d=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let h;return e[15]!==a||e[16]!==u?(h=r.jsxs(he,{variant:"outline",size:"xs",onClick:a,children:[d," ",u]}),e[15]=a,e[16]=u,e[17]=h):h=e[17],h}if(s==="starting"||s==="running"){const d=s==="running"&&!!o,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=ie(u),e[18]=u,e[19]=h):h=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==i||e[23]!==h||e[24]!==f?(m=r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",onClick:i,className:h,children:f})}),e[22]=i,e[23]=h,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=r.jsx(Ke,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=r.jsxs(We,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==o||e[34]!==d||e[35]!==c?(b=d&&r.jsxs(Xt,{children:[r.jsx(Zt,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",className:"rounded-l-none px-1",children:r.jsx(_s,{className:"size-3"})})}),r.jsx(es,{align:"end",children:r.jsxs(Xe,{onClick:o,children:[r.jsx(Dn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=o,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=r.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function aae(t){const e=z.c(17),{active:s,onClick:n,onClose:i,children:o,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=ie("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let h;e[2]!==d||e[3]!==u?(h=ie("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==o||e[6]!==n||e[7]!==h?(f=r.jsx("button",{type:"button",onClick:n,className:h,children:o}),e[5]=o,e[6]=n,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==o||e[10]!==i||e[11]!==l?(m=i&&r.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(o)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:r.jsx(Is,{className:"size-3.5"})}),e[9]=o,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=r.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function cae(t){const e=z.c(27),{scripts:s,onRun:n}=t,i=re(),[o,l]=P.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=r.jsx(Ht,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=r.jsx(He,{asChild:!0,children:r.jsx(ms,{asChild:!0,children:r.jsx(he,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let u;e[5]!==i?(u=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=r.jsx(Ke,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=r.jsxs(We,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=r.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(v=>r.jsxs("button",{type:"button",onClick:()=>{l(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==p||e[21]!==g?(x=r.jsxs(bs,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==o||e[24]!==x||e[25]!==f?(b=r.jsxs(vs,{open:o,onOpenChange:l,children:[f,x]}),e[23]=o,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function dae(t){const e=z.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:o,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(lt,{className:"size-3.5 animate-spin"}),e[0]=f):f=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=r.jsxs(he,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=r.jsx(wl,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=r.jsx(He,{asChild:!0,children:r.jsxs(he,{variant:"outline",size:"xs",onClick:i,children:[f," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=r.jsx(Ke,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=r.jsxs(We,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==o||e[21]!==a?(c=r.jsx(He,{asChild:!0,children:r.jsx(he,{variant:"outline",size:"xs",onClick:o,children:a})}),e[20]=o,e[21]=a,e[22]=c):c=e[22];let d;e[23]!==l?(d=l("sandbox.toolbar.stopProcess"),e[23]=l,e[24]=d):d=e[24];let u;e[25]!==d?(u=r.jsx(Ke,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=r.jsxs(We,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var qk=Object.defineProperty,uae=Object.getOwnPropertyDescriptor,hae=(t,e)=>{for(var s in e)qk(t,s,{get:e[s],enumerable:!0})},Vs=(t,e,s,n)=>{for(var i=n>1?void 0:n?uae(e,s):e,o=t.length-1,l;o>=0;o--)(l=t[o])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&qk(e,s,i),i},Ge=(t,e)=>(s,n)=>e(s,n,t),Ub="Terminal input",ep={get:()=>Ub,set:t=>Ub=t},Hb="Too much output to announce, navigate to rows manually to read",tp={get:()=>Hb,set:t=>Hb=t};function fae(t){return t.replace(/\r?\n/g,"\r")}function mae(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function pae(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function gae(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");Gk(i,e,s,n)}}function Gk(t,e,s,n){t=fae(t),t=mae(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Yk(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,o=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function Kb(t,e,s,n,i){Yk(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function mo(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function T9(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let o=t[i];o>65535?(o-=65536,n+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):n+=String.fromCharCode(o)}return n}var xae=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i=0;if(this._interim){let o=t.charCodeAt(i++);56320<=o&&o<=57343?e[n++]=(this._interim-55296)*1024+o-56320+65536:(e[n++]=this._interim,e[n++]=o),this._interim=0}for(let o=i;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return this._interim=l,n;let a=t.charCodeAt(o);56320<=a&&a<=57343?e[n++]=(l-55296)*1024+a-56320+65536:(e[n++]=l,e[n++]=a);continue}l!==65279&&(e[n++]=l)}return n}},bae=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i,o,l,a,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let u=s-4,h=d;for(;h<s;){for(;h<u&&!((i=t[h])&128)&&!((o=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=o,e[n++]=l,e[n++]=a,h+=4;if(i=t[h++],i<128)e[n++]=i;else if((i&224)===192){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(c=(i&31)<<6|o&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(c=(i&15)<<12|(o&63)<<6|l&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(h>=s)return this.interim[0]=i,n;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=o,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(o&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Jk="",vo=" ",r0=class Qk{constructor(){this.fg=0,this.bg=0,this.extended=new of}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Qk;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},of=class Xk{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Xk(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},li=class Zk extends r0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new of,this.combinedData=""}static fromCharData(e){let s=new Zk;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?mo(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Wb="di$target",sp="di$dependencies",I1=new Map;function vae(t){return t[sp]||[]}function on(t){if(I1.has(t))return I1.get(t);let e=function(s,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");yae(e,s,i)};return e._id=t,I1.set(t,e),e}function yae(t,e,s){e[Wb]===e?e[sp].push({id:t,index:s}):(e[sp]=[{id:t,index:s}],e[Wb]=e)}var Vn=on("BufferService"),ej=on("CoreMouseService"),Jl=on("CoreService"),_ae=on("CharsetService"),q3=on("InstantiationService"),tj=on("LogService"),An=on("OptionsService"),sj=on("OscLinkService"),Lae=on("UnicodeService"),o0=on("DecorationService"),np=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,o=new li,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let u=0;u<l;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=u,a=o.extended.urlId;continue}else d=o.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&u===l-1){let h=this._oscLinkService.getLinkData(a)?.uri;if(h){let f={start:{x:c+1,y:t},end:{x:u+(!d&&u===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(h);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:h,range:f,activate:(p,g)=>i?i.activate(p,g,f):wae(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=u,a=o.extended.urlId):(c=-1,a=-1)}}e(n)}};np=Vs([Ge(0,Vn),Ge(1,An),Ge(2,sj)],np);function wae(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
726
726
|
|
|
727
727
|
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var V9=on("CharSizeService"),Ur=on("CoreBrowserService"),G3=on("MouseService"),Hr=on("RenderService"),Sae=on("SelectionService"),nj=on("CharacterJoinerService"),ld=on("ThemeService"),ij=on("LinkProviderService"),kae=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?qb.isErrorNoTelemetry(t)?new qb(t.message+`
|
|
728
728
|
|