decocms 4.97.0 → 4.97.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-Bd2je-cB.js → AlertCircle-C4BWLdJ4.js} +1 -1
- package/dist/client/assets/{AreaChart-DkKq49Dt.js → AreaChart-2lzk5ej3.js} +1 -1
- package/dist/client/assets/{ArrowRight-B3m2pN9y.js → ArrowRight-qJlbKSrg.js} +1 -1
- package/dist/client/assets/{ArrowUp-BX_bEaFr.js → ArrowUp-BVYSfKPB.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CjNCKllv.js → ArrowUpRight-CZ2fIDWv.js} +1 -1
- package/dist/client/assets/{Check-D2tgQYUH.js → Check-CymDPtaz.js} +1 -1
- package/dist/client/assets/{CheckCircle-CBRH3j7M.js → CheckCircle-CeUlzZCm.js} +1 -1
- package/dist/client/assets/{ChevronDown-fdV9phBI.js → ChevronDown-B6-w9q8W.js} +1 -1
- package/dist/client/assets/{ChevronRight-BwJinQig.js → ChevronRight-DEIr6kW5.js} +1 -1
- package/dist/client/assets/{ChevronUp-Cp7VgDYd.js → ChevronUp-C_eomkpm.js} +1 -1
- package/dist/client/assets/{Copy01-DKnyVR5P.js → Copy01-R8AR2-1c.js} +1 -1
- package/dist/client/assets/{DotsVertical-Dzuqk0dy.js → DotsVertical-C3MnHRz8.js} +1 -1
- package/dist/client/assets/{Eye-DCD7YeTq.js → Eye-CE-cR8Oa.js} +1 -1
- package/dist/client/assets/{FilterLines-ZJaYu41j.js → FilterLines-D4J8LYhW.js} +1 -1
- package/dist/client/assets/{Globe01-DAdWNRRf.js → Globe01-hVg4-cH5.js} +1 -1
- package/dist/client/assets/{Globe04-jH-buQSM.js → Globe04-D5VJ_hkz.js} +1 -1
- package/dist/client/assets/{HardDrive-C6kdD_or.js → HardDrive-zN0Is6H-.js} +1 -1
- package/dist/client/assets/{Image01-BZrsIdRq.js → Image01-DG088yrA.js} +1 -1
- package/dist/client/assets/{Key01-C52Q4uIO.js → Key01-CHhJPyPs.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DnxqkwQW.js → LayoutLeft-C4fmYl61.js} +1 -1
- package/dist/client/assets/{LinkExternal01-Wx2zOa0M.js → LinkExternal01-DuSi53Ey.js} +1 -1
- package/dist/client/assets/{Monitor01-C0a3JFIF.js → Monitor01-D09qwZZ1.js} +1 -1
- package/dist/client/assets/{Package-BMVPvtc2.js → Package-oKuIYsv6.js} +1 -1
- package/dist/client/assets/{Palette-CxniLd-o.js → Palette-DxnkmeGc.js} +1 -1
- package/dist/client/assets/{Play-w51jOoUp.js → Play-BMDEoRJl.js} +1 -1
- package/dist/client/assets/{Plus-4_6KGqAm.js → Plus-D7pYKUsO.js} +1 -1
- package/dist/client/assets/{SearchLg-C__tBoev.js → SearchLg-C42MXEKt.js} +1 -1
- package/dist/client/assets/{SearchMd-Bjx-Ezhm.js → SearchMd-CP6wLgs6.js} +1 -1
- package/dist/client/assets/{Settings02-BrCvCp5i.js → Settings02-BbDm-Ne4.js} +1 -1
- package/dist/client/assets/{Shield01-qenJwry0.js → Shield01-CjiZhLxU.js} +1 -1
- package/dist/client/assets/{Star01-DTaYFGW8.js → Star01-DZ_3ux8i.js} +1 -1
- package/dist/client/assets/{Stars01-B0-XrNtW.js → Stars01-JDxcV7AF.js} +1 -1
- package/dist/client/assets/{Stars02-BgeAl4Qn.js → Stars02-CmhbeIDG.js} +1 -1
- package/dist/client/assets/{Sun-hd0x8f6o.js → Sun-DoaIj1xZ.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-D-4Z1b7Y.js → SwitchHorizontal01-CRibS_Zy.js} +1 -1
- package/dist/client/assets/{Tool01-tywbntXa.js → Tool01-DMTzqx5i.js} +1 -1
- package/dist/client/assets/{Tool02-Wk4yDDov.js → Tool02-DGUi9uKr.js} +1 -1
- package/dist/client/assets/{Trash01-BsXCUP-i.js → Trash01-D08DuleC.js} +1 -1
- package/dist/client/assets/{TrendUp01-D5MsRGsy.js → TrendUp01-B8sZVpOQ.js} +1 -1
- package/dist/client/assets/{Upload01-0iT0HtnC.js → Upload01-kJs7y_sS.js} +1 -1
- package/dist/client/assets/{User01-DtOpMbkt.js → User01-9n6b7RP1.js} +1 -1
- package/dist/client/assets/{Users01-DMwOx9vc.js → Users01-ZUQPsXZL.js} +1 -1
- package/dist/client/assets/{Users03-BmV8-N2x.js → Users03-CjXk-r9i.js} +1 -1
- package/dist/client/assets/{X-7dFtnplq.js → X-_ogr2Thx.js} +1 -1
- package/dist/client/assets/{XCircle-D8OccAXi.js → XCircle-Ojqttb4K.js} +1 -1
- package/dist/client/assets/{XClose-DSE0di54.js → XClose-C5Joak01.js} +1 -1
- package/dist/client/assets/{Zap-B6QwOIS_.js → Zap-CVYBhiGb.js} +1 -1
- package/dist/client/assets/{ZapSquare-17EeYv3v.js → ZapSquare-DuoaxuW6.js} +1 -1
- package/dist/client/assets/{ZoomOut-D9ex4vS_.js → ZoomOut-6evm9HJr.js} +1 -1
- package/dist/client/assets/{access-gate-DXoDxMVR.js → access-gate-CROyFBNQ.js} +1 -1
- package/dist/client/assets/{add-section-modal-BpHEb3lJ.js → add-section-modal-Dtdlek5H.js} +1 -1
- package/dist/client/assets/{agent-icon-CBgtoGMX.js → agent-icon-BBgjEkV0.js} +1 -1
- package/dist/client/assets/{agents-list-Dddq1Msf.js → agents-list-B2pe35L-.js} +1 -1
- package/dist/client/assets/{ai-providers-P0-WJLOi.js → ai-providers-C3odtRrl.js} +1 -1
- package/dist/client/assets/{alert-BByhYQNr.js → alert-Be-D3J6_.js} +1 -1
- package/dist/client/assets/{alert-dialog-fG87PlMu.js → alert-dialog-C2Bqhcmc.js} +1 -1
- package/dist/client/assets/{app-editor-B__C85yJ.js → app-editor-B3Nz7_-S.js} +1 -1
- package/dist/client/assets/{auth-BCM-D-sZ.js → auth-BU8dnKUI.js} +1 -1
- package/dist/client/assets/{auth-catchall-DYS0sjFC.js → auth-catchall-EXC_8C7r.js} +1 -1
- package/dist/client/assets/{auth-entry-COqZ5J_j.js → auth-entry-A7pTSp0P.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BB66Mf5-.js → auth-split-layout-C7ta0NVe.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-opWpqR2L.js → authenticate-and-persist-oauth-CXoW_w5W.js} +1 -1
- package/dist/client/assets/{automation-list-row-DqJTJ5Fa.js → automation-list-row-DRyf2mOg.js} +1 -1
- package/dist/client/assets/{automation-runs-BGHwnlly.js → automation-runs-U2tWrOBe.js} +1 -1
- package/dist/client/assets/{automations-BuTICk23.js → automations-Dd_qxkUk.js} +1 -1
- package/dist/client/assets/{autosend-BiG6REcJ.js → autosend-DZWEI21D.js} +1 -1
- package/dist/client/assets/{avatar-s4UNM9aY.js → avatar-UzWl0gwW.js} +1 -1
- package/dist/client/assets/{badge-PYjH4nYt.js → badge-Baw1FT-S.js} +1 -1
- package/dist/client/assets/{block-document-DBOT6_gI.js → block-document-Bo4gMMfS.js} +1 -1
- package/dist/client/assets/{brand-context-DnsRF8H_.js → brand-context-CG5th-2x.js} +1 -1
- package/dist/client/assets/{buckets-DLoORNrW.js → buckets-t5T7X7Zi.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-DAAtpJSk.js → bulk-category-panel-BcmvRZsS.js} +1 -1
- package/dist/client/assets/{calendar-DfhmE6yT.js → calendar-CDlXA0Du.js} +1 -1
- package/dist/client/assets/{capability-load-error-Bn9UXp0u.js → capability-load-error-KKdV9Q3l.js} +1 -1
- package/dist/client/assets/{card-C13XWIUN.js → card-zoyg0nhK.js} +1 -1
- package/dist/client/assets/{category-editor-wH2VReWY.js → category-editor-B3YyI2nN.js} +1 -1
- package/dist/client/assets/{chat-context-BZvh6FK5.js → chat-context-DUAqM3BL.js} +1 -1
- package/dist/client/assets/{checkbox-JZqnAqSI.js → checkbox-FmmsZFBn.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CNyVYBLj.js → cli-auth-success-C8PJDHgg.js} +1 -1
- package/dist/client/assets/{collection-detail-b0JpGJaa.js → collection-detail-DFnnR_Ed.js} +1 -1
- package/dist/client/assets/{collection-display-button-Du96-XRG.js → collection-display-button-O06UP2ip.js} +1 -1
- package/dist/client/assets/{collection-search-Kebpqtb4.js → collection-search-zof41lOw.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-HnUWREyd.js → collection-table-wrapper-zYN8dorL.js} +1 -1
- package/dist/client/assets/{collection-tabs-dO0ZeTCK.js → collection-tabs-CgqHDjS1.js} +1 -1
- package/dist/client/assets/{command-BL0tcMY4.js → command-rWYtUR5c.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-DBCFgq_L.js → commerce-onboarding-C645w_Mz.js} +1 -1
- package/dist/client/assets/{companions-core-CjZn6xwq.js → companions-core-sVa6Qw5T.js} +1 -1
- package/dist/client/assets/{connect-C4NXK81G.js → connect-D8942-MM.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-CxFuoeWg.js → connect-desktop-dialog-DxGAbniS.js} +1 -1
- package/dist/client/assets/{connection-card-DLNA5dfk.js → connection-card-Dz1fwerM.js} +1 -1
- package/dist/client/assets/{connection-detail-CNKK0Uwv.js → connection-detail-DbXXUV2H.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-zSgiw1Xk.js → connection-form-helpers-C_ssxiIn.js} +1 -1
- package/dist/client/assets/{connections-ywSL5h_0.js → connections-CLeMA5sw.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-CGqNc25D.js → decopilot-sse-pool-yan_82bi.js} +1 -1
- package/dist/client/assets/{dialog-DcrYgOGO.js → dialog-BhvH5UUY.js} +1 -1
- package/dist/client/assets/{domain-settings-B-LvwXmr.js → domain-settings-aEds6nPr.js} +1 -1
- package/dist/client/assets/{drawer-CiGyGKLQ.js → drawer-Clee3MiY.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DM7-k3j8.js → dropdown-menu-CJMe9yFA.js} +1 -1
- package/dist/client/assets/{empty-state-CAArqFDh.js → empty-state-YC9UCU06.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CiMQ0W6r.js → extract-connection-data-CRUudyOW.js} +1 -1
- package/dist/client/assets/{file-explorer-BA8hwotg.js → file-explorer-xqvaLr55.js} +1 -1
- package/dist/client/assets/{file-type-icon-CGnLW73f.js → file-type-icon-Wt0fW6Db.js} +1 -1
- package/dist/client/assets/{files-_XaDqqBq.js → files-PO932eji.js} +1 -1
- package/dist/client/assets/{form-D8CrSgsK.js → form-C5iFi2jZ.js} +1 -1
- package/dist/client/assets/{general-CCnrBM4Q.js → general-BcJnDe6x.js} +1 -1
- package/dist/client/assets/{github-repo-picker-CFEcOj4_.js → github-repo-picker-C6QGF-3R.js} +1 -1
- package/dist/client/assets/{hooks-DG6vcDwp.js → hooks-2c34l0ae.js} +1 -1
- package/dist/client/assets/{index-DTSNAVPl.js → index-BWC7sFp_.js} +3 -3
- package/dist/client/assets/{index-DuYNJaWj.js → index-BZKh5x8S.js} +3 -3
- package/dist/client/assets/{index-CNx7TmSm.js → index-CAwc9d0_.js} +1 -1
- package/dist/client/assets/{index-P1IoZ6NC.js → index-CDy6bFpC.js} +1 -1
- package/dist/client/assets/{index-Ba2odJdj.js → index-CHtFJlMs.js} +1 -1
- package/dist/client/assets/{index-DD73prpg.js → index-D0YUP6cD.js} +1 -1
- package/dist/client/assets/{index-Cmqa6FM3.js → index-D3Egmveq.js} +1 -1
- package/dist/client/assets/{index-By-VEKbQ.js → index-D4LYwylo.js} +1 -1
- package/dist/client/assets/{index-sjUL2IyD.js → index-DXU-zOnf.js} +1 -1
- package/dist/client/assets/{index-CJX4eGgf.js → index-DdFBHhSl.js} +1 -1
- package/dist/client/assets/{index-bIZkhTe1.js → index-Dha2A-8H.js} +1 -1
- package/dist/client/assets/{index-CrKZ9p2A.js → index-DkqrfhJp.js} +23 -23
- package/dist/client/assets/{index-DrYcM1UE.js → index-_4qsQ90U.js} +1 -1
- package/dist/client/assets/{index-redirect-DBTS2dnX.js → index-redirect-Bsk6Qi8z.js} +1 -1
- package/dist/client/assets/{index-CWEbo3GV.js → index-uvwA1VZB.js} +1 -1
- package/dist/client/assets/{input-BdGe86G9.js → input-Dwgjs0Me.js} +1 -1
- package/dist/client/assets/{integration-icon-Big2E16J.js → integration-icon-9QXIMfmD.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-CEz5eU9_.js → invite-member-dialog-CVfjEmwU.js} +1 -1
- package/dist/client/assets/{label-Cgcr_E3j.js → label-BK6sLMEK.js} +1 -1
- package/dist/client/assets/{layout-CSu6vzzu.js → layout-BL3WnOhQ.js} +1 -1
- package/dist/client/assets/{login-CZQugvTf.js → login-4_3ws-KS.js} +1 -1
- package/dist/client/assets/{mcp-oauth-6rvqQnMK.js → mcp-oauth-CCJ1wn2F.js} +1 -1
- package/dist/client/assets/{members-DUgIby8N.js → members-DBEjnYOy.js} +1 -1
- package/dist/client/assets/{monaco-editor-WB9KR-bw.js → monaco-editor-dhKEhAZV.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CK9Bvug8.js → monitoring-stats-row-BbVanr4F.js} +1 -1
- package/dist/client/assets/{multi-select-CLT6Otb5.js → multi-select-BR19LYze.js} +1 -1
- package/dist/client/assets/{oauth-callback-BHatfLrm.js → oauth-callback-Dvq5W1_N.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DqZYel48.js → oauth-callback-ai-provider-DbmJB-Oh.js} +1 -1
- package/dist/client/assets/{onboarding-DMLJT3my.js → onboarding-C8unJq0w.js} +1 -1
- package/dist/client/assets/{org-install-DRMyhX7p.js → org-install--ffHoCdp.js} +1 -1
- package/dist/client/assets/{org-layout-BS9LHZZk.js → org-layout-A8-sPwxd.js} +1 -1
- package/dist/client/assets/{organization-choice-CfBex73s.js → organization-choice-DtcC4Aee.js} +1 -1
- package/dist/client/assets/{orgs-Bk041H2L.js → orgs-DzN52fjP.js} +1 -1
- package/dist/client/assets/{page-seo-form-Cj05veVk.js → page-seo-form-CQiZ7Ngj.js} +1 -1
- package/dist/client/assets/page-seo-sheet-Cr5zp_Qx.js +1 -0
- package/dist/client/assets/{popover-C-6PWHh6.js → popover-C35uikDd.js} +1 -1
- package/dist/client/assets/{post-editor-CE149ctZ.js → post-editor-Bhd63YjE.js} +1 -1
- package/dist/client/assets/{primitives-91hU5Z7J.js → primitives-BcOXHRHh.js} +1 -1
- package/dist/client/assets/{profile-CSuugqqH.js → profile-D7z_2Q-S.js} +1 -1
- package/dist/client/assets/project-app-view-ByXtWSB_.js +1 -0
- package/dist/client/assets/record-editor-CzCU9PKr.js +1 -0
- package/dist/client/assets/{redirect-editor-CJc-xlJz.js → redirect-editor-mfOHOEeZ.js} +1 -1
- package/dist/client/assets/registry-BeUPIlNQ.js +2 -0
- package/dist/client/assets/{registry-layout-FcawRTNb.js → registry-layout-BmXDtVhQ.js} +1 -1
- package/dist/client/assets/{reports-BVWlDfnl.js → reports-Ch_0FWNX.js} +1 -1
- package/dist/client/assets/{require-capability-C7jVivWE.js → require-capability-BudvvNO5.js} +1 -1
- package/dist/client/assets/{required-auth-layout-ChqmDC9P.js → required-auth-layout-BrqitDmd.js} +1 -1
- package/dist/client/assets/{reset-password-DG3AimDG.js → reset-password-BbJbIECY.js} +1 -1
- package/dist/client/assets/{roles-BLXYMTam.js → roles-BNyb78Mb.js} +1 -1
- package/dist/client/assets/{search-input-3Pf6pH5A.js → search-input-Ccf8_eUm.js} +1 -1
- package/dist/client/assets/{secrets-DCWr6KKP.js → secrets-BzFJ43TI.js} +1 -1
- package/dist/client/assets/{sections-editor-BcPEsHf_.js → sections-editor-CPeM3Vti.js} +1 -1
- package/dist/client/assets/{select-model-D1cAmSQ6.js → select-model-gBHKlDIm.js} +1 -1
- package/dist/client/assets/{select-B4JKzLFi.js → select-uGrWbEMz.js} +1 -1
- package/dist/client/assets/{self-tool-result-Di9p13rl.js → self-tool-result-mjYjIdAR.js} +1 -1
- package/dist/client/assets/{seo-editor-CKU5zr_C.js → seo-editor-C6FBYCud.js} +1 -1
- package/dist/client/assets/{settings-layout-D6hkxbEw.js → settings-layout-DenVW1V_.js} +1 -1
- package/dist/client/assets/{settings-section-_-AGRPcy.js → settings-section-B8q2fbg4.js} +1 -1
- package/dist/client/assets/{shell-controls-DV44OB4-.js → shell-controls-ChkZgq-8.js} +1 -1
- package/dist/client/assets/{shell-layout-Ch3Kdb2k.js → shell-layout-Mucs34pV.js} +1 -1
- package/dist/client/assets/{sidebar-CGmVx26g.js → sidebar-Dv_H2jfW.js} +1 -1
- package/dist/client/assets/{skeleton-DA69b9Wr.js → skeleton-CEv-QtIz.js} +1 -1
- package/dist/client/assets/{sso-C2xzeJdb.js → sso-NPY_FcmV.js} +1 -1
- package/dist/client/assets/{store-BMPIzDfO.js → store-DvLImTcn.js} +1 -1
- package/dist/client/assets/store-registry-DkfCPpEE.js +2 -0
- package/dist/client/assets/{studio-tools-DH6NZyDA.js → studio-tools-DqyzSTaT.js} +1 -1
- package/dist/client/assets/{switch-Q9YYQF-D.js → switch-BQHSVMIs.js} +1 -1
- package/dist/client/assets/{table-CfqsJ4MB.js → table-CbpS0yp4.js} +1 -1
- package/dist/client/assets/{tabs-BQ7JKlxy.js → tabs-_KEklsIu.js} +1 -1
- package/dist/client/assets/{textarea-C3kqBFbl.js → textarea-D2K-qpEF.js} +1 -1
- package/dist/client/assets/{toggle-group-nPxCt6Jp.js → toggle-group-DZVcSFOA.js} +1 -1
- package/dist/client/assets/{toolbar-Clo_BDTH.js → toolbar-cItkaIEN.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-BX96U1pB.js → toolbar-icon-button-CmxseXuq.js} +1 -1
- package/dist/client/assets/{tooltip-B7vNT4Wn.js → tooltip-BmutXqWI.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CXjJzhnn.js → use-ai-providers-Dp6I5-8x.js} +1 -1
- package/dist/client/assets/{use-api-keys-CXczE1W-.js → use-api-keys-BNoqdZYe.js} +1 -1
- package/dist/client/assets/{use-automations-Do-o7Cxb.js → use-automations-zyl04vpa.js} +1 -1
- package/dist/client/assets/{use-autosave-PZsHxMCn.js → use-autosave-DxV5LsO-.js} +1 -1
- package/dist/client/assets/{use-capability-Dq-tRDHt.js → use-capability-B1l0lZqa.js} +1 -1
- package/dist/client/assets/{use-clock-tick-D7I7V0Ju.js → use-clock-tick-Bn8KTZQB.js} +1 -1
- package/dist/client/assets/{use-connection-izdZyOnV.js → use-connection-Db71aL_l.js} +1 -1
- package/dist/client/assets/{use-copy-1vVQnABW.js → use-copy-C9WCw_xQ.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BSXse2zg.js → use-create-virtual-mcp-B9oPChqg.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CI2n3xys.js → use-debounced-autosave-CF3nwEaJ.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CT_IuBiB.js → use-debounced-value-CmRylZJc.js} +1 -1
- package/dist/client/assets/{use-deco-credits-BF7U8JvI.js → use-deco-credits-CNlP8bKq.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-B96U5En2.js → use-decopilot-events-JGRwbLqN.js} +1 -1
- package/dist/client/assets/{use-delete-connection-DBawRcCu.js → use-delete-connection-Bbxuu1s-.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-CUUSn6dj.js → use-deployment-admin-Dd6ryBl2.js} +1 -1
- package/dist/client/assets/{use-file-configs-C96LPzgL.js → use-file-configs-BNgMZFIO.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DY0dMYA5.js → use-infinite-scroll-C9CrduD1.js} +1 -1
- package/dist/client/assets/{use-join-requests-Csi6FNCn.js → use-join-requests-pdqNaIsl.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-D9hbRmwN.js → use-mcp-auth-status-B8Ydhf-J.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CK5FwAgP.js → use-mcp-client-BfCXL7Ea.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DH1nvHw6.js → use-mcp-tools-Dmvh1NTU.js} +1 -1
- package/dist/client/assets/{use-members-DPDLUppt.js → use-members-DHjn4tSi.js} +1 -1
- package/dist/client/assets/{use-mobile-CM0mnPGe.js → use-mobile-D2X5CiwU.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-01oF9O4S.js → use-navigate-to-agent-BRmHvfMz.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-hoHI_uNL.js → use-org-auth-client-Y3lH7Le-.js} +1 -1
- package/dist/client/assets/{use-org-sso-DN8pMR44.js → use-org-sso-C63dt58J.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BN8Am-n3.js → use-organization-roles-DAWTrk9s.js} +1 -1
- package/dist/client/assets/{use-organization-settings-AcZ5yHOA.js → use-organization-settings-DdWAi5Fa.js} +1 -1
- package/dist/client/assets/{use-registry-app-D12nnqOT.js → use-registry-app-DhV6qG8g.js} +1 -1
- package/dist/client/assets/{use-registry-connections-BHwKxFqZ.js → use-registry-connections-B2LAq4ux.js} +1 -1
- package/dist/client/assets/{use-secrets-DD1VUOqY.js → use-secrets-C2rRzzPu.js} +1 -1
- package/dist/client/assets/{use-status-sounds-qQ1ObLCw.js → use-status-sounds-K0-7jWPp.js} +1 -1
- package/dist/client/assets/{use-view-mode-BzqQNiAl.js → use-view-mode-BSR8qosx.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-LDXRrLYA.js → use-virtual-mcp-B4R9Gg2E.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-B4u61JTE.js +1 -0
- package/dist/client/assets/{useRouterState-Cn-TDa5k.js → useRouterState-DfytzR2p.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-S8U9qcL-.js +1 -0
- package/dist/client/assets/{users-0Wdq7G49.js → users-K-MwRA9n.js} +1 -1
- package/dist/client/assets/{variant-calendar-DRgjJZhh.js → variant-calendar-BVVOn_dO.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-xUW46ArQ.js → view-mode-toggle-B1kegHzc.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/page-seo-sheet-4JLrA_Q_.js +0 -1
- package/dist/client/assets/project-app-view-CjPSyHhT.js +0 -1
- package/dist/client/assets/record-editor-CBqFE4_t.js +0 -1
- package/dist/client/assets/registry-Bn6rObQg.js +0 -2
- package/dist/client/assets/store-registry-DQmSIxU0.js +0 -2
- package/dist/client/assets/useInfiniteQuery-BAbHKPGb.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BAfqpdKf.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as He,i as at,r as V,m as Be,j as s,B as qe,k as Hs,o as xa,t as Q,K as ba}from"./index-DTSNAVPl.js";import{a1 as ya,a2 as _a,a3 as ja,H as Gs,J as Jt,K as Ws,P as Us,i as qs,a4 as Ea,V as Js,W as Ys,a5 as ka,a6 as Ra,G as wa,L as Qs,M as Pt,Q as Xs,U as Zs,N as en,_ as tn,a7 as sn,a8 as Va,a9 as Ct,aa as Na,S as nn,ab as nt,ac as Da,ad as Ta,ae as Pa,af as Ca,e as Aa,k as Ma,ag as Ka,ah as La,ai as Fa,aj as Ba,r as Ht,ak as Gt,al as Oa,am as ht,an as Nt,ao as Ia,ap as $a,aq as Xe,ar as Ts,as as za,at as Dt,au as Wt,av as Ha,aw as cs,ax as Ga,ay as kt,az as Wa,aA as Ua,aB as qa,aC as Ja,aD as Ya,aE as vt,aF as Qa,aG as Xa,aH as Za,m as eo,aI as Ps,aJ as Tt,aK as to,aL as so,aM as no,aN as ao,aO as us,aP as Cs,aQ as As,aR as Rt,aS as Ut,aT as Ms,aU as oo,aV as ds,aW as io,aX as ro,aY as lo,aZ as Ks,a_ as co}from"./index-CrKZ9p2A.js";import{t as uo}from"./ChevronDown-fdV9phBI.js";import{a4 as fs,V as an,F as mo,z as on,a5 as fo,a6 as po}from"./agent-icon-CBgtoGMX.js";import{i as rn}from"./ChevronRight-BwJinQig.js";import{n as go}from"./ChevronUp-Cp7VgDYd.js";import{i as ho}from"./Globe01-DAdWNRRf.js";import{m as qt}from"./automation-runs-BGHwnlly.js";import{b as St,T as xt,a as bt}from"./tooltip-B7vNT4Wn.js";import{b as vo,h as So,a as xo,c as bo,d as yo,e as _o}from"./dialog-DcrYgOGO.js";import{I as jo}from"./input-BdGe86G9.js";import{a as ln}from"./Copy01-DKnyVR5P.js";import{b as Eo}from"./ZoomOut-D9ex4vS_.js";import{i as ko}from"./Settings02-BrCvCp5i.js";import{s as Ro}from"./Eye-DCD7YeTq.js";import{s as cn}from"./TrendUp01-D5MsRGsy.js";import{s as ps}from"./Plus-4_6KGqAm.js";import{s as un}from"./Trash01-BsXCUP-i.js";import{i as wo}from"./Zap-B6QwOIS_.js";import{a as ft,D as dn,b as mn,c as fn,j as Vo}from"./dropdown-menu-DM7-k3j8.js";import{S as No,r as Ls,a as Do,d as To,b as Po,i as Co,f as Ao,P as Mo,c as Ko}from"./page-seo-form-Cj05veVk.js";import{b as Lo}from"./Tool01-tywbntXa.js";import{A as Fo}from"./add-section-modal-BpHEb3lJ.js";import"./ArrowUp-BX_bEaFr.js";import"./chat-context-BZvh6FK5.js";import"./autosend-BiG6REcJ.js";import"./hooks-DG6vcDwp.js";import"./use-mcp-client-CK5FwAgP.js";import"./auth-BCM-D-sZ.js";import"./decopilot-sse-pool-CGqNc25D.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-DH6NZyDA.js";import"./use-virtual-mcp-LDXRrLYA.js";import"./use-ai-providers-CXjJzhnn.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-B96U5En2.js";import"./use-organization-settings-AcZ5yHOA.js";import"./drawer-CiGyGKLQ.js";import"./collection-search-Kebpqtb4.js";import"./SearchMd-Bjx-Ezhm.js";import"./use-mobile-CM0mnPGe.js";import"./AreaChart-DkKq49Dt.js";import"./index-Cmqa6FM3.js";import"./calendar-DfhmE6yT.js";import"./X-7dFtnplq.js";import"./shell-layout-Ch3Kdb2k.js";import"./avatar-s4UNM9aY.js";import"./User01-DtOpMbkt.js";import"./Users03-BmV8-N2x.js";import"./SearchLg-C__tBoev.js";import"./Stars02-BgeAl4Qn.js";import"./XClose-DSE0di54.js";import"./CheckCircle-CBRH3j7M.js";import"./FilterLines-ZJaYu41j.js";import"./required-auth-layout-ChqmDC9P.js";import"./use-org-sso-DN8pMR44.js";import"./index-DuYNJaWj.js";import"./get-initials-D-f_fDFw.js";import"./SwitchHorizontal01-D-4Z1b7Y.js";import"./popover-C-6PWHh6.js";import"./use-registry-app-D12nnqOT.js";import"./use-mcp-tools-DH1nvHw6.js";import"./use-connection-izdZyOnV.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-opWpqR2L.js";import"./mcp-oauth-6rvqQnMK.js";import"./extract-connection-data-CiMQ0W6r.js";import"./use-members-DPDLUppt.js";import"./use-org-auth-client-hoHI_uNL.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./AlertCircle-Bd2je-cB.js";import"./DotsVertical-Dzuqk0dy.js";import"./use-copy-1vVQnABW.js";import"./Check-D2tgQYUH.js";import"./LinkExternal01-Wx2zOa0M.js";import"./command-BL0tcMY4.js";import"./index-DD73prpg.js";import"./ArrowRight-B3m2pN9y.js";import"./companions-core-CjZn6xwq.js";import"./ZapSquare-17EeYv3v.js";import"./Star01-DTaYFGW8.js";import"./Image01-BZrsIdRq.js";import"./Upload01-0iT0HtnC.js";import"./form-D8CrSgsK.js";import"./label-Cgcr_E3j.js";import"./select-B4JKzLFi.js";import"./tabs-BQ7JKlxy.js";import"./Tool02-Wk4yDDov.js";import"./toggle-group-nPxCt6Jp.js";import"./use-deco-credits-BF7U8JvI.js";import"./connection-card-DLNA5dfk.js";import"./use-registry-connections-BHwKxFqZ.js";import"./useInfiniteQuery-BAbHKPGb.js";import"./use-infinite-scroll-DY0dMYA5.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-C13XWIUN.js";import"./integration-icon-Big2E16J.js";import"./textarea-C3kqBFbl.js";import"./connection-form-helpers-zSgiw1Xk.js";import"./collection-tabs-dO0ZeTCK.js";import"./badge-PYjH4nYt.js";import"./useSuspenseInfiniteQuery-BAfqpdKf.js";import"./Monitor01-C0a3JFIF.js";import"./connect-desktop-dialog-CxFuoeWg.js";import"./select-model-D1cAmSQ6.js";import"./checkbox-JZqnAqSI.js";import"./skeleton-DA69b9Wr.js";import"./Key01-C52Q4uIO.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-_-AGRPcy.js";import"./ArrowUpRight-CjNCKllv.js";import"./Stars01-B0-XrNtW.js";import"./index-sjUL2IyD.js";import"./Palette-CxniLd-o.js";import"./alert-dialog-fG87PlMu.js";import"./file-type-icon-CGnLW73f.js";import"./toolbar-Clo_BDTH.js";import"./Package-BMVPvtc2.js";import"./use-debounced-value-CT_IuBiB.js";import"./index-bIZkhTe1.js";import"./LayoutLeft-DnxqkwQW.js";import"./XCircle-D8OccAXi.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-qQ1ObLCw.js";import"./empty-state-CAArqFDh.js";import"./use-capability-Dq-tRDHt.js";import"./toolbar-icon-button-BX96U1pB.js";import"./pt-BR-CLy76QW2.js";import"./Play-w51jOoUp.js";import"./use-debounced-autosave-CI2n3xys.js";import"./index-CJX4eGgf.js";import"./sidebar-CGmVx26g.js";import"./search-input-3Pf6pH5A.js";import"./use-mcp-auth-status-D9hbRmwN.js";import"./switch-Q9YYQF-D.js";import"./github-repo-picker-CFEcOj4_.js";import"./use-navigate-to-agent-01oF9O4S.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./Users01-DMwOx9vc.js";import"./use-secrets-DD1VUOqY.js";import"./monaco-editor-WB9KR-bw.js";import"./use-file-configs-C96LPzgL.js";import"./use-automations-Do-o7Cxb.js";import"./automation-list-row-DqJTJ5Fa.js";import"./Globe04-jH-buQSM.js";import"./HardDrive-C6kdD_or.js";import"./Sun-hd0x8f6o.js";import"./Shield01-qenJwry0.js";import"./table-CfqsJ4MB.js";import"./use-clock-tick-D7I7V0Ju.js";function Bo(g){return g.schema?.definitions??g.schema?.$defs??{}}function Oo(g,e){const o=Bo(e),d=o[btoa(g)];if(!d)return;let f=typeof d.image=="string"?d.image:void 0;if(!f&&Array.isArray(d.allOf)){const x=d.allOf.find(b=>typeof b.$ref=="string")?.$ref;if(typeof x=="string"){const b=x.replace("#/definitions/",""),m=o[b];f=typeof m?.image=="string"?m.image:void 0}}if(f?.includes("{{{"))return f}function Io(g,e){if(!e)return;const o=ya(g);if(!o)return;const d=Oo(o.resolveType,e);if(!d)return;const f=_a(d,o.data);if(f)return ja(f)}const $o="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",zo="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function Fs(g){return Array.from({length:g},(e,o)=>({id:crypto.randomUUID(),index:o}))}function pn(g){return g.map((e,o)=>({...e,index:o}))}function Ho(g,e){if(e===g.length)return g;if(e<g.length)return pn(g.slice(0,e));const o=Array.from({length:e-g.length},(d,f)=>({id:crypto.randomUUID(),index:g.length+f}));return[...g,...o]}function gn(g){const e=He.c(20),{section:o,raw:d,meta:f}=g,x=o.isSavedBlock===!0,b=o.isMultivariate===!0;let m;e[0]!==f||e[1]!==d?(m=d&&f?Io(d,f):void 0,e[0]=f,e[1]=d,e[2]=m):m=e[2];const h=m;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Eo,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=u):u=e[3];let y;e[4]!==h?(y=h&&s.jsx("img",{src:h,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=h,e[5]=y):y=e[5];let k;e[6]!==b||e[7]!==x?(k=x?{color:wa}:b?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=b,e[7]=x,e[8]=k):k=e[8];let D;e[9]!==k?(D=s.jsx(fs,{className:"h-4 w-4 shrink-0",style:k}),e[9]=k,e[10]=D):D=e[10];const E=o.isHidden&&"line-through opacity-50";let r;e[11]!==E?(r=Be("min-w-0 flex-1 truncate text-sm font-medium",E),e[11]=E,e[12]=r):r=e[12];let p;e[13]!==o.label||e[14]!==r?(p=s.jsx("span",{className:r,children:o.label}),e[13]=o.label,e[14]=r,e[15]=p):p=e[15];let i;return e[16]!==y||e[17]!==D||e[18]!==p?(i=s.jsxs(s.Fragment,{children:[u,y,D,p]}),e[16]=y,e[17]=D,e[18]=p,e[19]=i):i=e[19],i}function hn(g,e){const o=g.isSavedBlock===!0,d=g.isMultivariate===!0;return Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":o?$o:d?"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)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Go(g){const e=He.c(81),{section:o,raw:d,meta:f,sortableId:x,selected:b,onSelect:m,onDelete:h,onDuplicate:u,onMakeReusable:y,onToggleHidden:k,onToggleLazy:D,onAddVariant:E,onDetach:r}=g,p=at(),i=d?qs(d.__resolveType??""):!1;let P;e[0]!==o?(P=Ea(o),e[0]=o,e[1]=P):P=e[1];const l=P;let R;e[2]!==x?(R={id:x,animateLayoutChanges:Yo},e[2]=x,e[3]=R):R=e[3];const{attributes:A,listeners:$,setNodeRef:v,transform:C,isDragging:ie}=Js(R);let L;e[4]!==C?(L=Ys.Transform.toString(C?{...C,x:0}:null),e[4]=C,e[5]=L):L=e[5];const ce=ie?0:void 0;let K;e[6]!==L||e[7]!==ce?(K={transform:L,opacity:ce},e[6]=L,e[7]=ce,e[8]=K):K=e[8];const ge=K;let F;e[9]!==o?(F=ka(o),e[9]=o,e[10]=F):F=e[10];const ne=F,he="button",fe=0;let B;e[11]!==m?(B=G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),m())},e[11]=m,e[12]=B):B=e[12];const J=ie?"cursor-grabbing":"cursor-pointer";let X;e[13]!==o||e[14]!==b||e[15]!==J?(X=Be("touch-none transition-colors",J,hn(o,b)),e[13]=o,e[14]=b,e[15]=J,e[16]=X):X=e[16];let ue;e[17]!==f||e[18]!==d||e[19]!==o?(ue=s.jsx(gn,{section:o,raw:d,meta:f}),e[17]=f,e[18]=d,e[19]=o,e[20]=ue):ue=e[20];const O=!o.isMultivariate&&s.jsxs(St,{children:[s.jsx(xt,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":p(i?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:Be("h-7 w-7 shrink-0",i?"":"opacity-0 group-hover:opacity-100"),onClick:G=>{G.stopPropagation(),D()},onPointerDown:Jo,children:s.jsx(wo,{className:Be("h-3.5 w-3.5",i&&"text-yellow-500")})})}),s.jsx(bt,{side:"bottom",children:p(i?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]});let Ke;e[21]!==k||e[22]!==o.isHidden||e[23]!==o.isMultivariate||e[24]!==p?(Ke=!o.isMultivariate&&s.jsxs(St,{children:[s.jsx(xt,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":o.isHidden?p("sectionsEditor.sectionList.showSection"):p("sectionsEditor.sectionList.hideSection"),className:Be("h-7 w-7 shrink-0",o.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:G=>{G.stopPropagation(),k()},onPointerDown:qo,children:o.isHidden?s.jsx(ko,{className:"h-3.5 w-3.5"}):s.jsx(Ro,{className:"h-3.5 w-3.5"})})}),s.jsx(bt,{side:"bottom",children:o.isHidden?p("sectionsEditor.sectionList.showSection"):p("sectionsEditor.sectionList.hideSection")})]}),e[21]=k,e[22]=o.isHidden,e[23]=o.isMultivariate,e[24]=p,e[25]=Ke):Ke=e[25];let Z;e[26]!==p?(Z=p("sectionsEditor.sectionList.sectionActionsMenu"),e[26]=p,e[27]=Z):Z=e[27];let Le;e[28]===Symbol.for("react.memo_cache_sentinel")?(Le=s.jsx(an,{className:"h-3.5 w-3.5"}),e[28]=Le):Le=e[28];let ve;e[29]!==Z?(ve=s.jsx(dn,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":Z,className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Uo,onPointerDown:Wo,children:Le})}),e[29]=Z,e[30]=ve):ve=e[30];let de;e[31]!==u?(de=G=>{G.stopPropagation(),u()},e[31]=u,e[32]=de):de=e[32];let oe;e[33]===Symbol.for("react.memo_cache_sentinel")?(oe=s.jsx(ln,{className:"h-4 w-4"}),e[33]=oe):oe=e[33];let ee;e[34]!==p?(ee=p("sectionsEditor.sectionList.duplicateMenuItem"),e[34]=p,e[35]=ee):ee=e[35];let re;e[36]!==de||e[37]!==ee?(re=s.jsxs(ft,{onClick:de,children:[oe,ee]}),e[36]=de,e[37]=ee,e[38]=re):re=e[38];let pe;e[39]!==l||e[40]!==E||e[41]!==p?(pe=l&&s.jsxs(ft,{className:Ra,onClick:G=>{G.stopPropagation(),E()},children:[s.jsx(cn,{className:"h-4 w-4"}),p("sectionsEditor.sectionList.addVariantMenuItem")]}),e[39]=l,e[40]=E,e[41]=p,e[42]=pe):pe=e[42];let ke;e[43]!==ne||e[44]!==y||e[45]!==p?(ke=ne&&s.jsxs(ft,{className:zo,onClick:G=>{G.stopPropagation(),y()},children:[s.jsx(fs,{className:"h-4 w-4"}),p("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[43]=ne,e[44]=y,e[45]=p,e[46]=ke):ke=e[46];let Re;e[47]!==r||e[48]!==o.isMultivariate||e[49]!==o.isSavedBlock||e[50]!==p?(Re=o.isSavedBlock===!0&&!o.isMultivariate&&s.jsxs(ft,{onClick:G=>{G.stopPropagation(),r()},children:[s.jsx(fs,{className:"h-4 w-4"}),p("sectionsEditor.sectionList.detachMenuItem")]}),e[47]=r,e[48]=o.isMultivariate,e[49]=o.isSavedBlock,e[50]=p,e[51]=Re):Re=e[51];let Se;e[52]!==h?(Se=G=>{G.stopPropagation(),h()},e[52]=h,e[53]=Se):Se=e[53];let Ne;e[54]===Symbol.for("react.memo_cache_sentinel")?(Ne=s.jsx(un,{className:"h-4 w-4"}),e[54]=Ne):Ne=e[54];let _e;e[55]!==p?(_e=p("sectionsEditor.sectionList.deleteMenuItem"),e[55]=p,e[56]=_e):_e=e[56];let z;e[57]!==Se||e[58]!==_e?(z=s.jsxs(ft,{className:"text-destructive focus:text-destructive",onClick:Se,children:[Ne,_e]}),e[57]=Se,e[58]=_e,e[59]=z):z=e[59];let le;e[60]!==re||e[61]!==pe||e[62]!==ke||e[63]!==Re||e[64]!==z?(le=s.jsxs(mn,{align:"end",className:"w-44",children:[re,pe,ke,Re,z]}),e[60]=re,e[61]=pe,e[62]=ke,e[63]=Re,e[64]=z,e[65]=le):le=e[65];let je;e[66]!==ve||e[67]!==le?(je=s.jsxs(fn,{children:[ve,le]}),e[66]=ve,e[67]=le,e[68]=je):je=e[68];let De;return e[69]!==A||e[70]!==$||e[71]!==m||e[72]!==v||e[73]!==ge||e[74]!==X||e[75]!==ue||e[76]!==O||e[77]!==Ke||e[78]!==je||e[79]!==B?(De=s.jsxs("div",{ref:v,style:ge,...A,...$,role:he,tabIndex:fe,onClick:m,onKeyDown:B,className:X,children:[ue,O,Ke,je]}),e[69]=A,e[70]=$,e[71]=m,e[72]=v,e[73]=ge,e[74]=X,e[75]=ue,e[76]=O,e[77]=Ke,e[78]=je,e[79]=B,e[80]=De):De=e[80],De}function Wo(g){return g.stopPropagation()}function Uo(g){return g.stopPropagation()}function qo(g){return g.stopPropagation()}function Jo(g){return g.stopPropagation()}function Yo(){return!1}function Qo(g){const e=He.c(104),{listKey:o,rawSections:d,sections:f,meta:x,selectedIndex:b,onSelect:m,onReorder:h,onDelete:u,onDuplicate:y,onMakeReusable:k,onToggleHidden:D,onToggleLazy:E,onAddVariant:r,onDetach:p,onAddSection:i,canAddSection:P}=g,l=P===void 0?!0:P,R=at();let A;e[0]!==f.length?(A=()=>Fs(f.length),e[0]=f.length,e[1]=A):A=e[1];const[$,v]=V.useState(A),[C,ie]=V.useState(null),[L,ce]=V.useState(o),[K,ge]=V.useState(f.length),F=V.useRef(!1);L!==o?(ce(o),ge(f.length),v(Fs(f.length))):K!==f.length&&(ge(f.length),v(Ie=>Ho(Ie,f.length)));let ne;e[2]===Symbol.for("react.memo_cache_sentinel")?(ne={activationConstraint:{distance:8}},e[2]=ne):ne=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:Qs},e[3]=he):he=e[3];const fe=Gs(Jt(Us,ne),Jt(Ws,he));let B;e[4]!==$?(B=$.map(Xo),e[4]=$,e[5]=B):B=e[5];const J=B;let X;e[6]===Symbol.for("react.memo_cache_sentinel")?(X=Ie=>{ie(String(Ie.active.id))},e[6]=X):X=e[6];const ue=X;let O;e[7]!==J||e[8]!==h?(O=Ie=>{ie(null);const{active:N,over:ae}=Ie;if(!ae||N.id===ae.id)return;const I=J.indexOf(String(N.id)),Qe=J.indexOf(String(ae.id));I===-1||Qe===-1||(v(Ze=>pn(Pt([...Ze],I,Qe))),F.current=!0,requestAnimationFrame(()=>{F.current=!1}),h?.(I,Qe))},e[7]=J,e[8]=h,e[9]=O):O=e[9];const Ke=O;let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{ie(null)},e[10]=Z):Z=e[10];const Le=Z;let ve,de,oe,ee,re,pe,ke,Re,Se,Ne,_e,z,le,je,De;if(e[11]!==C||e[12]!==l||e[13]!==$||e[14]!==J||e[15]!==Ke||e[16]!==x||e[17]!==i||e[18]!==r||e[19]!==u||e[20]!==p||e[21]!==y||e[22]!==k||e[23]!==m||e[24]!==D||e[25]!==E||e[26]!==d||e[27]!==f||e[28]!==b||e[29]!==fe||e[30]!==R){je=Symbol.for("react.early_return_sentinel");e:{const Ie=N=>{F.current||m(N)};if(e[46]!==C||e[47]!==l||e[48]!==$||e[49]!==i||e[50]!==d||e[51]!==f||e[52]!==R){const N=C?$.find(ae=>ae.id===C):null;if(ee=N!=null?f[N.index]:null,oe=N!=null?d[N.index]:void 0,$.length===0){let ae;e[56]!==R?(ae=R("sectionsEditor.sectionList.noSections"),e[56]=R,e[57]=ae):ae=e[57];let I;e[58]!==ae?(I=s.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:ae}),e[58]=ae,e[59]=I):I=e[59];const Qe=!l;let Ze;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ze=s.jsx(ps,{size:14}),e[60]=Ze):Ze=e[60];let ot;e[61]!==R?(ot=R("sectionsEditor.sectionList.addSectionButton"),e[61]=R,e[62]=ot):ot=e[62];let it;e[63]!==i||e[64]!==Qe||e[65]!==ot?(it=s.jsxs(qe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Qe,onClick:i,children:[Ze,ot]}),e[63]=i,e[64]=Qe,e[65]=ot,e[66]=it):it=e[66];let rt;e[67]!==I||e[68]!==it?(rt=s.jsxs("div",{className:"space-y-2",children:[I,it]}),e[67]=I,e[68]=it,e[69]=rt):rt=e[69],je=rt;break e}le=Be(N&&"cursor-grabbing"),e[46]=C,e[47]=l,e[48]=$,e[49]=i,e[50]=d,e[51]=f,e[52]=R,e[53]=oe,e[54]=ee,e[55]=le}else oe=e[53],ee=e[54],le=e[55];de=Xs,Re=fe,Se=Zs,Ne=ue,_e=Ke,z=Le,ve=en,pe=J,ke=tn,De="space-y-1",re=$.map(N=>{const ae=f[N.index];return ae?s.jsx(Go,{sortableId:N.id,section:ae,raw:d[N.index],meta:x,selected:b===N.index,onSelect:()=>Ie(N.index),onDelete:()=>u(N.index),onDuplicate:()=>y(N.index),onMakeReusable:()=>k(N.index),onToggleHidden:()=>D(N.index),onToggleLazy:()=>E(N.index),onAddVariant:()=>r(N.index),onDetach:()=>p(N.index)},N.id):null})}e[11]=C,e[12]=l,e[13]=$,e[14]=J,e[15]=Ke,e[16]=x,e[17]=i,e[18]=r,e[19]=u,e[20]=p,e[21]=y,e[22]=k,e[23]=m,e[24]=D,e[25]=E,e[26]=d,e[27]=f,e[28]=b,e[29]=fe,e[30]=R,e[31]=ve,e[32]=de,e[33]=oe,e[34]=ee,e[35]=re,e[36]=pe,e[37]=ke,e[38]=Re,e[39]=Se,e[40]=Ne,e[41]=_e,e[42]=z,e[43]=le,e[44]=je,e[45]=De}else ve=e[31],de=e[32],oe=e[33],ee=e[34],re=e[35],pe=e[36],ke=e[37],Re=e[38],Se=e[39],Ne=e[40],_e=e[41],z=e[42],le=e[43],je=e[44],De=e[45];if(je!==Symbol.for("react.early_return_sentinel"))return je;let G;e[70]!==re||e[71]!==De?(G=s.jsx("div",{className:De,children:re}),e[70]=re,e[71]=De,e[72]=G):G=e[72];let Ae;e[73]!==ve||e[74]!==pe||e[75]!==ke||e[76]!==G?(Ae=s.jsx(ve,{items:pe,strategy:ke,children:G}),e[73]=ve,e[74]=pe,e[75]=ke,e[76]=G,e[77]=Ae):Ae=e[77];let Oe;e[78]!==oe||e[79]!==ee||e[80]!==x?(Oe=ee?s.jsx("div",{className:Be("cursor-grabbing shadow-lg ring-1 ring-border/60",hn(ee,!1)),children:s.jsx(gn,{section:ee,raw:oe,meta:x})}):null,e[78]=oe,e[79]=ee,e[80]=x,e[81]=Oe):Oe=e[81];let ze;e[82]!==Oe?(ze=s.jsx(sn,{dropAnimation:null,children:Oe}),e[82]=Oe,e[83]=ze):ze=e[83];let Fe;e[84]!==de||e[85]!==Re||e[86]!==Se||e[87]!==Ne||e[88]!==_e||e[89]!==z||e[90]!==Ae||e[91]!==ze?(Fe=s.jsxs(de,{sensors:Re,collisionDetection:Se,onDragStart:Ne,onDragEnd:_e,onDragCancel:z,children:[Ae,ze]}),e[84]=de,e[85]=Re,e[86]=Se,e[87]=Ne,e[88]=_e,e[89]=z,e[90]=Ae,e[91]=ze,e[92]=Fe):Fe=e[92];const xe=!l;let we;e[93]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx(ps,{size:14}),e[93]=we):we=e[93];let be;e[94]!==R?(be=R("sectionsEditor.sectionList.addSectionButton"),e[94]=R,e[95]=be):be=e[95];let te;e[96]!==i||e[97]!==xe||e[98]!==be?(te=s.jsxs(qe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:i,children:[we,be]}),e[96]=i,e[97]=xe,e[98]=be,e[99]=te):te=e[99];let me;return e[100]!==le||e[101]!==Fe||e[102]!==te?(me=s.jsxs("div",{className:le,children:[Fe,te]}),e[100]=le,e[101]=Fe,e[102]=te,e[103]=me):me=e[103],me}function Xo(g){return g.id}function Bs(g){const e=He.c(57),{open:o,initialName:d,autoLabel:f,isPending:x,onSubmit:b,onOpenChange:m}=g,h=x===void 0?!1:x,u=at(),[y,k]=V.useState(d),[D,E]=V.useState(o);o!==D&&(E(o),o&&k(d));let r;e[0]!==h||e[1]!==m?(r=ue=>{!ue&&!h&&m(!1)},e[0]=h,e[1]=m,e[2]=r):r=e[2];const p=r;let i;e[3]!==h||e[4]!==y||e[5]!==b?(i=async ue=>{ue.preventDefault(),!h&&await b(y.trim())},e[3]=h,e[4]=y,e[5]=b,e[6]=i):i=e[6];const P=i;let l;e[7]!==u?(l=u("sectionsEditor.variantRenameDialog.title"),e[7]=u,e[8]=l):l=e[8];let R;e[9]!==l?(R=s.jsx(vo,{children:l}),e[9]=l,e[10]=R):R=e[10];let A;e[11]!==f||e[12]!==u?(A=u("sectionsEditor.variantRenameDialog.description",{fallback:f||u("sectionsEditor.variantRenameDialog.defaultFallback")}),e[11]=f,e[12]=u,e[13]=A):A=e[13];let $;e[14]!==A?($=s.jsx(So,{children:A}),e[14]=A,e[15]=$):$=e[15];let v;e[16]!==R||e[17]!==$?(v=s.jsxs(xo,{children:[R,$]}),e[16]=R,e[17]=$,e[18]=v):v=e[18];let C;e[19]!==u?(C=u("sectionsEditor.variantRenameDialog.nameLabel"),e[19]=u,e[20]=C):C=e[20];let ie;e[21]!==C?(ie=s.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:C}),e[21]=C,e[22]=ie):ie=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=ue=>k(ue.target.value),e[23]=L):L=e[23];let ce;e[24]!==f||e[25]!==h||e[26]!==y?(ce=s.jsx(jo,{id:"variant-rename-name",value:y,onChange:L,placeholder:f,autoFocus:!0,disabled:h}),e[24]=f,e[25]=h,e[26]=y,e[27]=ce):ce=e[27];let K;e[28]!==ie||e[29]!==ce?(K=s.jsxs("div",{className:"space-y-1.5 py-4",children:[ie,ce]}),e[28]=ie,e[29]=ce,e[30]=K):K=e[30];let ge;e[31]!==m?(ge=()=>m(!1),e[31]=m,e[32]=ge):ge=e[32];let F;e[33]!==u?(F=u("sectionsEditor.variantRenameDialog.cancel"),e[33]=u,e[34]=F):F=e[34];let ne;e[35]!==h||e[36]!==ge||e[37]!==F?(ne=s.jsx(qe,{type:"button",variant:"outline",onClick:ge,disabled:h,children:F}),e[35]=h,e[36]=ge,e[37]=F,e[38]=ne):ne=e[38];let he;e[39]!==h||e[40]!==u?(he=h?s.jsxs(s.Fragment,{children:[s.jsx(Hs,{size:14,className:"animate-spin"}),u("sectionsEditor.variantRenameDialog.saving")]}):u("sectionsEditor.variantRenameDialog.save"),e[39]=h,e[40]=u,e[41]=he):he=e[41];let fe;e[42]!==h||e[43]!==he?(fe=s.jsx(qe,{type:"submit",disabled:h,children:he}),e[42]=h,e[43]=he,e[44]=fe):fe=e[44];let B;e[45]!==ne||e[46]!==fe?(B=s.jsxs(bo,{children:[ne,fe]}),e[45]=ne,e[46]=fe,e[47]=B):B=e[47];let J;e[48]!==P||e[49]!==K||e[50]!==B||e[51]!==v?(J=s.jsx(yo,{className:"sm:max-w-md",children:s.jsxs("form",{onSubmit:P,children:[v,K,B]})}),e[48]=P,e[49]=K,e[50]=B,e[51]=v,e[52]=J):J=e[52];let X;return e[53]!==p||e[54]!==o||e[55]!==J?(X=s.jsx(_o,{open:o,onOpenChange:p,children:J}),e[53]=p,e[54]=o,e[55]=J,e[56]=X):X=e[56],X}const Zo="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)]",vn="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)]";function Sn(g){const e=He.c(5),{rule:o,matchers:d}=g,f=o?.__resolveType??"";let x;if(e[0]!==d||e[1]!==f){const u=d.find(y=>y.resolveType===f)?.iconName??Va(f);x=mo(u),e[0]=d,e[1]=f,e[2]=x}else x=e[2];const b=x;if(!b)return null;let m;return e[3]!==b?(m=s.jsx(b,{size:14,className:"shrink-0"}),e[3]=b,e[4]=m):m=e[4],m}function Os(g){return g.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
1
|
+
import{c as He,i as at,r as V,m as Be,j as s,B as qe,k as Hs,o as xa,t as Q,K as ba}from"./index-BWC7sFp_.js";import{a1 as ya,a2 as _a,a3 as ja,H as Gs,J as Jt,K as Ws,P as Us,i as qs,a4 as Ea,V as Js,W as Ys,a5 as ka,a6 as Ra,G as wa,L as Qs,M as Pt,Q as Xs,U as Zs,N as en,_ as tn,a7 as sn,a8 as Va,a9 as Ct,aa as Na,S as nn,ab as nt,ac as Da,ad as Ta,ae as Pa,af as Ca,e as Aa,k as Ma,ag as Ka,ah as La,ai as Fa,aj as Ba,r as Ht,ak as Gt,al as Oa,am as ht,an as Nt,ao as Ia,ap as $a,aq as Xe,ar as Ts,as as za,at as Dt,au as Wt,av as Ha,aw as cs,ax as Ga,ay as kt,az as Wa,aA as Ua,aB as qa,aC as Ja,aD as Ya,aE as vt,aF as Qa,aG as Xa,aH as Za,m as eo,aI as Ps,aJ as Tt,aK as to,aL as so,aM as no,aN as ao,aO as us,aP as Cs,aQ as As,aR as Rt,aS as Ut,aT as Ms,aU as oo,aV as ds,aW as io,aX as ro,aY as lo,aZ as Ks,a_ as co}from"./index-DkqrfhJp.js";import{t as uo}from"./ChevronDown-B6-w9q8W.js";import{a4 as fs,V as an,F as mo,z as on,a5 as fo,a6 as po}from"./agent-icon-BBgjEkV0.js";import{i as rn}from"./ChevronRight-DEIr6kW5.js";import{n as go}from"./ChevronUp-C_eomkpm.js";import{i as ho}from"./Globe01-hVg4-cH5.js";import{m as qt}from"./automation-runs-U2tWrOBe.js";import{b as St,T as xt,a as bt}from"./tooltip-BmutXqWI.js";import{b as vo,h as So,a as xo,c as bo,d as yo,e as _o}from"./dialog-BhvH5UUY.js";import{I as jo}from"./input-Dwgjs0Me.js";import{a as ln}from"./Copy01-R8AR2-1c.js";import{b as Eo}from"./ZoomOut-6evm9HJr.js";import{i as ko}from"./Settings02-BbDm-Ne4.js";import{s as Ro}from"./Eye-CE-cR8Oa.js";import{s as cn}from"./TrendUp01-B8sZVpOQ.js";import{s as ps}from"./Plus-D7pYKUsO.js";import{s as un}from"./Trash01-D08DuleC.js";import{i as wo}from"./Zap-CVYBhiGb.js";import{a as ft,D as dn,b as mn,c as fn,j as Vo}from"./dropdown-menu-CJMe9yFA.js";import{S as No,r as Ls,a as Do,d as To,b as Po,i as Co,f as Ao,P as Mo,c as Ko}from"./page-seo-form-CQiZ7Ngj.js";import{b as Lo}from"./Tool01-DMTzqx5i.js";import{A as Fo}from"./add-section-modal-Dtdlek5H.js";import"./ArrowUp-BVYSfKPB.js";import"./chat-context-DUAqM3BL.js";import"./autosend-DZWEI21D.js";import"./hooks-2c34l0ae.js";import"./use-mcp-client-BfCXL7Ea.js";import"./auth-BU8dnKUI.js";import"./decopilot-sse-pool-yan_82bi.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-DqyzSTaT.js";import"./use-virtual-mcp-B4R9Gg2E.js";import"./use-ai-providers-Dp6I5-8x.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-JGRwbLqN.js";import"./use-organization-settings-DdWAi5Fa.js";import"./drawer-Clee3MiY.js";import"./collection-search-zof41lOw.js";import"./SearchMd-CP6wLgs6.js";import"./use-mobile-D2X5CiwU.js";import"./AreaChart-2lzk5ej3.js";import"./index-D3Egmveq.js";import"./calendar-CDlXA0Du.js";import"./X-_ogr2Thx.js";import"./shell-layout-Mucs34pV.js";import"./avatar-UzWl0gwW.js";import"./User01-9n6b7RP1.js";import"./Users03-CjXk-r9i.js";import"./SearchLg-C42MXEKt.js";import"./Stars02-CmhbeIDG.js";import"./XClose-C5Joak01.js";import"./CheckCircle-CeUlzZCm.js";import"./FilterLines-D4J8LYhW.js";import"./required-auth-layout-BrqitDmd.js";import"./use-org-sso-C63dt58J.js";import"./index-BZKh5x8S.js";import"./get-initials-D-f_fDFw.js";import"./SwitchHorizontal01-CRibS_Zy.js";import"./popover-C35uikDd.js";import"./use-registry-app-DhV6qG8g.js";import"./use-mcp-tools-Dmvh1NTU.js";import"./use-connection-Db71aL_l.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-CXoW_w5W.js";import"./mcp-oauth-CCJ1wn2F.js";import"./extract-connection-data-CRUudyOW.js";import"./use-members-DHjn4tSi.js";import"./use-org-auth-client-Y3lH7Le-.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./AlertCircle-C4BWLdJ4.js";import"./DotsVertical-C3MnHRz8.js";import"./use-copy-C9WCw_xQ.js";import"./Check-CymDPtaz.js";import"./LinkExternal01-DuSi53Ey.js";import"./command-rWYtUR5c.js";import"./index-D0YUP6cD.js";import"./ArrowRight-qJlbKSrg.js";import"./companions-core-sVa6Qw5T.js";import"./ZapSquare-DuoaxuW6.js";import"./Star01-DZ_3ux8i.js";import"./Image01-DG088yrA.js";import"./Upload01-kJs7y_sS.js";import"./form-C5iFi2jZ.js";import"./label-BK6sLMEK.js";import"./select-uGrWbEMz.js";import"./tabs-_KEklsIu.js";import"./Tool02-DGUi9uKr.js";import"./toggle-group-DZVcSFOA.js";import"./use-deco-credits-CNlP8bKq.js";import"./connection-card-Dz1fwerM.js";import"./use-registry-connections-B2LAq4ux.js";import"./useInfiniteQuery-B4u61JTE.js";import"./use-infinite-scroll-C9CrduD1.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-zoyg0nhK.js";import"./integration-icon-9QXIMfmD.js";import"./textarea-D2K-qpEF.js";import"./connection-form-helpers-C_ssxiIn.js";import"./collection-tabs-CgqHDjS1.js";import"./badge-Baw1FT-S.js";import"./useSuspenseInfiniteQuery-S8U9qcL-.js";import"./Monitor01-D09qwZZ1.js";import"./connect-desktop-dialog-DxGAbniS.js";import"./select-model-gBHKlDIm.js";import"./checkbox-FmmsZFBn.js";import"./skeleton-CEv-QtIz.js";import"./Key01-CHhJPyPs.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-B8q2fbg4.js";import"./ArrowUpRight-CZ2fIDWv.js";import"./Stars01-JDxcV7AF.js";import"./index-DXU-zOnf.js";import"./Palette-DxnkmeGc.js";import"./alert-dialog-C2Bqhcmc.js";import"./file-type-icon-Wt0fW6Db.js";import"./toolbar-cItkaIEN.js";import"./Package-oKuIYsv6.js";import"./use-debounced-value-CmRylZJc.js";import"./index-Dha2A-8H.js";import"./LayoutLeft-C4fmYl61.js";import"./XCircle-Ojqttb4K.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-K0-7jWPp.js";import"./empty-state-YC9UCU06.js";import"./use-capability-B1l0lZqa.js";import"./toolbar-icon-button-CmxseXuq.js";import"./pt-BR-CLy76QW2.js";import"./Play-BMDEoRJl.js";import"./use-debounced-autosave-CF3nwEaJ.js";import"./index-DdFBHhSl.js";import"./sidebar-Dv_H2jfW.js";import"./search-input-Ccf8_eUm.js";import"./use-mcp-auth-status-B8Ydhf-J.js";import"./switch-BQHSVMIs.js";import"./github-repo-picker-C6QGF-3R.js";import"./use-navigate-to-agent-BRmHvfMz.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./Users01-ZUQPsXZL.js";import"./use-secrets-C2rRzzPu.js";import"./monaco-editor-dhKEhAZV.js";import"./use-file-configs-BNgMZFIO.js";import"./use-automations-zyl04vpa.js";import"./automation-list-row-DRyf2mOg.js";import"./Globe04-D5VJ_hkz.js";import"./HardDrive-zN0Is6H-.js";import"./Sun-DoaIj1xZ.js";import"./Shield01-CjiZhLxU.js";import"./table-CbpS0yp4.js";import"./use-clock-tick-Bn8KTZQB.js";function Bo(g){return g.schema?.definitions??g.schema?.$defs??{}}function Oo(g,e){const o=Bo(e),d=o[btoa(g)];if(!d)return;let f=typeof d.image=="string"?d.image:void 0;if(!f&&Array.isArray(d.allOf)){const x=d.allOf.find(b=>typeof b.$ref=="string")?.$ref;if(typeof x=="string"){const b=x.replace("#/definitions/",""),m=o[b];f=typeof m?.image=="string"?m.image:void 0}}if(f?.includes("{{{"))return f}function Io(g,e){if(!e)return;const o=ya(g);if(!o)return;const d=Oo(o.resolveType,e);if(!d)return;const f=_a(d,o.data);if(f)return ja(f)}const $o="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",zo="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function Fs(g){return Array.from({length:g},(e,o)=>({id:crypto.randomUUID(),index:o}))}function pn(g){return g.map((e,o)=>({...e,index:o}))}function Ho(g,e){if(e===g.length)return g;if(e<g.length)return pn(g.slice(0,e));const o=Array.from({length:e-g.length},(d,f)=>({id:crypto.randomUUID(),index:g.length+f}));return[...g,...o]}function gn(g){const e=He.c(20),{section:o,raw:d,meta:f}=g,x=o.isSavedBlock===!0,b=o.isMultivariate===!0;let m;e[0]!==f||e[1]!==d?(m=d&&f?Io(d,f):void 0,e[0]=f,e[1]=d,e[2]=m):m=e[2];const h=m;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Eo,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=u):u=e[3];let y;e[4]!==h?(y=h&&s.jsx("img",{src:h,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=h,e[5]=y):y=e[5];let k;e[6]!==b||e[7]!==x?(k=x?{color:wa}:b?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=b,e[7]=x,e[8]=k):k=e[8];let D;e[9]!==k?(D=s.jsx(fs,{className:"h-4 w-4 shrink-0",style:k}),e[9]=k,e[10]=D):D=e[10];const E=o.isHidden&&"line-through opacity-50";let r;e[11]!==E?(r=Be("min-w-0 flex-1 truncate text-sm font-medium",E),e[11]=E,e[12]=r):r=e[12];let p;e[13]!==o.label||e[14]!==r?(p=s.jsx("span",{className:r,children:o.label}),e[13]=o.label,e[14]=r,e[15]=p):p=e[15];let i;return e[16]!==y||e[17]!==D||e[18]!==p?(i=s.jsxs(s.Fragment,{children:[u,y,D,p]}),e[16]=y,e[17]=D,e[18]=p,e[19]=i):i=e[19],i}function hn(g,e){const o=g.isSavedBlock===!0,d=g.isMultivariate===!0;return Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":o?$o:d?"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)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Go(g){const e=He.c(81),{section:o,raw:d,meta:f,sortableId:x,selected:b,onSelect:m,onDelete:h,onDuplicate:u,onMakeReusable:y,onToggleHidden:k,onToggleLazy:D,onAddVariant:E,onDetach:r}=g,p=at(),i=d?qs(d.__resolveType??""):!1;let P;e[0]!==o?(P=Ea(o),e[0]=o,e[1]=P):P=e[1];const l=P;let R;e[2]!==x?(R={id:x,animateLayoutChanges:Yo},e[2]=x,e[3]=R):R=e[3];const{attributes:A,listeners:$,setNodeRef:v,transform:C,isDragging:ie}=Js(R);let L;e[4]!==C?(L=Ys.Transform.toString(C?{...C,x:0}:null),e[4]=C,e[5]=L):L=e[5];const ce=ie?0:void 0;let K;e[6]!==L||e[7]!==ce?(K={transform:L,opacity:ce},e[6]=L,e[7]=ce,e[8]=K):K=e[8];const ge=K;let F;e[9]!==o?(F=ka(o),e[9]=o,e[10]=F):F=e[10];const ne=F,he="button",fe=0;let B;e[11]!==m?(B=G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),m())},e[11]=m,e[12]=B):B=e[12];const J=ie?"cursor-grabbing":"cursor-pointer";let X;e[13]!==o||e[14]!==b||e[15]!==J?(X=Be("touch-none transition-colors",J,hn(o,b)),e[13]=o,e[14]=b,e[15]=J,e[16]=X):X=e[16];let ue;e[17]!==f||e[18]!==d||e[19]!==o?(ue=s.jsx(gn,{section:o,raw:d,meta:f}),e[17]=f,e[18]=d,e[19]=o,e[20]=ue):ue=e[20];const O=!o.isMultivariate&&s.jsxs(St,{children:[s.jsx(xt,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":p(i?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:Be("h-7 w-7 shrink-0",i?"":"opacity-0 group-hover:opacity-100"),onClick:G=>{G.stopPropagation(),D()},onPointerDown:Jo,children:s.jsx(wo,{className:Be("h-3.5 w-3.5",i&&"text-yellow-500")})})}),s.jsx(bt,{side:"bottom",children:p(i?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]});let Ke;e[21]!==k||e[22]!==o.isHidden||e[23]!==o.isMultivariate||e[24]!==p?(Ke=!o.isMultivariate&&s.jsxs(St,{children:[s.jsx(xt,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":o.isHidden?p("sectionsEditor.sectionList.showSection"):p("sectionsEditor.sectionList.hideSection"),className:Be("h-7 w-7 shrink-0",o.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:G=>{G.stopPropagation(),k()},onPointerDown:qo,children:o.isHidden?s.jsx(ko,{className:"h-3.5 w-3.5"}):s.jsx(Ro,{className:"h-3.5 w-3.5"})})}),s.jsx(bt,{side:"bottom",children:o.isHidden?p("sectionsEditor.sectionList.showSection"):p("sectionsEditor.sectionList.hideSection")})]}),e[21]=k,e[22]=o.isHidden,e[23]=o.isMultivariate,e[24]=p,e[25]=Ke):Ke=e[25];let Z;e[26]!==p?(Z=p("sectionsEditor.sectionList.sectionActionsMenu"),e[26]=p,e[27]=Z):Z=e[27];let Le;e[28]===Symbol.for("react.memo_cache_sentinel")?(Le=s.jsx(an,{className:"h-3.5 w-3.5"}),e[28]=Le):Le=e[28];let ve;e[29]!==Z?(ve=s.jsx(dn,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":Z,className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Uo,onPointerDown:Wo,children:Le})}),e[29]=Z,e[30]=ve):ve=e[30];let de;e[31]!==u?(de=G=>{G.stopPropagation(),u()},e[31]=u,e[32]=de):de=e[32];let oe;e[33]===Symbol.for("react.memo_cache_sentinel")?(oe=s.jsx(ln,{className:"h-4 w-4"}),e[33]=oe):oe=e[33];let ee;e[34]!==p?(ee=p("sectionsEditor.sectionList.duplicateMenuItem"),e[34]=p,e[35]=ee):ee=e[35];let re;e[36]!==de||e[37]!==ee?(re=s.jsxs(ft,{onClick:de,children:[oe,ee]}),e[36]=de,e[37]=ee,e[38]=re):re=e[38];let pe;e[39]!==l||e[40]!==E||e[41]!==p?(pe=l&&s.jsxs(ft,{className:Ra,onClick:G=>{G.stopPropagation(),E()},children:[s.jsx(cn,{className:"h-4 w-4"}),p("sectionsEditor.sectionList.addVariantMenuItem")]}),e[39]=l,e[40]=E,e[41]=p,e[42]=pe):pe=e[42];let ke;e[43]!==ne||e[44]!==y||e[45]!==p?(ke=ne&&s.jsxs(ft,{className:zo,onClick:G=>{G.stopPropagation(),y()},children:[s.jsx(fs,{className:"h-4 w-4"}),p("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[43]=ne,e[44]=y,e[45]=p,e[46]=ke):ke=e[46];let Re;e[47]!==r||e[48]!==o.isMultivariate||e[49]!==o.isSavedBlock||e[50]!==p?(Re=o.isSavedBlock===!0&&!o.isMultivariate&&s.jsxs(ft,{onClick:G=>{G.stopPropagation(),r()},children:[s.jsx(fs,{className:"h-4 w-4"}),p("sectionsEditor.sectionList.detachMenuItem")]}),e[47]=r,e[48]=o.isMultivariate,e[49]=o.isSavedBlock,e[50]=p,e[51]=Re):Re=e[51];let Se;e[52]!==h?(Se=G=>{G.stopPropagation(),h()},e[52]=h,e[53]=Se):Se=e[53];let Ne;e[54]===Symbol.for("react.memo_cache_sentinel")?(Ne=s.jsx(un,{className:"h-4 w-4"}),e[54]=Ne):Ne=e[54];let _e;e[55]!==p?(_e=p("sectionsEditor.sectionList.deleteMenuItem"),e[55]=p,e[56]=_e):_e=e[56];let z;e[57]!==Se||e[58]!==_e?(z=s.jsxs(ft,{className:"text-destructive focus:text-destructive",onClick:Se,children:[Ne,_e]}),e[57]=Se,e[58]=_e,e[59]=z):z=e[59];let le;e[60]!==re||e[61]!==pe||e[62]!==ke||e[63]!==Re||e[64]!==z?(le=s.jsxs(mn,{align:"end",className:"w-44",children:[re,pe,ke,Re,z]}),e[60]=re,e[61]=pe,e[62]=ke,e[63]=Re,e[64]=z,e[65]=le):le=e[65];let je;e[66]!==ve||e[67]!==le?(je=s.jsxs(fn,{children:[ve,le]}),e[66]=ve,e[67]=le,e[68]=je):je=e[68];let De;return e[69]!==A||e[70]!==$||e[71]!==m||e[72]!==v||e[73]!==ge||e[74]!==X||e[75]!==ue||e[76]!==O||e[77]!==Ke||e[78]!==je||e[79]!==B?(De=s.jsxs("div",{ref:v,style:ge,...A,...$,role:he,tabIndex:fe,onClick:m,onKeyDown:B,className:X,children:[ue,O,Ke,je]}),e[69]=A,e[70]=$,e[71]=m,e[72]=v,e[73]=ge,e[74]=X,e[75]=ue,e[76]=O,e[77]=Ke,e[78]=je,e[79]=B,e[80]=De):De=e[80],De}function Wo(g){return g.stopPropagation()}function Uo(g){return g.stopPropagation()}function qo(g){return g.stopPropagation()}function Jo(g){return g.stopPropagation()}function Yo(){return!1}function Qo(g){const e=He.c(104),{listKey:o,rawSections:d,sections:f,meta:x,selectedIndex:b,onSelect:m,onReorder:h,onDelete:u,onDuplicate:y,onMakeReusable:k,onToggleHidden:D,onToggleLazy:E,onAddVariant:r,onDetach:p,onAddSection:i,canAddSection:P}=g,l=P===void 0?!0:P,R=at();let A;e[0]!==f.length?(A=()=>Fs(f.length),e[0]=f.length,e[1]=A):A=e[1];const[$,v]=V.useState(A),[C,ie]=V.useState(null),[L,ce]=V.useState(o),[K,ge]=V.useState(f.length),F=V.useRef(!1);L!==o?(ce(o),ge(f.length),v(Fs(f.length))):K!==f.length&&(ge(f.length),v(Ie=>Ho(Ie,f.length)));let ne;e[2]===Symbol.for("react.memo_cache_sentinel")?(ne={activationConstraint:{distance:8}},e[2]=ne):ne=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:Qs},e[3]=he):he=e[3];const fe=Gs(Jt(Us,ne),Jt(Ws,he));let B;e[4]!==$?(B=$.map(Xo),e[4]=$,e[5]=B):B=e[5];const J=B;let X;e[6]===Symbol.for("react.memo_cache_sentinel")?(X=Ie=>{ie(String(Ie.active.id))},e[6]=X):X=e[6];const ue=X;let O;e[7]!==J||e[8]!==h?(O=Ie=>{ie(null);const{active:N,over:ae}=Ie;if(!ae||N.id===ae.id)return;const I=J.indexOf(String(N.id)),Qe=J.indexOf(String(ae.id));I===-1||Qe===-1||(v(Ze=>pn(Pt([...Ze],I,Qe))),F.current=!0,requestAnimationFrame(()=>{F.current=!1}),h?.(I,Qe))},e[7]=J,e[8]=h,e[9]=O):O=e[9];const Ke=O;let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{ie(null)},e[10]=Z):Z=e[10];const Le=Z;let ve,de,oe,ee,re,pe,ke,Re,Se,Ne,_e,z,le,je,De;if(e[11]!==C||e[12]!==l||e[13]!==$||e[14]!==J||e[15]!==Ke||e[16]!==x||e[17]!==i||e[18]!==r||e[19]!==u||e[20]!==p||e[21]!==y||e[22]!==k||e[23]!==m||e[24]!==D||e[25]!==E||e[26]!==d||e[27]!==f||e[28]!==b||e[29]!==fe||e[30]!==R){je=Symbol.for("react.early_return_sentinel");e:{const Ie=N=>{F.current||m(N)};if(e[46]!==C||e[47]!==l||e[48]!==$||e[49]!==i||e[50]!==d||e[51]!==f||e[52]!==R){const N=C?$.find(ae=>ae.id===C):null;if(ee=N!=null?f[N.index]:null,oe=N!=null?d[N.index]:void 0,$.length===0){let ae;e[56]!==R?(ae=R("sectionsEditor.sectionList.noSections"),e[56]=R,e[57]=ae):ae=e[57];let I;e[58]!==ae?(I=s.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:ae}),e[58]=ae,e[59]=I):I=e[59];const Qe=!l;let Ze;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ze=s.jsx(ps,{size:14}),e[60]=Ze):Ze=e[60];let ot;e[61]!==R?(ot=R("sectionsEditor.sectionList.addSectionButton"),e[61]=R,e[62]=ot):ot=e[62];let it;e[63]!==i||e[64]!==Qe||e[65]!==ot?(it=s.jsxs(qe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Qe,onClick:i,children:[Ze,ot]}),e[63]=i,e[64]=Qe,e[65]=ot,e[66]=it):it=e[66];let rt;e[67]!==I||e[68]!==it?(rt=s.jsxs("div",{className:"space-y-2",children:[I,it]}),e[67]=I,e[68]=it,e[69]=rt):rt=e[69],je=rt;break e}le=Be(N&&"cursor-grabbing"),e[46]=C,e[47]=l,e[48]=$,e[49]=i,e[50]=d,e[51]=f,e[52]=R,e[53]=oe,e[54]=ee,e[55]=le}else oe=e[53],ee=e[54],le=e[55];de=Xs,Re=fe,Se=Zs,Ne=ue,_e=Ke,z=Le,ve=en,pe=J,ke=tn,De="space-y-1",re=$.map(N=>{const ae=f[N.index];return ae?s.jsx(Go,{sortableId:N.id,section:ae,raw:d[N.index],meta:x,selected:b===N.index,onSelect:()=>Ie(N.index),onDelete:()=>u(N.index),onDuplicate:()=>y(N.index),onMakeReusable:()=>k(N.index),onToggleHidden:()=>D(N.index),onToggleLazy:()=>E(N.index),onAddVariant:()=>r(N.index),onDetach:()=>p(N.index)},N.id):null})}e[11]=C,e[12]=l,e[13]=$,e[14]=J,e[15]=Ke,e[16]=x,e[17]=i,e[18]=r,e[19]=u,e[20]=p,e[21]=y,e[22]=k,e[23]=m,e[24]=D,e[25]=E,e[26]=d,e[27]=f,e[28]=b,e[29]=fe,e[30]=R,e[31]=ve,e[32]=de,e[33]=oe,e[34]=ee,e[35]=re,e[36]=pe,e[37]=ke,e[38]=Re,e[39]=Se,e[40]=Ne,e[41]=_e,e[42]=z,e[43]=le,e[44]=je,e[45]=De}else ve=e[31],de=e[32],oe=e[33],ee=e[34],re=e[35],pe=e[36],ke=e[37],Re=e[38],Se=e[39],Ne=e[40],_e=e[41],z=e[42],le=e[43],je=e[44],De=e[45];if(je!==Symbol.for("react.early_return_sentinel"))return je;let G;e[70]!==re||e[71]!==De?(G=s.jsx("div",{className:De,children:re}),e[70]=re,e[71]=De,e[72]=G):G=e[72];let Ae;e[73]!==ve||e[74]!==pe||e[75]!==ke||e[76]!==G?(Ae=s.jsx(ve,{items:pe,strategy:ke,children:G}),e[73]=ve,e[74]=pe,e[75]=ke,e[76]=G,e[77]=Ae):Ae=e[77];let Oe;e[78]!==oe||e[79]!==ee||e[80]!==x?(Oe=ee?s.jsx("div",{className:Be("cursor-grabbing shadow-lg ring-1 ring-border/60",hn(ee,!1)),children:s.jsx(gn,{section:ee,raw:oe,meta:x})}):null,e[78]=oe,e[79]=ee,e[80]=x,e[81]=Oe):Oe=e[81];let ze;e[82]!==Oe?(ze=s.jsx(sn,{dropAnimation:null,children:Oe}),e[82]=Oe,e[83]=ze):ze=e[83];let Fe;e[84]!==de||e[85]!==Re||e[86]!==Se||e[87]!==Ne||e[88]!==_e||e[89]!==z||e[90]!==Ae||e[91]!==ze?(Fe=s.jsxs(de,{sensors:Re,collisionDetection:Se,onDragStart:Ne,onDragEnd:_e,onDragCancel:z,children:[Ae,ze]}),e[84]=de,e[85]=Re,e[86]=Se,e[87]=Ne,e[88]=_e,e[89]=z,e[90]=Ae,e[91]=ze,e[92]=Fe):Fe=e[92];const xe=!l;let we;e[93]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx(ps,{size:14}),e[93]=we):we=e[93];let be;e[94]!==R?(be=R("sectionsEditor.sectionList.addSectionButton"),e[94]=R,e[95]=be):be=e[95];let te;e[96]!==i||e[97]!==xe||e[98]!==be?(te=s.jsxs(qe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:xe,onClick:i,children:[we,be]}),e[96]=i,e[97]=xe,e[98]=be,e[99]=te):te=e[99];let me;return e[100]!==le||e[101]!==Fe||e[102]!==te?(me=s.jsxs("div",{className:le,children:[Fe,te]}),e[100]=le,e[101]=Fe,e[102]=te,e[103]=me):me=e[103],me}function Xo(g){return g.id}function Bs(g){const e=He.c(57),{open:o,initialName:d,autoLabel:f,isPending:x,onSubmit:b,onOpenChange:m}=g,h=x===void 0?!1:x,u=at(),[y,k]=V.useState(d),[D,E]=V.useState(o);o!==D&&(E(o),o&&k(d));let r;e[0]!==h||e[1]!==m?(r=ue=>{!ue&&!h&&m(!1)},e[0]=h,e[1]=m,e[2]=r):r=e[2];const p=r;let i;e[3]!==h||e[4]!==y||e[5]!==b?(i=async ue=>{ue.preventDefault(),!h&&await b(y.trim())},e[3]=h,e[4]=y,e[5]=b,e[6]=i):i=e[6];const P=i;let l;e[7]!==u?(l=u("sectionsEditor.variantRenameDialog.title"),e[7]=u,e[8]=l):l=e[8];let R;e[9]!==l?(R=s.jsx(vo,{children:l}),e[9]=l,e[10]=R):R=e[10];let A;e[11]!==f||e[12]!==u?(A=u("sectionsEditor.variantRenameDialog.description",{fallback:f||u("sectionsEditor.variantRenameDialog.defaultFallback")}),e[11]=f,e[12]=u,e[13]=A):A=e[13];let $;e[14]!==A?($=s.jsx(So,{children:A}),e[14]=A,e[15]=$):$=e[15];let v;e[16]!==R||e[17]!==$?(v=s.jsxs(xo,{children:[R,$]}),e[16]=R,e[17]=$,e[18]=v):v=e[18];let C;e[19]!==u?(C=u("sectionsEditor.variantRenameDialog.nameLabel"),e[19]=u,e[20]=C):C=e[20];let ie;e[21]!==C?(ie=s.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:C}),e[21]=C,e[22]=ie):ie=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=ue=>k(ue.target.value),e[23]=L):L=e[23];let ce;e[24]!==f||e[25]!==h||e[26]!==y?(ce=s.jsx(jo,{id:"variant-rename-name",value:y,onChange:L,placeholder:f,autoFocus:!0,disabled:h}),e[24]=f,e[25]=h,e[26]=y,e[27]=ce):ce=e[27];let K;e[28]!==ie||e[29]!==ce?(K=s.jsxs("div",{className:"space-y-1.5 py-4",children:[ie,ce]}),e[28]=ie,e[29]=ce,e[30]=K):K=e[30];let ge;e[31]!==m?(ge=()=>m(!1),e[31]=m,e[32]=ge):ge=e[32];let F;e[33]!==u?(F=u("sectionsEditor.variantRenameDialog.cancel"),e[33]=u,e[34]=F):F=e[34];let ne;e[35]!==h||e[36]!==ge||e[37]!==F?(ne=s.jsx(qe,{type:"button",variant:"outline",onClick:ge,disabled:h,children:F}),e[35]=h,e[36]=ge,e[37]=F,e[38]=ne):ne=e[38];let he;e[39]!==h||e[40]!==u?(he=h?s.jsxs(s.Fragment,{children:[s.jsx(Hs,{size:14,className:"animate-spin"}),u("sectionsEditor.variantRenameDialog.saving")]}):u("sectionsEditor.variantRenameDialog.save"),e[39]=h,e[40]=u,e[41]=he):he=e[41];let fe;e[42]!==h||e[43]!==he?(fe=s.jsx(qe,{type:"submit",disabled:h,children:he}),e[42]=h,e[43]=he,e[44]=fe):fe=e[44];let B;e[45]!==ne||e[46]!==fe?(B=s.jsxs(bo,{children:[ne,fe]}),e[45]=ne,e[46]=fe,e[47]=B):B=e[47];let J;e[48]!==P||e[49]!==K||e[50]!==B||e[51]!==v?(J=s.jsx(yo,{className:"sm:max-w-md",children:s.jsxs("form",{onSubmit:P,children:[v,K,B]})}),e[48]=P,e[49]=K,e[50]=B,e[51]=v,e[52]=J):J=e[52];let X;return e[53]!==p||e[54]!==o||e[55]!==J?(X=s.jsx(_o,{open:o,onOpenChange:p,children:J}),e[53]=p,e[54]=o,e[55]=J,e[56]=X):X=e[56],X}const Zo="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)]",vn="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)]";function Sn(g){const e=He.c(5),{rule:o,matchers:d}=g,f=o?.__resolveType??"";let x;if(e[0]!==d||e[1]!==f){const u=d.find(y=>y.resolveType===f)?.iconName??Va(f);x=mo(u),e[0]=d,e[1]=f,e[2]=x}else x=e[2];const b=x;if(!b)return null;let m;return e[3]!==b?(m=s.jsx(b,{size:14,className:"shrink-0"}),e[3]=b,e[4]=m):m=e[4],m}function Os(g){return g.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
2
2
|
`)}function ms(g){return g.map((e,o)=>({id:crypto.randomUUID(),index:o,variant:e}))}function ei(g){return g.map((e,o)=>({...e,index:o}))}function xn(g){const e=He.c(17),{label:o,effectiveRule:d,matchers:f,canDelete:x,dragging:b,onRename:m,onDuplicate:h,onDelete:u}=g,y=at();let k;e[0]!==d||e[1]!==f?(k=s.jsx(Sn,{rule:d,matchers:f}),e[0]=d,e[1]=f,e[2]=k):k=e[2];let D;e[3]!==o?(D=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o}),e[3]=o,e[4]=D):D=e[4];let E;e[5]!==x||e[6]!==b||e[7]!==o||e[8]!==u||e[9]!==h||e[10]!==m||e[11]!==y?(E=!b&&s.jsxs(fn,{children:[s.jsx(dn,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":y("sectionsEditor.pageVariantTabs.actionsAriaLabel",{label:o}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:si,onPointerDown:ti,children:s.jsx(an,{size:14})})}),s.jsxs(mn,{align:"end",className:"w-36",children:[s.jsxs(ft,{onClick:p=>{p.stopPropagation(),m?.()},children:[s.jsx(Lo,{size:14}),y("sectionsEditor.pageVariantTabs.renameAction")]}),s.jsxs(ft,{onClick:p=>{p.stopPropagation(),h?.()},children:[s.jsx(ln,{size:14}),y("sectionsEditor.pageVariantTabs.duplicateAction")]}),s.jsx(Vo,{}),s.jsxs(ft,{variant:"destructive",disabled:!x,onClick:p=>{p.stopPropagation(),u?.()},children:[s.jsx(un,{size:14}),y("sectionsEditor.pageVariantTabs.deleteAction")]})]})]}),e[5]=x,e[6]=b,e[7]=o,e[8]=u,e[9]=h,e[10]=m,e[11]=y,e[12]=E):E=e[12];let r;return e[13]!==k||e[14]!==D||e[15]!==E?(r=s.jsxs(s.Fragment,{children:[k,D,E]}),e[13]=k,e[14]=D,e[15]=E,e[16]=r):r=e[16],r}function ti(g){return g.stopPropagation()}function si(g){return g.stopPropagation()}function ni(g){const e=He.c(33),{entry:o,sortableId:d,isActive:f,canDelete:x,decofile:b,meta:m,matchers:h,onSelect:u,onRename:y,onDuplicate:k,onDelete:D}=g;let E;e[0]!==d?(E={id:d,animateLayoutChanges:ai},e[0]=d,e[1]=E):E=e[1];const{attributes:r,listeners:p,setNodeRef:i,transform:P,isDragging:l}=Js(E);let R;e[2]!==P?(R=Ys.Transform.toString(P?{...P,x:0}:null),e[2]=P,e[3]=R):R=e[3];const A=l?0:void 0;let $;e[4]!==R||e[5]!==A?($={transform:R,opacity:A},e[4]=R,e[5]=A,e[6]=$):$=e[6];const v=$,C=m??void 0;let ie;e[7]!==b||e[8]!==o.variant.rule||e[9]!==C?(ie=Ct(o.variant.rule,b,C),e[7]=b,e[8]=o.variant.rule,e[9]=C,e[10]=ie):ie=e[10];const L=ie;let ce;e[11]!==u?(ce=fe=>{fe.target===fe.currentTarget&&(fe.key==="Enter"||fe.key===" ")&&(fe.preventDefault(),u())},e[11]=u,e[12]=ce):ce=e[12];const K=l?"cursor-grabbing":"cursor-pointer active:cursor-grabbing",ge=f?vn:Zo;let F;e[13]!==K||e[14]!==ge?(F=Be("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",K,ge),e[13]=K,e[14]=ge,e[15]=F):F=e[15];let ne;e[16]!==x||e[17]!==L||e[18]!==o.variant.label||e[19]!==h||e[20]!==D||e[21]!==k||e[22]!==y?(ne=s.jsx(xn,{label:o.variant.label,effectiveRule:L,matchers:h,canDelete:x,onRename:y,onDuplicate:k,onDelete:D}),e[16]=x,e[17]=L,e[18]=o.variant.label,e[19]=h,e[20]=D,e[21]=k,e[22]=y,e[23]=ne):ne=e[23];let he;return e[24]!==r||e[25]!==p||e[26]!==u||e[27]!==i||e[28]!==v||e[29]!==F||e[30]!==ne||e[31]!==ce?(he=s.jsx("div",{ref:i,style:v,...r,...p,onClick:u,onKeyDown:ce,className:F,children:ne}),e[24]=r,e[25]=p,e[26]=u,e[27]=i,e[28]=v,e[29]=F,e[30]=ne,e[31]=ce,e[32]=he):he=e[32],he}function ai(){return!1}function oi(g){const e=He.c(9),{variant:o,decofile:d,meta:f,matchers:x}=g,b=f??void 0;let m;e[0]!==d||e[1]!==b||e[2]!==o.rule?(m=Ct(o.rule,d,b),e[0]=d,e[1]=b,e[2]=o.rule,e[3]=m):m=e[3];const h=m;let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=Be("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",vn),e[4]=u):u=e[4];let y;return e[5]!==h||e[6]!==x||e[7]!==o.label?(y=s.jsx("div",{className:u,children:s.jsx(xn,{label:o.label,effectiveRule:h,matchers:x,canDelete:!1,dragging:!0})}),e[5]=h,e[6]=x,e[7]=o.label,e[8]=y):y=e[8],y}function ii(g){const e=He.c(91),{listKey:o,variants:d,activeIndex:f,decofile:x,meta:b,matchers:m,onSelect:h,onReorder:u,onRename:y,onDuplicate:k,onDelete:D,onAdd:E}=g,r=at();let p;e[0]!==d?(p=()=>ms(d),e[0]=d,e[1]=p):p=e[1];const[i,P]=V.useState(p),[l,R]=V.useState(null),[A,$]=V.useState(o),[v,C]=V.useState(d.length);let ie;e[2]!==d?(ie=()=>Os(d),e[2]=d,e[3]=ie):ie=e[3];const[L,ce]=V.useState(ie),K=V.useRef(!1),ge=Os(d);A!==o?($(o),C(d.length),ce(ge),P(ms(d))):v!==d.length?(C(d.length),ce(ge),P(ms(d))):L!==ge&&(ce(ge),P(Fe=>d.map((xe,we)=>({id:Fe[we]?.id??crypto.randomUUID(),index:we,variant:xe}))));let F;e[4]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[4]=F):F=e[4];let ne;e[5]===Symbol.for("react.memo_cache_sentinel")?(ne={coordinateGetter:Qs},e[5]=ne):ne=e[5];const he=Gs(Jt(Us,F),Jt(Ws,ne));let fe;e[6]!==i?(fe=i.map(ri),e[6]=i,e[7]=fe):fe=e[7];const B=fe,J=d.length>1;let X;e[8]!==i?(X=Fe=>{const xe=String(Fe.active.id);R(i.find(we=>we.id===xe)??null)},e[8]=i,e[9]=X):X=e[9];const ue=X;let O;e[10]!==B||e[11]!==u?(O=Fe=>{R(null);const{active:xe,over:we}=Fe;if(!we||xe.id===we.id)return;const be=B.indexOf(String(xe.id)),te=B.indexOf(String(we.id));be===-1||te===-1||(P(me=>ei(Pt([...me],be,te))),K.current=!0,requestAnimationFrame(()=>{K.current=!1}),u(be,te))},e[10]=B,e[11]=u,e[12]=O):O=e[12];const Ke=O;let Z;e[13]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{R(null)},e[13]=Z):Z=e[13];const Le=Z;let ve,de,oe,ee,re,pe,ke,Re,Se,Ne,_e,z,le;if(e[14]!==f||e[15]!==J||e[16]!==x||e[17]!==i||e[18]!==B||e[19]!==Ke||e[20]!==ue||e[21]!==m||e[22]!==b||e[23]!==E||e[24]!==D||e[25]!==k||e[26]!==y||e[27]!==h||e[28]!==he||e[29]!==r){const Fe=I=>{K.current||h(I)};_e="space-y-1 border-b p-2";let xe;e[43]!==r?(xe=r("sectionsEditor.pageVariantTabs.variantsLabel"),e[43]=r,e[44]=xe):xe=e[44];let we;e[45]!==xe?(we=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:xe}),e[45]=xe,e[46]=we):we=e[46];let be;e[47]!==r?(be=r("sectionsEditor.pageVariantTabs.addVariantAriaLabel"),e[47]=r,e[48]=be):be=e[48];let te;e[49]===Symbol.for("react.memo_cache_sentinel")?(te=s.jsx(ps,{size:14}),e[49]=te):te=e[49];let me;e[50]!==E||e[51]!==be?(me=s.jsx(xt,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":be,className:"size-6",onClick:E,children:te})}),e[50]=E,e[51]=be,e[52]=me):me=e[52];let Ie;e[53]!==r?(Ie=r("sectionsEditor.pageVariantTabs.addVariantTooltip"),e[53]=r,e[54]=Ie):Ie=e[54];let N;e[55]!==Ie?(N=s.jsx(bt,{children:Ie}),e[55]=Ie,e[56]=N):N=e[56];let ae;e[57]!==me||e[58]!==N?(ae=s.jsxs(St,{children:[me,N]}),e[57]=me,e[58]=N,e[59]=ae):ae=e[59],e[60]!==we||e[61]!==ae?(z=s.jsxs("div",{className:"flex items-center justify-between",children:[we,ae]}),e[60]=we,e[61]=ae,e[62]=z):z=e[62],de=Xs,pe=he,ke=Zs,Re=ue,Se=Ke,Ne=Le,ve=en,ee=B,re=tn,le="space-y-0.5",oe=i.map(I=>s.jsx(ni,{sortableId:I.id,entry:I,isActive:I.index===f,canDelete:J,decofile:x,meta:b,matchers:m,onSelect:()=>Fe(I.index),onRename:()=>y(I.index),onDuplicate:()=>k(I.index),onDelete:()=>D(I.index)},I.id)),e[14]=f,e[15]=J,e[16]=x,e[17]=i,e[18]=B,e[19]=Ke,e[20]=ue,e[21]=m,e[22]=b,e[23]=E,e[24]=D,e[25]=k,e[26]=y,e[27]=h,e[28]=he,e[29]=r,e[30]=ve,e[31]=de,e[32]=oe,e[33]=ee,e[34]=re,e[35]=pe,e[36]=ke,e[37]=Re,e[38]=Se,e[39]=Ne,e[40]=_e,e[41]=z,e[42]=le}else ve=e[30],de=e[31],oe=e[32],ee=e[33],re=e[34],pe=e[35],ke=e[36],Re=e[37],Se=e[38],Ne=e[39],_e=e[40],z=e[41],le=e[42];let je;e[63]!==oe||e[64]!==le?(je=s.jsx("div",{className:le,children:oe}),e[63]=oe,e[64]=le,e[65]=je):je=e[65];let De;e[66]!==ve||e[67]!==ee||e[68]!==re||e[69]!==je?(De=s.jsx(ve,{items:ee,strategy:re,children:je}),e[66]=ve,e[67]=ee,e[68]=re,e[69]=je,e[70]=De):De=e[70];let G;e[71]!==l||e[72]!==x||e[73]!==m||e[74]!==b?(G=l?s.jsx(oi,{variant:l.variant,decofile:x,meta:b,matchers:m}):null,e[71]=l,e[72]=x,e[73]=m,e[74]=b,e[75]=G):G=e[75];let Ae;e[76]!==G?(Ae=s.jsx(sn,{dropAnimation:null,children:G}),e[76]=G,e[77]=Ae):Ae=e[77];let Oe;e[78]!==de||e[79]!==pe||e[80]!==ke||e[81]!==Re||e[82]!==Se||e[83]!==Ne||e[84]!==De||e[85]!==Ae?(Oe=s.jsxs(de,{sensors:pe,collisionDetection:ke,onDragStart:Re,onDragEnd:Se,onDragCancel:Ne,children:[De,Ae]}),e[78]=de,e[79]=pe,e[80]=ke,e[81]=Re,e[82]=Se,e[83]=Ne,e[84]=De,e[85]=Ae,e[86]=Oe):Oe=e[86];let ze;return e[87]!==_e||e[88]!==z||e[89]!==Oe?(ze=s.jsxs("div",{className:_e,children:[z,Oe]}),e[87]=_e,e[88]=z,e[89]=Oe,e[90]=ze):ze=e[90],ze}function ri(g){return g.id}function li(g){const e=He.c(16),{schema:o,value:d,onChange:f,meta:x,decofile:b,onSaveReferencedBlock:m,sandbox:h}=g,u=at();let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0];const[k,D]=V.useState(y);let E;e[1]!==k||e[2]!==u?(E=k.length>0&&s.jsxs("nav",{"aria-label":u("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[s.jsx("button",{type:"button",onClick:()=>D([]),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:u("sectionsEditor.sectionsEditorPanels.backToRule"),children:s.jsx(on,{className:"size-3.5"})}),k.map((i,P)=>{const l=P===k.length-1;return s.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[P>0&&s.jsx(rn,{className:"size-3 shrink-0 text-muted-foreground/60"}),s.jsx("button",{type:"button",onClick:()=>D(k.slice(0,P+1)),title:i,className:Be("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",l?"font-medium text-foreground":"text-muted-foreground"),children:i})]},`${i}-${P}`)})]}),e[1]=k,e[2]=u,e[3]=E):E=e[3];let r;e[4]!==k||e[5]!==b||e[6]!==x||e[7]!==f||e[8]!==m||e[9]!==h||e[10]!==o||e[11]!==d?(r=s.jsx(nn,{schema:o,value:d,onChange:f,basePath:"",breadcrumbPath:k,onBreadcrumbChange:D,meta:x,decofile:b,onSaveReferencedBlock:m,sandbox:h}),e[4]=k,e[5]=b,e[6]=x,e[7]=f,e[8]=m,e[9]=h,e[10]=o,e[11]=d,e[12]=r):r=e[12];let p;return e[13]!==E||e[14]!==r?(p=s.jsxs("div",{className:"space-y-2",children:[E,r]}),e[13]=E,e[14]=r,e[15]=p):p=e[15],p}function Is(g){const e=He.c(21),{activeSchema:o,formValue:d,formResetKey:f,onFormChange:x,onBreadcrumbChange:b,breadcrumbPath:m,emptyMessage:h,beforeForm:u,seoResolveType:y,siteDefaultSeo:k,meta:D,decofile:E,onSaveReferencedBlock:r,sandbox:p}=g;let i;e[0]!==m?(i=m===void 0?[]:m,e[0]=m,e[1]=i):i=e[1];const P=i;let l;e[2]!==o||e[3]!==P||e[4]!==E||e[5]!==f||e[6]!==d||e[7]!==D||e[8]!==b||e[9]!==x||e[10]!==r||e[11]!==p||e[12]!==y||e[13]!==k?(l=o&&d?y?s.jsx(No,{schema:o,resolveType:y,value:d,formResetKey:f,onChange:x,onBreadcrumbChange:b,siteDefaultSeo:k}):s.jsx(nn,{schema:o,value:d,onChange:x,basePath:"",breadcrumbPath:P,onBreadcrumbChange:b,meta:D,decofile:E,onSaveReferencedBlock:r,sandbox:p},f):null,e[2]=o,e[3]=P,e[4]=E,e[5]=f,e[6]=d,e[7]=D,e[8]=b,e[9]=x,e[10]=r,e[11]=p,e[12]=y,e[13]=k,e[14]=l):l=e[14];const R=l;let A;e[15]!==h||e[16]!==R?(A=R??s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:h}),e[15]=h,e[16]=R,e[17]=A):A=e[17];let $;return e[18]!==u||e[19]!==A?($=s.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:s.jsxs("div",{className:"mx-auto max-w-2xl",children:[u,A]})}),e[18]=u,e[19]=A,e[20]=$):$=e[20],$}const ci="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 ui(g,e){return Na(g,e,nt)}function di(g){const e=He.c(19),{pageKey:o,initialName:d,initialPath:f,onFieldChange:x}=g,b=at(),[m,h]=V.useState(d),[u,y]=V.useState(f),[k,D]=V.useState(o);k!==o&&(D(o),h(d),y(f));let E;e[0]!==x?(E=A=>{h(A.target.value),x("name",A.target.value)},e[0]=x,e[1]=E):E=e[1];let r;e[2]!==b?(r=b("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[2]=b,e[3]=r):r=e[3];let p;e[4]!==m||e[5]!==E||e[6]!==r?(p=s.jsx("input",{type:"text",value:m,onChange:E,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:r}),e[4]=m,e[5]=E,e[6]=r,e[7]=p):p=e[7];let i;e[8]!==x?(i=A=>{y(A.target.value),x("path",A.target.value)},e[8]=x,e[9]=i):i=e[9];let P;e[10]!==b?(P=b("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[10]=b,e[11]=P):P=e[11];let l;e[12]!==u||e[13]!==i||e[14]!==P?(l=s.jsx("input",{type:"text",value:u,onChange:i,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:P}),e[12]=u,e[13]=i,e[14]=P,e[15]=l):l=e[15];let R;return e[16]!==p||e[17]!==l?(R=s.jsxs("div",{className:"space-y-1",children:[p,l]}),e[16]=p,e[17]=l,e[18]=R):R=e[18],R}function $s(g){const e=He.c(13),{onClick:o}=g,d=at();let f;e[0]!==d?(f=d("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=d,e[1]=f):f=e[1];let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(cn,{size:14}),e[2]=x):x=e[2];let b;e[3]!==o||e[4]!==f?(b=s.jsx(xt,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":f,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:o,children:x})}),e[3]=o,e[4]=f,e[5]=b):b=e[5];let m;e[6]!==d?(m=d("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=d,e[7]=m):m=e[7];let h;e[8]!==m?(h=s.jsx(bt,{side:"bottom",children:m}),e[8]=m,e[9]=h):h=e[9];let u;return e[10]!==b||e[11]!==h?(u=s.jsxs(St,{children:[b,h]}),e[10]=b,e[11]=h,e[12]=u):u=e[12],u}function zs(g){const e=He.c(21),{currentRt:o,currentLabel:d,currentGlobalKey:f,matchers:x,globals:b,onSelect:m,onSelectGlobal:h,schema:u,formValue:y,onChange:k,formKey:D,formWrapperClassName:E,meta:r,decofile:p,onSaveReferencedBlock:i,sandbox:P}=g;let l;e[0]!==f||e[1]!==d||e[2]!==o||e[3]!==b||e[4]!==x||e[5]!==m||e[6]!==h?(l=s.jsx(Da,{currentRt:o,currentLabel:d,currentGlobalKey:f,matchers:x,globals:b,onSelect:m,onSelectGlobal:h}),e[0]=f,e[1]=d,e[2]=o,e[3]=b,e[4]=x,e[5]=m,e[6]=h,e[7]=l):l=e[7];let R;e[8]!==p||e[9]!==D||e[10]!==y||e[11]!==E||e[12]!==r||e[13]!==k||e[14]!==i||e[15]!==P||e[16]!==u?(R=u&&y&&s.jsx("div",{className:E,children:s.jsx(li,{schema:u,value:y,onChange:k,meta:r,decofile:p,onSaveReferencedBlock:i,sandbox:P},D)}),e[8]=p,e[9]=D,e[10]=y,e[11]=E,e[12]=r,e[13]=k,e[14]=i,e[15]=P,e[16]=u,e[17]=R):R=e[17];let A;return e[18]!==l||e[19]!==R?(A=s.jsxs(s.Fragment,{children:[l,R]}),e[18]=l,e[19]=R,e[20]=A):A=e[20],A}function oc({orgSlug:g,virtualMcpId:e,branch:o,previewReady:d=!0,previewUrl:f,currentPath:x,activePageBlockKey:b=null,activeGlobalBlockKey:m=null,externalSelectedIndex:h,onSaved:u,initialEditSeo:y=!1,onExitSeo:k,onViewJsonFile:D,onVariantPreviewOverride:E}){const r=at(),p=d?{orgSlug:g,virtualMcpId:e,branch:o,previewUrl:f}:null,{data:i,isLoading:P}=Ta(p),{data:l,isLoading:R}=Pa(p),A=Ca(),$=A?.entity?.id===e?A.entity.metadata?.siteSlug??null:null,[v,C]=V.useState(null),[ie,L]=V.useState(null),[ce,K]=V.useState(null),[ge,F]=V.useState(0),[ne,he]=V.useState(void 0),[fe,B]=V.useState(null),[J,X]=V.useState(null),[ue,O]=V.useState([]),[Ke,Z]=V.useState(0),[Le,ve]=V.useState(null),[de,oe]=V.useState(null),[ee,re]=V.useState(null),[pe,ke]=V.useState(!0),[Re,Se]=V.useState(!1),[Ne,_e]=V.useState(!1),[z,le]=V.useState(y),[je,De]=V.useState(y);y&&!je&&(De(!0),le(!0),C(null),L(null),K(null),O([])),!y&&je&&De(!1);const[G,Ae]=V.useState(null),[Oe,ze]=V.useState(void 0),[Fe,xe]=V.useState([]),[we,be]=V.useState(0),[te,me]=V.useState(0),[Ie,N]=V.useState(null),[ae,I]=V.useState(null),[Qe,Ze]=V.useState(null),ot=xa(),it=`${g}/${e}/${o}`,rt=Aa({orgSlug:g,virtualMcpId:e,branch:o}),[bn,yn]=V.useState(x),[_n,jn]=V.useState(b),[En,kn]=V.useState(m);(bn!==x||_n!==b||En!==m)&&(queueMicrotask(()=>rt.flush()),yn(x),jn(b),kn(m),C(null),L(null),K(null),F(0),B(null),X(null),me(0),N(null),I(null),O([]),Z(t=>t+1),le(!1),Ae(null),ze(void 0),xe([]),be(t=>t+1));const Ve=Ma({orgSlug:g,virtualMcpId:e,branch:o}),At=eo((t,n)=>{Ve.mutate({blockKey:t,data:n},{onSuccess:()=>u?.(),onError:a=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:a.message}))})}),Yt=Ka({orgSlug:g,virtualMcpId:e,branch:o}),[wt,Mt]=V.useState(!1),Qt=V.useRef(null),yt=V.useRef(null),_t=V.useRef(null),Xt=V.useRef({}),Je=V.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!d||P||R)return s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:s.jsx(Hs,{size:20,className:"animate-spin text-muted-foreground"})});if(!i||!l)return s.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Rn=La(i),Te=!!m,Ge=Te?null:Fa(Rn,x,b),w=Te?m:Ge?.key??null,Zt=Te&&m?i[m]:void 0,gs=Te&&m&&Zt?Ba(m,Zt):Te&&m?m:"",Kt=!Te&&w&&i[w]?i[w]:null,es=z&&i&&l&&w&&Ge?Ls(i,{kind:"page",pageKey:w,pageName:String(Ge.name??""),path:String(Ge.path??"")},l):null,wn=z?Kt?.seo:void 0,ts=Oe!==void 0?Oe:wn,Vn=z?Do(ts):void 0,Nn=es?.seoTypeOptions??[],Dn=z&&l?To(l):"",hs=G??Vn??{},ss=z&&es?Po(hs,es):null,Tn=z&&ss&&Co(ts)?Ht(ss,l):null,Pn=z?Ao(i,l)?.seoData:void 0,$e=Te?[{label:"Default",sections:[{__resolveType:m}]}]:ui(Kt?.sections,i??{}),Lt=$e.length>1,Ce=Math.min(ge,$e.length-1),lt=$e[Ce],U=lt?.sections??[],Me=Gt(U,i),vs=!Te&&Oa(Kt?.sections);if(Te&&m&&Qe!==m){Ze(m);const t=U[0],n=Me[0];if(t&&n){C(0),me(0),O([]);const a=ht(t,n,i);a&&(L(a.data),K(a.resolveType),I(null),N(null))}}!Te&&Qe!==null&&Ze(null),Je.current={rawSections:U,parsedSections:Me,decofile:i??{},activePageKey:w,pageVariants:$e,variantIndex:Ce,sectionVariantIndex:te,selectedSectionIndex:v};const Cn=()=>({multivariate:vs,index:Ce,variants:$e.map(t=>({rule:t.rule}))}),Ss=(t,n)=>{if(!E)return;if(!w||!vs||t.length<=1){E(null);return}const a=Ms(w,{multivariate:!0,index:n,variants:t},i,l);E(a.length>0?a:null)},jt=(t,n,a)=>{if(!E)return;if(!w){E(null);return}const c=Cn(),S=Ms(w,c,i,l);if(!t||n<0){E(S.length>0?S:null);return}const j=oo({pageKey:w,page:c,sectionIndex:n,sectionLazy:Me[n]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:i,meta:l}),_=[...S,...j];E(_.length>0?_:null)},ct=(t,n,a,c=v??-1,S=!1)=>{const j=Xe(t,n);if(!j){L(null),K(null),I(null),N(null),S&&jt(null,c,a);return}const T=Ts(j,nt)[a];if(!T){L(null),K(null),I(null),N(null),S&&jt(null,c,a);return}const se=Wa(T.value,i);L(se?.data??null),K(se?.resolveType??null);const{resolveType:M,formValue:H}=Nt(T.rule,i,l??void 0);I(M),N(H),S&&jt(j,c,a)};if(h!==void 0&&h!==ne&&(he(h??null),typeof h=="number")){const t=U[h],n=Me[h];if(t&&n)if(C(h),me(0),O([]),Z(a=>a+1),n.isMultivariate)ct(t,n,0,h);else{const a=ht(t,n,i);a?(L(a.data),K(a.resolveType)):(L(null),K(null)),I(null),N(null)}}const Ft={orgSlug:g,virtualMcpId:e,branch:o,previewUrl:f??void 0,siteSlug:$},ns=ce&&l?Ht(ce,l):null,We=(t,n)=>{if(!w)return;const a=Tt(i,w,t,Ce,$e);Ve.mutate({blockKey:w,data:a},{onSuccess:()=>n?.onSuccess?.()??u?.(),onError:c=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},Et=()=>{C(null),L(null),K(null),me(0),N(null),I(null),O([]),Z(t=>t+1)},An=(t,n)=>{Qt.current&&clearTimeout(Qt.current);const a=Je.current.sectionVariantIndex;Qt.current=setTimeout(()=>{const{rawSections:c,parsedSections:S,decofile:j,activePageKey:_,pageVariants:T,variantIndex:se}=Je.current,M=c[n];if(!M)return;const H=S[n];if(!H)return;if(H.isSavedBlock){const q=H.isLazy?M.section?.__resolveType??M.__resolveType:M.__resolveType;Ve.mutate({blockKey:q,data:t},{onSuccess:()=>u?.(),onError:Y=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:Y.message}))});return}if(!_)return;const W={...j[_]},Ee=[...c];if(H.isMultivariate){const q=Xe(M,H);if(!q||!_)return;const Y=ro(q,a,t);Ee[n]=vt(M,H,Y)}else if(H.isHidden){const q=qs(M.__resolveType),Y=q?{...M.section}:{...M},Pe=Array.isArray(Y.variants)?[...Y.variants]:[];Pe[0]&&(Pe[0]={...Pe[0],value:t}),Y.variants=Pe,q?Ee[n]={...M,section:Y}:Ee[n]=Y}else H.isLazy?Ee[n]={...M,section:t}:Ee[n]=t;if(T.length>1){const q=W.sections,Y=[...q?.variants??[]];Y[se]&&(Y[se]={...Y[se],value:Ee}),W.sections={...q,variants:Y}}else W.sections=Ee;Ve.mutate({blockKey:_,data:W},{onSuccess:()=>u?.(),onError:q=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:q.message}))})},ds)},Mn=t=>{C(t),me(0),O([]),Z(S=>S+1);const n=U[t],a=Me[t];if(!n||!a)return;if(a.isMultivariate){ct(n,a,0,t);return}const c=ht(n,a,i);if(!c){L(null),K(null),I(null),N(null),jt(null,t,0);return}L(c.data),K(c.resolveType),I(null),N(null),jt(null,t,0)},xs=t=>{const n=t;L(n),v!==null&&An(n,v)},as=t=>{if(!w||!i||!l||!Ge)return;const n={kind:"page",pageKey:w,pageName:String(Ge.name??""),path:String(Ge.path??"")},a=Ls(i,n,l);a&&rt.save(w,()=>{const c=ot.getQueryData(ba.decofile(it))?.[w];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const S={...c,...Xt.current};return Xt.current={},t?.raw!==void 0?{...S,seo:t.raw}:t?.inner!==void 0?Ko(n,a,S,t.inner):S})},Kn=(t,n)=>{w&&(Xt.current[t]=n,as())},Ln=(t,n)=>{if(!w)return;const a=Pt([...U],t,n);v!==null&&(v===t?C(n):t<v&&n>=v?C(v-1):t>v&&n<=v&&C(v+1)),We(a)},Fn=t=>{if(!w)return;const n=U.filter((a,c)=>c!==t);v===t?Et():v!==null&&v>t&&C(v-1),We(n)},Bn=t=>{if(!w)return;const n=U[t];if(!n)return;const a=[...U];a.splice(t+1,0,ao(n)),v!==null&&v>t&&C(v+1),We(a)},On=t=>{if(!w)return;const n=U[t],a=Me[t];if(!n||!a||a.isMultivariate)return;const c=a.isHidden?so(n):no(n);if(!c)return;const S=[...U];S[t]=c,v===t&&Et(),We(S)},In=t=>{if(!w)return;const n=U[t],a=Me[t];if(!n||!a||a.isMultivariate)return;const c=to(n);if(!c)return;const S=[...U];S[t]=c,v===t&&Et(),We(S)},$n=t=>{if(!w)return;const n=U[t],a=Me[t];if(!n||!a?.isSavedBlock)return;const c=ht(n,a,i);if(!c?.data)return;const{name:S,...j}=c.data,_=[...U];a.isLazy?_[t]={...n,section:j}:_[t]=j,v===t&&Et(),We(_)},zn=t=>{if(!w)return;const n=[...U,{__resolveType:t.resolveType}],a=n.length-1;We(n,{onSuccess:()=>{Se(!1),C(a),me(0),O([]),Z(_=>_+1);const c=n[a],S=Gt(n,i)[a];if(!c||!S)return;if(S.isMultivariate){ct(c,S,0);return}const j=ht(c,S,i);if(!j){L(null),K(null),I(null),N(null);return}L(j.data),K(j.resolveType),I(null),N(null)}})},Hn=t=>{if(v===null)return;const n=U[v],a=Me[v];!n||!a?.isMultivariate||(me(t),O([]),Z(c=>c+1),ct(n,a,t,v,!0))},Gn=t=>{if(v===null||!w)return;const n=U[v],a=Me[v];if(!n||!a?.isMultivariate)return;const c=Xe(n,a);if(!c)return;const S=Xa(c,t);if(!S){Q.error(r("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const j=[...U];j[v]=vt(n,a,S);const _=S.variants;let T=te;t===te?T=Math.min(t,_.length-1):t<te&&(T=te-1),me(T),O([]),Z(se=>se+1),ct(j[v],a,T),We(j)},Wn=t=>{if(v===null||!w)return;const n=U[v],a=Me[v];if(!n||!a?.isMultivariate)return;const c=Xe(n,a);if(!c)return;const S=Za(c,t),j=[...U];j[v]=vt(n,a,S);const _=t+1;me(_),O([]),Z(T=>T+1),ct(j[v],a,_),We(j)},Un=(t,n)=>{if(v===null||!w||t===n)return;const a=U[v],c=Me[v];if(!a||!c?.isMultivariate)return;const S=Xe(a,c);if(!S)return;const j=Ya(S,t,n),_=[...U];_[v]=vt(a,c,j);let T=te;te===t?T=n:t<te&&n>=te?T=te-1:t>te&&n<=te&&(T=te+1),me(T),ct(_[v],c,T),We(_)},os=t=>{const n=t??v;if(n===null||!w)return;const a=U[n],c=Me[n];if(!a||!c)return;const S=Ua(a,c);if(!S){Q.error(r("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const j=[...U];j[n]=S.section;const _=Gt(j,i)[n];if(!_?.isMultivariate){Q.error(r("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}C(n),me(S.newVariantIndex),O([]),Z(T=>T+1),ct(S.section,_,S.newVariantIndex,n),We(j)},qn=()=>{if(v===null||!w)return;const t=U[v],n=Me[v];if(!t||!n?.isMultivariate)return;const a=Xe(t,n);if(!a)return;const c=Qa(t,n,a);if(!c){Q.error(r("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const S=[...U];S[v]=c;const j=Gt(S,i)[v];if(!j)return;me(0),I(null),N(null),O([]),Z(T=>T+1);const _=ht(c,j,i);_?(L(_.data),K(_.resolveType)):(L(null),K(null)),jt(null,v,0),We(S)},Jn=async t=>{if(Le===null||!w)return;const n=us(t,i);if(n){Q.error(n);return}const a=U[Le],c=Me[Le];if(!a||!c)return;const S=ht(a,c,i);if(!S){Q.error(r("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const j={...S.data,name:t};try{await Ve.mutateAsync({blockKey:t,data:j});const _=[...U];_[Le]={__resolveType:t},await Ve.mutateAsync({blockKey:w,data:Tt(i,w,_,Ce,$e)}),v===Le&&Et(),ve(null),Q.success(r("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),u?.()}catch(_){Q.error(_ instanceof Error?_.message:r("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"))}},bs=lt?.rule;if(Lt&&v===null&&J===null&&bs){const{resolveType:t,formValue:n}=Nt(bs,i??{},l??void 0);X(t),B(n)}const Bt=l?Ia(l):[],ys=l&&i?$a(l,i):[],Yn=!Te&&!!(f&&l&&i),Qn=J&&l?Ht(J,l):null,Ot=()=>{yt.current&&(clearTimeout(yt.current),yt.current=null),_t.current&&(clearTimeout(_t.current),_t.current=null)},Vt=async(t,n)=>{if(!(io(n,t,l)>0))try{await Yt.mutateAsync({blockKey:t})}catch(a){Q.error(a instanceof Error?a.message:r("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"))}},_s=t=>{yt.current&&clearTimeout(yt.current),yt.current=setTimeout(()=>{const{activePageKey:n,decofile:a,variantIndex:c}=Je.current;if(!n)return;const S={...a[n]},j={...S.sections},_=[...j.variants??[]],T=_[c],se=T?.rule;if(kt(se,a,l)){const M=se?.__resolveType??"",H=a[M],W=typeof H?.name=="string"?H.name:M,{__resolveType:Ee,...q}=t;Ve.mutate({blockKey:M,data:Rt(Ee??"",q,W)},{onSuccess:()=>u?.(),onError:Y=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:Y.message}))});return}T&&(_[c]={...T,rule:t}),S.sections={...j,variants:_},Ve.mutate({blockKey:n,data:S},{onSuccess:()=>u?.(),onError:M=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:M.message}))})},ds)},Xn=t=>{X(t);const n=t?{__resolveType:t}:{__resolveType:Ks};B({}),_s(n)},Zn=t=>{const n=t;B(n);const a=J?{__resolveType:J,...n}:{...n};_s(a)},ea=async t=>{Ot();const{activePageKey:n,decofile:a,variantIndex:c}=Je.current;if(!n)return;const S=a[n],j=S?.sections;if(!j||typeof j!="object"||Array.isArray(j))return;const _=j;if(!Array.isArray(_.variants))return;const T=[..._.variants],se=T[c];if(!se)return;const M=Dt(se.rule,a,l),H=Ut(t);T[c]={...se,rule:H};const W={...a,[n]:{...S,sections:{..._,variants:T}}},{resolveType:Ee,formValue:q}=Nt(H,W,l??void 0);X(Ee),B(q);try{await Ve.mutateAsync({blockKey:n,data:W[n]}),M&&M!==t&&await Vt(M,W),u?.()}catch(Y){Q.error(Y instanceof Error?Y.message:r("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}},js=t=>{_t.current&&clearTimeout(_t.current);const{selectedSectionIndex:n,sectionVariantIndex:a}=Je.current;n!==null&&(_t.current=setTimeout(()=>{const{rawSections:c,parsedSections:S,decofile:j,activePageKey:_,pageVariants:T,variantIndex:se}=Je.current;if(!_)return;const M=c[n],H=S[n];if(!M||!H?.isMultivariate)return;const W=Xe(M,H);if(!W)return;const q=(W.variants??[])[a]?.rule;if(kt(q,j,l)){const ye=q?.__resolveType??"",Ue=j[ye],tt=typeof Ue?.name=="string"?Ue.name:ye,{__resolveType:dt,...st}=t;Ve.mutate({blockKey:ye,data:Rt(dt??"",st,tt)},{onSuccess:()=>u?.(),onError:mt=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:mt.message}))});return}const Y=Ps(W,a,t),Pe=[...c];Pe[n]=vt(M,H,Y);const Ye=Tt(j,_,Pe,se,T);Ve.mutate({blockKey:_,data:Ye},{onSuccess:()=>u?.(),onError:ye=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:ye.message}))})},ds))},ta=t=>{I(t),N({}),js(t?{__resolveType:t}:{__resolveType:Ks})},sa=t=>{const n=t;N(n);const a=ae?{__resolveType:ae,...n}:{...n};js(a)},na=async t=>{Ot();const{selectedSectionIndex:n,sectionVariantIndex:a,rawSections:c,parsedSections:S,decofile:j,activePageKey:_,pageVariants:T,variantIndex:se}=Je.current;if(n===null||!_)return;const M=c[n],H=S[n];if(!M||!H?.isMultivariate)return;const W=Xe(M,H);if(!W)return;const Ee=W.variants??[],q=Dt(Ee[a]?.rule,j,l),Y=Ut(t),Pe=Ps(W,a,Y),Ye=[...c];Ye[n]=vt(M,H,Pe);const ye=Tt(j,_,Ye,se,T),Ue={...j,[_]:ye},{resolveType:tt,formValue:dt}=Nt(Y,Ue,l??void 0);I(tt),N(dt);try{await Ve.mutateAsync({blockKey:_,data:ye}),q&&q!==t&&await Vt(q,Ue),u?.()}catch(st){Q.error(st instanceof Error?st.message:r("sectionsEditor.sectionsEditor.couldNotApplySavedRule"))}};if(!Te&&!Ge)return s.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.noPageFound",{currentPath:x})});if(Te&&!Zt)return s.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:r("sectionsEditor.sectionsEditor.globalBlockNotFound")});const ut=v!==null?Me[v]??null:null,Es=v!==null?U[v]:null,ks=Es&&ut?.isMultivariate?Xe(Es,ut):null,pt=ks?Ts(ks,nt):[],is=Math.min(te,Math.max(pt.length-1,0)),It=pt[is]??null,gt=ut?.isMultivariate===!0,Rs=v!==null&&ut!==null,$t=Rs&&(gt||!!(ns&&ie)),aa=$t&&!Te&&ut?.isSavedBlock===!0,et=Te||aa,oa=Te?gs:ut?.label??"",ia=ae&&l?Ht(ae,l):null,rs=$t&&(!Te||ue.length>0)?Te?[gs,...ue]:[Ge.name,ut.label,...gt&&It?[It.label]:[],...ue]:[],ra=z&&Ge?[Ge.name,"SEO",...Fe]:[],zt=z?ra:et?rs.length>0?rs:[oa]:rs,ws=()=>{if(!w)return;const t=i[w],n=qa(t.sections,U);if(!n)return;const a=Ja(n);Ve.mutate({blockKey:w,data:{...t,sections:n}},{onSuccess:()=>{F(a),C(null),L(null),K(null),O([]),B(null),X(null)},onError:c=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:c.message}))})},ls=(t,n,a)=>{if(!w)return;const c=i[w],S=c.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const j=S;if(!Array.isArray(j.variants))return;const _=t([...j.variants]);if(!_)return;const T=lo(j,_),se={...i,[w]:{...c,sections:T}};Ve.mutate({blockKey:w,data:se[w]},{onSuccess:()=>{n?.(),a&&Vt(a,se)},onError:M=>Q.error(r("sectionsEditor.sectionsEditor.saveFailed",{error:M.message}))})},la=t=>{oe(null),F(t),C(null),L(null),K(null),O([]);const n=$e[t]?.rule,{resolveType:a,formValue:c}=Nt(n,i??{},l??void 0);X(a),B(c),Ss($e.map(S=>({rule:S.rule})),t)},ca=(t,n)=>{if(t===n)return;let a=Ce;Ce===t?a=n:t<Ce&&n>=Ce?a=Ce-1:t>Ce&&n<=Ce&&(a=Ce+1),F(a);const c=Pt($e.map(S=>({rule:S.rule})),t,n);Ss(c,a),ls(S=>Pt(S,t,n))},ua=t=>{const n=$e[t]?.rule,a=Dt(n,i??{},l??void 0);ls(c=>c.length<=1?null:(c.splice(t,1),c),()=>{$e.length-1===1?F(0):t<Ce?F(Ce-1):t===Ce&&F(Math.max(0,t-1)),C(null),L(null),K(null),O([]),B(null),X(null)},a)},da=t=>{ls(n=>co(n,t),()=>{F(t+1),C(null),L(null),K(null),O([]),B(null),X(null)})},ma=async(t,n)=>{Ot();const a=Je.current.activePageKey,c=Je.current.decofile;if(!a)return;const S=c[a],j=S.sections;if(!j||typeof j!="object"||Array.isArray(j))return;const _=j;if(!Array.isArray(_.variants))return;const T=[..._.variants],se=T[t];if(!se?.rule||typeof se.rule!="object"){Q.error(r("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const M=se.rule,H=n.trim();Mt(!0);try{if(!H){if(!kt(M,c,l)){oe(null);return}const Ye=M.__resolveType??"";T[t]={...se,rule:Cs(M,c,l)};const ye={...c,[a]:{...S,sections:{..._,variants:T}}};await Ve.mutateAsync({blockKey:a,data:ye[a]}),await Vt(Ye,ye),oe(null),u?.();return}const W=As(M,c,l);if(!W){Q.error(r("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(W.blockKey){await Ve.mutateAsync({blockKey:W.blockKey,data:Rt(W.resolveType,W.data,H)}),oe(null),u?.();return}const Ee=cs(H),q=us(Ee,c);if(q){Q.error(q);return}const Y=Rt(W.resolveType,W.data,H);let Pe=null;try{await Ve.mutateAsync({blockKey:Ee,data:Y}),Pe=Ee,T[t]={...se,rule:Ut(Ee)},await Ve.mutateAsync({blockKey:a,data:{...S,sections:{..._,variants:T}}}),Pe=null}catch(Ye){throw Pe&&await Yt.mutateAsync({blockKey:Pe}).catch(()=>{}),Ye}oe(null),Q.success(r("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:H})),u?.()}catch(W){Q.error(W instanceof Error?W.message:r("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Mt(!1)}},fa=async(t,n)=>{Ot();const{selectedSectionIndex:a,rawSections:c,parsedSections:S,decofile:j,activePageKey:_,pageVariants:T,variantIndex:se}=Je.current;if(a===null||!_)return;const M=c[a],H=S[a];if(!M||!H?.isMultivariate)return;const W=Xe(M,H);if(!W)return;const Ee=W.variants??[],q=Ee[t];if(!q?.rule||typeof q.rule!="object"){Q.error(r("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const Y=q.rule,Pe=n.trim();Mt(!0);const Ye=async ye=>{const Ue={...W,variants:ye},tt=[...c];tt[a]=vt(M,H,Ue);const dt=Tt(j,_,tt,se,T);return await Ve.mutateAsync({blockKey:_,data:dt}),{...j,[_]:dt}};try{if(!Pe){if(!kt(Y,j,l)){re(null);return}const mt=Y.__resolveType??"",Ds=[...Ee];Ds[t]={...q,rule:Cs(Y,j,l)};const Sa=await Ye(Ds);await Vt(mt,Sa),re(null),u?.();return}const ye=As(Y,j,l);if(!ye){Q.error(r("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(ye.blockKey){await Ve.mutateAsync({blockKey:ye.blockKey,data:Rt(ye.resolveType,ye.data,Pe)}),re(null),u?.();return}const Ue=cs(Pe),tt=us(Ue,j);if(tt){Q.error(tt);return}const dt=Rt(ye.resolveType,ye.data,Pe);let st=null;try{await Ve.mutateAsync({blockKey:Ue,data:dt}),st=Ue;const mt=[...Ee];mt[t]={...q,rule:Ut(Ue)},await Ye(mt),st=null}catch(mt){throw st&&await Yt.mutateAsync({blockKey:st}).catch(()=>{}),mt}re(null),Q.success(r("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Pe})),u?.()}catch(ye){Q.error(ye instanceof Error?ye.message:r("sectionsEditor.sectionsEditor.failedToRenameVariant"))}finally{Mt(!1)}},Vs=()=>{Et()},pa=t=>{Ae(t),as({inner:t})},ga=t=>{ze(t),as({raw:t})},ha=()=>{Ae(null),xe([])},va=()=>be(t=>t+1),Ns=t=>{if(z){if(t===0){rt.flush(),le(!1),Ae(null),ze(void 0),xe([]),be(a=>a+1),k?.();return}if(t===1){xe([]),be(a=>a+1);return}xe(Fe.slice(0,t-1)),be(a=>a+1);return}if(Te){O(ue.slice(0,t)),Z(a=>a+1);return}if(t===0){Vs();return}if(t===1){O([]),Z(a=>a+1);return}if(gt&&t===2){O([]),Z(a=>a+1);return}const n=gt?2:1;O(ue.slice(0,t-n))};return s.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[s.jsx("div",{className:"shrink-0",children:et||$t||z?s.jsxs("div",{className:Be("border-b px-3 py-2.5",et&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[zt.length>1&&s.jsx("button",{type:"button",onClick:()=>Ns(zt.length-2),title:r("sectionsEditor.sectionsEditor.back"),"aria-label":r("sectionsEditor.sectionsEditor.back"),className:Be("shrink-0 inline-flex size-6 items-center justify-center rounded-md transition-colors",et?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:s.jsx(on,{className:"size-4"})}),!Te&&Lt&<&&s.jsxs("button",{type:"button",onClick:Vs,title:r("sectionsEditor.sectionsEditor.editingInVariant",{variant:lt.label}),className:Be("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ci),children:[s.jsx(Sn,{rule:Ct(lt.rule,i??{},l??void 0),matchers:Bt}),s.jsx("span",{className:"max-w-[160px] truncate",children:lt.label})]}),s.jsx("nav",{"aria-label":r("sectionsEditor.sectionsEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:zt.map((t,n)=>{const a=n===zt.length-1;return s.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[n>0&&s.jsx(rn,{className:"size-3 shrink-0 text-muted-foreground/60"}),s.jsx("button",{type:"button",onClick:()=>Ns(n),title:t,className:Be("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?et?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":et?"text-foreground/80":"text-muted-foreground",et?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${n}`)})}),et&&s.jsxs(St,{children:[s.jsx(xt,{asChild:!0,children:s.jsx("span",{className:"shrink-0 cursor-help",children:s.jsx(ho,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),s.jsx(bt,{side:"bottom",className:"max-w-[260px]",children:r("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Rs&&!gt&&!ut?.isHidden&&w&&s.jsx($s,{onClick:()=>os()})]}),et&&s.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:r("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):s.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(di,{pageKey:w,initialName:Ge.name,initialPath:Ge.path,onFieldChange:Kn})}),s.jsxs(St,{children:[s.jsx(xt,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>le(!0),children:s.jsx(fo,{size:14})})}),s.jsx(bt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.editSeo")})]}),s.jsxs(St,{children:[s.jsx(xt,{asChild:!0,children:s.jsx(qe,{type:"button",variant:"ghost",size:"icon","aria-label":r("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>D&&w?D(w):_e(!0),children:s.jsx(po,{size:14})})}),s.jsx(bt,{side:"bottom",children:r("sectionsEditor.sectionsEditor.viewJson")})]}),s.jsx($s,{onClick:ws})]})}),z?s.jsx(qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:s.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:s.jsx("div",{className:"mx-auto max-w-2xl",children:Kt&&w?s.jsx(Mo,{rawSeo:ts,innerSeo:hs,defaultResolveType:Dn,seoSchema:Tn,activeResolveType:ss,seoTypeOptions:Nn,formResetKey:we,siteDefaultSeo:Pn,onBreadcrumbChange:xe,onPersistRaw:ga,onInnerChange:pa,onClearForm:ha,onBumpFormKey:va}):s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})}):$t?s.jsxs(qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[gt&&pt.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(za,{listKey:`${w??""}:${v??""}`,variants:pt.map((t,n)=>({index:n,label:t.label})),selectedIndex:is,onSelect:Hn,onRename:re,onDuplicate:Wn,onDelete:Gn,onRemoveAll:qn,onReorder:Un,onAdd:()=>os()}),gt&&s.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:r("sectionsEditor.sectionsEditor.variantRule")}),s.jsx(zs,{currentRt:ae??"",currentLabel:Wt(It?.rule,i??{},nt,l??void 0),currentGlobalKey:Dt(It?.rule,i??{},l??void 0)??void 0,matchers:Bt,globals:ys,onSelect:ta,onSelectGlobal:na,schema:ia,formValue:Ie,onChange:sa,formKey:`${v??"none"}:${is}:${ae??""}`,formWrapperClassName:"pt-1",meta:l??void 0,decofile:i,onSaveReferencedBlock:At,sandbox:Ft})]})]}),s.jsx(Is,{activeSchema:ns,formValue:ie,formResetKey:Ke,onFormChange:xs,onBreadcrumbChange:O,breadcrumbPath:ue,emptyMessage:r("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:l,decofile:i,onSaveReferencedBlock:At,sandbox:Ft})]}):Te?s.jsx(qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:s.jsx(Is,{activeSchema:ns,formValue:ie,formResetKey:Ke,onFormChange:xs,onBreadcrumbChange:O,breadcrumbPath:ue,emptyMessage:r("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:l,decofile:i,onSaveReferencedBlock:At,sandbox:Ft})}):s.jsxs(qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Lt&&w&&s.jsx(ii,{listKey:w,variants:$e,activeIndex:Ce,decofile:i??{},meta:l,matchers:Bt,onSelect:la,onReorder:ca,onRename:oe,onDuplicate:da,onDelete:ua,onAdd:ws}),Lt&&J!==null&&s.jsxs("div",{className:Be("px-3 border-b",pe?"pt-3 pb-5 space-y-3":"py-2"),children:[s.jsxs("button",{type:"button",onClick:()=>ke(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":pe,children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:r("sectionsEditor.sectionsEditor.variantRule")}),pe?s.jsx(go,{className:"size-3.5 shrink-0 text-muted-foreground"}):s.jsx(uo,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),pe&&s.jsx("div",{className:Be("space-y-3",wt&&"pointer-events-none opacity-50"),children:s.jsx(zs,{currentRt:J,currentLabel:Wt(lt?.rule,i??{},nt,l??void 0),currentGlobalKey:Dt(lt?.rule,i??{},l??void 0)??void 0,matchers:Bt,globals:ys,onSelect:Xn,onSelectGlobal:ea,schema:Qn,formValue:fe,onChange:Zn,formKey:`${Ce}:${J??""}`,formWrapperClassName:"space-y-3",meta:l??void 0,decofile:i,onSaveReferencedBlock:At,sandbox:Ft})})]}),s.jsx("div",{className:"p-2 pt-3",children:s.jsx(Qo,{listKey:`${w??""}-${Ce}`,rawSections:U,sections:Me,meta:l,selectedIndex:v,onSelect:Mn,onReorder:Ln,onDelete:Fn,onDuplicate:Bn,onMakeReusable:ve,onToggleHidden:On,onToggleLazy:In,onAddVariant:os,onDetach:$n,onAddSection:()=>Se(!0),canAddSection:Yn})})]}),s.jsx(Ha,{open:Le!==null,onOpenChange:t=>{t||ve(null)},defaultBlockId:Le!==null?cs(Me[Le]?.label??""):"",isPending:Ve.isPending,onSubmit:Jn}),f&&s.jsx(Fo,{open:Re,onOpenChange:Se,meta:l,decofile:i,previewBaseUrl:f,onSelect:zn}),Ne&&w&&i&&s.jsx(Ga,{open:Ne,onOpenChange:_e,pageKey:w,decofile:i}),de!==null&&s.jsx(Bs,{open:!0,initialName:kt($e[de]?.rule,i??{},l??void 0)?Wt($e[de]?.rule,i??{},nt,l??void 0):"",autoLabel:nt(Ct($e[de]?.rule,i??{},l??void 0)),isPending:wt,onSubmit:async t=>{await ma(de,t)},onOpenChange:t=>{!t&&!wt&&oe(null)}}),ee!==null&&s.jsx(Bs,{open:!0,initialName:kt(pt[ee]?.rule,i??{},l??void 0)?Wt(pt[ee]?.rule,i??{},nt,l??void 0):"",autoLabel:nt(Ct(pt[ee]?.rule,i??{},l??void 0)),isPending:wt,onSubmit:async t=>{await fa(ee,t)},onOpenChange:t=>{!t&&!wt&&re(null)}})]})}export{oc as SectionsEditor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as U,au as xt,c as H,i as se,j as s,J as He,M as ve,F as xe,o as Ie,P as qe,R as Ge,d as ke,K as re,t as le,B as ne,q as ie,D as gt,m as pe,n as vt,b as bt,E as yt,z as jt}from"./index-
|
|
1
|
+
import{r as U,au as xt,c as H,i as se,j as s,J as He,M as ve,F as xe,o as Ie,P as qe,R as Ge,d as ke,K as re,t as le,B as ne,q as ie,D as gt,m as pe,n as vt,b as bt,E as yt,z as jt}from"./index-BWC7sFp_.js";import{c as Xe,e as Ye,d as Qe,a as St,b as Je,h as Nt,D as kt}from"./dialog-BhvH5UUY.js";import{g as Ct,b as wt,a as It,D as _t}from"./drawer-Clee3MiY.js";import{u as Mt}from"./use-mobile-D2X5CiwU.js";import{S as Le,u as Et,m as Ot,a as _e}from"./chat-context-DUAqM3BL.js";import{C as Pt}from"./checkbox-FmmsZFBn.js";import{I as fe}from"./input-Dwgjs0Me.js";import{S as Lt,a as At,b as Tt,c as zt,d as Rt}from"./select-uGrWbEMz.js";import{S as ee}from"./skeleton-CEv-QtIz.js";import{i as Ze,b as et,c as Ft,a as Dt,s as Kt}from"./Settings02-BbDm-Ne4.js";import{c as $t,a as Ut,i as Bt}from"./Tool01-DMTzqx5i.js";import{i as Wt}from"./Key01-CHhJPyPs.js";import{i as tt}from"./SearchMd-CP6wLgs6.js";import{b as Me,u as Vt,a as Ht}from"./use-ai-providers-Dp6I5-8x.js";import{g as Ee}from"./ai-providers-logos-DD3qZ33J.js";import{i as qt}from"./Monitor01-D09qwZZ1.js";import{i as Gt}from"./AlertCircle-C4BWLdJ4.js";import{u as we}from"./studio-tools-DqyzSTaT.js";import{i as Xt}from"./ChevronRight-DEIr6kW5.js";import{A as Yt}from"./avatar-UzWl0gwW.js";import{S as Ae,a as Te,b as st}from"./settings-section-B8q2fbg4.js";import{s as it}from"./Eye-CE-cR8Oa.js";import{a as Se,b as Ne,C as Qt}from"./connect-desktop-dialog-DxGAbniS.js";import{t as ze}from"./ChevronDown-B6-w9q8W.js";import{a as Jt}from"./Image01-DG088yrA.js";import{t as Zt}from"./Stars01-JDxcV7AF.js";function he(l,e,t){let i=t.initialDeps??[],n,o=!0;function r(){var a,d,u;let c;t.key&&((a=t.debug)!=null&&a.call(t))&&(c=Date.now());const h=l();if(!(h.length!==i.length||h.some((p,j)=>i[j]!==p)))return n;i=h;let m;if(t.key&&((d=t.debug)!=null&&d.call(t))&&(m=Date.now()),n=e(...h),t.key&&((u=t.debug)!=null&&u.call(t))){const p=Math.round((Date.now()-c)*100)/100,j=Math.round((Date.now()-m)*100)/100,k=j/16,b=(S,I)=>{for(S=String(S);S.length<I;)S=" "+S;return S};console.info(`%c⏱ ${b(j,5)} /${b(p,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(n),o=!1,n}return r.updateDeps=a=>{i=a},r}function Re(l,e){if(l===void 0)throw new Error("Unexpected undefined");return l}const es=(l,e)=>Math.abs(l-e)<1.01,ts=(l,e,t)=>{let i;return function(...n){l.clearTimeout(i),i=l.setTimeout(()=>e.apply(this,n),t)}},Fe=l=>{const{offsetWidth:e,offsetHeight:t}=l;return{width:e,height:t}},ss=l=>l,is=l=>{const e=Math.max(l.startIndex-l.overscan,0),t=Math.min(l.endIndex+l.overscan,l.count-1),i=[];for(let n=e;n<=t;n++)i.push(n);return i},ls=(l,e)=>{const t=l.scrollElement;if(!t)return;const i=l.targetWindow;if(!i)return;const n=r=>{const{width:a,height:d}=r;e({width:Math.round(a),height:Math.round(d)})};if(n(Fe(t)),!i.ResizeObserver)return()=>{};const o=new i.ResizeObserver(r=>{const a=()=>{const d=r[0];if(d?.borderBoxSize){const u=d.borderBoxSize[0];if(u){n({width:u.inlineSize,height:u.blockSize});return}}n(Fe(t))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},De={passive:!0},Ke=typeof window>"u"?!0:"onscrollend"in window,ns=(l,e)=>{const t=l.scrollElement;if(!t)return;const i=l.targetWindow;if(!i)return;let n=0;const o=l.options.useScrollendEvent&&Ke?()=>{}:ts(i,()=>{e(n,!1)},l.options.isScrollingResetDelay),r=c=>()=>{const{horizontal:h,isRtl:f}=l.options;n=h?t.scrollLeft*(f&&-1||1):t.scrollTop,o(),e(n,c)},a=r(!0),d=r(!1);t.addEventListener("scroll",a,De);const u=l.options.useScrollendEvent&&Ke;return u&&t.addEventListener("scrollend",d,De),()=>{t.removeEventListener("scroll",a),u&&t.removeEventListener("scrollend",d)}},os=(l,e,t)=>{if(e?.borderBoxSize){const i=e.borderBoxSize[0];if(i)return Math.round(i[t.options.horizontal?"inlineSize":"blockSize"])}return l[t.options.horizontal?"offsetWidth":"offsetHeight"]},rs=(l,{adjustments:e=0,behavior:t},i)=>{var n,o;const r=l+e;(o=(n=i.scrollElement)==null?void 0:n.scrollTo)==null||o.call(n,{[i.options.horizontal?"left":"top"]:r,behavior:t})};class as{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,i,n;return((n=(i=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:i.now)==null?void 0:n.call(i))??Date.now()},this.observer=(()=>{let t=null;const i=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(n=>{n.forEach(o=>{const r=()=>{const a=o.target,d=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(a,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var n;(n=i())==null||n.disconnect(),t=null},observe:n=>{var o;return(o=i())==null?void 0:o.observe(n,{box:"border-box"})},unobserve:n=>{var o;return(o=i())==null?void 0:o.unobserve(n)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([i,n])=>{typeof n>"u"&&delete t[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ss,rangeExtractor:is,onChange:()=>{},measureElement:os,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var i,n;(n=(i=this.options).onChange)==null||n.call(i,this,t)},this.maybeNotify=he(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n)}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(n,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<n?"forward":"backward":null,this.scrollOffset=n,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,i)=>{const n=new Map,o=new Map;for(let r=i-1;r>=0;r--){const a=t[r];if(n.has(a.lane))continue;const d=o.get(a.lane);if(d==null||a.end>d.end?o.set(a.lane,a):a.end<d.end&&n.set(a.lane,!0),n.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,a)=>r.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=he(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,i,n,o,r,a,d)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:i,scrollMargin:n,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:d}),{key:!1}),this.getMeasurements=he(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:i,scrollMargin:n,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:d},u)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const m of this.laneAssignments.keys())m>=t&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,c),f=new Array(a).fill(void 0);for(let m=0;m<c;m++){const p=h[m];p&&(f[p.lane]=m)}for(let m=c;m<t;m++){const p=o(m),j=this.laneAssignments.get(m);let k,b;const S=d==="estimate"||u.has(p);if(j!==void 0&&this.options.lanes>1){k=j;const _=f[k],x=_!==void 0?h[_]:void 0;b=x?x.end+this.options.gap:i+n}else{const _=this.options.lanes===1?h[m-1]:this.getFurthestMeasurement(h,m);b=_?_.end+this.options.gap:i+n,k=_?_.lane:m%this.options.lanes,this.options.lanes>1&&S&&this.laneAssignments.set(m,k)}const I=u.get(p),P=typeof I=="number"?I:this.options.estimateSize(m),E=b+P;h[m]={index:m,start:b,size:P,end:E,key:p,lane:k},f[k]=m}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=he(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,i,n,o)=>this.range=t.length>0&&i>0?cs({measurements:t,outerSize:i,scrollOffset:n,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=he(()=>{let t=null,i=null;const n=this.calculateRange();return n&&(t=n.startIndex,i=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,i]},(t,i,n,o,r)=>o===null||r===null?[]:t({startIndex:o,endIndex:r,overscan:i,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const i=this.options.indexAttribute,n=t.getAttribute(i);return n?parseInt(n,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const n=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(n!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,n-o),a=Math.min(this.options.count-1,n+o);return t>=r&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,a)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(a))});return}const i=this.indexFromElement(t),n=this.options.getItemKey(i),o=this.elementsCache.get(n);o!==t&&(o&&this.observer.unobserve(o),this.observer.observe(t),this.elementsCache.set(n,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,i)=>{var n;const o=this.measurementsCache[t];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,a=i-r;a!==0&&(((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,i)),this.notify(!1))},this.getVirtualItems=he(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,i)=>{const n=[];for(let o=0,r=t.length;o<r;o++){const a=t[o],d=i[a];n.push(d)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const i=this.getMeasurements();if(i.length!==0)return Re(i[lt(0,i.length-1,n=>Re(i[n]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,i,n=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();i==="auto"&&(i=t>=r+o?"end":"start"),i==="center"?t+=(n-o)/2:i==="end"&&(t-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,i="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if(i==="auto")if(r.end>=o+n-this.options.scrollPaddingEnd)i="end";else if(r.start<=o+this.options.scrollPaddingStart)i="start";else return[o,i];if(i==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),i];const a=i==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,i,r.size),i]},this.scrollToOffset=(t,{align:i="start",behavior:n="auto"}={})=>{const o=this.getOffsetForAlignment(t,i),r=this.now();this.scrollState={index:null,align:i,behavior:n,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:i="auto",behavior:n="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getOffsetForIndex(t,i);if(!o)return;const[r,a]=o,d=this.now();this.scrollState={index:t,align:a,behavior:n,startedAt:d,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:i="auto"}={})=>{const n=this.getScrollOffset()+t,o=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const i=this.getMeasurements();let n;if(i.length===0)n=this.options.paddingStart;else if(this.options.lanes===1)n=((t=i[i.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=i.length-1;for(;r>=0&&o.some(a=>a===null);){const a=i[r];o[a.lane]===null&&(o[a.lane]=a.end),r--}n=Math.max(...o.filter(a=>a!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:i,behavior:n})=>{this.options.scrollToFn(t,{behavior:n,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,n=i?i[0]:this.scrollState.lastTargetOffset,o=1,r=n!==this.scrollState.lastTargetOffset;if(!r&&es(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=n,this.scrollState.behavior="auto",this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const lt=(l,e,t,i)=>{for(;l<=e;){const n=(l+e)/2|0,o=t(n);if(o<i)l=n+1;else if(o>i)e=n-1;else return n}return l>0?l-1:0};function cs({measurements:l,outerSize:e,scrollOffset:t,lanes:i}){const n=l.length-1,o=d=>l[d].start;if(l.length<=i)return{startIndex:0,endIndex:n};let r=lt(0,n,o,t),a=r;if(i===1)for(;a<n&&l[a].end<t+e;)a++;else if(i>1){const d=Array(i).fill(0);for(;a<n&&d.some(c=>c<t+e);){const c=l[a];d[c.lane]=c.end,a++}const u=Array(i).fill(t+e);for(;r>=0&&u.some(c=>c>=t);){const c=l[r];u[c.lane]=c.start,r--}r=Math.max(0,r-r%i),a=Math.min(n,a+(i-1-a%i))}return{startIndex:r,endIndex:a}}const $e=typeof document<"u"?U.useLayoutEffect:U.useEffect;function ds({useFlushSync:l=!0,...e}){const t=U.useReducer(()=>({}),{})[1],i={...e,onChange:(o,r)=>{var a;l&&r?xt.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,r)}},[n]=U.useState(()=>new as(i));return n.setOptions(i),$e(()=>n._didMount(),[]),$e(()=>n._willUpdate()),n}function us(l){return ds({observeElementRect:ls,observeElementOffset:ns,scrollToFn:rs,...l})}const nt=[{id:"openai",name:"OpenAI",description:"GPT-4, GPT-5, and other OpenAI models",logo:"https://decoims.com/decocms/b51001ef-ae58-4db4-8a75-9e6d2df2dd8e/openai.png",baseUrlPlaceholder:"https://api.openai.com/v1",defaultBaseUrl:"https://api.openai.com/v1",apiKeyRecommended:!0,helpText:"Use your OpenAI API key (starts with sk-)."},{id:"litellm",name:"LiteLLM",description:"Connect to a LiteLLM gateway your team manages",logo:"https://decoims.com/decocms/e974ae05-ad64-4b4a-8444-d9705f019b85/litellm.png",baseUrlPlaceholder:"http://localhost:4000",apiKeyRecommended:!0,helpText:"Point at your LiteLLM proxy. The base URL should be the root of the proxy (we'll append /v1)."},{id:"ollama",name:"Ollama",description:"Run open-source models on your own computer",logo:"https://decoims.com/decocms/2bb2f822-5288-4b7c-a541-dcbef76525a0/ollama.png",baseUrlPlaceholder:"http://localhost:11434",apiKeyRecommended:!1,helpText:"Ollama exposes /v1 by default — no API key required for local use."},{id:"lm-studio",name:"LM Studio",description:"Open models running through LM Studio",logo:"https://decoims.com/decocms/9f0ab1a9-d2d5-4f3e-9de0-aadd4926428d/lmstudio.webp",baseUrlPlaceholder:"http://localhost:1234",apiKeyRecommended:!1,helpText:"Start the local server in LM Studio, then paste its base URL here."},{id:"vllm",name:"vLLM",description:"Connect to your team's self-hosted vLLM server",logo:"https://decoims.com/decocms/b6c60e4f-a4aa-443c-981f-ad0f31640e22/vllm.png",baseUrlPlaceholder:"http://localhost:8000",apiKeyRecommended:!1}];function be(l){if(l)return nt.find(e=>e.id===l)}const Ue=4;function ge(l){const e=H.c(8),{logo:t,name:i,description:n,onClick:o}=l;let r;e[0]!==t||e[1]!==i?(r=t?s.jsx("img",{src:t,alt:i,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(Yt,{fallback:i.charAt(0),className:"size-8 bg-primary/10 text-primary"}),e[0]=t,e[1]=i,e[2]=r):r=e[2];let a;return e[3]!==n||e[4]!==i||e[5]!==o||e[6]!==r?(a=s.jsx(st,{onClick:o,icon:r,title:i,description:n}),e[3]=n,e[4]=i,e[5]=o,e[6]=r,e[7]=a):a=e[7],a}function ot(l){const e=H.c(38),{providers:t,onSelect:i,onShowAll:n}=l,o=se();let r;e[0]!==t?(r=t.find(ps),e[0]=t,e[1]=r):r=e[1];const a=r;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={openrouter:0,llmapi:1,anthropic:2,google:3},e[2]=d):d=e[2];const u=d;let c;if(e[3]!==i||e[4]!==t||e[5]!==o){let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=(y,C)=>{const L=u[y.id]??Number.MAX_SAFE_INTEGER,A=u[C.id]??Number.MAX_SAFE_INTEGER;return L-A},e[7]=P):P=e[7];const E=t.filter(fs).sort(P);let _;e[8]!==t?(_=t.find(hs),e[8]=t,e[9]=_):_=e[9];const x=_;let N;e[10]===Symbol.for("react.memo_cache_sentinel")?(N=be("openai"),e[10]=N):N=e[10];const w=N;let M;e[11]!==i?(M=y=>s.jsx(ge,{logo:y.logo,name:y.name,description:y.description,onClick:()=>i({kind:"provider",provider:y})},y.id),e[11]=i,e[12]=M):M=e[12];let g;e[13]!==i||e[14]!==x?(g=x&&w?[s.jsx(ge,{logo:w.logo,name:w.name,description:w.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:w})},w.id)]:[],e[13]=i,e[14]=x,e[15]=g):g=e[15];let v;e[16]!==i||e[17]!==x||e[18]!==o?(v=x?[...nt.filter(ms).map(y=>s.jsx(ge,{logo:y.logo,name:y.name,description:y.description,onClick:()=>i({kind:"openai-compatible",provider:x,preset:y})},y.id)),s.jsx(ge,{logo:x.logo,name:o("settings.aiProviders.customOpenAiCompatible"),description:o("settings.aiProviders.customOpenAiDescription"),onClick:()=>i({kind:"openai-compatible",provider:x,preset:null})},"custom")]:[],e[16]=i,e[17]=x,e[18]=o,e[19]=v):v=e[19],c=[...E.map(M),...g,...v],e[3]=i,e[4]=t,e[5]=o,e[6]=c}else c=e[6];const h=c,f=h.length-Ue,m=!!n&&f>0;let p;e[20]!==h||e[21]!==m?(p=m?h.slice(0,Ue):h,e[20]=h,e[21]=m,e[22]=p):p=e[22];const j=p;let k;e[23]!==a||e[24]!==i||e[25]!==o?(k=a&&s.jsx(Ae,{children:s.jsxs("div",{className:"relative rounded-xl border border-violet-400/30 bg-gradient-to-br from-violet-50/50 via-transparent to-lime-50/30 dark:from-violet-950/20 dark:to-lime-950/10 p-1.5",children:[s.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-violet-400/5 to-lime-400/5 pointer-events-none"}),s.jsx("p",{className:"text-xs font-medium text-violet-700 dark:text-violet-400 mb-1.5 px-2 pt-2 relative",children:o("settings.aiProviders.recommended")}),s.jsx(Te,{className:"relative",children:s.jsx(ge,{logo:a.logo,name:a.name,description:a.description,onClick:()=>i({kind:"provider",provider:a})})})]})}),e[23]=a,e[24]=i,e[25]=o,e[26]=k):k=e[26];let b;e[27]!==f||e[28]!==n||e[29]!==m||e[30]!==o?(b=m&&s.jsx(st,{onClick:n,title:o("settings.aiProviders.moreProviders",{count:f,plural:f===1?"":"s"}),action:s.jsx(Xt,{size:16,className:"text-muted-foreground"})}),e[27]=f,e[28]=n,e[29]=m,e[30]=o,e[31]=b):b=e[31];let S;e[32]!==b||e[33]!==j?(S=s.jsx(Ae,{children:s.jsxs(Te,{children:[j,b]})}),e[32]=b,e[33]=j,e[34]=S):S=e[34];let I;return e[35]!==k||e[36]!==S?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[k,S]}),e[35]=k,e[36]=S,e[37]=I):I=e[37],I}function ms(l){return l.id!=="openai"}function hs(l){return l.id==="openai-compatible"}function fs(l){return l.id!=="deco"&&l.id!=="openai-compatible"}function ps(l){return l.id==="deco"}const xs=He({label:ve().optional(),apiKey:ve().min(1,"API key is required")});function gs(l){const e=H.c(87),{providerId:t,onCancel:i,onSuccess:n}=l,{org:o}=xe(),r=we(),a=Ie(),[d,u]=U.useState(!1),c=se();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={resolver:qe(xs),defaultValues:{label:"",apiKey:""}},e[0]=h):h=e[0];const{register:f,handleSubmit:m,formState:p}=Ge(h),{errors:j}=p;let k;e[1]!==t||e[2]!==r||e[3]!==c?(k=async Z=>{await r.call("AI_PROVIDER_KEY_CREATE",{providerId:t,label:Z.label||c("settings.connectForms.defaultKeyLabel"),apiKey:Z.apiKey})},e[1]=t,e[2]=r,e[3]=c,e[4]=k):k=e[4];let b;e[5]!==n||e[6]!==o||e[7]!==a||e[8]!==c?(b=()=>{a.invalidateQueries({queryKey:re.aiProviderKeys(o.id)}),a.invalidateQueries({queryKey:re.aiProviders(o.id)}),le.success(c("settings.connectForms.keySavedSuccess")),n()},e[5]=n,e[6]=o,e[7]=a,e[8]=c,e[9]=b):b=e[9];let S;e[10]!==c?(S=Z=>{le.error(c("settings.connectForms.failedSaveKey",{error:Z.message}))},e[10]=c,e[11]=S):S=e[11];let I;e[12]!==k||e[13]!==b||e[14]!==S?(I={mutationFn:k,onSuccess:b,onError:S},e[12]=k,e[13]=b,e[14]=S,e[15]=I):I=e[15];const{mutate:P,isPending:E,error:_}=ke(I);let x;e[16]!==P?(x=Z=>P(Z),e[16]=P,e[17]=x):x=e[17];let N;e[18]!==m||e[19]!==x?(N=m(x),e[18]=m,e[19]=x,e[20]=N):N=e[20];let w;e[21]!==c?(w=c("settings.connectForms.labelField"),e[21]=c,e[22]=w):w=e[22];let M;e[23]!==w?(M=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:w}),e[23]=w,e[24]=M):M=e[24];let g;e[25]!==c?(g=c("settings.connectForms.labelPlaceholder"),e[25]=c,e[26]=g):g=e[26];let v;e[27]!==f?(v=f("label"),e[27]=f,e[28]=v):v=e[28];let y;e[29]!==g||e[30]!==v?(y=s.jsx(fe,{placeholder:g,...v,className:"h-8 text-sm"}),e[29]=g,e[30]=v,e[31]=y):y=e[31];let C;e[32]!==M||e[33]!==y?(C=s.jsxs("div",{className:"space-y-1",children:[M,y]}),e[32]=M,e[33]=y,e[34]=C):C=e[34];let L;e[35]!==c?(L=c("settings.connectForms.apiKeyField"),e[35]=c,e[36]=L):L=e[36];let A;e[37]!==L?(A=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:L}),e[37]=L,e[38]=A):A=e[38];const O=d?"text":"password";let R;e[39]!==f?(R=f("apiKey"),e[39]=f,e[40]=R):R=e[40];let F;e[41]!==O||e[42]!==R?(F=s.jsx(fe,{type:O,placeholder:"sk-...",...R,className:"ph-no-capture h-8 text-sm pr-8"}),e[41]=O,e[42]=R,e[43]=F):F=e[43];let D;e[44]!==d?(D=()=>u(!d),e[44]=d,e[45]=D):D=e[45];let z;e[46]!==d||e[47]!==c?(z=c(d?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[46]=d,e[47]=c,e[48]=z):z=e[48];let K;e[49]!==d?(K=d?s.jsx(Ze,{size:14}):s.jsx(it,{size:14}),e[49]=d,e[50]=K):K=e[50];let V;e[51]!==D||e[52]!==z||e[53]!==K?(V=s.jsx("button",{type:"button",onClick:D,"aria-label":z,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:K}),e[51]=D,e[52]=z,e[53]=K,e[54]=V):V=e[54];let J;e[55]!==F||e[56]!==V?(J=s.jsxs("div",{className:"relative",children:[F,V]}),e[55]=F,e[56]=V,e[57]=J):J=e[57];let G;e[58]!==j.apiKey?(G=j.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:j.apiKey.message}),e[58]=j.apiKey,e[59]=G):G=e[59];let X;e[60]!==A||e[61]!==J||e[62]!==G?(X=s.jsxs("div",{className:"space-y-1",children:[A,J,G]}),e[60]=A,e[61]=J,e[62]=G,e[63]=X):X=e[63];let T;e[64]!==_?(T=_&&s.jsx("p",{className:"text-xs text-destructive",children:_.message}),e[64]=_,e[65]=T):T=e[65];let B;e[66]!==c?(B=c("settings.connectForms.cancel"),e[66]=c,e[67]=B):B=e[67];let W;e[68]!==E||e[69]!==i||e[70]!==B?(W=s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:E,children:B}),e[68]=E,e[69]=i,e[70]=B,e[71]=W):W=e[71];let q;e[72]!==E||e[73]!==c?(q=c(E?"settings.connectForms.saving":"settings.connectForms.saveKey"),e[72]=E,e[73]=c,e[74]=q):q=e[74];let $;e[75]!==E||e[76]!==q?($=s.jsx(ne,{type:"submit",size:"sm",disabled:E,children:q}),e[75]=E,e[76]=q,e[77]=$):$=e[77];let Y;e[78]!==W||e[79]!==$?(Y=s.jsxs(Xe,{children:[W,$]}),e[78]=W,e[79]=$,e[80]=Y):Y=e[80];let te;return e[81]!==C||e[82]!==X||e[83]!==T||e[84]!==Y||e[85]!==N?(te=s.jsxs("form",{onSubmit:N,className:"space-y-3",children:[C,X,T,Y]}),e[81]=C,e[82]=X,e[83]=T,e[84]=Y,e[85]=N,e[86]=te):te=e[86],te}const vs=He({label:ve().optional(),baseUrl:ve().min(1,"Base URL is required"),apiKey:ve().optional()});function bs(l){const e=H.c(105),{preset:t,onCancel:i,onSuccess:n}=l,{org:o}=xe(),r=we(),a=Ie(),[d,u]=U.useState(!1),c=se();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=qe(vs),e[0]=h):h=e[0];const f=t?.defaultBaseUrl??"";let m;e[1]!==f?(m={resolver:h,defaultValues:{label:"",baseUrl:f,apiKey:""}},e[1]=f,e[2]=m):m=e[2];const{register:p,handleSubmit:j,formState:k}=Ge(m),{errors:b}=k;let S;e[3]!==t||e[4]!==r?(S=async oe=>{const pt=JSON.stringify({baseUrl:oe.baseUrl,apiKey:oe.apiKey||""});await r.call("AI_PROVIDER_KEY_CREATE",{providerId:"openai-compatible",label:oe.label||t?.name||oe.baseUrl,apiKey:pt,...t?{presetId:t.id}:{}})},e[3]=t,e[4]=r,e[5]=S):S=e[5];let I;e[6]!==n||e[7]!==o||e[8]!==a||e[9]!==c?(I=()=>{a.invalidateQueries({queryKey:re.aiProviderKeys(o.id)}),a.invalidateQueries({queryKey:re.aiProviders(o.id)}),le.success(c("settings.connectForms.connectionSavedSuccess")),n()},e[6]=n,e[7]=o,e[8]=a,e[9]=c,e[10]=I):I=e[10];let P;e[11]!==c?(P=oe=>{le.error(c("settings.connectForms.failedSaveConnection",{error:oe.message}))},e[11]=c,e[12]=P):P=e[12];let E;e[13]!==S||e[14]!==I||e[15]!==P?(E={mutationFn:S,onSuccess:I,onError:P},e[13]=S,e[14]=I,e[15]=P,e[16]=E):E=e[16];const{mutate:_,isPending:x,error:N}=ke(E);let w;e[17]!==t||e[18]!==c?(w=t?c("settings.connectForms.labelPlaceholderPreset",{name:t.name}):c("settings.connectForms.labelPlaceholderOpenAiCompatible"),e[17]=t,e[18]=c,e[19]=w):w=e[19];const M=w;let g;e[20]!==t?.baseUrlPlaceholder||e[21]!==c?(g=t?.baseUrlPlaceholder??c("settings.connectForms.baseUrlPlaceholder"),e[20]=t?.baseUrlPlaceholder,e[21]=c,e[22]=g):g=e[22];const v=g;let y;e[23]!==_?(y=oe=>_(oe),e[23]=_,e[24]=y):y=e[24];let C;e[25]!==j||e[26]!==y?(C=j(y),e[25]=j,e[26]=y,e[27]=C):C=e[27];let L;e[28]!==c?(L=c("settings.connectForms.labelField"),e[28]=c,e[29]=L):L=e[29];let A;e[30]!==L?(A=s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:L}),e[30]=L,e[31]=A):A=e[31];let O;e[32]!==p?(O=p("label"),e[32]=p,e[33]=O):O=e[33];let R;e[34]!==M||e[35]!==O?(R=s.jsx(fe,{placeholder:M,...O,className:"h-8 text-sm"}),e[34]=M,e[35]=O,e[36]=R):R=e[36];let F;e[37]!==A||e[38]!==R?(F=s.jsxs("div",{className:"space-y-1",children:[A,R]}),e[37]=A,e[38]=R,e[39]=F):F=e[39];let D;e[40]!==v||e[41]!==b||e[42]!==t?.defaultBaseUrl||e[43]!==p||e[44]!==c?(D=t?.defaultBaseUrl?s.jsx("input",{type:"hidden",...p("baseUrl")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:c("settings.connectForms.baseUrlField")}),s.jsx(fe,{type:"url",placeholder:v,...p("baseUrl"),className:"h-8 text-sm"}),b.baseUrl&&s.jsx("p",{className:"text-xs text-destructive",children:b.baseUrl.message})]}),e[40]=v,e[41]=b,e[42]=t?.defaultBaseUrl,e[43]=p,e[44]=c,e[45]=D):D=e[45];let z;e[46]!==c?(z=c("settings.connectForms.apiKeyField"),e[46]=c,e[47]=z):z=e[47];let K;e[48]!==t?.apiKeyRecommended||e[49]!==c?(K=t?.apiKeyRecommended?c("settings.connectForms.recommended"):c("settings.connectForms.optional"),e[48]=t?.apiKeyRecommended,e[49]=c,e[50]=K):K=e[50];let V;e[51]!==K?(V=s.jsxs("span",{className:"text-muted-foreground/60",children:["(",K,")"]}),e[51]=K,e[52]=V):V=e[52];let J;e[53]!==z||e[54]!==V?(J=s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[z," ",V]}),e[53]=z,e[54]=V,e[55]=J):J=e[55];const G=d?"text":"password";let X;e[56]!==p?(X=p("apiKey"),e[56]=p,e[57]=X):X=e[57];let T;e[58]!==G||e[59]!==X?(T=s.jsx(fe,{type:G,placeholder:"sk-...",...X,className:"ph-no-capture h-8 text-sm pr-8"}),e[58]=G,e[59]=X,e[60]=T):T=e[60];let B;e[61]!==d?(B=()=>u(!d),e[61]=d,e[62]=B):B=e[62];let W;e[63]!==d||e[64]!==c?(W=c(d?"settings.connectForms.hideApiKey":"settings.connectForms.showApiKey"),e[63]=d,e[64]=c,e[65]=W):W=e[65];let q;e[66]!==d?(q=d?s.jsx(Ze,{size:14}):s.jsx(it,{size:14}),e[66]=d,e[67]=q):q=e[67];let $;e[68]!==B||e[69]!==W||e[70]!==q?($=s.jsx("button",{type:"button",onClick:B,"aria-label":W,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:q}),e[68]=B,e[69]=W,e[70]=q,e[71]=$):$=e[71];let Y;e[72]!==T||e[73]!==$?(Y=s.jsxs("div",{className:"relative",children:[T,$]}),e[72]=T,e[73]=$,e[74]=Y):Y=e[74];let te;e[75]!==J||e[76]!==Y?(te=s.jsxs("div",{className:"space-y-1",children:[J,Y]}),e[75]=J,e[76]=Y,e[77]=te):te=e[77];let Z;e[78]!==t?(Z=t?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:t.helpText}),e[78]=t,e[79]=Z):Z=e[79];let Q;e[80]!==N?(Q=N&&s.jsx("p",{className:"text-xs text-destructive",children:N.message}),e[80]=N,e[81]=Q):Q=e[81];let ae;e[82]!==c?(ae=c("settings.connectForms.cancel"),e[82]=c,e[83]=ae):ae=e[83];let ce;e[84]!==x||e[85]!==i||e[86]!==ae?(ce=s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:x,children:ae}),e[84]=x,e[85]=i,e[86]=ae,e[87]=ce):ce=e[87];let de;e[88]!==x||e[89]!==c?(de=c(x?"settings.connectForms.saving":"settings.connectForms.saveConnection"),e[88]=x,e[89]=c,e[90]=de):de=e[90];let ue;e[91]!==x||e[92]!==de?(ue=s.jsx(ne,{type:"submit",size:"sm",disabled:x,children:de}),e[91]=x,e[92]=de,e[93]=ue):ue=e[93];let me;e[94]!==ce||e[95]!==ue?(me=s.jsxs(Xe,{children:[ce,ue]}),e[94]=ce,e[95]=ue,e[96]=me):me=e[96];let ye;return e[97]!==C||e[98]!==F||e[99]!==D||e[100]!==te||e[101]!==Z||e[102]!==Q||e[103]!==me?(ye=s.jsxs("form",{onSubmit:C,className:"space-y-3",children:[F,D,te,Z,Q,me]}),e[97]=C,e[98]=F,e[99]=D,e[100]=te,e[101]=Z,e[102]=Q,e[103]=me,e[104]=ye):ye=e[104],ye}const ys={kind:"closed"};function js(l,e){switch(e.type){case"open":return l.kind==="closed"?{kind:"grid"}:l;case"close":return{kind:"closed"};case"back":switch(l.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return{kind:"grid"};default:return l}case"select-form":return l.kind!=="grid"?l:{kind:"form",providerId:e.providerId,presetId:e.presetId};case"select-oauth":return l.kind!=="grid"?l:{kind:"oauth-pending",providerId:e.providerId,stateToken:e.stateToken};case"oauth-failed":return l.kind==="oauth-pending"?{kind:"grid"}:l;case"select-provision":return l.kind!=="grid"?l:{kind:"provision-pending",providerId:e.providerId};case"provision-error":return l.kind!=="provision-pending"?l:{kind:"provision-error",providerId:l.providerId,error:e.error};case"retry-provision":return l.kind!=="provision-error"?l:{kind:"provision-pending",providerId:l.providerId}}}function Ss(l){switch(l.kind){case"form":case"oauth-pending":case"provision-pending":case"provision-error":return l.providerId;default:return null}}function Ns({open:l,onOpenChange:e,initialProvider:t}){const i=se(),o=Me()?.providers??[],{org:r}=xe(),a=we(),d=Ie(),[u,c]=U.useReducer(js,ys),h=U.useRef(!1);U.useEffect(()=>{l&&u.kind==="closed"?c({type:"open"}):!l&&u.kind!=="closed"&&c({type:"close"})},[l,u.kind]);const f=()=>{h.current=!1,c({type:"close"}),e(!1)},m=()=>{d.invalidateQueries({queryKey:re.aiProviderKeys(r.id)}),d.invalidateQueries({queryKey:re.aiProviders(r.id)})},{mutate:p}=ke({mutationFn:async({providerId:g,code:v,stateToken:y,label:C})=>(await a.call("AI_PROVIDER_OAUTH_EXCHANGE",{providerId:g,code:v,stateToken:y,label:C}),g),onSuccess:g=>{ie("ai_provider_oauth_succeeded",{provider_id:g}),m();const v=o.find(y=>y.id===g);le.success(i("settings.connectProviderDialog.oauthSuccessMessage",{provider:v?.name??i("settings.connectProviderDialog.defaultProviderName")})),f()},onError:(g,v)=>{ie("ai_provider_oauth_failed",{provider_id:v.providerId,error:g.message}),le.error(i("settings.connectProviderDialog.oauthFailedMessage",{error:g.message})),c({type:"oauth-failed"})}}),{mutate:j}=ke({mutationFn:async g=>(await a.call("AI_PROVIDER_PROVISION_KEY",{providerId:g}),g),onSuccess:g=>{ie("ai_provider_provision_succeeded",{provider_id:g}),m();const v=o.find(y=>y.id===g);le.success(i("settings.connectProviderDialog.provisionSuccessMessage",{provider:v?.name??i("settings.connectProviderDialog.defaultProviderName")})),f()},onError:(g,v)=>{ie("ai_provider_provision_failed",{provider_id:v,error:g.message}),c({type:"provision-error",error:g.message})}}),k=async g=>{const{provider:v}=g,y=g.kind==="openai-compatible"?g.preset?.id??null:null,C=v.supportedMethods.includes("oauth-pkce"),L=v.supportedMethods.includes("api-key");if(v.supportsProvision===!0){ie("ai_provider_connect_clicked",{provider_id:v.id,method:"provision"}),c({type:"select-provision",providerId:v.id}),j(v.id);return}if(C){ie("ai_provider_connect_clicked",{provider_id:v.id,method:"oauth-pkce"});try{const O=await a.call("AI_PROVIDER_OAUTH_URL",{providerId:v.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`});if(!O?.url)throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL");c({type:"select-oauth",providerId:v.id,stateToken:O.stateToken}),window.open(O.url,"AiProviderOAuth","width=600,height=700")}catch(O){le.error(i("settings.connectProviderDialog.startOAuthFailedMessage",{error:O instanceof Error?O.message:String(O)}))}return}L&&(ie("ai_provider_connect_clicked",{provider_id:v.id,...y!==null?{preset_id:y}:{},method:"api-key"}),c({type:"select-form",providerId:v.id,presetId:y}))},b=U.useRef(k);b.current=k;const S=U.useRef(t);S.current=t,U.useEffect(()=>{!S.current||u.kind!=="grid"||h.current||(h.current=!0,b.current(S.current))},[u.kind]);const I=u.kind==="oauth-pending"?u.stateToken:null,P=u.kind==="oauth-pending"?u.providerId:null;U.useEffect(()=>{if(u.kind!=="oauth-pending")return;let g=!1;const v=u.stateToken,y=u.providerId,C=A=>{if(A.origin!==window.location.origin||A.data?.type!=="AI_PROVIDER_OAUTH_CALLBACK")return;const{code:O,stateToken:R}=A.data;if(R!==v){le.error(i("settings.connectProviderDialog.securityCheckFailedMessage")),c({type:"oauth-failed"});return}g=!0;const F=o.find(D=>D.id===y);p({providerId:y,code:O,stateToken:v,label:F?.name??y})};window.addEventListener("message",C);const L=setTimeout(()=>{g||(ie("ai_provider_oauth_timeout",{provider_id:y}),c({type:"oauth-failed"}),le.error(i("settings.connectProviderDialog.connectionTimedOutMessage")))},12e4);return()=>{window.removeEventListener("message",C),clearTimeout(L)}},[u.kind,I,P,p]);const E=Ss(u),_=E?o.find(g=>g.id===E):null,N=(u.kind==="form"&&u.presetId?be(u.presetId):null)?.name??_?.name??i("settings.connectProviderDialog.defaultTitle"),w=u.kind!=="grid"&&u.kind!=="closed",M=()=>{t?f():c({type:"back"})};return s.jsx(Ye,{open:u.kind!=="closed",onOpenChange:g=>!g&&f(),children:s.jsxs(Qe,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(St,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[w&&s.jsx(ne,{variant:"ghost",size:"icon","aria-label":i("settings.connectProviderDialog.backButtonLabel"),className:"h-7 w-7",onClick:M,children:s.jsx(et,{size:16})}),s.jsx(Je,{children:N})]}),u.kind==="grid"&&!t&&s.jsx(Nt,{children:i("settings.connectProviderDialog.gridDescription")})]}),u.kind==="grid"&&!t&&s.jsx(ot,{providers:o,onSelect:k}),u.kind==="form"&&(u.providerId==="openai-compatible"?s.jsx(bs,{preset:u.presetId?be(u.presetId):void 0,onCancel:()=>c({type:"back"}),onSuccess:()=>{m(),f()}}):s.jsx(gs,{providerId:u.providerId,onCancel:()=>c({type:"back"}),onSuccess:()=>{m(),f()}})),u.kind==="oauth-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Le,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:i("settings.connectProviderDialog.oauthPendingMessage")})]}),u.kind==="provision-pending"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(Le,{size:"lg"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:i("settings.connectProviderDialog.provisionPendingMessage")})]}),u.kind==="provision-error"&&s.jsxs("div",{className:"flex flex-col items-center gap-4 py-6",children:[s.jsx(Gt,{size:28,className:"text-destructive"}),s.jsx("p",{className:"text-sm text-foreground text-center",children:u.error}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>c({type:"back"}),children:i("settings.connectProviderDialog.backButton")}),s.jsx(ne,{size:"sm",onClick:()=>{c({type:"retry-provision"}),j(u.providerId)},children:i("settings.connectProviderDialog.retryButton")})]})]})]})})}function ks(){const l=H.c(7),{org:e}=xe(),t=we();let i;l[0]!==e.id?(i=re.defaultBrand(e.id),l[0]=e.id,l[1]=i):i=l[1];let n;l[2]!==t?(n=async()=>{const{items:a}=await t.call("BRAND_CONTEXT_LIST",{});return(Array.isArray(a)?a:[]).find(Cs)??null},l[2]=t,l[3]=n):n=l[3];let o;l[4]!==i||l[5]!==n?(o={queryKey:i,queryFn:n},l[4]=i,l[5]=n,l[6]=o):o=l[6];const{data:r}=vt(o);return r??null}function Cs(l){return l.isDefault&&!l.archivedAt}function ws(l){const e=l.colors;if(!e)return null;if(Array.isArray(e)){const t=e.find(n=>typeof n=="object"&&n!==null&&"label"in n&&/primary|brand|main/i.test(n.label)),i=t?t.value:e[0]?.value;return typeof i=="string"?i:null}if(typeof e=="object"){const t=e;return t.primary??Object.values(t)[0]??null}return null}function Is(l){const e=H.c(66);let t;e[0]!==l?(t=l===void 0?{}:l,e[0]=l,e[1]=t):t=e[1];const{title:i,description:n,onLocalRuntimePicked:o}=t,r=se(),{org:a}=xe(),{localMode:d}=gt(),u=ks(),c=Et(),h=Ot(),[f,m]=U.useState(null),[p,j]=U.useState(!1),[k,b]=U.useState(!1),S=Me();let I;e[2]!==S?.providers?(I=S?.providers??[],e[2]=S?.providers,e[3]=I):I=e[3];const P=I;let E,_,x;if(e[4]!==u||e[5]!==h||e[6]!==n||e[7]!==c.capabilities||e[8]!==c.online||e[9]!==d||e[10]!==o||e[11]!==a.name||e[12]!==r||e[13]!==i){const O=[];if(c.online){if(c.capabilities.includes("claude-code")){let Q;e[17]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Se,{size:16}),e[17]=Q):Q=e[17],O.push({option:"claude-code-desktop",label:"Claude Code",icon:Q})}if(c.capabilities.includes("codex")){let Q;e[18]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Ne,{size:16}),e[18]=Q):Q=e[18],O.push({option:"codex-desktop",label:"Codex",icon:Q})}}const R=O.length>0&&h!==null,F=a.name;let D;e[19]!==u?(D=u?ws(u):null,e[19]=u,e[20]=D):D=e[20];const z=D,K=u?.favicon??u?.logo??null;let V;e[21]!==F||e[22]!==r||e[23]!==i?(V=i??(F?r("chat.noAiProviderEmptyState.headingWithOrg",{org:F}):r("chat.noAiProviderEmptyState.headingDefault")),e[21]=F,e[22]=r,e[23]=i,e[24]=V):V=e[24];const J=V;let G;e[25]!==n||e[26]!==R||e[27]!==d||e[28]!==r?(G=n??r(R?"chat.noAiProviderEmptyState.subtitleWithDesktop":d?"chat.noAiProviderEmptyState.subtitleLocalMode":"chat.noAiProviderEmptyState.subtitleDefault"),e[25]=n,e[26]=R,e[27]=d,e[28]=r,e[29]=G):G=e[29];const X=G,T=!!(K||z);let B;e[30]!==z?(B=z?{backgroundColor:`${z}18`,borderColor:`${z}30`}:void 0,e[30]=z,e[31]=B):B=e[31];const W=B,q=T?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-muted border border-border";E="flex flex-col items-center gap-8 w-full max-w-3xl px-4";let $;e[32]!==q||e[33]!==W||e[34]!==K||e[35]!==c.online||e[36]!==z||e[37]!==r?($=K?s.jsx("div",{className:q,style:W,children:s.jsx("img",{src:K,alt:"",className:"size-7 rounded object-contain"})}):s.jsx("button",{type:"button",onClick:()=>b(!0),"aria-label":c.online?r("chat.noAiProviderEmptyState.desktopLinkedLabel"):r("chat.noAiProviderEmptyState.connectDesktopLabel"),className:pe(q,"cursor-pointer transition-colors hover:bg-accent"),style:W,children:s.jsxs("span",{className:"relative inline-flex items-center justify-center",children:[s.jsx(qt,{size:24,style:z?{color:z}:void 0,className:pe(!z&&"text-muted-foreground")}),c.online&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-success ring-2 ring-background animate-pulse"})]})}),e[32]=q,e[33]=W,e[34]=K,e[35]=c.online,e[36]=z,e[37]=r,e[38]=$):$=e[38];let Y;e[39]!==J?(Y=s.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:J}),e[39]=J,e[40]=Y):Y=e[40];let te;e[41]!==X?(te=s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:X}),e[41]=X,e[42]=te):te=e[42];let Z;e[43]!==Y||e[44]!==te?(Z=s.jsxs("div",{className:"space-y-2",children:[Y,te]}),e[43]=Y,e[44]=te,e[45]=Z):Z=e[45],e[46]!==$||e[47]!==Z?(_=s.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[$,Z]}),e[46]=$,e[47]=Z,e[48]=_):_=e[48],x=R&&s.jsxs("div",{className:"flex flex-col items-center gap-3 w-full",children:[s.jsx("div",{className:"flex flex-wrap items-center justify-center gap-2",children:O.map(Q=>s.jsxs(ne,{variant:"default",className:"gap-2",onClick:()=>{h?.setPendingAgentOption(Q.option),o?.(Q.option)},children:[Q.icon,r("chat.noAiProviderEmptyState.useLabel",{label:Q.label})]},Q.option))}),s.jsxs("div",{className:"flex items-center gap-3 w-full max-w-xs text-xs text-muted-foreground",children:[s.jsx("span",{className:"h-px flex-1 bg-border"}),r("chat.noAiProviderEmptyState.orConnectProvider"),s.jsx("span",{className:"h-px flex-1 bg-border"})]})]}),e[4]=u,e[5]=h,e[6]=n,e[7]=c.capabilities,e[8]=c.online,e[9]=d,e[10]=o,e[11]=a.name,e[12]=r,e[13]=i,e[14]=E,e[15]=_,e[16]=x}else E=e[14],_=e[15],x=e[16];let N,w;e[49]===Symbol.for("react.memo_cache_sentinel")?(N=O=>m(O),w=()=>j(!0),e[49]=N,e[50]=w):(N=e[49],w=e[50]);let M;e[51]!==P?(M=s.jsx("div",{className:"w-full",children:s.jsx(ot,{providers:P,onSelect:N,onShowAll:w})}),e[51]=P,e[52]=M):M=e[52];const g=f!==null||p;let v;e[53]===Symbol.for("react.memo_cache_sentinel")?(v=O=>{O||(m(null),j(!1))},e[53]=v):v=e[53];const y=f??void 0;let C;e[54]!==y||e[55]!==g?(C=s.jsx(Ns,{open:g,onOpenChange:v,initialProvider:y}),e[54]=y,e[55]=g,e[56]=C):C=e[56];let L;e[57]!==k?(L=s.jsx(Qt,{open:k,onOpenChange:b}),e[57]=k,e[58]=L):L=e[58];let A;return e[59]!==C||e[60]!==L||e[61]!==E||e[62]!==_||e[63]!==x||e[64]!==M?(A=s.jsxs("div",{className:E,children:[_,x,M,C,L]}),e[59]=C,e[60]=L,e[61]=E,e[62]=_,e[63]=x,e[64]=M,e[65]=A):A=e[65],A}function Oe(l){const e=l.title.includes(": ");return{provider:e?l.title.split(": ")[0]??"":l.modelId.split("/")[0]??"",displayName:e?l.title.split(": ").slice(1).join(": "):l.title}}function _s(l){return l<32e3?{level:1,labelKey:"chat.shared.contextLevelSmall",descriptionKey:"chat.shared.contextLevelSmallDesc"}:l<2e5?{level:2,labelKey:"chat.shared.contextLevelMedium",descriptionKey:"chat.shared.contextLevelMediumDesc"}:l<5e5?{level:3,labelKey:"chat.shared.contextLevelLarge",descriptionKey:"chat.shared.contextLevelLargeDesc"}:{level:4,labelKey:"chat.shared.contextLevelVeryLarge",descriptionKey:"chat.shared.contextLevelVeryLargeDesc"}}const Ms=["bg-destructive","bg-warning","bg-success","bg-success"],Es=["text-success","text-warning","text-warning","text-destructive"];function Os(l,e){const t=Math.round(l*.75/1e3),i=t>=1?`${t}K`:`${Math.round(l*.75)}`;return e("chat.shared.approxWords",{wordCount:i})}function Ps(l){return l<1?{level:1,labelKey:"chat.shared.costLevelCheap"}:l<5?{level:2,labelKey:"chat.shared.costLevelModerate"}:l<15?{level:3,labelKey:"chat.shared.costLevelHigh"}:{level:4,labelKey:"chat.shared.costLevelExpensive"}}const Ls={text:{icon:s.jsx(Ut,{className:"size-3.5"}),labelKey:"chat.shared.capabilityText"},vision:{icon:s.jsx(Jt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityVision"},image:{icon:s.jsx(Ft,{className:"size-3.5"}),labelKey:"chat.shared.capabilityImage"},tools:{icon:s.jsx($t,{className:"size-3.5"}),labelKey:"chat.shared.capabilityTools"},reasoning:{icon:s.jsx(Zt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityReasoning"},"web-search":{icon:s.jsx(tt,{className:"size-3.5"}),labelKey:"chat.shared.capabilityWebSearch"}};function As(l){const e=H.c(10),{capability:t}=l,i=se(),n=Ls[t];if(n){const d=n.icon;let u;e[0]!==n.labelKey||e[1]!==i?(u=i(n.labelKey),e[0]=n.labelKey,e[1]=i,e[2]=u):u=e[2];let c;return e[3]!==n.icon||e[4]!==u?(c=s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[d,u]}),e[3]=n.icon,e[4]=u,e[5]=c):c=e[5],c}let o;e[6]!==t?(o=t.charAt(0).toUpperCase(),e[6]=t,e[7]=o):o=e[7];const r=o+t.slice(1);let a;return e[8]!==r?(a=s.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:r}),e[8]=r,e[9]=a):a=e[9],a}function Ts(l){const e=H.c(59),{model:t,compact:i}=l,n=i===void 0?!1:i,o=se();if(!t){let x;e[0]!==o?(x=o("chat.shared.hoverToPreview"),e[0]=o,e[1]=x):x=e[1];let N;return e[2]!==x?(N=s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:x}),e[2]=x,e[3]=N):N=e[3],N}const r=t.costs?.input!=null?t.costs.input*1e6:null,a=t.costs?.output!=null?t.costs.output*1e6:null;let d;e[4]!==t?(d=Oe(t),e[4]=t,e[5]=d):d=e[5];const{provider:u,displayName:c}=d;if(n){let x;e[6]!==t.limits||e[7]!==o?(x=t.limits?.contextWindow&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:o("chat.shared.context")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.contextWindow.toLocaleString()," ",o("chat.shared.tokens")]})]}),e[6]=t.limits,e[7]=o,e[8]=x):x=e[8];let N;e[9]!==r||e[10]!==o?(N=r!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:o("chat.shared.input")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[9]=r,e[10]=o,e[11]=N):N=e[11];let w;e[12]!==a||e[13]!==o?(w=a!=null&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:o("chat.shared.output")}),s.jsxs("span",{className:"text-foreground font-medium",children:["$",a.toFixed(2)," / 1M"]})]}),e[12]=a,e[13]=o,e[14]=w):w=e[14];let M;e[15]!==t.limits||e[16]!==o?(M=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:o("chat.shared.outputLimit")}),s.jsxs("span",{className:"text-foreground font-medium",children:[t.limits.maxOutputTokens.toLocaleString()," ",o("chat.shared.tokens")]})]}),e[15]=t.limits,e[16]=o,e[17]=M):M=e[17];let g;return e[18]!==x||e[19]!==N||e[20]!==w||e[21]!==M?(g=s.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[x,N,w,M]}),e[18]=x,e[19]=N,e[20]=w,e[21]=M,e[22]=g):g=e[22],g}let h;e[23]!==u?(h=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:u}),e[23]=u,e[24]=h):h=e[24];let f;e[25]!==t.logo||e[26]!==t.title?(f=t.logo&&s.jsx("img",{src:t.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[25]=t.logo,e[26]=t.title,e[27]=f):f=e[27];let m;e[28]!==c?(m=s.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:c}),e[28]=c,e[29]=m):m=e[29];let p;e[30]!==f||e[31]!==m?(p=s.jsxs("div",{className:"flex items-center gap-2.5",children:[f,m]}),e[30]=f,e[31]=m,e[32]=p):p=e[32];let j;e[33]!==t.modelId?(j=s.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:t.modelId}),e[33]=t.modelId,e[34]=j):j=e[34];let k;e[35]!==h||e[36]!==p||e[37]!==j?(k=s.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[h,p,j]}),e[35]=h,e[36]=p,e[37]=j,e[38]=k):k=e[38];let b;e[39]!==t.capabilities?(b=t.capabilities&&t.capabilities.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(t.capabilities)].map(zs)}),e[39]=t.capabilities,e[40]=b):b=e[40];let S;e[41]!==t.limits||e[42]!==o?(S=t.limits?.contextWindow&&(()=>{const{level:x,labelKey:N,descriptionKey:w}=_s(t.limits.contextWindow);return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:o("chat.shared.contextWindow")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(M=>s.jsx("div",{className:pe("w-2 h-2 rounded-full",M<=x?Ms[x-1]:"bg-muted")},M))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:o(N)}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",o(w)]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.limits.contextWindow.toLocaleString()," ",o("chat.shared.tokens")]})]})})(),e[41]=t.limits,e[42]=o,e[43]=S):S=e[43];let I;e[44]!==t.limits||e[45]!==o?(I=t.limits?.maxOutputTokens&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:o("chat.shared.outputLimit")}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-sm text-foreground",children:[t.limits.maxOutputTokens.toLocaleString()," ",o("chat.shared.tokens")]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:Os(t.limits.maxOutputTokens,o)})]})]}),e[44]=t.limits,e[45]=o,e[46]=I):I=e[46];let P;e[47]!==r||e[48]!==a||e[49]!==o?(P=(r!=null||a!=null)&&(()=>{const{level:x,labelKey:N}=r!=null?Ps(r):{level:0,labelKey:null};return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:o("chat.shared.pricing")}),r!=null&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(w=>s.jsx("span",{className:pe("text-sm font-bold leading-none",w<=x?Es[x-1]:"text-muted-foreground/20"),children:"$"},w))}),s.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N?o(N):""})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[r!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.shared.input")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M"," ",o("chat.shared.tokens")]})]}),a!=null&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:o("chat.shared.output")}),s.jsxs("span",{className:"text-xs text-foreground",children:["$",a.toFixed(2)," / 1M"," ",o("chat.shared.tokens")]})]})]})]})})(),e[47]=r,e[48]=a,e[49]=o,e[50]=P):P=e[50];let E;e[51]!==S||e[52]!==I||e[53]!==P?(E=s.jsxs("div",{className:"flex flex-col gap-6",children:[S,I,P]}),e[51]=S,e[52]=I,e[53]=P,e[54]=E):E=e[54];let _;return e[55]!==E||e[56]!==k||e[57]!==b?(_=s.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[k,b,E]}),e[55]=E,e[56]=k,e[57]=b,e[58]=_):_=e[58],_}function zs(l){return s.jsx(As,{capability:l},l)}function rt(l){const e=H.c(22),{model:t,placeholder:i,isLoading:n}=l,o=n===void 0?!1:n,r=se();let a;e[0]!==i||e[1]!==r?(a=i??r("chat.shared.selectModel"),e[0]=i,e[1]=r,e[2]=a):a=e[2];const d=a;if(o){let b;return e[3]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ee,{className:"w-5 h-5 rounded-sm shrink-0"}),s.jsx(ee,{className:"w-16 h-3 hidden md:block"})]}),e[3]=b):b=e[3],b}if(!t){let b;e[4]!==d?(b=s.jsx("span",{className:"text-sm text-muted-foreground",children:d}),e[4]=d,e[5]=b):b=e[5];let S;e[6]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[6]=S):S=e[6];let I;return e[7]!==b?(I=s.jsxs("div",{className:"flex items-center gap-1.5",children:[b,S]}),e[7]=b,e[8]=I):I=e[8],I}let u;e[9]!==t?(u=Oe(t),e[9]=t,e[10]=u):u=e[10];const{displayName:c}=u;let h;e[11]!==t?(h=Ee(t),e[11]=t,e[12]=h):h=e[12];const f=h;let m;e[13]!==t.title||e[14]!==f?(m=s.jsx("img",{src:f,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[13]=t.title,e[14]=f,e[15]=m):m=e[15];let p;e[16]!==c?(p=s.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:c}),e[16]=c,e[17]=p):p=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(ze,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[18]=j):j=e[18];let k;return e[19]!==m||e[20]!==p?(k=s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[m,p,j]}),e[19]=m,e[20]=p,e[21]=k):k=e[21],k}const Rs=["vision","image","file","audio","video"],at=["image/png","image/jpeg","image/gif","image/webp"],ct=["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];function Pe(l){const e=l?.capabilities;return e?Rs.some(t=>e.includes(t)):!1}function Gi(l,e){if(!l)return!1;if(l.startsWith("text/"))return!0;const t=e?.capabilities??[],i=t.includes("vision")||t.includes("image"),n=t.includes("file"),o=t.includes("audio"),r=t.includes("video");return!!(i&&at.includes(l)||n&&l==="application/pdf"||o&&l.startsWith("audio/")||r&&l.startsWith("video/")||Pe(e)&&ct.includes(l))}function Xi(l){const e=l?.capabilities??[],t=["text/*"];return(e.includes("vision")||e.includes("image"))&&t.push(...at),e.includes("file")&&t.push("application/pdf"),e.includes("audio")&&t.push("audio/*"),e.includes("video")&&t.push("video/*"),Pe(l)&&t.push(...ct),t.join(",")}function Yi(l){const e=l?.capabilities??[],t=[];return(e.includes("vision")||e.includes("image"))&&t.push("chat.shared.fileTypeImages"),e.includes("file")&&t.push("chat.shared.fileTypePdfs"),e.includes("audio")&&t.push("chat.shared.fileTypeAudio"),e.includes("video")&&t.push("chat.shared.fileTypeVideo"),Pe(l)&&t.push("chat.shared.fileTypeOffice"),{parts:t,count:t.length}}const dt=["smarter","faster","cheaper"],Fs={smarter:"chat.decopilot.tierSmarter",faster:"chat.decopilot.tierFaster",cheaper:"chat.decopilot.tierCheaper"},Ds=[{tier:"smarter",prefixes:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Ks=Ds.flatMap(({tier:l,prefixes:e})=>e.map(t=>({tier:l,prefix:t}))).sort((l,e)=>e.prefix.length-l.prefix.length),$s="google/gemini-2.5-pro",Be=new Map;function Us(l){const e=Be.get(l);if(e!==void 0)return e;let t=null;if(l.endsWith(":free"))t="cheaper";else for(const{tier:i,prefix:n}of Ks)if(l.startsWith(n)){if(n===$s&&l.length>n.length&&l[n.length]==="-"){const r=l[n.length+1];if(!r||!/\d/.test(r))continue}t=i;break}return Be.set(l,t),t}function We(l){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const t of l){const i=Us(t.modelId);e[i??"other"].push(t)}for(const t of Object.keys(e))e[t].sort((i,n)=>i.title.localeCompare(n.title));return e}const ut="mesh:model-shortlist:",Bs=new Set(["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Ws(l){try{const e=localStorage.getItem(ut+l);return e?new Set(JSON.parse(e)):null}catch{return null}}function Vs(l,e){localStorage.setItem(ut+l,JSON.stringify([...e]))}function Hs(l){const e=H.c(21),{model:t,onHover:i}=l;let n;e[0]!==t?(n=Oe(t),e[0]=t,e[1]=n):n=e[1];const{displayName:o,provider:r}=n;let a;e[2]!==t?(a=Ee(t),e[2]=t,e[3]=a):a=e[3];const d=a;let u;e[4]!==t||e[5]!==i?(u=()=>i(t),e[4]=t,e[5]=i,e[6]=u):u=e[6];let c;e[7]!==t.title||e[8]!==d?(c=s.jsx("img",{src:d,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[7]=t.title,e[8]=d,e[9]=c):c=e[9];let h;e[10]!==o?(h=s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=h):h=e[11];let f;e[12]!==r?(f=s.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=f):f=e[13];let m;e[14]!==h||e[15]!==f?(m=s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[h,f]}),e[14]=h,e[15]=f,e[16]=m):m=e[16];let p;return e[17]!==u||e[18]!==c||e[19]!==m?(p=s.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:u,children:[c,m]}),e[17]=u,e[18]=c,e[19]=m,e[20]=p):p=e[20],p}function qs(l){const e=H.c(16),{error:t,onRetry:i}=l,n=se();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:s.jsx(jt,{className:"size-5 text-destructive"})}),e[0]=o):o=e[0];const r=n("chat.decopilot.failedToLoadModels");let a;e[1]!==r?(a=s.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e[1]=r,e[2]=a):a=e[2];const d=t?.message||n("chat.decopilot.couldNotFetchModels"),u=" "+n("chat.decopilot.tryAnotherProviderOrRetry");let c;e[3]!==d||e[4]!==u?(c=s.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[d,u]}),e[3]=d,e[4]=u,e[5]=c):c=e[5];let h;e[6]!==a||e[7]!==c?(h=s.jsxs("div",{className:"flex flex-col gap-1",children:[a,c]}),e[6]=a,e[7]=c,e[8]=h):h=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Kt,{className:"size-3.5"}),e[9]=f):f=e[9];const m=n("chat.decopilot.retry");let p;e[10]!==i||e[11]!==m?(p=s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[f,m]})}),e[10]=i,e[11]=m,e[12]=p):p=e[12];let j;return e[13]!==p||e[14]!==h?(j=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[o,h,p]}),e[13]=p,e[14]=h,e[15]=j):j=e[15],j}function Gs(){const l=H.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(Xs)}),l[0]=e):e=l[0],e}function Xs(l,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(ee,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(ee,{className:"flex-1 h-4"}),s.jsx(ee,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ve(l){const e=H.c(12),{label:t,models:i,onSelect:n,onHover:o}=l;if(i.length===0)return null;let r;e[0]!==t?(r=s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:t}),e[0]=t,e[1]=r):r=e[1];let a;if(e[2]!==i||e[3]!==o||e[4]!==n){let u;e[6]!==o||e[7]!==n?(u=c=>s.jsx("div",{onClick:()=>n(c),className:"cursor-pointer",children:s.jsx(Hs,{model:c,onHover:o})},c.modelId),e[6]=o,e[7]=n,e[8]=u):u=e[8],a=i.map(u),e[2]=i,e[3]=o,e[4]=n,e[5]=a}else a=e[5];let d;return e[9]!==r||e[10]!==a?(d=s.jsxs("div",{children:[r,a]}),e[9]=r,e[10]=a,e[11]=d):d=e[11],d}function Ce(l,e){return e(l==="other"?"chat.decopilot.tierOther":Fs[l])}function Ys(l){const e=H.c(21),{model:t,isChecked:i,onToggle:n,onHover:o}=l,[r,a]=U.useState(i);r!==i&&a(i);let d;e[0]!==t?(d=Ee(t),e[0]=t,e[1]=d):d=e[1];const u=d;let c;e[2]!==t||e[3]!==o?(c=()=>o(t),e[2]=t,e[3]=o,e[4]=c):c=e[4];let h;e[5]!==t.modelId||e[6]!==n?(h=()=>{a(Qs),n(t.modelId)},e[5]=t.modelId,e[6]=n,e[7]=h):h=e[7];let f;e[8]!==r||e[9]!==h?(f=s.jsx(Pt,{checked:r,onCheckedChange:h}),e[8]=r,e[9]=h,e[10]=f):f=e[10];let m;e[11]!==u||e[12]!==t.title?(m=s.jsx("img",{src:u,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:t.title}),e[11]=u,e[12]=t.title,e[13]=m):m=e[13];let p;e[14]!==t.title?(p=s.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:t.title}),e[14]=t.title,e[15]=p):p=e[15];let j;return e[16]!==c||e[17]!==f||e[18]!==m||e[19]!==p?(j=s.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:c,children:[f,m,p]}),e[16]=c,e[17]=f,e[18]=m,e[19]=p,e[20]=j):j=e[20],j}function Qs(l){return!l}function Js(l,e){const t=[];for(const i of dt)if(l[i].length>0){t.push({type:"header",label:Ce(i,e)});for(const n of l[i])t.push({type:"model",model:n})}if(l.other.length>0){t.push({type:"header",label:Ce("other",e)});for(const i of l.other)t.push({type:"model",model:i})}return t}function Zs({items:l,shortlistSet:e,onToggle:t,onHover:i}){const n=U.useRef(null),o=us({count:l.length,getScrollElement:()=>n.current,estimateSize:r=>l[r]?.type==="header"?36:44,overscan:6});return s.jsx("div",{ref:n,className:"flex-1 overflow-y-auto",children:s.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(r=>{const a=l[r.index];return a?s.jsx("div",{"data-index":r.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:a.type==="header"?s.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:a.label}):s.jsx(Ys,{model:a.model,isChecked:e.has(a.model.modelId),onToggle:t,onHover:i})},r.key):null})})})}function ei(l){const e=H.c(30),{keyId:t,searchTerm:i,onHover:n,onModelSelect:o,managing:r,onToggleManage:a,filterModels:d}=l,u=se(),{models:c}=Ht(t),h=d?c.filter(d):c.filter(ti);let f;e[0]!==t?(f=()=>(t?Ws(t):null)??Bs,e[0]=t,e[1]=f):f=e[1];const[m,p]=U.useState(f),[,j]=U.useTransition();let k;e[2]!==t||e[3]!==j?(k=v=>{t&&j(()=>{p(y=>{const C=new Set(y);return C.has(v)?C.delete(v):C.add(v),Vs(t,C),C})})},e[2]=t,e[3]=j,e[4]=k):k=e[4];const b=k,S=i.toLowerCase().trim(),I=v=>S?v.filter(y=>y.title.toLowerCase().includes(S)||y.modelId.toLowerCase().includes(S)):v;if(r){const v=We(I(h)),y=Js(v,u);let C;e[5]!==m?(C=F=>m.has(F.modelId),e[5]=m,e[6]=C):C=e[6];const L=h.filter(C).length;let A;e[7]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(et,{size:14}),e[7]=A):A=e[7];let O;e[8]!==u?(O=u("chat.decopilot.back"),e[8]=u,e[9]=O):O=e[9];let R;return e[10]!==a||e[11]!==O?(R=s.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[A,O]}),e[10]=a,e[11]=O,e[12]=R):R=e[12],s.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[R,s.jsx("span",{className:"text-xs text-muted-foreground",children:u("chat.decopilot.selectedCount",{count:L})})]}),s.jsx(Zs,{items:y,shortlistSet:m,onToggle:b,onHover:n})]})}let P;e[13]!==m?(P=v=>m.has(v.modelId),e[13]=m,e[14]=P):P=e[14];const E=h.filter(P),_=E.length>0?E:h,x=We(I(_));let N;e[15]!==x||e[16]!==n||e[17]!==o||e[18]!==u?(N=dt.map(v=>s.jsx(Ve,{label:Ce(v,u),models:x[v],onSelect:o,onHover:n},v)),e[15]=x,e[16]=n,e[17]=o,e[18]=u,e[19]=N):N=e[19];let w;e[20]!==u?(w=Ce("other",u),e[20]=u,e[21]=w):w=e[21];let M;e[22]!==x.other||e[23]!==n||e[24]!==o||e[25]!==w?(M=s.jsx(Ve,{label:w,models:x.other,onSelect:o,onHover:n}),e[22]=x.other,e[23]=n,e[24]=o,e[25]=w,e[26]=M):M=e[26];let g;return e[27]!==N||e[28]!==M?(g=s.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[N,M]}),e[27]=N,e[28]=M,e[29]=g):g=e[29],g}function ti(l){return l.asyncResearch!==!0}function si(){const l=H.c(6);let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[s.jsx(ee,{className:"size-4 shrink-0"}),s.jsx(ee,{className:"flex-1 h-6"}),s.jsx(ee,{className:"w-[140px] h-8 shrink-0"})]})}),l[0]=e):e=l[0];let t;l[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,s.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(ii)})]}),l[1]=t):t=l[1];let i;l[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ee,{className:"size-6 shrink-0"}),s.jsx(ee,{className:"h-6 w-32"})]}),l[2]=i):i=l[2];let n;l[3]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[i,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ee,{className:"h-6 w-20 rounded-md"}),s.jsx(ee,{className:"h-6 w-24 rounded-md"})]})]}),l[3]=n):n=l[3];let o;l[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(ee,{className:"h-4 w-24"}),s.jsx(ee,{className:"h-4 w-32"})]}),l[4]=o):o=l[4];let r;return l[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[t,s.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:s.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[n,s.jsxs("div",{className:"flex flex-col gap-4",children:[o,s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(ee,{className:"h-4 w-16"}),s.jsx(ee,{className:"h-4 w-40"})]})]})]})})]}),l[5]=r):r=l[5],r}function ii(l,e){return s.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[s.jsx(ee,{className:"size-5 shrink-0 rounded-sm"}),s.jsx(ee,{className:"flex-1 h-4"}),s.jsx(ee,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function mt(l){const e=H.c(54),{onClose:t,credentialId:i,onCredentialChange:n,selectedModel:o,onModelChange:r,filterModels:a}=l,d=se(),[u,c]=U.useState(null),[h,f]=U.useState(""),[m,p]=U.useState(!1),j=U.useRef(null),k=Me(),b=Vt();let S;e[0]!==k?.providers?(S=Object.fromEntries((k?.providers??[]).map(oi)),e[0]=k?.providers,e[1]=S):S=e[1];const I=S,P=bt(),{org:E}=xe();let _;e[2]!==n?(_=T=>{n(T),c(null)},e[2]=n,e[3]=_):_=e[3];const x=_;let N;e[4]!==i||e[5]!==t||e[6]!==r?(N=T=>{i&&(r(T),f(""),t())},e[4]=i,e[5]=t,e[6]=r,e[7]=N):N=e[7];const w=N;if(b.length===0){let T;return e[8]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:s.jsx(Is,{})}),e[8]=T):T=e[8],T}let M;e[9]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(tt,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=M):M=e[9];let g;e[10]!==m||e[11]!==d?(g=d(m?"chat.decopilot.searchAllModels":"chat.decopilot.searchForModel"),e[10]=m,e[11]=d,e[12]=g):g=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=T=>f(T.target.value),e[13]=v):v=e[13];let y;e[14]!==h||e[15]!==g?(y=s.jsx(fe,{ref:j,type:"text",placeholder:g,value:h,onChange:v,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[14]=h,e[15]=g,e[16]=y):y=e[16];let C;e[17]!==i||e[18]!==x||e[19]!==b||e[20]!==I||e[21]!==d?(C=b.length>0&&s.jsxs(Lt,{value:i??"",onValueChange:x,children:[s.jsxs(At,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:ni,children:[s.jsx(Tt,{placeholder:d("chat.decopilot.key"),children:(()=>{const T=b.find(Y=>Y.id===i),B=T?I[T.providerId]:void 0,W=be(T?.presetId),q=W?.logo??B?.logo,$=W?.name??B?.name??T?.providerId??"Key";return s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[q?s.jsx("img",{src:q,alt:$,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:$.slice(0,1).toUpperCase()}),s.jsx("span",{className:"text-xs truncate",children:$})]})})()}),s.jsx(Bt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),s.jsx(zt,{children:b.map(T=>{const B=I[T.providerId],W=be(T.presetId),q=W?.logo??B?.logo,$=W?.name??B?.name??T.providerId;return s.jsx(Rt,{value:T.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[q?s.jsx("img",{src:q,alt:$,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:$.slice(0,1).toUpperCase()}),s.jsxs("span",{children:[$," — ",T.label]})]})},T.id)})})]}),e[17]=i,e[18]=x,e[19]=b,e[20]=I,e[21]=d,e[22]=C):C=e[22];let L;e[23]!==y||e[24]!==C?(L=s.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text",children:[M,y,C]})}),e[23]=y,e[24]=C,e[25]=L):L=e[25];let A;e[26]!==i?(A=T=>{const{error:B,resetError:W}=T;return s.jsx(qs,{error:B,onRetry:W,credentialId:i??void 0})},e[26]=i,e[27]=A):A=e[27];let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Gs,{}),e[28]=O):O=e[28];const R=i??void 0;let F;e[29]===Symbol.for("react.memo_cache_sentinel")?(F=()=>p(li),e[29]=F):F=e[29];let D;e[30]!==a||e[31]!==w||e[32]!==m||e[33]!==h||e[34]!==R?(D=s.jsx(U.Suspense,{fallback:O,children:s.jsx(ei,{keyId:R,searchTerm:h,onHover:c,onModelSelect:w,managing:m,onToggleManage:F,filterModels:a})}),e[30]=a,e[31]=w,e[32]=m,e[33]=h,e[34]=R,e[35]=D):D=e[35];let z;e[36]!==i||e[37]!==A||e[38]!==D?(z=s.jsx(yt,{fallback:A,children:D},i),e[36]=i,e[37]=A,e[38]=D,e[39]=z):z=e[39];let K;e[40]!==m||e[41]!==P||e[42]!==E||e[43]!==d?(K=!m&&s.jsxs("div",{className:"border-t border-border flex",children:[s.jsxs("button",{type:"button",onClick:()=>U.startTransition(()=>p(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Dt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageModels")]}),s.jsx("div",{className:"w-px bg-border shrink-0"}),s.jsxs("button",{type:"button",onClick:()=>P({to:"/$org/settings/ai-providers",params:{org:E.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[s.jsx(Wt,{className:"size-3.5 shrink-0"}),d("chat.decopilot.manageApiKeys")]})]}),e[40]=m,e[41]=P,e[42]=E,e[43]=d,e[44]=K):K=e[44];let V;e[45]!==z||e[46]!==K||e[47]!==L?(V=s.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[L,z,K]}),e[45]=z,e[46]=K,e[47]=L,e[48]=V):V=e[48];const J=u??o??null;let G;e[49]!==J?(G=s.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:s.jsx(Ts,{model:J})}),e[49]=J,e[50]=G):G=e[50];let X;return e[51]!==V||e[52]!==G?(X=s.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[V,G]}),e[51]=V,e[52]=G,e[53]=X):X=e[53],X}function li(l){return!l}function ni(l){return l.stopPropagation()}function oi(l){return[l.id,l]}function ri(l){const e=H.c(12),{onClose:t}=l,{credentialId:i,setCredentialId:n,selectedModel:o,setModel:r}=_e();let a;e[0]!==n?(a=c=>{ie("chat_credential_changed",{credential_id:c}),n(c)},e[0]=n,e[1]=a):a=e[1];let d;e[2]!==i||e[3]!==o?.modelId||e[4]!==r?(d=c=>{i&&(ie("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:c.modelId,to_model_provider:c.providerId??null,credential_id:i}),r({...c,keyId:i}))},e[2]=i,e[3]=o?.modelId,e[4]=r,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==t||e[8]!==o||e[9]!==a||e[10]!==d?(u=s.jsx(mt,{onClose:t,credentialId:i,onCredentialChange:a,selectedModel:o,onModelChange:d}),e[6]=i,e[7]=t,e[8]=o,e[9]=a,e[10]=d,e[11]=u):u=e[11],u}function ai(l){const e=H.c(2),{onClose:t}=l;let i;return e[0]!==t?(i=s.jsx(ri,{onClose:t}),e[0]=t,e[1]=i):i=e[1],i}function ci(l){const e=H.c(2);let t;return e[0]!==l?(t=s.jsx(mt,{...l}),e[0]=l,e[1]=t):t=e[1],t}const di=[{tier:"fast",labelKey:"chat.desktopCli.tierFastDescription"},{tier:"smart",labelKey:"chat.desktopCli.tierSmartDescription"},{tier:"thinking",labelKey:"chat.desktopCli.tierThinkingDescription"}];function ht(l){const e=H.c(11),{modelSet:t,selectedModelId:i,onSelect:n}=l,o=se();let r,a;if(e[0]!==t.logo||e[1]!==t.models||e[2]!==t.tiers||e[3]!==n||e[4]!==i||e[5]!==o){const u=Object.fromEntries(t.models.map(ui));r="flex flex-col p-2 w-[320px]",a=di.map(c=>{const{tier:h,labelKey:f}=c,m=t.tiers[h];if(!m.modelId)return null;const p=u[m.modelId];if(!p)return null;const j=i===m.modelId;return s.jsxs("button",{type:"button",onClick:()=>n(p),className:pe("flex items-center gap-3 px-3 py-2.5 rounded-lg text-left hover:bg-accent",j&&"bg-accent/50"),children:[s.jsx("img",{src:t.logo,alt:m.label,className:"size-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),s.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[s.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:m.label}),s.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:o(f)})]})]},h)}),e[0]=t.logo,e[1]=t.models,e[2]=t.tiers,e[3]=n,e[4]=i,e[5]=o,e[6]=r,e[7]=a}else r=e[6],a=e[7];let d;return e[8]!==r||e[9]!==a?(d=s.jsx("div",{className:r,children:a}),e[8]=r,e[9]=a,e[10]=d):d=e[10],d}function ui(l){return[l.modelId,l]}const mi=[{providerId:"claude-code",modelId:"claude-code:haiku",title:"Claude Code Haiku",description:"Fast and lightweight",capabilities:["text"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:sonnet",title:"Claude Code Sonnet 5",description:"Balanced performance",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus",title:"Claude Code Opus",description:"Most capable",capabilities:["text","reasoning"],limits:null,costs:null},{providerId:"claude-code",modelId:"claude-code:opus-1m",title:"Claude Code Opus 4.8 1M",description:"Most capable, 1M context window",capabilities:["text","reasoning"],limits:{contextWindow:1e6,maxOutputTokens:null},costs:null}],je="https://assets.decocache.com/decocms/6ac44f1c-c0cf-4480-84b5-2ae6fe742d0b/codex-app.png.png",hi=[{providerId:"codex",modelId:"codex:gpt-5.6-sol",title:"GPT-5.6 Sol",description:"Frontier Codex model for deep reasoning, complex coding, and real-world work",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-terra",title:"GPT-5.6 Terra",description:"Balanced Codex model for everyday coding and agent work",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.6-luna",title:"GPT-5.6 Luna",description:"Fast Codex model for lightweight coding tasks and titles",capabilities:["text","reasoning"],logo:je,limits:null,costs:null},{providerId:"codex",modelId:"codex:gpt-5.3-codex-spark",title:"GPT-5.3 Codex Spark",description:"Ultra-fast coding model",capabilities:["text","reasoning"],logo:je,limits:null,costs:null}],fi="https://decoims.com/decocms/93e4059c-e598-412b-87eb-54d72a946ec8/claude-stroke-rounded.svg",pi="https://decoims.com/decocms/9170ffd4-b9cc-4661-ad8f-ae2eea019e00/codex.svg";function xi(l){return{fast:{modelId:"claude-code:haiku",label:l("chat.agentModels.haikuLabel"),description:l("chat.agentModels.quickerResponses"),iconNode:s.jsx(Se,{size:16})},smart:{modelId:"claude-code:sonnet",label:l("chat.agentModels.sonnetLabel"),description:l("chat.agentModels.balancedQuality"),iconNode:s.jsx(Se,{size:16})},thinking:{modelId:"claude-code:opus-1m",label:l("chat.agentModels.opusLabel"),description:l("chat.agentModels.deeperReasoning"),iconNode:s.jsx(Se,{size:16})}}}function gi(l){return{fast:{modelId:"codex:gpt-5.6-luna",label:l("chat.agentModels.gptLunaLabel"),description:l("chat.agentModels.quickerResponses"),iconNode:s.jsx(Ne,{size:16})},smart:{modelId:"codex:gpt-5.6-terra",label:l("chat.agentModels.gptTerraLabel"),description:l("chat.agentModels.balancedQuality"),iconNode:s.jsx(Ne,{size:16})},thinking:{modelId:"codex:gpt-5.6-sol",label:l("chat.agentModels.gptSolLabel"),description:l("chat.agentModels.deeperReasoning"),iconNode:s.jsx(Ne,{size:16})}}}function ft(l,e){return l==="claude-code"?{logo:fi,tiers:xi(e),models:mi}:l==="codex"?{logo:pi,tiers:gi(e),models:hi}:null}function vi(l){const e=H.c(12),{onClose:t,agent:i}=l,n=se(),o=_e(),r=i??o.pendingHarnessId??"decopilot";let a;e[0]!==r||e[1]!==n?(a=ft(r,n),e[0]=r,e[1]=n,e[2]=a):a=e[2];const d=a;if(!d){let f;return e[3]!==t?(f=s.jsx(ai,{onClose:t}),e[3]=t,e[4]=f):f=e[4],f}const u=o.selectedModel?.modelId??d.tiers[o.simpleModeTier].modelId;let c;e[5]!==t||e[6]!==o?(c=f=>{o.setModel({...f,keyId:void 0}),t()},e[5]=t,e[6]=o,e[7]=c):c=e[7];let h;return e[8]!==d||e[9]!==u||e[10]!==c?(h=s.jsx(ht,{modelSet:d,selectedModelId:u,onSelect:c}),e[8]=d,e[9]=u,e[10]=c,e[11]=h):h=e[11],h}function bi(l){const e=H.c(14);let t,i;e[0]!==l?({agent:t,...i}=l,e[0]=l,e[1]=t,e[2]=i):(t=e[1],i=e[2]);const n=se();let o;e[3]!==t||e[4]!==n?(o=t?ft(t,n):null,e[3]=t,e[4]=n,e[5]=o):o=e[5];const r=o;if(!r){let c;return e[6]!==i?(c=s.jsx(ci,{...i}),e[6]=i,e[7]=c):c=e[7],c}const a=i.selectedModel?.modelId??r.tiers.smart.modelId;let d;e[8]!==i?(d=c=>{i.onModelChange(c),i.onClose()},e[8]=i,e[9]=d):d=e[9];let u;return e[10]!==r||e[11]!==a||e[12]!==d?(u=s.jsx(ht,{modelSet:r,selectedModelId:a,onSelect:d}),e[10]=r,e[11]=a,e[12]=d,e[13]=u):u=e[13],u}function Qi(l){const e=H.c(49),{variant:t,className:i,placeholder:n,model:o,isLoading:r,credentialId:a,onCredentialChange:d,onModelChange:u,filterModels:c,agent:h}=l,f=t===void 0?"borderless":t,m=n===void 0?"Select model":n,p=se(),[j,k]=U.useState(!1),b=u!==void 0,S=Mt(),I=f==="borderless"?"ghost":"outline",P=f==="borderless"&&"md:border-none";let E;e[0]!==i||e[1]!==P?(E=pe("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",P,i),e[0]=i,e[1]=P,e[2]=E):E=e[2];let _;e[3]!==r||e[4]!==o||e[5]!==m||e[6]!==b?(_=b?s.jsx(rt,{model:o??null,placeholder:m,isLoading:r}):s.jsx(ji,{placeholder:m}),e[3]=r,e[4]=o,e[5]=m,e[6]=b,e[7]=_):_=e[7];let x;e[8]!==I||e[9]!==E||e[10]!==_?(x=s.jsx(ne,{variant:I,size:"sm",className:E,children:_}),e[8]=I,e[9]=E,e[10]=_,e[11]=x):x=e[11];const N=x;let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(si,{}),e[12]=w):w=e[12];let M;e[13]!==h||e[14]!==a||e[15]!==c||e[16]!==o||e[17]!==d||e[18]!==u||e[19]!==b?(M=s.jsx(U.Suspense,{fallback:w,children:b?s.jsx(bi,{onClose:()=>k(!1),agent:h,credentialId:a??null,onCredentialChange:d??yi,selectedModel:o??null,onModelChange:u,filterModels:c}):s.jsx(vi,{onClose:()=>k(!1),agent:h})}),e[13]=h,e[14]=a,e[15]=c,e[16]=o,e[17]=d,e[18]=u,e[19]=b,e[20]=M):M=e[20];const g=M;if(S){let O;e[21]!==N?(O=s.jsx(Ct,{asChild:!0,children:N}),e[21]=N,e[22]=O):O=e[22];let R;e[23]!==p?(R=p("chat.selectModel.selectModel"),e[23]=p,e[24]=R):R=e[24];let F;e[25]!==R?(F=s.jsx(wt,{className:"sr-only",children:R}),e[25]=R,e[26]=F):F=e[26];let D;e[27]!==g?(D=s.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:g}),e[27]=g,e[28]=D):D=e[28];let z;e[29]!==F||e[30]!==D?(z=s.jsxs(It,{className:"p-0 flex flex-col max-h-[95vh]",children:[F,D]}),e[29]=F,e[30]=D,e[31]=z):z=e[31];let K;return e[32]!==j||e[33]!==O||e[34]!==z?(K=s.jsxs(_t,{open:j,onOpenChange:k,children:[O,z]}),e[32]=j,e[33]=O,e[34]=z,e[35]=K):K=e[35],K}let v;e[36]!==N?(v=s.jsx(kt,{asChild:!0,children:N}),e[36]=N,e[37]=v):v=e[37];let y;e[38]!==p?(y=p("chat.selectModel.selectModel"),e[38]=p,e[39]=y):y=e[39];let C;e[40]!==y?(C=s.jsx(Je,{className:"sr-only",children:y}),e[40]=y,e[41]=C):C=e[41];let L;e[42]!==g||e[43]!==C?(L=s.jsxs(Qe,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[C,g]}),e[42]=g,e[43]=C,e[44]=L):L=e[44];let A;return e[45]!==j||e[46]!==v||e[47]!==L?(A=s.jsxs(Ye,{open:j,onOpenChange:k,children:[v,L]}),e[45]=j,e[46]=v,e[47]=L,e[48]=A):A=e[48],A}function yi(){}function ji(l){const e=H.c(4),{placeholder:t}=l,{selectedModel:i,isModelsLoading:n}=_e();let o;return e[0]!==n||e[1]!==i||e[2]!==t?(o=s.jsx(rt,{model:i,placeholder:t,isLoading:n}),e[0]=n,e[1]=i,e[2]=t,e[3]=o):o=e[3],o}export{Ns as C,Qi as M,Is as N,ot as P,Xi as a,be as b,Yi as g,Gi as i,Pe as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,aU as nt,aS as Pe,j as d,cU as rt,aW as be,aT as k,cV as st,aP as j,aV as N,bI as $,cW as lt,au as _e,cX as Ee,aQ as at,bG as ct,bK as it,d1 as dt,d2 as ut,d3 as pt,d4 as ft,cY as mt,aR as ht,d5 as vt,cZ as gt,c$ as xt,c as ee,m as oe}from"./index-DTSNAVPl.js";import{V as St}from"./tooltip-B7vNT4Wn.js";import{i as wt}from"./Check-D2tgQYUH.js";import{t as Re}from"./ChevronDown-fdV9phBI.js";import{n as Ct}from"./ChevronUp-Cp7VgDYd.js";function Ne(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],Q="Select",[de,ue,bt]=at(Q),[ne]=ht(Q,[bt,Ee]),pe=Ee(),[Tt,G]=ne(Q),[Pt,Nt]=ne(Q),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[U,M]=i.useState(!1),re=nt(u),[_,O]=Pe({prop:o,defaultProp:n??!1,onChange:c,caller:Q}),[W,q]=Pe({prop:s,defaultProp:l,onChange:a,caller:Q}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[F,V]=i.useState(new Set),H=Array.from(F).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:U,onValueNodeHasChildrenChange:M,contentId:be(),value:W,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Pt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Je,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:W,onChange:E=>q(E.target.value),disabled:b,form:S,children:[W===void 0?d.jsx("option",{value:""}):null,Array.from(F)]},H):null]})})};je.displayName=Q;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:N(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:N(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:N(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var _t="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var J="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(J,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?_e.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=J;var A=10,[Ve,Y]=ne(J),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(J,t),[x,U]=i.useState(null),[M,re]=i.useState(null),_=k(e,f=>U(f)),[O,W]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[F,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(P=>P.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const P of f)if(P===I||(P?.scrollIntoView({block:"nearest"}),P===T&&M&&(M.scrollTop=0),P===y&&M&&(M.scrollTop=M.scrollHeight),P?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{F&&D()},[F,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(W(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:F,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:N(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:N(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,P=y.indexOf(I);y=y.slice(P+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(J,t),s=Y(J,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,_=>h(_)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const _=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),W=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,P=W.left-I,X=_.left-P,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Ne(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,P=window.innerWidth-W.right-I,X=window.innerWidth-_.right-P,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Ne(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,F=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+F+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const P=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,se+(I?he:0)+P+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[U,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:U},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(J,{}),we="SelectViewport",Ue=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:N(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var We="SelectGroup",[Dt,kt]=ne(We),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=We;var Fe="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(Fe,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=Fe;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:N(s.onFocus,()=>w(!0)),onBlur:N(s.onBlur,()=>w(!1)),onClick:N(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:N(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:N(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:N(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:N(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Nt(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Xe=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Xe.displayName=Ce;var ye="SelectScrollDownButton",Ze=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=ye;var Qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:N(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:N(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:N(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ut=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ut.displayName=Ie;var Wt="SelectBubbleInput",Je=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Je.displayName=Wt;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Ft(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Ft(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Xt=Be,Zt=Ue,Qt=$e,Jt=Ge,eo=qe,to=Xe,oo=Ze;function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Zt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Xt,{"data-slot":"select-content",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Jt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Qt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Ne as e};
|
|
1
|
+
import{r as i,aU as nt,aS as Pe,j as d,cU as rt,aW as be,aT as k,cV as st,aP as j,aV as N,bI as $,cW as lt,au as _e,cX as Ee,aQ as at,bG as ct,bK as it,d1 as dt,d2 as ut,d3 as pt,d4 as ft,cY as mt,aR as ht,d5 as vt,cZ as gt,c$ as xt,c as ee,m as oe}from"./index-BWC7sFp_.js";import{V as St}from"./tooltip-BmutXqWI.js";import{i as wt}from"./Check-CymDPtaz.js";import{t as Re}from"./ChevronDown-B6-w9q8W.js";import{n as Ct}from"./ChevronUp-C_eomkpm.js";function Ne(r,[e,t]){return Math.min(t,Math.max(e,r))}var yt=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],Q="Select",[de,ue,bt]=at(Q),[ne]=ht(Q,[bt,Ee]),pe=Ee(),[Tt,G]=ne(Q),[Pt,Nt]=ne(Q),je=r=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:n,onOpenChange:c,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:b,required:w,form:S}=r,p=pe(e),[v,C]=i.useState(null),[m,x]=i.useState(null),[U,M]=i.useState(!1),re=nt(u),[_,O]=Pe({prop:o,defaultProp:n??!1,onChange:c,caller:Q}),[W,q]=Pe({prop:s,defaultProp:l,onChange:a,caller:Q}),L=i.useRef(null),B=v?S||!!v.closest("form"):!0,[F,V]=i.useState(new Set),H=Array.from(F).map(E=>E.props.value).join(";");return d.jsx(rt,{...p,children:d.jsxs(Tt,{required:w,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:U,onValueNodeHasChildrenChange:M,contentId:be(),value:W,onValueChange:q,open:_,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:b,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(Pt,{scope:r.__scopeSelect,onNativeOptionAdd:i.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:i.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Je,{"aria-hidden":!0,required:w,tabIndex:-1,name:h,autoComplete:g,value:W,onChange:E=>q(E.target.value),disabled:b,form:S,children:[W===void 0?d.jsx("option",{value:""}):null,Array.from(F)]},H):null]})})};je.displayName=Q;var Me="SelectTrigger",Ae=i.forwardRef((r,e)=>{const{__scopeSelect:t,disabled:o=!1,...n}=r,c=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=i.useRef("touch"),[g,b,w]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),w()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(st,{asChild:!0,...c,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...n,ref:a,onClick:N(n.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:N(n.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:N(n.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&b(p.key),!(v&&p.key===" ")&&yt.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,children:c,placeholder:s="",...l}=r,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=c!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):c})});De.displayName=Oe;var _t="SelectIcon",ke=i.forwardRef((r,e)=>{const{__scopeSelect:t,children:o,...n}=r;return d.jsx(j.span,{"aria-hidden":!0,...n,ref:e,children:o||"▼"})});ke.displayName=_t;var Et="SelectPortal",Le=r=>d.jsx(lt,{asChild:!0,...r});Le.displayName=Et;var J="SelectContent",Be=i.forwardRef((r,e)=>{const t=G(J,r.__scopeSelect),[o,n]=i.useState();if($(()=>{n(new DocumentFragment)},[]),!t.open){const c=o;return c?_e.createPortal(d.jsx(Ve,{scope:r.__scopeSelect,children:d.jsx(de.Slot,{scope:r.__scopeSelect,children:d.jsx("div",{children:r.children})})}),c):null}return d.jsx(He,{...r,ref:e})});Be.displayName=J;var A=10,[Ve,Y]=ne(J),Rt="SelectContentImpl",jt=vt("SelectContent.RemoveScroll"),He=i.forwardRef((r,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:c,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=r,m=G(J,t),[x,U]=i.useState(null),[M,re]=i.useState(null),_=k(e,f=>U(f)),[O,W]=i.useState(null),[q,L]=i.useState(null),B=ue(t),[F,V]=i.useState(!1),H=i.useRef(!1);i.useEffect(()=>{if(x)return dt(x)},[x]),ut();const E=i.useCallback(f=>{const[T,...R]=B().map(P=>P.ref.current),[y]=R.slice(-1),I=document.activeElement;for(const P of f)if(P===I||(P?.scrollIntoView({block:"nearest"}),P===T&&M&&(M.scrollTop=0),P===y&&M&&(M.scrollTop=M.scrollHeight),P?.focus(),document.activeElement!==I))return},[B,M]),D=i.useCallback(()=>E([O,x]),[E,O,x]);i.useEffect(()=>{F&&D()},[F,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;i.useEffect(()=>{if(x){let f={x:0,y:0};const T=y=>{f={x:Math.abs(Math.round(y.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(y.pageY)-(K.current?.y??0))}},R=y=>{f.x<=10&&f.y<=10?y.preventDefault():x.contains(y.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),i.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(I=>!I.disabled),R=T.find(I=>I.ref.current===document.activeElement),y=ot(T,f,R);y&&setTimeout(()=>y.ref.current.focus())}),me=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&(W(f),y&&(H.current=!0))},[m.value]),he=i.useCallback(()=>x?.focus(),[x]),te=i.useCallback((f,T,R)=>{const y=!H.current&&!R;(m.value!==void 0&&m.value===T||y)&&L(f)},[m.value]),ce=o==="popper"?Se:ze,se=ce===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:b,collisionPadding:w,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:F,searchRef:fe,children:d.jsx(pt,{as:jt,allowPinchZoom:!0,children:d.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:N(n,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:N(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let y=B().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(f.key)&&(y=y.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const I=f.target,P=y.indexOf(I);y=y.slice(P+1)}setTimeout(()=>E(y)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=i.forwardRef((r,e)=>{const{__scopeSelect:t,onPlaced:o,...n}=r,c=G(J,t),s=Y(J,t),[l,a]=i.useState(null),[u,h]=i.useState(null),g=k(e,_=>h(_)),b=ue(t),w=i.useRef(!1),S=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=i.useCallback(()=>{if(c.trigger&&c.valueNode&&l&&u&&p&&v&&C){const _=c.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),W=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const I=q.left-O.left,P=W.left-I,X=_.left-P,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Ne(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const I=O.right-q.right,P=window.innerWidth-W.right-I,X=window.innerWidth-_.right-P,Z=_.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Ne(P,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=b(),B=window.innerHeight-A*2,F=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+F+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=_.top+_.height/2-A,ce=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const I=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const P=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ce,se+(I?he:0)+P+D),Z=T+X;l.style.height=Z+"px"}else{const I=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(I?me:0)+se)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[b,c.trigger,c.valueNode,l,u,p,v,C,c.dir,o]);$(()=>x(),[x]);const[U,M]=i.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=i.useCallback(_=>{_&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:U},children:d.jsx(j.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=i.forwardRef((r,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:n=A,...c}=r,s=pe(t);return d.jsx(gt,{...s,...c,ref:e,align:o,collisionPadding:n,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(J,{}),we="SelectViewport",Ue=i.forwardRef((r,e)=>{const{__scopeSelect:t,nonce:o,...n}=r,c=Y(we,t),s=Te(we,t),l=k(e,c.onViewportChange),a=i.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:N(n.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=s;if(b?.current&&g){const w=Math.abs(a.current-h.scrollTop);if(w>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+w,x=Math.min(S,m),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var We="SelectGroup",[Dt,kt]=ne(We),Lt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=be();return d.jsx(Dt,{scope:t,id:n,children:d.jsx(j.div,{role:"group","aria-labelledby":n,...o,ref:e})})});Lt.displayName=We;var Fe="SelectLabel",Bt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=kt(Fe,t);return d.jsx(j.div,{id:n.id,...o,ref:e})});Bt.displayName=Fe;var ie="SelectItem",[Vt,Ke]=ne(ie),$e=i.forwardRef((r,e)=>{const{__scopeSelect:t,value:o,disabled:n=!1,textValue:c,...s}=r,l=G(ie,t),a=Y(ie,t),u=l.value===o,[h,g]=i.useState(c??""),[b,w]=i.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,n)),p=be(),v=i.useRef("touch"),C=()=>{n||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:n,textId:p,isSelected:u,onItemTextChange:i.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:n,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":b?"":void 0,"aria-selected":u&&b,"data-state":u?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...s,ref:S,onFocus:N(s.onFocus,()=>w(!0)),onBlur:N(s.onBlur,()=>w(!1)),onClick:N(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:N(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:N(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:N(s.onPointerMove,m=>{v.current=m.pointerType,n?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:N(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var le="SelectItemText",Ge=i.forwardRef((r,e)=>{const{__scopeSelect:t,className:o,style:n,...c}=r,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Nt(le,t),[h,g]=i.useState(null),b=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),w=h?.textContent,S=i.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:w},a.value),[a.disabled,a.value,w]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...c,ref:b}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?_e.createPortal(c.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var Ce="SelectScrollUpButton",Xe=i.forwardRef((r,e)=>{const t=Y(Ce,r.__scopeSelect),o=Te(Ce,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;c(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Xe.displayName=Ce;var ye="SelectScrollDownButton",Ze=i.forwardRef((r,e)=>{const t=Y(ye,r.__scopeSelect),o=Te(ye,r.__scopeSelect),[n,c]=i.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;c(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),n?d.jsx(Qe,{...r,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=ye;var Qe=i.forwardRef((r,e)=>{const{__scopeSelect:t,onAutoScroll:o,...n}=r,c=Y("SelectScrollButton",t),s=i.useRef(null),l=ue(t),a=i.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return i.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...n,ref:e,style:{flexShrink:0,...n.style},onPointerDown:N(n.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:N(n.onPointerMove,()=>{c.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:N(n.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ut=i.forwardRef((r,e)=>{const{__scopeSelect:t,...o}=r,n=pe(t),c=G(Ie,t),s=Y(Ie,t);return c.open&&s.position==="popper"?d.jsx(xt,{...n,...o,ref:e}):null});Ut.displayName=Ie;var Wt="SelectBubbleInput",Je=i.forwardRef(({__scopeSelect:r,value:e,...t},o)=>{const n=i.useRef(null),c=k(o,n),s=ct(e);return i.useEffect(()=>{const l=n.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...St,...t.style},ref:c,defaultValue:e})});Je.displayName=Wt;function et(r){return r===""||r===void 0}function tt(r){const e=it(r),t=i.useRef(""),o=i.useRef(0),n=i.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),c=i.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,n,c]}function ot(r,e,t){const n=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,c=t?r.indexOf(t):-1;let s=Ft(r,Math.max(c,0));n.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(n.toLowerCase()));return a!==t?a:void 0}function Ft(r,e){return r.map((t,o)=>r[(e+o)%r.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Xt=Be,Zt=Ue,Qt=$e,Jt=Ge,eo=qe,to=Xe,oo=Ze;function uo(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(r){const e=ee.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function fo(r){const e=ee.c(13);let t,o,n,c;e[0]!==r?({className:o,size:c,children:t,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?"default":c;let l;e[5]!==o?(l=oe("data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg bg-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=xs]:h-6 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==n||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...n,children:[t,a]}),e[8]=t,e[9]=n,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function mo(r){const e=ee.c(25);let t,o,n,c,s;e[0]!==r?({className:o,children:t,position:c,hideScrollButtons:s,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c,e[5]=s):(t=e[1],o=e[2],n=e[3],c=e[4],s=e[5]);const l=c===void 0?"popper":c,a=s===void 0?!1:s,u=l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let h;e[6]!==o||e[7]!==u?(h=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",u,o),e[6]=o,e[7]=u,e[8]=h):h=e[8];let g;e[9]!==a?(g=!a&&d.jsx(no,{}),e[9]=a,e[10]=g):g=e[10];const b=l==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let w;e[11]!==b?(w=oe("p-1",b),e[11]=b,e[12]=w):w=e[12];let S;e[13]!==t||e[14]!==w?(S=d.jsx(Zt,{className:w,children:t}),e[13]=t,e[14]=w,e[15]=S):S=e[15];let p;e[16]!==a?(p=!a&&d.jsx(ro,{}),e[16]=a,e[17]=p):p=e[17];let v;return e[18]!==l||e[19]!==n||e[20]!==h||e[21]!==g||e[22]!==S||e[23]!==p?(v=d.jsx(qt,{children:d.jsxs(Xt,{"data-slot":"select-content",className:h,position:l,...n,children:[g,S,p]})}),e[18]=l,e[19]=n,e[20]=h,e[21]=g,e[22]=S,e[23]=p,e[24]=v):v=e[24],v}function ho(r){const e=ee.c(16);let t,o,n,c;e[0]!==r?({className:o,children:t,hideCheck:c,...n}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=n,e[4]=c):(t=e[1],o=e[2],n=e[3],c=e[4]);const s=c===void 0?!1:c;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(wt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Jt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Qt,{"data-slot":"select-item",className:l,...n,children:[a,u]}),e[11]=n,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Ct,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}function ro(r){const e=ee.c(9);let t,o;e[0]!==r?({className:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let n;e[3]!==t?(n=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=n):n=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(Re,{className:"size-4"}),e[5]=c):c=e[5];let s;return e[6]!==o||e[7]!==n?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:n,...o,children:c}),e[6]=o,e[7]=n,e[8]=s):s=e[8],s}export{uo as S,fo as a,po as b,mo as c,ho as d,Ne as e};
|