decocms 4.524.1 → 4.524.3

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.
Files changed (405) hide show
  1. package/dist/client/assets/{ActiveShapeUtils-Bp4fmUBo.js → ActiveShapeUtils-CZUL4aQf.js} +1 -1
  2. package/dist/client/assets/{AlertCircle-Bq5T03B8.js → AlertCircle-CHPvy_VM.js} +1 -1
  3. package/dist/client/assets/{AreaChart-CCyND0Jp.js → AreaChart-DXZAxruT.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-Bwi_Jr7f.js → ArrowLeft-D_5CBumM.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-CzX0fTk7.js → ArrowUp-DhHGL7HY.js} +1 -1
  6. package/dist/client/assets/{BarChart-wLDzzyOQ.js → BarChart-D1RHjiDU.js} +1 -1
  7. package/dist/client/assets/{Building02-A_MT9tNO.js → Building02-Cs-fRF4C.js} +1 -1
  8. package/dist/client/assets/{CartesianChart-B0qX_dpC.js → CartesianChart-B6XqwP69.js} +1 -1
  9. package/dist/client/assets/{CategoricalChart-BDZ_2Tmn.js → CategoricalChart-CiyWbCkx.js} +1 -1
  10. package/dist/client/assets/{CheckCircle-BE1i_X4b.js → CheckCircle-DFdmK-T2.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-DNrt0MHW.js → ChevronSelectorVertical-B7yaofOD.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-RlBkcpdd.js → ChevronUp-PedQ2gd6.js} +1 -1
  13. package/dist/client/assets/{Copy01-B9x501ud.js → Copy01-B6cJ_ygs.js} +1 -1
  14. package/dist/client/assets/{CreditCard01-Bu_qRR36.js → CreditCard01-bH_MgXhH.js} +1 -1
  15. package/dist/client/assets/{DotsVertical-D9231JAc.js → DotsVertical-B50qkKfK.js} +1 -1
  16. package/dist/client/assets/{ErrorBarContext-PGp8cmoe.js → ErrorBarContext-D3MOF1QH.js} +1 -1
  17. package/dist/client/assets/{Globe04-DQlP6Nhr.js → Globe04-BvSQLcQH.js} +1 -1
  18. package/dist/client/assets/{Image01-ClayPF_a.js → Image01-D6z5fxVv.js} +1 -1
  19. package/dist/client/assets/{Key01-CxKYO-oQ.js → Key01-DIVY2Gpo.js} +1 -1
  20. package/dist/client/assets/{Link01-B7BHRxIW.js → Link01-D806UI0V.js} +1 -1
  21. package/dist/client/assets/{LinkBroken01-XqJUgSE7.js → LinkBroken01-Be879sLY.js} +1 -1
  22. package/dist/client/assets/{Minus-Bh6ogRng.js → Minus-DVOE0qZc.js} +1 -1
  23. package/dist/client/assets/{Monitor01-BpzvJnXA.js → Monitor01-CP0zz7rW.js} +1 -1
  24. package/dist/client/assets/{Play-w4omVTRa.js → Play-DG-gbp_U.js} +1 -1
  25. package/dist/client/assets/{Plus-CcJNnBya.js → Plus-feGO5xhL.js} +1 -1
  26. package/dist/client/assets/{ReferenceLine-CI6ZmeJ0.js → ReferenceLine-oNnV1mWS.js} +1 -1
  27. package/dist/client/assets/{SearchMd-5lGv5a5H.js → SearchMd-OqihyBBE.js} +1 -1
  28. package/dist/client/assets/{Sector-gkUUnvA4.js → Sector-BH34m5G1.js} +1 -1
  29. package/dist/client/assets/{ShoppingBag01-C82UeRR9.js → ShoppingBag01-ZgB-qLs9.js} +1 -1
  30. package/dist/client/assets/{Sun-IvvKZ51n.js → Sun-DQ0xzUJx.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-B1MoYKPo.js → SwitchHorizontal01-Dsf5zpNu.js} +1 -1
  32. package/dist/client/assets/{Tool01-BvlRH5Ln.js → Tool01-PlDxztWD.js} +1 -1
  33. package/dist/client/assets/{Trash01-C9E8l_mI.js → Trash01-BqnutNRJ.js} +1 -1
  34. package/dist/client/assets/{Upload01-mlw10ZK-.js → Upload01-CyyevXMg.js} +1 -1
  35. package/dist/client/assets/{UserSquare-DwNuAluZ.js → UserSquare-Csbu2VpZ.js} +1 -1
  36. package/dist/client/assets/{Users01-DcHPIKgH.js → Users01-BSztUOd5.js} +1 -1
  37. package/dist/client/assets/{XClose-BBReaSBA.js → XClose-CGLyFs-P.js} +1 -1
  38. package/dist/client/assets/{ZoomOut-CnbxUNSo.js → ZoomOut-DTBYck8o.js} +1 -1
  39. package/dist/client/assets/{access-gate-BNOWXoYR.js → access-gate-CQo9WEtv.js} +1 -1
  40. package/dist/client/assets/{add-connection-dialog-CEj8kbGq.js → add-connection-dialog-BXhPQM8W.js} +1 -1
  41. package/dist/client/assets/agent-analytics-C4isBTY7.js +1 -0
  42. package/dist/client/assets/agent-app-BakS5Mpg.js +1 -0
  43. package/dist/client/assets/{agent-assets-CppO2yKd.js → agent-assets-DPXKGmqE.js} +1 -1
  44. package/dist/client/assets/{agent-automation-BtSTyUKu.js → agent-automation-68EhX00q.js} +1 -1
  45. package/dist/client/assets/{agent-automations-Bf-0_57T.js → agent-automations-XvbfNN1P.js} +1 -1
  46. package/dist/client/assets/agent-calendar-rlwx6fiZ.js +1 -0
  47. package/dist/client/assets/{agent-connect-sources-C_0x6Udu.js → agent-connect-sources-D3zK6Sae.js} +1 -1
  48. package/dist/client/assets/agent-deck-uq6T-H5n.js +1 -0
  49. package/dist/client/assets/{agent-e2e-DokyQFgS.js → agent-e2e-DQcmFy3H.js} +1 -1
  50. package/dist/client/assets/agent-experiments-D3cQ-WP1.js +1 -0
  51. package/dist/client/assets/{agent-file-B5Z-mSXW.js → agent-file-JtT0MyWr.js} +1 -1
  52. package/dist/client/assets/{agent-hosting-v3_GHpmO.js → agent-hosting-BxPrxIfg.js} +1 -1
  53. package/dist/client/assets/{agent-icon-KvVT3fA8.js → agent-icon-CTGtlw1z.js} +1 -1
  54. package/dist/client/assets/agent-library-C3l8PEn-.js +1 -0
  55. package/dist/client/assets/agent-library-file-CjRMeR9i.js +1 -0
  56. package/dist/client/assets/agent-monitor-BfPm0PfR.js +1 -0
  57. package/dist/client/assets/{agent-overview-9FhsI0nk.js → agent-overview-B9lC95oC.js} +1 -1
  58. package/dist/client/assets/{agent-releases-CRh6y5DW.js → agent-releases-OHw-HILT.js} +1 -1
  59. package/dist/client/assets/agent-settings-C3PrzQdK.js +1 -0
  60. package/dist/client/assets/{agent-site-editor-BALtgla6.js → agent-site-editor-DL4MgFcw.js} +1 -1
  61. package/dist/client/assets/agent-site-editor-code-CrwcPx-x.js +2 -0
  62. package/dist/client/assets/agent-site-editor-content-DOS83K5A.js +1 -0
  63. package/dist/client/assets/agent-site-editor-preview-Cuy-72sw.js +1 -0
  64. package/dist/client/assets/agent-view-DIoRN3S4.js +1 -0
  65. package/dist/client/assets/{agent-view-guard-bPXLqLsK.js → agent-view-guard-BrroWBJx.js} +1 -1
  66. package/dist/client/assets/{agents-list-DrT_0gVh.js → agents-list-DIpYtUlJ.js} +1 -1
  67. package/dist/client/assets/{ai-providers-DorJXBZe.js → ai-providers-DJSUQnD1.js} +1 -1
  68. package/dist/client/assets/{alert-DEw5BVAh.js → alert-GbAkes7m.js} +1 -1
  69. package/dist/client/assets/{analytics-sections-g9foqwY5.js → analytics-sections-Bb2X2x1n.js} +1 -1
  70. package/dist/client/assets/{analytics-tab-D5KshkAH.js → analytics-tab-BmRbRV7j.js} +1 -1
  71. package/dist/client/assets/{api-keys-CIPiPSYY.js → api-keys-CUAWVknr.js} +1 -1
  72. package/dist/client/assets/api-keys-CYNApwkv.js +1 -0
  73. package/dist/client/assets/{app-editor-ChUXEXt-.js → app-editor-CyjHGv_R.js} +1 -1
  74. package/dist/client/assets/{asset-utils-DRJP317P.js → asset-utils-cXz86Lc9.js} +1 -1
  75. package/dist/client/assets/{auth-Dqt9menC.js → auth-Dfomi5JO.js} +1 -1
  76. package/dist/client/assets/{auth-catchall-B5Em8iaq.js → auth-catchall-CQPN8xxO.js} +1 -1
  77. package/dist/client/assets/{auth-entry-CNtzQsix.js → auth-entry-CopJeOJe.js} +1 -1
  78. package/dist/client/assets/{auth-split-layout-BoWG-no5.js → auth-split-layout-DlqDAzsj.js} +1 -1
  79. package/dist/client/assets/{authenticate-and-persist-oauth-BziZaG_M.js → authenticate-and-persist-oauth-CIjqyOtu.js} +1 -1
  80. package/dist/client/assets/{automation-list-row-BRtPLrxX.js → automation-list-row-DjtEQ2qE.js} +1 -1
  81. package/dist/client/assets/{automation-runs-C0-BhIZn.js → automation-runs-Fh82uxKP.js} +1 -1
  82. package/dist/client/assets/{automations-CXOQ5gKM.js → automations-v0vsa1w4.js} +1 -1
  83. package/dist/client/assets/{autosend-BRUzWk70.js → autosend-1kVbs2RQ.js} +1 -1
  84. package/dist/client/assets/{badge-Ckz5LqgP.js → badge-Cd6N93gT.js} +1 -1
  85. package/dist/client/assets/{block-document-BPaZQC5L.js → block-document-Eqc7jC1E.js} +1 -1
  86. package/dist/client/assets/blocks-preview-workspace-context-DmNovEJ2.js +1 -0
  87. package/dist/client/assets/{blocks-tab-states-BcxrQPOR.js → blocks-tab-states-EZ53-FeU.js} +1 -1
  88. package/dist/client/assets/{blog-schema-Du7ILh7Q.js → blog-schema-BIlyKinw.js} +1 -1
  89. package/dist/client/assets/{buckets-CKZYh6Ij.js → buckets-DeThgb1z.js} +1 -1
  90. package/dist/client/assets/{build-improve-prompt-doc-DJhZN8lj.js → build-improve-prompt-doc-BhOi567C.js} +1 -1
  91. package/dist/client/assets/{calendar-DkZz5VlH.js → calendar-CZnHQIdE.js} +1 -1
  92. package/dist/client/assets/{campaigns-view-Dc88Zs16.js → campaigns-view-keHuDNLa.js} +1 -1
  93. package/dist/client/assets/{capability-load-error-CRB9otZt.js → capability-load-error-BoUVRT1s.js} +1 -1
  94. package/dist/client/assets/{category-editor-CSPe0t_-.js → category-editor-CRQwImqd.js} +1 -1
  95. package/dist/client/assets/{cdn-tab-KPAxnC3T.js → cdn-tab-DGJOOmwS.js} +1 -1
  96. package/dist/client/assets/{chart-Bp6om7lj.js → chart-DIxDpRCA.js} +1 -1
  97. package/dist/client/assets/chat-context-2letHrEJ.js +39 -0
  98. package/dist/client/assets/{chat-draft-OR83_S8w.js → chat-draft-BamZUeXG.js} +1 -1
  99. package/dist/client/assets/{checkbox-BQ7Ebuar.js → checkbox-vkygLbK1.js} +1 -1
  100. package/dist/client/assets/{choose-editor-CspgtGFS.js → choose-editor-CvBlgOf7.js} +1 -1
  101. package/dist/client/assets/{cli-auth-success-CGyir_iF.js → cli-auth-success-DbYRVqF9.js} +1 -1
  102. package/dist/client/assets/{client-icons-BOMFh2QS.js → client-icons-Byj2LmW_.js} +1 -1
  103. package/dist/client/assets/cms-settings-editor-2-st_NGk.js +1 -0
  104. package/dist/client/assets/{collapsible-BB8_usPT.js → collapsible-DsyQMORE.js} +1 -1
  105. package/dist/client/assets/{collection-detail-H-UqYky8.js → collection-detail-DWStyXoZ.js} +1 -1
  106. package/dist/client/assets/{collection-display-button-CulG1s8m.js → collection-display-button-DxqDuoDs.js} +1 -1
  107. package/dist/client/assets/{collection-search-Cf4li4kg.js → collection-search-BT_p6pKF.js} +1 -1
  108. package/dist/client/assets/{collection-table-wrapper-DnZHa5Lt.js → collection-table-wrapper-Bu9UKC3v.js} +1 -1
  109. package/dist/client/assets/{collection-tabs-x8ccQUAC.js → collection-tabs-D6nWmqmK.js} +1 -1
  110. package/dist/client/assets/{column-rules-C_DWUbCh.js → column-rules-1_e0Bdla.js} +1 -1
  111. package/dist/client/assets/{combobox-BZoZToki.js → combobox-C05HI-BC.js} +1 -1
  112. package/dist/client/assets/{command-MmMDew8i.js → command-CPzIRDl7.js} +1 -1
  113. package/dist/client/assets/{companion-mcps-section-By8_AO07.js → companion-mcps-section-8bJuflHh.js} +1 -1
  114. package/dist/client/assets/{config-DBn3iCC3.js → config-g4_iXJef.js} +1 -1
  115. package/dist/client/assets/{connect-layout-9tsE00M7.js → connect-layout-B0kvJrgY.js} +1 -1
  116. package/dist/client/assets/{connect-source-dialog-DqWilbbC.js → connect-source-dialog-Drua8oaC.js} +1 -1
  117. package/dist/client/assets/{connect-DbK_vN0J.js → connect-uOeiI1CS.js} +1 -1
  118. package/dist/client/assets/{connection-QGwhnKZn.js → connection-BHsOzStk.js} +1 -1
  119. package/dist/client/assets/{connection-card-DEMVrMsW.js → connection-card-CYaVyCqL.js} +1 -1
  120. package/dist/client/assets/{connection-detail-4PyaBO0_.js → connection-detail-C6xJbNuX.js} +1 -1
  121. package/dist/client/assets/{connection-form-helpers-DCRY9s0M.js → connection-form-helpers-D-t8mb0f.js} +1 -1
  122. package/dist/client/assets/{connections-CpcdB3jc.js → connections-D-CMEpMd.js} +1 -1
  123. package/dist/client/assets/{content-tab-YME7HMCb.js → content-tab-BplT8Wwk.js} +3 -3
  124. package/dist/client/assets/{context-oSwYvz9P.js → context-TIPHj43k.js} +1 -1
  125. package/dist/client/assets/{context-menu-Cpvztbef.js → context-menu-7c-Y-PHB.js} +1 -1
  126. package/dist/client/assets/{context-shell-BVBpRdKB.js → context-shell-n8IEtxwr.js} +3 -3
  127. package/dist/client/assets/{core.esm-B2cbbV3O.js → core.esm-Bp5Q1Stg.js} +1 -1
  128. package/dist/client/assets/{create-organization-dialog-NLldLLor.js → create-organization-dialog-mPrO9oSa.js} +1 -1
  129. package/dist/client/assets/{daily-pulse-ClSeB_Ta.js → daily-pulse-C7I4Uxdj.js} +1 -1
  130. package/dist/client/assets/{discover-DmBynuR0.js → discover-7t1pJX8W.js} +1 -1
  131. package/dist/client/assets/{domain-settings-Cu3Pj63v.js → domain-settings-CXb5s0he.js} +1 -1
  132. package/dist/client/assets/{drawer-GssD8cb3.js → drawer-CtTfZzW7.js} +1 -1
  133. package/dist/client/assets/{editor-BTovmEAS.js → editor-BDmCsl05.js} +1 -1
  134. package/dist/client/assets/{editor-classes-CcPgajKG.js → editor-classes-BJAtiMt8.js} +1 -1
  135. package/dist/client/assets/{empty-state-DLNzdrwg.js → empty-state-BFtVVtPz.js} +1 -1
  136. package/dist/client/assets/{empty-state-D86P1Giw.js → empty-state-BpneGtoe.js} +1 -1
  137. package/dist/client/assets/{experiments-tab-CjpJzYQ9.js → experiments-tab-CLMcteix.js} +1 -1
  138. package/dist/client/assets/{experiments-tab-choice-pVOiMOWe.js → experiments-tab-choice-vFGVi3bn.js} +1 -1
  139. package/dist/client/assets/{extract-connection-data-DwkOg2rJ.js → extract-connection-data-CF7y2wEt.js} +1 -1
  140. package/dist/client/assets/{feature-gate-BIwsQPiQ.js → feature-gate-CM-Nk9xN.js} +1 -1
  141. package/dist/client/assets/{feature-paywall-DpVlsq5a.js → feature-paywall-CjqBZ6L8.js} +1 -1
  142. package/dist/client/assets/{file-explorer-B9Wz0lPl.js → file-explorer-BboVEb8_.js} +1 -1
  143. package/dist/client/assets/{file-preview-CX5xfaHR.js → file-preview-Bvo7zdtc.js} +1 -1
  144. package/dist/client/assets/{file-share-button-Cx66riM5.js → file-share-button-CXYkYNE_.js} +1 -1
  145. package/dist/client/assets/{file-type-icon-tAeiI9_2.js → file-type-icon-CjiJpbk5.js} +1 -1
  146. package/dist/client/assets/{folder-icon-C25vLo5g.js → folder-icon-BZUD34gC.js} +1 -1
  147. package/dist/client/assets/{form-CKF06Eu0.js → form-DrzlJwQH.js} +1 -1
  148. package/dist/client/assets/{general-CA7uhFzP.js → general-Cd6mSkL_.js} +1 -1
  149. package/dist/client/assets/{held-block-view-CU5t1B8c.js → held-block-view-R3GhxO1l.js} +3 -3
  150. package/dist/client/assets/{home-BuPVKVzx.js → home-CrEXzaHC.js} +1 -1
  151. package/dist/client/assets/{icon-button-5JlhYc9R.js → icon-button-j3Ikexya.js} +1 -1
  152. package/dist/client/assets/{index-D8kI0oe2.js → index-6M_m-_Us.js} +1 -1
  153. package/dist/client/assets/{index-B8bCJ3Gm.js → index-B7a1uePd.js} +1 -1
  154. package/dist/client/assets/{index-C4tYnNih.js → index-BJ9m9LNK.js} +7 -7
  155. package/dist/client/assets/{index-BLRFIWph.js → index-BZXHvOuQ.js} +1 -1
  156. package/dist/client/assets/{index-DQ4MCRAi.js → index-BhEe0I5z.js} +1 -1
  157. package/dist/client/assets/{index-CJ8-jtJ3.js → index-BjON6Ore.js} +1 -1
  158. package/dist/client/assets/{index-DG_Aoo8H.js → index-CPP16Pqo.js} +1 -1
  159. package/dist/client/assets/{index-CDfG-oXn.js → index-Cs2qsEhb.js} +1 -1
  160. package/dist/client/assets/{index-BerfNxBu.js → index-DEhrG7UG.js} +1 -1
  161. package/dist/client/assets/{index-DMcUJv3F.js → index-DO1wPTie.js} +1 -1
  162. package/dist/client/assets/{index-CieIETkx.js → index-DT3sLrgG.js} +1 -1
  163. package/dist/client/assets/{index-AY0yzUAx.js → index-Da5shA_7.js} +1 -1
  164. package/dist/client/assets/{index-CMXP-HlZ.js → index-Dj2ac1Ct.js} +1 -1
  165. package/dist/client/assets/index-DyS4s94t.js +1 -0
  166. package/dist/client/assets/{index-B0Hb2bUK.js → index-Zaz397OF.js} +1 -1
  167. package/dist/client/assets/{index-redirect-DSkhUiz1.js → index-redirect-Ch_11yeO.js} +1 -1
  168. package/dist/client/assets/{infiniteQueryObserver-CyNcT3qz.js → infiniteQueryObserver-CM3ITLPo.js} +1 -1
  169. package/dist/client/assets/{infra-billing-OmwhvZsy.js → infra-billing-D_W3RIFV.js} +1 -1
  170. package/dist/client/assets/input-DTDcy6hY.js +17 -0
  171. package/dist/client/assets/{input-Drj3v1Rm.js → input-DipMvobq.js} +1 -1
  172. package/dist/client/assets/{integration-icon-wG7mou98.js → integration-icon-gBiw8y2C.js} +1 -1
  173. package/dist/client/assets/{jira-icon-Ct9neMH3.js → jira-icon-Cus3NRDL.js} +1 -1
  174. package/dist/client/assets/{label-Kngegn1Y.js → label-BWO7BDzN.js} +1 -1
  175. package/dist/client/assets/{layout-D1PXm8wr.js → layout-C4eU6U_z.js} +1 -1
  176. package/dist/client/assets/{legacy-agents-deep-CqqR00U7.js → legacy-agents-deep-CDxdVAmP.js} +1 -1
  177. package/dist/client/assets/{legacy-main-redirect-j5rWQTR7.js → legacy-main-redirect-BTqRcXg6.js} +1 -1
  178. package/dist/client/assets/library-CRTbwohf.js +1 -0
  179. package/dist/client/assets/{login-dCZC1OIS.js → login-UOHS7fQN.js} +1 -1
  180. package/dist/client/assets/{markdown-C-J5-sTt.js → markdown-BG06zpZJ.js} +1 -1
  181. package/dist/client/assets/{mcp-app-renderer-vHEVQIZL.js → mcp-app-renderer-CxONPSoj.js} +1 -1
  182. package/dist/client/assets/{mcp-oauth-5QMuPFQa.js → mcp-oauth-C_vXn_zS.js} +1 -1
  183. package/dist/client/assets/{mcp-oauth-CnB7EPe0.js → mcp-oauth-hbfUsWSk.js} +1 -1
  184. package/dist/client/assets/{members-D62Ns7xb.js → members-DiPd0w69.js} +1 -1
  185. package/dist/client/assets/{memory-BRnI6IWM.js → memory-D7_gYCf3.js} +1 -1
  186. package/dist/client/assets/{mini-report-page-RV5HcY13.js → mini-report-page-DudoCNBc.js} +1 -1
  187. package/dist/client/assets/{mock-board-C5ljPU5m.js → mock-board-COFBA38P.js} +3 -3
  188. package/dist/client/assets/{monaco-editor-CG1RPml4.js → monaco-editor-Bp87HTy0.js} +1 -1
  189. package/dist/client/assets/{monitoring-kGWQYp7Z.js → monitoring-KjkBz5Hy.js} +1 -1
  190. package/dist/client/assets/{monitoring-stats-row-BpfaRq5_.js → monitoring-stats-row-DZiWF0MT.js} +1 -1
  191. package/dist/client/assets/{multi-select-D79TIC6v.js → multi-select-ClUvymCl.js} +1 -1
  192. package/dist/client/assets/{mustache-BdHuXtQC.js → mustache-SEzsgR-s.js} +1 -1
  193. package/dist/client/assets/{named-rule-uses-DDsPTKwP.js → named-rule-uses-DBpP8kZW.js} +1 -1
  194. package/dist/client/assets/{named-rule-view-CelDjugE.js → named-rule-view-CIxMNPIR.js} +1 -1
  195. package/dist/client/assets/{new-project-dialog-DQPlctqf.js → new-project-dialog-BIxGYry7.js} +1 -1
  196. package/dist/client/assets/{oauth-callback-ah6cR8xQ.js → oauth-callback-CgnzMW_h.js} +1 -1
  197. package/dist/client/assets/{oauth-callback-ai-provider-C5jhPG9E.js → oauth-callback-ai-provider-CrNuoNuA.js} +1 -1
  198. package/dist/client/assets/{onboarding-BPgxXbEy.js → onboarding-CPcIJ7Kl.js} +1 -1
  199. package/dist/client/assets/{openai-conversation-COLqoqqY.js → openai-conversation-BVVfXB0S.js} +1 -1
  200. package/dist/client/assets/{optimistic-project-sidebar-views-BXm7Dv06.js → optimistic-project-sidebar-views-CGrVGbzf.js} +1 -1
  201. package/dist/client/assets/{order-monitor-day-DzTTlxAw.js → order-monitor-day-_COSpI9X.js} +1 -1
  202. package/dist/client/assets/{organization-choice-CMYQUq77.js → organization-choice-DM-i-ste.js} +1 -1
  203. package/dist/client/assets/{orgs-Cb-j6SHO.js → orgs-DBGdo2ep.js} +1 -1
  204. package/dist/client/assets/{page-seo-form-CCa1Xirx.js → page-seo-form-B-bTZXwI.js} +1 -1
  205. package/dist/client/assets/{pair-CRFLUGB-.js → pair-CeWIXyL1.js} +1 -1
  206. package/dist/client/assets/{parse-sections-CBOr5TcU.js → parse-sections-CzJo2WgK.js} +1 -1
  207. package/dist/client/assets/{plan-CZiCKWsL.js → plan-6sf6fzbJ.js} +1 -1
  208. package/dist/client/assets/{plan-ladder-Clu_D1dM.js → plan-ladder-Co29049V.js} +1 -1
  209. package/dist/client/assets/{popover-7hw0_Cgu.js → popover-C5Dt3qOY.js} +1 -1
  210. package/dist/client/assets/{post-calendar-oSfCtk_Z.js → post-calendar-DOKKScLr.js} +1 -1
  211. package/dist/client/assets/{post-editor-DqdLoENq.js → post-editor-L6XkKTbk.js} +1 -1
  212. package/dist/client/assets/{preview-content-tpqwn9DV.js → preview-content-CY8QtGeB.js} +1 -1
  213. package/dist/client/assets/{preview-dialog-DDUA3zbn.js → preview-dialog-SFPfuPhe.js} +1 -1
  214. package/dist/client/assets/{preview-panel-B7KDfk34.js → preview-panel-DG1XweCF.js} +1 -1
  215. package/dist/client/assets/{preview-tab-CwHbL-uL.js → preview-tab-CppK1K1V.js} +3 -3
  216. package/dist/client/assets/{product-picker-dialog-q_j-OMur.js → product-picker-dialog-B-qJRXdq.js} +1 -1
  217. package/dist/client/assets/{profile--UpTdMEW.js → profile-CogKW0ml.js} +1 -1
  218. package/dist/client/assets/{project-app-view-BDtUwetx.js → project-app-view-Bg0IXTwt.js} +1 -1
  219. package/dist/client/assets/{project-apps-M24hPHW2.js → project-apps-BWyBTcjU.js} +1 -1
  220. package/dist/client/assets/{project-feed-Dm5w30sM.js → project-feed-BbnYaqgF.js} +1 -1
  221. package/dist/client/assets/{project-icon-BlULUcrw.js → project-icon-OmAeiXOI.js} +1 -1
  222. package/dist/client/assets/project-reports-C4fNYK5h.js +1 -0
  223. package/dist/client/assets/project-tasks-CiUIlBvj.js +1 -0
  224. package/dist/client/assets/{projects-C9fr3jni.js → projects-ScLrP0Sq.js} +1 -1
  225. package/dist/client/assets/{projects-empty-state-DRas-7X9.js → projects-empty-state-DySkSTbO.js} +1 -1
  226. package/dist/client/assets/{prompts-CiGgpCOz.js → prompts-fqxplS8t.js} +1 -1
  227. package/dist/client/assets/record-editor-Cd5kCJv3.js +1 -0
  228. package/dist/client/assets/{redirect-editor-DbPiIIKk.js → redirect-editor-CiqrxPXo.js} +1 -1
  229. package/dist/client/assets/{releases-api-DA_Oz9WG.js → releases-api-CughGviB.js} +1 -1
  230. package/dist/client/assets/reports-D4nL6cfo.js +1 -0
  231. package/dist/client/assets/{reports-Czva0tSD.js → reports-DoXSUp0p.js} +1 -1
  232. package/dist/client/assets/{reports-onboarding-BsOWdPaY.js → reports-onboarding-CvtUysYm.js} +1 -1
  233. package/dist/client/assets/{reports-tab-C2STfD1k.js → reports-tab-DGGd_cJc.js} +2 -2
  234. package/dist/client/assets/repositories-CX881Zmd.js +1 -0
  235. package/dist/client/assets/{repositories-Dp2o7kK8.js → repositories-DiF_6MDk.js} +1 -1
  236. package/dist/client/assets/{repository-binding-C7GXruB1.js → repository-binding-5kMOX4dj.js} +1 -1
  237. package/dist/client/assets/{repository-import-picker-BIFRKH2H.js → repository-import-picker-Cf-mDDmo.js} +1 -1
  238. package/dist/client/assets/{repository-picker-D6fEwnOk.js → repository-picker-BN84wENn.js} +1 -1
  239. package/dist/client/assets/{require-capability-DSeRbn1u.js → require-capability-d9R-dYdO.js} +1 -1
  240. package/dist/client/assets/{required-auth-layout-D4yn4VOg.js → required-auth-layout-DojZ1KGX.js} +1 -1
  241. package/dist/client/assets/{reset-password-CLlk4Qyg.js → reset-password-DSQJZEJs.js} +1 -1
  242. package/dist/client/assets/{resizable-B3zVq59U.js → resizable-DaKs1eh5.js} +1 -1
  243. package/dist/client/assets/{resolve-tab-icon-NGCKQk4u.js → resolve-tab-icon-E0pJTGSy.js} +1 -1
  244. package/dist/client/assets/{review-settings-ChOJMpqj.js → review-settings-B7m9uNKt.js} +1 -1
  245. package/dist/client/assets/{roles-034YEIy0.js → roles-sT7X7xzB.js} +1 -1
  246. package/dist/client/assets/{route-DixoE7S2.js → route-BiPjYs2Q.js} +1 -1
  247. package/dist/client/assets/{route-D3_kGiYP.js → route-CO4TvlsY.js} +1 -1
  248. package/dist/client/assets/route-qbvcUo1A.js +1 -0
  249. package/dist/client/assets/sandbox-lifecycle-context-BdO8UXfQ.js +1 -0
  250. package/dist/client/assets/{schema-DXQBt-Da.js → schema-Bp5lazAd.js} +1 -1
  251. package/dist/client/assets/{schema-DIZqRcY2.js → schema-HyTKqr-p.js} +1 -1
  252. package/dist/client/assets/{scroll-area-BYOXOcFm.js → scroll-area-ButOmQch.js} +1 -1
  253. package/dist/client/assets/{search-input-CM9T7koR.js → search-input-N6CaOC_1.js} +1 -1
  254. package/dist/client/assets/{search-toggle-BA_oiAdj.js → search-toggle-hVjf6-kQ.js} +1 -1
  255. package/dist/client/assets/{secret-picker-D2Cr-oRZ.js → secret-picker-DbQaPqx6.js} +1 -1
  256. package/dist/client/assets/{secrets-BRbaixQo.js → secrets-CkR4uy6Z.js} +1 -1
  257. package/dist/client/assets/{section-array-field-TQFJqwVV.js → section-array-field-Lr-feKpQ.js} +1 -1
  258. package/dist/client/assets/{sections-05hBo9NL.js → sections-BM3hOdfC.js} +1 -1
  259. package/dist/client/assets/{sections-editor-BR_A8Bqr.js → sections-editor-DLgM9lBb.js} +1 -1
  260. package/dist/client/assets/{select-BZ2tKCpr.js → select-BwZ3fxwy.js} +1 -1
  261. package/dist/client/assets/{select-model-DskJe0jJ.js → select-model-B5VqF5aQ.js} +1 -1
  262. package/dist/client/assets/{seo-editor-DWsRiK1b.js → seo-editor-Bpy9Dzdq.js} +1 -1
  263. package/dist/client/assets/{separator-DdBbm1xl.js → separator-BJ59N-4S.js} +1 -1
  264. package/dist/client/assets/settings-tab-CA-W7UU2.js +1 -0
  265. package/dist/client/assets/{sheet-DYw2VD7L.js → sheet-CFaQrFou.js} +1 -1
  266. package/dist/client/assets/{shell-layout-DQPoLlFW.js → shell-layout-BmOtysoG.js} +1 -1
  267. package/dist/client/assets/{site-draft-actions-dD4jyBUz.js → site-draft-actions-DQSFILpp.js} +1 -1
  268. package/dist/client/assets/site-draft-view-FIwQQWqm.js +2 -0
  269. package/dist/client/assets/site-editor-pGVB_SVm.js +1 -0
  270. package/dist/client/assets/{site-editor-toast-gO0geSY6.js → site-editor-toast-Drt9__vU.js} +1 -1
  271. package/dist/client/assets/{skills-BG0VOLIN.js → skills-CuAtdce2.js} +1 -1
  272. package/dist/client/assets/{slider-ApiojjsY.js → slider-9xLURN_x.js} +1 -1
  273. package/dist/client/assets/{sortable.esm-DPfgkRcd.js → sortable.esm-DKvN4I2-.js} +1 -1
  274. package/dist/client/assets/{sso-CfSDpa9Z.js → sso-Bt0VIDB0.js} +1 -1
  275. package/dist/client/assets/{suggestion-DTo0Z5su.js → suggestion-B65JiyPM.js} +1 -1
  276. package/dist/client/assets/{switch-B3v6apDN.js → switch-DAskixZA.js} +1 -1
  277. package/dist/client/assets/{symbol-pDh9bf5z.js → symbol-DHBzZbeR.js} +1 -1
  278. package/dist/client/assets/{synced-repos-oiGV5Ihu.js → synced-repos-CE8wN2_N.js} +1 -1
  279. package/dist/client/assets/{tab-icon-glyph-BzFDI553.js → tab-icon-glyph-CpaZMvdV.js} +1 -1
  280. package/dist/client/assets/{table-CANIhtsr.js → table-gy7RNGr-.js} +1 -1
  281. package/dist/client/assets/{tabs-B5O9VNwn.js → tabs-BIh8PZDT.js} +1 -1
  282. package/dist/client/assets/{task-assignee-avatar-BOAf_3H_.js → task-assignee-avatar-T0yhZapD.js} +1 -1
  283. package/dist/client/assets/{task-board-CBBaN9ua.js → task-board-DDJJrv54.js} +1 -1
  284. package/dist/client/assets/{task-route-1lojPQeZ.js → task-route-BuxqCGZd.js} +1 -1
  285. package/dist/client/assets/{task-status-DM1NBqlc.js → task-status-B-hiqAeK.js} +1 -1
  286. package/dist/client/assets/{taskboard-analytics-DK79qp1-.js → taskboard-analytics-CACHd6vk.js} +1 -1
  287. package/dist/client/assets/{tasks-Czi5B_ZB.js → tasks-CPyoTCOO.js} +1 -1
  288. package/dist/client/assets/tasks-CyRF0ujk.js +1 -0
  289. package/dist/client/assets/{textarea-CAZh8Kr5.js → textarea-B-cDk_e9.js} +1 -1
  290. package/dist/client/assets/{thread-analytics-K9PkKnHr.js → thread-analytics-DKFvK1DN.js} +1 -1
  291. package/dist/client/assets/{thread-intent-B9ceQWmI.js → thread-intent-DXpv35UG.js} +1 -1
  292. package/dist/client/assets/{thread-route-gmMlW4oz.js → thread-route-BZKbOQYe.js} +1 -1
  293. package/dist/client/assets/{thread-route-_-Jo9yAq.js → thread-route-Dp-aglxM.js} +1 -1
  294. package/dist/client/assets/{thread-sheet-body-ClyiLZhS.js → thread-sheet-body-CRJRoIwG.js} +1 -1
  295. package/dist/client/assets/{time-range-picker-m7OMfbU0.js → time-range-picker-B1ueoxPR.js} +1 -1
  296. package/dist/client/assets/{toggle-group-8XrNtMoS.js → toggle-group-B4WOnAP4.js} +1 -1
  297. package/dist/client/assets/{tool-namespace-cn6zTT0m.js → tool-namespace-BDVFYO2h.js} +1 -1
  298. package/dist/client/assets/{toolbar-icon-button-fBm5AosV.js → toolbar-icon-button-CsFCKDkl.js} +1 -1
  299. package/dist/client/assets/{tooltip-B1eS9Khq.js → tooltip-BP50pkvP.js} +1 -1
  300. package/dist/client/assets/{tooltipContext-DMiC5t9-.js → tooltipContext-C8XbU8o0.js} +1 -1
  301. package/dist/client/assets/{track-BcscPlt3.js → track-CDPTw9ZB.js} +1 -1
  302. package/dist/client/assets/{types-C_LaIhQe.js → types-G5N7kkmB.js} +1 -1
  303. package/dist/client/assets/{url-slug-BEmF9qH1.js → url-slug-D6AdbSqw.js} +1 -1
  304. package/dist/client/assets/{usage-stats-DtO_zGwF.js → usage-stats-n069Pf6u.js} +1 -1
  305. package/dist/client/assets/{use-ai-providers-C315xBlf.js → use-ai-providers-BCXdfWt4.js} +1 -1
  306. package/dist/client/assets/{use-apply-named-rule-9ihG8ELj.js → use-apply-named-rule-2pgSelD5.js} +1 -1
  307. package/dist/client/assets/{use-automations-BpSvam4M.js → use-automations-Ch5lNT3Y.js} +1 -1
  308. package/dist/client/assets/{use-autosave-CRCl3eTr.js → use-autosave-DnUFhq5-.js} +1 -1
  309. package/dist/client/assets/{use-chat-layout-state-ByIICjWr.js → use-chat-layout-state-Boq7M7MG.js} +1 -1
  310. package/dist/client/assets/{use-clock-tick-QAJndZ00.js → use-clock-tick-C7RLnGnY.js} +1 -1
  311. package/dist/client/assets/{use-connect-companion-rEYy0Kcd.js → use-connect-companion-w3O3zQJZ.js} +1 -1
  312. package/dist/client/assets/{use-connection-CBlLT-Gl.js → use-connection-SBf1IMNR.js} +1 -1
  313. package/dist/client/assets/{use-content-sync-TKItZ8SP.js → use-content-sync-BL9rGIyO.js} +1 -1
  314. package/dist/client/assets/{use-copy-C9NYM8DB.js → use-copy-Dgppamoo.js} +1 -1
  315. package/dist/client/assets/{use-create-virtual-mcp-DFsMYI92.js → use-create-virtual-mcp-DE2rukKQ.js} +1 -1
  316. package/dist/client/assets/{use-date-fns-locale-bL-I5mOj.js → use-date-fns-locale-MUGqYczL.js} +1 -1
  317. package/dist/client/assets/{use-debounced-autosave-DfJudaYl.js → use-debounced-autosave-C_xNyGJY.js} +1 -1
  318. package/dist/client/assets/{use-debounced-value-DOPKXMfX.js → use-debounced-value-Cf0I7A9v.js} +1 -1
  319. package/dist/client/assets/{use-deco-credits-DL_DG4I5.js → use-deco-credits-Dna90E4X.js} +1 -1
  320. package/dist/client/assets/{use-decopilot-events-4yDcDH2I.js → use-decopilot-events-8w_hmlMJ.js} +1 -1
  321. package/dist/client/assets/{use-delete-connection-3ef0jZgj.js → use-delete-connection-ClNsS7Ho.js} +1 -1
  322. package/dist/client/assets/{use-deployment-admin-C2GaZpz9.js → use-deployment-admin-4YEWaFep.js} +1 -1
  323. package/dist/client/assets/{use-fast-preview-draft-url-CN-8cYCq.js → use-fast-preview-draft-url-Bc3gs7gV.js} +1 -1
  324. package/dist/client/assets/{use-file-configs-Dfr8whNN.js → use-file-configs-B-wH52y_.js} +1 -1
  325. package/dist/client/assets/{use-inbox-feed-UXhkZ9eS.js → use-inbox-feed-Ci3vPrJA.js} +1 -1
  326. package/dist/client/assets/{use-infinite-scroll-WEv8wBk9.js → use-infinite-scroll-BIzBYJCu.js} +1 -1
  327. package/dist/client/assets/{use-join-requests-Bf1nx4BW.js → use-join-requests-DP8Apzuq.js} +1 -1
  328. package/dist/client/assets/{use-main-panel-tabs-CnvhH3AB.js → use-main-panel-tabs-CYcYIai-.js} +1 -1
  329. package/dist/client/assets/{use-mcp-auth-status-Dxn8Kcei.js → use-mcp-auth-status-CNLX3LBK.js} +1 -1
  330. package/dist/client/assets/{use-mcp-client-BkBWhGyj.js → use-mcp-client-Do4_ndrI.js} +1 -1
  331. package/dist/client/assets/{use-mcp-prompts-DWjSk3XQ.js → use-mcp-prompts-BtZywK26.js} +1 -1
  332. package/dist/client/assets/{use-mcp-tools-Cq-ES3mk.js → use-mcp-tools-D588moK7.js} +1 -1
  333. package/dist/client/assets/{use-mobile-BADuLdb7.js → use-mobile-CMu6UtqS.js} +1 -1
  334. package/dist/client/assets/{use-move-blocks-Ds_0OJ4H.js → use-move-blocks-0Xns2gtz.js} +1 -1
  335. package/dist/client/assets/{use-navigate-to-agent-B3bMlZK-.js → use-navigate-to-agent-BhR34hZR.js} +1 -1
  336. package/dist/client/assets/{use-open-billing-url-Dfpg8Tio.js → use-open-billing-url-C2ZKl_OJ.js} +1 -1
  337. package/dist/client/assets/{use-org-fs-Dt6mQNyr.js → use-org-fs-Bmjx4Cik.js} +1 -1
  338. package/dist/client/assets/{use-org-repo-syncs-D2j2_BKY.js → use-org-repo-syncs-BSAcLSvr.js} +1 -1
  339. package/dist/client/assets/{use-org-sso-CWvWEDQk.js → use-org-sso-C2CyZRUp.js} +1 -1
  340. package/dist/client/assets/{use-organization-roles-DsjUZx1i.js → use-organization-roles-DSCc1iIP.js} +1 -1
  341. package/dist/client/assets/{use-organization-settings-DBQ6GIch.js → use-organization-settings-DMgbBKf8.js} +1 -1
  342. package/dist/client/assets/{use-panel-navigate-DZO4-0o6.js → use-panel-navigate-o6edpcRi.js} +1 -1
  343. package/dist/client/assets/{use-project-native-view-presence-Y3Sopx8q.js → use-project-native-view-presence-CiNgXr_r.js} +1 -1
  344. package/dist/client/assets/{use-project-scope-CKNjz3VB.js → use-project-scope-2Tdoer5a.js} +1 -1
  345. package/dist/client/assets/{use-recent-apps-TrfPEwKE.js → use-recent-apps-D4vko3CW.js} +1 -1
  346. package/dist/client/assets/{use-releases-DSFeRsP3.js → use-releases-CZIw49MO.js} +1 -1
  347. package/dist/client/assets/{use-reports-diagnostic-YBAEN0Wc.js → use-reports-diagnostic-D1hUsQ-k.js} +1 -1
  348. package/dist/client/assets/use-sandbox-events-BGso5ik2.js +2 -0
  349. package/dist/client/assets/{use-secrets-xwuuJgHg.js → use-secrets-B4A-mk96.js} +1 -1
  350. package/dist/client/assets/{use-section-preview-base-BdMX2uY9.js → use-section-preview-base-7CyzrhDh.js} +1 -1
  351. package/dist/client/assets/{use-session-runtime-CtTWKH1c.js → use-session-runtime-CbMaO8p7.js} +1 -1
  352. package/dist/client/assets/{use-sidebar-collapsed-DXyrU3VA.js → use-sidebar-collapsed-CI6KBWLr.js} +1 -1
  353. package/dist/client/assets/{use-tags-CwZHa3pE.js → use-tags-lzJX123E.js} +1 -1
  354. package/dist/client/assets/{use-task-board-analytics-BzPvlYE9.js → use-task-board-analytics-BzMGYkMt.js} +1 -1
  355. package/dist/client/assets/{use-task-board-events-qI_skUMm.js → use-task-board-events-DoQeMblf.js} +1 -1
  356. package/dist/client/assets/{use-task-board-item-prs-CiXpN6jW.js → use-task-board-item-prs-C1DrMHVS.js} +1 -1
  357. package/dist/client/assets/{use-task-metadata-E8aNM85o.js → use-task-metadata-DKj0uikU.js} +1 -1
  358. package/dist/client/assets/{use-thread-analytics-DKupwFaR.js → use-thread-analytics-C147IXlL.js} +1 -1
  359. package/dist/client/assets/{use-thread-outputs-Di1RSISN.js → use-thread-outputs-sdt1CHHh.js} +1 -1
  360. package/dist/client/assets/useInfiniteQuery-Cq3QQD7o.js +1 -0
  361. package/dist/client/assets/{useQueries-BOzKsoXi.js → useQueries-B2KTxxDE.js} +1 -1
  362. package/dist/client/assets/useSuspenseInfiniteQuery-jjzI6K-a.js +1 -0
  363. package/dist/client/assets/{users-Cup6bGNw.js → users-B-OmSt3n.js} +1 -1
  364. package/dist/client/assets/{utils-wTX1Gyo-.js → utils-muk7Isuo.js} +1 -1
  365. package/dist/client/assets/{variant-calendar-Doi5lHFb.js → variant-calendar-DE-GxRhT.js} +1 -1
  366. package/dist/client/assets/{variant-matcher-override-LGFgaSJn.js → variant-matcher-override-CDXRGILn.js} +1 -1
  367. package/dist/client/assets/{virtual-mcp-DO56RLOP.js → virtual-mcp-C5K9GZ-3.js} +1 -1
  368. package/dist/client/assets/{watch-sse-pool-BBTCM7MS.js → watch-sse-pool-BzTIkVFy.js} +1 -1
  369. package/dist/client/index.html +1 -1
  370. package/dist/server/server.js +1102 -1102
  371. package/package.json +1 -1
  372. package/dist/client/assets/agent-analytics-DcqQcnI_.js +0 -1
  373. package/dist/client/assets/agent-app-BWM9EEcJ.js +0 -1
  374. package/dist/client/assets/agent-calendar-Bp6Y1tPy.js +0 -1
  375. package/dist/client/assets/agent-deck-BOaej8yV.js +0 -1
  376. package/dist/client/assets/agent-experiments-7O17P9sC.js +0 -1
  377. package/dist/client/assets/agent-library-B3W6CGJl.js +0 -1
  378. package/dist/client/assets/agent-library-file-CHgoG2j3.js +0 -1
  379. package/dist/client/assets/agent-monitor-C9pMT5KA.js +0 -1
  380. package/dist/client/assets/agent-settings-CfNarIdW.js +0 -1
  381. package/dist/client/assets/agent-site-editor-code-D6BBbIl8.js +0 -2
  382. package/dist/client/assets/agent-site-editor-content-DAMOp9X5.js +0 -1
  383. package/dist/client/assets/agent-site-editor-preview-B0IbykqU.js +0 -1
  384. package/dist/client/assets/agent-view-B5q0EqmS.js +0 -1
  385. package/dist/client/assets/api-keys-B-qwgNok.js +0 -1
  386. package/dist/client/assets/blocks-preview-workspace-context-C-uj3YG0.js +0 -1
  387. package/dist/client/assets/chat-context-CIOqAIIy.js +0 -39
  388. package/dist/client/assets/cms-settings-editor-DbU_3ksB.js +0 -1
  389. package/dist/client/assets/index-Bz0XRw1e.js +0 -1
  390. package/dist/client/assets/input-C0IBlV9i.js +0 -17
  391. package/dist/client/assets/library-BB_eexuL.js +0 -1
  392. package/dist/client/assets/project-reports-BXESPzCU.js +0 -1
  393. package/dist/client/assets/project-tasks-CRajXa6Z.js +0 -1
  394. package/dist/client/assets/record-editor-Dw_A1nYV.js +0 -1
  395. package/dist/client/assets/reports-I3thcjRj.js +0 -1
  396. package/dist/client/assets/repositories-B5BeE82u.js +0 -1
  397. package/dist/client/assets/route-B9sbaFmI.js +0 -1
  398. package/dist/client/assets/sandbox-lifecycle-context-DS1zxfZb.js +0 -1
  399. package/dist/client/assets/settings-tab-5QV5D7iT.js +0 -1
  400. package/dist/client/assets/site-draft-view-Ds5aQAqU.js +0 -2
  401. package/dist/client/assets/site-editor-D8vmphjE.js +0 -1
  402. package/dist/client/assets/tasks--LaoDxg8.js +0 -1
  403. package/dist/client/assets/use-sandbox-events-C6ionJ0p.js +0 -2
  404. package/dist/client/assets/useInfiniteQuery-CtWUiDbh.js +0 -1
  405. package/dist/client/assets/useSuspenseInfiniteQuery-Diw12fEI.js +0 -1
@@ -1 +1 @@
1
- import{c as P,q as z,m as M,K as h,eP as ct,aK as zt,aL as Xt,r as j,a as Zt,az as pe,a4 as qt,eQ as lt,eR as Ce,bh as be,eS as ue,eT as _e,eU as Ne,ax as Kt,bq as ut,eV as F,eW as ee,eX as we,eY as He,eZ as en,t as q,j as G}from"./index-C4tYnNih.js";import{u as dt}from"./use-session-runtime-CtTWKH1c.js";import{s as Ge}from"./thread-intent-B9ceQWmI.js";import{u as Re,b as tn}from"./experiments-tab-choice-pVOiMOWe.js";import{b as de}from"./sandbox-url-D3mC8qhT.js";import{s as nn}from"./utils-wTX1Gyo-.js";import{a as on}from"./repository-binding-C7GXruB1.js";import{u as rn}from"./chat-context-CIOqAIIy.js";import{i as sn,u as an}from"./use-sandbox-events-C6ionJ0p.js";import{a as cn}from"./sandbox-git-api-CH_-QFpD.js";import{e as ln}from"./backoff-CrEUbyZT.js";const S={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class D extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new D(t.code,t.message,t.data)}}const Z="deco-content",Se={major:1},ft=1;async function un(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const ye={major:Se.major,minor:ft},ht=`the endpoint speaks an older ${Z} than this client needs (${ye.major}.${ye.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ne(e,t,n){const o={reason:t,required:{...ye}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new D(S.Unsupported,e,o)}function gt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==Z)throw ne(`the endpoint speaks ${JSON.stringify(n)}, not ${Z}`,"protocol",t);if(o?.major!==Se.major)throw ne(`the endpoint speaks ${Z} ${String(o?.major)}.x; this client speaks ${Se.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<ft)throw ne(ht,"outdated",t);return e}function Je(e,t){return t.code===S.MethodNotFound&&e.startsWith("changes.")?ne(ht,"outdated"):D.from(t)}function xe(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let l;try{l=await un(a)}catch{throw new D(S.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(l)&&l?.id===null){const c=l?.error;throw c?D.from(c):new D(S.Unavailable,`the endpoint answered HTTP ${a.status}`)}return l}const r=async(s,i)=>{const a=n++,l=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(l.error)throw Je(s,l.error);return l.result};return{call:r,describe:async()=>gt(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((c,u)=>({jsonrpc:"2.0",id:i[u],method:c.method,params:c.params??{}}))),l=new Map(a.map(c=>[c.id,c]));return i.map((c,u)=>{const d=l.get(c);return d?d.error?{ok:!1,error:Je(s[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new D(S.InternalError,"no response for this call")}})}}}function vt(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const We=20,Ye=5,ze=500;function Pe(e){return e instanceof D?e.code===S.MethodNotFound?!0:e.code===S.Unsupported&&e.data?.reason==="outdated":!1}function Ee(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function dn(e,t,n){const o=h.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(vt(r)),i=Ee(r,s);if(i)return i;const a=await t.changesList({});return Ee(void 0,a)}async function fn(e,t){const n=[];for(let s=0;s<t.length;s+=We)n.push(t.slice(s,s+We));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=Ye){const i=await e.batch(n.slice(s,s+Ye).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const l=a.result;Object.assign(o,l.entries),r.push(...l.diagnostics)}}return{entries:o,diagnostics:r}}async function Jo(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=ze){const r=t.slice(o,o+ze),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Wo(e){return e instanceof D&&e.code===S.Conflict}function mt(e){return e?.kind==="protocol"?e:null}function Yo(e,t,n){const o=P.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=z();let a;o[2]!==e?(a=mt(e),o[2]=e,o[3]=a):a=o[3];const l=a,c=!!l&&!!t&&s.enabled!==!1;let u;o[4]!==t?(u=h.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let d;o[6]!==t||o[7]!==c||o[8]!==l||o[9]!==i?(d=c?()=>dn(i,l.client,t):ct,o[6]=t,o[7]=c,o[8]=l,o[9]=i,o[10]=d):d=o[10];let g;return o[11]!==u||o[12]!==d?(g={queryKey:u,queryFn:d,staleTime:0},o[11]=u,o[12]=d,o[13]=g):g=o[13],M(g)}function zo(e,t,n){const o=P.c(14);let r;o[0]!==e?(r=mt(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,l=!!s&&!!t&&!!n&&a.length>0;let c;o[4]!==t||o[5]!==n?.revision?(c=h.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=c):c=o[6];let u;o[7]!==l||o[8]!==a||o[9]!==s?(u=l?()=>fn(s.client,a):ct,o[7]=l,o[8]=a,o[9]=s,o[10]=u):u=o[10];let d;return o[11]!==c||o[12]!==u?(d={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=c,o[12]=u,o[13]=d):d=o[13],M(d)}function pt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function ie(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const bt=zt({endpoint:Xt().max(2048).refine(e=>pt(e)&&new URL(e).pathname==="/rpc").transform(ie)});function Xo(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=bt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function wt(e){const t=bt.safeParse(e);return t.success?t.data:null}const St="studio:deco-serve-last";function Zo(e){try{localStorage.setItem(St,JSON.stringify(e))}catch{}}function qo(){try{const e=localStorage.getItem(St);return e?wt(JSON.parse(e)):null}catch{return null}}function Ko(e){try{return new URL(ie(e)).host}catch{return e}}function hn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const gn="http://localhost:4545/rpc",er="npx @decocms/blocks serve",tr="npx @decocms/blocks schema";class $e extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function vn(e){if(e instanceof $e)return{reason:"not-deco-serve"};if(!(e instanceof D))return{reason:"not-answering"};switch(e.code){case S.Unauthorized:case S.MethodNotFound:return{reason:"outdated"};case S.Unsupported:return Pe(e)?{reason:"outdated"}:{reason:"version-mismatch"};case S.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function nr(e,t){if(e)return[ie(e.endpoint)];const n=[t?.endpoint,gn].filter(o=>!!o).map(ie);return[...new Set(n)]}const yt=j.createContext(null);function mn(e){const t=P.c(27),n=j.useContext(yt),o=Re(n?null:e),{data:r}=Zt.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?pe.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[l,c]=Ze(a);let u;t[4]!==i||t[5]!==s||t[6]!==e?(u=i?pe.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=u):u=t[7];const[d,g]=Ze(u);if(n)return n;let f;t[8]!==l||t[9]!==i?(f=i?wt(l):null,t[8]=l,t[9]=i,t[10]=f):f=t[10];const v=f,b=!!v;let w;t[11]!==o||t[12]!==b?(w=pn(o,b),t[11]=o,t[12]=b,t[13]=w):w=t[13];const{applies:I,undecided:T}=w,x=I?v:null,_=i&&o==="v8"&&typeof d=="string"?d:null;let C;t[14]!==g||t[15]!==c||t[16]!==i?(C=N=>{i&&(c(N),g(N.endpoint))},t[14]=g,t[15]=c,t[16]=i,t[17]=C):C=t[17];let E;t[18]!==c||t[19]!==i?(E=()=>{i&&c(null)},t[18]=c,t[19]=i,t[20]=E):E=t[20];let k;return t[21]!==x||t[22]!==_||t[23]!==C||t[24]!==E||t[25]!==T?(k={connection:x,undecided:T,lastEndpoint:_,set:C,clear:E},t[21]=x,t[22]=_,t[23]=C,t[24]=E,t[25]=T,t[26]=k):k=t[26],k}function pn(e,t){return t?e==="loading"?{applies:!1,undecided:!0}:{applies:e==="v8"||e==="error",undecided:!1}:{applies:!1,undecided:!1}}function Xe(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function Ze(e){const t=P.c(17),n=z(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?Xe(e):null,a=()=>e?Xe(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const l=!!e;let c;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==l?(c={queryKey:s,queryFn:i,initialData:a,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=l,t[9]=c):c=t[9];const{data:u}=M(c);let d;t[10]!==e||t[11]!==n||t[12]!==s?(d=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(s,b)}},t[10]=e,t[11]=n,t[12]=s,t[13]=d):d=t[13];const g=d,f=e?u??null:null;let v;return t[14]!==g||t[15]!==f?(v=[f,g],t[14]=g,t[15]=f,t[16]=v):v=t[16],v}function or(e){return e.kind==="protocol"||e.kind==="unavailable"}function rr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n==="protocol"||n==="unavailable"?!0:n==="pending"?t===!0?!0:void 0:t}function sr(e,t,n){return t!=="github"||n!=="v8"?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function ir(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&pt(t)?t:null}function ar(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function Et(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function bn(e){if(!e.hasProject)return"legacy";const t=Et(e);if(t==="local")return"protocol-local";if(e.serveConnectionUndecided)return"pending";if(t==="sandbox"){const o=e.sandboxSite;return o==="v8"?"protocol-sandbox":o==="v7"?"legacy":o==="error"?e.markedV8?"retrying-sandbox":"legacy":"pending"}if(e.mainSchema==="loading")return"pending";if(e.mainSchema==="error")return"retrying-github";if(e.mainSchema==="v7")return"legacy";const n=e.githubSite;return n==="v8"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":n==="v7"?"legacy":"pending"}function wn(e){return{github:e.mode==="github"&&e.mainSchema==="v8",sandbox:e.mode==="sandbox"&&e.workingTreeReady}}function qe(e){return e.isError||e.errorUpdateCount>0}function Sn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function yn(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}const kt="__noSchema";function En(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[kt]:!0}}function cr(e){return!!e&&e[kt]===!0}function Ot(e){if(!e.ok)return e.error.code===S.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function kn(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const On=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function lr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:kn(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(On)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Ke(n.resolveType).localeCompare(Ke(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Ke(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function et(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=et(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?et(s[a],r,n):s[a];return i}return e}function ur(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class tt extends Error{}class nt extends Error{}const Dt="site-not-owned";async function Dn(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Tn(e,t=r=>fetch(r),n,o){const r=xe({endpoint:e,fetch:async s=>{const i=new Request(s);for(const[l,c]of Object.entries(ue("v8")))i.headers.set(l,c);const a=await t(i);if(await Dn(a))throw new nt;if(await _e(a))throw n?.(),new Ne;return a}});try{const s=await Le(r,be(o)?{schema:o}:void 0);return s.v8Schema?s:null}catch(s){if(s instanceof nt)return Dt;throw s}}const Ae=5e3;function In(e){return new URL(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/rpc`,window.location.origin).href}function Cn(e){return new URL(de(e,"rpc"),window.location.origin).href}async function Le(e,t){const[n,o]=await e.batch(t?[{method:"describe"}]:[{method:"describe"},{method:"schema.get"}]);if(!n?.ok)throw n?.error??new Error("no describe");if(n.result?.protocol!==Z)throw new $e;const s=gt(n.result);if(t)return{client:e,describe:s,hasSchema:t.schema!=null,v8Schema:be(t.schema)};if(!o)throw new Error("no schema.get");if(Ot(o))return{client:e,describe:s,hasSchema:!1,v8Schema:!1};if(o.ok){const i=o.result;return{client:e,describe:s,hasSchema:!0,v8Schema:be(i?.schema)}}throw o.error}async function _n(e,t=n=>fetch(n)){const n=xe({endpoint:e,fetch:async o=>{const r=await t(o);if(r.status===404)throw new tt;return r}});try{const o=await Le(n);return o.v8Schema?o:null}catch(o){if(o instanceof tt)return null;throw o}}function Tt(e,t){const n=P.c(53),{org:o}=qt(),{connection:r,undecided:s}=mn(e),{runtime:i}=dt(e),a=j.useContext(yt),l=Re(a?null:e),c=tn(e),u=Et({hasServeConnection:!!r,runtime:i}),d=rn()?.taskId??null,g=sn(an().lifecycle.phase),f=z(),v=wn({mode:u,mainSchema:l,workingTreeReady:g}),b=v.github&&!!o.slug&&!!e&&!!t;let w;n[0]!==t||n[1]!==o.slug||n[2]!==f||n[3]!==e?(w=()=>Tn(In({orgSlug:o.slug,virtualMcpId:e,branch:t}),void 0,()=>Ce(f,o.slug,e),lt(f,o.slug,e)?.schema),n[0]=t,n[1]=o.slug,n[2]=f,n[3]=e,n[4]=w):w=n[4];const I=M({queryKey:h.contentBackend(o.slug,e??"",t??"","github"),queryFn:w,enabled:b,staleTime:Number.POSITIVE_INFINITY,...ot}),T=v.sandbox&&!!o.slug&&!!e&&!!t;let x;n[5]!==t||n[6]!==o.slug||n[7]!==d||n[8]!==e?(x=async()=>_n(Cn({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:d})),n[5]=t,n[6]=o.slug,n[7]=d,n[8]=e,n[9]=x):x=n[9];const _=M({queryKey:h.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:x,enabled:T,staleTime:Number.POSITIVE_INFINITY,...ot}),C=!!r;let E;n[10]!==r?.endpoint||n[11]!==o.slug||n[12]!==e?(E=h.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[10]=r?.endpoint,n[11]=o.slug,n[12]=e,n[13]=E):E=n[13];let k;n[14]!==r?(k=()=>Le(xe({endpoint:r.endpoint})),n[14]=r,n[15]=k):k=n[15];let N;n[16]!==C||n[17]!==E||n[18]!==k?(N={queryKey:E,queryFn:k,enabled:C,staleTime:Number.POSITIVE_INFINITY,retry:xn,retryDelay:Rn,refetchInterval:Nn},n[16]=C,n[17]=E,n[18]=k,n[19]=N):N=n[19];const p=M(N);let O;n[20]!==r?.endpoint||n[21]!==o.slug||n[22]!==e?(O=h.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[20]=r?.endpoint,n[21]=o.slug,n[22]=e,n[23]=O):O=n[23];const $=O;let y;n[24]!==r?.endpoint||n[25]!==o.slug||n[26]!==e?(y=h.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[24]=r?.endpoint,n[25]=o.slug,n[26]=e,n[27]=y):y=n[27];let R;n[28]!==p.data||n[29]!==$||n[30]!==f?(R=async()=>{try{return await p.data.client.describe()}catch(m){const Y=m;throw f.invalidateQueries({queryKey:$,exact:!0},{cancelRefetch:!1}),Y}},n[28]=p.data,n[29]=$,n[30]=f,n[31]=R):R=n[31];const A=!!p.data&&!a;let U;n[32]!==y||n[33]!==R||n[34]!==A?(U={queryKey:y,queryFn:R,enabled:A,refetchInterval:Ae,retry:!1},n[32]=y,n[33]=R,n[34]=A,n[35]=U):U=n[35];const V=M(U).data??p.data?.describe,L=bn({hasProject:!!e,hasServeConnection:!!r,serveConnectionUndecided:s,runtime:i,mainSchema:l,githubSite:I.data===Dt?"not-owned":I.data?"v8":I.data===null?"v7":qe(I)?"error":"loading",sandboxSite:Pn({data:_.data,isError:qe(_),workingTreeReady:g}),markedV8:c});if(L==="pending"){let m;return n[36]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending"},n[36]=m):m=n[36],m}if(L==="retrying-github"){let m;return n[37]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"github"},n[37]=m):m=n[37],m}if(L==="retrying-sandbox"){let m;return n[38]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"sandbox"},n[38]=m):m=n[38],m}if(L==="legacy"){let m;return n[39]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"legacy"},n[39]=m):m=n[39],m}if(L==="protocol-github"){const m=I.data;let Y;return n[40]!==m?(Y=ke("github",m,""),n[40]=m,n[41]=Y):Y=n[41],Y}if(L==="site-not-owned-github"){let m;return n[42]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github",siteNotOwned:!0},n[42]=m):m=n[42],m}if(L==="protocol-sandbox"){let m;return n[43]!==_.data?(m=ke("sandbox",_.data,":sandbox"),n[43]=_.data,n[44]=m):m=n[44],m}if(L==="unavailable-github"){let m;return n[45]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github"},n[45]=m):m=n[45],m}const W=p.error??p.failureReason,ve=r?.endpoint??"";let te;return n[46]!==V||n[47]!==p.data||n[48]!==p.failureCount||n[49]!==p.isError||n[50]!==W||n[51]!==ve?(te=An({probed:p.data,isError:p.isError,failureCount:p.failureCount,failure:W,describe:V,endpoint:ve}),n[46]=V,n[47]=p.data,n[48]=p.failureCount,n[49]=p.isError,n[50]=W,n[51]=ve,n[52]=te):te=n[52],te}function Nn(e){return e.state.status==="error"||e.state.data?.v8Schema===!1?Ae:!1}function Rn(e){return hn(e+1)}function xn(e,t){return!(t instanceof D)&&!(t instanceof $e)}function Pn(e){return e.data!==void 0?e.data?"v8":"v7":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const $n=3;function An(e){if(e.probed?.hasSchema&&!e.probed.v8Schema)return{kind:"unavailable",source:"local",problem:{reason:"not-v8"}};const t=e.probed?ke("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<$n?t:{kind:"unavailable",source:"local",problem:vn(e.failure)}:t??{kind:"pending"}}const ot={retry:2,refetchInterval:e=>e.state.status==="error"?Ae:!1};function ke(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema}}function It(e){const t=P.c(13);let n;t[0]!==e?(n=pe.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=Kt(o,null),i=Re(e);let a;if(t[2]!==i||t[3]!==r||t[4]!==e){const g=e?Ge(r):null;a=Ln({saved:g,main:i}),t[2]=i,t[3]=r,t[4]=e,t[5]=a}else a=t[5];const l=a;let c,u;t[6]!==s?(c=g=>s(Ge(g)),u=()=>s(null),t[6]=s,t[7]=c,t[8]=u):(c=t[7],u=t[8]);let d;return t[9]!==l||t[10]!==c||t[11]!==u?(d={...l,setUrl:c,clear:u},t[9]=l,t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function Ln(e){return e.saved?e.main==="v7"?{url:e.saved,undecided:!1}:e.main==="v8"?{url:null,undecided:!1}:{url:null,undecided:!0}:{url:null,undecided:!1}}function jn(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function rt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}class je extends Error{constructor(t,n,o=[],r=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=r,this.name="BlockConflictError"}blocks;fields;carriedStored}function Ue(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function fe(e,t,n){return["decofile-write",e,t,n]}function Un(e,t,n){return{id:fe(e,t,n).join(":")}}function Me(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function Mn(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function Fn(e,t,n){e.setQueryData(h.decofileDraft(Ue(t)),n)}function Qn(e,t){return e.getQueryData(h.decofileDraft(Ue(t)))??null}async function Bn(e,t){const n=await fetch(Me(e),{cache:"no-store",headers:{...ue("v7"),"if-none-match":`"${t}"`}}).catch(()=>null);return n?.status===200||n?.status===409}function dr(e){const t=P.c(4);let n;t[0]!==e?(n=h.decofileDraft(e?Ue(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Vn,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=M(o);return r??null}async function Vn(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Hn(e,t){const n=await fetch(Me(t),{cache:"no-store",headers:ue("v7")});if(await _e(n))throw Ce(e,t.orgSlug,t.virtualMcpId),new Ne;if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&Fn(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function fr(e,t){const n=await fetch(Me(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new je(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return Mn(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Ct=3e3,Gn=15e3,Jn=2*6e4,_t={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Wn(e){return e<Jn?Ct:Gn}function Yn(e,t=_t){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,Wn(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:l,skip:c}=e();if(r||t.hidden()||c?.()){i();return}r=!0;let u;try{u=l()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const st=()=>0;function zn(e,t,n=_t){const o=j.useRef(t);o.current=t;const[r]=j.useState(()=>({polling:()=>Yn(()=>o.current,n),idle:()=>()=>{}}));j.useSyncExternalStore(e?r.polling:r.idle,st,st)}function Nt(e,t){return de(e,t)}function Xn(e,t){return de(e,"preview-fetch",{path:t})}function hr(e){return Nt(e,"preview-invoke")}function gr(e){return Nt(e,"catalog-invoke")}function Rt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function Zn(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&Rt(n))return n}return null}function qn(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Zn();return n&&Rt(n)?new URL(t,n).toString():Xn(e,t)}function Kn(e){return qn(e,"/.decofile")}function eo(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function it(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function to(e,t){const n=de(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=eo(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:nn(s.content)}}async function no(e,t){const n=await to(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function vr(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function oo(e){return on(e)?.metadata?.runtime?.path??null}class xt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function mr(e){return e instanceof D&&e.code===S.Conflict}function Pt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class Fe extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class Qe extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function pr(e,t){return(t instanceof Fe||t instanceof Qe)&&(t.message=$t(e,t,"github")),t}function $t(e,t,n){if(t instanceof Fe)return e("siteEditor.save.draftUnread");if(t instanceof Qe)return e("siteEditor.save.keptChanging");if(t instanceof je)return t.message;if(n==="local")return so(e,t);if(t instanceof D)switch(t.code){case S.Conflict:return e("siteEditor.save.conflict");case S.ReadOnly:return e("siteEditor.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("siteEditor.save.invalid");case S.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function ro(e,t){if(t==="local"||e instanceof je||e instanceof Fe||e instanceof Qe)return null;if(e instanceof D){const n=e.code===S.InvalidBlock||e.code===S.InvalidParams?Pt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function so(e,t){if(t instanceof xt)return e("decoServe.save.serverGone");if(t instanceof D)switch(t.code){case S.Conflict:return e("decoServe.save.conflict");case S.ReadOnly:return e("decoServe.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("decoServe.save.invalid",{detail:Pt(t)});case S.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function io(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function ao(e,t){const[n,o]=j.useState(e),r=j.useRef(null);return e&&!n&&o(!0),j.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=io(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const co="decocms:content-writes",Oe=new Set;let H;function At(){if(H!==void 0)return H;H=null;try{typeof BroadcastChannel=="function"&&(H=new BroadcastChannel(co),H.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Oe])n(t)}))}catch{H=null}return H}function lo(e){try{At()?.postMessage({cacheKey:e})}catch{}}function uo(e){return At(),Oe.add(e),()=>{Oe.delete(e)}}const Lt={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},fo=15e3,ae=new Map;function J(e,t){return`${e}/${t}`}function Q(e){let t=ae.get(e);return t||(t={state:Lt,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ae.set(e,t)),t}function B(e,t){const n=Q(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function he(e){e.timer&&clearTimeout(e.timer),e.timer=null}function Be(e){return ae.get(e)?.state??Lt}function ho(e,t){const n=Q(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function br(e){const t=Q(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(he(t),B(e,{phase:"idle"}))}}function wr(e){const t=ae.get(e);!t||t.state.phase!=="reloading"||(he(t),B(e,{phase:"idle"}))}function jt(e){const t=Q(e);he(t),B(e,{phase:"saving",inFlight:t.state.inFlight+1})}function oe(e,t){const n=Q(e),o=Math.max(0,n.state.inFlight-1);if(o>0){B(e,{inFlight:o});return}if(!t.ok||n.previews===0){B(e,{phase:"idle",inFlight:o});return}Ut(e,t.navigates,o)}function Ut(e,t,n=0){const o=Q(e);he(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&B(e,{phase:"idle"})},fo),B(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function go(e){return e?.kind==="protocol"&&e.source==="github"}async function re(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,l=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:h.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await l,{navigates:!1};const c=s?h.protocolDraftRead(o,r,s):null,u=c?JSON.stringify(n.getQueryData(c)??null):null,d=l?[l]:[];if(a&&t.reread&&d.push(n.invalidateQueries({queryKey:h.decofile(a)})),a&&!t.adopted&&d.push(n.invalidateQueries({queryKey:h.contentChanges(a)})),s&&i.source==="sandbox"&&d.push(n.invalidateQueries({queryKey:cn(o,r,s)})),go(i)&&c&&!t.adopted&&d.push(n.invalidateQueries({queryKey:c})),await Promise.all(d),t.kind!=="edit"){const v=J(o,r);B(v,{epoch:Be(v).epoch+1})}const g=c?JSON.stringify(n.getQueryData(c)??null):null,f=u!==g;return f&&await new Promise(v=>ut.schedule(v)),{navigates:f}}async function vo(e,t){return jt(J(e.orgSlug,e.virtualMcpId)),Mt(e,t)}function at(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(h.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Mt(e,t){const n=J(e.orgSlug,e.virtualMcpId),o=t.adopted?at(e):null;let r;try{r=await t.write()}catch(i){throw oe(n,{ok:!1,navigates:!1}),t.refreshOnError&&re(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&lo(e.cacheKey),t.adopted){const i=at(e)!==o;return i&&await new Promise(a=>ut.schedule(a)),oe(n,{ok:!0,navigates:i}),t.reread&&re(e,t).catch(()=>{}),r}let s=!1;try{({navigates:s}=await re(e,t))}catch{}finally{oe(n,{ok:!0,navigates:s})}return r}function Sr(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=J(o,r),a=new Set(t.blockKeys);for(const u of[...Q(i).discardListeners])u(a);jt(i);let l=!1;const c=()=>(l=!0,Mt(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:fe(o,r,s),scope:Un(o,r,s),mutationFn:c}).execute(void 0).catch(u=>{throw l||oe(i,{ok:!1,navigates:!1}),u}):c()}function yr(e,t,n){const o=P.c(8);let r;o[0]!==e||o[1]!==t?(r=J(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const l=Q(s).discardListeners;return l.add(n),()=>{l.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],j.useEffect(i,a)}function mo(e){const t=J(e.orgSlug,e.virtualMcpId);Be(t).inFlight>0||re(e,{kind:"external"}).then(({navigates:n})=>{const o=Q(t);o.previews>0&&o.state.inFlight===0&&Ut(t,n)}).catch(()=>{})}function po(e,t){const n=P.c(7);let o;n[0]!==e||n[1]!==t?(o=J(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=c=>ho(r,c),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>Be(r),n[5]=r,n[6]=a):a=n[6];const l=a;return j.useSyncExternalStore(i,l,l)}const bo=500;function Er(e,t){const{phase:n}=po(e,t);return ao(n!=="idle",bo)}function wo(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function So(e,t){return h.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function kr(e,t,n,o){if(o?.source==="github")return yo(e,t,n);const r=e.getQueryData(h.contentVersions(t));if(!r)return;if(Object.hasOwn(r,n))return r[n];const s=e.getQueryData(h.decofile(t));return s&&Object.hasOwn(s,n)?void 0:null}function K(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(r=>F(r)===n);return o===void 0?void 0:e.changes[o]}function yo(e,t,n){const o=e.getQueryData(h.contentChanges(t));if(o)return Ft(o,ge(e,t),n)}function Ft(e,t,n){const o=K(e,n);return o?.kind==="delete"?o.version??we:o?o.version:t.has(F(n))?we:null}function Or(e,t,n){const o=e.getQueryData(h.contentChanges(t));if(!o)return!1;const r=K(o,n);return r?r.kind==="set"&&r.baseVersion===null:ge(e,t).has(F(n))}function Dr(e,t){const n=e.getQueryData(h.decofile(t)),o=e.getQueryData(h.contentChanges(t));if(!n||!o)return null;const r=ge(e,t);return{blocks:n,versionOf:s=>Ft(o,r,s)}}function ge(e,t){return new Set(e.getQueryData(h.contentDraftTombstones(t)))}function ce(e,t,n,o){const r=F(n),s=ge(e,t);s.has(r)!==o&&(o?s.add(r):s.delete(r),ee(e),e.setQueryData(h.contentDraftTombstones(t),[...s]))}function Eo(e,t,n,o){const r=He(o.revision),s=e.getQueryData(h.contentRevision(n))?.revision,i=s?He(s):null,a=r&&!r.main&&i?en(i.main,r.draft):o.revision,l=e.getQueryData(h.contentVersions(n)),c=Object.entries(o.versions??{}).map(([f,v])=>[f,v===we?null:v]),u=e.getQueryData(h.contentChanges(n)),d=new Set(c.flatMap(([f])=>{const v=u?K(u,f):void 0;return(v?v.baseVersion:l?.[f]??null)===null?[f]:[]})),g=new Set(c.flatMap(([f,v])=>v===null?[]:[F(f)]));e.setQueryData(h.contentChanges(n),f=>{if(!f)return f;const v={...f.changes};for(const[b,w]of c){const I=K(f,b),T=I?I.baseVersion:l?.[b]??null;w!==null?v[b]={kind:"set",version:w,baseVersion:T}:T!==null?v[b]={kind:"delete",version:null,baseVersion:T}:delete v[b]}return{...f,changes:v,edited:!0}});for(const[f,v]of c)v!==null?ce(e,n,f,!1):!g.has(F(f))&&d.has(f)&&ce(e,n,f,!0);return r&&r.draft!=="none"&&e.setQueryData(h.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),f=>f&&{...f,version:r.draft}),a}function Ve(e,t,n){ee(e),e.setQueryData(h.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function ko(e,t){const n=e.getMutationCache().findAll({mutationKey:fe(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>yn(o.state.variables)))}function De(e,t){e.resetQueries({queryKey:h.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function le(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof D);throw t.source==="local"&&s?(De(e,n),new xt(r)):(t.source==="local"&&Pe(r)&&De(e,n),r)}}const se=new Map;function Qt(e,t,n,o){const r=se.get(o);if(r)return r;const s=Bt(e,t,n,o,!0);return se.set(o,s),s.finally(()=>se.delete(o))}const me=new Set;function Oo(e,t,n){const o=P.c(8),r=z(),s=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let l,c;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==s||o[4]!==r||o[5]!==i?(l=()=>{if(!e||!s||!i||!a)return;const u={orgSlug:s,virtualMcpId:i,branch:a};return uo(d=>{d===n&&(me.has(n)||(me.add(n),To(r,e,u,n).catch(Do).finally(()=>me.delete(n))))})},c=[r,e,s,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=s,o[4]=r,o[5]=i,o[6]=l,o[7]=c):(l=o[6],c=o[7]),j.useEffect(l,c)}function Do(){}async function To(e,t,n,o){const r=se.get(o);return r&&await r.catch(()=>{}),Qt(e,t,n,o)}async function Bt(e,t,n,o,r){ee(e);const s=h.decofile(o),i=So(n,t),a=h.contentRevision(o),l=h.contentVersions(o),c=e.getQueryData(s),u=e.getQueryData(l),d=e.getQueryData(i),g=e.getQueryData(a)??void 0,f=t.source==="github"&&!d?lt(e,n.orgSlug,n.virtualMcpId):void 0,v=f?.isV8&&f.schema&&f.version?f:void 0,b=d??v?.schema,w=v?{...g,schemaVersion:v.version}:g,I=r&&c&&u?w?.revision:void 0,T=r&&b?w?.schemaVersion:void 0,x=h.contentChanges(o),_=e.getQueryData(x),[C,E,k]=await le(e,t,n,()=>t.client.batch([{method:"blocks.list",params:I?{ifNoneMatch:I}:{}},{method:"schema.get",params:T?{ifNoneMatch:T}:{}},{method:"changes.list",params:vt(_)}])),N=e.getQueryData(a)?.revision,p=N!==void 0&&N!==w?.revision;if(k?.ok){const X=p?null:Ee(_,k.result);X&&e.setQueryData(x,X)}else k&&t.source==="local"&&Pe(k.error)&&De(e,n);if(!C?.ok)throw C?.error??new Error("no blocks.list");if(!E)throw new Error("no schema.get");const O=C.result,$=Ot(E),y=E.ok&&!$?E.result:null;if(O.notModified&&(!c||!u)||y?.notModified&&!b)return Bt(e,t,n,o,!1);const R=O.notModified?new Set:ko(e,n),A=O.notModified?c:Sn(O.blocks,c,R),U=$?En():y?y.notModified?b:y.schema:E.error;if(e.setQueryData(a,{revision:p?N:O.notModified?w?.revision:O.revision,schemaVersion:y?y.notModified?w?.schemaVersion:y.version??void 0:void 0}),e.setQueryData(s,A),!O.notModified){const X=e.getQueryData(l),V={...O.versions};for(const L of R){const W=X?.[L];W!==void 0?V[L]=W:delete V[L]}e.setQueryData(l,V)}return U instanceof D||e.setQueryData(i,U),!p&&!O.notModified&&c&&w?.revision&&O.revision!==w.revision&&mo({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:U}}async function Tr(e,t,n,o,r,s){if(t.source==="github"){const a=[...Object.keys(r.set??{}),...r.delete??[]].filter(l=>!s||!Object.hasOwn(s,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`)}return vo({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=await le(e,t,n,()=>t.client.blocksApply({set:r.set,delete:r.delete,...s?{ifMatch:s}:{}}));ee(e);const a=t.source==="github"?Eo(e,n,o,i):i.revision;e.setQueryData(h.contentRevision(o),c=>({...c,revision:a}));const l=i.versions??{};return Ve(e,o,l),{revision:a,versions:l}}})}function Vt(e,t){if(!(e instanceof D))return;const n=e.data?.draft;if(!n||typeof n!="object"||!Object.hasOwn(n,t))return;const o=n[t];return o&&typeof o.version=="string"?o:void 0}function Ht(e,t,n){if(!(n instanceof D))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[r,s]of Object.entries(o))s===null&&ce(e,t,r,!1)}function Gt(e,t,n,o){ee(e);const r=o.block===null,s=e.getQueryData(h.contentVersions(t)),i=e.getQueryData(h.contentChanges(t)),a=i?K(i,n):void 0,l=a?a.baseVersion:s?.[n]??null;if(i){const c=F(n),u=Object.fromEntries(Object.entries(i.changes).filter(([d])=>F(d)!==c));r?l!==null&&(u[n]={kind:"delete",version:null,baseVersion:l}):u[n]={kind:"set",version:o.version,baseVersion:l},e.setQueryData(h.contentChanges(t),{...i,changes:u,edited:!0})}ce(e,t,n,r&&l===null),e.setQueryData(h.decofile(t),c=>{const u={...c};return r?delete u[n]:u[n]=o.block,u}),Ve(e,t,{[n]:r?null:o.version})}function Ir(e,t,n,o){if(t.source!=="github"||!(o instanceof D))return!1;Ht(e,n,o);const r=o.data?.draft;if(!r||typeof r!="object")return!1;const s=Object.keys(r),i=s.map(a=>Vt(o,a));return s.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:h.decofile(n)}),s.forEach((a,l)=>{Gt(e,n,a,i[l])}),!0)}async function Cr(e,t,n,o,r,s){t.source==="github"&&Ht(e,o,s);const i=t.source==="github"?Vt(s,r):void 0;if(i)return e.cancelQueries({queryKey:h.decofile(o)}),Gt(e,o,r,i),!0;await e.invalidateQueries({queryKey:h.decofile(o)});let a;try{const c=(await le(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(c&&c.after===null&&c.version!==null)return!1;a={value:c?.after??null,version:c?.version??null},t.source==="github"&&e.setQueryData(h.contentChanges(o),u=>{if(!u)return u;const d={...u.changes};return c?.kind?d[r]={kind:c.kind,version:c.version,baseVersion:c.baseVersion}:delete d[r],{...u,changes:d,edited:!0}})}catch{const l=await le(e,t,n,()=>t.client.blocksList({}));if(l.notModified)return!1;a={value:l.blocks[r]??null,version:l.versions[r]??null}}return e.setQueryData(h.decofile(o),l=>{const c={...l};return a.value===null?delete c[r]:c[r]=a.value,c}),Ve(e,o,{[r]:a.version}),!1}function Io(e){const t=P.c(15),n=z();let o;t[0]!==e?.branch||t[1]!==e?.orgSlug||t[2]!==e?.virtualMcpId?(o=h.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[0]=e?.branch,t[1]=e?.orgSlug,t[2]=e?.virtualMcpId,t[3]=o):o=t[3];let r;t[4]!==e||t[5]!==n?(r=async()=>{const f=await fetch(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`,{cache:"no-store",headers:ue("v8")});if(await _e(f))throw Ce(n,e.orgSlug,e.virtualMcpId),new Ne;if(!f.ok)throw new Error(`draft pointer read failed: ${f.status}`);return await f.json()},t[4]=e,t[5]=n,t[6]=r):r=t[6];const s=!!e;let i;t[7]!==o||t[8]!==r||t[9]!==s?(i={queryKey:o,queryFn:r,enabled:s,staleTime:Number.POSITIVE_INFINITY},t[7]=o,t[8]=r,t[9]=s,t[10]=i):i=t[10];const{data:a,isPending:l,isError:c}=M(i),u=!!e&&l&&!c;if(!e||!a?.draft||!a.version){let f;return t[11]!==u?(f={pointer:null,pending:u},t[11]=u,t[12]=f):f=t[12],f}const d=`${a.draft}@${a.version}`;let g;return t[13]!==d?(g={pointer:d,pending:!1},t[13]=d,t[14]=g):g=t[14],g}function _r(e){return Io(e).pointer}function Nr(e){const t=P.c(4);let n;t[0]!==e?(n=h.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Co,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=M(o);return r?.revision}async function Co(){throw new Error("content revisions are set by reads and writes")}function Te(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Rr(e,t){return Te({...e,protocolSuffix:t.cacheKeySuffix})}function _o(e,t){const n=P.c(6),{url:o}=It(e?.virtualMcpId),r=Tt(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?Te({...e,protocolSuffix:r.cacheKeySuffix}):Te({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function xr(e,t){const n=P.c(39),{url:o,undecided:r}=It(e?.virtualMcpId),s=!!o,i=Tt(e?.virtualMcpId,e?.branch),a=i.kind==="protocol"?i:null,l=_o(e),c=t?.fetchEnabled??!0,u=oo(e?.virtualMcpId),d=dt(e?.virtualMcpId).runtime==="cms",g=z();let f;n[0]!==l?(f=h.decofile(l),n[0]=l,n[1]=f):f=n[1];const v=f;Oo(a,a&&e?e:null,l);let b;n[2]!==e||n[3]!==g||n[4]!==v?(b=()=>{if(!e||g.isMutating({mutationKey:fe(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const p=g.getQueryState(v);return p?.fetchStatus==="fetching"||Date.now()-(p?.dataUpdatedAt??0)<Ct/2},n[2]=e,n[3]=g,n[4]=v,n[5]=b):b=n[5];let w;n[6]!==d||n[7]!==s||n[8]!==e||n[9]!==a||n[10]!==g||n[11]!==v?(w=async()=>{if(e){if(!a&&d&&!s){const p=Qn(g,e)?.version;if(p&&!await Bn(e,p))return}await g.refetchQueries({queryKey:v,exact:!0},{cancelRefetch:!1})}},n[6]=d,n[7]=s,n[8]=e,n[9]=a,n[10]=g,n[11]=v,n[12]=w):w=n[12];let I;n[13]!==b||n[14]!==w?(I={skip:b,read:w},n[13]=b,n[14]=w,n[15]=I):I=n[15],zn(!!t?.pollWhile&&!!e,I);let T;n[16]!==i.kind||n[17]!==d||n[18]!==c||n[19]!==l||n[20]!==s||n[21]!==o||n[22]!==u||n[23]!==e||n[24]!==a||n[25]!==g?(T=async()=>{if(a)return(await Qt(g,a,e,l)).blocks;if(i.kind==="unavailable")throw wo("decofile");if(s){const y=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(xo),R=y?.ok?rt(await y.text()):null;if(R)return R;const A=new Error("decofile unavailable (local tunnel unreachable)");throw A.status=502,A}if(d)return Hn(g,e);const p=()=>no(e,jn(u,".deco/blocks.gen.json"));if(c){const y=await fetch(Kn(e),{cache:"no-store"}).catch(Ro);if(y?.ok){const U=rt(await y.text());if(U)return U}const R=await p();if(R.kind==="data")return R.data;const A=new Error(`Failed to fetch decofile: ${y?.status??"network error"}`);throw A.status=it({liveOk:!!y?.ok,liveStatus:y?.status,committedAbsent:R.kind==="absent"}),A}const O=await p();if(O.kind==="data")return O.data;const $=new Error("decofile unavailable (preview down, no committed snapshot)");throw $.status=it({liveOk:!1,committedAbsent:O.kind==="absent"}),$},n[16]=i.kind,n[17]=d,n[18]=c,n[19]=l,n[20]=s,n[21]=o,n[22]=u,n[23]=e,n[24]=a,n[25]=g,n[26]=T):T=n[26];const x=!!e&&i.kind!=="pending"&&!r,_=a?0:3e4,C=a?.describe.pollIntervalMs,E=a?"always":void 0;let k;n[27]!==d||n[28]!==s||n[29]!==a?(k=(p,O)=>{if(a||d||s)return p<3;const $=O.status;return $!==502&&$!==404&&p<2},n[27]=d,n[28]=s,n[29]=a,n[30]=k):k=n[30];let N;return n[31]!==v||n[32]!==T||n[33]!==x||n[34]!==_||n[35]!==C||n[36]!==E||n[37]!==k?(N={queryKey:v,queryFn:T,enabled:x,staleTime:_,refetchInterval:C,refetchIntervalInBackground:!1,refetchOnWindowFocus:E,retry:k,retryDelay:No},n[31]=v,n[32]=T,n[33]=x,n[34]=_,n[35]=C,n[36]=E,n[37]=k,n[38]=N):N=n[38],M(N)}function No(e){return ln(5e3,1e3,e,2,0)}function Ro(){return null}function xo(){return null}const Po="site-editor-save",Jt={id:Po,description:void 0,action:void 0,cancel:void 0},Pr="site-editor-undo",Ie="site-editor-publish";function $o(e){const t=P.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=G.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=G.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=G.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function Wt(e,t){return t?G.jsx($o,{label:e("siteEditor.details"),detail:t}):void 0}function $r(e,t,n){q.error($t(e,t,n),{...Jt,description:Wt(e,ro(t,n))})}function Ar(e,t,n=!1){q.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Jt,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Yt={action:void 0,duration:void 0};function Lr(e,t){q.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Yt,id:Ie,description:void 0})}function jr(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=Wt(e,o??null);q[i](t,{id:Ie,description:n&&a?G.jsxs(G.Fragment,{children:[G.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:l=>{l.preventDefault(),q.loading(s??e("thread.publishPopover.publishing"),{...Yt,id:Ie,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function Ur(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Dr as $,br as A,po as B,wr as C,_o as D,Nr as E,Un as F,fe as G,vo as H,to as I,Mn as J,Ar as K,Or as L,pr as M,je as N,mr as O,To as P,Fe as Q,Tr as R,er as S,yt as T,Cr as U,$r as V,kr as W,So as X,Fn as Y,fr as Z,yr as _,nr as a,rr as a0,lr as a1,Ke as a2,et as a3,ur as a4,tr as a5,qn as a6,ar as a7,Rr as a8,gn as a9,S as aA,gr as aB,Wt as aa,Ur as ab,Lr as ac,Sr as ad,Jo as ae,Wo as af,Pe as ag,zo as ah,dn as ai,$o as aj,Yo as ak,Qt as al,wo as am,vr as an,no as ao,Qe as ap,Ir as aq,dr as ar,_r as as,jr as at,Ie as au,Yt as av,Pr as aw,Jt as ax,ko as ay,D as az,mn as b,It as c,hn as d,Ko as e,vn as f,Le as g,xe as h,pt as i,hr as j,Xn as k,xr as l,or as m,cr as n,oo as o,Xo as p,jn as q,qo as r,Zo as s,Et as t,Tt as u,ir as v,Er as w,sr as x,Io as y,J as z};
1
+ import{c as P,q as z,m as M,K as h,eP as ct,aK as zt,aL as Xt,r as j,a as Zt,az as pe,a4 as qt,eQ as lt,eR as Ce,bh as be,eS as ue,eT as _e,eU as Ne,ax as Kt,bq as ut,eV as F,eW as ee,eX as we,eY as He,eZ as en,t as q,j as G}from"./index-BJ9m9LNK.js";import{u as dt}from"./use-session-runtime-CbMaO8p7.js";import{s as Ge}from"./thread-intent-DXpv35UG.js";import{u as Re,b as tn}from"./experiments-tab-choice-vFGVi3bn.js";import{b as de}from"./sandbox-url-D3mC8qhT.js";import{s as nn}from"./utils-muk7Isuo.js";import{a as on}from"./repository-binding-5kMOX4dj.js";import{u as rn}from"./chat-context-2letHrEJ.js";import{i as sn,u as an}from"./use-sandbox-events-BGso5ik2.js";import{a as cn}from"./sandbox-git-api-CH_-QFpD.js";import{e as ln}from"./backoff-CrEUbyZT.js";const S={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class D extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new D(t.code,t.message,t.data)}}const Z="deco-content",Se={major:1},ft=1;async function un(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const ye={major:Se.major,minor:ft},ht=`the endpoint speaks an older ${Z} than this client needs (${ye.major}.${ye.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ne(e,t,n){const o={reason:t,required:{...ye}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new D(S.Unsupported,e,o)}function gt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==Z)throw ne(`the endpoint speaks ${JSON.stringify(n)}, not ${Z}`,"protocol",t);if(o?.major!==Se.major)throw ne(`the endpoint speaks ${Z} ${String(o?.major)}.x; this client speaks ${Se.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<ft)throw ne(ht,"outdated",t);return e}function Je(e,t){return t.code===S.MethodNotFound&&e.startsWith("changes.")?ne(ht,"outdated"):D.from(t)}function xe(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let l;try{l=await un(a)}catch{throw new D(S.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(l)&&l?.id===null){const c=l?.error;throw c?D.from(c):new D(S.Unavailable,`the endpoint answered HTTP ${a.status}`)}return l}const r=async(s,i)=>{const a=n++,l=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(l.error)throw Je(s,l.error);return l.result};return{call:r,describe:async()=>gt(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((c,u)=>({jsonrpc:"2.0",id:i[u],method:c.method,params:c.params??{}}))),l=new Map(a.map(c=>[c.id,c]));return i.map((c,u)=>{const d=l.get(c);return d?d.error?{ok:!1,error:Je(s[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new D(S.InternalError,"no response for this call")}})}}}function vt(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const We=20,Ye=5,ze=500;function Pe(e){return e instanceof D?e.code===S.MethodNotFound?!0:e.code===S.Unsupported&&e.data?.reason==="outdated":!1}function Ee(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function dn(e,t,n){const o=h.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(vt(r)),i=Ee(r,s);if(i)return i;const a=await t.changesList({});return Ee(void 0,a)}async function fn(e,t){const n=[];for(let s=0;s<t.length;s+=We)n.push(t.slice(s,s+We));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=Ye){const i=await e.batch(n.slice(s,s+Ye).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const l=a.result;Object.assign(o,l.entries),r.push(...l.diagnostics)}}return{entries:o,diagnostics:r}}async function Jo(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=ze){const r=t.slice(o,o+ze),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Wo(e){return e instanceof D&&e.code===S.Conflict}function mt(e){return e?.kind==="protocol"?e:null}function Yo(e,t,n){const o=P.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=z();let a;o[2]!==e?(a=mt(e),o[2]=e,o[3]=a):a=o[3];const l=a,c=!!l&&!!t&&s.enabled!==!1;let u;o[4]!==t?(u=h.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let d;o[6]!==t||o[7]!==c||o[8]!==l||o[9]!==i?(d=c?()=>dn(i,l.client,t):ct,o[6]=t,o[7]=c,o[8]=l,o[9]=i,o[10]=d):d=o[10];let g;return o[11]!==u||o[12]!==d?(g={queryKey:u,queryFn:d,staleTime:0},o[11]=u,o[12]=d,o[13]=g):g=o[13],M(g)}function zo(e,t,n){const o=P.c(14);let r;o[0]!==e?(r=mt(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,l=!!s&&!!t&&!!n&&a.length>0;let c;o[4]!==t||o[5]!==n?.revision?(c=h.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=c):c=o[6];let u;o[7]!==l||o[8]!==a||o[9]!==s?(u=l?()=>fn(s.client,a):ct,o[7]=l,o[8]=a,o[9]=s,o[10]=u):u=o[10];let d;return o[11]!==c||o[12]!==u?(d={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=c,o[12]=u,o[13]=d):d=o[13],M(d)}function pt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function ie(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const bt=zt({endpoint:Xt().max(2048).refine(e=>pt(e)&&new URL(e).pathname==="/rpc").transform(ie)});function Xo(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=bt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function wt(e){const t=bt.safeParse(e);return t.success?t.data:null}const St="studio:deco-serve-last";function Zo(e){try{localStorage.setItem(St,JSON.stringify(e))}catch{}}function qo(){try{const e=localStorage.getItem(St);return e?wt(JSON.parse(e)):null}catch{return null}}function Ko(e){try{return new URL(ie(e)).host}catch{return e}}function hn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const gn="http://localhost:4545/rpc",er="npx @decocms/blocks serve",tr="npx @decocms/blocks schema";class $e extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function vn(e){if(e instanceof $e)return{reason:"not-deco-serve"};if(!(e instanceof D))return{reason:"not-answering"};switch(e.code){case S.Unauthorized:case S.MethodNotFound:return{reason:"outdated"};case S.Unsupported:return Pe(e)?{reason:"outdated"}:{reason:"version-mismatch"};case S.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function nr(e,t){if(e)return[ie(e.endpoint)];const n=[t?.endpoint,gn].filter(o=>!!o).map(ie);return[...new Set(n)]}const yt=j.createContext(null);function mn(e){const t=P.c(27),n=j.useContext(yt),o=Re(n?null:e),{data:r}=Zt.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?pe.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[l,c]=Ze(a);let u;t[4]!==i||t[5]!==s||t[6]!==e?(u=i?pe.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=u):u=t[7];const[d,g]=Ze(u);if(n)return n;let f;t[8]!==l||t[9]!==i?(f=i?wt(l):null,t[8]=l,t[9]=i,t[10]=f):f=t[10];const v=f,b=!!v;let w;t[11]!==o||t[12]!==b?(w=pn(o,b),t[11]=o,t[12]=b,t[13]=w):w=t[13];const{applies:I,undecided:T}=w,x=I?v:null,_=i&&o==="v8"&&typeof d=="string"?d:null;let C;t[14]!==g||t[15]!==c||t[16]!==i?(C=N=>{i&&(c(N),g(N.endpoint))},t[14]=g,t[15]=c,t[16]=i,t[17]=C):C=t[17];let E;t[18]!==c||t[19]!==i?(E=()=>{i&&c(null)},t[18]=c,t[19]=i,t[20]=E):E=t[20];let k;return t[21]!==x||t[22]!==_||t[23]!==C||t[24]!==E||t[25]!==T?(k={connection:x,undecided:T,lastEndpoint:_,set:C,clear:E},t[21]=x,t[22]=_,t[23]=C,t[24]=E,t[25]=T,t[26]=k):k=t[26],k}function pn(e,t){return t?e==="loading"?{applies:!1,undecided:!0}:{applies:e==="v8"||e==="error",undecided:!1}:{applies:!1,undecided:!1}}function Xe(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function Ze(e){const t=P.c(17),n=z(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?Xe(e):null,a=()=>e?Xe(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const l=!!e;let c;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==l?(c={queryKey:s,queryFn:i,initialData:a,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=l,t[9]=c):c=t[9];const{data:u}=M(c);let d;t[10]!==e||t[11]!==n||t[12]!==s?(d=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(s,b)}},t[10]=e,t[11]=n,t[12]=s,t[13]=d):d=t[13];const g=d,f=e?u??null:null;let v;return t[14]!==g||t[15]!==f?(v=[f,g],t[14]=g,t[15]=f,t[16]=v):v=t[16],v}function or(e){return e.kind==="protocol"||e.kind==="unavailable"}function rr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n==="protocol"||n==="unavailable"?!0:n==="pending"?t===!0?!0:void 0:t}function sr(e,t,n){return t!=="github"||n!=="v8"?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function ir(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&pt(t)?t:null}function ar(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function Et(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function bn(e){if(!e.hasProject)return"legacy";const t=Et(e);if(t==="local")return"protocol-local";if(e.serveConnectionUndecided)return"pending";if(t==="sandbox"){const o=e.sandboxSite;return o==="v8"?"protocol-sandbox":o==="v7"?"legacy":o==="error"?e.markedV8?"retrying-sandbox":"legacy":"pending"}if(e.mainSchema==="loading")return"pending";if(e.mainSchema==="error")return"retrying-github";if(e.mainSchema==="v7")return"legacy";const n=e.githubSite;return n==="v8"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":n==="v7"?"legacy":"pending"}function wn(e){return{github:e.mode==="github"&&e.mainSchema==="v8",sandbox:e.mode==="sandbox"&&e.workingTreeReady}}function qe(e){return e.isError||e.errorUpdateCount>0}function Sn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function yn(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}const kt="__noSchema";function En(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[kt]:!0}}function cr(e){return!!e&&e[kt]===!0}function Ot(e){if(!e.ok)return e.error.code===S.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function kn(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const On=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function lr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:kn(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(On)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Ke(n.resolveType).localeCompare(Ke(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Ke(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function et(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=et(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?et(s[a],r,n):s[a];return i}return e}function ur(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class tt extends Error{}class nt extends Error{}const Dt="site-not-owned";async function Dn(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Tn(e,t=r=>fetch(r),n,o){const r=xe({endpoint:e,fetch:async s=>{const i=new Request(s);for(const[l,c]of Object.entries(ue("v8")))i.headers.set(l,c);const a=await t(i);if(await Dn(a))throw new nt;if(await _e(a))throw n?.(),new Ne;return a}});try{const s=await Le(r,be(o)?{schema:o}:void 0);return s.v8Schema?s:null}catch(s){if(s instanceof nt)return Dt;throw s}}const Ae=5e3;function In(e){return new URL(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/rpc`,window.location.origin).href}function Cn(e){return new URL(de(e,"rpc"),window.location.origin).href}async function Le(e,t){const[n,o]=await e.batch(t?[{method:"describe"}]:[{method:"describe"},{method:"schema.get"}]);if(!n?.ok)throw n?.error??new Error("no describe");if(n.result?.protocol!==Z)throw new $e;const s=gt(n.result);if(t)return{client:e,describe:s,hasSchema:t.schema!=null,v8Schema:be(t.schema)};if(!o)throw new Error("no schema.get");if(Ot(o))return{client:e,describe:s,hasSchema:!1,v8Schema:!1};if(o.ok){const i=o.result;return{client:e,describe:s,hasSchema:!0,v8Schema:be(i?.schema)}}throw o.error}async function _n(e,t=n=>fetch(n)){const n=xe({endpoint:e,fetch:async o=>{const r=await t(o);if(r.status===404)throw new tt;return r}});try{const o=await Le(n);return o.v8Schema?o:null}catch(o){if(o instanceof tt)return null;throw o}}function Tt(e,t){const n=P.c(53),{org:o}=qt(),{connection:r,undecided:s}=mn(e),{runtime:i}=dt(e),a=j.useContext(yt),l=Re(a?null:e),c=tn(e),u=Et({hasServeConnection:!!r,runtime:i}),d=rn()?.taskId??null,g=sn(an().lifecycle.phase),f=z(),v=wn({mode:u,mainSchema:l,workingTreeReady:g}),b=v.github&&!!o.slug&&!!e&&!!t;let w;n[0]!==t||n[1]!==o.slug||n[2]!==f||n[3]!==e?(w=()=>Tn(In({orgSlug:o.slug,virtualMcpId:e,branch:t}),void 0,()=>Ce(f,o.slug,e),lt(f,o.slug,e)?.schema),n[0]=t,n[1]=o.slug,n[2]=f,n[3]=e,n[4]=w):w=n[4];const I=M({queryKey:h.contentBackend(o.slug,e??"",t??"","github"),queryFn:w,enabled:b,staleTime:Number.POSITIVE_INFINITY,...ot}),T=v.sandbox&&!!o.slug&&!!e&&!!t;let x;n[5]!==t||n[6]!==o.slug||n[7]!==d||n[8]!==e?(x=async()=>_n(Cn({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:d})),n[5]=t,n[6]=o.slug,n[7]=d,n[8]=e,n[9]=x):x=n[9];const _=M({queryKey:h.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:x,enabled:T,staleTime:Number.POSITIVE_INFINITY,...ot}),C=!!r;let E;n[10]!==r?.endpoint||n[11]!==o.slug||n[12]!==e?(E=h.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[10]=r?.endpoint,n[11]=o.slug,n[12]=e,n[13]=E):E=n[13];let k;n[14]!==r?(k=()=>Le(xe({endpoint:r.endpoint})),n[14]=r,n[15]=k):k=n[15];let N;n[16]!==C||n[17]!==E||n[18]!==k?(N={queryKey:E,queryFn:k,enabled:C,staleTime:Number.POSITIVE_INFINITY,retry:xn,retryDelay:Rn,refetchInterval:Nn},n[16]=C,n[17]=E,n[18]=k,n[19]=N):N=n[19];const p=M(N);let O;n[20]!==r?.endpoint||n[21]!==o.slug||n[22]!==e?(O=h.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[20]=r?.endpoint,n[21]=o.slug,n[22]=e,n[23]=O):O=n[23];const $=O;let y;n[24]!==r?.endpoint||n[25]!==o.slug||n[26]!==e?(y=h.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[24]=r?.endpoint,n[25]=o.slug,n[26]=e,n[27]=y):y=n[27];let R;n[28]!==p.data||n[29]!==$||n[30]!==f?(R=async()=>{try{return await p.data.client.describe()}catch(m){const Y=m;throw f.invalidateQueries({queryKey:$,exact:!0},{cancelRefetch:!1}),Y}},n[28]=p.data,n[29]=$,n[30]=f,n[31]=R):R=n[31];const A=!!p.data&&!a;let U;n[32]!==y||n[33]!==R||n[34]!==A?(U={queryKey:y,queryFn:R,enabled:A,refetchInterval:Ae,retry:!1},n[32]=y,n[33]=R,n[34]=A,n[35]=U):U=n[35];const V=M(U).data??p.data?.describe,L=bn({hasProject:!!e,hasServeConnection:!!r,serveConnectionUndecided:s,runtime:i,mainSchema:l,githubSite:I.data===Dt?"not-owned":I.data?"v8":I.data===null?"v7":qe(I)?"error":"loading",sandboxSite:Pn({data:_.data,isError:qe(_),workingTreeReady:g}),markedV8:c});if(L==="pending"){let m;return n[36]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending"},n[36]=m):m=n[36],m}if(L==="retrying-github"){let m;return n[37]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"github"},n[37]=m):m=n[37],m}if(L==="retrying-sandbox"){let m;return n[38]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"sandbox"},n[38]=m):m=n[38],m}if(L==="legacy"){let m;return n[39]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"legacy"},n[39]=m):m=n[39],m}if(L==="protocol-github"){const m=I.data;let Y;return n[40]!==m?(Y=ke("github",m,""),n[40]=m,n[41]=Y):Y=n[41],Y}if(L==="site-not-owned-github"){let m;return n[42]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github",siteNotOwned:!0},n[42]=m):m=n[42],m}if(L==="protocol-sandbox"){let m;return n[43]!==_.data?(m=ke("sandbox",_.data,":sandbox"),n[43]=_.data,n[44]=m):m=n[44],m}if(L==="unavailable-github"){let m;return n[45]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github"},n[45]=m):m=n[45],m}const W=p.error??p.failureReason,ve=r?.endpoint??"";let te;return n[46]!==V||n[47]!==p.data||n[48]!==p.failureCount||n[49]!==p.isError||n[50]!==W||n[51]!==ve?(te=An({probed:p.data,isError:p.isError,failureCount:p.failureCount,failure:W,describe:V,endpoint:ve}),n[46]=V,n[47]=p.data,n[48]=p.failureCount,n[49]=p.isError,n[50]=W,n[51]=ve,n[52]=te):te=n[52],te}function Nn(e){return e.state.status==="error"||e.state.data?.v8Schema===!1?Ae:!1}function Rn(e){return hn(e+1)}function xn(e,t){return!(t instanceof D)&&!(t instanceof $e)}function Pn(e){return e.data!==void 0?e.data?"v8":"v7":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const $n=3;function An(e){if(e.probed?.hasSchema&&!e.probed.v8Schema)return{kind:"unavailable",source:"local",problem:{reason:"not-v8"}};const t=e.probed?ke("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<$n?t:{kind:"unavailable",source:"local",problem:vn(e.failure)}:t??{kind:"pending"}}const ot={retry:2,refetchInterval:e=>e.state.status==="error"?Ae:!1};function ke(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema}}function It(e){const t=P.c(13);let n;t[0]!==e?(n=pe.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=Kt(o,null),i=Re(e);let a;if(t[2]!==i||t[3]!==r||t[4]!==e){const g=e?Ge(r):null;a=Ln({saved:g,main:i}),t[2]=i,t[3]=r,t[4]=e,t[5]=a}else a=t[5];const l=a;let c,u;t[6]!==s?(c=g=>s(Ge(g)),u=()=>s(null),t[6]=s,t[7]=c,t[8]=u):(c=t[7],u=t[8]);let d;return t[9]!==l||t[10]!==c||t[11]!==u?(d={...l,setUrl:c,clear:u},t[9]=l,t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function Ln(e){return e.saved?e.main==="v7"?{url:e.saved,undecided:!1}:e.main==="v8"?{url:null,undecided:!1}:{url:null,undecided:!0}:{url:null,undecided:!1}}function jn(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function rt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}class je extends Error{constructor(t,n,o=[],r=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=r,this.name="BlockConflictError"}blocks;fields;carriedStored}function Ue(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function fe(e,t,n){return["decofile-write",e,t,n]}function Un(e,t,n){return{id:fe(e,t,n).join(":")}}function Me(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function Mn(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function Fn(e,t,n){e.setQueryData(h.decofileDraft(Ue(t)),n)}function Qn(e,t){return e.getQueryData(h.decofileDraft(Ue(t)))??null}async function Bn(e,t){const n=await fetch(Me(e),{cache:"no-store",headers:{...ue("v7"),"if-none-match":`"${t}"`}}).catch(()=>null);return n?.status===200||n?.status===409}function dr(e){const t=P.c(4);let n;t[0]!==e?(n=h.decofileDraft(e?Ue(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Vn,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=M(o);return r??null}async function Vn(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Hn(e,t){const n=await fetch(Me(t),{cache:"no-store",headers:ue("v7")});if(await _e(n))throw Ce(e,t.orgSlug,t.virtualMcpId),new Ne;if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&Fn(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function fr(e,t){const n=await fetch(Me(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new je(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return Mn(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Ct=3e3,Gn=15e3,Jn=2*6e4,_t={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function Wn(e){return e<Jn?Ct:Gn}function Yn(e,t=_t){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,Wn(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:l,skip:c}=e();if(r||t.hidden()||c?.()){i();return}r=!0;let u;try{u=l()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const st=()=>0;function zn(e,t,n=_t){const o=j.useRef(t);o.current=t;const[r]=j.useState(()=>({polling:()=>Yn(()=>o.current,n),idle:()=>()=>{}}));j.useSyncExternalStore(e?r.polling:r.idle,st,st)}function Nt(e,t){return de(e,t)}function Xn(e,t){return de(e,"preview-fetch",{path:t})}function hr(e){return Nt(e,"preview-invoke")}function gr(e){return Nt(e,"catalog-invoke")}function Rt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function Zn(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&Rt(n))return n}return null}function qn(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Zn();return n&&Rt(n)?new URL(t,n).toString():Xn(e,t)}function Kn(e){return qn(e,"/.decofile")}function eo(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function it(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function to(e,t){const n=de(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=eo(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:nn(s.content)}}async function no(e,t){const n=await to(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function vr(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function oo(e){return on(e)?.metadata?.runtime?.path??null}class xt extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function mr(e){return e instanceof D&&e.code===S.Conflict}function Pt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class Fe extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class Qe extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function pr(e,t){return(t instanceof Fe||t instanceof Qe)&&(t.message=$t(e,t,"github")),t}function $t(e,t,n){if(t instanceof Fe)return e("siteEditor.save.draftUnread");if(t instanceof Qe)return e("siteEditor.save.keptChanging");if(t instanceof je)return t.message;if(n==="local")return so(e,t);if(t instanceof D)switch(t.code){case S.Conflict:return e("siteEditor.save.conflict");case S.ReadOnly:return e("siteEditor.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("siteEditor.save.invalid");case S.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function ro(e,t){if(t==="local"||e instanceof je||e instanceof Fe||e instanceof Qe)return null;if(e instanceof D){const n=e.code===S.InvalidBlock||e.code===S.InvalidParams?Pt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function so(e,t){if(t instanceof xt)return e("decoServe.save.serverGone");if(t instanceof D)switch(t.code){case S.Conflict:return e("decoServe.save.conflict");case S.ReadOnly:return e("decoServe.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("decoServe.save.invalid",{detail:Pt(t)});case S.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function io(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function ao(e,t){const[n,o]=j.useState(e),r=j.useRef(null);return e&&!n&&o(!0),j.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=io(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const co="decocms:content-writes",Oe=new Set;let H;function At(){if(H!==void 0)return H;H=null;try{typeof BroadcastChannel=="function"&&(H=new BroadcastChannel(co),H.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Oe])n(t)}))}catch{H=null}return H}function lo(e){try{At()?.postMessage({cacheKey:e})}catch{}}function uo(e){return At(),Oe.add(e),()=>{Oe.delete(e)}}const Lt={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},fo=15e3,ae=new Map;function J(e,t){return`${e}/${t}`}function Q(e){let t=ae.get(e);return t||(t={state:Lt,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ae.set(e,t)),t}function B(e,t){const n=Q(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function he(e){e.timer&&clearTimeout(e.timer),e.timer=null}function Be(e){return ae.get(e)?.state??Lt}function ho(e,t){const n=Q(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function br(e){const t=Q(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(he(t),B(e,{phase:"idle"}))}}function wr(e){const t=ae.get(e);!t||t.state.phase!=="reloading"||(he(t),B(e,{phase:"idle"}))}function jt(e){const t=Q(e);he(t),B(e,{phase:"saving",inFlight:t.state.inFlight+1})}function oe(e,t){const n=Q(e),o=Math.max(0,n.state.inFlight-1);if(o>0){B(e,{inFlight:o});return}if(!t.ok||n.previews===0){B(e,{phase:"idle",inFlight:o});return}Ut(e,t.navigates,o)}function Ut(e,t,n=0){const o=Q(e);he(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&B(e,{phase:"idle"})},fo),B(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function go(e){return e?.kind==="protocol"&&e.source==="github"}async function re(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,l=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:h.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await l,{navigates:!1};const c=s?h.protocolDraftRead(o,r,s):null,u=c?JSON.stringify(n.getQueryData(c)??null):null,d=l?[l]:[];if(a&&t.reread&&d.push(n.invalidateQueries({queryKey:h.decofile(a)})),a&&!t.adopted&&d.push(n.invalidateQueries({queryKey:h.contentChanges(a)})),s&&i.source==="sandbox"&&d.push(n.invalidateQueries({queryKey:cn(o,r,s)})),go(i)&&c&&!t.adopted&&d.push(n.invalidateQueries({queryKey:c})),await Promise.all(d),t.kind!=="edit"){const v=J(o,r);B(v,{epoch:Be(v).epoch+1})}const g=c?JSON.stringify(n.getQueryData(c)??null):null,f=u!==g;return f&&await new Promise(v=>ut.schedule(v)),{navigates:f}}async function vo(e,t){return jt(J(e.orgSlug,e.virtualMcpId)),Mt(e,t)}function at(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(h.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Mt(e,t){const n=J(e.orgSlug,e.virtualMcpId),o=t.adopted?at(e):null;let r;try{r=await t.write()}catch(i){throw oe(n,{ok:!1,navigates:!1}),t.refreshOnError&&re(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&lo(e.cacheKey),t.adopted){const i=at(e)!==o;return i&&await new Promise(a=>ut.schedule(a)),oe(n,{ok:!0,navigates:i}),t.reread&&re(e,t).catch(()=>{}),r}let s=!1;try{({navigates:s}=await re(e,t))}catch{}finally{oe(n,{ok:!0,navigates:s})}return r}function Sr(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=J(o,r),a=new Set(t.blockKeys);for(const u of[...Q(i).discardListeners])u(a);jt(i);let l=!1;const c=()=>(l=!0,Mt(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:fe(o,r,s),scope:Un(o,r,s),mutationFn:c}).execute(void 0).catch(u=>{throw l||oe(i,{ok:!1,navigates:!1}),u}):c()}function yr(e,t,n){const o=P.c(8);let r;o[0]!==e||o[1]!==t?(r=J(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const l=Q(s).discardListeners;return l.add(n),()=>{l.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],j.useEffect(i,a)}function mo(e){const t=J(e.orgSlug,e.virtualMcpId);Be(t).inFlight>0||re(e,{kind:"external"}).then(({navigates:n})=>{const o=Q(t);o.previews>0&&o.state.inFlight===0&&Ut(t,n)}).catch(()=>{})}function po(e,t){const n=P.c(7);let o;n[0]!==e||n[1]!==t?(o=J(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=c=>ho(r,c),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>Be(r),n[5]=r,n[6]=a):a=n[6];const l=a;return j.useSyncExternalStore(i,l,l)}const bo=500;function Er(e,t){const{phase:n}=po(e,t);return ao(n!=="idle",bo)}function wo(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function So(e,t){return h.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function kr(e,t,n,o){if(o?.source==="github")return yo(e,t,n);const r=e.getQueryData(h.contentVersions(t));if(!r)return;if(Object.hasOwn(r,n))return r[n];const s=e.getQueryData(h.decofile(t));return s&&Object.hasOwn(s,n)?void 0:null}function K(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(r=>F(r)===n);return o===void 0?void 0:e.changes[o]}function yo(e,t,n){const o=e.getQueryData(h.contentChanges(t));if(o)return Ft(o,ge(e,t),n)}function Ft(e,t,n){const o=K(e,n);return o?.kind==="delete"?o.version??we:o?o.version:t.has(F(n))?we:null}function Or(e,t,n){const o=e.getQueryData(h.contentChanges(t));if(!o)return!1;const r=K(o,n);return r?r.kind==="set"&&r.baseVersion===null:ge(e,t).has(F(n))}function Dr(e,t){const n=e.getQueryData(h.decofile(t)),o=e.getQueryData(h.contentChanges(t));if(!n||!o)return null;const r=ge(e,t);return{blocks:n,versionOf:s=>Ft(o,r,s)}}function ge(e,t){return new Set(e.getQueryData(h.contentDraftTombstones(t)))}function ce(e,t,n,o){const r=F(n),s=ge(e,t);s.has(r)!==o&&(o?s.add(r):s.delete(r),ee(e),e.setQueryData(h.contentDraftTombstones(t),[...s]))}function Eo(e,t,n,o){const r=He(o.revision),s=e.getQueryData(h.contentRevision(n))?.revision,i=s?He(s):null,a=r&&!r.main&&i?en(i.main,r.draft):o.revision,l=e.getQueryData(h.contentVersions(n)),c=Object.entries(o.versions??{}).map(([f,v])=>[f,v===we?null:v]),u=e.getQueryData(h.contentChanges(n)),d=new Set(c.flatMap(([f])=>{const v=u?K(u,f):void 0;return(v?v.baseVersion:l?.[f]??null)===null?[f]:[]})),g=new Set(c.flatMap(([f,v])=>v===null?[]:[F(f)]));e.setQueryData(h.contentChanges(n),f=>{if(!f)return f;const v={...f.changes};for(const[b,w]of c){const I=K(f,b),T=I?I.baseVersion:l?.[b]??null;w!==null?v[b]={kind:"set",version:w,baseVersion:T}:T!==null?v[b]={kind:"delete",version:null,baseVersion:T}:delete v[b]}return{...f,changes:v,edited:!0}});for(const[f,v]of c)v!==null?ce(e,n,f,!1):!g.has(F(f))&&d.has(f)&&ce(e,n,f,!0);return r&&r.draft!=="none"&&e.setQueryData(h.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),f=>f&&{...f,version:r.draft}),a}function Ve(e,t,n){ee(e),e.setQueryData(h.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function ko(e,t){const n=e.getMutationCache().findAll({mutationKey:fe(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>yn(o.state.variables)))}function De(e,t){e.resetQueries({queryKey:h.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function le(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof D);throw t.source==="local"&&s?(De(e,n),new xt(r)):(t.source==="local"&&Pe(r)&&De(e,n),r)}}const se=new Map;function Qt(e,t,n,o){const r=se.get(o);if(r)return r;const s=Bt(e,t,n,o,!0);return se.set(o,s),s.finally(()=>se.delete(o))}const me=new Set;function Oo(e,t,n){const o=P.c(8),r=z(),s=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let l,c;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==s||o[4]!==r||o[5]!==i?(l=()=>{if(!e||!s||!i||!a)return;const u={orgSlug:s,virtualMcpId:i,branch:a};return uo(d=>{d===n&&(me.has(n)||(me.add(n),To(r,e,u,n).catch(Do).finally(()=>me.delete(n))))})},c=[r,e,s,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=s,o[4]=r,o[5]=i,o[6]=l,o[7]=c):(l=o[6],c=o[7]),j.useEffect(l,c)}function Do(){}async function To(e,t,n,o){const r=se.get(o);return r&&await r.catch(()=>{}),Qt(e,t,n,o)}async function Bt(e,t,n,o,r){ee(e);const s=h.decofile(o),i=So(n,t),a=h.contentRevision(o),l=h.contentVersions(o),c=e.getQueryData(s),u=e.getQueryData(l),d=e.getQueryData(i),g=e.getQueryData(a)??void 0,f=t.source==="github"&&!d?lt(e,n.orgSlug,n.virtualMcpId):void 0,v=f?.isV8&&f.schema&&f.version?f:void 0,b=d??v?.schema,w=v?{...g,schemaVersion:v.version}:g,I=r&&c&&u?w?.revision:void 0,T=r&&b?w?.schemaVersion:void 0,x=h.contentChanges(o),_=e.getQueryData(x),[C,E,k]=await le(e,t,n,()=>t.client.batch([{method:"blocks.list",params:I?{ifNoneMatch:I}:{}},{method:"schema.get",params:T?{ifNoneMatch:T}:{}},{method:"changes.list",params:vt(_)}])),N=e.getQueryData(a)?.revision,p=N!==void 0&&N!==w?.revision;if(k?.ok){const X=p?null:Ee(_,k.result);X&&e.setQueryData(x,X)}else k&&t.source==="local"&&Pe(k.error)&&De(e,n);if(!C?.ok)throw C?.error??new Error("no blocks.list");if(!E)throw new Error("no schema.get");const O=C.result,$=Ot(E),y=E.ok&&!$?E.result:null;if(O.notModified&&(!c||!u)||y?.notModified&&!b)return Bt(e,t,n,o,!1);const R=O.notModified?new Set:ko(e,n),A=O.notModified?c:Sn(O.blocks,c,R),U=$?En():y?y.notModified?b:y.schema:E.error;if(e.setQueryData(a,{revision:p?N:O.notModified?w?.revision:O.revision,schemaVersion:y?y.notModified?w?.schemaVersion:y.version??void 0:void 0}),e.setQueryData(s,A),!O.notModified){const X=e.getQueryData(l),V={...O.versions};for(const L of R){const W=X?.[L];W!==void 0?V[L]=W:delete V[L]}e.setQueryData(l,V)}return U instanceof D||e.setQueryData(i,U),!p&&!O.notModified&&c&&w?.revision&&O.revision!==w.revision&&mo({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:U}}async function Tr(e,t,n,o,r,s){if(t.source==="github"){const a=[...Object.keys(r.set??{}),...r.delete??[]].filter(l=>!s||!Object.hasOwn(s,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`)}return vo({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=await le(e,t,n,()=>t.client.blocksApply({set:r.set,delete:r.delete,...s?{ifMatch:s}:{}}));ee(e);const a=t.source==="github"?Eo(e,n,o,i):i.revision;e.setQueryData(h.contentRevision(o),c=>({...c,revision:a}));const l=i.versions??{};return Ve(e,o,l),{revision:a,versions:l}}})}function Vt(e,t){if(!(e instanceof D))return;const n=e.data?.draft;if(!n||typeof n!="object"||!Object.hasOwn(n,t))return;const o=n[t];return o&&typeof o.version=="string"?o:void 0}function Ht(e,t,n){if(!(n instanceof D))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[r,s]of Object.entries(o))s===null&&ce(e,t,r,!1)}function Gt(e,t,n,o){ee(e);const r=o.block===null,s=e.getQueryData(h.contentVersions(t)),i=e.getQueryData(h.contentChanges(t)),a=i?K(i,n):void 0,l=a?a.baseVersion:s?.[n]??null;if(i){const c=F(n),u=Object.fromEntries(Object.entries(i.changes).filter(([d])=>F(d)!==c));r?l!==null&&(u[n]={kind:"delete",version:null,baseVersion:l}):u[n]={kind:"set",version:o.version,baseVersion:l},e.setQueryData(h.contentChanges(t),{...i,changes:u,edited:!0})}ce(e,t,n,r&&l===null),e.setQueryData(h.decofile(t),c=>{const u={...c};return r?delete u[n]:u[n]=o.block,u}),Ve(e,t,{[n]:r?null:o.version})}function Ir(e,t,n,o){if(t.source!=="github"||!(o instanceof D))return!1;Ht(e,n,o);const r=o.data?.draft;if(!r||typeof r!="object")return!1;const s=Object.keys(r),i=s.map(a=>Vt(o,a));return s.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:h.decofile(n)}),s.forEach((a,l)=>{Gt(e,n,a,i[l])}),!0)}async function Cr(e,t,n,o,r,s){t.source==="github"&&Ht(e,o,s);const i=t.source==="github"?Vt(s,r):void 0;if(i)return e.cancelQueries({queryKey:h.decofile(o)}),Gt(e,o,r,i),!0;await e.invalidateQueries({queryKey:h.decofile(o)});let a;try{const c=(await le(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(c&&c.after===null&&c.version!==null)return!1;a={value:c?.after??null,version:c?.version??null},t.source==="github"&&e.setQueryData(h.contentChanges(o),u=>{if(!u)return u;const d={...u.changes};return c?.kind?d[r]={kind:c.kind,version:c.version,baseVersion:c.baseVersion}:delete d[r],{...u,changes:d,edited:!0}})}catch{const l=await le(e,t,n,()=>t.client.blocksList({}));if(l.notModified)return!1;a={value:l.blocks[r]??null,version:l.versions[r]??null}}return e.setQueryData(h.decofile(o),l=>{const c={...l};return a.value===null?delete c[r]:c[r]=a.value,c}),Ve(e,o,{[r]:a.version}),!1}function Io(e){const t=P.c(15),n=z();let o;t[0]!==e?.branch||t[1]!==e?.orgSlug||t[2]!==e?.virtualMcpId?(o=h.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[0]=e?.branch,t[1]=e?.orgSlug,t[2]=e?.virtualMcpId,t[3]=o):o=t[3];let r;t[4]!==e||t[5]!==n?(r=async()=>{const f=await fetch(`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`,{cache:"no-store",headers:ue("v8")});if(await _e(f))throw Ce(n,e.orgSlug,e.virtualMcpId),new Ne;if(!f.ok)throw new Error(`draft pointer read failed: ${f.status}`);return await f.json()},t[4]=e,t[5]=n,t[6]=r):r=t[6];const s=!!e;let i;t[7]!==o||t[8]!==r||t[9]!==s?(i={queryKey:o,queryFn:r,enabled:s,staleTime:Number.POSITIVE_INFINITY},t[7]=o,t[8]=r,t[9]=s,t[10]=i):i=t[10];const{data:a,isPending:l,isError:c}=M(i),u=!!e&&l&&!c;if(!e||!a?.draft||!a.version){let f;return t[11]!==u?(f={pointer:null,pending:u},t[11]=u,t[12]=f):f=t[12],f}const d=`${a.draft}@${a.version}`;let g;return t[13]!==d?(g={pointer:d,pending:!1},t[13]=d,t[14]=g):g=t[14],g}function _r(e){return Io(e).pointer}function Nr(e){const t=P.c(4);let n;t[0]!==e?(n=h.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Co,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=M(o);return r?.revision}async function Co(){throw new Error("content revisions are set by reads and writes")}function Te(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Rr(e,t){return Te({...e,protocolSuffix:t.cacheKeySuffix})}function _o(e,t){const n=P.c(6),{url:o}=It(e?.virtualMcpId),r=Tt(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?Te({...e,protocolSuffix:r.cacheKeySuffix}):Te({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function xr(e,t){const n=P.c(39),{url:o,undecided:r}=It(e?.virtualMcpId),s=!!o,i=Tt(e?.virtualMcpId,e?.branch),a=i.kind==="protocol"?i:null,l=_o(e),c=t?.fetchEnabled??!0,u=oo(e?.virtualMcpId),d=dt(e?.virtualMcpId).runtime==="cms",g=z();let f;n[0]!==l?(f=h.decofile(l),n[0]=l,n[1]=f):f=n[1];const v=f;Oo(a,a&&e?e:null,l);let b;n[2]!==e||n[3]!==g||n[4]!==v?(b=()=>{if(!e||g.isMutating({mutationKey:fe(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const p=g.getQueryState(v);return p?.fetchStatus==="fetching"||Date.now()-(p?.dataUpdatedAt??0)<Ct/2},n[2]=e,n[3]=g,n[4]=v,n[5]=b):b=n[5];let w;n[6]!==d||n[7]!==s||n[8]!==e||n[9]!==a||n[10]!==g||n[11]!==v?(w=async()=>{if(e){if(!a&&d&&!s){const p=Qn(g,e)?.version;if(p&&!await Bn(e,p))return}await g.refetchQueries({queryKey:v,exact:!0},{cancelRefetch:!1})}},n[6]=d,n[7]=s,n[8]=e,n[9]=a,n[10]=g,n[11]=v,n[12]=w):w=n[12];let I;n[13]!==b||n[14]!==w?(I={skip:b,read:w},n[13]=b,n[14]=w,n[15]=I):I=n[15],zn(!!t?.pollWhile&&!!e,I);let T;n[16]!==i.kind||n[17]!==d||n[18]!==c||n[19]!==l||n[20]!==s||n[21]!==o||n[22]!==u||n[23]!==e||n[24]!==a||n[25]!==g?(T=async()=>{if(a)return(await Qt(g,a,e,l)).blocks;if(i.kind==="unavailable")throw wo("decofile");if(s){const y=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(xo),R=y?.ok?rt(await y.text()):null;if(R)return R;const A=new Error("decofile unavailable (local tunnel unreachable)");throw A.status=502,A}if(d)return Hn(g,e);const p=()=>no(e,jn(u,".deco/blocks.gen.json"));if(c){const y=await fetch(Kn(e),{cache:"no-store"}).catch(Ro);if(y?.ok){const U=rt(await y.text());if(U)return U}const R=await p();if(R.kind==="data")return R.data;const A=new Error(`Failed to fetch decofile: ${y?.status??"network error"}`);throw A.status=it({liveOk:!!y?.ok,liveStatus:y?.status,committedAbsent:R.kind==="absent"}),A}const O=await p();if(O.kind==="data")return O.data;const $=new Error("decofile unavailable (preview down, no committed snapshot)");throw $.status=it({liveOk:!1,committedAbsent:O.kind==="absent"}),$},n[16]=i.kind,n[17]=d,n[18]=c,n[19]=l,n[20]=s,n[21]=o,n[22]=u,n[23]=e,n[24]=a,n[25]=g,n[26]=T):T=n[26];const x=!!e&&i.kind!=="pending"&&!r,_=a?0:3e4,C=a?.describe.pollIntervalMs,E=a?"always":void 0;let k;n[27]!==d||n[28]!==s||n[29]!==a?(k=(p,O)=>{if(a||d||s)return p<3;const $=O.status;return $!==502&&$!==404&&p<2},n[27]=d,n[28]=s,n[29]=a,n[30]=k):k=n[30];let N;return n[31]!==v||n[32]!==T||n[33]!==x||n[34]!==_||n[35]!==C||n[36]!==E||n[37]!==k?(N={queryKey:v,queryFn:T,enabled:x,staleTime:_,refetchInterval:C,refetchIntervalInBackground:!1,refetchOnWindowFocus:E,retry:k,retryDelay:No},n[31]=v,n[32]=T,n[33]=x,n[34]=_,n[35]=C,n[36]=E,n[37]=k,n[38]=N):N=n[38],M(N)}function No(e){return ln(5e3,1e3,e,2,0)}function Ro(){return null}function xo(){return null}const Po="site-editor-save",Jt={id:Po,description:void 0,action:void 0,cancel:void 0},Pr="site-editor-undo",Ie="site-editor-publish";function $o(e){const t=P.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=G.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=G.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=G.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function Wt(e,t){return t?G.jsx($o,{label:e("siteEditor.details"),detail:t}):void 0}function $r(e,t,n){q.error($t(e,t,n),{...Jt,description:Wt(e,ro(t,n))})}function Ar(e,t,n=!1){q.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Jt,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Yt={action:void 0,duration:void 0};function Lr(e,t){q.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Yt,id:Ie,description:void 0})}function jr(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=Wt(e,o??null);q[i](t,{id:Ie,description:n&&a?G.jsxs(G.Fragment,{children:[G.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:l=>{l.preventDefault(),q.loading(s??e("thread.publishPopover.publishing"),{...Yt,id:Ie,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function Ur(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Dr as $,br as A,po as B,wr as C,_o as D,Nr as E,Un as F,fe as G,vo as H,to as I,Mn as J,Ar as K,Or as L,pr as M,je as N,mr as O,To as P,Fe as Q,Tr as R,er as S,yt as T,Cr as U,$r as V,kr as W,So as X,Fn as Y,fr as Z,yr as _,nr as a,rr as a0,lr as a1,Ke as a2,et as a3,ur as a4,tr as a5,qn as a6,ar as a7,Rr as a8,gn as a9,S as aA,gr as aB,Wt as aa,Ur as ab,Lr as ac,Sr as ad,Jo as ae,Wo as af,Pe as ag,zo as ah,dn as ai,$o as aj,Yo as ak,Qt as al,wo as am,vr as an,no as ao,Qe as ap,Ir as aq,dr as ar,_r as as,jr as at,Ie as au,Yt as av,Pr as aw,Jt as ax,ko as ay,D as az,mn as b,It as c,hn as d,Ko as e,vn as f,Le as g,xe as h,pt as i,hr as j,Xn as k,xr as l,or as m,cr as n,oo as o,Xo as p,jn as q,qo as r,Zo as s,Et as t,Tt as u,ir as v,Er as w,sr as x,Io as y,J as z};
@@ -1 +1 @@
1
- import{b as te,a4 as se,q as ae,r as M,ad as ce,j as t,B as H,n as $,bA as de,a5 as me,aS as ue,aR as pe,aO as ge,aM as fe,aN as he,aQ as xe,aP as je,bl as ke,t as D,aD as ve,c as ie,l as ye,Z as Se,V as be,Y as we,X as Ce,K as q,gn as De}from"./index-C4tYnNih.js";import{i as Ne}from"./DotsVertical-D9231JAc.js";import{i as le,a as Pe}from"./ZoomOut-CnbxUNSo.js";import{s as Ae}from"./Trash01-C9E8l_mI.js";import{i as Ee}from"./Upload01-mlw10ZK-.js";import{S as Me}from"./search-input-CM9T7koR.js";import{S as Te}from"./search-toggle-BA_oiAdj.js";import{E as V}from"./empty-state-D86P1Giw.js";import{C as Oe}from"./collection-tabs-x8ccQUAC.js";import{p as Ie,S as Re,F as ze}from"./folder-icon-C25vLo5g.js";import{h as Fe,i as $e,r as _e}from"./use-org-fs-Dt6mQNyr.js";import{S as Le,H as Z,f as Be}from"./location-V0VwTJTt.js";import"./SearchMd-5lGv5a5H.js";import"./icon-button-5JlhYc9R.js";import"./tooltip-B1eS9Khq.js";import"./index-B0Hb2bUK.js";import"./badge-Ckz5LqgP.js";import"./markdown-C-J5-sTt.js";import"./use-copy-C9NYM8DB.js";import"./Copy01-B9x501ud.js";import"./use-mobile-BADuLdb7.js";import"./use-panel-navigate-DZO4-0o6.js";import"./thread-route-_-Jo9yAq.js";import"./use-project-scope-CKNjz3VB.js";import"./repository-binding-C7GXruB1.js";import"./use-mcp-client-BkBWhGyj.js";import"./auth-Dqt9menC.js";import"./file-preview-CX5xfaHR.js";import"./utils-wTX1Gyo-.js";import"./Image01-ClayPF_a.js";import"./editor-BTovmEAS.js";import"./file-type-icon-tAeiI9_2.js";import"./useInfiniteQuery-CtWUiDbh.js";import"./infiniteQueryObserver-CyNcT3qz.js";const J=200,Ke=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Qe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!Ke.has(e))}function qe(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function He(s,e){const l=new Map;for(const r of s){const c=G(r).split("/");c.pop();const a=["skills",e,...c].join("/");l.set(a,[...l.get(a)??[],r])}return l}async function Ge(s,e){const r=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(r)throw r.reason}function Ue(s,e){const l=Ie(e),r=`skills/${s}`;return{id:`home/${r}`,name:l.name??s,description:l.description,disableModelInvocation:l.disableModelInvocation,source:"home",volume:Z,path:r,sandboxPath:`${Le}/${Z}/${r}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const l=s.indexOf(":");return l===-1?{label:e,glyph:le}:{label:s.slice(l+1),glyph:s.startsWith("repo:")?ve:Pe}}function Xe(s){const e=ie.c(48),{entry:l,pending:r,onOpen:c,onDelete:a}=s,o=te(),{org:m}=se();let S;e[0]!==l.source||e[1]!==m.name?(S=re(l.source,m.name),e[0]=l.source,e[1]=m.name,e[2]=S):S=e[2];const{label:T,glyph:O}=S;let I;e[3]!==l?(I=B(l),e[3]=l,e[4]=I):I=e[4];const z=I,R=r?"opacity-60":"hover:bg-accent";let u;e[5]!==R?(u=ye("relative transition-colors group overflow-hidden flex flex-col h-full",R),e[5]=R,e[6]=u):u=e[6];let f;e[7]!==l.name||e[8]!==c||e[9]!==r?(f=!r&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":l.name}),e[7]=l.name,e[8]=c,e[9]=r,e[10]=f):f=e[10];const b=z?"default":"system",N=!z;let w;e[11]!==O||e[12]!==b||e[13]!==N?(w=t.jsx(ze,{glyph:O,tone:b,readOnly:N,className:"size-8 shrink-0"}),e[11]=O,e[12]=b,e[13]=N,e[14]=w):w=e[14];let h;e[15]!==a||e[16]!==o?(h=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(Se,{children:[t.jsx(be,{asChild:!0,children:t.jsx(H,{variant:"ghost",size:"icon",children:t.jsx(Ne,{size:16})})}),t.jsx(we,{align:"end",children:t.jsxs(Ce,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ae,{size:16}),o("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=o,e[17]=h):h=e[17];let x;e[18]!==w||e[19]!==h?(x=t.jsxs("div",{className:"flex items-start justify-between",children:[w,h]}),e[18]=w,e[19]=h,e[20]=x):x=e[20];let j;e[21]!==l.name?(j=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.name}),e[21]=l.name,e[22]=j):j=e[22];let C;e[23]!==l.description||e[24]!==o?(C=l.description||o("settings.skills.noDescription"),e[23]=l.description,e[24]=o,e[25]=C):C=e[25];let k;e[26]!==C?(k=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:C}),e[26]=C,e[27]=k):k=e[27];let d;e[28]!==j||e[29]!==k?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[j,k]}),e[28]=j,e[29]=k,e[30]=d):d=e[30];let v;e[31]!==x||e[32]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,d]}),e[31]=x,e[32]=d,e[33]=v):v=e[33];let p;e[34]!==T||e[35]!==r||e[36]!==o?(p=r?o("settings.skills.importing"):T,e[34]=T,e[35]=r,e[36]=o,e[37]=p):p=e[37];let y;e[38]!==p?(y=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p})})}),e[38]=p,e[39]=y):y=e[39];let g;e[40]!==v||e[41]!==y?(g=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[v,y]}),e[40]=v,e[41]=y,e[42]=g):g=e[42];let P;return e[43]!==r||e[44]!==g||e[45]!==u||e[46]!==f?(P=t.jsxs(De,{size:"flush","aria-busy":r,className:u,children:[f,g]}),e[43]=r,e[44]=g,e[45]=u,e[46]=f,e[47]=P):P=e[47],P}function ee(s){const e=ie.c(2),{children:l}=s;let r;return e[0]!==l?(r=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:l}),e[0]=l,e[1]=r):r=e[1],r}function At(){const s=te(),{org:e}=se(),l=Fe(),{remove:r,upload:c}=$e("home"),a=ae(),o=M.useRef(null),[m,S]=M.useState(""),T=ce(),[O,I]=M.useState(L),[z,R]=M.useState(!1),[u,f]=M.useState(null),[b,N]=M.useState(null),[w,h]=M.useState(null),x=()=>{a.invalidateQueries({queryKey:q.slashSkills(e.id)}),a.invalidateQueries({queryKey:q.orgFsSkills(e.id)})},j=i=>a.setQueryData(q.slashSkills(e.id),n=>i(n??[]));async function C(i){const n=[...i??[]];if(o.current&&(o.current.value=""),n.length===0)return;const A=n[0]?.webkitRelativePath??"";if(!A){D.error(s("settings.skills.importNeedsFolder"));return}const Q=A.split("/")[0]??"",_=n.filter(Qe),X=_.find(E=>G(E)==="SKILL.md");if(!X){D.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){D.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const F=qe(Q),W=`skills/${F}`;let Y=!1;R(!0);try{if(await _e(e.slug,"home",W)){D.error(s("settings.skills.importSlugTaken",{slug:F}));return}Y=!0;const E=Ue(F,await X.text());j(oe=>[E,...oe]),h(E.id),await Ge(He(_,F),c.mutateAsync),D.success(s("settings.skills.importSuccess",{name:F}))}catch(E){Y&&await r.mutateAsync(W).catch(()=>{}),D.error(E instanceof Error?E.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=m.toLowerCase(),d=(l.data??[]).filter(i=>i.name.toLowerCase().includes(k)||(i.description??"").toLowerCase().includes(k)).sort((i,n)=>Number(B(n))-Number(B(i))||i.name.localeCompare(n.name)),v=new Set((l.data??[]).map(i=>i.source)),p=new Map;for(const i of d)p.set(i.source,(p.get(i.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:d.length},...[...v].map(i=>({id:i,label:re(i,e.name).label,count:p.get(i)??0}))],g=v.has(O)?O:L,P=g===L?d:d.filter(i=>i.source===g),K=i=>f(Be(i.volume,i.path)),ne=async()=>{if(!b)return;const{id:i,path:n}=b;N(null),j(A=>A.filter(Q=>Q.id!==i));try{await r.mutateAsync(n),D.success(s("settings.skills.deleteSuccess"))}catch(A){D.error(A instanceof Error?A.message:s("settings.skills.deleteError"))}finally{x()}},U=t.jsxs(H,{size:"sm",disabled:z,onClick:()=>o.current?.click(),children:[t.jsx(Ee,{size:14}),s(z?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs($,{children:[t.jsx($.Content,{children:t.jsx($.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[T?t.jsx($.Actions,{secondary:t.jsx(Te,{value:m,onChange:S,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:U}):t.jsx($.Title,{actions:U,children:s("settings.skills.pageTitle")}),t.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 empty:hidden",children:!T&&t.jsx(Me,{value:m,onChange:S,placeholder:s("settings.skills.searchPlaceholder"),className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(S(""),i.target.blur())}})}),t.jsx("input",{ref:o,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:i=>{C(i.target.files)}}),y.length>2&&t.jsx(Oe,{placement:"page",tabs:y,activeTab:g,onTabChange:I}),l.isPending?t.jsx("div",{className:"@container",children:t.jsx(ee,{children:Array.from({length:8},(i,n)=>t.jsx(de,{className:"h-[168px] rounded-xl"},n))})}):l.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(V,{image:t.jsx(me,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:l.error instanceof Error?l.error.message:s("settings.skills.errorDescription"),actions:t.jsx(H,{size:"sm",variant:"outline",onClick:()=>{l.refetch()},children:s("settings.skills.retry")})})}):P.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(V,{image:t.jsx(le,{size:48,className:"text-muted-foreground"}),title:s(m?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:m?s("settings.skills.noResultsDescription",{search:m}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(ee,{children:P.map(i=>{const n=i.id===w;return t.jsx(Xe,{entry:i,pending:n,onOpen:()=>K(i),onDelete:B(i)&&!n?()=>N(i):void 0},i.id)})})})]})})}),u&&t.jsx(Re,{skillPath:u,onClose:()=>f(null)},u),t.jsx(ue,{open:b!==null,onOpenChange:i=>!i&&N(null),children:t.jsxs(pe,{children:[t.jsxs(ge,{children:[t.jsx(fe,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(he,{children:s("settings.skills.deleteDialogDescription",{name:b?.name??""})})]}),t.jsxs(xe,{children:[t.jsx(je,{children:s("settings.skills.cancel")}),t.jsx(ke,{onClick:ne,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{At as default};
1
+ import{b as te,a4 as se,q as ae,r as M,ad as ce,j as t,B as H,n as $,bA as de,a5 as me,aS as ue,aR as pe,aO as ge,aM as fe,aN as he,aQ as xe,aP as je,bl as ke,t as D,aD as ve,c as ie,l as ye,Z as Se,V as be,Y as we,X as Ce,K as q,gn as De}from"./index-BJ9m9LNK.js";import{i as Ne}from"./DotsVertical-B50qkKfK.js";import{i as le,a as Pe}from"./ZoomOut-DTBYck8o.js";import{s as Ae}from"./Trash01-BqnutNRJ.js";import{i as Ee}from"./Upload01-CyyevXMg.js";import{S as Me}from"./search-input-N6CaOC_1.js";import{S as Te}from"./search-toggle-hVjf6-kQ.js";import{E as V}from"./empty-state-BpneGtoe.js";import{C as Oe}from"./collection-tabs-D6nWmqmK.js";import{p as Ie,S as Re,F as ze}from"./folder-icon-BZUD34gC.js";import{h as Fe,i as $e,r as _e}from"./use-org-fs-Bmjx4Cik.js";import{S as Le,H as Z,f as Be}from"./location-V0VwTJTt.js";import"./SearchMd-OqihyBBE.js";import"./icon-button-j3Ikexya.js";import"./tooltip-BP50pkvP.js";import"./index-Zaz397OF.js";import"./badge-Cd6N93gT.js";import"./markdown-BG06zpZJ.js";import"./use-copy-Dgppamoo.js";import"./Copy01-B6cJ_ygs.js";import"./use-mobile-CMu6UtqS.js";import"./use-panel-navigate-o6edpcRi.js";import"./thread-route-Dp-aglxM.js";import"./use-project-scope-2Tdoer5a.js";import"./repository-binding-5kMOX4dj.js";import"./use-mcp-client-Do4_ndrI.js";import"./auth-Dfomi5JO.js";import"./file-preview-Bvo7zdtc.js";import"./utils-muk7Isuo.js";import"./Image01-D6z5fxVv.js";import"./editor-BDmCsl05.js";import"./file-type-icon-CjiJpbk5.js";import"./useInfiniteQuery-Cq3QQD7o.js";import"./infiniteQueryObserver-CM3ITLPo.js";const J=200,Ke=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Qe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!Ke.has(e))}function qe(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function He(s,e){const l=new Map;for(const r of s){const c=G(r).split("/");c.pop();const a=["skills",e,...c].join("/");l.set(a,[...l.get(a)??[],r])}return l}async function Ge(s,e){const r=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(r)throw r.reason}function Ue(s,e){const l=Ie(e),r=`skills/${s}`;return{id:`home/${r}`,name:l.name??s,description:l.description,disableModelInvocation:l.disableModelInvocation,source:"home",volume:Z,path:r,sandboxPath:`${Le}/${Z}/${r}`}}const L="*";function B(s){return s.volume==="home"}function re(s,e){const l=s.indexOf(":");return l===-1?{label:e,glyph:le}:{label:s.slice(l+1),glyph:s.startsWith("repo:")?ve:Pe}}function Xe(s){const e=ie.c(48),{entry:l,pending:r,onOpen:c,onDelete:a}=s,o=te(),{org:m}=se();let S;e[0]!==l.source||e[1]!==m.name?(S=re(l.source,m.name),e[0]=l.source,e[1]=m.name,e[2]=S):S=e[2];const{label:T,glyph:O}=S;let I;e[3]!==l?(I=B(l),e[3]=l,e[4]=I):I=e[4];const z=I,R=r?"opacity-60":"hover:bg-accent";let u;e[5]!==R?(u=ye("relative transition-colors group overflow-hidden flex flex-col h-full",R),e[5]=R,e[6]=u):u=e[6];let f;e[7]!==l.name||e[8]!==c||e[9]!==r?(f=!r&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":l.name}),e[7]=l.name,e[8]=c,e[9]=r,e[10]=f):f=e[10];const b=z?"default":"system",N=!z;let w;e[11]!==O||e[12]!==b||e[13]!==N?(w=t.jsx(ze,{glyph:O,tone:b,readOnly:N,className:"size-8 shrink-0"}),e[11]=O,e[12]=b,e[13]=N,e[14]=w):w=e[14];let h;e[15]!==a||e[16]!==o?(h=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(Se,{children:[t.jsx(be,{asChild:!0,children:t.jsx(H,{variant:"ghost",size:"icon",children:t.jsx(Ne,{size:16})})}),t.jsx(we,{align:"end",children:t.jsxs(Ce,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ae,{size:16}),o("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=o,e[17]=h):h=e[17];let x;e[18]!==w||e[19]!==h?(x=t.jsxs("div",{className:"flex items-start justify-between",children:[w,h]}),e[18]=w,e[19]=h,e[20]=x):x=e[20];let j;e[21]!==l.name?(j=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.name}),e[21]=l.name,e[22]=j):j=e[22];let C;e[23]!==l.description||e[24]!==o?(C=l.description||o("settings.skills.noDescription"),e[23]=l.description,e[24]=o,e[25]=C):C=e[25];let k;e[26]!==C?(k=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:C}),e[26]=C,e[27]=k):k=e[27];let d;e[28]!==j||e[29]!==k?(d=t.jsxs("div",{className:"flex flex-col gap-1",children:[j,k]}),e[28]=j,e[29]=k,e[30]=d):d=e[30];let v;e[31]!==x||e[32]!==d?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,d]}),e[31]=x,e[32]=d,e[33]=v):v=e[33];let p;e[34]!==T||e[35]!==r||e[36]!==o?(p=r?o("settings.skills.importing"):T,e[34]=T,e[35]=r,e[36]=o,e[37]=p):p=e[37];let y;e[38]!==p?(y=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:p})})}),e[38]=p,e[39]=y):y=e[39];let g;e[40]!==v||e[41]!==y?(g=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[v,y]}),e[40]=v,e[41]=y,e[42]=g):g=e[42];let P;return e[43]!==r||e[44]!==g||e[45]!==u||e[46]!==f?(P=t.jsxs(De,{size:"flush","aria-busy":r,className:u,children:[f,g]}),e[43]=r,e[44]=g,e[45]=u,e[46]=f,e[47]=P):P=e[47],P}function ee(s){const e=ie.c(2),{children:l}=s;let r;return e[0]!==l?(r=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:l}),e[0]=l,e[1]=r):r=e[1],r}function At(){const s=te(),{org:e}=se(),l=Fe(),{remove:r,upload:c}=$e("home"),a=ae(),o=M.useRef(null),[m,S]=M.useState(""),T=ce(),[O,I]=M.useState(L),[z,R]=M.useState(!1),[u,f]=M.useState(null),[b,N]=M.useState(null),[w,h]=M.useState(null),x=()=>{a.invalidateQueries({queryKey:q.slashSkills(e.id)}),a.invalidateQueries({queryKey:q.orgFsSkills(e.id)})},j=i=>a.setQueryData(q.slashSkills(e.id),n=>i(n??[]));async function C(i){const n=[...i??[]];if(o.current&&(o.current.value=""),n.length===0)return;const A=n[0]?.webkitRelativePath??"";if(!A){D.error(s("settings.skills.importNeedsFolder"));return}const Q=A.split("/")[0]??"",_=n.filter(Qe),X=_.find(E=>G(E)==="SKILL.md");if(!X){D.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){D.error(s("settings.skills.importTooManyFiles",{count:String(_.length),max:String(J)}));return}const F=qe(Q),W=`skills/${F}`;let Y=!1;R(!0);try{if(await _e(e.slug,"home",W)){D.error(s("settings.skills.importSlugTaken",{slug:F}));return}Y=!0;const E=Ue(F,await X.text());j(oe=>[E,...oe]),h(E.id),await Ge(He(_,F),c.mutateAsync),D.success(s("settings.skills.importSuccess",{name:F}))}catch(E){Y&&await r.mutateAsync(W).catch(()=>{}),D.error(E instanceof Error?E.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=m.toLowerCase(),d=(l.data??[]).filter(i=>i.name.toLowerCase().includes(k)||(i.description??"").toLowerCase().includes(k)).sort((i,n)=>Number(B(n))-Number(B(i))||i.name.localeCompare(n.name)),v=new Set((l.data??[]).map(i=>i.source)),p=new Map;for(const i of d)p.set(i.source,(p.get(i.source)??0)+1);const y=[{id:L,label:s("settings.skills.filterAll"),count:d.length},...[...v].map(i=>({id:i,label:re(i,e.name).label,count:p.get(i)??0}))],g=v.has(O)?O:L,P=g===L?d:d.filter(i=>i.source===g),K=i=>f(Be(i.volume,i.path)),ne=async()=>{if(!b)return;const{id:i,path:n}=b;N(null),j(A=>A.filter(Q=>Q.id!==i));try{await r.mutateAsync(n),D.success(s("settings.skills.deleteSuccess"))}catch(A){D.error(A instanceof Error?A.message:s("settings.skills.deleteError"))}finally{x()}},U=t.jsxs(H,{size:"sm",disabled:z,onClick:()=>o.current?.click(),children:[t.jsx(Ee,{size:14}),s(z?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs($,{children:[t.jsx($.Content,{children:t.jsx($.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[T?t.jsx($.Actions,{secondary:t.jsx(Te,{value:m,onChange:S,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:U}):t.jsx($.Title,{actions:U,children:s("settings.skills.pageTitle")}),t.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 empty:hidden",children:!T&&t.jsx(Me,{value:m,onChange:S,placeholder:s("settings.skills.searchPlaceholder"),className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(S(""),i.target.blur())}})}),t.jsx("input",{ref:o,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:i=>{C(i.target.files)}}),y.length>2&&t.jsx(Oe,{placement:"page",tabs:y,activeTab:g,onTabChange:I}),l.isPending?t.jsx("div",{className:"@container",children:t.jsx(ee,{children:Array.from({length:8},(i,n)=>t.jsx(de,{className:"h-[168px] rounded-xl"},n))})}):l.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(V,{image:t.jsx(me,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:l.error instanceof Error?l.error.message:s("settings.skills.errorDescription"),actions:t.jsx(H,{size:"sm",variant:"outline",onClick:()=>{l.refetch()},children:s("settings.skills.retry")})})}):P.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(V,{image:t.jsx(le,{size:48,className:"text-muted-foreground"}),title:s(m?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:m?s("settings.skills.noResultsDescription",{search:m}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(ee,{children:P.map(i=>{const n=i.id===w;return t.jsx(Xe,{entry:i,pending:n,onOpen:()=>K(i),onDelete:B(i)&&!n?()=>N(i):void 0},i.id)})})})]})})}),u&&t.jsx(Re,{skillPath:u,onClose:()=>f(null)},u),t.jsx(ue,{open:b!==null,onOpenChange:i=>!i&&N(null),children:t.jsxs(pe,{children:[t.jsxs(ge,{children:[t.jsx(fe,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(he,{children:s("settings.skills.deleteDialogDescription",{name:b?.name??""})})]}),t.jsxs(xe,{children:[t.jsx(je,{children:s("settings.skills.cancel")}),t.jsx(ke,{onClick:ne,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{At as default};
@@ -1 +1 @@
1
- import{c as _,l as N,j}from"./index-C4tYnNih.js";import{T as k,R as z,a as D,b as S}from"./index-B8bCJ3Gm.js";function V(T){const e=_.c(41);let i,t,n,s,c,b,g,o,r,a;e[0]!==T?({className:i,defaultValue:t,value:a,min:b,max:g,onPointerDown:s,onKeyDown:n,thumbLabel:o,thumbValueText:r,...c}=T,e[0]=T,e[1]=i,e[2]=t,e[3]=n,e[4]=s,e[5]=c,e[6]=b,e[7]=g,e[8]=o,e[9]=r,e[10]=a):(i=e[1],t=e[2],n=e[3],s=e[4],c=e[5],b=e[6],g=e[7],o=e[8],r=e[9],a=e[10]);const d=b===void 0?0:b,u=g===void 0?100:g;let p;e[11]!==t||e[12]!==u||e[13]!==d||e[14]!==a?(p=Array.isArray(a)?a:Array.isArray(t)?t:[d,u],e[11]=t,e[12]=u,e[13]=d,e[14]=a,e[15]=p):p=e[15];const A=p;let f;e[16]!==i?(f=N("relative flex w-full touch-none items-center py-2 select-none data-[disabled]:opacity-50 data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",i),e[16]=i,e[17]=f):f=e[17];let m;e[18]!==s?(m=l=>{l.currentTarget.dataset.pointer="",s?.(l)},e[18]=s,e[19]=m):m=e[19];let h;e[20]!==n?(h=l=>{delete l.currentTarget.dataset.pointer,n?.(l)},e[20]=n,e[21]=h):h=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=N("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1"),e[22]=x):x=e[22];let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=j.jsx(k,{"data-slot":"slider-track",className:x,children:j.jsx(z,{"data-slot":"slider-range",className:N("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[23]=w):w=e[23];let v;if(e[24]!==A.length||e[25]!==o||e[26]!==r){let l;e[28]!==o||e[29]!==r?(l=(E,R)=>j.jsx(S,{"data-slot":"slider-thumb",...o!==void 0?{"aria-label":o}:{},...r!==void 0?{"aria-valuetext":r}:{},className:"relative block size-4 shrink-0 cursor-grab rounded-full bg-white shadow-edge transition-transform duration-150 after:absolute after:-inset-3 after:rounded-full after:content-[''] hover:scale-110 focus-ring in-data-pointer:outline-none! active:scale-110 active:cursor-grabbing disabled:pointer-events-none motion-reduce:transition-none"},R),e[28]=o,e[29]=r,e[30]=l):l=e[30],v=Array.from({length:A.length},l),e[24]=A.length,e[25]=o,e[26]=r,e[27]=v}else v=e[27];let y;return e[31]!==t||e[32]!==u||e[33]!==d||e[34]!==c||e[35]!==f||e[36]!==m||e[37]!==h||e[38]!==v||e[39]!==a?(y=j.jsxs(D,{"data-slot":"slider",defaultValue:t,value:a,min:d,max:u,className:f,...c,onPointerDown:m,onKeyDown:h,children:[w,v]}),e[31]=t,e[32]=u,e[33]=d,e[34]=c,e[35]=f,e[36]=m,e[37]=h,e[38]=v,e[39]=a,e[40]=y):y=e[40],y}export{V as S};
1
+ import{c as _,l as N,j}from"./index-BJ9m9LNK.js";import{T as k,R as z,a as D,b as S}from"./index-B7a1uePd.js";function V(T){const e=_.c(41);let i,t,n,s,c,b,g,o,r,a;e[0]!==T?({className:i,defaultValue:t,value:a,min:b,max:g,onPointerDown:s,onKeyDown:n,thumbLabel:o,thumbValueText:r,...c}=T,e[0]=T,e[1]=i,e[2]=t,e[3]=n,e[4]=s,e[5]=c,e[6]=b,e[7]=g,e[8]=o,e[9]=r,e[10]=a):(i=e[1],t=e[2],n=e[3],s=e[4],c=e[5],b=e[6],g=e[7],o=e[8],r=e[9],a=e[10]);const d=b===void 0?0:b,u=g===void 0?100:g;let p;e[11]!==t||e[12]!==u||e[13]!==d||e[14]!==a?(p=Array.isArray(a)?a:Array.isArray(t)?t:[d,u],e[11]=t,e[12]=u,e[13]=d,e[14]=a,e[15]=p):p=e[15];const A=p;let f;e[16]!==i?(f=N("relative flex w-full touch-none items-center py-2 select-none data-[disabled]:opacity-50 data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",i),e[16]=i,e[17]=f):f=e[17];let m;e[18]!==s?(m=l=>{l.currentTarget.dataset.pointer="",s?.(l)},e[18]=s,e[19]=m):m=e[19];let h;e[20]!==n?(h=l=>{delete l.currentTarget.dataset.pointer,n?.(l)},e[20]=n,e[21]=h):h=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=N("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1"),e[22]=x):x=e[22];let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=j.jsx(k,{"data-slot":"slider-track",className:x,children:j.jsx(z,{"data-slot":"slider-range",className:N("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[23]=w):w=e[23];let v;if(e[24]!==A.length||e[25]!==o||e[26]!==r){let l;e[28]!==o||e[29]!==r?(l=(E,R)=>j.jsx(S,{"data-slot":"slider-thumb",...o!==void 0?{"aria-label":o}:{},...r!==void 0?{"aria-valuetext":r}:{},className:"relative block size-4 shrink-0 cursor-grab rounded-full bg-white shadow-edge transition-transform duration-150 after:absolute after:-inset-3 after:rounded-full after:content-[''] hover:scale-110 focus-ring in-data-pointer:outline-none! active:scale-110 active:cursor-grabbing disabled:pointer-events-none motion-reduce:transition-none"},R),e[28]=o,e[29]=r,e[30]=l):l=e[30],v=Array.from({length:A.length},l),e[24]=A.length,e[25]=o,e[26]=r,e[27]=v}else v=e[27];let y;return e[31]!==t||e[32]!==u||e[33]!==d||e[34]!==c||e[35]!==f||e[36]!==m||e[37]!==h||e[38]!==v||e[39]!==a?(y=j.jsxs(D,{"data-slot":"slider",defaultValue:t,value:a,min:d,max:u,className:f,...c,onPointerDown:m,onKeyDown:h,children:[w,v]}),e[31]=t,e[32]=u,e[33]=d,e[34]=c,e[35]=f,e[36]=m,e[37]=h,e[38]=v,e[39]=a,e[40]=y):y=e[40],y}export{V as S};
@@ -1 +1 @@
1
- import{r as v,fd as K}from"./index-C4tYnNih.js";import{d as de,e as fe,f as U,g as ge,h as pe,i as be,j as ve,C as Y,k as he,l as y,m as me,n as xe,o as Ie,s as ye}from"./core.esm-B2cbbV3O.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Re(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Xe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=K.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function _e(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),R=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&R&&i(g)},[x,g,R,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:Re(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return K.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function je(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:R,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:P}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:X,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(P,X),S=!!T,_=S&&!R&&O(d)&&O(h),j=!w&&M,F=j&&_?oe:null,ie=_?F??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,G=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!G,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:P,setDraggableNodeRef:X,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(j&&!ve(Z)||!u)&&(S||G))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[y.Down,y.Right,y.Up,y.Left],Fe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case y.Down:r.top<d.top&&f.push(l);break;case y.Up:r.top>d.top&&f.push(l);break;case y.Left:r.left>d.left&&f.push(l);break;case y.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,R=d?.node.current;if(R&&g&&l&&d){const h=Ie(R).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:ye(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{_e as S,q as a,B as r,Fe as s,je as u,Xe as v};
1
+ import{r as v,fd as K}from"./index-BJ9m9LNK.js";import{d as de,e as fe,f as U,g as ge,h as pe,i as be,j as ve,C as Y,k as he,l as y,m as me,n as xe,o as Ie,s as ye}from"./core.esm-Bp5Q1Stg.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Re(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Xe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=K.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function _e(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),R=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&R&&i(g)},[x,g,R,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:Re(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return K.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function je(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:R,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:P}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:X,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(P,X),S=!!T,_=S&&!R&&O(d)&&O(h),j=!w&&M,F=j&&_?oe:null,ie=_?F??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,G=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!G,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:P,setDraggableNodeRef:X,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(j&&!ve(Z)||!u)&&(S||G))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[y.Down,y.Right,y.Up,y.Left],Fe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case y.Down:r.top<d.top&&f.push(l);break;case y.Up:r.top>d.top&&f.push(l);break;case y.Left:r.left>d.left&&f.push(l);break;case y.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,R=d?.node.current;if(R&&g&&l&&d){const h=Ie(R).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:ye(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{_e as S,q as a,B as r,Fe as s,je as u,Xe as v};
@@ -1 +1 @@
1
- import{b as A,a4 as B,r as v,j as e,n as x,hd as k,fT as E,fU as y,fV as a,hL as D,B as m,I as d,aS as z,aR as T,aO as O,aM as R,aQ as F,aP as M,bl as U,C,t as c,c as q}from"./index-C4tYnNih.js";import{D as $}from"./domain-settings-Cu3Pj63v.js";import{S as H}from"./switch-B3v6apDN.js";import{a as Q,b as V,c as G,d as J}from"./use-org-sso-CWvWEDQk.js";import{s as K}from"./Trash01-C9E8l_mI.js";import{R as W}from"./require-capability-DSeRbn1u.js";import"./badge-Ckz5LqgP.js";import"./select-BZ2tKCpr.js";import"./index-BdQq_4o_.js";import"./index-B0Hb2bUK.js";import"./ChevronUp-RlBkcpdd.js";import"./access-gate-BNOWXoYR.js";import"./capability-load-error-CRB9otZt.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:P}=Q(o.id,o.slug),f=V(o.id,o.slug),S=G(o.id,o.slug),b=J(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[g,p]=v.useState(!1),[I,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,_=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},w=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!u&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(u?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},L=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},N=async t=>{try{await b.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx($,{}),P?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!g&&e.jsx(E,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx(H,{checked:n.enforced,onCheckedChange:N,disabled:b.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(K,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:_,children:s("settings.orgSso.editConfigButton")})]})]})}),(!u||g)&&e.jsx(E,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(d,{id:"sso-issuer",placeholder:s("settings.orgSso.issuerUrlPlaceholder"),value:i.issuer,onChange:t=>l(r=>({...r,issuer:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx(d,{id:"sso-client-id",placeholder:s("settings.orgSso.clientIdPlaceholder"),value:i.clientId,onChange:t=>l(r=>({...r,clientId:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientSecretLabel"),description:g&&u?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(d,{id:"sso-client-secret",type:"password",placeholder:s("settings.orgSso.clientSecretPlaceholder"),value:i.clientSecret,onChange:t=>l(r=>({...r,clientSecret:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.emailDomainLabel"),description:s("settings.orgSso.emailDomainDescription"),action:e.jsx(d,{id:"sso-domain",placeholder:s("settings.orgSso.emailDomainPlaceholder"),value:i.domain,onChange:t=>l(r=>({...r,domain:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx(d,{id:"sso-scopes",placeholder:s("settings.orgSso.scopesPlaceholder"),value:i.scopes,onChange:t=>l(r=>({...r,scopes:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.discoveryEndpointLabel"),description:s("settings.orgSso.discoveryEndpointDescription"),action:e.jsx(d,{id:"sso-discovery",placeholder:s("settings.orgSso.discoveryEndpointPlaceholder"),value:i.discoveryEndpoint,onChange:t=>l(r=>({...r,discoveryEndpoint:t.target.value})),className:"w-[280px]"})}),e.jsxs(D,{children:[g&&e.jsx(m,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(m,{onClick:w,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(g?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(z,{open:I,onOpenChange:j,children:e.jsxs(T,{children:[e.jsx(O,{children:e.jsx(R,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(F,{children:[e.jsx(M,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx(U,{onClick:L,disabled:S.isPending,variant:"destructive",children:s("settings.orgSso.removeButton")})]})]})})]})}function ge(){const s=q.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(W,{capability:"org:manage",area:"security",children:e.jsx(X,{})}),s[0]=o):o=s[0],o}export{ge as default};
1
+ import{b as A,a4 as B,r as v,j as e,n as x,hd as k,fT as E,fU as y,fV as a,hL as D,B as m,I as d,aS as z,aR as T,aO as O,aM as R,aQ as F,aP as M,bl as U,C,t as c,c as q}from"./index-BJ9m9LNK.js";import{D as $}from"./domain-settings-CXb5s0he.js";import{S as H}from"./switch-DAskixZA.js";import{a as Q,b as V,c as G,d as J}from"./use-org-sso-C2CyZRUp.js";import{s as K}from"./Trash01-BqnutNRJ.js";import{R as W}from"./require-capability-d9R-dYdO.js";import"./badge-Cd6N93gT.js";import"./select-BwZ3fxwy.js";import"./index-BdQq_4o_.js";import"./index-Zaz397OF.js";import"./ChevronUp-PedQ2gd6.js";import"./access-gate-CQo9WEtv.js";import"./capability-load-error-BoUVRT1s.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:P}=Q(o.id,o.slug),f=V(o.id,o.slug),S=G(o.id,o.slug),b=J(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[g,p]=v.useState(!1),[I,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,_=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},w=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!u&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(u?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},L=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},N=async t=>{try{await b.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx($,{}),P?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!g&&e.jsx(E,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx(H,{checked:n.enforced,onCheckedChange:N,disabled:b.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(K,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:_,children:s("settings.orgSso.editConfigButton")})]})]})}),(!u||g)&&e.jsx(E,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(d,{id:"sso-issuer",placeholder:s("settings.orgSso.issuerUrlPlaceholder"),value:i.issuer,onChange:t=>l(r=>({...r,issuer:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx(d,{id:"sso-client-id",placeholder:s("settings.orgSso.clientIdPlaceholder"),value:i.clientId,onChange:t=>l(r=>({...r,clientId:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientSecretLabel"),description:g&&u?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(d,{id:"sso-client-secret",type:"password",placeholder:s("settings.orgSso.clientSecretPlaceholder"),value:i.clientSecret,onChange:t=>l(r=>({...r,clientSecret:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.emailDomainLabel"),description:s("settings.orgSso.emailDomainDescription"),action:e.jsx(d,{id:"sso-domain",placeholder:s("settings.orgSso.emailDomainPlaceholder"),value:i.domain,onChange:t=>l(r=>({...r,domain:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx(d,{id:"sso-scopes",placeholder:s("settings.orgSso.scopesPlaceholder"),value:i.scopes,onChange:t=>l(r=>({...r,scopes:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.discoveryEndpointLabel"),description:s("settings.orgSso.discoveryEndpointDescription"),action:e.jsx(d,{id:"sso-discovery",placeholder:s("settings.orgSso.discoveryEndpointPlaceholder"),value:i.discoveryEndpoint,onChange:t=>l(r=>({...r,discoveryEndpoint:t.target.value})),className:"w-[280px]"})}),e.jsxs(D,{children:[g&&e.jsx(m,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(m,{onClick:w,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(g?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(z,{open:I,onOpenChange:j,children:e.jsxs(T,{children:[e.jsx(O,{children:e.jsx(R,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(F,{children:[e.jsx(M,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx(U,{onClick:L,disabled:S.isPending,variant:"destructive",children:s("settings.orgSso.removeButton")})]})]})})]})}function ge(){const s=q.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(W,{capability:"org:manage",area:"security",children:e.jsx(X,{})}),s[0]=o):o=s[0],o}export{ge as default};
@@ -1,2 +1,2 @@
1
- import{t as Ye,n as ie,o as Ge,D as Qe,v as ze,w as Ze}from"./usage-stats-DtO_zGwF.js";import{r as p,g6 as Je,fY as we,g7 as et,g8 as j,g9 as te,j as I,bP as tt,ga as nt,gb as ne,gc as ot,gd as rt,ge as st,gf as it,gg as at,gh as lt,gi as Ce,gj as ct,c as H,U as ut,K as dt,gk as ft,gl as gt,gm as mt,b as pt,l as vt,h as ht}from"./index-C4tYnNih.js";import{g as bt,d as xt}from"./tool-namespace-cn6zTT0m.js";import{A as yt}from"./agent-icon-KvVT3fA8.js";var Hn=Ye;var Rt=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ae=Rt.join(","),Ie=typeof Element>"u",Q=Ie?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,J=!Ie&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n?.ownerDocument},ee=function(e,t){var o;t===void 0&&(t=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),s=r===""||r==="true",i=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ee(e.parentNode));return i},St=function(e){var t,o=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return o===""||o==="true"},Et=function(e,t,o){if(ee(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ae));return t&&Q.call(e,ae)&&r.unshift(e),r=r.filter(o),r},le=function(e,t,o){for(var r=[],s=Array.from(e);s.length;){var i=s.shift();if(!ee(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=le(l,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:i,candidates:c})}else{var d=Q.call(i,ae);d&&o.filter(i)&&(t||!e.includes(i))&&r.push(i);var u=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),g=!ee(u,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(u&&g){var h=le(u===!0?i.children:u.children,!0,o);o.flatten?r.push.apply(r,h):r.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return r},Te=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Pe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||St(e))&&!Te(e)?0:e.tabIndex},wt=function(e,t){var o=Pe(e);return o<0&&t&&!Te(e)?0:o},Ct=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ae=function(e){return e.tagName==="INPUT"},It=function(e){return Ae(e)&&e.type==="hidden"},Tt=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return t},Pt=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]},At=function(e){if(!e.name)return!0;var t=e.form||J(e),o=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Pt(r,e.form);return!s||s===e},Nt=function(e){return Ae(e)&&e.type==="radio"},Dt=function(e){return Nt(e)&&!At(e)},Mt=function(e){var t,o=e&&J(e),r=(t=o)===null||t===void 0?void 0:t.host,s=!1;if(o&&o!==e){var i,a,l;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&r;){var c,d,u;o=J(r),r=(c=o)===null||c===void 0?void 0:c.host,s=!!((d=r)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return s},ge=function(e){var t=e.getBoundingClientRect(),o=t.width,r=t.height;return o===0&&r===0},Ot=function(e,t){var o=t.displayCheck,r=t.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=Q.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(Q.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var c=e.parentElement,d=J(e);if(c&&!c.shadowRoot&&r(c)===!0)return ge(e);e.assignedSlot?e=e.assignedSlot:!c&&d!==e.ownerDocument?e=d.host:e=c}e=l}if(Mt(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return ge(e);return!1},Ft=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var o=0;o<t.children.length;o++){var r=t.children.item(o);if(r.tagName==="LEGEND")return Q.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},qt=function(e,t){return!(t.disabled||It(t)||Ot(t,e)||Tt(t)||Ft(t))},me=function(e,t){return!(Dt(t)||Pe(t)<0||!qt(e,t))},$t=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ne=function(e){var t=[],o=[];return e.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,l=wt(a,i),c=i?Ne(r.candidates):a;l===0?i?t.push.apply(t,c):t.push(a):o.push({documentOrder:s,tabIndex:l,item:r,isScope:i,content:c})}),o.sort(Ct).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(t)},De=function(e,t){t=t||{};var o;return t.getShadowRoot?o=le([e],t.includeContainer,{filter:me.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$t}):o=Et(e,t.includeContainer,me.bind(null,t)),Ne(o)};function kt(){return/apple/i.test(navigator.vendor)}const pe="data-floating-ui-focusable";function _t(n){let e=n.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function ce(n,e){if(!n||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(n.contains(e))return!0;if(t&&Je(t)){let o=e;for(;o;){if(n===o)return!0;o=o.parentNode||o.host}}return!1}function G(n){return"composedPath"in n?n.composedPath()[0]:n.target}function oe(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function Lt(n){return n.matches("html,body")}function z(n){return n?.ownerDocument||document}function jt(n){return n?n.hasAttribute(pe)?n:n.querySelector("["+pe+"]")||n:null}function Z(n,e,t){return t===void 0&&(t=!0),n.filter(r=>{var s;return r.parentId===e&&(!t||((s=r.context)==null?void 0:s.open))}).flatMap(r=>[r,...Z(n,r.id,t)])}function Kt(n){return"nativeEvent"in n}var Bt=typeof document<"u",Ut=function(){},V=Bt?p.useLayoutEffect:Ut;const Vt={...we},Wt=Vt.useInsertionEffect,Ht=Wt||(n=>n());function W(n){const e=p.useRef(()=>{});return Ht(()=>{e.current=n}),p.useCallback(function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return e.current==null?void 0:e.current(...o)},[])}const Me=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Oe(n,e){const t=De(n,Me()),o=t.length;if(o===0)return;const r=_t(z(n)),s=t.indexOf(r),i=s===-1?e===1?0:o-1:s+e;return t[i]}function Xt(n){return Oe(z(n).body,1)||n}function Yt(n){return Oe(z(n).body,-1)||n}function re(n,e){const t=e||n.currentTarget,o=n.relatedTarget;return!o||!ce(t,o)}function Gt(n){De(n,Me()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function ve(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const o=t.dataset.tabindex;delete t.dataset.tabindex,o?t.setAttribute("tabindex",o):t.removeAttribute("tabindex")})}const Qt="data-floating-ui-focusable",he="active",be="selected",zt={...we};let xe=!1,Zt=0;const ye=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Zt++;function Jt(){const[n,e]=p.useState(()=>xe?ye():void 0);return V(()=>{n==null&&e(ye())},[]),p.useEffect(()=>{xe=!0},[]),n}const en=zt.useId,ue=en||Jt;function tn(){const n=new Map;return{emit(e,t){var o;(o=n.get(e))==null||o.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var o;(o=n.get(e))==null||o.delete(t)}}}const nn=p.createContext(null),on=p.createContext(null),Fe=()=>{var n;return((n=p.useContext(nn))==null?void 0:n.id)||null},qe=()=>p.useContext(on);function de(n){return"data-floating-ui-"+n}const rn={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Re=p.forwardRef(function(e,t){const[o,r]=p.useState();V(()=>{kt()&&r("button")},[]);const s={ref:t,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[de("focus-guard")]:"",style:rn};return I.jsx("span",{...e,...s})}),sn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$e=p.createContext(null),Se=de("portal");function an(n){n===void 0&&(n={});const{id:e,root:t}=n,o=ue(),r=cn(),[s,i]=p.useState(null),a=p.useRef(null);return V(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),V(()=>{if(!o||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=o,c.setAttribute(Se,""),l.appendChild(c),a.current=c,i(c)},[e,o]),V(()=>{if(t===null||!o||a.current)return;let l=t||r?.portalNode;l&&!it(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const d=document.createElement("div");d.id=o,d.setAttribute(Se,""),l=c||l,l.appendChild(d),a.current=d,i(d)},[e,t,o,r]),s}function ln(n){const{children:e,id:t,root:o,preserveTabOrder:r=!0}=n,s=an({id:t,root:o}),[i,a]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),g=i?.modal,h=i?.open,y=!!i&&!i.modal&&i.open&&r&&!!(o||s);return p.useEffect(()=>{if(!s||!r||g)return;function m(f){s&&re(f)&&(f.type==="focusin"?ve:Gt)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,r,g]),p.useEffect(()=>{s&&(h||ve(s))},[h,s]),I.jsxs($e.Provider,{value:p.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:s,setFocusManagerState:a}),[r,s]),children:[y&&s&&I.jsx(Re,{"data-type":"outside",ref:l,onFocus:m=>{if(re(m,s)){var f;(f=d.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Yt(x);b?.focus()}}}),y&&s&&I.jsx("span",{"aria-owns":s.id,style:sn}),s&&tt.createPortal(e,s),y&&s&&I.jsx(Re,{"data-type":"outside",ref:c,onFocus:m=>{if(re(m,s)){var f;(f=u.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Xt(x);b?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const cn=()=>p.useContext($e),un={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ee=n=>{var e,t;return{escapeKey:typeof n=="boolean"?n:(e=n?.escapeKey)!=null?e:!1,outsidePress:typeof n=="boolean"?n:(t=n?.outsidePress)!=null?t:!0}};function fn(n,e){e===void 0&&(e={});const{open:t,onOpenChange:o,elements:r,dataRef:s}=n,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:d=!1,referencePressEvent:u="pointerdown",ancestorScroll:g=!1,bubbles:h,capture:y}=e,m=qe(),f=W(typeof l=="function"?l:()=>!1),x=typeof l=="function"?f:l,b=p.useRef(!1),{escapeKey:R,outsidePress:v}=Ee(h),{escapeKey:D,outsidePress:C}=Ee(y),O=p.useRef(!1),A=W(S=>{var E;if(!t||!i||!a||S.key!=="Escape"||O.current)return;const P=(E=s.current.floatingContext)==null?void 0:E.nodeId,M=m?Z(m.nodesRef.current,P):[];if(!R&&(S.stopPropagation(),M.length>0)){let w=!0;if(M.forEach(N=>{var q;if((q=N.context)!=null&&q.open&&!N.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}o(!1,Kt(S)?S.nativeEvent:S,"escape-key")}),F=W(S=>{var E;const P=()=>{var M;A(S),(M=G(S))==null||M.removeEventListener("keydown",P)};(E=G(S))==null||E.addEventListener("keydown",P)}),T=W(S=>{var E;const P=s.current.insideReactTree;s.current.insideReactTree=!1;const M=b.current;if(b.current=!1,c==="click"&&M||P||typeof x=="function"&&!x(S))return;const w=G(S),N="["+de("inert")+"]",q=z(r.floating).querySelectorAll(N);let L=j(w)?w:null;for(;L&&!ne(L);){const k=ot(L);if(ne(k)||!j(k))break;L=k}if(q.length&&j(w)&&!Lt(w)&&!ce(w,r.floating)&&Array.from(q).every(k=>!ce(L,k)))return;if(rt(w)&&K){const k=ne(w),B=st(w),Y=/auto|scroll/,Ke=k||Y.test(B.overflowX),Be=k||Y.test(B.overflowY),Ue=Ke&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Ve=Be&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,We=B.direction==="rtl",He=Ve&&(We?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),Xe=Ue&&S.offsetY>w.clientHeight;if(He||Xe)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,X=m&&Z(m.nodesRef.current,U).some(k=>{var B;return oe(S,(B=k.context)==null?void 0:B.elements.floating)});if(oe(S,r.floating)||oe(S,r.domReference)||X)return;const fe=m?Z(m.nodesRef.current,U):[];if(fe.length>0){let k=!0;if(fe.forEach(B=>{var Y;if((Y=B.context)!=null&&Y.open&&!B.context.dataRef.current.__outsidePressBubbles){k=!1;return}}),!k)return}o(!1,S,"outside-press")}),$=W(S=>{var E;const P=()=>{var M;T(S),(M=G(S))==null||M.removeEventListener(c,P)};(E=G(S))==null||E.addEventListener(c,P)});p.useEffect(()=>{if(!t||!i)return;s.current.__escapeKeyBubbles=R,s.current.__outsidePressBubbles=v;let S=-1;function E(q){o(!1,q,"ancestor-scroll")}function P(){window.clearTimeout(S),O.current=!0}function M(){S=window.setTimeout(()=>{O.current=!1},nt()?5:0)}const w=z(r.floating);a&&(w.addEventListener("keydown",D?F:A,D),w.addEventListener("compositionstart",P),w.addEventListener("compositionend",M)),x&&w.addEventListener(c,C?$:T,C);let N=[];return g&&(j(r.domReference)&&(N=te(r.domReference)),j(r.floating)&&(N=N.concat(te(r.floating))),!j(r.reference)&&r.reference&&r.reference.contextElement&&(N=N.concat(te(r.reference.contextElement)))),N=N.filter(q=>{var L;return q!==((L=w.defaultView)==null?void 0:L.visualViewport)}),N.forEach(q=>{q.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(w.removeEventListener("keydown",D?F:A,D),w.removeEventListener("compositionstart",P),w.removeEventListener("compositionend",M)),x&&w.removeEventListener(c,C?$:T,C),N.forEach(q=>{q.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,r,a,x,c,t,o,g,i,R,v,A,D,F,T,C,$]),p.useEffect(()=>{s.current.insideReactTree=!1},[s,x,c]);const _=p.useMemo(()=>({onKeyDown:A,...d&&{[un[u]]:S=>{o(!1,S.nativeEvent,"reference-press")},...u!=="click"&&{onClick(S){o(!1,S.nativeEvent,"reference-press")}}}}),[A,o,d,u]),K=p.useMemo(()=>{function S(E){E.button===0&&(b.current=!0)}return{onKeyDown:A,onMouseDown:S,onMouseUp:S,[dn[c]]:()=>{s.current.insideReactTree=!0}}},[A,c,s]);return p.useMemo(()=>i?{reference:_,floating:K}:{},[i,_,K])}function gn(n){const{open:e=!1,onOpenChange:t,elements:o}=n,r=ue(),s=p.useRef({}),[i]=p.useState(()=>tn()),a=Fe()!=null,[l,c]=p.useState(o.reference),d=W((h,y,m)=>{s.current.openEvent=h?y:void 0,i.emit("openchange",{open:h,event:y,reason:m,nested:a}),t?.(h,y,m)}),u=p.useMemo(()=>({setPositionReference:c}),[]),g=p.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return p.useMemo(()=>({dataRef:s,open:e,onOpenChange:d,elements:g,events:i,floatingId:r,refs:u}),[e,d,g,i,r,u])}function mn(n){n===void 0&&(n={});const{nodeId:e}=n,t=gn({...n,elements:{reference:null,floating:null,...n.elements}}),o=n.rootContext||t,r=o.elements,[s,i]=p.useState(null),[a,l]=p.useState(null),d=r?.domReference||s,u=p.useRef(null),g=qe();V(()=>{d&&(u.current=d)},[d]);const h=et({...n,elements:{...r,...a&&{reference:a}}}),y=p.useCallback(R=>{const v=j(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;l(v),h.refs.setReference(v)},[h.refs]),m=p.useCallback(R=>{(j(R)||R===null)&&(u.current=R,i(R)),(j(h.refs.reference.current)||h.refs.reference.current===null||R!==null&&!j(R))&&h.refs.setReference(R)},[h.refs]),f=p.useMemo(()=>({...h.refs,setReference:m,setPositionReference:y,domReference:u}),[h.refs,m,y]),x=p.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=p.useMemo(()=>({...h,...o,refs:f,elements:x,nodeId:e}),[h,f,x,e,o]);return V(()=>{o.dataRef.current.floatingContext=b;const R=g?.nodesRef.current.find(v=>v.id===e);R&&(R.context=b)}),p.useMemo(()=>({...h,context:b,refs:f,elements:x}),[h,f,x,b])}function se(n,e,t){const o=new Map,r=t==="item";let s=n;if(r&&n){const{[he]:i,[be]:a,...l}=n;s=l}return{...t==="floating"&&{tabIndex:-1,[Qt]:""},...s,...e.map(i=>{const a=i?i[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(r&&[he,be].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof d=="function"){var u;(u=o.get(c))==null||u.push(d),i[c]=function(){for(var g,h=arguments.length,y=new Array(h),m=0;m<h;m++)y[m]=arguments[m];return(g=o.get(c))==null?void 0:g.map(f=>f(...y)).find(f=>f!==void 0)}}}else i[c]=d}),i),{})}}function pn(n){n===void 0&&(n=[]);const e=n.map(a=>a?.reference),t=n.map(a=>a?.floating),o=n.map(a=>a?.item),r=p.useCallback(a=>se(a,n,"reference"),e),s=p.useCallback(a=>se(a,n,"floating"),t),i=p.useCallback(a=>se(a,n,"item"),o);return p.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:i}),[r,s,i])}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hn(n,e){var t,o;e===void 0&&(e={});const{open:r,elements:s,floatingId:i}=n,{enabled:a=!0,role:l="dialog"}=e,c=ue(),d=((t=s.domReference)==null?void 0:t.id)||c,u=p.useMemo(()=>{var b;return((b=jt(s.floating))==null?void 0:b.id)||i},[s.floating,i]),g=(o=vn.get(l))!=null?o:l,y=Fe()!=null,m=p.useMemo(()=>g==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":g==="alertdialog"?"dialog":g,"aria-controls":r?u:void 0,...g==="listbox"&&{role:"combobox"},...g==="menu"&&{id:d},...g==="menu"&&y&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,u,y,r,d,l]),f=p.useMemo(()=>{const b={id:u,...g&&{role:g}};return g==="tooltip"||l==="label"?b:{...b,...g==="menu"&&{"aria-labelledby":d}}},[g,u,d,l]),x=p.useCallback(b=>{let{active:R,selected:v}=b;const D={role:"option",...R&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...D,"aria-selected":v}}return{}},[u,l]);return p.useMemo(()=>a?{reference:m,floating:f,item:x}:{},[a,m,f,x])}function bn(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:a}=n,l=o&&!r,c=Ze(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",g=r?"":c,h=l?new RegExp(`${u}${c}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const m=a.pos-y.length,f=Array.from(y.matchAll(h)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const x=f.input.slice(Math.max(0,f.index-1),f.index),b=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!b)return null;const R=m+f.index;let v=R+f[0].length;return l&&d.test(y.slice(v-1,v+1))&&(f[0]+=" ",v+=1),R<a.pos&&v>=a.pos?{range:{from:R,to:v},query:f[0].slice(t.length),text:f[0]}:null}function xn(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const o=t.content.textBetween(0,t.content.size,`
1
+ import{t as Ye,n as ie,o as Ge,D as Qe,v as ze,w as Ze}from"./usage-stats-n069Pf6u.js";import{r as p,g6 as Je,fY as we,g7 as et,g8 as j,g9 as te,j as I,bP as tt,ga as nt,gb as ne,gc as ot,gd as rt,ge as st,gf as it,gg as at,gh as lt,gi as Ce,gj as ct,c as H,U as ut,K as dt,gk as ft,gl as gt,gm as mt,b as pt,l as vt,h as ht}from"./index-BJ9m9LNK.js";import{g as bt,d as xt}from"./tool-namespace-BDVFYO2h.js";import{A as yt}from"./agent-icon-CTGtlw1z.js";var Hn=Ye;var Rt=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ae=Rt.join(","),Ie=typeof Element>"u",Q=Ie?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,J=!Ie&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n?.ownerDocument},ee=function(e,t){var o;t===void 0&&(t=!0);var r=e==null||(o=e.getAttribute)===null||o===void 0?void 0:o.call(e,"inert"),s=r===""||r==="true",i=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ee(e.parentNode));return i},St=function(e){var t,o=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return o===""||o==="true"},Et=function(e,t,o){if(ee(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ae));return t&&Q.call(e,ae)&&r.unshift(e),r=r.filter(o),r},le=function(e,t,o){for(var r=[],s=Array.from(e);s.length;){var i=s.shift();if(!ee(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=le(l,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:i,candidates:c})}else{var d=Q.call(i,ae);d&&o.filter(i)&&(t||!e.includes(i))&&r.push(i);var u=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),g=!ee(u,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(u&&g){var h=le(u===!0?i.children:u.children,!0,o);o.flatten?r.push.apply(r,h):r.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return r},Te=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Pe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||St(e))&&!Te(e)?0:e.tabIndex},wt=function(e,t){var o=Pe(e);return o<0&&t&&!Te(e)?0:o},Ct=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ae=function(e){return e.tagName==="INPUT"},It=function(e){return Ae(e)&&e.type==="hidden"},Tt=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(o){return o.tagName==="SUMMARY"});return t},Pt=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]},At=function(e){if(!e.name)return!0;var t=e.form||J(e),o=function(a){return t.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(e.name));else try{r=o(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Pt(r,e.form);return!s||s===e},Nt=function(e){return Ae(e)&&e.type==="radio"},Dt=function(e){return Nt(e)&&!At(e)},Mt=function(e){var t,o=e&&J(e),r=(t=o)===null||t===void 0?void 0:t.host,s=!1;if(o&&o!==e){var i,a,l;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&r;){var c,d,u;o=J(r),r=(c=o)===null||c===void 0?void 0:c.host,s=!!((d=r)!==null&&d!==void 0&&(u=d.ownerDocument)!==null&&u!==void 0&&u.contains(r))}}return s},ge=function(e){var t=e.getBoundingClientRect(),o=t.width,r=t.height;return o===0&&r===0},Ot=function(e,t){var o=t.displayCheck,r=t.getShadowRoot;if(o==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=Q.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(Q.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var c=e.parentElement,d=J(e);if(c&&!c.shadowRoot&&r(c)===!0)return ge(e);e.assignedSlot?e=e.assignedSlot:!c&&d!==e.ownerDocument?e=d.host:e=c}e=l}if(Mt(e))return!e.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return ge(e);return!1},Ft=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var o=0;o<t.children.length;o++){var r=t.children.item(o);if(r.tagName==="LEGEND")return Q.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},qt=function(e,t){return!(t.disabled||It(t)||Ot(t,e)||Tt(t)||Ft(t))},me=function(e,t){return!(Dt(t)||Pe(t)<0||!qt(e,t))},$t=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ne=function(e){var t=[],o=[];return e.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,l=wt(a,i),c=i?Ne(r.candidates):a;l===0?i?t.push.apply(t,c):t.push(a):o.push({documentOrder:s,tabIndex:l,item:r,isScope:i,content:c})}),o.sort(Ct).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(t)},De=function(e,t){t=t||{};var o;return t.getShadowRoot?o=le([e],t.includeContainer,{filter:me.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$t}):o=Et(e,t.includeContainer,me.bind(null,t)),Ne(o)};function kt(){return/apple/i.test(navigator.vendor)}const pe="data-floating-ui-focusable";function _t(n){let e=n.activeElement;for(;((t=e)==null||(t=t.shadowRoot)==null?void 0:t.activeElement)!=null;){var t;e=e.shadowRoot.activeElement}return e}function ce(n,e){if(!n||!e)return!1;const t=e.getRootNode==null?void 0:e.getRootNode();if(n.contains(e))return!0;if(t&&Je(t)){let o=e;for(;o;){if(n===o)return!0;o=o.parentNode||o.host}}return!1}function G(n){return"composedPath"in n?n.composedPath()[0]:n.target}function oe(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function Lt(n){return n.matches("html,body")}function z(n){return n?.ownerDocument||document}function jt(n){return n?n.hasAttribute(pe)?n:n.querySelector("["+pe+"]")||n:null}function Z(n,e,t){return t===void 0&&(t=!0),n.filter(r=>{var s;return r.parentId===e&&(!t||((s=r.context)==null?void 0:s.open))}).flatMap(r=>[r,...Z(n,r.id,t)])}function Kt(n){return"nativeEvent"in n}var Bt=typeof document<"u",Ut=function(){},V=Bt?p.useLayoutEffect:Ut;const Vt={...we},Wt=Vt.useInsertionEffect,Ht=Wt||(n=>n());function W(n){const e=p.useRef(()=>{});return Ht(()=>{e.current=n}),p.useCallback(function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return e.current==null?void 0:e.current(...o)},[])}const Me=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Oe(n,e){const t=De(n,Me()),o=t.length;if(o===0)return;const r=_t(z(n)),s=t.indexOf(r),i=s===-1?e===1?0:o-1:s+e;return t[i]}function Xt(n){return Oe(z(n).body,1)||n}function Yt(n){return Oe(z(n).body,-1)||n}function re(n,e){const t=e||n.currentTarget,o=n.relatedTarget;return!o||!ce(t,o)}function Gt(n){De(n,Me()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function ve(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const o=t.dataset.tabindex;delete t.dataset.tabindex,o?t.setAttribute("tabindex",o):t.removeAttribute("tabindex")})}const Qt="data-floating-ui-focusable",he="active",be="selected",zt={...we};let xe=!1,Zt=0;const ye=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Zt++;function Jt(){const[n,e]=p.useState(()=>xe?ye():void 0);return V(()=>{n==null&&e(ye())},[]),p.useEffect(()=>{xe=!0},[]),n}const en=zt.useId,ue=en||Jt;function tn(){const n=new Map;return{emit(e,t){var o;(o=n.get(e))==null||o.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var o;(o=n.get(e))==null||o.delete(t)}}}const nn=p.createContext(null),on=p.createContext(null),Fe=()=>{var n;return((n=p.useContext(nn))==null?void 0:n.id)||null},qe=()=>p.useContext(on);function de(n){return"data-floating-ui-"+n}const rn={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Re=p.forwardRef(function(e,t){const[o,r]=p.useState();V(()=>{kt()&&r("button")},[]);const s={ref:t,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[de("focus-guard")]:"",style:rn};return I.jsx("span",{...e,...s})}),sn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$e=p.createContext(null),Se=de("portal");function an(n){n===void 0&&(n={});const{id:e,root:t}=n,o=ue(),r=cn(),[s,i]=p.useState(null),a=p.useRef(null);return V(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),V(()=>{if(!o||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const c=document.createElement("div");c.id=o,c.setAttribute(Se,""),l.appendChild(c),a.current=c,i(c)},[e,o]),V(()=>{if(t===null||!o||a.current)return;let l=t||r?.portalNode;l&&!it(l)&&(l=l.current),l=l||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,l.appendChild(c));const d=document.createElement("div");d.id=o,d.setAttribute(Se,""),l=c||l,l.appendChild(d),a.current=d,i(d)},[e,t,o,r]),s}function ln(n){const{children:e,id:t,root:o,preserveTabOrder:r=!0}=n,s=an({id:t,root:o}),[i,a]=p.useState(null),l=p.useRef(null),c=p.useRef(null),d=p.useRef(null),u=p.useRef(null),g=i?.modal,h=i?.open,y=!!i&&!i.modal&&i.open&&r&&!!(o||s);return p.useEffect(()=>{if(!s||!r||g)return;function m(f){s&&re(f)&&(f.type==="focusin"?ve:Gt)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,r,g]),p.useEffect(()=>{s&&(h||ve(s))},[h,s]),I.jsxs($e.Provider,{value:p.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:u,portalNode:s,setFocusManagerState:a}),[r,s]),children:[y&&s&&I.jsx(Re,{"data-type":"outside",ref:l,onFocus:m=>{if(re(m,s)){var f;(f=d.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Yt(x);b?.focus()}}}),y&&s&&I.jsx("span",{"aria-owns":s.id,style:sn}),s&&tt.createPortal(e,s),y&&s&&I.jsx(Re,{"data-type":"outside",ref:c,onFocus:m=>{if(re(m,s)){var f;(f=u.current)==null||f.focus()}else{const x=i?i.domReference:null,b=Xt(x);b?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const cn=()=>p.useContext($e),un={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ee=n=>{var e,t;return{escapeKey:typeof n=="boolean"?n:(e=n?.escapeKey)!=null?e:!1,outsidePress:typeof n=="boolean"?n:(t=n?.outsidePress)!=null?t:!0}};function fn(n,e){e===void 0&&(e={});const{open:t,onOpenChange:o,elements:r,dataRef:s}=n,{enabled:i=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="pointerdown",referencePress:d=!1,referencePressEvent:u="pointerdown",ancestorScroll:g=!1,bubbles:h,capture:y}=e,m=qe(),f=W(typeof l=="function"?l:()=>!1),x=typeof l=="function"?f:l,b=p.useRef(!1),{escapeKey:R,outsidePress:v}=Ee(h),{escapeKey:D,outsidePress:C}=Ee(y),O=p.useRef(!1),A=W(S=>{var E;if(!t||!i||!a||S.key!=="Escape"||O.current)return;const P=(E=s.current.floatingContext)==null?void 0:E.nodeId,M=m?Z(m.nodesRef.current,P):[];if(!R&&(S.stopPropagation(),M.length>0)){let w=!0;if(M.forEach(N=>{var q;if((q=N.context)!=null&&q.open&&!N.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}o(!1,Kt(S)?S.nativeEvent:S,"escape-key")}),F=W(S=>{var E;const P=()=>{var M;A(S),(M=G(S))==null||M.removeEventListener("keydown",P)};(E=G(S))==null||E.addEventListener("keydown",P)}),T=W(S=>{var E;const P=s.current.insideReactTree;s.current.insideReactTree=!1;const M=b.current;if(b.current=!1,c==="click"&&M||P||typeof x=="function"&&!x(S))return;const w=G(S),N="["+de("inert")+"]",q=z(r.floating).querySelectorAll(N);let L=j(w)?w:null;for(;L&&!ne(L);){const k=ot(L);if(ne(k)||!j(k))break;L=k}if(q.length&&j(w)&&!Lt(w)&&!ce(w,r.floating)&&Array.from(q).every(k=>!ce(L,k)))return;if(rt(w)&&K){const k=ne(w),B=st(w),Y=/auto|scroll/,Ke=k||Y.test(B.overflowX),Be=k||Y.test(B.overflowY),Ue=Ke&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Ve=Be&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,We=B.direction==="rtl",He=Ve&&(We?S.offsetX<=w.offsetWidth-w.clientWidth:S.offsetX>w.clientWidth),Xe=Ue&&S.offsetY>w.clientHeight;if(He||Xe)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,X=m&&Z(m.nodesRef.current,U).some(k=>{var B;return oe(S,(B=k.context)==null?void 0:B.elements.floating)});if(oe(S,r.floating)||oe(S,r.domReference)||X)return;const fe=m?Z(m.nodesRef.current,U):[];if(fe.length>0){let k=!0;if(fe.forEach(B=>{var Y;if((Y=B.context)!=null&&Y.open&&!B.context.dataRef.current.__outsidePressBubbles){k=!1;return}}),!k)return}o(!1,S,"outside-press")}),$=W(S=>{var E;const P=()=>{var M;T(S),(M=G(S))==null||M.removeEventListener(c,P)};(E=G(S))==null||E.addEventListener(c,P)});p.useEffect(()=>{if(!t||!i)return;s.current.__escapeKeyBubbles=R,s.current.__outsidePressBubbles=v;let S=-1;function E(q){o(!1,q,"ancestor-scroll")}function P(){window.clearTimeout(S),O.current=!0}function M(){S=window.setTimeout(()=>{O.current=!1},nt()?5:0)}const w=z(r.floating);a&&(w.addEventListener("keydown",D?F:A,D),w.addEventListener("compositionstart",P),w.addEventListener("compositionend",M)),x&&w.addEventListener(c,C?$:T,C);let N=[];return g&&(j(r.domReference)&&(N=te(r.domReference)),j(r.floating)&&(N=N.concat(te(r.floating))),!j(r.reference)&&r.reference&&r.reference.contextElement&&(N=N.concat(te(r.reference.contextElement)))),N=N.filter(q=>{var L;return q!==((L=w.defaultView)==null?void 0:L.visualViewport)}),N.forEach(q=>{q.addEventListener("scroll",E,{passive:!0})}),()=>{a&&(w.removeEventListener("keydown",D?F:A,D),w.removeEventListener("compositionstart",P),w.removeEventListener("compositionend",M)),x&&w.removeEventListener(c,C?$:T,C),N.forEach(q=>{q.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,r,a,x,c,t,o,g,i,R,v,A,D,F,T,C,$]),p.useEffect(()=>{s.current.insideReactTree=!1},[s,x,c]);const _=p.useMemo(()=>({onKeyDown:A,...d&&{[un[u]]:S=>{o(!1,S.nativeEvent,"reference-press")},...u!=="click"&&{onClick(S){o(!1,S.nativeEvent,"reference-press")}}}}),[A,o,d,u]),K=p.useMemo(()=>{function S(E){E.button===0&&(b.current=!0)}return{onKeyDown:A,onMouseDown:S,onMouseUp:S,[dn[c]]:()=>{s.current.insideReactTree=!0}}},[A,c,s]);return p.useMemo(()=>i?{reference:_,floating:K}:{},[i,_,K])}function gn(n){const{open:e=!1,onOpenChange:t,elements:o}=n,r=ue(),s=p.useRef({}),[i]=p.useState(()=>tn()),a=Fe()!=null,[l,c]=p.useState(o.reference),d=W((h,y,m)=>{s.current.openEvent=h?y:void 0,i.emit("openchange",{open:h,event:y,reason:m,nested:a}),t?.(h,y,m)}),u=p.useMemo(()=>({setPositionReference:c}),[]),g=p.useMemo(()=>({reference:l||o.reference||null,floating:o.floating||null,domReference:o.reference}),[l,o.reference,o.floating]);return p.useMemo(()=>({dataRef:s,open:e,onOpenChange:d,elements:g,events:i,floatingId:r,refs:u}),[e,d,g,i,r,u])}function mn(n){n===void 0&&(n={});const{nodeId:e}=n,t=gn({...n,elements:{reference:null,floating:null,...n.elements}}),o=n.rootContext||t,r=o.elements,[s,i]=p.useState(null),[a,l]=p.useState(null),d=r?.domReference||s,u=p.useRef(null),g=qe();V(()=>{d&&(u.current=d)},[d]);const h=et({...n,elements:{...r,...a&&{reference:a}}}),y=p.useCallback(R=>{const v=j(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;l(v),h.refs.setReference(v)},[h.refs]),m=p.useCallback(R=>{(j(R)||R===null)&&(u.current=R,i(R)),(j(h.refs.reference.current)||h.refs.reference.current===null||R!==null&&!j(R))&&h.refs.setReference(R)},[h.refs]),f=p.useMemo(()=>({...h.refs,setReference:m,setPositionReference:y,domReference:u}),[h.refs,m,y]),x=p.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=p.useMemo(()=>({...h,...o,refs:f,elements:x,nodeId:e}),[h,f,x,e,o]);return V(()=>{o.dataRef.current.floatingContext=b;const R=g?.nodesRef.current.find(v=>v.id===e);R&&(R.context=b)}),p.useMemo(()=>({...h,context:b,refs:f,elements:x}),[h,f,x,b])}function se(n,e,t){const o=new Map,r=t==="item";let s=n;if(r&&n){const{[he]:i,[be]:a,...l}=n;s=l}return{...t==="floating"&&{tabIndex:-1,[Qt]:""},...s,...e.map(i=>{const a=i?i[t]:null;return typeof a=="function"?n?a(n):null:a}).concat(n).reduce((i,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(r&&[he,be].includes(c)))if(c.indexOf("on")===0){if(o.has(c)||o.set(c,[]),typeof d=="function"){var u;(u=o.get(c))==null||u.push(d),i[c]=function(){for(var g,h=arguments.length,y=new Array(h),m=0;m<h;m++)y[m]=arguments[m];return(g=o.get(c))==null?void 0:g.map(f=>f(...y)).find(f=>f!==void 0)}}}else i[c]=d}),i),{})}}function pn(n){n===void 0&&(n=[]);const e=n.map(a=>a?.reference),t=n.map(a=>a?.floating),o=n.map(a=>a?.item),r=p.useCallback(a=>se(a,n,"reference"),e),s=p.useCallback(a=>se(a,n,"floating"),t),i=p.useCallback(a=>se(a,n,"item"),o);return p.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:i}),[r,s,i])}const vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hn(n,e){var t,o;e===void 0&&(e={});const{open:r,elements:s,floatingId:i}=n,{enabled:a=!0,role:l="dialog"}=e,c=ue(),d=((t=s.domReference)==null?void 0:t.id)||c,u=p.useMemo(()=>{var b;return((b=jt(s.floating))==null?void 0:b.id)||i},[s.floating,i]),g=(o=vn.get(l))!=null?o:l,y=Fe()!=null,m=p.useMemo(()=>g==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:r?u:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":g==="alertdialog"?"dialog":g,"aria-controls":r?u:void 0,...g==="listbox"&&{role:"combobox"},...g==="menu"&&{id:d},...g==="menu"&&y&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,u,y,r,d,l]),f=p.useMemo(()=>{const b={id:u,...g&&{role:g}};return g==="tooltip"||l==="label"?b:{...b,...g==="menu"&&{"aria-labelledby":d}}},[g,u,d,l]),x=p.useCallback(b=>{let{active:R,selected:v}=b;const D={role:"option",...R&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...D,"aria-selected":v}}return{}},[u,l]);return p.useMemo(()=>a?{reference:m,floating:f,item:x}:{},[a,m,f,x])}function bn(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,$position:a}=n,l=o&&!r,c=Ze(t),d=new RegExp(`\\s${c}$`),u=i?"^":"",g=r?"":c,h=l?new RegExp(`${u}${c}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${u}(?:^)?${c}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const m=a.pos-y.length,f=Array.from(y.matchAll(h)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const x=f.input.slice(Math.max(0,f.index-1),f.index),b=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!b)return null;const R=m+f.index;let v=R+f[0].length;return l&&d.test(y.slice(v-1,v+1))&&(f[0]+=" ",v+=1),R<a.pos&&v>=a.pos?{range:{from:R,to:v},query:f[0].slice(t.length),text:f[0]}:null}function xn(n){return n.docChanged?n.steps.some(e=>{const t=e.slice;if(!t?.content)return!1;const o=t.content.textBetween(0,t.content.size,`
2
2
  `);return/\s/.test(o)}):!1}function yn(n){return()=>{const e=n.state.selection.$anchor.pos,{top:t,right:o,bottom:r,left:s}=n.view.coordsAtPos(e);try{return new DOMRect(s,t,o-s,r-t)}catch{return null}}}function Rn(n,e,t,o){return t?()=>{const r=o.getState(n.state),s=r?.decorationId,i=e.dom.querySelector(`[data-decoration-id="${s}"]`);return i?.getBoundingClientRect()||null}:yn(n)}function Sn({match:n,dismissedRange:e,state:t,transaction:o,editor:r,shouldResetDismissed:s,effectiveAllowSpaces:i}){return s?.({editor:r,state:t,range:e,match:n,transaction:o,allowSpaces:i})?!1:i?n.range.from===e.from:n.range.from===e.from&&!xn(o)}function En({view:n,pluginKeyRef:e}){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}function wn({pluginKey:n,decorationTag:e,decorationClass:t,decorationContent:o,decorationEmptyClass:r,renderer:s,dispatchExit:i}){return{handleKeyDown(a,l){var c;const d=n.getState(a.state);if(!d.active)return!1;if(l.key==="Escape"||l.key==="Esc"){var u;return s==null||(u=s.onKeyDown)===null||u===void 0||u.call(s,{view:a,event:l,range:d.range}),i(a),!0}return(s==null||(c=s.onKeyDown)===null||c===void 0?void 0:c.call(s,{view:a,event:l,range:d.range}))||!1},decorations(a){const{active:l,range:c,decorationId:d,query:u}=n.getState(a);if(!l)return null;const g=!u?.length,h=[t];return g&&h.push(r),Qe.create(a.doc,[ze.inline(c.from,c.to,{nodeName:e,class:h.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":o})])}}}function Cn({editor:n,char:e,effectiveAllowSpaces:t,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,findSuggestionMatch:i,allow:a,shouldShow:l,shouldKeepDismissed:c,pluginKey:d}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(u,g,h,y){const{isEditable:m}=n,{composing:f}=n.view,{selection:x}=u,{empty:b,from:R}=x,v={...g},D=u.getMeta(d);if(D&&D.exit)return v.active=!1,v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null,v.dismissedRange=g.active?{...g.range}:g.dismissedRange,v;if(v.composing=f,u.docChanged&&v.dismissedRange!==null&&(v.dismissedRange={from:u.mapping.map(v.dismissedRange.from),to:u.mapping.map(v.dismissedRange.to)}),m&&(b||n.view.composing)){(R<g.range.from||R>g.range.to)&&!f&&!g.composing&&(v.active=!1);const C=i({char:e,allowSpaces:t,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,$position:x.$from}),O=`id_${Math.floor(Math.random()*4294967295)}`;C&&a({editor:n,state:y,range:C.range,isActive:g.active})&&(!l||l({editor:n,range:C.range,query:C.query,text:C.text,transaction:u}))?(v.dismissedRange!==null&&!c({match:C,dismissedRange:v.dismissedRange,state:y,transaction:u})&&(v.dismissedRange=null),v.dismissedRange===null?(v.active=!0,v.decorationId=g.decorationId||O,v.range=C.range,v.query=C.query,v.text=C.text):v.active=!1):(C||(v.dismissedRange=null),v.active=!1)}else v.active=!1;return v.active||(v.decorationId=null,v.range={from:0,to:0},v.query=null,v.text=null),v}}}function In({editor:n,items:e}){let t=null,o=null,r=null;const s=()=>{o!==null&&(clearTimeout(o),o=null),r?.(),r=null},i=c=>new Promise(d=>{r=d,o=setTimeout(()=>{o=null;const u=r;r=null,u?.()},c)}),a=()=>{t?.abort(),s(),t=null};return{abort:a,fetch:async(c,d)=>{a(),t=new AbortController;const u=t;if(d>0&&await i(d),t!==u||u.signal.aborted)return{status:"aborted"};try{const g=await e({editor:n,query:c,signal:u.signal});return t!==u||u.signal.aborted?{status:"aborted"}:{status:"resolved",items:g}}catch{return t!==u||u.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function Tn({placement:n,offset:e,flip:t,floatingUi:o}){var r,s,i,a;const l=[at({mainAxis:(r=e.mainAxis)!==null&&r!==void 0?r:4,crossAxis:(s=e.crossAxis)!==null&&s!==void 0?s:0})];return t&&l.push(lt()),!(o==null||(i=o.middleware)===null||i===void 0)&&i.length&&l.push(...o.middleware),{placement:n,strategy:(a=o?.strategy)!==null&&a!==void 0?a:"absolute",middleware:l}}function Pn(n){if(n instanceof HTMLElement)return n;if(typeof n=="string")try{const e=document.querySelector(n);if(e)return e}catch{return document.body}return document.body}function An({getReferenceRect:n,contextElement:e,config:t,container:o,dismissOnOutsideClick:r,dismiss:s}){return(i,a={})=>{const l={getBoundingClientRect:()=>{var y;return(y=n())!==null&&y!==void 0?y:new DOMRect},contextElement:e};let c=!1;const d=!i.isConnected;d&&Pn(o).appendChild(i),a.onPosition||(i.style.visibility="hidden",i.style.width="max-content");const g=Ce(l,i,()=>{ct(l,i,{placement:t.placement,strategy:t.strategy,middleware:t.middleware}).then(({x:y,y:m,placement:f,strategy:x})=>{if(a.onPosition){a.onPosition({x:y,y:m,placement:f,strategy:x});return}Object.assign(i.style,{position:x,left:`${y}px`,top:`${m}px`}),c||(c=!0,i.style.visibility="")})},a.autoUpdate);let h;return r&&(h=y=>{const m=y.target;!(m instanceof Node)||i.contains(m)||e.contains(m)||s()},document.addEventListener("pointerdown",h,!0)),()=>{g(),h&&document.removeEventListener("pointerdown",h,!0),d&&i.remove()}}}function Nn({editor:n,pluginKey:e,items:t,renderer:o,minQueryLength:r,debounce:s,initialItems:i,placement:a,offset:l,container:c,flip:d,floatingUi:u,dismissOnOutsideClick:g,command:h,clientRectFor:y,dispatchExit:m}){let f;const x=In({editor:n,items:t}),b=Tn({placement:a,offset:l,flip:d,floatingUi:u});function R(v,D){switch(v){case"started":var C;o==null||(C=o.onStart)===null||C===void 0||C.call(o,D);break;case"updated":var O;o==null||(O=o.onUpdate)===null||O===void 0||O.call(o,D);break;case"stopped":var A;o==null||(A=o.onExit)===null||A===void 0||A.call(o,D)}}return{update:async(v,D)=>{var C,O;const A=e.getState(D),F=e.getState(v.state);if(!A||!F)return;let T=null;const $=A.query!==F.query,_=A.text!==F.text,K=A.range.from!==F.range.from||A.range.to!==F.range.to,S=$||_||K;if(!A.active&&F.active)T="started";else if(A.active&&!F.active)T="stopped";else if(F.active&&S)T="updated";else return;const E=T==="stopped"?A:F,P=v.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`),M=y(v,P),w=r===0||(E.query?E.query.length>=r:!1),N=(T==="started"||T==="updated")&&w;if(f={editor:n,range:E.range,query:E.query||"",text:E.text||"",items:i??[],command:U=>h({editor:n,range:E.range,props:U}),decorationNode:P,clientRect:M,loading:N,placement:a,offset:{mainAxis:(C=l.mainAxis)!==null&&C!==void 0?C:4,crossAxis:(O=l.crossAxis)!==null&&O!==void 0?O:0},container:c,flip:d,floatingUi:b,mount:An({getReferenceRect:M,contextElement:v.dom,config:b,container:c,dismissOnOutsideClick:g,dismiss:()=>m(n.view)})},T==="started"){var q;o==null||(q=o.onBeforeStart)===null||q===void 0||q.call(o,f)}if(T==="updated"){var L;o==null||(L=o.onBeforeUpdate)===null||L===void 0||L.call(o,f)}if(T==="started"&&R(T,f),T==="started"||T==="updated")if(!N)x.abort(),f={...f,items:i??[],loading:!1};else{f={...f,items:i??[],loading:!0},T="updated",R(T,f);const U=await x.fetch(E.query||"",s);if(U.status==="aborted")return;const X=e.getState(v.state);if(!X?.active){x.abort();return}f=U.status==="resolved"?{...f,items:U.items,loading:!1}:{...f,loading:!1}}if(T==="stopped"){x.abort(),R(T,f),f=void 0;return}T==="updated"&&R(T,f)},destroy:()=>{var v;x.abort(),f&&(o==null||(v=o.onExit)===null||v===void 0||v.call(o,f))}}}const ke=new ie("suggestion");function _e({pluginKey:n=ke,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:u=()=>null,items:g=()=>[],minQueryLength:h=0,debounce:y=0,initialItems:m,placement:f="bottom-start",offset:x={},container:b,flip:R=!0,floatingUi:v,dismissOnOutsideClick:D=!0,render:C=()=>({}),allow:O=()=>!0,findSuggestionMatch:A=bn,shouldShow:F,shouldResetDismissed:T}){const $=C?.(),_=o&&!r,K=(P,M)=>Rn(e,P,M,n);function S(P){return Sn({...P,editor:e,shouldResetDismissed:T,effectiveAllowSpaces:_})}const E=P=>En({view:P,pluginKeyRef:n});return new Ge({key:n,view:()=>Nn({editor:e,pluginKey:n,items:g,renderer:$,minQueryLength:h,debounce:y,initialItems:m,placement:f,offset:x,container:b,flip:R,floatingUi:v,dismissOnOutsideClick:D,command:u,clientRectFor:K,dispatchExit:E}),state:Cn({editor:e,char:t,effectiveAllowSpaces:_,allowToIncludeChar:r,allowedPrefixes:s,startOfLine:i,findSuggestionMatch:A,allow:O,shouldShow:F,shouldKeepDismissed:S,pluginKey:n}),props:wn({pluginKey:n,decorationTag:a,decorationClass:l,decorationContent:c,decorationEmptyClass:d,renderer:$,dispatchExit:E})})}function Xn(n,e=ke){const t=n.state.tr.setMeta(e,{exit:!0});n.dispatch(t)}var Yn=_e;function Dn(n){const e=H.c(17),{editor:t,query:o,items:r,onSelect:s,onClose:i}=n,[a,l]=p.useState(0),c=p.useRef(r),d=p.useRef(a),u=p.useRef(s),g=p.useRef(i),h=p.useDeferredValue(o),[y,m]=p.useState(h);y!==h&&(m(h),l(0)),a>=r.length&&r.length>0&&l(0);let f,x;e[0]!==r?(f=()=>{c.current=r},x=[r],e[0]=r,e[1]=f,e[2]=x):(f=e[1],x=e[2]),p.useEffect(f,x);let b,R;e[3]!==a?(b=()=>{d.current=a},R=[a],e[3]=a,e[4]=b,e[5]=R):(b=e[4],R=e[5]),p.useEffect(b,R);let v,D;e[6]!==s?(v=()=>{u.current=s},D=[s],e[6]=s,e[7]=v,e[8]=D):(v=e[7],D=e[8]),p.useEffect(v,D);let C,O;e[9]!==i?(C=()=>{g.current=i},O=[i],e[9]=i,e[10]=C,e[11]=O):(C=e[10],O=e[11]),p.useEffect(C,O);let A,F;e[12]!==t?(F=()=>{if(t?.isDestroyed)return;let _;try{_=t.view.dom}catch{return}if(!_)return;const K=E=>{const P=c.current;if(!P.length)return!1;const M=()=>l(N=>(N+1)%P.length),w=()=>l(N=>(N-1+P.length)%P.length);switch(E.key){case"ArrowUp":return E.preventDefault(),w(),!0;case"ArrowDown":return E.preventDefault(),M(),!0;case"Tab":return E.preventDefault(),E.shiftKey?w():M(),!0;case"Home":return E.preventDefault(),l(0),!0;case"End":return E.preventDefault(),l(P.length-1),!0;case"Enter":{if(E.isComposing)return!1;E.preventDefault();const N=d.current;return N!==-1&&P[N]&&u.current?.(P[N],N),!0}case"Escape":return E.preventDefault(),g.current?.(),!0;default:return!1}},S=E=>{K(E)};return _.addEventListener("keydown",S,!0),()=>{_?.removeEventListener("keydown",S,!0)}},A=[t],e[12]=t,e[13]=A,e[14]=F):(A=e[13],F=e[14]),p.useEffect(F,A);const T=r.length?a:void 0;let $;return e[15]!==T?($={selectedIndex:T,setSelectedIndex:l},e[15]=T,e[16]=$):$=e[16],$}function Mn(n,e){switch(e.type){case"SET_SELECTED_ITEM":return{...n,selectedItem:e.payload};case"ON_START":return{...n,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...n,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return n}}const Le=p.createContext(void 0);function je(){const n=p.useContext(Le);if(!n)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return n}function On(n){const e=H.c(16),{editor:t,char:o,pluginKey:r,allow:s,onOpenChange:i}=n;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={open:!1,element:null,query:"",range:null,selectedItem:null},e[0]=a):a=e[0];const[l,c]=p.useReducer(Mn,a);let d;e[1]!==i?(d=m=>{i?.(m)},e[1]=i,e[2]=d):d=e[2];const u=p.useEffectEvent(d);let g;e[3]!==o||e[4]!==s||e[5]!==t||e[6]!==u||e[7]!==r?(g=()=>{if(t?.isDestroyed)return;const m=r instanceof ie?r:new ie(r);t.state.plugins.find(b=>b.spec.key===m)&&t.unregisterPlugin(m);const x=_e({pluginKey:m,editor:t,char:o,allow(b){const R=t.state.doc.resolve(b.range.from);for(let v=R.depth;v>0;v--)if(R.node(v).type.name==="image")return!1;return!(s&&!s(b))},command(){},render:()=>({onStart:b=>{c({type:"ON_START",payload:{element:b.decorationNode??null,query:b.query,range:b.range}}),u(!0)},onUpdate:b=>{c({type:"ON_UPDATE",payload:{element:b.decorationNode??null,query:b.query,range:b.range}})},onKeyDown:b=>b.event.key==="Escape"?(c({type:"ON_EXIT"}),!0):!1,onExit:()=>{c({type:"ON_EXIT"}),u(!1)}}),items:Fn});return t.registerPlugin(x),()=>{t?.isDestroyed||t.unregisterPlugin(m)}},e[3]=o,e[4]=s,e[5]=t,e[6]=u,e[7]=r,e[8]=g):g=e[8];let h;e[9]!==o||e[10]!==s||e[11]!==t||e[12]!==r?(h=[t,r,o,c,s],e[9]=o,e[10]=s,e[11]=t,e[12]=r,e[13]=h):h=e[13],p.useEffect(g,h);let y;return e[14]!==l?(y={state:l,dispatch:c},e[14]=l,e[15]=y):y=e[15],y}function Fn(){return[]}function qn({editor:n,queryKey:e,queryFn:t,onSelect:o}){const{state:r,dispatch:s}=je(),i=p.useDeferredValue(r.query),{data:a}=ut({queryKey:dt.suggestionItems(e,r.open,i),queryFn:()=>r.open?t({query:i}):[]}),l=()=>{s({type:"ON_EXIT"})},c=async(u,g)=>{if(!(r.selectedItem!==null||!r.range)){s({type:"SET_SELECTED_ITEM",payload:u});try{const{view:h}=n,m=h.state.selection.$to.nodeAfter?.text?.startsWith(" "),f=r.range?{...r.range}:{from:0,to:0};m&&r.range&&(f.to+=1),await o({range:f,item:u})===!1?s({type:"SET_SELECTED_ITEM",payload:null}):l()}catch{l()}}},{selectedIndex:d}=Dn({editor:n,query:i,items:a,onSelect:c,onClose:l});return{selectedItem:r.selectedItem,items:a,selectedIndex:d,close:l,onSelect:c}}function $n({children:n}){const{state:e,dispatch:t}=je(),{open:o,element:r}=e,s=()=>{t({type:"ON_EXIT"})},{refs:i,floatingStyles:a,context:l}=mn({placement:"bottom-start",open:o,onOpenChange:g=>{g||s()},elements:{reference:r},middleware:[ft(10),gt(),mt()],whileElementsMounted:Ce}),c=fn(l,{outsidePress:g=>!(g.target instanceof Element&&g.target.closest(".ProseMirror"))}),d=hn(l,{role:"listbox"}),{getFloatingProps:u}=pn([c,d]);return o?I.jsx(ln,{children:I.jsx("div",{ref:i.setFloating,style:a,...u(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-soft outline-hidden overflow-hidden",children:n})}):null}const kn=n=>{const e=H.c(17),{item:t,isSelected:o,onSelect:r,isLoading:s,ref:i,renderItem:a}=n;let l;if(e[0]!==t){const x=bt(t._meta);l=t.title||xt(t.name,x),e[0]=t,e[1]=l}else l=e[1];const c=l,d=t.description||null,u=t.icon,g=o&&"bg-accent text-accent-foreground",h=s&&"pointer-events-none opacity-50";let y;e[2]!==g||e[3]!==h?(y=vt("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",g,h),e[2]=g,e[3]=h,e[4]=y):y=e[4];let m;e[5]!==d||e[6]!==u||e[7]!==s||e[8]!==t||e[9]!==c||e[10]!==a?(m=a?a(t):I.jsxs(I.Fragment,{children:[u!==void 0&&I.jsx(yt,{icon:u,name:c,size:"xs",className:"mr-2"}),I.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[I.jsxs("div",{className:"flex items-center justify-between gap-2",children:[I.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:c}),s&&I.jsx(ht,{size:"xs"})]}),d&&I.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d})]}),t.drillable&&I.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-2xs font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"})]}),e[5]=d,e[6]=u,e[7]=s,e[8]=t,e[9]=c,e[10]=a,e[11]=m):m=e[11];let f;return e[12]!==r||e[13]!==i||e[14]!==y||e[15]!==m?(f=I.jsx("div",{ref:i,onClick:r,className:y,children:m}),e[12]=r,e[13]=i,e[14]=y,e[15]=m,e[16]=f):f=e[16],f},_n=n=>{const e=H.c(24),{editor:t,queryKey:o,queryFn:r,onSelect:s,renderItem:i,emptyLabel:a}=n,l=pt();let c;e[0]!==t||e[1]!==s||e[2]!==r||e[3]!==o?(c={editor:t,queryKey:o,queryFn:r,onSelect:s},e[0]=t,e[1]=s,e[2]=r,e[3]=o,e[4]=c):c=e[4];const{items:d,selectedIndex:u,onSelect:g,selectedItem:h}=qn(c);if(!d.length){let x;e[5]!==a||e[6]!==l?(x=a??l("chat.mention.noItemsFound"),e[5]=a,e[6]=l,e[7]=x):x=e[7];let b;return e[8]!==x?(b=I.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-soft p-3 text-sm",children:x}),e[8]=x,e[9]=b):b=e[9],b}let y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[10]=y):y=e[10];let m;if(e[11]!==g||e[12]!==d||e[13]!==i||e[14]!==u||e[15]!==h?.name){let x;e[17]!==g||e[18]!==i||e[19]!==u||e[20]!==h?.name?(x=(b,R)=>I.jsx(kn,{item:b,isSelected:R===u,ref:R===u?Kn:void 0,onSelect:()=>g(b,R),isLoading:h?.name===b.name,renderItem:i},`${b.kind??"item"}:${b.name}`),e[17]=g,e[18]=i,e[19]=u,e[20]=h?.name,e[21]=x):x=e[21],m=d.map(x),e[11]=g,e[12]=d,e[13]=i,e[14]=u,e[15]=h?.name,e[16]=m}else m=e[16];let f;return e[22]!==m?(f=I.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:y,children:I.jsx("div",{className:"p-1",children:m})}),e[22]=m,e[23]=f):f=e[23],f};function Ln(){const n=H.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=I.jsx("div",{className:"p-1",children:[...Array(3)].map(jn)}),n[0]=e):e=n[0],e}function jn(n,e){return I.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[I.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),I.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Gn(n){const e=H.c(20),{editor:t,char:o,pluginKey:r,queryKey:s,queryFn:i,onSelect:a,allow:l,onOpenChange:c,renderItem:d,emptyLabel:u}=n;let g;e[0]!==l||e[1]!==o||e[2]!==t||e[3]!==c||e[4]!==r?(g={editor:t,char:o,pluginKey:r,allow:l,onOpenChange:c},e[0]=l,e[1]=o,e[2]=t,e[3]=c,e[4]=r,e[5]=g):g=e[5];const{state:h,dispatch:y}=On(g);let m;e[6]!==y||e[7]!==h?(m={state:h,dispatch:y},e[6]=y,e[7]=h,e[8]=m):m=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=I.jsx(Ln,{}),e[9]=f):f=e[9];let x;e[10]!==t||e[11]!==u||e[12]!==a||e[13]!==i||e[14]!==s||e[15]!==d?(x=I.jsx($n,{children:I.jsx(p.Suspense,{fallback:f,children:I.jsx(_n,{editor:t,queryKey:s,queryFn:i,onSelect:a,renderItem:d,emptyLabel:u})})}),e[10]=t,e[11]=u,e[12]=a,e[13]=i,e[14]=s,e[15]=d,e[16]=x):x=e[16];let b;return e[17]!==m||e[18]!==x?(b=I.jsx(Le.Provider,{value:m,children:x}),e[17]=m,e[18]=x,e[19]=b):b=e[19],b}function Kn(n){n&&n.scrollIntoView({block:"center",behavior:"smooth"})}export{Gn as S,Yn as a,Xn as e,Hn as s};
@@ -1 +1 @@
1
- import{r as n,j as i,cz as C,cx as _,cu as T,cA as I,cF as M,cQ as z,cM as A,c as H,l as g}from"./index-C4tYnNih.js";var b="Switch",[U]=A(b),[q,F]=U(b),y=n.forwardRef((o,e)=>{const{__scopeSwitch:t,name:s,checked:r,defaultChecked:c,required:a,disabled:d,value:u="on",onCheckedChange:w,form:l,...k}=o,[p,h]=n.useState(null),S=_(e,m=>h(m)),x=n.useRef(!1),v=p?l||!!p.closest("form"):!0,[f,N]=T({prop:r,defaultProp:c??!1,onChange:w,caller:b});return i.jsxs(q,{scope:t,checked:f,disabled:d,children:[i.jsx(C.button,{type:"button",role:"switch","aria-checked":f,"aria-required":a,"data-state":j(f),"data-disabled":d?"":void 0,disabled:d,value:u,...k,ref:S,onClick:I(o.onClick,m=>{N(B=>!B),v&&(x.current=m.isPropagationStopped(),x.current||m.stopPropagation())})}),v&&i.jsx(R,{control:p,bubbles:!x.current,name:s,value:u,checked:f,required:a,disabled:d,form:l,style:{transform:"translateX(-100%)"}})]})});y.displayName=b;var E="SwitchThumb",P=n.forwardRef((o,e)=>{const{__scopeSwitch:t,...s}=o,r=F(E,t);return i.jsx(C.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:e})});P.displayName=E;var L="SwitchBubbleInput",R=n.forwardRef(({__scopeSwitch:o,control:e,checked:t,bubbles:s=!0,...r},c)=>{const a=n.useRef(null),d=_(a,c),u=M(t),w=z(e);return n.useEffect(()=>{const l=a.current;if(!l)return;const k=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&h){const S=new Event("click",{bubbles:s});h.call(l,t),l.dispatchEvent(S)}},[u,t,s]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:d,style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});R.displayName=L;function j(o){return o?"checked":"unchecked"}var O=y,$=P;function Q(o){const e=H.c(9);let t,s;e[0]!==o?({className:t,...s}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-foreground/15 inline-flex h-[1.125rem] w-8 shrink-0 items-center rounded-full border-2 border-transparent transition-colors outline-none focus-ring disabled:opacity-50",t),e[3]=t,e[4]=r):r=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx($,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-3.5 rounded-full shadow-[0_0_0_1px_#0000000f] ring-0 transition-transform data-[state=checked]:translate-x-3.5 data-[state=unchecked]:translate-x-0")}),e[5]=c):c=e[5];let a;return e[6]!==s||e[7]!==r?(a=i.jsx(O,{"data-slot":"switch",className:r,...s,children:c}),e[6]=s,e[7]=r,e[8]=a):a=e[8],a}export{Q as S};
1
+ import{r as n,j as i,cz as C,cx as _,cu as T,cA as I,cF as M,cQ as z,cM as A,c as H,l as g}from"./index-BJ9m9LNK.js";var b="Switch",[U]=A(b),[q,F]=U(b),y=n.forwardRef((o,e)=>{const{__scopeSwitch:t,name:s,checked:r,defaultChecked:c,required:a,disabled:d,value:u="on",onCheckedChange:w,form:l,...k}=o,[p,h]=n.useState(null),S=_(e,m=>h(m)),x=n.useRef(!1),v=p?l||!!p.closest("form"):!0,[f,N]=T({prop:r,defaultProp:c??!1,onChange:w,caller:b});return i.jsxs(q,{scope:t,checked:f,disabled:d,children:[i.jsx(C.button,{type:"button",role:"switch","aria-checked":f,"aria-required":a,"data-state":j(f),"data-disabled":d?"":void 0,disabled:d,value:u,...k,ref:S,onClick:I(o.onClick,m=>{N(B=>!B),v&&(x.current=m.isPropagationStopped(),x.current||m.stopPropagation())})}),v&&i.jsx(R,{control:p,bubbles:!x.current,name:s,value:u,checked:f,required:a,disabled:d,form:l,style:{transform:"translateX(-100%)"}})]})});y.displayName=b;var E="SwitchThumb",P=n.forwardRef((o,e)=>{const{__scopeSwitch:t,...s}=o,r=F(E,t);return i.jsx(C.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:e})});P.displayName=E;var L="SwitchBubbleInput",R=n.forwardRef(({__scopeSwitch:o,control:e,checked:t,bubbles:s=!0,...r},c)=>{const a=n.useRef(null),d=_(a,c),u=M(t),w=z(e);return n.useEffect(()=>{const l=a.current;if(!l)return;const k=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&h){const S=new Event("click",{bubbles:s});h.call(l,t),l.dispatchEvent(S)}},[u,t,s]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:d,style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});R.displayName=L;function j(o){return o?"checked":"unchecked"}var O=y,$=P;function Q(o){const e=H.c(9);let t,s;e[0]!==o?({className:t,...s}=o,e[0]=o,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-foreground/15 inline-flex h-[1.125rem] w-8 shrink-0 items-center rounded-full border-2 border-transparent transition-colors outline-none focus-ring disabled:opacity-50",t),e[3]=t,e[4]=r):r=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx($,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-3.5 rounded-full shadow-[0_0_0_1px_#0000000f] ring-0 transition-transform data-[state=checked]:translate-x-3.5 data-[state=unchecked]:translate-x-0")}),e[5]=c):c=e[5];let a;return e[6]!==s||e[7]!==r?(a=i.jsx(O,{"data-slot":"switch",className:r,...s,children:c}),e[6]=s,e[7]=r,e[8]=a):a=e[8],a}export{Q as S};
@@ -1 +1 @@
1
- import{ao as P,ap as m}from"./CategoricalChart-BDZ_2Tmn.js";const w=Math.cos,f=Math.sin,c=Math.sqrt,y=Math.PI,h=2*y,v={draw(n,l){const o=c(l/y);n.moveTo(o,0),n.arc(0,0,o,0,h)}},I={draw(n,l){const o=c(l/5)/2;n.moveTo(-3*o,-o),n.lineTo(-o,-o),n.lineTo(-o,-3*o),n.lineTo(o,-3*o),n.lineTo(o,-o),n.lineTo(3*o,-o),n.lineTo(3*o,o),n.lineTo(o,o),n.lineTo(o,3*o),n.lineTo(-o,3*o),n.lineTo(-o,o),n.lineTo(-3*o,o),n.closePath()}},g=c(1/3),k=g*2,W={draw(n,l){const o=c(l/k),a=o*g;n.moveTo(0,-o),n.lineTo(a,0),n.lineTo(0,o),n.lineTo(-a,0),n.closePath()}},$={draw(n,l){const o=c(l),a=-o/2;n.rect(a,a,o,o)}},q=.8908130915292852,p=f(y/10)/f(7*y/10),M=f(h/10)*p,S=-w(h/10)*p,j={draw(n,l){const o=c(l*q),a=M*o,i=S*o;n.moveTo(0,-o),n.lineTo(a,i);for(let s=1;s<5;++s){const t=h*s/5,u=w(t),e=f(t);n.lineTo(e*o,-u*o),n.lineTo(u*a-e*i,e*a+u*i)}n.closePath()}},d=c(3),A={draw(n,l){const o=-c(l/(d*3));n.moveTo(0,o*2),n.lineTo(-d*o,-o),n.lineTo(d*o,-o),n.closePath()}},r=-.5,T=c(3)/2,b=1/c(12),C=(b/2+1)*3,B={draw(n,l){const o=c(l/C),a=o/2,i=o*b,s=a,t=o*b+o,u=-s,e=t;n.moveTo(a,i),n.lineTo(s,t),n.lineTo(u,e),n.lineTo(r*a-T*i,T*a+r*i),n.lineTo(r*s-T*t,T*s+r*t),n.lineTo(r*u-T*e,T*u+r*e),n.lineTo(r*a+T*i,r*i-T*a),n.lineTo(r*s+T*t,r*t-T*s),n.lineTo(r*u+T*e,r*e-T*u),n.closePath()}};function E(n,l){let o=null,a=P(i);n=typeof n=="function"?n:m(n||v),l=typeof l=="function"?l:m(l===void 0?64:+l);function i(){let s;if(o||(o=s=a()),n.apply(this,arguments).draw(o,+l.apply(this,arguments)),s)return o=null,s+""||null}return i.type=function(s){return arguments.length?(n=typeof s=="function"?s:m(s),i):n},i.size=function(s){return arguments.length?(l=typeof s=="function"?s:m(+s),i):l},i.context=function(s){return arguments.length?(o=s??null,i):o},i}export{E as S,A as a,j as b,$ as c,W as d,I as e,v as f,B as s};
1
+ import{ao as P,ap as m}from"./CategoricalChart-CiyWbCkx.js";const w=Math.cos,f=Math.sin,c=Math.sqrt,y=Math.PI,h=2*y,v={draw(n,l){const o=c(l/y);n.moveTo(o,0),n.arc(0,0,o,0,h)}},I={draw(n,l){const o=c(l/5)/2;n.moveTo(-3*o,-o),n.lineTo(-o,-o),n.lineTo(-o,-3*o),n.lineTo(o,-3*o),n.lineTo(o,-o),n.lineTo(3*o,-o),n.lineTo(3*o,o),n.lineTo(o,o),n.lineTo(o,3*o),n.lineTo(-o,3*o),n.lineTo(-o,o),n.lineTo(-3*o,o),n.closePath()}},g=c(1/3),k=g*2,W={draw(n,l){const o=c(l/k),a=o*g;n.moveTo(0,-o),n.lineTo(a,0),n.lineTo(0,o),n.lineTo(-a,0),n.closePath()}},$={draw(n,l){const o=c(l),a=-o/2;n.rect(a,a,o,o)}},q=.8908130915292852,p=f(y/10)/f(7*y/10),M=f(h/10)*p,S=-w(h/10)*p,j={draw(n,l){const o=c(l*q),a=M*o,i=S*o;n.moveTo(0,-o),n.lineTo(a,i);for(let s=1;s<5;++s){const t=h*s/5,u=w(t),e=f(t);n.lineTo(e*o,-u*o),n.lineTo(u*a-e*i,e*a+u*i)}n.closePath()}},d=c(3),A={draw(n,l){const o=-c(l/(d*3));n.moveTo(0,o*2),n.lineTo(-d*o,-o),n.lineTo(d*o,-o),n.closePath()}},r=-.5,T=c(3)/2,b=1/c(12),C=(b/2+1)*3,B={draw(n,l){const o=c(l/C),a=o/2,i=o*b,s=a,t=o*b+o,u=-s,e=t;n.moveTo(a,i),n.lineTo(s,t),n.lineTo(u,e),n.lineTo(r*a-T*i,T*a+r*i),n.lineTo(r*s-T*t,T*s+r*t),n.lineTo(r*u-T*e,T*u+r*e),n.lineTo(r*a+T*i,r*i-T*a),n.lineTo(r*s+T*t,r*t-T*s),n.lineTo(r*u+T*e,r*e-T*u),n.closePath()}};function E(n,l){let o=null,a=P(i);n=typeof n=="function"?n:m(n||v),l=typeof l=="function"?l:m(l===void 0?64:+l);function i(){let s;if(o||(o=s=a()),n.apply(this,arguments).draw(o,+l.apply(this,arguments)),s)return o=null,s+""||null}return i.type=function(s){return arguments.length?(n=typeof s=="function"?s:m(s),i):n},i.size=function(s){return arguments.length?(l=typeof s=="function"?s:m(+s),i):l},i.context=function(s){return arguments.length?(o=s??null,i):o},i}export{E as S,A as a,j as b,$ as c,W as d,I as e,v as f,B as s};