decocms 3.75.0 → 3.75.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/client/assets/{AlertCircle-gDIRb30q.js → AlertCircle-CNubGDaO.js} +1 -1
  2. package/dist/client/assets/{ArrowRight-DOrox7OR.js → ArrowRight-xN7BW_ul.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-DUpL9CZ2.js → ArrowUpRight-D3CKRkTo.js} +1 -1
  4. package/dist/client/assets/{Check-Cm33WeVI.js → Check-DU5rb3bM.js} +1 -1
  5. package/dist/client/assets/{CheckCircle-n1UVh1rp.js → CheckCircle-BSoYnn-I.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-B1p7gEgu.js → ChevronDown-TvYn-OY4.js} +1 -1
  7. package/dist/client/assets/{ChevronLeft-mGN37yAj.js → ChevronLeft-BTipE5Wt.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-BaLK8W40.js → ChevronRight-VbCUQ4nm.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DGOcvlL6.js → ChevronUp-CE5JDW17.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CnMx95BE.js → DotsVertical-C3vJLOIx.js} +1 -1
  11. package/dist/client/assets/{Eye-zZDQDA3a.js → Eye-C2MUknhG.js} +1 -1
  12. package/dist/client/assets/{FilterLines-Dl8wSr4T.js → FilterLines-C44nyj1e.js} +1 -1
  13. package/dist/client/assets/{Globe01-BLm5QG5d.js → Globe01-DF9LBrGV.js} +1 -1
  14. package/dist/client/assets/{Globe04-C-LVP6qx.js → Globe04-DiSYAA-c.js} +1 -1
  15. package/dist/client/assets/{HardDrive-m2RrTwEL.js → HardDrive-d3IntPKl.js} +1 -1
  16. package/dist/client/assets/{Key01-RXyewMb-.js → Key01-DoBeqbsw.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-BdoPIgTz.js → LayoutLeft-yX6ZaEXM.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-D8bSh32s.js → LinkExternal01-BzrXa1Dk.js} +1 -1
  19. package/dist/client/assets/{Monitor01-BCz40A5M.js → Monitor01-B4R66HFG.js} +1 -1
  20. package/dist/client/assets/{Palette-wtl4QkBp.js → Palette-CZf9xPYO.js} +1 -1
  21. package/dist/client/assets/{Play-DDTUl1uH.js → Play-Bh8sfYwM.js} +1 -1
  22. package/dist/client/assets/{Plus-CVwFP0PN.js → Plus-BoROENfr.js} +1 -1
  23. package/dist/client/assets/{SearchMd-BW7euwEe.js → SearchMd-BfPMpih2.js} +1 -1
  24. package/dist/client/assets/{Settings02-iz5Ayf9j.js → Settings02-DBLsMPef.js} +1 -1
  25. package/dist/client/assets/{Shield01-BCu1IdE0.js → Shield01-CTNl8Ar6.js} +1 -1
  26. package/dist/client/assets/{Star01-DCpmC1j3.js → Star01-BFLcGuw1.js} +1 -1
  27. package/dist/client/assets/{Stars01-BRfLDHl4.js → Stars01-CHs_UD1n.js} +1 -1
  28. package/dist/client/assets/{Stars02-Bzgbk92-.js → Stars02-BJLb-WgL.js} +1 -1
  29. package/dist/client/assets/{Sun-C8DHOjPt.js → Sun-BZGkPKkt.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-CfRV3USq.js → SwitchHorizontal01-Dtng_RoY.js} +1 -1
  31. package/dist/client/assets/{Tool01-B5EFkWYb.js → Tool01-lXuB6RrN.js} +1 -1
  32. package/dist/client/assets/{Trash01-pGyZZZg3.js → Trash01-DXfifcH2.js} +1 -1
  33. package/dist/client/assets/{Upload01-CO717o9q.js → Upload01-D3BizWvA.js} +1 -1
  34. package/dist/client/assets/{User01-BsJPatkI.js → User01-DJp_IeHl.js} +1 -1
  35. package/dist/client/assets/{Users01-BxvSAjH8.js → Users01-Cd5fFCG3.js} +1 -1
  36. package/dist/client/assets/{Users03-CIlsRKUq.js → Users03-DBhmjqg-.js} +1 -1
  37. package/dist/client/assets/{X-CZpN5x6J.js → X-Cb9V7Mmc.js} +1 -1
  38. package/dist/client/assets/{XCircle-DVQX_ogU.js → XCircle-D1bMGooP.js} +1 -1
  39. package/dist/client/assets/{XClose-C6AbPQFS.js → XClose-C-OqIzD0.js} +1 -1
  40. package/dist/client/assets/{Zap-DG9_RSXd.js → Zap-fD2sTtVx.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-BTnHHxm_.js → ZapSquare-CQngmi94.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-CZ4ld1AP.js → ZoomOut-btgvbLfz.js} +1 -1
  43. package/dist/client/assets/{access-gate-D9-CVWiV.js → access-gate-DopFOivn.js} +1 -1
  44. package/dist/client/assets/{add-section-modal-CP1B07W5.js → add-section-modal-DaW89V0L.js} +1 -1
  45. package/dist/client/assets/{agent-icon-B9d-96TZ.js → agent-icon-Dt9gAenf.js} +1 -1
  46. package/dist/client/assets/{agents-list-BRtDsLop.js → agents-list-DJqTtRwj.js} +1 -1
  47. package/dist/client/assets/{ai-providers-DW6wb4_w.js → ai-providers-Dt9ZC4ot.js} +1 -1
  48. package/dist/client/assets/{alert-6Fct2Yfh.js → alert-BEVgn7Ey.js} +1 -1
  49. package/dist/client/assets/{alert-dialog-BNLt3lQD.js → alert-dialog-BI0HtITQ.js} +1 -1
  50. package/dist/client/assets/{app-editor-CnPsZtOc.js → app-editor-NI3cJ7Tq.js} +1 -1
  51. package/dist/client/assets/{auth-4W_EFEAm.js → auth-B4gmwlqe.js} +1 -1
  52. package/dist/client/assets/{auth-catchall-FBHQyT3w.js → auth-catchall-BQbd477s.js} +1 -1
  53. package/dist/client/assets/{auth-entry-CatFRWPl.js → auth-entry-ChG4AH7U.js} +1 -1
  54. package/dist/client/assets/{auth-split-layout-Qbd_XkxB.js → auth-split-layout-DCJj8VSe.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-DoJkgDgr.js → automation-list-row-DppLBhCt.js} +1 -1
  56. package/dist/client/assets/{automation-runs-CUFxzmfV.js → automation-runs-5dSIKSAM.js} +1 -1
  57. package/dist/client/assets/{automations-CabohE9a.js → automations-Ci91R3wv.js} +1 -1
  58. package/dist/client/assets/{avatar-P-4FtMAp.js → avatar-fJAHQTnV.js} +1 -1
  59. package/dist/client/assets/{badge-CA2aw-nf.js → badge-_YKQKI_5.js} +1 -1
  60. package/dist/client/assets/{block-document-DBOLBUl9.js → block-document-CsRe6WAh.js} +1 -1
  61. package/dist/client/assets/{brand-context-DUqDv9rb.js → brand-context-DDDXyCcm.js} +1 -1
  62. package/dist/client/assets/{buckets-CZzli-pv.js → buckets-DFAe7O6M.js} +1 -1
  63. package/dist/client/assets/{calendar-txHWMXIT.js → calendar-DNMnej2k.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-DR1p6bTx.js → capability-load-error-6WyfjcJj.js} +1 -1
  65. package/dist/client/assets/{card-B2iG-uof.js → card--NKS06Go.js} +1 -1
  66. package/dist/client/assets/category-editor-BSYT0S7j.js +1 -0
  67. package/dist/client/assets/{chat-context-rlOQNE59.js → chat-context-BBXOT296.js} +1 -1
  68. package/dist/client/assets/{checkbox-BA_77XLZ.js → checkbox-DioyTT5K.js} +1 -1
  69. package/dist/client/assets/{cli-auth-success-ma7E5wYX.js → cli-auth-success-CyURtcqJ.js} +1 -1
  70. package/dist/client/assets/{collection-detail-CS3p9M1R.js → collection-detail-DmymJ-oX.js} +1 -1
  71. package/dist/client/assets/{collection-display-button-Dj5uDvuS.js → collection-display-button-Cd9myrh7.js} +1 -1
  72. package/dist/client/assets/{collection-search-_6FIA0Xj.js → collection-search-BZq7gbHk.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-DwMsWo9f.js → collection-tabs-D6OcWh8j.js} +1 -1
  74. package/dist/client/assets/{command-B27wsER9.js → command-C8wmQ_e6.js} +1 -1
  75. package/dist/client/assets/commerce-onboarding-nmWmtHC4.js +1 -0
  76. package/dist/client/assets/{connect-desktop-dialog-GQLUi7li.js → connect-desktop-dialog-DdSa47RX.js} +1 -1
  77. package/dist/client/assets/{connection-card-CX1DS71u.js → connection-card-Bk1hBg4j.js} +1 -1
  78. package/dist/client/assets/{connection-detail-DqcnMDO-.js → connection-detail-Bx3dAqUw.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-CBjQkddI.js → connection-form-helpers-B5KjXNd0.js} +1 -1
  80. package/dist/client/assets/{connections-F_I9_qJr.js → connections-CQD6YxIa.js} +1 -1
  81. package/dist/client/assets/{context-menu-BpgQstIM.js → context-menu-gCK6_paD.js} +1 -1
  82. package/dist/client/assets/{decopilot-FgrFF7Fp.js → decopilot-B0LSd6zj.js} +1 -1
  83. package/dist/client/assets/{decopilot-sse-pool-DMpx5_Wv.js → decopilot-sse-pool-Dr6zLVju.js} +1 -1
  84. package/dist/client/assets/{dialog-K6fUF2ve.js → dialog-oTR0pyLu.js} +1 -1
  85. package/dist/client/assets/{domain-settings-C3FHyjrg.js → domain-settings-D1RYSSaH.js} +1 -1
  86. package/dist/client/assets/{drawer-Co3WWFC1.js → drawer-CQ737j09.js} +1 -1
  87. package/dist/client/assets/{dropdown-menu-5W_sgZVH.js → dropdown-menu-C8krdQDA.js} +1 -1
  88. package/dist/client/assets/{empty-state-CO4a25-j.js → empty-state-2-TuTLZO.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-DZucvYfU.js → extract-connection-data-CoqC381t.js} +1 -1
  90. package/dist/client/assets/{file-explorer-CqPeyiCF.js → file-explorer-D_emiMhz.js} +1 -1
  91. package/dist/client/assets/{file-type-icon-BZQ5R-XM.js → file-type-icon-0w6lWLwV.js} +1 -1
  92. package/dist/client/assets/{files-BDxHO9pY.js → files-DgtpUNqB.js} +1 -1
  93. package/dist/client/assets/{form-BjMnGj6X.js → form-BagRiauK.js} +1 -1
  94. package/dist/client/assets/{general-BBlcQ-ht.js → general-u65O_ulZ.js} +1 -1
  95. package/dist/client/assets/{github-repo-picker-_k79qN8r.js → github-repo-picker-BPZlnUfE.js} +1 -1
  96. package/dist/client/assets/{hooks-D6XuBBC6.js → hooks-CxzPycJ_.js} +1 -1
  97. package/dist/client/assets/{image-field-BmdkZbCY.js → image-field-MuguRJgc.js} +1 -1
  98. package/dist/client/assets/{import-from-deco-dialog-OGhtcz0k.js → import-from-deco-dialog-UI3dH-Hl.js} +1 -1
  99. package/dist/client/assets/{index-4DFLhyGP.js → index-4QUVw0pj.js} +1 -1
  100. package/dist/client/assets/{index-5wLfHEXe.js → index-BIs9Ud-n.js} +1 -1
  101. package/dist/client/assets/{index-O7bXn1ca.js → index-BarrImOK.js} +1 -1
  102. package/dist/client/assets/{index-D1GDu3f0.js → index-BkjLb3UM.js} +1 -1
  103. package/dist/client/assets/{index-C_oukb-6.js → index-ByF5bntS.js} +3 -3
  104. package/dist/client/assets/{index-Dq7zL7ft.js → index-CDiti927.js} +1 -1
  105. package/dist/client/assets/{index-okWbIZy5.js → index-CZhEygsx.js} +4 -4
  106. package/dist/client/assets/{index-Czglk-CY.js → index-CbbSoEZK.js} +1 -1
  107. package/dist/client/assets/index-Ccsp4bJ3.js +3 -0
  108. package/dist/client/assets/{index-_4NX_Yew.js → index-D2SAtRXJ.js} +1 -1
  109. package/dist/client/assets/{index-CJD5j0F7.js → index-DIdWimus.js} +1 -1
  110. package/dist/client/assets/{index-dPL3Unnh.js → index-DaQLp-vp.js} +1 -1
  111. package/dist/client/assets/{index-MKNwh3Ag.js → index-aZUbmonm.js} +1 -1
  112. package/dist/client/assets/{index-redirect-DIsWHj9i.js → index-redirect-BihaLwOx.js} +1 -1
  113. package/dist/client/assets/{index-B-GcMgWE.js → index-vZmzAO4E.js} +1 -1
  114. package/dist/client/assets/{input-D5W2abuH.js → input-BbFJIfNw.js} +1 -1
  115. package/dist/client/assets/{integration-icon-CRb2USX8.js → integration-icon-CnsCd0E7.js} +1 -1
  116. package/dist/client/assets/{label-BElDaZMn.js → label-BMmTnqcN.js} +1 -1
  117. package/dist/client/assets/{login-DlGbre6S.js → login-BgMVzBys.js} +1 -1
  118. package/dist/client/assets/{mcp-oauth-C0C6iyUr.js → mcp-oauth-Bz-VdP7D.js} +1 -1
  119. package/dist/client/assets/{members-DANdG_qT.js → members-DR6dSQyU.js} +1 -1
  120. package/dist/client/assets/{monaco-editor-qyEj4EXj.js → monaco-editor-ESNgwP--.js} +1 -1
  121. package/dist/client/assets/{monitoring-stats-row-ClqdPUY_.js → monitoring-stats-row-kDhyNhF-.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-BnZw5lf7.js → oauth-callback-BOzxigzA.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-ai-provider-BDfsvj3N.js → oauth-callback-ai-provider-C5MfgzuH.js} +1 -1
  124. package/dist/client/assets/{onboarding-Bhh2Gfr7.js → onboarding-JGOf00z4.js} +1 -1
  125. package/dist/client/assets/{org-install-CLKcwFC7.js → org-install-DxVgzR1j.js} +1 -1
  126. package/dist/client/assets/{org-layout-BtwB1Yd_.js → org-layout-UNAnU3dA.js} +1 -1
  127. package/dist/client/assets/{organization-choice-Utx7V6Tf.js → organization-choice-U7SIyZLD.js} +1 -1
  128. package/dist/client/assets/{page-seo-form-IyeHzt0x.js → page-seo-form-DDmJ7WM7.js} +1 -1
  129. package/dist/client/assets/page-seo-sheet-tAzLcu1B.js +1 -0
  130. package/dist/client/assets/{popover-DrmoScrz.js → popover-CbGGQiRT.js} +1 -1
  131. package/dist/client/assets/{post-editor-85T1iDhM.js → post-editor-EFJORDJS.js} +1 -1
  132. package/dist/client/assets/{preview-dialog-BtBeOlGc.js → preview-dialog-C6JG48B-.js} +1 -1
  133. package/dist/client/assets/{primitives-CyAmXJ6r.js → primitives-CmNGaFLq.js} +1 -1
  134. package/dist/client/assets/{profile-BZvBJZHl.js → profile-DeZ6t4-R.js} +1 -1
  135. package/dist/client/assets/project-app-view-lTLFjkpn.js +1 -0
  136. package/dist/client/assets/record-editor-cDeH3Vh6.js +1 -0
  137. package/dist/client/assets/registry-BuM4iuit.js +2 -0
  138. package/dist/client/assets/{registry-layout-Blav6YiD.js → registry-layout-EyoNoFU9.js} +1 -1
  139. package/dist/client/assets/{require-capability-rNA3gn0T.js → require-capability-BTWSjjcL.js} +1 -1
  140. package/dist/client/assets/{required-auth-layout-DKqkYrYg.js → required-auth-layout-nQU7linn.js} +1 -1
  141. package/dist/client/assets/{reset-password-B9qOkXzA.js → reset-password-BPJYUgtU.js} +1 -1
  142. package/dist/client/assets/{roles-B0IO3W8R.js → roles-D2UJQdT5.js} +1 -1
  143. package/dist/client/assets/save-referenced-block-Cz8Q3CB5.js +1 -0
  144. package/dist/client/assets/{save-status-BGoLsugG.js → save-status-B0qeonp0.js} +1 -1
  145. package/dist/client/assets/{schema-form-AuQQIbwO.js → schema-form-C3xSIHrW.js} +1 -1
  146. package/dist/client/assets/{scroll-area-DU0ESQct.js → scroll-area-B8ItTjhW.js} +1 -1
  147. package/dist/client/assets/{search-input-CQDoT-2H.js → search-input-CdLueOhF.js} +1 -1
  148. package/dist/client/assets/{secrets-Bt7g_eL6.js → secrets-CJIvH6yN.js} +1 -1
  149. package/dist/client/assets/{sections-editor-C5D7KMRv.js → sections-editor-D8owzXB3.js} +1 -1
  150. package/dist/client/assets/{select-CWgv_m_K.js → select-Bo6CrzVw.js} +1 -1
  151. package/dist/client/assets/{select-model-BbKGRdYy.js → select-model-ppX7sHfC.js} +1 -1
  152. package/dist/client/assets/{seo-editor-B__Haa2P.js → seo-editor-0xmY1Z00.js} +1 -1
  153. package/dist/client/assets/{settings-layout-DCyMU3DC.js → settings-layout-Og4lnODt.js} +1 -1
  154. package/dist/client/assets/{settings-section-CJtoNKEm.js → settings-section-CnVR3qqE.js} +1 -1
  155. package/dist/client/assets/{sheet-CdA5nUqw.js → sheet-BuEWFo6R.js} +1 -1
  156. package/dist/client/assets/{shell-controls-CykUSzsG.js → shell-controls-DLyk9enu.js} +1 -1
  157. package/dist/client/assets/shell-layout-BmHL7kpa.js +1 -0
  158. package/dist/client/assets/{shell-route-loading-XgUvvz6p.js → shell-route-loading-RRQOTV6Y.js} +1 -1
  159. package/dist/client/assets/{sidebar-ChFfr0rN.js → sidebar-CRs9fZ48.js} +1 -1
  160. package/dist/client/assets/{skeleton-sLaw1Xk2.js → skeleton-BBoWXlQw.js} +1 -1
  161. package/dist/client/assets/{sortable.esm-B2GVQDR4.js → sortable.esm-Bj8xmSPS.js} +1 -1
  162. package/dist/client/assets/{sso-wVe-gPEC.js → sso-DtcGtItQ.js} +1 -1
  163. package/dist/client/assets/{store-DKnN_mWg.js → store-GzsI2yK1.js} +1 -1
  164. package/dist/client/assets/store-registry-DkQNv_eF.js +2 -0
  165. package/dist/client/assets/{studio-tools-Bf0h7pKn.js → studio-tools-DkpVw1Fk.js} +1 -1
  166. package/dist/client/assets/{switch-B5emAkAa.js → switch-DxdiLTfz.js} +1 -1
  167. package/dist/client/assets/{table-DDDAcgpb.js → table-DhLw2Dwk.js} +1 -1
  168. package/dist/client/assets/{tabs-DpXkahnx.js → tabs-XHi1y4Cg.js} +1 -1
  169. package/dist/client/assets/{task-status-DxP55tG6.js → task-status-Cavo-ZwA.js} +1 -1
  170. package/dist/client/assets/{textarea-wSBnNv7u.js → textarea-_jouvwDc.js} +1 -1
  171. package/dist/client/assets/{toggle-group-BcGBnErX.js → toggle-group-CfmlR7sy.js} +1 -1
  172. package/dist/client/assets/{toolbar-fshSxuLx.js → toolbar-CIBafoV_.js} +1 -1
  173. package/dist/client/assets/{tooltip-CDUQmtIe.js → tooltip-BGNlh40O.js} +1 -1
  174. package/dist/client/assets/{types-BXRFG3iR.js → types-sci-lCr2.js} +1 -1
  175. package/dist/client/assets/{use-ai-providers-D_ebIH0r.js → use-ai-providers-B2SGssyX.js} +1 -1
  176. package/dist/client/assets/{use-automations-ERukqXr_.js → use-automations-DlxacTNX.js} +1 -1
  177. package/dist/client/assets/{use-capability-CrbE-PVJ.js → use-capability-B9zmFZLR.js} +1 -1
  178. package/dist/client/assets/{use-clock-tick-Doyp_hie.js → use-clock-tick-xD667FrM.js} +1 -1
  179. package/dist/client/assets/{use-collections-C5c19M28.js → use-collections-YcK_UpXo.js} +1 -1
  180. package/dist/client/assets/{use-connection-BmWMtwa9.js → use-connection-8IOgdNi0.js} +1 -1
  181. package/dist/client/assets/{use-copy-Cq9FbLLo.js → use-copy-CRqf_gDL.js} +1 -1
  182. package/dist/client/assets/{use-create-virtual-mcp-DdNYKluu.js → use-create-virtual-mcp-CDVY_QqV.js} +1 -1
  183. package/dist/client/assets/{use-debounced-autosave-D7-TM9NJ.js → use-debounced-autosave-cJge7NGp.js} +1 -1
  184. package/dist/client/assets/{use-deco-credits-l2OguEyG.js → use-deco-credits-DgT4uYPb.js} +1 -1
  185. package/dist/client/assets/{use-delete-connection-LB7jL5NP.js → use-delete-connection-2pMxBj7g.js} +1 -1
  186. package/dist/client/assets/{use-file-configs-BIkBkbG9.js → use-file-configs-ClyDZHyo.js} +1 -1
  187. package/dist/client/assets/{use-infinite-scroll-eransp1S.js → use-infinite-scroll-B-zoWl8c.js} +1 -1
  188. package/dist/client/assets/{use-join-requests-DJIGN6qo.js → use-join-requests-CS9hHY93.js} +1 -1
  189. package/dist/client/assets/{use-mcp-client-4Oly-YkT.js → use-mcp-client-BI9mCeJ3.js} +1 -1
  190. package/dist/client/assets/{use-mcp-prompts-BzVgnzr0.js → use-mcp-prompts-B4uY1_xI.js} +1 -1
  191. package/dist/client/assets/{use-mcp-tools-BQHlQR5o.js → use-mcp-tools-B5SwMdAl.js} +1 -1
  192. package/dist/client/assets/{use-members-DfpjiEN8.js → use-members-BXMztwuo.js} +1 -1
  193. package/dist/client/assets/{use-navigate-to-agent-BkZH8xYi.js → use-navigate-to-agent-BeUkvKDD.js} +1 -1
  194. package/dist/client/assets/{use-org-auth-client-BUfV82c_.js → use-org-auth-client-BN1ti7dt.js} +1 -1
  195. package/dist/client/assets/{use-org-sso-BHaPLxVv.js → use-org-sso-C6H_RLHI.js} +1 -1
  196. package/dist/client/assets/{use-organization-roles-CHXWUrIp.js → use-organization-roles-B7adr4SK.js} +1 -1
  197. package/dist/client/assets/{use-organization-settings-D2zerFXW.js → use-organization-settings-C1kJraO9.js} +1 -1
  198. package/dist/client/assets/{use-registry-connections-D-BNd8aV.js → use-registry-connections-xZJwULcQ.js} +1 -1
  199. package/dist/client/assets/{use-secrets-cs3fO-m_.js → use-secrets-Dz889CgS.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-DpP7gGFB.js → use-status-sounds-CRdMhPvE.js} +1 -1
  201. package/dist/client/assets/{use-view-mode-D-rE3O6I.js → use-view-mode-rOJla7nl.js} +1 -1
  202. package/dist/client/assets/{use-virtual-mcp-Ctv1YJgk.js → use-virtual-mcp-DVO8vnjv.js} +1 -1
  203. package/dist/client/assets/useInfiniteQuery-cug4FXD1.js +1 -0
  204. package/dist/client/assets/useSuspenseInfiniteQuery-B6VvfHY4.js +1 -0
  205. package/dist/client/assets/{variant-calendar-se_uWtri.js → variant-calendar-B3h7hcmo.js} +1 -1
  206. package/dist/client/assets/{view-mode-toggle-DuWN4iSs.js → view-mode-toggle-B8QrRReE.js} +1 -1
  207. package/dist/client/index.html +1 -1
  208. package/dist/server/cli.js +6 -6
  209. package/dist/server/server.js +3 -3
  210. package/package.json +1 -1
  211. package/dist/client/assets/category-editor-dHLb0Q5z.js +0 -1
  212. package/dist/client/assets/commerce-onboarding-Cc0EEeKk.js +0 -1
  213. package/dist/client/assets/index-fBd_LCW3.js +0 -3
  214. package/dist/client/assets/page-seo-sheet-BAekolJG.js +0 -1
  215. package/dist/client/assets/project-app-view-C27tx_mL.js +0 -1
  216. package/dist/client/assets/record-editor-DCcletMQ.js +0 -1
  217. package/dist/client/assets/registry-BMCM3rbD.js +0 -2
  218. package/dist/client/assets/save-referenced-block-KDKLCPRO.js +0 -1
  219. package/dist/client/assets/shell-layout-CrOv1YY7.js +0 -1
  220. package/dist/client/assets/store-registry-Be51xSYe.js +0 -2
  221. package/dist/client/assets/useInfiniteQuery-ClmiO4eL.js +0 -1
  222. package/dist/client/assets/useSuspenseInfiniteQuery-Bg7QIp7e.js +0 -1
@@ -1,2 +1,2 @@
1
- import{c as J,r as te,j as s,l as ge,B as Ce,t as Re,k as kn,K as Cn}from"./index-C_oukb-6.js";import{K as Tn,D as Lt,am as An,an as wn,ao as Rn,ap as In,aq as $n,ar as On,P as Dn,as as xt,N as gt,l as lt,S as Ln}from"./agent-icon-B9d-96TZ.js";import{C as Fn}from"./calendar-txHWMXIT.js";import{I as ke}from"./input-D5W2abuH.js";import{L as be}from"./label-BElDaZMn.js";import{a as Ft,b as Et,P as Mt}from"./popover-DrmoScrz.js";import{T as En}from"./textarea-wSBnNv7u.js";import{a as Mn}from"./XCircle-DVQX_ogU.js";import{d as Bn}from"./SwitchHorizontal01-CfRV3USq.js";import{v as zn,y as Pn,z as Vn}from"./scroll-area-DU0ESQct.js";import{S as Un}from"./switch-B5emAkAa.js";import{a as Bt,b as zt,c as Pt,S as Vt,d as Ut}from"./select-CWgv_m_K.js";import{u as Kt,a as Be,K as Ht,P as Wt,b as Yt,C as qt,s as Gt,d as nt,D as Xt,c as Qt,S as Zt,v as Jt,e as en}from"./sortable.esm-B2GVQDR4.js";import{c as ot}from"./ZoomOut-CZ4ld1AP.js";import{s as tn}from"./Plus-CVwFP0PN.js";import{s as We}from"./Trash01-pGyZZZg3.js";import{D as nn,a as sn,b as rn,c as st}from"./dropdown-menu-5W_sgZVH.js";import{i as Oe,Y as Ye,Z as yt,m as ze,_ as Se,$ as ln,a0 as Kn,a1 as qe,a2 as Pe,a3 as Hn,a4 as Wn,a5 as rt,a6 as Yn,X as qn,n as vt,a7 as Gn,a8 as Xn}from"./index-okWbIZy5.js";import{e as on,u as Qn,m as Zn,L as Jn,F as es,I as ts}from"./image-field-BmdkZbCY.js";import{t as at}from"./ChevronDown-B1p7gEgu.js";import{i as an}from"./ChevronRight-BaLK8W40.js";import{i as ns}from"./Globe01-BLm5QG5d.js";import{T as Ve,a as Ue,b as Ke}from"./tooltip-CDUQmtIe.js";import{i as ss}from"./Check-Cm33WeVI.js";import{d as rs}from"./Tool01-B5EFkWYb.js";import{b as cn,C as un,a as it,e as fn,c as dn,d as is,g as ls}from"./command-B27wsER9.js";import{i as os}from"./Upload01-CO717o9q.js";import{c as as}from"./use-file-configs-BIkBkbG9.js";import{a as cs}from"./Eye-zZDQDA3a.js";import{i as us}from"./FilterLines-Dl8wSr4T.js";const fs="oklch(0.65 0.15 160)",ds="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",mn="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",Li="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function bt(t){return t.map(e=>e.label).join(`
1
+ import{c as J,r as te,j as s,l as ge,B as Ce,t as Re,k as kn,K as Cn}from"./index-ByF5bntS.js";import{K as Tn,D as Lt,am as An,an as wn,ao as Rn,ap as In,aq as $n,ar as On,P as Dn,as as xt,N as gt,l as lt,S as Ln}from"./agent-icon-Dt9gAenf.js";import{C as Fn}from"./calendar-DNMnej2k.js";import{I as ke}from"./input-BbFJIfNw.js";import{L as be}from"./label-BMmTnqcN.js";import{a as Ft,b as Et,P as Mt}from"./popover-CbGGQiRT.js";import{T as En}from"./textarea-_jouvwDc.js";import{a as Mn}from"./XCircle-D1bMGooP.js";import{d as Bn}from"./SwitchHorizontal01-Dtng_RoY.js";import{v as zn,y as Pn,z as Vn}from"./scroll-area-B8ItTjhW.js";import{S as Un}from"./switch-DxdiLTfz.js";import{a as Bt,b as zt,c as Pt,S as Vt,d as Ut}from"./select-Bo6CrzVw.js";import{u as Kt,a as Be,K as Ht,P as Wt,b as Yt,C as qt,s as Gt,d as nt,D as Xt,c as Qt,S as Zt,v as Jt,e as en}from"./sortable.esm-Bj8xmSPS.js";import{c as ot}from"./ZoomOut-btgvbLfz.js";import{s as tn}from"./Plus-BoROENfr.js";import{s as We}from"./Trash01-DXfifcH2.js";import{D as nn,a as sn,b as rn,c as st}from"./dropdown-menu-C8krdQDA.js";import{i as Oe,Y as Ye,Z as yt,m as ze,_ as Se,$ as ln,a0 as Kn,a1 as qe,a2 as Pe,a3 as Hn,a4 as Wn,a5 as rt,a6 as Yn,X as qn,n as vt,a7 as Gn,a8 as Xn}from"./index-CZhEygsx.js";import{e as on,u as Qn,m as Zn,L as Jn,F as es,I as ts}from"./image-field-MuguRJgc.js";import{t as at}from"./ChevronDown-TvYn-OY4.js";import{i as an}from"./ChevronRight-VbCUQ4nm.js";import{i as ns}from"./Globe01-DF9LBrGV.js";import{T as Ve,a as Ue,b as Ke}from"./tooltip-BGNlh40O.js";import{i as ss}from"./Check-DU5rb3bM.js";import{d as rs}from"./Tool01-lXuB6RrN.js";import{b as cn,C as un,a as it,e as fn,c as dn,d as is,g as ls}from"./command-C8wmQ_e6.js";import{i as os}from"./Upload01-D3BizWvA.js";import{c as as}from"./use-file-configs-ClyDZHyo.js";import{a as cs}from"./Eye-C2MUknhG.js";import{i as us}from"./FilterLines-C44nyj1e.js";const fs="oklch(0.65 0.15 160)",ds="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",mn="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",Li="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function bt(t){return t.map(e=>e.label).join(`
2
2
  `)}function Qe(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function ms(t){return t.map((e,n)=>({...e,index:n}))}function pn(t){const e=J.c(17),{label:n,canDelete:r,dragging:i,onDuplicate:o,onDelete:l}=t,a=i?"opacity-100":"opacity-0 group-hover:opacity-100";let c;e[0]!==a?(c=ge("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",a),e[0]=a,e[1]=c):c=e[1];let u;e[2]!==c?(u=s.jsx(ot,{className:c}),e[2]=c,e[3]=u):u=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Tn,{className:"h-4 w-4 shrink-0",style:{color:fs}}),e[4]=d):d=e[4];let f;e[5]!==n?(f=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:n}),e[5]=n,e[6]=f):f=e[6];let m;e[7]!==r||e[8]!==i||e[9]!==n||e[10]!==l||e[11]!==o?(m=!i&&s.jsxs(nn,{children:[s.jsx(sn,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":`Open actions for ${n}`,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:hs,onPointerDown:ps,children:s.jsx(Lt,{size:14})})}),s.jsxs(rn,{align:"end",children:[s.jsxs(st,{onClick:y=>{y.stopPropagation(),o?.()},children:[s.jsx(cs,{size:14}),"Duplicate"]}),s.jsxs(st,{variant:"destructive",disabled:!r,onClick:y=>{y.stopPropagation(),l?.()},children:[s.jsx(We,{size:14}),"Delete"]})]})]}),e[7]=r,e[8]=i,e[9]=n,e[10]=l,e[11]=o,e[12]=m):m=e[12];let p;return e[13]!==u||e[14]!==f||e[15]!==m?(p=s.jsxs(s.Fragment,{children:[u,d,f,m]}),e[13]=u,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function ps(t){return t.stopPropagation()}function hs(t){return t.stopPropagation()}function xs(t){const e=J.c(26),{entry:n,selected:r,canDelete:i,onSelect:o,onDuplicate:l,onDelete:a}=t;let c;e[0]!==n.id?(c={id:n.id,animateLayoutChanges:gs},e[0]=n.id,e[1]=c):c=e[1];const{attributes:u,listeners:d,setNodeRef:f,transform:m,isDragging:p}=Yt(c);let y;e[2]!==m?(y=qt.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=y):y=e[3];const x=p?0:void 0;let v;e[4]!==y||e[5]!==x?(v={transform:y,opacity:x},e[4]=y,e[5]=x,e[6]=v):v=e[6];const g=v;let h;e[7]!==o?(h=N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),o())},e[7]=o,e[8]=h):h=e[8];const b=p?"cursor-grabbing":"cursor-grab",k=r?mn:ds;let S;e[9]!==b||e[10]!==k?(S=ge("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",b,k),e[9]=b,e[10]=k,e[11]=S):S=e[11];let C;e[12]!==i||e[13]!==n.label||e[14]!==a||e[15]!==l?(C=s.jsx(pn,{label:n.label,canDelete:i,onDuplicate:l,onDelete:a}),e[12]=i,e[13]=n.label,e[14]=a,e[15]=l,e[16]=C):C=e[16];let _;return e[17]!==u||e[18]!==d||e[19]!==o||e[20]!==f||e[21]!==g||e[22]!==h||e[23]!==S||e[24]!==C?(_=s.jsx("div",{ref:f,style:g,...u,...d,onClick:o,onKeyDown:h,className:S,children:C}),e[17]=u,e[18]=d,e[19]=o,e[20]=f,e[21]=g,e[22]=h,e[23]=S,e[24]=C,e[25]=_):_=e[25],_}function gs(){return!1}function ys(t){const e=J.c(81),{listKey:n,variants:r,selectedIndex:i,onSelect:o,onDuplicate:l,onDelete:a,onRemoveAll:c,onReorder:u,onAdd:d}=t,f=r.length>1;let m;e[0]!==r?(m=()=>Qe(r),e[0]=r,e[1]=m):m=e[1];const[p,y]=te.useState(m),[x,v]=te.useState(null),[g,h]=te.useState(n),[b,k]=te.useState(r.length);let S;e[2]!==r?(S=()=>bt(r),e[2]=r,e[3]=S):S=e[3];const[C,_]=te.useState(S),N=te.useRef(!1),T=bt(r);g!==n?(h(n),k(r.length),_(T),y(Qe(r))):b!==r.length?(k(r.length),_(T),y(Qe(r))):C!==T&&(_(T),y(B=>r.map((W,Z)=>({id:B[Z]?.id??crypto.randomUUID(),index:W.index,label:W.label}))));let A;e[4]===Symbol.for("react.memo_cache_sentinel")?(A={activationConstraint:{distance:8}},e[4]=A):A=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j={coordinateGetter:Gt},e[5]=j):j=e[5];const D=Kt(Be(Wt,A),Be(Ht,j));let O;e[6]!==p?(O=p.map(vs),e[6]=p,e[7]=O):O=e[7];const $=O;let P;e[8]!==p?(P=B=>{const W=String(B.active.id);v(p.find(Z=>Z.id===W)??null)},e[8]=p,e[9]=P):P=e[9];const z=P;let w;e[10]!==$||e[11]!==u?(w=B=>{v(null);const{active:W,over:Z}=B;if(!Z||W.id===Z.id)return;const ce=$.indexOf(String(W.id)),xe=$.indexOf(String(Z.id));ce===-1||xe===-1||(y(he=>ms(nt([...he],ce,xe))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),u(ce,xe))},e[10]=$,e[11]=u,e[12]=w):w=e[12];const R=w;let ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=()=>{v(null)},e[13]=ee):ee=e[13];const fe=ee;let Q,V,H,Y,F,U,ne,E,M,q,ie,G,de;if(e[14]!==f||e[15]!==p||e[16]!==$||e[17]!==R||e[18]!==z||e[19]!==d||e[20]!==a||e[21]!==l||e[22]!==c||e[23]!==o||e[24]!==i||e[25]!==D){const B=L=>{N.current||o(L)};ie="space-y-1 border-b p-2";let W;e[39]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[39]=W):W=e[39];let Z;e[40]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(tn,{size:14}),e[40]=Z):Z=e[40];let ce;e[41]!==d?(ce=s.jsx(Ve,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:d,children:Z})}),e[41]=d,e[42]=ce):ce=e[42];let xe;e[43]===Symbol.for("react.memo_cache_sentinel")?(xe=s.jsx(Ue,{children:"Add variant"}),e[43]=xe):xe=e[43];let he;e[44]!==ce?(he=s.jsxs(Ke,{children:[ce,xe]}),e[44]=ce,e[45]=he):he=e[45];let ye;e[46]===Symbol.for("react.memo_cache_sentinel")?(ye=s.jsx(We,{size:14}),e[46]=ye):ye=e[46];let ue;e[47]!==c?(ue=s.jsx(Ve,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":"Remove all variants",className:"size-6 text-muted-foreground hover:text-destructive",onClick:c,children:ye})}),e[47]=c,e[48]=ue):ue=e[48];let je;e[49]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx(Ue,{children:"Remove all variants"}),e[49]=je):je=e[49];let I;e[50]!==ue?(I=s.jsxs(Ke,{children:[ue,je]}),e[50]=ue,e[51]=I):I=e[51],e[52]!==he||e[53]!==I?(G=s.jsxs("div",{className:"flex items-center justify-between",children:[W,s.jsxs("div",{className:"flex items-center gap-0.5",children:[he,I]})]}),e[52]=he,e[53]=I,e[54]=G):G=e[54],V=Xt,U=D,ne=Qt,E=z,M=R,q=fe,Q=Zt,Y=$,F=Jt,de="space-y-0.5",H=p.map(L=>s.jsx(xs,{entry:L,selected:L.index===i,canDelete:f,onSelect:()=>B(L.index),onDuplicate:()=>l(L.index),onDelete:()=>a(L.index)},L.id)),e[14]=f,e[15]=p,e[16]=$,e[17]=R,e[18]=z,e[19]=d,e[20]=a,e[21]=l,e[22]=c,e[23]=o,e[24]=i,e[25]=D,e[26]=Q,e[27]=V,e[28]=H,e[29]=Y,e[30]=F,e[31]=U,e[32]=ne,e[33]=E,e[34]=M,e[35]=q,e[36]=ie,e[37]=G,e[38]=de}else Q=e[26],V=e[27],H=e[28],Y=e[29],F=e[30],U=e[31],ne=e[32],E=e[33],M=e[34],q=e[35],ie=e[36],G=e[37],de=e[38];let ae;e[55]!==H||e[56]!==de?(ae=s.jsx("div",{className:de,children:H}),e[55]=H,e[56]=de,e[57]=ae):ae=e[57];let se;e[58]!==Q||e[59]!==Y||e[60]!==F||e[61]!==ae?(se=s.jsx(Q,{items:Y,strategy:F,children:ae}),e[58]=Q,e[59]=Y,e[60]=F,e[61]=ae,e[62]=se):se=e[62];let me;e[63]!==x||e[64]!==f?(me=x?s.jsx("div",{className:ge("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",mn),children:s.jsx(pn,{label:x.label,canDelete:f,dragging:!0})}):null,e[63]=x,e[64]=f,e[65]=me):me=e[65];let le;e[66]!==me?(le=s.jsx(en,{dropAnimation:null,children:me}),e[66]=me,e[67]=le):le=e[67];let K;e[68]!==V||e[69]!==U||e[70]!==ne||e[71]!==E||e[72]!==M||e[73]!==q||e[74]!==se||e[75]!==le?(K=s.jsxs(V,{sensors:U,collisionDetection:ne,onDragStart:E,onDragEnd:M,onDragCancel:q,children:[se,le]}),e[68]=V,e[69]=U,e[70]=ne,e[71]=E,e[72]=M,e[73]=q,e[74]=se,e[75]=le,e[76]=K):K=e[76];let X;return e[77]!==ie||e[78]!==G||e[79]!==K?(X=s.jsxs("div",{className:ie,children:[G,K]}),e[77]=ie,e[78]=G,e[79]=K,e[80]=X):X=e[80],X}function vs(t){return t.id}function ct(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Oe(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function bs(t){return t.includes("flags/multivariate")}function js(t){return Se(t)}function _s(t,e){const n=[...t],r=new Set(n.map(o=>o.resolveType)),i=(o,l)=>{!o||r.has(o)||(r.add(o),n.push({resolveType:o,title:l??js(o)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const o=ct(e.editorValue);o?.includes("/")&&i(o)}return n}function Ss(t,e,n){const r=e[0]?.resolveType??"";if(n)return n;if(!t||typeof t!="object"||Array.isArray(t))return r;const i=t,o=i.__resolveType;if(typeof o=="string"){if(Ye(o)){const f=e.find(m=>m.resolveType===o);return f?f.resolveType:o}const u=e.find(f=>yt(f.resolveType,o));if(u)return u.resolveType;const d=e.find(f=>f.resolveType===o);if(d)return d.resolveType;if(o.includes("/"))return o}const l=typeof i.type=="string"?i.type:void 0;if(l){const u=e.find(d=>d.discriminatorValue===l||d.resolveType===l||yt(d.resolveType,l));if(u)return u.resolveType}let a=r,c=-1;for(const u of e){if(!u.schema?.properties)continue;const f=Object.keys(u.schema.properties).filter(m=>!m.startsWith("__")&&m!=="@type"&&m!=="action"&&m!=="alt").filter(m=>i[m]!==void 0).length;f>0&&f>c&&(c=f,a=u.resolveType)}return c>0,a}function jt(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return n??null;const r=ct(t);if(!r)return n??null;if(!e)return r.includes("/")?null:n??null;const i=ze(r,e);return i||(r.includes("/")?null:n??null)}function Ns(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const n={...t.properties};return delete n[e],{...t,properties:n}}function hn(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Oe(e.__resolveType))return null;const n=e.section;return!n||typeof n!="object"||Array.isArray(n)?null:n}function ks(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=ct(n);return r&&bs(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(i=>!i.startsWith("__")&&i!=="@type")}function Cs(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function Ts(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=e.find(i=>typeof i.value=="string");if(r)return r.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function xn(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(xn);const e=t;return e.__resolveType?Ts(e)??t:gn(e)}function gn(t){const e={};for(const[n,r]of Object.entries(t))e[n]=xn(r);return e}function As(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function yn(t){return t==null?"":Array.isArray(t)?t.map(yn).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function ut(t,e){if(!t.includes("{"))return;const n=gn(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,o,l)=>{const a=(o??l??"").trim();return yn(As(n,a))}).trim()||void 0}function ws(t){return t.replace(/<[^>]*>/g,"").trim()}function Rs(t,e){if(e.includes("{"))return ut(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const r=n.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(r)return r}}function Te(t,e,n){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;const i=hn(r);if(i&&(r=i),n?.titleBy){const l=Rs(r,n.titleBy);if(l)return l}for(const l of["name","label","title","alt","text","href","id","key"]){const a=r[l];if(typeof a=="string"&&a.trim()){const c=n?.properties?.[l]?.format;if(c==="rich-text"||c==="html"){const u=ws(a);if(u)return u;continue}return a}if(Array.isArray(a)){const c=a.map(u=>u==null?"":String(u)).filter(Boolean).join(",");if(c)return c}}const o=r.__resolveType;if(typeof o=="string"&&o)return Se(o);if(n?.title){const l=ut(n.title,r);if(l)return l;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function Is(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const n=e.properties;return n?.mobile?"{{{image.mobile}}}":n?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function _t(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=Is(e);if(!n)return;const r=ut(n,t);if(!r)return;const i=on(r)||r;return Cs(i)}function vn(t){return t===ln||t===Kn}function Ge(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function He(t,e){const n=t.__resolveType??"";if(!n)return null;if(Oe(n)){const r=t.section??{};return bn(r,e)}if(vn(n)){const r=t.variants?.[0]?.value;return r?He(r,e):null}return!Ye(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ge(n,e)}function bn(t,e){const n=t.__resolveType??"";if(!n)return null;if(vn(n)){const r=t.variants?.[0]?.value;return r?He(r,e):null}return!Ye(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ge(n,e)}function $s(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!Ye(r)||!Object.hasOwn(e,r))return null;const i=Ge(r,e);return i?{blockKey:r,...i}:null}function Fi(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Ge(r,n)}if(e.isHidden){const o=(Oe(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return He(o,n)}if(e.isLazy||Oe(t.__resolveType)){const r=t.section??{};return bn(r,n)}return He(t,n)}const Os=new Set(["http:","https:","mailto:","tel:","ftp:"]);function Ds(t){if(t.startsWith("/")||t.startsWith(".")||t.startsWith("#"))return!0;try{const e=new URL(t,"https://placeholder.invalid");return Os.has(e.protocol)}catch{return!1}}function Ne(t){const e=J.c(8),{active:n,label:r,onClick:i,children:o}=t,l=n?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let a;e[0]!==l?(a=ge("flex h-7 w-7 items-center justify-center rounded transition-colors cursor-pointer",l),e[0]=l,e[1]=a):a=e[1];let c;return e[2]!==n||e[3]!==o||e[4]!==r||e[5]!==i||e[6]!==a?(c=s.jsx("button",{type:"button","aria-label":r,"aria-pressed":n,onMouseDown:Ls,onClick:i,className:a,children:o}),e[2]=n,e[3]=o,e[4]=r,e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function Ls(t){return t.preventDefault()}function Fs({schema:t,value:e,onChange:n,path:r,label:i}){const o=typeof e=="string"?e:"",l=te.useRef(n);l.current=n;const a=zn({extensions:[Pn.configure({heading:{levels:[1,2,3]}})],content:o||"",editorProps:{attributes:{class:ge("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:c})=>{const u=c.getHTML();l.current(u==="<p></p>"?"":u)}});return a?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(be,{htmlFor:r,children:i}),t.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:t.description})]}),s.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[s.jsx(Ne,{active:a.isActive("bold"),label:"Bold",onClick:()=>a.chain().focus().toggleBold().run(),children:s.jsx(An,{size:14})}),s.jsx(Ne,{active:a.isActive("italic"),label:"Italic",onClick:()=>a.chain().focus().toggleItalic().run(),children:s.jsx(wn,{size:14})}),s.jsx(Ne,{active:a.isActive("underline"),label:"Underline",onClick:()=>a.chain().focus().toggleUnderline().run(),children:s.jsx(Rn,{size:14})}),s.jsx(Ne,{active:a.isActive("strike"),label:"Strikethrough",onClick:()=>a.chain().focus().toggleStrike().run(),children:s.jsx(In,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(Ne,{active:a.isActive("heading",{level:1}),label:"Heading 1",onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),children:s.jsx($n,{size:14})}),s.jsx(Ne,{active:a.isActive("heading",{level:2}),label:"Heading 2",onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),children:s.jsx(On,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(Ne,{active:a.isActive("bulletList"),label:"Bullet list",onClick:()=>a.chain().focus().toggleBulletList().run(),children:s.jsx(Bn,{size:14})}),s.jsx(Ne,{active:a.isActive("orderedList"),label:"Ordered list",onClick:()=>a.chain().focus().toggleOrderedList().run(),children:s.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(Ne,{active:a.isActive("link"),label:"Link",onClick:()=>{const c=a.getAttributes("link").href,u=window.prompt("Link URL",c??"https://");u!==null&&(u===""?a.chain().focus().unsetLink().run():Ds(u)&&a.chain().focus().setLink({href:u}).run())},children:s.jsx(Mn,{size:14})})]}),s.jsx(Vn,{editor:a})]})]}):null}const we=t=>String(t).padStart(2,"0"),Es="1900-01-01",Ms="2099-12-31",Bs="1900-01-01T00:00",zs="2099-12-31T23:59";function Ps(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const n=new Date(t);return Number.isNaN(n.getTime())?"":`${n.getUTCFullYear()}-${we(n.getUTCMonth()+1)}-${we(n.getUTCDate())}`}function Vs(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function Us(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${we(e.getMonth()+1)}-${we(e.getDate())}T${we(e.getHours())}:${we(e.getMinutes())}`}function Ks(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function Hs(t){const e=J.c(29),{id:n,withTime:r,value:i,onChange:o}=t,[l,a]=te.useState(!1);let c;e[0]!==i||e[1]!==r?(c=r?Us(i):Ps(i),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;let d;e[3]!==o||e[4]!==r?(d=T=>{o(r?Ks(T.target.value):Vs(T.target.value))},e[3]=o,e[4]=r,e[5]=d):d=e[5];const f=d;let m;if(e[6]!==i){const T=i?new Date(i):null;m=T&&!Number.isNaN(T.getTime())?T:null,e[6]=i,e[7]=m}else m=e[7];const p=m;let y;e[8]!==o||e[9]!==p||e[10]!==r?(y=T=>{T&&(r&&p?T.setHours(p.getHours(),p.getMinutes(),0,0):T.setHours(0,0,0,0),o(T.toISOString()),a(!1))},e[8]=o,e[9]=p,e[10]=r,e[11]=y):y=e[11];const x=y,v=r?"datetime-local":"date",g=r?Bs:Es,h=r?zs:Ms;let b;e[12]!==f||e[13]!==n||e[14]!==u||e[15]!==v||e[16]!==g||e[17]!==h?(b=s.jsx(ke,{id:n,type:v,min:g,max:h,value:u,onChange:f,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=f,e[13]=n,e[14]=u,e[15]=v,e[16]=g,e[17]=h,e[18]=b):b=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Ft,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:s.jsx(Dn,{className:"h-4 w-4"})})}),e[19]=k):k=e[19];const S=p??void 0;let C;e[20]!==x||e[21]!==S?(C=s.jsx(Et,{className:"w-auto p-0",align:"end",children:s.jsx(Fn,{mode:"single",selected:S,onSelect:x,initialFocus:!0})}),e[20]=x,e[21]=S,e[22]=C):C=e[22];let _;e[23]!==l||e[24]!==C?(_=s.jsxs(Mt,{open:l,onOpenChange:a,children:[k,C]}),e[23]=l,e[24]=C,e[25]=_):_=e[25];let N;return e[26]!==_||e[27]!==b?(N=s.jsxs("div",{className:"flex gap-1",children:[b,_]}),e[26]=_,e[27]=b,e[28]=N):N=e[28],N}function Le(t){const e=J.c(8),{htmlFor:n,label:r,description:i}=t;let o;e[0]!==n||e[1]!==r?(o=s.jsx(be,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=o):o=e[2];let l;e[3]!==i?(l=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=s.jsxs("div",{className:"space-y-0.5",children:[o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function Fe(t){const e=J.c(67),{schema:n,value:r,onChange:i,path:o,label:l}=t,a=typeof r=="string"?r:"",c=n.format;if(c==="rich-text"||c==="rich-text-inline"||c==="html"){let x;return e[0]!==l||e[1]!==i||e[2]!==o||e[3]!==n||e[4]!==r?(x=s.jsx(Fs,{schema:n,value:r,onChange:i,path:o,label:l}),e[0]=l,e[1]=i,e[2]=o,e[3]=n,e[4]=r,e[5]=x):x=e[5],x}if(c==="textarea"||c==="markdown"){let x;e[6]!==l||e[7]!==o||e[8]!==n.description?(x=s.jsx(Le,{htmlFor:o,label:l,description:n.description}),e[6]=l,e[7]=o,e[8]=n.description,e[9]=x):x=e[9];let v;e[10]!==i?(v=b=>i(b.target.value),e[10]=i,e[11]=v):v=e[11];let g;e[12]!==o||e[13]!==a||e[14]!==v?(g=s.jsx(En,{id:o,value:a,onChange:v,rows:4}),e[12]=o,e[13]=a,e[14]=v,e[15]=g):g=e[15];let h;return e[16]!==x||e[17]!==g?(h=s.jsxs("div",{className:"space-y-2",children:[x,g]}),e[16]=x,e[17]=g,e[18]=h):h=e[18],h}if(c==="date"||c==="date-time"){let x;e[19]!==l||e[20]!==o||e[21]!==n.description?(x=s.jsx(Le,{htmlFor:o,label:l,description:n.description}),e[19]=l,e[20]=o,e[21]=n.description,e[22]=x):x=e[22];const v=c==="date-time";let g;e[23]!==i||e[24]!==o||e[25]!==a||e[26]!==v?(g=s.jsx(Hs,{id:o,withTime:v,value:a,onChange:i}),e[23]=i,e[24]=o,e[25]=a,e[26]=v,e[27]=g):g=e[27];let h;return e[28]!==x||e[29]!==g?(h=s.jsxs("div",{className:"space-y-2",children:[x,g]}),e[28]=x,e[29]=g,e[30]=h):h=e[30],h}if(c==="color-input"){let x;e[31]!==l||e[32]!==o||e[33]!==n.description?(x=s.jsx(Le,{htmlFor:o,label:l,description:n.description}),e[31]=l,e[32]=o,e[33]=n.description,e[34]=x):x=e[34];const v=a||"#000000";let g;e[35]!==i?(g=_=>i(_.target.value),e[35]=i,e[36]=g):g=e[36];let h;e[37]!==v||e[38]!==g?(h=s.jsx("input",{type:"color",value:v,onChange:g,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[37]=v,e[38]=g,e[39]=h):h=e[39];let b;e[40]!==i?(b=_=>i(_.target.value),e[40]=i,e[41]=b):b=e[41];let k;e[42]!==o||e[43]!==a||e[44]!==b?(k=s.jsx(ke,{id:o,value:a,onChange:b,placeholder:"#000000",className:"h-10 flex-1"}),e[42]=o,e[43]=a,e[44]=b,e[45]=k):k=e[45];let S;e[46]!==h||e[47]!==k?(S=s.jsxs("div",{className:"flex items-center gap-2",children:[h,k]}),e[46]=h,e[47]=k,e[48]=S):S=e[48];let C;return e[49]!==x||e[50]!==S?(C=s.jsxs("div",{className:"space-y-2",children:[x,S]}),e[49]=x,e[50]=S,e[51]=C):C=e[51],C}let u;e[52]!==l||e[53]!==o||e[54]!==n.description?(u=s.jsx(Le,{htmlFor:o,label:l,description:n.description}),e[52]=l,e[53]=o,e[54]=n.description,e[55]=u):u=e[55];const d=c==="url"?"url":"text";let f;e[56]!==i?(f=x=>i(x.target.value),e[56]=i,e[57]=f):f=e[57];const m=n.default!=null?String(n.default):void 0;let p;e[58]!==o||e[59]!==a||e[60]!==d||e[61]!==f||e[62]!==m?(p=s.jsx(ke,{id:o,type:d,value:a,onChange:f,placeholder:m,className:"h-10"}),e[58]=o,e[59]=a,e[60]=d,e[61]=f,e[62]=m,e[63]=p):p=e[63];let y;return e[64]!==u||e[65]!==p?(y=s.jsxs("div",{className:"space-y-2",children:[u,p]}),e[64]=u,e[65]=p,e[66]=y):y=e[66],y}function Ws(t){const e=J.c(17),{schema:n,value:r,onChange:i,path:o,label:l}=t,a=typeof r=="number"?r:"";let c;e[0]!==l||e[1]!==o?(c=s.jsx(be,{htmlFor:o,children:l}),e[0]=l,e[1]=o,e[2]=c):c=e[2];let u;e[3]!==n.description?(u=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=d):d=e[7];let f;e[8]!==i?(f=y=>{const x=y.target.value;i(x===""?void 0:Number(x))},e[8]=i,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==o||e[12]!==f?(m=s.jsx(ke,{id:o,type:"number",value:a,onChange:f,className:"h-10"}),e[10]=a,e[11]=o,e[12]=f,e[13]=m):m=e[13];let p;return e[14]!==d||e[15]!==m?(p=s.jsxs("div",{className:"space-y-2",children:[d,m]}),e[14]=d,e[15]=m,e[16]=p):p=e[16],p}function Ys(t){const e=J.c(17),{value:n,onChange:r,path:i,label:o,schema:l}=t,a=typeof n=="boolean"?n:!1;let c;e[0]!==o||e[1]!==i?(c=s.jsx(be,{htmlFor:i,children:o}),e[0]=o,e[1]=i,e[2]=c):c=e[2];let u;e[3]!==l.description?(u=l.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l.description}),e[3]=l.description,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=d):d=e[7];let f;e[8]!==r?(f=y=>r(y),e[8]=r,e[9]=f):f=e[9];let m;e[10]!==a||e[11]!==i||e[12]!==f?(m=s.jsx(Un,{id:i,checked:a,onCheckedChange:f}),e[10]=a,e[11]=i,e[12]=f,e[13]=m):m=e[13];let p;return e[14]!==d||e[15]!==m?(p=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[d,m]}),e[14]=d,e[15]=m,e[16]=p):p=e[16],p}const ft="__enum_empty__";function dt(t){return t===""?ft:String(t)}function qs(t,e){if(t===ft)return"";const n=e.find(r=>dt(r)===t);return n!==void 0?n:t}function Gs(t,e){return t==null?e.some(n=>n==="")?ft:void 0:dt(t)}function Xs(t){return t===""?"":String(t)}function Qs(t){const e=J.c(28),{schema:n,value:r,onChange:i,path:o,label:l}=t;let a;e[0]!==n.enum?(a=n.enum??[],e[0]=n.enum,e[1]=a):a=e[1];const c=a;let u;e[2]!==c||e[3]!==r?(u=Gs(r,c),e[2]=c,e[3]=r,e[4]=u):u=e[4];const d=u;let f;e[5]!==l||e[6]!==o?(f=s.jsx(be,{htmlFor:o,children:l}),e[5]=l,e[6]=o,e[7]=f):f=e[7];let m;e[8]!==n.description?(m=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=m):m=e[9];let p;e[10]!==f||e[11]!==m?(p=s.jsxs("div",{className:"space-y-0.5",children:[f,m]}),e[10]=f,e[11]=m,e[12]=p):p=e[12];let y;e[13]!==i||e[14]!==c?(y=k=>i(qs(k,c)),e[13]=i,e[14]=c,e[15]=y):y=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(zt,{className:"h-10",children:s.jsx(Pt,{placeholder:"Select..."})}),e[16]=x):x=e[16];let v;e[17]!==c?(v=c.map(Zs),e[17]=c,e[18]=v):v=e[18];let g;e[19]!==v?(g=s.jsx(Vt,{children:v}),e[19]=v,e[20]=g):g=e[20];let h;e[21]!==d||e[22]!==y||e[23]!==g?(h=s.jsxs(Ut,{value:d,onValueChange:y,children:[x,g]}),e[21]=d,e[22]=y,e[23]=g,e[24]=h):h=e[24];let b;return e[25]!==h||e[26]!==p?(b=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[25]=h,e[26]=p,e[27]=b):b=e[27],b}function Zs(t){const e=dt(t);return s.jsx(Bt,{value:e,children:Xs(t)},e)}function jn(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ae(t){return t.normalize("NFC").trim()}function pe(t,e){return Ae(t)===Ae(e)}function St(t,e){return Ae(t).replace(/\s+/g,"").toLowerCase()===Ae(e).replace(/\s+/g,"").toLowerCase()}function Ee(t,e,n){const r=Ae(n);if(t.some(l=>pe(l,r)||pe(l,n)))return t;const i=[...t];return i.some(l=>pe(l,e))||i.push(e),i.push(n),i}function Js(t,e,n){if(n.length===0)return n;const r=Ie(t,e),i=n[0];return pe(i,r)||pe(i,t)?n.slice(1):n}function Ie(t,e){return e.title??jn(t)}function Ei(t,e){return e<=0?[]:t.slice(0,e)}function Ze(t,e){const n=Ae(e);return t.findIndex(r=>Ae(r)===n)}function Nt(t,e){return t.type==="array"&&t.items||qe(t)?!0:Array.isArray(e)}function er(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function De(t,e,n,r){if(r.length===0)return null;const i=r[0];for(const l of t){const a=e[l];if(!a||!Nt(a,n[l]))continue;const c=Ie(l,a);if(pe(i,c)||pe(i,l)||r.some(u=>pe(u,c)||pe(u,l)))return l}for(const l of t){const a=e[l];if(!a||!Nt(a,n[l]))continue;const c=n[l];if(!Array.isArray(c))continue;const u=a.items;for(let d=0;d<c.length;d++){const f=Te(c[d],d,u);if(pe(f,i))return l}}for(const l of t){const a=e[l];if(a?.type!=="object"||!a.properties)continue;const c=Object.keys(a.properties),u=er(n[l]),d=Ie(l,a);if(De(c,a.properties,u,r)||(pe(i,d)||pe(i,l))&&De(c,a.properties,u,r.slice(1)))return l}let o=null;for(const l of t){const a=e[l];if(a?.type!=="block-ref")continue;const c=Ie(l,a);if(!(i!==c&&i!==l)){if(r.length>1){const u=n[l];if(u&&typeof u=="object"&&!Array.isArray(u)){const d=r[1];if(Object.keys(u).some(m=>!m.startsWith("__")&&(St(jn(m),d)||St(m,d))))return l}}o||(o=l)}}return o||null}function tr(t,e,n,r){return De(t,e,n,r)}function nr(t,e,n,r,i){if(i.length===0||!n.properties)return!1;const o=Object.keys(n.properties);if(De(o,n.properties,r,i))return!0;const l=i[0];return!pe(l,e)&&!pe(l,t)?!1:i.length>1||De(o,n.properties,r,i.slice(1))!==null}function sr(t,e,n,r){if(e.length===0)return null;for(let o=0;o<e.length;o++){const l=e[o],a=n.findIndex((c,u)=>pe(Te(c,u,r),l));if(a>=0)return{index:a,innerPath:e.slice(o+1)}}const i=e.findIndex(o=>pe(o,t));if(i>=0&&e.length>i+1){const o=e[i+1],l=n.findIndex((a,c)=>pe(Te(a,c,r),o));if(l>=0)return{index:l,innerPath:e.slice(i+2)}}return null}function Je(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===ln}function rr(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Je(n.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Je(n.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(n=>Je(n.resolveType)):!1}function ir(t,e){if(e==="global"||e==="sections"||qe(t))return!0;const n=t.type==="array"?t.items:void 0;return n?rr(n):!1}function kt(t){return Array.from({length:t},(e,n)=>({id:crypto.randomUUID(),index:n}))}function lr(t,e,n,r,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const o=t.__resolveType;if(typeof o=="string"&&n){const l=ze(o,n);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(n&&r&&i){const l=ze(r,n)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function or(t){const e=t.split(".").filter(n=>!/^\d+$/.test(n));return e[e.length-1]??t}function _n(t){return t.map((e,n)=>({...e,index:n}))}function ar(t,e){if(e===t.length)return t;if(e<t.length)return _n(t.slice(0,e));const n=Array.from({length:e-t.length},(r,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...n]}function cr(t){const e=J.c(8),{labelText:n,imageSrc:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ot,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let o;e[1]!==r?(o=r&&s.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=r,e[2]=o):o=e[2];let l;e[3]!==n?(l=s.jsx("span",{className:"min-w-0 truncate",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=s.jsxs(s.Fragment,{children:[i,s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[o,l]})]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function ur(t){const e=J.c(37),{sortableId:n,labelText:r,imageSrc:i,onOpen:o,onRemove:l}=t;let a;e[0]!==n?(a={id:n,animateLayoutChanges:mr},e[0]=n,e[1]=a):a=e[1];const{attributes:c,listeners:u,setNodeRef:d,transform:f,isDragging:m}=Yt(a);let p;e[2]!==f?(p=qt.Transform.toString(f?{...f,x:0}:null),e[2]=f,e[3]=p):p=e[3];const y=m?0:void 0;let x;e[4]!==p||e[5]!==y?(x={transform:p,opacity:y},e[4]=p,e[5]=y,e[6]=x):x=e[6];const v=x;let g;e[7]!==o?(g=$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),o())},e[7]=o,e[8]=g):g=e[8];const h=m?"cursor-grabbing":"cursor-pointer";let b;e[9]!==h?(b=ge("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",h),e[9]=h,e[10]=b):b=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(ot,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let S;e[12]!==i?(S=i&&s.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=S):S=e[13];let C;e[14]!==r?(C=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:r}),e[14]=r,e[15]=C):C=e[15];const _=`Open actions for ${r}`;let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(Lt,{size:14}),e[16]=N):N=e[16];let T;e[17]!==_?(T=s.jsx(sn,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon","aria-label":_,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:dr,onPointerDown:fr,children:N})}),e[17]=_,e[18]=T):T=e[18];let A;e[19]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(We,{size:14}),e[19]=A):A=e[19];let j;e[20]!==l?(j=s.jsx(rn,{align:"end",children:s.jsxs(st,{className:"text-destructive focus:text-destructive",onClick:l,children:[A,"Delete"]})}),e[20]=l,e[21]=j):j=e[21];let D;e[22]!==T||e[23]!==j?(D=s.jsxs(nn,{children:[T,j]}),e[22]=T,e[23]=j,e[24]=D):D=e[24];let O;return e[25]!==c||e[26]!==r||e[27]!==u||e[28]!==o||e[29]!==d||e[30]!==v||e[31]!==C||e[32]!==D||e[33]!==g||e[34]!==b||e[35]!==S?(O=s.jsxs("div",{ref:d,style:v,...c,...u,role:"button",tabIndex:0,onClick:o,onKeyDown:g,className:b,title:r,children:[k,S,C,D]}),e[25]=c,e[26]=r,e[27]=u,e[28]=o,e[29]=d,e[30]=v,e[31]=C,e[32]=D,e[33]=g,e[34]=b,e[35]=S,e[36]=O):O=e[36],O}function fr(t){return t.stopPropagation()}function dr(t){return t.stopPropagation()}function mr(){return!1}function Me(t){const e=J.c(24),{schema:n,value:r,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:f,containerResolveType:m,previewBaseUrl:p,onAddSectionItem:y,onRequestAddSection:x,sandbox:v}=t,g=a===void 0?[]:a,h=Array.isArray(r)?r:[],b=n.items,k=or(o),S=ir(n,k),C=sr(l,g,h,b),_=C?.index??null,[N,T]=te.useState(()=>kt(h.length)),[A,j]=te.useState(null),[D,O]=te.useState(o),[$,P]=te.useState(h.length),z=te.useRef(!1);D!==o?(O(o),P(h.length),T(kt(h.length))):$!==h.length&&(P(h.length),T(I=>ar(I,h.length)));let w;e[0]!==b?(w=(I,L)=>Te(I,L,b),e[0]=b,e[1]=w):w=e[1];const R=w,ee=I=>{if(z.current)return;const L=R(h[I],I);c?.(Ee(g,l,L))},fe=I=>{const L=[...h,I];i(L);const oe=L.length-1,re=Te(I,oe,b);c?.(Ee(g,l,re))},Q=()=>{const I=b?.type,L=b?.default!==void 0?b.default:I==="object"?{}:I==="block-ref"?(()=>{const _e=b?.anyOfRefs?.[0]?.resolveType;return typeof _e!="string"||Pe(_e)?{}:{__resolveType:_e}})():I==="number"||I==="integer"?0:I==="boolean"?!1:I==="array"?[]:"",oe=[...h,L];i(oe);const re=oe.length-1,ve=Te(L,re,b);c?.(Ee(g,l,ve))},V=()=>{if(S){if(!p){Re.error("Start the preview dev server to add sections.");return}if(x){x({append:fe});return}Re.error("Section picker is not available in this editor.");return}Q()},H=I=>{if(i(h.filter((L,oe)=>oe!==I)),_===I){const L=R(h[I],I),oe=Ze(g,L);c?.(oe>=0?g.slice(0,oe):[])}},Y=(I,L)=>{const oe=[...h];if(oe[I]=L,i(oe),I===_&&_!==null){const re=R(h[I],I),ve=Te(L,I,b);if(re!==ve){const _e=Ze(g,re);if(_e>=0){const ht=[...g];ht[_e]=ve,c?.(ht)}}}};let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[2]=F):F=e[2];let U;e[3]===Symbol.for("react.memo_cache_sentinel")?(U={coordinateGetter:Gt},e[3]=U):U=e[3];const ne=Kt(Be(Wt,F),Be(Ht,U)),E=N.map(pr);let M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M=I=>{j(String(I.active.id))},e[4]=M):M=e[4];const q=M,ie=I=>{j(null);const{active:L,over:oe}=I;if(!oe||L.id===oe.id)return;const re=E.indexOf(String(L.id)),ve=E.indexOf(String(oe.id));re===-1||ve===-1||(T(_e=>_n(nt([..._e],re,ve))),i(nt([...h],re,ve)),z.current=!0,requestAnimationFrame(()=>{z.current=!1}))};let G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=()=>{j(null)},e[5]=G):G=e[5];const de=G,ae=A?N.find(I=>I.id===A):null,se=ae!=null?h[ae.index]:void 0,me=ae!=null&&se!==void 0?R(se,ae.index):null,le=ae!=null&&se!==void 0?_t(se,b):void 0;if(_!==null&&_<h.length){const I=h[_],L=lr(I,b,u,m,k),oe=()=>{const re=R(I,_),ve=Ee(g,l,re),_e=Ze(ve,re);return _e>=0?ve.slice(0,_e+1):ve};return s.jsx("div",{className:"min-w-0",children:L?.type==="object"&&L.properties?s.jsx(Xe,{schema:L,value:I,onChange:re=>Y(_,re),basePath:`${o}.${_}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:re=>{c?.([...oe(),...re])},meta:u,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:y,onRequestAddSection:x,sandbox:v}):L?pt({schema:L,value:I,onChange:re=>Y(_,re),path:`${o}.${_}`,label:L.title??`Item ${_+1}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:re=>{c?.([...oe(),...re])},meta:u,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:y,onRequestAddSection:x,sandbox:v}):null})}const K="space-y-2";let X;e[6]!==l?(X=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[6]=l,e[7]=X):X=e[7];const B=h.length>0&&s.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:h.length});let W;e[8]!==X||e[9]!==B?(W=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[X,B]}),e[8]=X,e[9]=B,e[10]=W):W=e[10];let Z;e[11]!==n.description?(Z=n.description&&s.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=Z):Z=e[12];let ce;e[13]!==W||e[14]!==Z?(ce=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[W,Z]}),e[13]=W,e[14]=Z,e[15]=ce):ce=e[15];const xe=h.length>0&&s.jsx("div",{className:ge(A&&"cursor-grabbing"),children:s.jsxs(Xt,{sensors:ne,collisionDetection:Qt,onDragStart:q,onDragEnd:ie,onDragCancel:de,children:[s.jsx(Zt,{items:E,strategy:Jt,children:s.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:N.map(I=>{const L=h[I.index];if(L===void 0)return null;const oe=R(L,I.index),re=_t(L,b);return s.jsx(ur,{sortableId:I.id,labelText:oe,imageSrc:re,onOpen:()=>ee(I.index),onRemove:()=>H(I.index)},I.id)})})}),s.jsx(en,{dropAnimation:null,children:me?s.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:s.jsx(cr,{labelText:me,imageSrc:le})}):null})]})});let he;e[16]===Symbol.for("react.memo_cache_sentinel")?(he=s.jsx(tn,{size:14}),e[16]=he):he=e[16];const ye=S?"Add section":"Add item";let ue;e[17]!==V||e[18]!==ye?(ue=s.jsxs("button",{type:"button",onClick:V,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[he,ye]}),e[17]=V,e[18]=ye,e[19]=ue):ue=e[19];let je;return e[20]!==ce||e[21]!==xe||e[22]!==ue?(je=s.jsxs("div",{className:K,children:[ce,xe,ue]}),e[20]=ce,e[21]=xe,e[22]=ue,e[23]=je):je=e[23],je}function pr(t){return t.id}function hr(t){const e=J.c(44),{schema:n,value:r,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:y,sandbox:x}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const g=v,[h,b]=te.useState(!1);let k;e[2]!==r?(k=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=k):k=e[3];const S=k;if(!n.properties)return null;let C;e[4]!==o?(C=o.split(".").pop()??o,e[4]=o,e[5]=C):C=e[5];const _=C;let N;e[6]!==g||e[7]!==_||e[8]!==l||e[9]!==S||e[10]!==n?(N=nr(_,l,n,S,g),e[6]=g,e[7]=_,e[8]=l,e[9]=S,e[10]=n,e[11]=N):N=e[11];const A=h||N,j=`${o}-fields`;let D;e[12]===Symbol.for("react.memo_cache_sentinel")?(D=()=>b(xr),e[12]=D):D=e[12];let O;e[13]!==A?(O=s.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:A?s.jsx(at,{size:16}):s.jsx(an,{size:16})}),e[13]=A,e[14]=O):O=e[14];let $;e[15]!==l?($=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[15]=l,e[16]=$):$=e[16];let P;e[17]!==j||e[18]!==A||e[19]!==O||e[20]!==$?(P=s.jsxs("button",{type:"button","aria-expanded":A,"aria-controls":j,onClick:D,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[O,$]}),e[17]=j,e[18]=A,e[19]=O,e[20]=$,e[21]=P):P=e[21];let z;e[22]!==n.description?(z=n.description&&s.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=z):z=e[23];let w;e[24]!==g||e[25]!==j||e[26]!==d||e[27]!==A||e[28]!==u||e[29]!==S||e[30]!==p||e[31]!==c||e[32]!==i||e[33]!==y||e[34]!==f||e[35]!==o||e[36]!==m||e[37]!==x||e[38]!==n?(w=A&&s.jsx("div",{id:j,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:s.jsx(Xe,{schema:n,value:S,onChange:i,basePath:o,breadcrumbPath:g,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:y,sandbox:x})}),e[24]=g,e[25]=j,e[26]=d,e[27]=A,e[28]=u,e[29]=S,e[30]=p,e[31]=c,e[32]=i,e[33]=y,e[34]=f,e[35]=o,e[36]=m,e[37]=x,e[38]=n,e[39]=w):w=e[39];let R;return e[40]!==z||e[41]!==w||e[42]!==P?(R=s.jsxs("div",{className:"min-w-0 space-y-2",children:[P,z,w]}),e[40]=z,e[41]=w,e[42]=P,e[43]=R):R=e[43],R}function xr(t){return!t}function gr(t){if(!t?.properties)return{};const e={};for(const[n,r]of Object.entries(t.properties))n.startsWith("__")||n==="@type"||(r.default!==void 0?e[n]=r.default:r.type==="boolean"?e[n]=!1:r.type==="string"?e[n]="":r.type==="number"||r.type==="integer"?e[n]=0:r.type==="object"&&(e[n]={}));return e}function yr(t){const e=J.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ve,{asChild:!0,children:s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[s.jsx(ns,{size:11}),"Global"]})}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=s.jsxs(Ke,{children:[r,s.jsxs(Ue,{side:"top",className:"max-w-[260px]",children:["Edits the saved block “",n,"”. Changes apply everywhere this loader is referenced on your site."]})]}),e[1]=n,e[2]=i):i=e[2],i}function vr(t){const e=J.c(28),{path:n,open:r,onOpenChange:i,title:o,nested:l,nestedBlockRef:a,globalBlockKey:c}=t,u=`${n}-loader-config`,d=a&&"ml-1";let f;e[0]!==d?(f=ge("rounded-lg border border-border/80 bg-muted/30",d),e[0]=d,e[1]=f):f=e[1];let m;e[2]!==i||e[3]!==r?(m=()=>i(!r),e[2]=i,e[3]=r,e[4]=m):m=e[4];let p;e[5]!==r?(p=s.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?s.jsx(at,{size:16}):s.jsx(an,{size:16})}),e[5]=r,e[6]=p):p=e[6];let y;e[7]!==o?(y=s.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:o}),e[7]=o,e[8]=y):y=e[8];let x;e[9]!==c?(x=c&&s.jsx(yr,{blockKey:c}),e[9]=c,e[10]=x):x=e[10];let v;e[11]!==y||e[12]!==x?(v=s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[y,x]}),e[11]=y,e[12]=x,e[13]=v):v=e[13];let g;e[14]!==u||e[15]!==r||e[16]!==m||e[17]!==p||e[18]!==v?(g=s.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":u,onClick:m,className:"group flex w-full min-w-0 items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[p,v]}),e[14]=u,e[15]=r,e[16]=m,e[17]=p,e[18]=v,e[19]=g):g=e[19];let h;e[20]!==u||e[21]!==l||e[22]!==r?(h=r&&s.jsx("div",{id:u,className:"border-t border-border/60 px-4 pb-4 pt-3",children:s.jsx("div",{className:"border-l border-border/80 pl-4",children:l})}),e[20]=u,e[21]=l,e[22]=r,e[23]=h):h=e[23];let b;return e[24]!==f||e[25]!==g||e[26]!==h?(b=s.jsxs("div",{className:f,children:[g,h]}),e[24]=f,e[25]=g,e[26]=h,e[27]=b):b=e[27],b}function Ct(t){const e=J.c(35),{schema:n,value:r,onChange:i,path:o,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:f,sandbox:m}=t,p=(n.anyOfRefs??[]).filter(_r),y=d&&r?$s(r,d):null,x=y?.data??r,v=y?null:hn(x),g=v??x,h=_s(p,{savedBlockKey:y?.blockKey,editorValue:x}),b=h.length>0?Ss(x,h,y?.blockKey):h[0]?.resolveType??"",S=n.type==="block-ref"&&h.some(jr);let C;e[0]!==l||e[1]!==o?(C=l??(o.includes(".")?o.split(".")[0]:o),e[0]=l,e[1]=o,e[2]=C):C=e[2];const _=C;let N;e[3]!==a?(N=a??[],e[3]=a,e[4]=N):N=e[4];const T=N,A=S&&T[0]===_?T.slice(1):T,j=S?F=>{c?.([_,...F])}:c,[D,O]=te.useState(b),[$,P]=te.useState(b);$!==b&&(P(b),O(b));const[z,w]=te.useState(()=>ks(x,y?.blockKey));if(h.length>0){const F=D||b;let U;e[5]!==F?(U=B=>B.resolveType===F,e[5]=F,e[6]=U):U=e[6];const ne=h.find(U),E=jt(x,u,ne?.schema),M=Ns(E??ne?.schema??null,n.discriminatorKey),q=n.discriminatorKey,ie=B=>{O(B);const W=h.find(ue=>ue.resolveType===B),Z=jt(x,u,W?.schema),ce=new Set(Object.keys((Z??W?.schema)?.properties??{})),xe=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},he=Object.fromEntries(Object.entries(xe).filter(ue=>{const[je]=ue;return ce.has(je)})),ye={...gr(W?.schema),...he};if(q){const ue=W?.discriminatorValue??B;i({...ye,[q]:ue});return}if(Pe(B)){i(ye);return}i({...ye,__resolveType:B})};let G;e[7]!==F||e[8]!==q||e[9]!==i?(G=B=>{if(q||!Pe(F)||B===null||typeof B!="object"||Array.isArray(B)){i(B);return}const{__resolveType:W,...Z}=B;i(Z)},e[7]=F,e[8]=q,e[9]=i,e[10]=G):G=e[10];const de=G,ae=M?.properties?s.jsx(Xe,{schema:M,value:g,onChange:B=>{if(y&&f){f(y.blockKey,B);return}if(v){i({...x,section:B});return}de(B)},basePath:o,breadcrumbPath:A,onBreadcrumbChange:j,meta:u,decofile:d,onSaveReferencedBlock:f,sandbox:m}):null;let se;e[11]!==o?(se=o.includes("."),e[11]=o,e[12]=se):se=e[12];const me=se;let le;e[13]!==l||e[14]!==o?(le=s.jsx(be,{htmlFor:o,children:l}),e[13]=l,e[14]=o,e[15]=le):le=e[15];let K;e[16]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(zt,{children:s.jsx(Pt,{placeholder:"Select..."})}),e[16]=K):K=e[16];let X;return e[17]!==n.description?(X=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[17]=n.description,e[18]=X):X=e[18],s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[le,s.jsxs(Ut,{value:F||void 0,onValueChange:ie,children:[K,s.jsx(Vt,{children:h.map(br)})]}),X]}),ae&&(S?s.jsx(vr,{path:o,open:z,onOpenChange:w,title:me?"Configuration":"Loader configuration",nested:ae,nestedBlockRef:me,globalBlockKey:y?.blockKey}):ae)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let R;e[19]!==l||e[20]!==o?(R=s.jsx(be,{htmlFor:o,children:l}),e[19]=l,e[20]=o,e[21]=R):R=e[21];const ee=r!=null?String(r):"";let fe;e[22]!==i?(fe=F=>i(F.target.value),e[22]=i,e[23]=fe):fe=e[23];const Q=n.description??"";let V;e[24]!==o||e[25]!==ee||e[26]!==fe||e[27]!==Q?(V=s.jsx("input",{id:o,type:"text",value:ee,onChange:fe,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:Q}),e[24]=o,e[25]=ee,e[26]=fe,e[27]=Q,e[28]=V):V=e[28];let H;e[29]!==n.description?(H=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[29]=n.description,e[30]=H):H=e[30];let Y;return e[31]!==R||e[32]!==V||e[33]!==H?(Y=s.jsxs("div",{className:"space-y-1.5",children:[R,V,H]}),e[31]=R,e[32]=V,e[33]=H,e[34]=Y):Y=e[34],Y}function br(t){const e=t.title&&!t.title.includes("/")?t.title:Hn(t.resolveType)??Se(t.resolveType);return s.jsx(Bt,{value:t.resolveType,children:e},t.resolveType)}function jr(t){return t.resolveType.includes("/")&&!Pe(t.resolveType)}function _r(t){return t.resolveType!==""}function Sr(t){if(!Array.isArray(t))return[];const e=[];for(const n of t)if(typeof n=="string")e.push({value:n,label:n});else if(n&&typeof n=="object"&&"value"in n){const r=n;e.push({value:String(r.value),label:typeof r.label=="string"?r.label:String(r.value),image:typeof r.image=="string"?r.image:void 0})}return e}async function Nr(t,e,n){const r={};n&&(r.term=n);const o=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(o,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!l.ok)throw new Error(`Failed to fetch dynamic options: ${l.status}`);const a=await l.json();return Sr(a)}function Tt(t){const e=J.c(8),{path:n,label:r,description:i}=t;let o;e[0]!==r||e[1]!==n?(o=s.jsx(be,{htmlFor:n,children:r}),e[0]=r,e[1]=n,e[2]=o):o=e[2];let l;e[3]!==i?(l=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=s.jsxs("div",{className:"space-y-0.5",children:[o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function kr(t){const e=J.c(71),{schema:n,value:r,onChange:i,path:o,label:l,sandbox:a}=t,c=n.options,u=a?.previewUrl,[d,f]=te.useState(!1),[m,p]=te.useState(""),[y,x]=te.useState(""),v=te.useRef(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=E=>{p(E),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{x(E)},300)},e[0]=g):g=e[0];const h=g,b=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"";let k;e[1]!==y||e[2]!==c||e[3]!==b?(k=Cn.sandboxInvoke(b,`dynamic-options:${c??""}:${y}`),e[1]=y,e[2]=c,e[3]=b,e[4]=k):k=e[4];let S;e[5]!==y||e[6]!==c||e[7]!==u?(S=()=>Nr(u,c,y||void 0),e[5]=y,e[6]=c,e[7]=u,e[8]=S):S=e[8];const C=!!u&&!!c&&d;let _;e[9]!==k||e[10]!==S||e[11]!==C?(_={queryKey:k,queryFn:S,enabled:C,staleTime:6e4,retry:1},e[9]=k,e[10]=S,e[11]=C,e[12]=_):_=e[12];const N=kn(_);let T;e[13]!==N.data?(T=N.data??[],e[13]=N.data,e[14]=T):T=e[14];const A=T,j=typeof r=="string"?r:"";let D;if(e[15]!==j||e[16]!==A){let E;e[18]!==j?(E=M=>M.value===j,e[18]=j,e[19]=E):E=e[19],D=A.find(E),e[15]=j,e[16]=A,e[17]=D}else D=e[17];const O=D;if(!u||!c){let E;e[20]!==l||e[21]!==o||e[22]!==n.description?(E=s.jsx(Tt,{path:o,label:l,description:n.description}),e[20]=l,e[21]=o,e[22]=n.description,e[23]=E):E=e[23];let M;e[24]!==i?(M=G=>i(G.target.value),e[24]=i,e[25]=M):M=e[25];let q;e[26]!==j||e[27]!==o||e[28]!==M?(q=s.jsx(ke,{id:o,type:"text",value:j,onChange:M}),e[26]=j,e[27]=o,e[28]=M,e[29]=q):q=e[29];let ie;return e[30]!==q||e[31]!==E?(ie=s.jsxs("div",{className:"space-y-2",children:[E,q]}),e[30]=q,e[31]=E,e[32]=ie):ie=e[32],ie}let $;e[33]!==l||e[34]!==o||e[35]!==n.description?($=s.jsx(Tt,{path:o,label:l,description:n.description}),e[33]=l,e[34]=o,e[35]=n.description,e[36]=$):$=e[36];let P;e[37]!==j||e[38]!==O?(P=O?s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[O.image&&s.jsx("img",{src:O.image,alt:"",referrerPolicy:"no-referrer",className:"h-6 w-6 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:O.label??O.value})]}):j?s.jsx("span",{className:"truncate",children:j}):s.jsx("span",{className:"text-muted-foreground",children:"Select..."}),e[37]=j,e[38]=O,e[39]=P):P=e[39];let z;e[40]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(rs,{className:"size-4 shrink-0 opacity-50"}),e[40]=z):z=e[40];let w;e[41]!==d||e[42]!==P?(w=s.jsx(Ft,{asChild:!0,children:s.jsxs(Ce,{variant:"outline",role:"combobox","aria-expanded":d,className:"h-10 w-full justify-between font-normal",children:[P,z]})}),e[41]=d,e[42]=P,e[43]=w):w=e[43];let R;e[44]===Symbol.for("react.memo_cache_sentinel")?(R={width:"var(--radix-popover-trigger-width)"},e[44]=R):R=e[44];let ee;e[45]!==m?(ee=s.jsx(cn,{placeholder:"Search...",className:"h-9",value:m,onValueChange:h}),e[45]=m,e[46]=ee):ee=e[46];const fe=N.isLoading?"Loading...":"No results found.";let Q;e[47]!==fe?(Q=s.jsx(un,{children:fe}),e[47]=fe,e[48]=Q):Q=e[48];let V;if(e[49]!==j||e[50]!==i||e[51]!==A){let E;e[53]!==j||e[54]!==i?(E=M=>s.jsxs(it,{value:M.value,onSelect:()=>{i(M.value===j?"":M.value),f(!1)},children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[M.image&&s.jsx("img",{src:M.image,alt:"",referrerPolicy:"no-referrer",className:"h-9 w-9 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:M.label??M.value})]}),s.jsx(ss,{className:ge("ml-auto size-4 shrink-0",j===M.value?"opacity-100":"opacity-0")})]},M.value),e[53]=j,e[54]=i,e[55]=E):E=e[55],V=A.map(E),e[49]=j,e[50]=i,e[51]=A,e[52]=V}else V=e[52];let H;e[56]!==V?(H=s.jsx(fn,{children:V}),e[56]=V,e[57]=H):H=e[57];let Y;e[58]!==Q||e[59]!==H?(Y=s.jsxs(dn,{children:[Q,H]}),e[58]=Q,e[59]=H,e[60]=Y):Y=e[60];let F;e[61]!==ee||e[62]!==Y?(F=s.jsx(Et,{className:"p-0",style:R,children:s.jsxs(is,{shouldFilter:!1,children:[ee,Y]})}),e[61]=ee,e[62]=Y,e[63]=F):F=e[63];let U;e[64]!==d||e[65]!==w||e[66]!==F?(U=s.jsxs(Mt,{open:d,onOpenChange:f,children:[w,F]}),e[64]=d,e[65]=w,e[66]=F,e[67]=U):U=e[67];let ne;return e[68]!==U||e[69]!==$?(ne=s.jsxs("div",{className:"space-y-2",children:[$,U]}),e[68]=U,e[69]=$,e[70]=ne):ne=e[70],ne}function At(t){const e=J.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=s.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Cr(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Tr(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function Ar(t){const e=J.c(79),{schema:n,value:r,onChange:i,path:o,label:l,sandbox:a}=t,c=n.format==="video-uri",u=on(r),[d,f]=te.useState(!1),[m,p]=te.useState(!1),y=u?Cr(u):"",x=y?Tr(y):"",v=as(),g=Qn();let h;e[0]!==v.data?.configs?(h=v.data?.configs??[],e[0]=v.data?.configs,e[1]=h):h=e[1];const b=a?.siteSlug;let k;e[2]!==h||e[3]!==b?(k=Zn(h,b),e[2]=h,e[3]=b,e[4]=k):k=e[4];const S=k;let C;e[5]!==v.data?.configs||e[6]!==S?(C=function(){if(S)return S.id;const K=v.data?.configs??[];if(K.length===1)return K[0].id;if(K.length===0)return null;const X=typeof window<"u"?window.localStorage.getItem(Jn):null;return K.some(B=>B.id===X)?X:null},e[5]=v.data?.configs,e[6]=S,e[7]=C):C=e[7];const _=C;let N;e[8]!==c||e[9]!==i||e[10]!==_||e[11]!==f||e[12]!==g?(N=async function(K){if(!K)return;let X=Array.from(K);if(X.length===0)return;if(c&&(X=X.filter(wr),X.length===0)){Re.error("Please drop a video file (mp4, webm, …).");return}const B=_();if(!B){f(!0);return}try{const W=await g.mutateAsync({configId:B,file:X[0]});i(W.publicUrl),X.length>1&&Re.info(`Uploaded ${X[0].name}; extra files were ignored (single-select field).`)}catch(W){const Z=W;Re.error(Z instanceof Error?Z.message:"Upload failed")}},e[8]=c,e[9]=i,e[10]=_,e[11]=f,e[12]=g,e[13]=N):N=e[13];const T=N;let A;e[14]!==p?(A=function(K){K.preventDefault(),K.dataTransfer.types.includes("Files")&&p(!0)},e[14]=p,e[15]=A):A=e[15];const j=A;let D;e[16]!==p?(D=function(K){K.currentTarget===K.target&&p(!1)},e[16]=p,e[17]=D):D=e[17];const O=D;let $;e[18]!==T||e[19]!==p?($=function(K){K.preventDefault(),p(!1),T(K.dataTransfer.files)},e[18]=T,e[19]=p,e[20]=$):$=e[20];const P=$;let z;e[21]!==l||e[22]!==o?(z=s.jsx(be,{htmlFor:o,className:"text-muted-foreground",children:l}),e[21]=l,e[22]=o,e[23]=z):z=e[23];let w;e[24]!==n.description?(w=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=w):w=e[25];let R;e[26]!==w||e[27]!==z?(R=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[z,w]}),e[26]=w,e[27]=z,e[28]=R):R=e[28];const ee=m&&"border-primary ring-2 ring-primary/30",fe=g.isPending&&"pointer-events-none opacity-60";let Q;e[29]!==ee||e[30]!==fe?(Q=ge("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",ee,fe),e[29]=ee,e[30]=fe,e[31]=Q):Q=e[31];let V;e[32]!==x||e[33]!==y||e[34]!==c||e[35]!==f||e[36]!==u||e[37]!==g.isPending?(V=u?c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:s.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u)}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[s.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:y}),s.jsx(At,{ext:x})]})]}):s.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[s.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:s.jsx(gt,{size:18,className:"text-muted-foreground"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:y}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),s.jsx(At,{ext:x})]}):s.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[c?s.jsx(xt,{size:20}):s.jsx(gt,{size:20}),s.jsx("span",{className:"text-sm font-medium",children:g.isPending?"Uploading…":c?"Drop a video here or click to browse":"Drop a file or click to browse"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[32]=x,e[33]=y,e[34]=c,e[35]=f,e[36]=u,e[37]=g.isPending,e[38]=V):V=e[38];let H;e[39]!==m?(H=m&&s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:s.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[39]=m,e[40]=H):H=e[40];let Y;e[41]!==O||e[42]!==j||e[43]!==P||e[44]!==Q||e[45]!==V||e[46]!==H?(Y=s.jsxs("div",{onDragOver:j,onDragLeave:O,onDrop:P,className:Q,children:[V,H]}),e[41]=O,e[42]=j,e[43]=P,e[44]=Q,e[45]=V,e[46]=H,e[47]=Y):Y=e[47];let F;e[48]!==i?(F=le=>i(le.target.value),e[48]=i,e[49]=F):F=e[49];let U;e[50]!==o||e[51]!==u||e[52]!==F?(U=s.jsx(ke,{id:o,type:"url",value:u,onChange:F,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[50]=o,e[51]=u,e[52]=F,e[53]=U):U=e[53];let ne;e[54]!==f?(ne=()=>f(!0),e[54]=f,e[55]=ne):ne=e[55];let E;e[56]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(os,{size:14}),e[56]=E):E=e[56];const M=u?"Replace":"Browse";let q;e[57]!==ne||e[58]!==M?(q=s.jsxs(Ce,{type:"button",variant:"outline",size:"sm",onClick:ne,className:"h-9 shrink-0",children:[E,M]}),e[57]=ne,e[58]=M,e[59]=q):q=e[59];let ie;e[60]!==i||e[61]!==u?(ie=u&&s.jsx(Ce,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":"Remove file",children:s.jsx(We,{size:14})}),e[60]=i,e[61]=u,e[62]=ie):ie=e[62];let G;e[63]!==U||e[64]!==q||e[65]!==ie?(G=s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,q,ie]}),e[63]=U,e[64]=q,e[65]=ie,e[66]=G):G=e[66];let de;e[67]!==i?(de=le=>i(le),e[67]=i,e[68]=de):de=e[68];const ae=S?.id??null;let se;e[69]!==d||e[70]!==f||e[71]!==de||e[72]!==ae?(se=s.jsx(es,{open:d,onOpenChange:f,mode:"any",onSelect:de,lockedConfigId:ae}),e[69]=d,e[70]=f,e[71]=de,e[72]=ae,e[73]=se):se=e[73];let me;return e[74]!==R||e[75]!==Y||e[76]!==G||e[77]!==se?(me=s.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[R,Y,G,se]}),e[74]=R,e[75]=Y,e[76]=G,e[77]=se,e[78]=me):me=e[78],me}function wr(t){return t.type.startsWith("video/")}const Rr=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Ir={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function et(t){return lt(t)!==void 0}function Sn(t,e){if(e){if(et(e))return e;const n=Ir[e];if(n&&et(n))return n}for(const[n,r]of Rr)if(n.test(t)&&et(r))return r;return"FilterLines"}function $r(t){return lt(t)??us}function wt(t){const e=J.c(11),{iconName:n,size:r,className:i}=t,o=r===void 0?"md":r;let l;e[0]!==n?(l=$r(n),e[0]=n,e[1]=l):l=e[1];const a=l,c=o==="sm"?"size-7":"size-9",u=o==="sm"?16:18;let d;e[2]!==c||e[3]!==i?(d=ge("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=d):d=e[4];let f;e[5]!==a||e[6]!==u?(f=s.jsx(a,{size:u,className:"text-muted-foreground"}),e[5]=a,e[6]=u,e[7]=f):f=e[7];let m;return e[8]!==d||e[9]!==f?(m=s.jsx("div",{className:d,children:f}),e[8]=d,e[9]=f,e[10]=m):m=e[10],m}const Nn="Users03";function Or(t){const e=t.manifest?.blocks??{},n=[];for(const[r,i]of Object.entries(e))if(r.includes("matchers"))for(const o of Object.keys(i)){if(o.includes("always"))continue;const l=Wn(o,t);n.push({resolveType:o,title:l.title??Se(o),description:l.description,iconName:Sn(o,l.icon)})}return n}function Dr(t,e){if(!t)return Nn;const n=e.find(r=>r.resolveType===t);return n?n.iconName:Sn(t)}function Lr(t){const e=J.c(41),{currentRt:n,currentLabel:r,matchers:i,onSelect:o}=t,[l,a]=te.useState(!1);let c;if(e[0]!==n||e[1]!==i){const O=Dr(n,i);c=lt(O),e[0]=n,e[1]=i,e[2]=c}else c=e[2];const u=c;let d;e[3]!==o?(d=O=>{o(O),a(!1)},e[3]=o,e[4]=d):d=e[4];const f=d;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=()=>a(!0),e[5]=m):m=e[5];let p;e[6]!==u?(p=u&&s.jsx(u,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[6]=u,e[7]=p):p=e[7];let y;e[8]!==r?(y=s.jsx("span",{className:"flex-1 truncate",children:r}),e[8]=r,e[9]=y):y=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(at,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[10]=x):x=e[10];let v;e[11]!==p||e[12]!==y?(v=s.jsxs("button",{type:"button",onClick:m,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[p,y,x]}),e[11]=p,e[12]=y,e[13]=v):v=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(cn,{placeholder:"Search rules..."}),e[14]=g):g=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(un,{children:"No rules found."}),e[15]=h):h=e[15];let b;e[16]!==f?(b=()=>f(""),e[16]=f,e[17]=b):b=e[17];const k=!n&&"bg-accent/60";let S;e[18]!==k?(S=ge("gap-2.5",k),e[18]=k,e[19]=S):S=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(wt,{iconName:Nn,size:"sm"}),e[20]=C):C=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{className:"text-sm",children:"Always"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Target all users"})]}),e[21]=_):_=e[21];let N;e[22]!==b||e[23]!==S?(N=s.jsxs(it,{value:"always Target all users",onSelect:b,className:S,children:[C,_]}),e[22]=b,e[23]=S,e[24]=N):N=e[24];let T;if(e[25]!==n||e[26]!==f||e[27]!==i){let O;e[29]!==n||e[30]!==f?(O=$=>s.jsxs(it,{value:`${$.title} ${$.resolveType} ${$.description??""}`,onSelect:()=>f($.resolveType),className:ge("gap-2.5",n===$.resolveType&&"bg-accent/60"),children:[s.jsx(wt,{iconName:$.iconName,size:"sm"}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{className:"text-sm",children:$.title}),$.description&&s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:$.description})]})]},$.resolveType),e[29]=n,e[30]=f,e[31]=O):O=e[31],T=i.map(O),e[25]=n,e[26]=f,e[27]=i,e[28]=T}else T=e[28];let A;e[32]!==N||e[33]!==T?(A=s.jsxs(dn,{children:[h,s.jsxs(fn,{children:[N,T]})]}),e[32]=N,e[33]=T,e[34]=A):A=e[34];let j;e[35]!==l||e[36]!==A?(j=s.jsxs(ls,{open:l,onOpenChange:a,title:"Choose a rule",description:"Pick how to target users for this variant",className:"sm:max-w-lg",children:[g,A]}),e[35]=l,e[36]=A,e[37]=j):j=e[37];let D;return e[38]!==j||e[39]!==v?(D=s.jsxs(s.Fragment,{children:[v,j]}),e[38]=j,e[39]=v,e[40]=D):D=e[40],D}const Fr=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Er=5,Mr=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function Rt(t){const{start:e,end:n}=t,r=typeof e=="string"?e:"",i=typeof n=="string"?n:"";if(!r&&!i)return null;const o=c=>{if(!c)return null;const u=new Date(c);return Number.isNaN(u.getTime())?null:Mr.format(u)},l=o(r),a=o(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function mt(t,e=0){if(!t)return"Default";if(e>Er)return"...";const n=t.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(n)||n==="")return"Default";switch(n){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:i,tablet:o,desktop:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),o&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(Fr).join(" & "):Se(n)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return Rt(t)??Se(n);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:i}=t;return typeof i=="number"?`${Math.ceil(i*100)}% of sessions`:Se(n)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:o}=t,l=[];return i&&l.push(i),o&&l.push(o),l.length>0?l.join(" - "):Se(n)}case"website/matchers/pathname.ts":{const i=t.case,{type:o,pathname:l}=i??{};return o&&l?`Pathname ${o} ${l}`:Se(n)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:o}=t,l=u=>[u.city,u.regionCode,u.country].filter(Boolean).join(" - "),a=i?.[0];if(a){const u=(i?.length??0)-1;return`${l(a)}${u>0?` +${u}`:""}`}const c=o?.[0];if(c){const u=(o?.length??0)-1;return`Except ${l(c)}${u>0?` +${u}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:i,op:o="AND"}=t;if(i&&i.length>0){const l=o==="OR"?"OR":"AND";return i.map(a=>mt(a,e+1)).join(` ${l} `)}return Se(n)}default:{const i=Rt(t);return i||Se(n)||"Default"}}}function Br(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function zr(t,e){return{__resolveType:e,variants:[{rule:rt(),value:structuredClone(t)},{rule:rt(),value:structuredClone(t)}]}}function Pr(t){const e=t.variants;if(e.length===0)return;const n=e.find(r=>Yn(r.rule));return n?n.value:e[e.length-1]?.value}function Vr(t){const e=[...t.variants],n=e[e.length-1],r={rule:rt(),value:n?structuredClone(n.value):void 0};return{...t,variants:[...e,r]}}function Ur(t,e){if(t.variants.length<=1)return null;const n=[...t.variants];return n.splice(e,1),{...t,variants:n}}function Kr(t,e){const n=[...t.variants],r=n[e];return r?(n.splice(e+1,0,structuredClone(r)),{...t,variants:n}):t}function Hr(t,e,n){const r=[...t.variants];if(e===n||e<0||n<0||e>=r.length||n>=r.length)return t;const[i]=r.splice(e,1);return i?(r.splice(n,0,i),{...t,variants:r}):t}function Wr(t,e,n){const r=[...t.variants],i=r[e];return i?(r[e]={...i,value:n},{...t,variants:r}):t}function It(t,e,n){const r=[...t.variants],i=r[e];return i?(r[e]={...i,rule:n},{...t,variants:r}):t}const $t=new WeakMap,Ot=new Map;function Yr(t){let e=$t.get(t);return e||(e=Or(t),$t.set(t,e)),e}function qr(t,e){let n=Ot.get(t);return n===void 0&&(n=ze(t,e),Ot.set(t,n)),n}function Gr(t){const e=J.c(3),{multivariateResolveType:n,renderInnerField:r,...i}=t,{value:o,onChange:l,meta:a,path:c}=i,[u,d]=te.useState(0);if(!Br(o)){let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Ln,{size:14}),e[0]=w):w=e[0];let R;return e[1]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ue,{children:"Add variant"}),e[1]=R):R=e[1],s.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[s.jsxs(Ke,{children:[s.jsx(Ve,{asChild:!0,children:s.jsx(Ce,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":"Add variant",onClick:()=>{l(zr(o,n)),d(0)},children:w})}),R]}),r(i)]})}const f=o,m=f.variants,p=Math.min(u,m.length-1),y=m.map(Xr),x=m[p],v=x?.rule??{},g=v.__resolveType??"",h=x?.value,b=a?Yr(a):[],k=g&&a?qr(g,a):null,{__resolveType:S,...C}=v,_=()=>{l(Pr(f)),d(0)},N=()=>{const w=Vr(f);l(w),d(w.variants.length-1)},T=w=>{const R=Ur(f,w);R&&(l(R),p>=R.variants.length&&d(R.variants.length-1))},A=w=>{const R=Kr(f,w);l(R),d(w+1)},j=(w,R)=>{const ee=Hr(f,w,R);l(ee),p===w&&d(R)},D=w=>{l(It(f,p,w?{__resolveType:w}:{__resolveType:qn}))},O=w=>{const R=w,ee=g?{...R,__resolveType:g}:{...R};l(It(f,p,ee))},$=w=>{l(Wr(f,p,w))},P=`${c}-${f.__resolveType}`;let z;return e[2]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(be,{className:"text-xs text-muted-foreground",children:"Rule"}),e[2]=z):z=e[2],s.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[s.jsx(ys,{listKey:P,variants:y,selectedIndex:p,onSelect:d,onDuplicate:A,onDelete:T,onRemoveAll:_,onReorder:j,onAdd:N}),s.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[z,s.jsx(Lr,{currentRt:g,currentLabel:mt(v),matchers:b,onSelect:D}),k&&s.jsx("div",{className:"pt-1",children:s.jsx(Xe,{schema:k,value:C,onChange:O,basePath:""})})]}),r({...i,value:h,onChange:$})]})]})}function Xr(t,e){return{index:e,label:mt(t.rule)||`Variant ${e+1}`}}const Qr="website/loaders/secret.ts";function $e(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Zr(){return{__resolveType:Qr,name:"",encrypted:""}}function Jr(t){const{value:e,...n}=t;return n}function tt(t){const e=J.c(45),{schema:n,value:r,onChange:i,label:o,path:l}=t;if(typeof r=="string"||r==null&&!$e(r)){const _=typeof r=="string"?r:"";let N;e[0]!==o||e[1]!==l?(N=s.jsx(be,{htmlFor:l,className:"text-sm font-medium",children:o}),e[0]=o,e[1]=l,e[2]=N):N=e[2];let T;e[3]!==n.description?(T=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=T):T=e[4];let A;e[5]!==i?(A=O=>i(O.target.value),e[5]=i,e[6]=A):A=e[6];let j;e[7]!==l||e[8]!==_||e[9]!==A?(j=s.jsx(ke,{id:l,type:"password",value:_,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:"Secret value",onChange:A,className:"h-10"}),e[7]=l,e[8]=_,e[9]=A,e[10]=j):j=e[10];let D;return e[11]!==N||e[12]!==T||e[13]!==j?(D=s.jsxs("div",{className:"space-y-2",children:[N,T,j]}),e[11]=N,e[12]=T,e[13]=j,e[14]=D):D=e[14],D}let a;e[15]!==r?(a=$e(r)?r:Zr(),e[15]=r,e[16]=a):a=e[16];const c=a,u=typeof c.name=="string"?c.name:"",d=typeof c.encrypted=="string"&&c.encrypted,f=`${l}-name`;let m;e[17]!==o||e[18]!==f?(m=s.jsx(be,{htmlFor:f,className:"text-sm font-medium",children:o}),e[17]=o,e[18]=f,e[19]=m):m=e[19];let p;e[20]!==n.description?(p=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[20]=n.description,e[21]=p):p=e[21];const y=`${l}-name`;let x;e[22]!==c||e[23]!==i?(x=_=>i({...c,name:_.target.value}),e[22]=c,e[23]=i,e[24]=x):x=e[24];let v;e[25]!==u||e[26]!==y||e[27]!==x?(v=s.jsx(ke,{id:y,value:u,placeholder:"Secret name",onChange:x,className:"h-10"}),e[25]=u,e[26]=y,e[27]=x,e[28]=v):v=e[28];const g=`${l}-value`,h=d?"Leave blank to keep current value":"Secret value";let b;e[29]!==c||e[30]!==d||e[31]!==i?(b=_=>{const N=_.target.value;if(!N){i(d?Jr(c):c);return}i({...c,value:N})},e[29]=c,e[30]=d,e[31]=i,e[32]=b):b=e[32];let k;e[33]!==b||e[34]!==g||e[35]!==h?(k=s.jsx(ke,{id:g,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:h,onChange:b,className:"h-10"}),e[33]=b,e[34]=g,e[35]=h,e[36]=k):k=e[36];let S;e[37]!==d?(S=d&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"A secret value is stored."}),e[37]=d,e[38]=S):S=e[38];let C;return e[39]!==k||e[40]!==S||e[41]!==m||e[42]!==p||e[43]!==v?(C=s.jsxs("div",{className:"space-y-2",children:[m,p,v,k,S]}),e[39]=k,e[40]=S,e[41]=m,e[42]=p,e[43]=v,e[44]=C):C=e[44],C}function ei(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const n={};for(const[r,i]of Object.entries(e))r.startsWith("__")||(typeof i=="string"?n[r]={type:"string"}:typeof i=="number"?n[r]={type:"number"}:typeof i=="boolean"&&(n[r]={type:"boolean"}));return Object.keys(n).length>0?{type:"object",properties:n}:void 0}const ti=new Set(["__resolveType","@type"]);function ni(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function si(t){if(qe(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function Dt(t){if(t.type==="array"&&t.items)return t;const e=t.items??si(t);return e?{...t,type:"array",items:e}:null}function ri(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function pt(t){const{schema:e,value:n}=t;if(vt(n)){const l=Gn(n),a=Dt(e);if(l!==null&&a)return s.jsx(Me,{...t,schema:a,value:l,onChange:c=>t.onChange(Xn(n,c))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&qe(e)){const l=Dt(e);if(l)return s.jsx(Me,{...t,schema:l,value:n,onChange:t.onChange},t.path)}if(Array.isArray(n)&&!vt(n)&&e.type==="block-ref"){const l=ei(n);if(l){const a={...e,type:"array",items:l};return s.jsx(Me,{...t,schema:a,value:n,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||n!==null&&typeof n=="object"&&!Array.isArray(n)&&typeof n.__resolveType=="string"&&e.anyOfRefs){if(ni(e)){const l=e.anyOfRefs[0],a=l.schema?.properties?.variants?.items?.properties?.value,c=a&&a.type!=="block-ref"?a:e.plainSchema??a?.plainSchema??{type:"string"},u=d=>pt({...d,schema:c});return s.jsx(Gr,{...t,multivariateResolveType:l.resolveType,renderInnerField:u},t.path)}return e.anyOfRefs?s.jsx(Ct,{...t},t.path):null}if(e.format==="image-uri")return s.jsx(ts,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return s.jsx(Ar,{...t},t.path);if(e.format==="dynamic-options"&&e.options)return s.jsx(kr,{...t},t.path);if(e.enum&&e.enum.length>0)return s.jsx(Qs,{...t},t.path);if(e.type==="anyOf")return s.jsx(Ct,{...t},t.path);if($e(n)||e.format==="password"||n==null&&e.format==="password")return s.jsx(tt,{...t},t.path);const r=n??ri(e.type,e.default);if(r==null)return $e(n)?s.jsx(tt,{...t},t.path):null;if($e(r))return s.jsx(tt,{...t,value:r},t.path);const i={...t,value:r},o=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(o==="array"||Array.isArray(r))return s.jsx(Me,{...i},t.path);switch(o){case"boolean":return s.jsx(Ys,{...i},t.path);case"number":case"integer":return s.jsx(Ws,{...i},t.path);case"string":{const l=e.format;return l==="color-input"?s.jsx(Fe,{...i},t.path):l==="textarea"||l==="rich-text"||l==="html"?s.jsx(Fe,{...i},t.path):s.jsx(Fe,{...i},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?s.jsx(hr,{...i},t.path):null;default:return s.jsx(Fe,{...i},t.path)}}function Xe(t){const e=J.c(16),{schema:n,value:r,onChange:i,basePath:o,breadcrumbPath:l,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:d,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:y}=t;let x,v;if(e[0]!==o||e[1]!==u||e[2]!==c||e[3]!==m||e[4]!==a||e[5]!==i||e[6]!==p||e[7]!==d||e[8]!==f||e[9]!==y||e[10]!==n.properties||e[11]!==l||e[12]!==r){v=Symbol.for("react.early_return_sentinel");e:{const g=l===void 0?[]:l,h=n.properties;if(!h){v=null;break e}const b=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},k=Object.keys(h).filter(j=>!ti.has(j)&&h[j]?.hidden!==!0);if(k.length===0){let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[15]=j):j=e[15],v=j;break e}const S=(j,D)=>{i({...b,[j]:D})},C=typeof b.__resolveType=="string"?b.__resolveType:void 0,_=g.length>0?tr(k,h,b,g):null,N=_?h[_]:null,T=_&&N?[_]:k,A=_&&N?Js(_,N,g):g;x=s.jsx("div",{className:"min-w-0 space-y-6",children:T.map(j=>{const D=h[j];if(!D)return null;const O=o?`${o}.${j}`:j,$=Ie(j,D);return pt({schema:D,value:b[j],onChange:P=>S(j,P),path:O,label:$,breadcrumbPath:A,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:d,containerResolveType:C,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:y})})})}e[0]=o,e[1]=u,e[2]=c,e[3]=m,e[4]=a,e[5]=i,e[6]=p,e[7]=d,e[8]=f,e[9]=y,e[10]=n.properties,e[11]=l,e[12]=r,e[13]=x,e[14]=v}else x=e[13],v=e[14];return v!==Symbol.for("react.early_return_sentinel")?v:x}export{Lr as M,ys as S,Li as V,Sn as a,Xe as b,pt as c,Ei as d,Or as e,mt as f,Fe as g,ut as r,Cs as s,Fi as u};
@@ -1,4 +1,4 @@
1
- import{c as P,r as M,x as xc,z as ah,C as ch,j as p,B as lr,y as Ol,bK as bc,bL as uh,aO as dh,af as rn,bM as fh,l as Z,p as hh,P as $t,Q as Ot,V as kr,$ as ph,ai as mh,W as hn,bN as kc,U as Sc,s as zt,I as gh,d as yh,K as Kt,t as zi,k as Co,b as Ln,a2 as xh,ac as vc,bO as To,ah as bh,bP as Ut}from"./index-C_oukb-6.js";import{f as kh,M as Sh,d as vh,ae as wh,W as Ch,V as Th,U as Nh,ab as wc,af as Mh,ag as Eh,A as Cc,ah as it,ai as Ah,aj as Oh,ak as Ih,j as Rh}from"./agent-icon-B9d-96TZ.js";import{t as Fs}from"./Stars01-BRfLDHl4.js";import{t as jh,c as Tc,a as Er}from"./XCircle-DVQX_ogU.js";import{i as Nc}from"./ArrowRight-DOrox7OR.js";import{i as No}from"./Check-Cm33WeVI.js";import{i as Il}from"./ChevronRight-BaLK8W40.js";import{a as Mc,s as Dh}from"./Eye-zZDQDA3a.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-Doyp_hie.js";import{u as Oc}from"./use-copy-Cq9FbLLo.js";import{T as sn,a as on,b as ln}from"./tooltip-CDUQmtIe.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-BZQ5R-XM.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-BXRFG3iR.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-rlOQNE59.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-D6XuBBC6.js";import{u as Uh}from"./studio-tools-Bf0h7pKn.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{e as Gh,u as jc,l as Xh}from"./use-mcp-client-4Oly-YkT.js";import{i as Dc}from"./AlertCircle-gDIRb30q.js";import{s as Jr,t as Pc}from"./Star01-DCpmC1j3.js";import{s as Yh}from"./XClose-C6AbPQFS.js";import{n as Bi}from"./ZapSquare-BTnHHxm_.js";import{n as Lc,i as Qh}from"./Globe01-BLm5QG5d.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-B5EFkWYb.js";import{b as jl,a as tp}from"./ZoomOut-CZ4ld1AP.js";import{i as Gn}from"./Monitor01-BCz40A5M.js";import{i as np}from"./SearchMd-BW7euwEe.js";import{i as rp}from"./Upload01-CO717o9q.js";import{b as sp,c as ip}from"./shell-layout-CrOv1YY7.js";import{n as _c}from"./LinkExternal01-D8bSh32s.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-CdA5nUqw.js";import{I as Sr}from"./integration-icon-CRb2USX8.js";import{a as up}from"./use-virtual-mcp-Ctv1YJgk.js";import{i as dp}from"./ArrowUpRight-DUpL9CZ2.js";import{a as Ao}from"./Users03-CIlsRKUq.js";import{a as ot}from"./Palette-wtl4QkBp.js";import{m as $c}from"./use-navigate-to-agent-BkZH8xYi.js";import{a as fp}from"./use-connection-BmWMtwa9.js";import{a as hp}from"./Stars02-Bzgbk92-.js";import{g as pp}from"./use-mcp-prompts-BzVgnzr0.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-K6fUF2ve.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-BjMnGj6X.js";import{I as Np}from"./input-D5W2abuH.js";import{t as Mp}from"./ChevronDown-B1p7gEgu.js";import{e as Ep}from"./select-CWgv_m_K.js";const Ap={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function zc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Ap)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Bc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Fc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+zc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function yw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Op(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Oo(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Io(n,e){if(!e)return n;const t=`${Op(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Ip(n,e){return Io(n,e).replace(/[_-]/g," ").toLowerCase()}function Rp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Ol().min(1,"Required"):Ol();return xc(e)}function jp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Dp(n){const e=P.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?Rp(t):xc({});l=ah($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?jp(t,i):{},e[2]=i,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=ch(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let S;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(S=t.title||Ip(t.name,Oo(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=S):S=e[20];let v;e[21]!==S?(v=p.jsx(mp,{children:p.jsx("span",{className:"capitalize",children:S})}),e[21]=S,e[22]=v):v=e[22];let k;e[23]!==t.description?(k=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=k):k=e[24];let C;e[25]!==k||e[26]!==v?(C=p.jsxs(gp,{children:[v,k]}),e[25]=k,e[26]=v,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==y?(w=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=w):w=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=B=>p.jsx(Sp,{control:f.control,name:B.name,render:J=>{const{field:Y}=J;return p.jsxs(vp,{children:[p.jsxs(wp,{className:"text-xs",children:[B.name,B.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Cp,{children:p.jsx(Np,{...Y,value:Y.value??"",required:B.required,placeholder:B.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Tp,{})]})}},B.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(lr,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx($h,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(L=p.jsx(lr,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=o,e[47]=j,e[48]=L):L=e[48];let O;e[49]!==E||e[50]!==L?(O=p.jsxs(yp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=O):O=e[51];let D;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==O?(D=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,O]}),e[52]=o,e[53]=w,e[54]=T,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==f||e[58]!==D?(R=p.jsx(kp,{...f,children:D}),e[57]=f,e[58]=D,e[59]=R):R=e[59];let F;e[60]!==C||e[61]!==R?(F=p.jsxs(xp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[60]=C,e[61]=R,e[62]=F):F=e[62];let z;return e[63]!==b||e[64]!==F?(z=p.jsx(bp,{open:!0,onOpenChange:b,children:F}),e[63]=b,e[64]=F,e[65]=z):z=e[65],z}function Hc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function tt(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function $n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Te(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Te(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Vc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Vc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wc(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new A(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new A(s,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Vc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Or(t+1,i):Or(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ci={index:0,offset:0};function Or(n,e){return ci.index=n,ci.offset=e,ci}function Gr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Gr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Fi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Fi.none;if(e instanceof Fi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ne.none=[];class Xr extends Error{}class _{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=qc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Uc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return _.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _(A.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new _(e,r,s)}}_.empty=new _(A.empty,0,0);function Uc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Uc(i.content,e-s-1,t-s-1)))}function qc(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qc(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Kc(n,e,t,0)}function Kc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Zt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Lp(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Yr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function Hi(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function Qt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Xn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Qt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Qt(e.nodeBefore,r)}function Zt(n,e){return n.type.checkContent(e),n.copy(e)}function Gc(n,e,t,r,s){let i=n.depth>s&&Hi(n,e,s+1),o=r.depth>s&&Hi(t,r,s+1),l=[];return Xn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jc(i,o),Qt(Zt(i,Gc(n,e,t,r,s+1)),l)):(i&&Qt(Zt(i,Yr(n,e,s+1)),l),Xn(e,t,s,l),o&&Qt(Zt(o,Yr(t,r,s+1)),l)),Xn(r,null,s,l),new A(l)}function Yr(n,e,t){let r=[];if(Xn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Yr(n,e,t+1)),r)}return Xn(e,null,t,r),new A(r)}function Lp(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ar{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Qr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ar(t,r,i)}static resolveCached(e,t){let r=Dl.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Dl.set(e,r=new _p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%$p,s}}class _p{constructor(){this.elts=[],this.i=0}}const $p=12,Dl=new WeakMap;class Qr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const zp=Object.create(null);class et{constructor(e,t,r,s=ne.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Gr(this.attrs,t||e.defaultAttrs||zp)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return _.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new _(c,s.depth-o,i.depth-o)}replace(e,t,r){return Pp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return ar.resolveCached(this,e)}resolveNoCache(e){return ar.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=A.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}et.prototype.text=void 0;class Zr extends et{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bp(e,t);if(r.next==null)return an.empty;let s=Yc(r);r.next&&r.err("Unexpected trailing text");let i=Kp(qp(s));return Jp(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
1
+ import{c as P,r as M,x as xc,z as ah,C as ch,j as p,B as lr,y as Ol,bK as bc,bL as uh,aO as dh,af as rn,bM as fh,l as Z,p as hh,P as $t,Q as Ot,V as kr,$ as ph,ai as mh,W as hn,bN as kc,U as Sc,s as zt,I as gh,d as yh,K as Kt,t as zi,k as Co,b as Ln,a2 as xh,ac as vc,bO as To,ah as bh,bP as Ut}from"./index-ByF5bntS.js";import{f as kh,M as Sh,d as vh,ae as wh,W as Ch,V as Th,U as Nh,ab as wc,af as Mh,ag as Eh,A as Cc,ah as it,ai as Ah,aj as Oh,ak as Ih,j as Rh}from"./agent-icon-Dt9gAenf.js";import{t as Fs}from"./Stars01-CHs_UD1n.js";import{t as jh,c as Tc,a as Er}from"./XCircle-D1bMGooP.js";import{i as Nc}from"./ArrowRight-xN7BW_ul.js";import{i as No}from"./Check-DU5rb3bM.js";import{i as Il}from"./ChevronRight-VbCUQ4nm.js";import{a as Mc,s as Dh}from"./Eye-C2MUknhG.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-xD667FrM.js";import{u as Oc}from"./use-copy-CRqf_gDL.js";import{T as sn,a as on,b as ln}from"./tooltip-BGNlh40O.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-0w6lWLwV.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-sci-lCr2.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-BBXOT296.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-CxzPycJ_.js";import{u as Uh}from"./studio-tools-DkpVw1Fk.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{e as Gh,u as jc,l as Xh}from"./use-mcp-client-BI9mCeJ3.js";import{i as Dc}from"./AlertCircle-CNubGDaO.js";import{s as Jr,t as Pc}from"./Star01-BFLcGuw1.js";import{s as Yh}from"./XClose-C-OqIzD0.js";import{n as Bi}from"./ZapSquare-CQngmi94.js";import{n as Lc,i as Qh}from"./Globe01-DF9LBrGV.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-lXuB6RrN.js";import{b as jl,a as tp}from"./ZoomOut-btgvbLfz.js";import{i as Gn}from"./Monitor01-B4R66HFG.js";import{i as np}from"./SearchMd-BfPMpih2.js";import{i as rp}from"./Upload01-D3BizWvA.js";import{b as sp,c as ip}from"./shell-layout-BmHL7kpa.js";import{n as _c}from"./LinkExternal01-BzrXa1Dk.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-BuEWFo6R.js";import{I as Sr}from"./integration-icon-CnsCd0E7.js";import{a as up}from"./use-virtual-mcp-DVO8vnjv.js";import{i as dp}from"./ArrowUpRight-D3CKRkTo.js";import{a as Ao}from"./Users03-DBhmjqg-.js";import{a as ot}from"./Palette-CZf9xPYO.js";import{m as $c}from"./use-navigate-to-agent-BeUkvKDD.js";import{a as fp}from"./use-connection-8IOgdNi0.js";import{a as hp}from"./Stars02-BJLb-WgL.js";import{g as pp}from"./use-mcp-prompts-B4uY1_xI.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-oTR0pyLu.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-BagRiauK.js";import{I as Np}from"./input-BbFJIfNw.js";import{t as Mp}from"./ChevronDown-TvYn-OY4.js";import{e as Ep}from"./select-Bo6CrzVw.js";const Ap={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function zc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Ap)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Bc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Fc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+zc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function yw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Op(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Oo(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Io(n,e){if(!e)return n;const t=`${Op(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Ip(n,e){return Io(n,e).replace(/[_-]/g," ").toLowerCase()}function Rp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Ol().min(1,"Required"):Ol();return xc(e)}function jp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Dp(n){const e=P.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?Rp(t):xc({});l=ah($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?jp(t,i):{},e[2]=i,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=ch(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let S;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(S=t.title||Ip(t.name,Oo(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=S):S=e[20];let v;e[21]!==S?(v=p.jsx(mp,{children:p.jsx("span",{className:"capitalize",children:S})}),e[21]=S,e[22]=v):v=e[22];let k;e[23]!==t.description?(k=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=k):k=e[24];let C;e[25]!==k||e[26]!==v?(C=p.jsxs(gp,{children:[v,k]}),e[25]=k,e[26]=v,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==y?(w=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=w):w=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=B=>p.jsx(Sp,{control:f.control,name:B.name,render:J=>{const{field:Y}=J;return p.jsxs(vp,{children:[p.jsxs(wp,{className:"text-xs",children:[B.name,B.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Cp,{children:p.jsx(Np,{...Y,value:Y.value??"",required:B.required,placeholder:B.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Tp,{})]})}},B.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(lr,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx($h,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(L=p.jsx(lr,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=o,e[47]=j,e[48]=L):L=e[48];let O;e[49]!==E||e[50]!==L?(O=p.jsxs(yp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=O):O=e[51];let D;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==O?(D=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,O]}),e[52]=o,e[53]=w,e[54]=T,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==f||e[58]!==D?(R=p.jsx(kp,{...f,children:D}),e[57]=f,e[58]=D,e[59]=R):R=e[59];let F;e[60]!==C||e[61]!==R?(F=p.jsxs(xp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[60]=C,e[61]=R,e[62]=F):F=e[62];let z;return e[63]!==b||e[64]!==F?(z=p.jsx(bp,{open:!0,onOpenChange:b,children:F}),e[63]=b,e[64]=F,e[65]=z):z=e[65],z}function Hc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function tt(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function $n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Te(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Te(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Vc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Vc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wc(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new A(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new A(s,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Vc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Or(t+1,i):Or(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ci={index:0,offset:0};function Or(n,e){return ci.index=n,ci.offset=e,ci}function Gr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Gr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Fi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Fi.none;if(e instanceof Fi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ne.none=[];class Xr extends Error{}class _{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=qc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Uc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return _.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _(A.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new _(e,r,s)}}_.empty=new _(A.empty,0,0);function Uc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Uc(i.content,e-s-1,t-s-1)))}function qc(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qc(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Kc(n,e,t,0)}function Kc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Zt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Lp(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Yr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function Hi(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function Qt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Xn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Qt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Qt(e.nodeBefore,r)}function Zt(n,e){return n.type.checkContent(e),n.copy(e)}function Gc(n,e,t,r,s){let i=n.depth>s&&Hi(n,e,s+1),o=r.depth>s&&Hi(t,r,s+1),l=[];return Xn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jc(i,o),Qt(Zt(i,Gc(n,e,t,r,s+1)),l)):(i&&Qt(Zt(i,Yr(n,e,s+1)),l),Xn(e,t,s,l),o&&Qt(Zt(o,Yr(t,r,s+1)),l)),Xn(r,null,s,l),new A(l)}function Yr(n,e,t){let r=[];if(Xn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Yr(n,e,t+1)),r)}return Xn(e,null,t,r),new A(r)}function Lp(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ar{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Qr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ar(t,r,i)}static resolveCached(e,t){let r=Dl.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Dl.set(e,r=new _p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%$p,s}}class _p{constructor(){this.elts=[],this.i=0}}const $p=12,Dl=new WeakMap;class Qr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const zp=Object.create(null);class et{constructor(e,t,r,s=ne.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Gr(this.attrs,t||e.defaultAttrs||zp)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return _.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new _(c,s.depth-o,i.depth-o)}replace(e,t,r){return Pp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return ar.resolveCached(this,e)}resolveNoCache(e){return ar.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=A.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}et.prototype.text=void 0;class Zr extends et{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bp(e,t);if(r.next==null)return an.empty;let s=Yc(r);r.next&&r.err("Unexpected trailing text");let i=Kp(qp(s));return Jp(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
2
2
  `)}}an.empty=new an(!0);class Bp{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Yc(n){let e=[];do e.push(Fp(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Fp(n){let e=[];do e.push(Hp(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Hp(n){let e=Up(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Vp(n,e);else break;return e}function Pl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Vp(n,e){let t=Pl(n),r=t;return n.eat(",")&&(n.next!="}"?r=Pl(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Wp(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Up(n){if(n.eat("(")){let e=Yc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Wp(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function qp(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Qc(n,e){return e-n}function Ll(n,e){let t=[];return r(e),t.sort(Qc);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function Kp(n){let e=Object.create(null);return t(Ll(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);Ll(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new an(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Qc);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function Jp(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Zc(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function eu(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function tu(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function nu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Xp(n,r,e[r]);return t}let _l=class ru{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=nu(e,r.attrs),this.defaultAttrs=Zc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==an.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:eu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new et(this,this.computeAttrs(e),A.from(t),ne.setFrom(r))}createChecked(e=null,t,r){return t=A.from(t),this.checkContent(t),new et(this,this.computeAttrs(e),t,ne.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=A.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(A.empty,!0);return i?new et(this,e,t.append(i),ne.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){tu(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:ne.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ru(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Gp(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class Xp{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Gp(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hs{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=nu(e,s.attrs),this.excluded=null;let i=Zc(this.attrs);this.instance=i?new ne(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ne(this,eu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Hs(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){tu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class su{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Te.from(e.nodes),t.marks=Te.from(e.marks||{}),this.nodes=_l.compile(this.spec.nodes,this),this.marks=Hs.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=an.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?$l(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:$l(this,o.split(" "))}this.nodeFromJSON=s=>et.fromJSON(this,s),this.markFromJSON=s=>ne.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof _l){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new Zr(r,r.defaultAttrs,e,ne.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function $l(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Yp(n){return n.tag!=null}function Qp(n){return n.style!=null}class It{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Yp(s))this.tags.push(s);else if(Qp(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Bl(this,t,!1);return r.addAll(e,ne.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Bl(this,t,!0);return r.addAll(e,ne.none,t.from,t.to),_.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(tm(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Fl(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Fl(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new It(e,It.schemaRules(e)))}}const iu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Zp={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ou={ol:!0,ul:!0},cr=1,Vi=2,Yn=4;function zl(n,e,t){return e!=null?(e?cr:0)|(e==="full"?Vi:0):n&&n.whitespace=="pre"?cr|Vi:t&~Yn}class Ir{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=ne.none,this.match=i||(o&Yn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(A.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&cr)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=A.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!iu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Bl{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=zl(null,t.preserveWhitespace,0)|(r?Yn:0);s?i=new Ir(s.type,s.attrs,ne.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Ir(null,null,ne.none,!0,null,o):i=new Ir(e.schema.topNodeType,null,ne.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Vi?"full":this.localPreserveWS||(s.options&cr)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;ou.hasOwnProperty(o)&&this.parser.normalizeLists&&em(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Zp.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(iu.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=ne.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Hl(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=zl(e,i,o.options);o.options&Yn&&o.content.length==0&&(l|=Yn);let a=ne.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Hl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Ir(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=cr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function em(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ou.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function tm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Fl(n){let e={};for(let t in n)e[t]=n[t];return e}function Hl(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class pn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ui(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Vr(ui(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Vr(ui(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Vr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Vl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Vl(e.marks)}}function Vl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ui(n){return n.document||window.document}const Wl=new WeakMap;function nm(n){let e=Wl.get(n);return e===void 0&&Wl.set(n,e=rm(n)),e}function rm(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Vr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=nm(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Vr(n,f,t,r);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const lu=65535,au=Math.pow(2,16);function sm(n,e){return n+e*au}function Ul(n){return n&lu}function im(n){return(n-(n&lu))/au}const cu=1,uu=2,Wr=4,du=8;class Wi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&du)>0}get deletedBefore(){return(this.delInfo&(cu|Wr))>0}get deletedAfter(){return(this.delInfo&(uu|Wr))>0}get deletedAcross(){return(this.delInfo&Wr)>0}}class Fe{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Fe.empty)return Fe.empty}recover(e){let t=0,r=Ul(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+im(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let m=e==(t<0?a:d)?null:sm(l/3,e-a),g=e==a?uu:e==d?cu:Wr;return(t<0?e!=a:e!=d)&&(g|=du),new Wi(h,g,m)}s+=u-c}return r?e+s:new Wi(e+s,0,null)}touches(e,t){let r=0,s=Ul(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new Fe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fe.empty:new Fe(e<0?[0,-e,0]:[0,0,e])}}Fe.empty=new Fe([]);class ur{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ur(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new ur;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Wi(e,s,null)}}const di=Object.create(null);class De{getMap(){return Fe.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=di[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in di)throw new RangeError("Duplicate use of step JSON ID "+e);return di[e]=t,t.prototype.jsonID=e,t}}class me{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new me(e,null)}static fail(e){return new me(null,e)}static fromReplace(e,t,r,s){try{return me.ok(e.replace(t,r,s))}catch(i){if(i instanceof Xr)return me.fail(i.message);throw i}}}function Ro(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(Ro(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return A.fromArray(r)}class Mt extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new _(Ro(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,i)}invert(){return new Ze(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Mt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Mt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Mt(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("addMark",Mt);class Ze extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new _(Ro(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,r)}invert(){return new Mt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ze(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ze&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ze(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ze(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("removeMark",Ze);class Et extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Et(this.pos,t.marks[s]);return new Et(this.pos,this.mark)}}return new cn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Et(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Et(t.pos,e.markFromJSON(t.mark))}}De.jsonID("addNodeMark",Et);class cn extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Et(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new cn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new cn(t.pos,e.markFromJSON(t.mark))}}De.jsonID("removeNodeMark",cn);class pe extends De{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Ui(e,this.from,this.to)?me.fail("Structure replace would overwrite content"):me.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Fe([this.from,this.to-this.from,this.slice.size])}invert(e){return new pe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&pe.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new pe(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?_.empty:new _(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?_.empty:new _(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pe(t.from,t.to,_.fromJSON(e,t.slice),!!t.structure)}}pe.MAP_BIAS=1;De.jsonID("replace",pe);class ve extends De{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Ui(e,this.from,this.gapFrom)||Ui(e,this.gapTo,this.to)))return me.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?me.fromReplace(e,this.from,this.to,r):me.fail("Content does not fit in gap")}getMap(){return new Fe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ve(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new ve(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ve(t.from,t.to,t.gapFrom,t.gapTo,_.fromJSON(e,t.slice),t.insert,!!t.structure)}}De.jsonID("replaceAround",ve);function Ui(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function om(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:s.push(o=new Ze(f,h,d[g])));l&&l.to==f?l.to=h:i.push(l=new Mt(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function lm(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof Hs){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==i-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Ze(o.from,o.to,o.style)))}function jo(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new pe(l,u,_.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Ze(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new _(A.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new pe(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);n.replace(l,l,new _(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function am(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function zn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!am(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function cm(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=A.empty,d=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=A.from(r.node(m).copy(u)),d++):a--;let f=A.empty,h=0;for(let m=i,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=A.from(s.node(m).copy(f)),h++):c++;n.step(new ve(a,c,o,l,new _(u.append(f),d,h),u.size-d,!0))}function Do(n,e,t=null,r=n){let s=um(n,e),i=s&&dm(r,e);return i?s.map(ql).concat({type:e,attrs:t}).concat(i.map(ql)):null}function ql(n){return{type:n,attrs:null}}function um(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function dm(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function fm(n,e,t){let r=A.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new ve(s,i,s,i,new _(r,0,0),t.length,!0))}function hm(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&pm(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&hu(n,o,l,i),jo(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new ve(d,f,d+1,f-1,new _(A.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&fu(n,o,l,i),!1}})}function fu(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function hu(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -1 +1 @@
1
- import{c as b,l as w,j as a,i as j}from"./index-C_oukb-6.js";import{i as N}from"./SearchMd-BW7euwEe.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
1
+ import{c as b,l as w,j as a,i as j}from"./index-ByF5bntS.js";import{i as N}from"./SearchMd-BfPMpih2.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
@@ -1 +1 @@
1
- import{c as p,j as t,a2 as P,r as j,ae as w,B as S,t as y}from"./index-C_oukb-6.js";import{i as k}from"./AlertCircle-gDIRb30q.js";import{s as z}from"./Plus-CVwFP0PN.js";import{s as F}from"./User01-BsJPatkI.js";import{t as E}from"./Users01-BxvSAjH8.js";import{d as $,c as I,D as O,a as A,b as R,e as T}from"./dialog-K6fUF2ve.js";import{I as N}from"./input-D5W2abuH.js";import{L as g}from"./label-BElDaZMn.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-CWgv_m_K.js";import{S as H}from"./skeleton-sLaw1Xk2.js";import{T as K}from"./textarea-wSBnNv7u.js";import{P as b}from"./index-CJD5j0F7.js";import{c as W}from"./settings-section-CJtoNKEm.js";import{u as Y,a as G}from"./use-secrets-cs3fO-m_.js";import{R as J}from"./require-capability-rNA3gn0T.js";import"./X-CZpN5x6J.js";import"./tooltip-CDUQmtIe.js";import"./Check-Cm33WeVI.js";import"./ChevronDown-B1p7gEgu.js";import"./ChevronUp-DGOcvlL6.js";import"./sidebar-ChFfr0rN.js";import"./LayoutLeft-BdoPIgTz.js";import"./sheet-CdA5nUqw.js";import"./card-B2iG-uof.js";import"./ArrowUpRight-DUpL9CZ2.js";import"./studio-tools-Bf0h7pKn.js";import"./use-capability-CrbE-PVJ.js";import"./access-gate-D9-CVWiV.js";import"./capability-load-error-DR1p6bTx.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,c=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Ie(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Ie as default};
1
+ import{c as p,j as t,a2 as P,r as j,ae as w,B as S,t as y}from"./index-ByF5bntS.js";import{i as k}from"./AlertCircle-CNubGDaO.js";import{s as z}from"./Plus-BoROENfr.js";import{s as F}from"./User01-DJp_IeHl.js";import{t as E}from"./Users01-Cd5fFCG3.js";import{d as $,c as I,D as O,a as A,b as R,e as T}from"./dialog-oTR0pyLu.js";import{I as N}from"./input-BbFJIfNw.js";import{L as g}from"./label-BMmTnqcN.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-Bo6CrzVw.js";import{S as H}from"./skeleton-BBoWXlQw.js";import{T as K}from"./textarea-_jouvwDc.js";import{P as b}from"./index-DIdWimus.js";import{c as W}from"./settings-section-CnVR3qqE.js";import{u as Y,a as G}from"./use-secrets-Dz889CgS.js";import{R as J}from"./require-capability-BTWSjjcL.js";import"./X-Cb9V7Mmc.js";import"./tooltip-BGNlh40O.js";import"./Check-DU5rb3bM.js";import"./ChevronDown-TvYn-OY4.js";import"./ChevronUp-CE5JDW17.js";import"./sidebar-CRs9fZ48.js";import"./LayoutLeft-yX6ZaEXM.js";import"./sheet-BuEWFo6R.js";import"./card--NKS06Go.js";import"./ArrowUpRight-D3CKRkTo.js";import"./studio-tools-DkpVw1Fk.js";import"./use-capability-B9zmFZLR.js";import"./access-gate-DopFOivn.js";import"./capability-load-error-6WyfjcJj.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,c=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Ie(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Ie as default};