decocms 2.288.0 → 2.289.0

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 (198) hide show
  1. package/dist/client/assets/{AlertCircle--Y_xi7pz.js → AlertCircle-BCfEJcld.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-adl7K_Ob.js → ArrowNarrowLeft-dDBZy2uy.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-DrcSZgbj.js → ArrowUpRight-DR20SS60.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-DeN4Arf9.js → CheckCircle-C29ChaU6.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-aTqoLskN.js → ChevronDown-CAze57fI.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-D_eqesT2.js → ChevronRight-Df7bIxwE.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-BJsJc2K_.js → ChevronUp-CTU6V7Q0.js} +1 -1
  8. package/dist/client/assets/{Container-RTpXHcc_.js → Container-Ckr-D4x-.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-DU62Ovco.js → DotsVertical-BooYL5-r.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-CZ54w6Ys.js → LinkExternal01-BF4nSmdO.js} +1 -1
  11. package/dist/client/assets/{Lock01-C1fACGdb.js → Lock01-D_RqxNIk.js} +1 -1
  12. package/dist/client/assets/{Palette-CSi1xvBX.js → Palette-Du_aKlJW.js} +1 -1
  13. package/dist/client/assets/{Play-ZwqBA0Gj.js → Play-hp4nCWPw.js} +1 -1
  14. package/dist/client/assets/{Plus-DgDw4N5v.js → Plus-C-OJiAlg.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-BQD-u-1H.js → RefreshCcw01-Bw_4FSKr.js} +1 -1
  16. package/dist/client/assets/{SearchMd-DIPAhwlI.js → SearchMd-DRU7KH2R.js} +1 -1
  17. package/dist/client/assets/{Settings02-NWpe6nkq.js → Settings02-tDR0R-7r.js} +1 -1
  18. package/dist/client/assets/{Shield01-yW6P30XX.js → Shield01-CyMbm-kt.js} +1 -1
  19. package/dist/client/assets/{Star01-BNCw32N6.js → Star01-BSV4P3zw.js} +1 -1
  20. package/dist/client/assets/{Sun-BIhz6_CP.js → Sun-NTsERAnx.js} +1 -1
  21. package/dist/client/assets/{Tool01-DK8Fhe6_.js → Tool01-JkKJ-VBh.js} +1 -1
  22. package/dist/client/assets/{Trash01-CLPACLPe.js → Trash01-5isrbkO6.js} +1 -1
  23. package/dist/client/assets/{User01-C_p7EKq6.js → User01-CtVgwrxn.js} +1 -1
  24. package/dist/client/assets/{Users03-C5Wav_Yh.js → Users03-kskEQmar.js} +1 -1
  25. package/dist/client/assets/{X-BI3qXgCM.js → X-KZf37p0i.js} +1 -1
  26. package/dist/client/assets/{XCircle-C15LvzjS.js → XCircle-0jhuLEi-.js} +1 -1
  27. package/dist/client/assets/{XClose-xaUxE8BL.js → XClose-DmXYRRRU.js} +1 -1
  28. package/dist/client/assets/{Zap-DUrCsyVy.js → Zap-CjGMKfBw.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-CzhlLfPR.js → ZapSquare-Q_j-wpZU.js} +1 -1
  30. package/dist/client/assets/{accordion-PgILOgmD.js → accordion-LhYuXsvn.js} +1 -1
  31. package/dist/client/assets/{agent-icon-Dwc2UhoB.js → agent-icon-CJBSrXXa.js} +1 -1
  32. package/dist/client/assets/{agents-list-DtDkfiBL.js → agents-list-Bj1ZEySf.js} +1 -1
  33. package/dist/client/assets/ai-providers-NZdL0YY1.js +1 -0
  34. package/dist/client/assets/{alert-dialog-P1MELuo2.js → alert-dialog-DGf6p6RH.js} +2 -2
  35. package/dist/client/assets/{auth-catchall-DXBvhnpI.js → auth-catchall-mJXjaGjq.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-ZhJERDs5.js → automation-list-row-i7idsf84.js} +1 -1
  37. package/dist/client/assets/{automations-BKo3NXeb.js → automations-D5L5OUmd.js} +1 -1
  38. package/dist/client/assets/{avatar-C4Xk2I9Z.js → avatar-BiQlJs5k.js} +1 -1
  39. package/dist/client/assets/{badge-LkPgBUqp.js → badge-BiDYflRu.js} +1 -1
  40. package/dist/client/assets/{brand-context-B0xNT0Kl.js → brand-context-1aiu9Hp5.js} +1 -1
  41. package/dist/client/assets/{card-oTGN-YLV.js → card-kpHhMcOo.js} +1 -1
  42. package/dist/client/assets/{chat-context-yRGYHam2.js → chat-context-C5B4JHNW.js} +1 -1
  43. package/dist/client/assets/{checkbox-COiFtX5D.js → checkbox-DVSlEbBg.js} +1 -1
  44. package/dist/client/assets/{collection-detail-D7_Iw3uk.js → collection-detail-8OxmAVZx.js} +1 -1
  45. package/dist/client/assets/{collection-display-button-cYrSfrMz.js → collection-display-button-DJUi1nr2.js} +1 -1
  46. package/dist/client/assets/{collection-search-Biy5fWyC.js → collection-search-Cauf3WLX.js} +1 -1
  47. package/dist/client/assets/{collection-search-D8Ek-RA1.js → collection-search-G428te1f.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-D7Avuad7.js → collection-table-wrapper-CgJ-IWGp.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-Ez6xggyp.js → collection-tabs-ImMH44oz.js} +1 -1
  50. package/dist/client/assets/{collections-h5KZ86rd.js → collections-CgvQVGim.js} +1 -1
  51. package/dist/client/assets/{command-BcjbHr_r.js → command-DUlueOVl.js} +1 -1
  52. package/dist/client/assets/{connection-card-Tvf09fuE.js → connection-card-CfcNRXjD.js} +1 -1
  53. package/dist/client/assets/{connection-detail-BOee_bXK.js → connection-detail-ZbjzvLjZ.js} +1 -1
  54. package/dist/client/assets/{connection-form-helpers-BML8fV-T.js → connection-form-helpers-CLdsDsnf.js} +1 -1
  55. package/dist/client/assets/{connections-BE48nDv7.js → connections-Db7XXBzz.js} +1 -1
  56. package/dist/client/assets/{constants-n9yTcILK.js → constants-D21LrFJ4.js} +1 -1
  57. package/dist/client/assets/{constants-Dsh71ijv.js → constants-DV1Uc_8Q.js} +2 -2
  58. package/dist/client/assets/{dialog-Dv_lEigV.js → dialog-eYBbNtPx.js} +1 -1
  59. package/dist/client/assets/{domain-settings-BcSGKzwX.js → domain-settings-5yGQjw4b.js} +1 -1
  60. package/dist/client/assets/{drawer-WXY2u6pv.js → drawer-BnROsLEL.js} +1 -1
  61. package/dist/client/assets/{dropdown-menu-B9QIvjxH.js → dropdown-menu-BeTlEYH5.js} +1 -1
  62. package/dist/client/assets/{dynamic-plugin-layout-CjDWcYO9.js → dynamic-plugin-layout-BvdykXHY.js} +1 -1
  63. package/dist/client/assets/{empty-state-DIMeCEjD.js → empty-state-B2VGunPR.js} +1 -1
  64. package/dist/client/assets/{empty-state-JxMlNoaR.js → empty-state-Dyal5Xfo.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-Cvlutde4.js → extract-connection-data-CSJgZrtD.js} +1 -1
  66. package/dist/client/assets/{features-YbryDu0n.js → features-B-66Obp6.js} +1 -1
  67. package/dist/client/assets/{form-BNoUlod_.js → form-CIMdOf9q.js} +1 -1
  68. package/dist/client/assets/{general-b6CUcDdB.js → general-D6CyCDN-.js} +1 -1
  69. package/dist/client/assets/{github-repo-picker-CP7-EChX.js → github-repo-picker-CvkiRKr8.js} +1 -1
  70. package/dist/client/assets/{index-Dig_TVyF.js → index-B07jP2sp.js} +1 -1
  71. package/dist/client/assets/{index-BVkdH26T.js → index-B0qIbTFl.js} +1 -1
  72. package/dist/client/assets/{index-Cw8cSB3k.js → index-CKiHh8tq.js} +1 -1
  73. package/dist/client/assets/{index-FXohrF1g.js → index-CQ6k5P_g.js} +1 -1
  74. package/dist/client/assets/{index-C-fdRcaZ.js → index-CQJ0POFk.js} +4 -4
  75. package/dist/client/assets/{index-CdjpBOmP.js → index-Ciwyai62.js} +1 -1
  76. package/dist/client/assets/{index-BZtydI_4.js → index-Cqh-Pw0g.js} +1 -1
  77. package/dist/client/assets/{index-CVUETRIB.js → index-D3dcRy4-.js} +28 -28
  78. package/dist/client/assets/{index-B0_K5fYx.js → index-DdZX0aDg.js} +1 -1
  79. package/dist/client/assets/{index-CjZGXiUn.js → index-Duvlh7HC.js} +1 -1
  80. package/dist/client/assets/{infiniteQueryObserver-BYD3scla.js → infiniteQueryObserver-DNXrDhz0.js} +1 -1
  81. package/dist/client/assets/{input-CL-LUIlC.js → input-BTdB8RPC.js} +1 -1
  82. package/dist/client/assets/{integration-icon-BXMU-Z0-.js → integration-icon-DJHy4-lT.js} +1 -1
  83. package/dist/client/assets/{label-Do_qw_q4.js → label-HfwUkinD.js} +1 -1
  84. package/dist/client/assets/{layout-DrFXNrUJ.js → layout-Blu93q33.js} +1 -1
  85. package/dist/client/assets/{login-B6O4fD8Q.js → login-YFb2t01p.js} +1 -1
  86. package/dist/client/assets/{members-L61ME1MY.js → members-qoLnAp5E.js} +1 -1
  87. package/dist/client/assets/{monaco-editor-BRexmFrU.js → monaco-editor-BFeXzORV.js} +1 -1
  88. package/dist/client/assets/{monitoring-stats-row-DpDZn9jY.js → monitoring-stats-row-B8LpUgZ3.js} +1 -1
  89. package/dist/client/assets/{oauth-callback-_ywR3sFa.js → oauth-callback-CXbpsVJh.js} +1 -1
  90. package/dist/client/assets/{oauth-callback-ai-provider-CpjecUsU.js → oauth-callback-ai-provider-CHi0ZwiA.js} +1 -1
  91. package/dist/client/assets/{onboarding-BHrMLfDa.js → onboarding-CS_9vzjQ.js} +1 -1
  92. package/dist/client/assets/{org-layout-BkXZ1gvy.js → org-layout-DzWFCFrp.js} +1 -1
  93. package/dist/client/assets/{org-plugin-layout-DQZ2g3kO.js → org-plugin-layout-C1udHyJg.js} +1 -1
  94. package/dist/client/assets/{plugin-empty-state-vwtahL68.js → plugin-empty-state-uSy8H1wz.js} +1 -1
  95. package/dist/client/assets/{plugin-header-BsB_du51.js → plugin-header-Y9KGqpf-.js} +1 -1
  96. package/dist/client/assets/{plugin-layout-Buej05e7.js → plugin-layout-BMUI6aZk.js} +1 -1
  97. package/dist/client/assets/{popover-C4684neQ.js → popover-0rGXbfVv.js} +1 -1
  98. package/dist/client/assets/{profile-DDmHWY6_.js → profile-Dxc4PLoS.js} +1 -1
  99. package/dist/client/assets/{project-app-view-BNwkzuii.js → project-app-view-rhNtxAKM.js} +1 -1
  100. package/dist/client/assets/registry-3CD149WE.js +2 -0
  101. package/dist/client/assets/{registry-layout-CZd2B4C7.js → registry-layout-20jGjbo6.js} +1 -1
  102. package/dist/client/assets/{required-auth-layout-SaQW2h7l.js → required-auth-layout-BrXS6Et-.js} +1 -1
  103. package/dist/client/assets/{reset-password-DDLCghhj.js → reset-password-KHQpUmrP.js} +1 -1
  104. package/dist/client/assets/{roles-DmqW3xZU.js → roles-QJpAwLWN.js} +1 -1
  105. package/dist/client/assets/{scroll-area-BmiP98pu.js → scroll-area-Cmb2U-GX.js} +1 -1
  106. package/dist/client/assets/{search-input-DQ1Xzm_b.js → search-input-Cxdo8FJH.js} +1 -1
  107. package/dist/client/assets/{select-model-CX8VF4-p.js → select-model-CepjGove.js} +1 -1
  108. package/dist/client/assets/{select-DaM3TY5t.js → select-pbe1Tw3i.js} +1 -1
  109. package/dist/client/assets/{settings-layout-DNFV8Oix.js → settings-layout-C_jpXJmC.js} +1 -1
  110. package/dist/client/assets/{settings-section-BS3Z4RWi.js → settings-section-zap-Boy4.js} +1 -1
  111. package/dist/client/assets/shell-layout-YcfNni5N.js +1 -0
  112. package/dist/client/assets/{skeleton-C8RqYCI9.js → skeleton-cT9-y8hq.js} +1 -1
  113. package/dist/client/assets/{sso-CZDbiXIw.js → sso-Bbte0m6W.js} +1 -1
  114. package/dist/client/assets/{store-CeeuB26r.js → store-CdJMoZz8.js} +1 -1
  115. package/dist/client/assets/store-registry-BT7eie06.js +2 -0
  116. package/dist/client/assets/{switch-DGYFt_K8.js → switch-CrRugnBx.js} +1 -1
  117. package/dist/client/assets/{table-BJ_I6wc6.js → table-Chd-IJRh.js} +1 -1
  118. package/dist/client/assets/{tabs-O35WvzjF.js → tabs-DvsJVzb1.js} +1 -1
  119. package/dist/client/assets/{task-status-BKkJIb6H.js → task-status-KWWNTm4M.js} +1 -1
  120. package/dist/client/assets/{textarea-CjtgfBdH.js → textarea-CWhJ3Xwe.js} +1 -1
  121. package/dist/client/assets/{toggle-group-ComSgZAp.js → toggle-group-B06Rml5A.js} +1 -1
  122. package/dist/client/assets/{tools-list-CurMUG9t.js → tools-list-DT1hnay8.js} +1 -1
  123. package/dist/client/assets/{types-DlC_80GR.js → types-DsDrkXAr.js} +1 -1
  124. package/dist/client/assets/{use-ai-providers-C3mVVuRV.js → use-ai-providers-oEGyGWt1.js} +1 -1
  125. package/dist/client/assets/{use-collections-DcKD6Qxv.js → use-collections-D8VuBtQu.js} +1 -1
  126. package/dist/client/assets/{use-connection-PZAuCSXO.js → use-connection-DATDvleR.js} +1 -1
  127. package/dist/client/assets/{use-copy-Bj-MTwaa.js → use-copy-C4JHTA85.js} +1 -1
  128. package/dist/client/assets/{use-create-virtual-mcp-B_irsl9D.js → use-create-virtual-mcp-CPp3t7Vk.js} +1 -1
  129. package/dist/client/assets/{use-decopilot-events-CDeh99iZ.js → use-decopilot-events-BmJPvHjL.js} +1 -1
  130. package/dist/client/assets/{use-delete-connection-BR9ISSGY.js → use-delete-connection-Cs_pBxVJ.js} +1 -1
  131. package/dist/client/assets/{use-infinite-scroll-D-2l__Cz.js → use-infinite-scroll-42GyaTNJ.js} +1 -1
  132. package/dist/client/assets/{use-list-state-BV21WFDK.js → use-list-state-B_acXswQ.js} +1 -1
  133. package/dist/client/assets/{use-mcp-tools-Bv5yUcCZ.js → use-mcp-tools-Bp4N36ES.js} +1 -1
  134. package/dist/client/assets/{use-members-BAhIl5n0.js → use-members-egBMdDNQ.js} +1 -1
  135. package/dist/client/assets/{use-mobile-BpBXbl16.js → use-mobile-BwJlvmat.js} +1 -1
  136. package/dist/client/assets/{use-navigate-to-agent-CG7-kp4S.js → use-navigate-to-agent-CeIX1obd.js} +1 -1
  137. package/dist/client/assets/{use-org-sso-4JoNv6HV.js → use-org-sso-D35VQct2.js} +1 -1
  138. package/dist/client/assets/{use-organization-roles-Bpj16cC4.js → use-organization-roles-DewFhO3_.js} +1 -1
  139. package/dist/client/assets/{use-organization-settings-axiNM6Y6.js → use-organization-settings-DlzwYRHw.js} +1 -1
  140. package/dist/client/assets/{use-registry-connections-fdW_5JrJ.js → use-registry-connections-BMDx5SL4.js} +1 -1
  141. package/dist/client/assets/{use-status-sounds-BYcGwXOW.js → use-status-sounds-CnYkx9X0.js} +1 -1
  142. package/dist/client/assets/{use-tasks-CEbKlK-w.js → use-tasks-BtgjavUX.js} +1 -1
  143. package/dist/client/assets/{use-view-mode-DXGS7T6x.js → use-view-mode-ni8MVEBL.js} +1 -1
  144. package/dist/client/assets/{use-virtual-mcp-C8FeHhCA.js → use-virtual-mcp-CLK92_-L.js} +1 -1
  145. package/dist/client/assets/useInfiniteQuery-NxzX8_KV.js +1 -0
  146. package/dist/client/assets/useSuspenseInfiniteQuery-BTse9xwX.js +1 -0
  147. package/dist/client/assets/{user-1OxcID9o.js → user-K40phdtq.js} +1 -1
  148. package/dist/client/assets/{view-mode-toggle-BiIaP24A.js → view-mode-toggle-Co7HEZDI.js} +1 -1
  149. package/dist/client/assets/{workflow-Dx23L5rN.js → workflow-CuFWe7ID.js} +1 -1
  150. package/dist/client/assets/workflow-detail-CoSxU_nR.js +1 -0
  151. package/dist/client/index.html +1 -1
  152. package/dist/server/cli.js +1 -1
  153. package/dist/server/node_modules/{xtend → pg}/LICENSE +7 -6
  154. package/dist/server/node_modules/pg/README.md +95 -0
  155. package/dist/server/node_modules/pg/esm/index.mjs +20 -0
  156. package/dist/server/node_modules/pg/lib/client.js +743 -0
  157. package/dist/server/node_modules/pg/lib/connection-parameters.js +171 -0
  158. package/dist/server/node_modules/pg/lib/connection.js +221 -0
  159. package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
  160. package/dist/server/node_modules/pg/lib/crypto/sasl.js +212 -0
  161. package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
  162. package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
  163. package/dist/server/node_modules/pg/lib/crypto/utils.js +9 -0
  164. package/dist/server/node_modules/pg/lib/defaults.js +91 -0
  165. package/dist/server/node_modules/pg/lib/index.js +73 -0
  166. package/dist/server/node_modules/pg/lib/native/client.js +323 -0
  167. package/dist/server/node_modules/pg/lib/native/index.js +2 -0
  168. package/dist/server/node_modules/pg/lib/native/query.js +165 -0
  169. package/dist/server/node_modules/pg/lib/query.js +252 -0
  170. package/dist/server/node_modules/pg/lib/result.js +109 -0
  171. package/dist/server/node_modules/pg/lib/stream.js +83 -0
  172. package/dist/server/node_modules/pg/lib/type-overrides.js +35 -0
  173. package/dist/server/node_modules/pg/lib/utils.js +217 -0
  174. package/dist/server/node_modules/pg/package.json +76 -0
  175. package/package.json +1 -1
  176. package/dist/client/assets/ai-providers-dl8LgpRM.js +0 -1
  177. package/dist/client/assets/registry-B2nAdztj.js +0 -2
  178. package/dist/client/assets/shell-layout-DifA2CaM.js +0 -1
  179. package/dist/client/assets/store-registry-Db_sa3Jy.js +0 -2
  180. package/dist/client/assets/useInfiniteQuery-D8Ti3aNB.js +0 -1
  181. package/dist/client/assets/useSuspenseInfiniteQuery-BOcz1SDi.js +0 -1
  182. package/dist/client/assets/workflow-detail-BMaclVeL.js +0 -1
  183. package/dist/server/node_modules/ansi-styles/index.d.ts +0 -236
  184. package/dist/server/node_modules/ansi-styles/index.js +0 -223
  185. package/dist/server/node_modules/ansi-styles/license +0 -9
  186. package/dist/server/node_modules/ansi-styles/package.json +0 -54
  187. package/dist/server/node_modules/ansi-styles/readme.md +0 -173
  188. package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  189. package/dist/server/node_modules/is-fullwidth-code-point/index.js +0 -12
  190. package/dist/server/node_modules/is-fullwidth-code-point/license +0 -9
  191. package/dist/server/node_modules/is-fullwidth-code-point/package.json +0 -53
  192. package/dist/server/node_modules/is-fullwidth-code-point/readme.md +0 -31
  193. package/dist/server/node_modules/xtend/.jshintrc +0 -30
  194. package/dist/server/node_modules/xtend/README.md +0 -32
  195. package/dist/server/node_modules/xtend/immutable.js +0 -19
  196. package/dist/server/node_modules/xtend/mutable.js +0 -17
  197. package/dist/server/node_modules/xtend/package.json +0 -55
  198. package/dist/server/node_modules/xtend/test.js +0 -103
@@ -1,4 +1,4 @@
1
- import{e as di,c as fi,aX as ju,j as M,r as w,cD as _l,bg as Hu,J as Wu,bc as St,cE as Uu,ah as it,ai as Qe,aW as On,aT as qu,aU as Ku,b6 as Mt,cF as Vl,ao as jl,aS as Ju,ae as ut}from"./index-CVUETRIB.js";import{e as Gu}from"./select-DaM3TY5t.js";const Yu=ju("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",special:"fill-special text-backround"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function db(n){const e=di.c(10),{variant:t,size:r}=n;let s;e[0]!==r||e[1]!==t?(s=fi(Yu({variant:t,size:r})),e[0]=r,e[1]=t,e[2]=s):s=e[2];let i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=M.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o=M.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=i,e[4]=o):(i=e[3],o=e[4]);let l;e[5]!==s?(l=M.jsxs("svg",{"aria-hidden":"true",className:s,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i,o]}),e[5]=s,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=M.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=a):a=e[7];let c;return e[8]!==l?(c=M.jsxs("div",{role:"status",children:[l,a]}),e[8]=l,e[9]=c):c=e[9],c}function Q(n){this.content=n}Q.prototype={constructor:Q,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 Q(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 Q(t)},addToStart:function(n,e){return new Q([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Q(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 Q(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=Q.from(n),n.size?new Q(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Q.from(n),n.size?new Q(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Q.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}};Q.from=function(n){if(n instanceof Q)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Q(e)};function Hl(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=Hl(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wl(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=Wl(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{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 k(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 k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(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 k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(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 Hl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wl(this,e,t,r)}findIndex(e){if(e==0)return Ln(0,e);if(e==this.size)return Ln(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?Ln(t+1,i):Ln(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 k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.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 k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const ls={index:0,offset:0};function Ln(n,e){return ls.index=n,ls.offset=e,ls}function Qn(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(!Qn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Qn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let z=class Ps{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&&Qn(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 Ps.none;if(e instanceof Ps)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};z.none=[];class Zn extends Error{}class v{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=ql(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Ul(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 v.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 v(k.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 v(e,r,s)}}v.empty=new v(k.empty,0,0);function Ul(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(Ul(i.content,e-s-1,t-s-1)))}function ql(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=ql(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Xu(n,e,t){if(t.openStart>n.depth)throw new Zn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Zn("Inconsistent open depths");return Kl(n,e,t,0)}function Kl(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=Kl(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 yt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Qu(t,n);return yt(i,Gl(n,o,l,e,r))}else return yt(i,er(n,e,r))}function Jl(n,e){if(!e.type.compatibleContent(n.type))throw new Zn("Cannot join "+e.type.name+" onto "+n.type.name)}function Ls(n,e,t){let r=n.node(t);return Jl(r,e.node(t)),r}function gt(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 an(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&&(gt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)gt(s.child(l),r);e&&e.depth==t&&e.textOffset&&gt(e.nodeBefore,r)}function yt(n,e){return n.type.checkContent(e),n.copy(e)}function Gl(n,e,t,r,s){let i=n.depth>s&&Ls(n,e,s+1),o=r.depth>s&&Ls(t,r,s+1),l=[];return an(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jl(i,o),gt(yt(i,Gl(n,e,t,r,s+1)),l)):(i&&gt(yt(i,er(n,e,s+1)),l),an(e,t,s,l),o&&gt(yt(o,er(t,r,s+1)),l)),an(r,null,s,l),new k(l)}function er(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let s=Ls(n,e,t+1);gt(yt(s,er(n,e,t+1)),r)}return an(e,null,t,r),new k(r)}function Qu(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(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class kn{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 z.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 tr(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 kn(t,r,i)}static resolveCached(e,t){let r=oo.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 oo.set(e,r=new Zu);let s=r.elts[r.i]=kn.resolve(e,t);return r.i=(r.i+1)%ed,s}}class Zu{constructor(){this.elts=[],this.i=0}}const ed=12,oo=new WeakMap;class tr{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 td=Object.create(null);class Ee{constructor(e,t,r,s=z.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.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&&Qn(this.attrs,t||e.defaultAttrs||td)&&z.sameSet(this.marks,r||z.none)}copy(e=null){return e==this.content?this:new Ee(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ee(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 v.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 v(c,s.depth-o,i.depth-o)}replace(e,t,r){return Xu(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 kn.resolveCached(this,e)}resolveNoCache(e){return kn.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()+")"),Yl(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=k.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=z.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(!z.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=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Ee.prototype.text=void 0;class nr extends Ee{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):Yl(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 nr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new nr(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 Yl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class wt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new nd(e,t);if(r.next==null)return wt.empty;let s=Xl(r);r.next&&r.err("Unexpected trailing text");let i=cd(ad(s));return ud(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 k.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{e as di,c as fi,aX as ju,j as M,r as w,cE as _l,bg as Hu,J as Wu,bc as St,cF as Uu,ah as it,ai as Qe,aW as On,aT as qu,aU as Ku,b6 as Mt,cG as Vl,ao as jl,aS as Ju,ae as ut}from"./index-D3dcRy4-.js";import{e as Gu}from"./select-pbe1Tw3i.js";const Yu=ju("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",special:"fill-special text-backround"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function db(n){const e=di.c(10),{variant:t,size:r}=n;let s;e[0]!==r||e[1]!==t?(s=fi(Yu({variant:t,size:r})),e[0]=r,e[1]=t,e[2]=s):s=e[2];let i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=M.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),o=M.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=i,e[4]=o):(i=e[3],o=e[4]);let l;e[5]!==s?(l=M.jsxs("svg",{"aria-hidden":"true",className:s,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i,o]}),e[5]=s,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=M.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=a):a=e[7];let c;return e[8]!==l?(c=M.jsxs("div",{role:"status",children:[l,a]}),e[8]=l,e[9]=c):c=e[9],c}function Q(n){this.content=n}Q.prototype={constructor:Q,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 Q(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 Q(t)},addToStart:function(n,e){return new Q([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Q(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 Q(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=Q.from(n),n.size?new Q(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Q.from(n),n.size?new Q(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Q.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}};Q.from=function(n){if(n instanceof Q)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Q(e)};function Hl(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=Hl(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wl(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=Wl(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{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 k(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 k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(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 k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(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 Hl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wl(this,e,t,r)}findIndex(e){if(e==0)return Ln(0,e);if(e==this.size)return Ln(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?Ln(t+1,i):Ln(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 k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.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 k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const ls={index:0,offset:0};function Ln(n,e){return ls.index=n,ls.offset=e,ls}function Qn(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(!Qn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Qn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let z=class Ps{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&&Qn(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 Ps.none;if(e instanceof Ps)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};z.none=[];class Zn extends Error{}class v{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=ql(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Ul(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 v.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 v(k.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 v(e,r,s)}}v.empty=new v(k.empty,0,0);function Ul(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(Ul(i.content,e-s-1,t-s-1)))}function ql(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=ql(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Xu(n,e,t){if(t.openStart>n.depth)throw new Zn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Zn("Inconsistent open depths");return Kl(n,e,t,0)}function Kl(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=Kl(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 yt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Qu(t,n);return yt(i,Gl(n,o,l,e,r))}else return yt(i,er(n,e,r))}function Jl(n,e){if(!e.type.compatibleContent(n.type))throw new Zn("Cannot join "+e.type.name+" onto "+n.type.name)}function Ls(n,e,t){let r=n.node(t);return Jl(r,e.node(t)),r}function gt(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 an(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&&(gt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)gt(s.child(l),r);e&&e.depth==t&&e.textOffset&&gt(e.nodeBefore,r)}function yt(n,e){return n.type.checkContent(e),n.copy(e)}function Gl(n,e,t,r,s){let i=n.depth>s&&Ls(n,e,s+1),o=r.depth>s&&Ls(t,r,s+1),l=[];return an(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jl(i,o),gt(yt(i,Gl(n,e,t,r,s+1)),l)):(i&&gt(yt(i,er(n,e,s+1)),l),an(e,t,s,l),o&&gt(yt(o,er(t,r,s+1)),l)),an(r,null,s,l),new k(l)}function er(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let s=Ls(n,e,t+1);gt(yt(s,er(n,e,t+1)),r)}return an(e,null,t,r),new k(r)}function Qu(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(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class kn{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 z.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 tr(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 kn(t,r,i)}static resolveCached(e,t){let r=oo.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 oo.set(e,r=new Zu);let s=r.elts[r.i]=kn.resolve(e,t);return r.i=(r.i+1)%ed,s}}class Zu{constructor(){this.elts=[],this.i=0}}const ed=12,oo=new WeakMap;class tr{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 td=Object.create(null);class Ee{constructor(e,t,r,s=z.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.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&&Qn(this.attrs,t||e.defaultAttrs||td)&&z.sameSet(this.marks,r||z.none)}copy(e=null){return e==this.content?this:new Ee(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ee(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 v.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 v(c,s.depth-o,i.depth-o)}replace(e,t,r){return Xu(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 kn.resolveCached(this,e)}resolveNoCache(e){return kn.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()+")"),Yl(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=k.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=z.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(!z.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=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Ee.prototype.text=void 0;class nr extends Ee{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):Yl(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 nr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new nr(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 Yl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class wt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new nd(e,t);if(r.next==null)return wt.empty;let s=Xl(r);r.next&&r.err("Unexpected trailing text");let i=cd(ad(s));return ud(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 k.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
  `)}}wt.empty=new wt(!0);class nd{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 Xl(n){let e=[];do e.push(rd(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function rd(n){let e=[];do e.push(sd(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sd(n){let e=ld(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=id(n,e);else break;return e}function lo(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function id(n,e){let t=lo(n),r=t;return n.eat(",")&&(n.next!="}"?r=lo(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function od(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 ld(n){if(n.eat("(")){let e=Xl(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=od(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 ad(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 Ql(n,e){return e-n}function ao(n,e){let t=[];return r(e),t.sort(Ql);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 cd(n){let e=Object.create(null);return t(ao(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]);ao(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new wt(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Ql);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function ud(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 Zl(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 ea(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 ta(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 na(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new fd(n,r,e[r]);return t}let co=class ra{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=na(e,r.attrs),this.defaultAttrs=Zl(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==wt.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:ea(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ee(this,this.computeAttrs(e),k.from(t),z.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new Ee(this,this.computeAttrs(e),t,z.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.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(k.empty,!0);return i?new Ee(this,e,t.append(i),z.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){ta(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:z.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ra(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 dd(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 fd{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?dd(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class jr{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=na(e,s.attrs),this.excluded=null;let i=Zl(this.attrs);this.instance=i?new z(this,i):null}create(e=null){return!e&&this.instance?this.instance:new z(this,ea(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new jr(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){ta(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class sa{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=Q.from(e.nodes),t.marks=Q.from(e.marks||{}),this.nodes=co.compile(this.spec.nodes,this),this.marks=jr.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]=wt.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?uo(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==""?[]:uo(this,o.split(" "))}this.nodeFromJSON=s=>Ee.fromJSON(this,s),this.markFromJSON=s=>z.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 co){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 nr(r,r.defaultAttrs,e,z.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 uo(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 hd(n){return n.tag!=null}function pd(n){return n.style!=null}class Ze{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(hd(s))this.tags.push(s);else if(pd(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 ho(this,t,!1);return r.addAll(e,z.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ho(this,t,!0);return r.addAll(e,z.none,t.from,t.to),v.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(yd(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=po(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=po(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ze(e,Ze.schemaRules(e)))}}const ia={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},md={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oa={ol:!0,ul:!0},xn=1,Bs=2,cn=4;function fo(n,e,t){return e!=null?(e?xn:0)|(e==="full"?Bs:0):n&&n.whitespace=="pre"?xn|Bs:t&~cn}class Bn{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=z.none,this.match=i||(o&cn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.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&xn)){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=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.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&&!ia.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ho{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=fo(null,t.preserveWhitespace,0)|(r?cn:0);s?i=new Bn(s.type,s.attrs,z.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Bn(null,null,z.none,!0,null,o):i=new Bn(e.schema.topNodeType,null,z.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&Bs?"full":this.localPreserveWS||(s.options&xn)>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;oa.hasOwnProperty(o)&&this.parser.normalizeLists&&gd(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:md.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(ia.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=z.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):mo(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=fo(e,i,o.options);o.options&cn&&o.content.length==0&&(l|=cn);let a=z.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):mo(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Bn(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|=xn)}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 gd(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&oa.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function yd(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function po(n){let e={};for(let t in n)e[t]=n[t];return e}function mo(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 At{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=as(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}=Kn(as(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&&Kn(as(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Kn(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new At(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=go(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return go(e.marks)}}function go(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function as(n){return n.document||window.document}const yo=new WeakMap;function bd(n){let e=yo.get(n);return e===void 0&&yo.set(n,e=kd(n)),e}function kd(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 Kn(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=bd(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:p}=Kn(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const la=65535,aa=Math.pow(2,16);function xd(n,e){return n+e*aa}function bo(n){return n&la}function Sd(n){return(n-(n&la))/aa}const ca=1,ua=2,Jn=4,da=8;class zs{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&da)>0}get deletedBefore(){return(this.delInfo&(ca|Jn))>0}get deletedAfter(){return(this.delInfo&(ua|Jn))>0}get deletedAcross(){return(this.delInfo&Jn)>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=bo(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+Sd(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 p=e==(t<0?a:d)?null:xd(l/3,e-a),m=e==a?ua:e==d?ca:Jn;return(t<0?e!=a:e!=d)&&(m|=da),new zs(h,m,p)}s+=u-c}return r?e+s:new zs(e+s,0,null)}touches(e,t){let r=0,s=bo(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 Sn{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 Sn(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 Sn;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 zs(e,s,null)}}const cs=Object.create(null);class se{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=cs[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 cs)throw new RangeError("Duplicate use of step JSON ID "+e);return cs[e]=t,t.prototype.jsonID=e,t}}class q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new q(e,null)}static fail(e){return new q(null,e)}static fromReplace(e,t,r,s){try{return q.ok(e.replace(t,r,s))}catch(i){if(i instanceof Zn)return q.fail(i.message);throw i}}}function hi(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(hi(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return k.fromArray(r)}class Ge extends se{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 v(hi(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 q.fromReplace(e,this.from,this.to,i)}invert(){return new ve(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 Ge(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ge(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 Ge(t.from,t.to,e.markFromJSON(t.mark))}}se.jsonID("addMark",Ge);class ve extends se{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 v(hi(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,r)}invert(){return new Ge(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 ve(t.pos,r.pos,this.mark)}merge(e){return e instanceof ve&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ve(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 ve(t.from,t.to,e.markFromJSON(t.mark))}}se.jsonID("removeMark",ve);class Ye extends se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new v(k.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 Ye(this.pos,t.marks[s]);return new Ye(this.pos,this.mark)}}return new Ct(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ye(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 Ye(t.pos,e.markFromJSON(t.mark))}}se.jsonID("addNodeMark",Ye);class Ct extends se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new v(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ye(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ct(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 Ct(t.pos,e.markFromJSON(t.mark))}}se.jsonID("removeNodeMark",Ct);class U extends se{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&$s(e,this.from,this.to)?q.fail("Structure replace would overwrite content"):q.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 U(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&&U.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new U(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof U)||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?v.empty:new v(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new U(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?v.empty:new v(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new U(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 U(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}U.MAP_BIAS=1;se.jsonID("replace",U);class Y extends se{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&&($s(e,this.from,this.gapFrom)||$s(e,this.gapTo,this.to)))return q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?q.fromReplace(e,this.from,this.to,r):q.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 Y(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 Y(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 Y(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}se.jsonID("replaceAround",Y);function $s(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 wd(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),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:s.push(o=new ve(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Ge(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function Cd(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 jr){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 p=s[h];p.step==i-1&&d.eq(s[h].style)&&(f=p)}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 ve(o.from,o.to,o.style)))}function pi(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 U(l,u,v.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ve(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new v(k.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new U(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(k.empty,!0);n.replace(l,l,new v(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function vd(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Yt(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||!vd(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function Ed(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=k.empty,d=0;for(let p=i,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=k.from(r.node(p).copy(u)),d++):a--;let f=k.empty,h=0;for(let p=i,m=!1;p>t;p--)m||s.after(p+1)<s.end(p)?(m=!0,f=k.from(s.node(p).copy(f)),h++):c++;n.step(new Y(a,c,o,l,new v(u.append(f),d,h),u.size-d,!0))}function mi(n,e,t=null,r=n){let s=Td(n,e),i=s&&Md(r,e);return i?s.map(ko).concat({type:e,attrs:t}).concat(i.map(ko)):null}function ko(n){return{type:n,attrs:null}}function Td(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 Md(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 Ad(n,e,t){let r=k.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=k.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new Y(s,i,s,i,new v(r,0,0),t.length,!0))}function Nd(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)&&Od(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&ha(n,o,l,i),pi(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 Y(d,f,d+1,f-1,new v(k.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&fa(n,o,l,i),!1}})}function fa(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 ha(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{e as b,c as w,j as a,l as j}from"./index-CVUETRIB.js";import{i as N}from"./SearchMd-DIPAhwlI.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{e as b,c as w,j as a,l as j}from"./index-D3dcRy4-.js";import{i as N}from"./SearchMd-DRU7KH2R.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,4 +1,4 @@
1
- import{r as O,J as pt,v as se,y as z,aK as Se,aI as je,a_ as Ne,aJ as ke,e as K,j as l,E as $e,s as ie,o as ge,a as le,K as X,n as Be,c as oe,x as _e,w as we,z as Y,aB as ve,t as Z,B as te,aD as Ue,u as gt,f as bt,D as vt}from"./index-CVUETRIB.js";import{C as yt}from"./checkbox-COiFtX5D.js";import{I as ne}from"./input-CL-LUIlC.js";import{d as Ve,c as We,a as jt,D as qe,e as St,b as He,h as Nt}from"./dialog-Dv_lEigV.js";import{g as _t,a as wt,b as Ct,c as It}from"./drawer-WXY2u6pv.js";import{u as kt}from"./use-mobile-BpBXbl16.js";import{a as Et,c as Mt,d as At,S as Ot,b as Tt}from"./select-DaM3TY5t.js";import{S as q}from"./skeleton-C8RqYCI9.js";import{i as Rt,t as Pt,b as zt,a as Ft,c as Lt}from"./Tool01-DK8Fhe6_.js";import{b as Qe,s as Ge,c as Dt,a as Kt,i as $t}from"./RefreshCcw01-BQD-u-1H.js";import{t as Ee}from"./ChevronDown-aTqoLskN.js";import{a as Ye,i as Xe}from"./SearchMd-DIPAhwlI.js";import{a as Bt}from"./Settings02-NWpe6nkq.js";import{u as ae,b as Je,a as he}from"./use-ai-providers-C3mVVuRV.js";import{p as Me,u as Ze}from"./chat-context-yRGYHam2.js";import{g as Ce}from"./ai-providers-logos-CS4PCiqI.js";import{i as Ut}from"./Zap-DUrCsyVy.js";import{i as Vt}from"./AlertCircle--Y_xi7pz.js";import{i as Wt}from"./CheckCircle-DeN4Arf9.js";import{s as qt}from"./Trash01-CLPACLPe.js";import{P as fe}from"./index-Dig_TVyF.js";import{d as Ht,S as xe,a as pe,b as ue}from"./settings-section-BS3Z4RWi.js";import{S as Qt}from"./switch-DGYFt_K8.js";import{a as Ae,T as Gt}from"./toggle-group-ComSgZAp.js";import{A as Yt}from"./avatar-C4Xk2I9Z.js";import{c as et,b as tt,d as st,A as lt,e as it,g as nt,a as ot,f as rt}from"./alert-dialog-P1MELuo2.js";import{S as ce,u as de}from"./constants-Dsh71ijv.js";import{e as Xt,f as Jt}from"./use-organization-settings-axiNM6Y6.js";import{f as Zt}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as es}from"./unwrap-tool-result-BYXdCQMg.js";function re(t,e,s){let n=s.initialDeps??[],i,o=!0;function a(){var r,d,m;let c;s.key&&((r=s.debug)!=null&&r.call(s))&&(c=Date.now());const h=t();if(!(h.length!==n.length||h.some((j,b)=>n[b]!==j)))return i;n=h;let f;if(s.key&&((d=s.debug)!=null&&d.call(s))&&(f=Date.now()),i=e(...h),s.key&&((m=s.debug)!=null&&m.call(s))){const j=Math.round((Date.now()-c)*100)/100,b=Math.round((Date.now()-f)*100)/100,_=b/16,N=(x,p)=>{for(x=String(x);x.length<p;)x=" "+x;return x};console.info(`%c⏱ ${N(b,5)} /${N(j,5)} ms`,`
1
+ import{r as O,J as pt,v as se,y as z,aK as Se,aI as je,a_ as Ne,aJ as ke,e as K,j as l,E as $e,s as ie,o as ge,a as le,K as X,n as Be,c as oe,x as _e,w as we,z as Y,aB as ve,t as Z,B as te,aD as Ue,u as gt,f as bt,D as vt}from"./index-D3dcRy4-.js";import{C as yt}from"./checkbox-DVSlEbBg.js";import{I as ne}from"./input-BTdB8RPC.js";import{d as Ve,c as We,a as jt,D as qe,e as St,b as He,h as Nt}from"./dialog-eYBbNtPx.js";import{g as _t,a as wt,b as Ct,c as It}from"./drawer-BnROsLEL.js";import{u as kt}from"./use-mobile-BwJlvmat.js";import{a as Et,c as Mt,d as At,S as Ot,b as Tt}from"./select-pbe1Tw3i.js";import{S as q}from"./skeleton-cT9-y8hq.js";import{i as Rt,t as Pt,b as zt,a as Ft,c as Lt}from"./Tool01-JkKJ-VBh.js";import{b as Qe,s as Ge,c as Dt,a as Kt,i as $t}from"./RefreshCcw01-Bw_4FSKr.js";import{t as Ee}from"./ChevronDown-CAze57fI.js";import{a as Ye,i as Xe}from"./SearchMd-DRU7KH2R.js";import{a as Bt}from"./Settings02-tDR0R-7r.js";import{u as ae,b as Je,a as he}from"./use-ai-providers-oEGyGWt1.js";import{p as Me,u as Ze}from"./chat-context-C5B4JHNW.js";import{g as Ce}from"./ai-providers-logos-CS4PCiqI.js";import{i as Ut}from"./Zap-CjGMKfBw.js";import{i as Vt}from"./AlertCircle-BCfEJcld.js";import{i as Wt}from"./CheckCircle-C29ChaU6.js";import{s as qt}from"./Trash01-5isrbkO6.js";import{P as fe}from"./index-B07jP2sp.js";import{d as Ht,S as xe,a as pe,b as ue}from"./settings-section-zap-Boy4.js";import{S as Qt}from"./switch-CrRugnBx.js";import{a as Ae,T as Gt}from"./toggle-group-B06Rml5A.js";import{A as Yt}from"./avatar-BiQlJs5k.js";import{c as et,b as tt,d as st,A as lt,e as it,g as nt,a as ot,f as rt}from"./alert-dialog-DGf6p6RH.js";import{S as ce,u as de}from"./constants-DV1Uc_8Q.js";import{e as Xt,f as Jt}from"./use-organization-settings-DlzwYRHw.js";import{f as Zt}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as es}from"./unwrap-tool-result-BYXdCQMg.js";function re(t,e,s){let n=s.initialDeps??[],i,o=!0;function a(){var r,d,m;let c;s.key&&((r=s.debug)!=null&&r.call(s))&&(c=Date.now());const h=t();if(!(h.length!==n.length||h.some((j,b)=>n[b]!==j)))return i;n=h;let f;if(s.key&&((d=s.debug)!=null&&d.call(s))&&(f=Date.now()),i=e(...h),s.key&&((m=s.debug)!=null&&m.call(s))){const j=Math.round((Date.now()-c)*100)/100,b=Math.round((Date.now()-f)*100)/100,_=b/16,N=(x,p)=>{for(x=String(x);x.length<p;)x=" "+x;return x};console.info(`%c⏱ ${N(b,5)} /${N(j,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*_,120))}deg 100% 31%);`,s?.key)}return s?.onChange&&!(o&&s.skipInitialOnChange)&&s.onChange(i),o=!1,i}return a.updateDeps=r=>{n=r},a}function Oe(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const ts=(t,e)=>Math.abs(t-e)<1.01,ss=(t,e,s)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),s)}},Te=t=>{const{offsetWidth:e,offsetHeight:s}=t;return{width:e,height:s}},ls=t=>t,is=t=>{const e=Math.max(t.startIndex-t.overscan,0),s=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let i=e;i<=s;i++)n.push(i);return n},ns=(t,e)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;const i=a=>{const{width:r,height:d}=a;e({width:Math.round(r),height:Math.round(d)})};if(i(Te(s)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(a=>{const r=()=>{const d=a[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){i({width:m.inlineSize,height:m.blockSize});return}}i(Te(s))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return o.observe(s,{box:"border-box"}),()=>{o.unobserve(s)}},Re={passive:!0},Pe=typeof window>"u"?!0:"onscrollend"in window,os=(t,e)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;let i=0;const o=t.options.useScrollendEvent&&Pe?()=>{}:ss(n,()=>{e(i,!1)},t.options.isScrollingResetDelay),a=c=>()=>{const{horizontal:h,isRtl:u}=t.options;i=h?s.scrollLeft*(u&&-1||1):s.scrollTop,o(),e(i,c)},r=a(!0),d=a(!1);s.addEventListener("scroll",r,Re);const m=t.options.useScrollendEvent&&Pe;return m&&s.addEventListener("scrollend",d,Re),()=>{s.removeEventListener("scroll",r),m&&s.removeEventListener("scrollend",d)}},rs=(t,e,s)=>{if(e?.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[s.options.horizontal?"inlineSize":"blockSize"])}return t[s.options.horizontal?"offsetWidth":"offsetHeight"]},as=(t,{adjustments:e=0,behavior:s},n)=>{var i,o;const a=t+e;(o=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[n.options.horizontal?"left":"top"]:a,behavior:s})};class cs{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var s,n,i;return((i=(n=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:n.now)==null?void 0:i.call(n))??Date.now()},this.observer=(()=>{let s=null;const n=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const a=()=>{const r=o.target,d=this.indexFromElement(r);if(!r.isConnected){this.observer.unobserve(r);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(r,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=n())==null||i.disconnect(),s=null},observe:i=>{var o;return(o=n())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=n())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=s=>{Object.entries(s).forEach(([n,i])=>{typeof i>"u"&&delete s[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ls,rangeExtractor:is,onChange:()=>{},measureElement:rs,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...s}},this.notify=s=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,s)},this.maybeNotify=re(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(s=>s()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var s;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(s,n)=>{const i=new Map,o=new Map;for(let a=n-1;a>=0;a--){const r=s[a];if(i.has(r.lane))continue;const d=o.get(r.lane);if(d==null||r.end>d.end?o.set(r.lane,r):r.end<d.end&&i.set(r.lane,!0),i.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((a,r)=>a.end===r.end?a.index-r.index:a.end-r.end)[0]:void 0},this.getMeasurementOptions=re(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(s,n,i,o,a,r,d)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=!0),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:s,paddingStart:n,scrollMargin:i,getItemKey:o,enabled:a,lanes:r,laneAssignmentMode:d}),{key:!1}),this.getMeasurements=re(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:n,scrollMargin:i,getItemKey:o,enabled:a,lanes:r,laneAssignmentMode:d},m)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const f of this.laneAssignments.keys())f>=s&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,c),u=new Array(r).fill(void 0);for(let f=0;f<c;f++){const j=h[f];j&&(u[j.lane]=f)}for(let f=c;f<s;f++){const j=o(f),b=this.laneAssignments.get(f);let _,N;const x=d==="estimate"||m.has(j);if(b!==void 0&&this.options.lanes>1){_=b;const g=u[_],y=g!==void 0?h[g]:void 0;N=y?y.end+this.options.gap:n+i}else{const g=this.options.lanes===1?h[f-1]:this.getFurthestMeasurement(h,f);N=g?g.end+this.options.gap:n+i,_=g?g.lane:f%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(f,_)}const p=m.get(j),v=typeof p=="number"?p:this.options.estimateSize(f),w=N+v;h[f]={index:f,start:N,size:v,end:w,key:j,lane:_},u[_]=f}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=re(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,n,i,o)=>this.range=s.length>0&&n>0?ds({measurements:s,outerSize:n,scrollOffset:i,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=re(()=>{let s=null,n=null;const i=this.calculateRange();return i&&(s=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,n]},(s,n,i,o,a)=>o===null||a===null?[]:s({startIndex:o,endIndex:a,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=s=>{const n=this.options.indexAttribute,i=s.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(i!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,i-o),r=Math.min(this.options.count-1,i+o);return s>=a&&s<=r}return!0},this.measureElement=s=>{if(!s){this.elementsCache.forEach((a,r)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(r))});return}const n=this.indexFromElement(s),i=this.options.getItemKey(n),o=this.elementsCache.get(i);o!==s&&(o&&this.observer.unobserve(o),this.observer.observe(s),this.elementsCache.set(i,s)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(s,void 0,this))},this.resizeItem=(s,n)=>{var i;const o=this.measurementsCache[s];if(!o)return;const a=this.itemSizeCache.get(o.key)??o.size,r=n-a;r!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,r,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,n)),this.notify(!1))},this.getVirtualItems=re(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,n)=>{const i=[];for(let o=0,a=s.length;o<a;o++){const r=s[o],d=n[r];i.push(d)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const n=this.getMeasurements();if(n.length!==0)return Oe(n[at(0,n.length-1,i=>Oe(n[i]).start,s)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(s,n,i=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),a=this.getScrollOffset();n==="auto"&&(n=s>=a+o?"end":"start"),n==="center"?s+=(i-o)/2:n==="end"&&(s-=o);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,s),0)},this.getOffsetForIndex=(s,n="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const i=this.getSize(),o=this.getScrollOffset(),a=this.measurementsCache[s];if(!a)return;if(n==="auto")if(a.end>=o+i-this.options.scrollPaddingEnd)n="end";else if(a.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];if(n==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),n];const r=n==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,n,a.size),n]},this.scrollToOffset=(s,{align:n="start",behavior:i="auto"}={})=>{const o=this.getOffsetForAlignment(s,n),a=this.now();this.scrollState={index:null,align:n,behavior:i,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:n="auto",behavior:i="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getOffsetForIndex(s,n);if(!o)return;const[a,r]=o,d=this.now();this.scrollState={index:s,align:r,behavior:i,startedAt:d,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:n="auto"}={})=>{const i=this.getScrollOffset()+s,o=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var s;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((s=n[n.length-1])==null?void 0:s.end)??0;else{const o=Array(this.options.lanes).fill(null);let a=n.length-1;for(;a>=0&&o.some(r=>r===null);){const r=n[a];o[r.lane]===null&&(o[r.lane]=r.end),a--}i=Math.max(...o.filter(r=>r!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(s,{adjustments:n,behavior:i})=>{this.options.scrollToFn(s,{behavior:i,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=n?n[0]:this.scrollState.lastTargetOffset,o=1,a=i!==this.scrollState.lastTargetOffset;if(!a&&ts(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const at=(t,e,s,n)=>{for(;t<=e;){const i=(t+e)/2|0,o=s(i);if(o<n)t=i+1;else if(o>n)e=i-1;else return i}return t>0?t-1:0};function ds({measurements:t,outerSize:e,scrollOffset:s,lanes:n}){const i=t.length-1,o=d=>t[d].start;if(t.length<=n)return{startIndex:0,endIndex:i};let a=at(0,i,o,s),r=a;if(n===1)for(;r<i&&t[r].end<s+e;)r++;else if(n>1){const d=Array(n).fill(0);for(;r<i&&d.some(c=>c<s+e);){const c=t[r];d[c.lane]=c.end,r++}const m=Array(n).fill(s+e);for(;a>=0&&m.some(c=>c>=s);){const c=t[a];m[c.lane]=c.start,a--}a=Math.max(0,a-a%n),r=Math.min(i,r+(n-1-r%n))}return{startIndex:a,endIndex:r}}const ze=typeof document<"u"?O.useLayoutEffect:O.useEffect;function ms({useFlushSync:t=!0,...e}){const s=O.useReducer(()=>({}),{})[1],n={...e,onChange:(o,a)=>{var r;t&&a?pt.flushSync(s):s(),(r=e.onChange)==null||r.call(e,o,a)}},[i]=O.useState(()=>new cs(n));return i.setOptions(n),ze(()=>i._didMount(),[]),ze(()=>i._willUpdate()),i}function us(t){return ms({observeElementRect:ns,observeElementOffset:os,scrollToFn:as,...t})}se({title:z(),url:z(),icon:z()});se({registries:je(z(),se({enabled:Ne()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:Se(z()).describe("List of MCP app_name or app_id values to hide from the store.")});const me=se({keyId:z(),modelId:z(),title:z().optional()}).nullable(),hs=se({enabled:Ne(),chat:se({fast:me,smart:me,thinking:me}),image:me,webResearch:me});se({ids:Se(z()).describe("Ordered list of agent ids to show on the home view. Mix of well-known template ids and custom virtual MCP ids.")});se({id:z().describe("Brand context ID"),name:z().describe("Company name"),domain:z().describe("Company domain (e.g. example.com)"),overview:z().describe("Company overview / description"),logo:z().nullable().optional().describe("Logo URL"),favicon:z().nullable().optional().describe("Favicon URL"),ogImage:z().nullable().optional().describe("OG image URL"),fonts:se({heading:z().optional().describe("Font family for headings"),body:z().optional().describe("Font family for body text"),code:z().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:se({primary:z().optional().describe("Primary brand color (hex)"),secondary:z().optional().describe("Secondary brand color (hex)"),accent:z().optional().describe("Accent / highlight color (hex)"),background:z().optional().describe("Background color (hex)"),foreground:z().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:Se(je(z(),ke())).nullable().optional().describe("Brand images"),metadata:je(z(),ke()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:z().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:Ne().optional().describe("Whether this is the default brand for the organization")});function fs(t){const e=K.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(Vt,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=l.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,l.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",s.message]})]}),e[1]=s.message,e[2]=i):i=e[2],i}function xs(t){const e=K.c(27),{keys:s,onDelete:n,isDeleting:i}=t,[o,a]=O.useState(null);let r;if(e[0]!==o||e[1]!==s){let v;e[3]!==o?(v=w=>w.id===o,e[3]=o,e[4]=v):v=e[4],r=s.find(v),e[0]=o,e[1]=s,e[2]=r}else r=e[2];const d=r;let m;if(e[5]!==i||e[6]!==s){let v;e[8]!==i?(v=w=>l.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50 text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[l.jsx(Ye,{size:14,className:"text-muted-foreground shrink-0"}),l.jsx("span",{className:"font-medium truncate",children:w.label}),l.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["added ",Zt(new Date(w.createdAt))," ago"]})]}),l.jsx("div",{onClick:gs,children:l.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",disabled:i,onClick:()=>a(w.id),children:l.jsx(qt,{size:14})})})]},w.id),e[8]=i,e[9]=v):v=e[9],m=s.map(v),e[5]=i,e[6]=s,e[7]=m}else m=e[7];const c=!!o;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=v=>!v&&a(null),e[10]=h):h=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=l.jsx(et,{children:"Delete API Key"}),e[11]=u):u=e[11];const f=d?.label;let j;e[12]!==f?(j=l.jsxs(tt,{children:[u,l.jsxs(st,{children:["This action cannot be undone. This will permanently delete"," ",l.jsx("span",{className:"font-medium text-foreground",children:f}),"."]})]}),e[12]=f,e[13]=j):j=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsx(lt,{children:"Cancel"}),e[14]=b):b=e[14];let _;e[15]!==o||e[16]!==n?(_=l.jsxs(it,{children:[b,l.jsx(nt,{onClick:()=>{o&&(n(o),a(null))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[15]=o,e[16]=n,e[17]=_):_=e[17];let N;e[18]!==j||e[19]!==_?(N=l.jsxs(ot,{onClick:ps,children:[j,_]}),e[18]=j,e[19]=_,e[20]=N):N=e[20];let x;e[21]!==N||e[22]!==c?(x=l.jsx(rt,{open:c,onOpenChange:h,children:N}),e[21]=N,e[22]=c,e[23]=x):x=e[23];let p;return e[24]!==x||e[25]!==m?(p=l.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[m,x]}),e[24]=x,e[25]=m,e[26]=p):p=e[26],p}function ps(t){return t.stopPropagation()}function gs(t){return t.stopPropagation()}const bs=se({label:z().optional(),apiKey:z().min(1,"API key is required")});function vs(t){const e=K.c(61),{providerId:s,onCancel:n,onSuccess:i}=t,{org:o}=ie();let a;e[0]!==o.id?(a={connectionId:ce,orgId:o.id},e[0]=o.id,e[1]=a):a=e[1];const r=de(a),d=ge(),[m,c]=O.useState(!1);let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={resolver:we(bs),defaultValues:{label:"",apiKey:""}},e[2]=h):h=e[2];const{register:u,handleSubmit:f,formState:j}=_e(h),{errors:b}=j;let _;e[3]!==r||e[4]!==s?(_=async H=>{await r.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:s,label:H.label||"Personal key",apiKey:H.apiKey}})},e[3]=r,e[4]=s,e[5]=_):_=e[5];let N;e[6]!==i||e[7]!==o.id||e[8]!==d?(N=()=>{d.invalidateQueries({queryKey:X.aiProviderKeys(o.id)}),d.invalidateQueries({queryKey:X.aiProviders(o.id)}),Y.success("Key saved successfully"),i()},e[6]=i,e[7]=o.id,e[8]=d,e[9]=N):N=e[9];let x;e[10]!==_||e[11]!==N?(x={mutationFn:_,onSuccess:N,onError:ys},e[10]=_,e[11]=N,e[12]=x):x=e[12];const{mutate:p,isPending:v,error:w}=le(x);let g;e[13]!==p?(g=H=>p(H),e[13]=p,e[14]=g):g=e[14];let y;e[15]!==f||e[16]!==g?(y=f(g),e[15]=f,e[16]=g,e[17]=y):y=e[17];let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[18]=C):C=e[18];let E;e[19]!==u?(E=u("label"),e[19]=u,e[20]=E):E=e[20];let I;e[21]!==E?(I=l.jsxs("div",{className:"space-y-1",children:[C,l.jsx(ne,{placeholder:"e.g. Personal key",...E,className:"h-8 text-sm"})]}),e[21]=E,e[22]=I):I=e[22];let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),e[23]=S):S=e[23];const k=m?"text":"password";let T;e[24]!==u?(T=u("apiKey"),e[24]=u,e[25]=T):T=e[25];let M;e[26]!==k||e[27]!==T?(M=l.jsx(ne,{type:k,placeholder:"sk-...",...T,className:"ph-no-capture h-8 text-sm pr-8"}),e[26]=k,e[27]=T,e[28]=M):M=e[28];let A;e[29]!==m?(A=()=>c(!m),e[29]=m,e[30]=A):A=e[30];let R;e[31]!==m?(R=m?l.jsx(Qe,{size:14}):l.jsx(Ge,{size:14}),e[31]=m,e[32]=R):R=e[32];let P;e[33]!==A||e[34]!==R?(P=l.jsx("button",{type:"button",onClick:A,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:R}),e[33]=A,e[34]=R,e[35]=P):P=e[35];let L;e[36]!==M||e[37]!==P?(L=l.jsxs("div",{className:"relative",children:[M,P]}),e[36]=M,e[37]=P,e[38]=L):L=e[38];let Q;e[39]!==b.apiKey?(Q=b.apiKey&&l.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[39]=b.apiKey,e[40]=Q):Q=e[40];let U;e[41]!==L||e[42]!==Q?(U=l.jsxs("div",{className:"space-y-1",children:[S,L,Q]}),e[41]=L,e[42]=Q,e[43]=U):U=e[43];let $;e[44]!==w?($=w&&l.jsx("p",{className:"text-xs text-destructive",children:w.message}),e[44]=w,e[45]=$):$=e[45];let D;e[46]!==v||e[47]!==n?(D=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:v,children:"Cancel"}),e[46]=v,e[47]=n,e[48]=D):D=e[48];const V=v?"Saving...":"Save Key";let B;e[49]!==v||e[50]!==V?(B=l.jsx(te,{type:"submit",size:"sm",disabled:v,children:V}),e[49]=v,e[50]=V,e[51]=B):B=e[51];let W;e[52]!==D||e[53]!==B?(W=l.jsxs(He,{children:[D,B]}),e[52]=D,e[53]=B,e[54]=W):W=e[54];let G;return e[55]!==I||e[56]!==U||e[57]!==$||e[58]!==W||e[59]!==y?(G=l.jsxs("form",{onSubmit:y,className:"space-y-3",children:[I,U,$,W]}),e[55]=I,e[56]=U,e[57]=$,e[58]=W,e[59]=y,e[60]=G):G=e[60],G}function ys(t){Y.error(`Failed to save key: ${t.message}`)}const js=se({label:z().optional(),baseUrl:z().min(1,"Base URL is required"),apiKey:z().optional()});function Ss(t){const e=K.c(66),{onCancel:s,onSuccess:n}=t,{org:i}=ie();let o;e[0]!==i.id?(o={connectionId:ce,orgId:i.id},e[0]=i.id,e[1]=o):o=e[1];const a=de(o),r=ge(),[d,m]=O.useState(!1);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={resolver:we(js),defaultValues:{label:"",baseUrl:"",apiKey:""}},e[2]=c):c=e[2];const{register:h,handleSubmit:u,formState:f}=_e(c),{errors:j}=f;let b;e[3]!==a?(b=async F=>{const J=JSON.stringify({baseUrl:F.baseUrl,apiKey:F.apiKey||""});await a.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:"openai-compatible",label:F.label||F.baseUrl,apiKey:J}})},e[3]=a,e[4]=b):b=e[4];let _;e[5]!==n||e[6]!==i.id||e[7]!==r?(_=()=>{r.invalidateQueries({queryKey:X.aiProviderKeys(i.id)}),r.invalidateQueries({queryKey:X.aiProviders(i.id)}),Y.success("Connection saved successfully"),n()},e[5]=n,e[6]=i.id,e[7]=r,e[8]=_):_=e[8];let N;e[9]!==b||e[10]!==_?(N={mutationFn:b,onSuccess:_,onError:Ns},e[9]=b,e[10]=_,e[11]=N):N=e[11];const{mutate:x,isPending:p,error:v}=le(N);let w;e[12]!==x?(w=F=>x(F),e[12]=x,e[13]=w):w=e[13];let g;e[14]!==u||e[15]!==w?(g=u(w),e[14]=u,e[15]=w,e[16]=g):g=e[16];let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[17]=y):y=e[17];let C;e[18]!==h?(C=h("label"),e[18]=h,e[19]=C):C=e[19];let E;e[20]!==C?(E=l.jsxs("div",{className:"space-y-1",children:[y,l.jsx(ne,{placeholder:"e.g. LiteLLM, Ollama",...C,className:"h-8 text-sm"})]}),e[20]=C,e[21]=E):E=e[21];let I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),e[22]=I):I=e[22];let S;e[23]!==h?(S=h("baseUrl"),e[23]=h,e[24]=S):S=e[24];let k;e[25]!==S?(k=l.jsx(ne,{type:"url",placeholder:"http://localhost:4000/v1",...S,className:"h-8 text-sm"}),e[25]=S,e[26]=k):k=e[26];let T;e[27]!==j.baseUrl?(T=j.baseUrl&&l.jsx("p",{className:"text-xs text-destructive",children:j.baseUrl.message}),e[27]=j.baseUrl,e[28]=T):T=e[28];let M;e[29]!==k||e[30]!==T?(M=l.jsxs("div",{className:"space-y-1",children:[I,k,T]}),e[29]=k,e[30]=T,e[31]=M):M=e[31];let A;e[32]===Symbol.for("react.memo_cache_sentinel")?(A=l.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API Key ",l.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),e[32]=A):A=e[32];const R=d?"text":"password";let P;e[33]!==h?(P=h("apiKey"),e[33]=h,e[34]=P):P=e[34];let L;e[35]!==R||e[36]!==P?(L=l.jsx(ne,{type:R,placeholder:"sk-...",...P,className:"ph-no-capture h-8 text-sm pr-8"}),e[35]=R,e[36]=P,e[37]=L):L=e[37];let Q;e[38]!==d?(Q=()=>m(!d),e[38]=d,e[39]=Q):Q=e[39];let U;e[40]!==d?(U=d?l.jsx(Qe,{size:14}):l.jsx(Ge,{size:14}),e[40]=d,e[41]=U):U=e[41];let $;e[42]!==Q||e[43]!==U?($=l.jsx("button",{type:"button",onClick:Q,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:U}),e[42]=Q,e[43]=U,e[44]=$):$=e[44];let D;e[45]!==L||e[46]!==$?(D=l.jsxs("div",{className:"space-y-1",children:[A,l.jsxs("div",{className:"relative",children:[L,$]})]}),e[45]=L,e[46]=$,e[47]=D):D=e[47];let V;e[48]!==v?(V=v&&l.jsx("p",{className:"text-xs text-destructive",children:v.message}),e[48]=v,e[49]=V):V=e[49];let B;e[50]!==p||e[51]!==s?(B=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:p,children:"Cancel"}),e[50]=p,e[51]=s,e[52]=B):B=e[52];const W=p?"Saving...":"Save Connection";let G;e[53]!==p||e[54]!==W?(G=l.jsx(te,{type:"submit",size:"sm",disabled:p,children:W}),e[53]=p,e[54]=W,e[55]=G):G=e[55];let H;e[56]!==B||e[57]!==G?(H=l.jsxs(He,{children:[B,G]}),e[56]=B,e[57]=G,e[58]=H):H=e[58];let ee;return e[59]!==E||e[60]!==M||e[61]!==D||e[62]!==V||e[63]!==H||e[64]!==g?(ee=l.jsxs("form",{onSubmit:g,className:"space-y-3",children:[E,M,D,V,H]}),e[59]=E,e[60]=M,e[61]=D,e[62]=V,e[63]=H,e[64]=g,e[65]=ee):ee=e[65],ee}function Ns(t){Y.error(`Failed to save connection: ${t.message}`)}function Fe({provider:t,keys:e}){const{org:s}=ie(),n=de({connectionId:ce,orgId:s.id}),i=ge(),[o,a]=O.useState(!1),[r,d]=O.useState(!1),[m,c]=O.useState(null),h=t.supportedMethods.includes("cli-activate"),u=e.length>0,{mutate:f,isPending:j}=le({mutationFn:async S=>(await n.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:S}}),S),onSuccess:S=>{i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),i.invalidateQueries({queryKey:X.aiProviderModels(s.id,S)}),Y.success("Key deleted")},onError:S=>{Y.error(`Failed to delete key: ${S.message}`)}}),{mutate:b}=le({mutationFn:async({code:S,stateToken:k})=>{const T=await n.callTool({name:"AI_PROVIDER_OAUTH_EXCHANGE",arguments:{providerId:t.id,code:S,stateToken:k,label:"Connected via OAuth"}});if(T?.isError){const M=T.content?.[0]?.text??"OAuth exchange failed";throw new Error(M)}},onSuccess:()=>{Z("ai_provider_oauth_succeeded",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`),d(!1),c(null)},onError:S=>{Z("ai_provider_oauth_failed",{provider_id:t.id,error:S.message}),Y.error(`OAuth connection failed: ${S.message}`),d(!1),c(null)}}),{mutate:_,isPending:N}=le({mutationFn:async()=>{const S=await n.callTool({name:"AI_PROVIDER_CLI_ACTIVATE",arguments:{providerId:t.id}});if(S?.isError)throw new Error(S.content?.[0]?.text??"CLI activation failed");return S.structuredContent},onSuccess:S=>{if(!S?.activated){Z("ai_provider_cli_activate_failed",{provider_id:t.id,error:S?.error??"unknown"}),Y.error(S?.error??"CLI activation failed");return}Z("ai_provider_cli_activated",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} activated`)},onError:S=>{Z("ai_provider_cli_activate_failed",{provider_id:t.id,error:S.message}),Y.error(S.message)}}),{mutate:x,isPending:p}=le({mutationFn:async()=>{const S=await n.callTool({name:"AI_PROVIDER_PROVISION_KEY",arguments:{providerId:t.id}});if(S?.isError){const k=S.content?.[0]?.text??"Key provisioning failed";throw new Error(k)}},onSuccess:()=>{Z("ai_provider_provision_succeeded",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`)},onError:S=>{Z("ai_provider_provision_failed",{provider_id:t.id,error:S.message}),Y.error(`Failed to connect ${t.name}: ${S.message}`)}});O.useEffect(()=>{if(!r||!m)return;let S=!1;const k=M=>{if(M.origin===window.location.origin&&M.data?.type==="AI_PROVIDER_OAUTH_CALLBACK"){const{code:A,stateToken:R}=M.data;R===m?(S=!0,b({code:A,stateToken:R})):(console.error("State token mismatch"),Y.error("Security check failed: State token mismatch"),d(!1),c(null))}};window.addEventListener("message",k);const T=setTimeout(()=>{S||(Z("ai_provider_oauth_timeout",{provider_id:t.id}),d(!1),c(null),Y.error("Connection timed out"))},12e4);return()=>{window.removeEventListener("message",k),clearTimeout(T)}},[r,m,b,t.id]);const v=!!t.supportsProvision,w=t.supportedMethods.includes("oauth-pkce"),g=t.supportedMethods.includes("api-key"),y=()=>{if(!(o||r||N||p)){if(h){u||(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"cli-activate"}),_());return}v?(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"provision"}),x()):w?(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"oauth-pkce"}),C()):g&&(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"api-key"}),a(!0))}},C=async()=>{try{d(!0);const S=await n.callTool({name:"AI_PROVIDER_OAUTH_URL",arguments:{providerId:t.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`}});if(S.structuredContent)c(S.structuredContent.stateToken),window.open(S.structuredContent.url,"AiProviderOAuth","width=600,height=700");else throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL")}catch(S){d(!1),Y.error(`Failed to start OAuth: ${S instanceof Error?S.message:String(S)}`)}},E=N?"Checking CLI...":p?"Connecting...":r?"Authorizing...":null,I=E??(u&&h?`Authenticated via ${t.name} CLI`:t.description);return l.jsxs(l.Fragment,{children:[l.jsx(ue,{icon:t.logo?l.jsx("img",{src:t.logo,alt:t.name,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):l.jsx(Yt,{fallback:t.name.charAt(0),className:"size-8 bg-primary/10 text-primary"}),title:l.jsxs("span",{className:"flex items-center gap-2",children:[t.name,u&&!h&&!E&&l.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:[e.length," key",e.length!==1?"s":""," configured",t.supportsCredits?" · Managed above":""]})]}),description:I,onClick:!r&&!N&&!p?y:void 0,className:oe((r||N||p)&&"cursor-wait"),action:l.jsx("div",{className:"flex items-center gap-2",children:u&&l.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0"})}),children:u&&!h&&l.jsx(xs,{keys:e,onDelete:f,isDeleting:j})}),l.jsx(Ve,{open:o,onOpenChange:S=>{S||a(!1)},children:l.jsxs(We,{children:[l.jsxs(jt,{children:[l.jsxs(qe,{children:["Connect ",t.name]}),l.jsx(St,{children:t.id==="openai-compatible"?"Enter the base URL and optional API key for your OpenAI-compatible endpoint.":`Add an API key to connect your ${t.name} account.`})]}),t.id==="openai-compatible"?l.jsx(Ss,{onCancel:()=>a(!1),onSuccess:()=>a(!1)}):l.jsx(vs,{providerId:t.id,onCancel:()=>a(!1),onSuccess:()=>a(!1)})]})})]})}function ct(t){const e=K.c(24);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{hideProviderId:n}=s,i=Je(),o=ae();let a,r,d,m,c;if(e[2]!==i?.providers||e[3]!==o||e[4]!==n){let j;e[10]!==n?(j=p=>p.id!==n,e[10]=n,e[11]=j):j=e[11];const b=(i?.providers??[]).filter(j),_=b.filter(ws),N=b.filter(_s);m="flex flex-col gap-6 w-full",c=_.length>0&&l.jsx(xe,{children:l.jsxs("div",{className:"relative rounded-xl border border-lime-400/30 bg-gradient-to-br from-lime-50/50 via-transparent to-yellow-50/30 dark:from-lime-950/20 dark:to-yellow-950/10 p-4",children:[l.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-lime-400/5 to-yellow-400/5 pointer-events-none"}),l.jsx("p",{className:"text-xs font-medium text-lime-700 dark:text-lime-400 mb-3 relative",children:"Local models — use your existing AI provider"}),l.jsx(pe,{className:"relative",children:_.map(p=>l.jsx(Fe,{provider:p,keys:o.filter(v=>v.providerId===p.id)},p.id))})]})}),r=xe,a=pe;let x;e[12]!==o?(x=p=>l.jsx(Fe,{provider:p,keys:o.filter(v=>v.providerId===p.id)},p.id),e[12]=o,e[13]=x):x=e[13],d=N.map(x),e[2]=i?.providers,e[3]=o,e[4]=n,e[5]=a,e[6]=r,e[7]=d,e[8]=m,e[9]=c}else a=e[5],r=e[6],d=e[7],m=e[8],c=e[9];let h;e[14]!==a||e[15]!==d?(h=l.jsx(a,{children:d}),e[14]=a,e[15]=d,e[16]=h):h=e[16];let u;e[17]!==r||e[18]!==h?(u=l.jsx(r,{children:h}),e[17]=r,e[18]=h,e[19]=u):u=e[19];let f;return e[20]!==m||e[21]!==c||e[22]!==u?(f=l.jsxs("div",{className:m,children:[c,u]}),e[20]=m,e[21]=c,e[22]=u,e[23]=f):f=e[23],f}function _s(t){return!t.supportedMethods.includes("cli-activate")}function ws(t){return t.supportedMethods.includes("cli-activate")}const Cs={usd:[10,20,100],brl:[50,100,500]};function Is(){const t=K.c(28),{org:e}=ie();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s),[i,o]=O.useState(!1),{mutate:a,isPending:r}=le({mutationFn:async y=>{const C=await n.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:y,currency:u}});if(C?.isError)throw new Error(C.content?.[0]?.text??"Failed to get top-up URL");return C.structuredContent?.url},onSuccess:Es,onError:ks}),[d,m]=O.useState(""),[c,h]=O.useState("usd"),u=c,f=parseFloat(d),j=!isNaN(f)&&f>=1,b=u==="brl"?"R$":"$";let _;t[2]!==h?(_=y=>{y&&h(y)},t[2]=h,t[3]=_):_=t[3];let N,x;t[4]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx(Ae,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),x=l.jsx(Ae,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),t[4]=N,t[5]=x):(N=t[4],x=t[5]);let p;t[6]!==u||t[7]!==_?(p=l.jsxs(Gt,{type:"single",variant:"outline",size:"default",value:u,onValueChange:_,children:[N,x]}),t[6]=u,t[7]=_,t[8]=p):p=t[8];let v;t[9]!==u||t[10]!==b||t[11]!==i||t[12]!==r||t[13]!==a?(v=!i&&l.jsxs(l.Fragment,{children:[Cs[u].map(y=>l.jsxs(te,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:r,onClick:()=>a(y*100),children:[b,y]},y)),l.jsx(te,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>o(!0),disabled:r,children:"Custom"})]}),t[9]=u,t[10]=b,t[11]=i,t[12]=r,t[13]=a,t[14]=v):v=t[14];let w;t[15]!==b||t[16]!==d||t[17]!==f||t[18]!==i||t[19]!==j||t[20]!==r||t[21]!==m||t[22]!==a?(w=i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative max-w-[140px]",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:b}),l.jsx(ne,{type:"number",min:"1",step:"1",placeholder:"50",value:d,onChange:y=>m(y.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),l.jsx(te,{className:"h-10",disabled:!j||r,onClick:()=>a(Math.round(f*100)),children:r?"...":"Add"}),l.jsx(te,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{o(!1),m("")},children:"Cancel"})]}),t[15]=b,t[16]=d,t[17]=f,t[18]=i,t[19]=j,t[20]=r,t[21]=m,t[22]=a,t[23]=w):w=t[23];let g;return t[24]!==p||t[25]!==v||t[26]!==w?(g=l.jsx("div",{className:"flex flex-col gap-2.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p,v,w]})}),t[24]=p,t[25]=v,t[26]=w,t[27]=g):g=t[27],g}function ks(t){Y.error(`Top-up failed: ${t.message}`)}function Es(t){t&&window.open(t,"_blank","noopener,noreferrer")}function Ms(t){return t<=0?"text-destructive":t<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function As(){const t=K.c(60),{org:e}=ie();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s),i=ge(),o=ae();let a;t[2]!==o?(a=o.find(Ts),t[2]=o,t[3]=a):a=t[3];const r=a,[d,m]=O.useState(!1);let c;t[4]!==n||t[5]!==r?(c=async()=>{r&&await n.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:r.id}})},t[4]=n,t[5]=r,t[6]=c):c=t[6];let h;t[7]!==e.id||t[8]!==i?(h=()=>{i.invalidateQueries({queryKey:X.aiProviderKeys(e.id)}),i.invalidateQueries({queryKey:X.aiProviders(e.id)}),Y.success("Deco AI Gateway disconnected"),m(!1)},t[7]=e.id,t[8]=i,t[9]=h):h=t[9];let u;t[10]!==c||t[11]!==h?(u={mutationFn:c,onSuccess:h,onError:Os},t[10]=c,t[11]=h,t[12]=u):u=t[12];const{mutate:f,isPending:j}=le(u);let b;t[13]!==e.id?(b=X.aiProviderCredits(e.id,"deco"),t[13]=e.id,t[14]=b):b=t[14];const _=!!r;let N;t[15]!==n?(N=async()=>{const ee=await n.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return ee?.isError?null:ee.structuredContent??null},t[15]=n,t[16]=N):N=t[16];let x;t[17]!==b||t[18]!==_||t[19]!==N?(x={queryKey:b,enabled:_,staleTime:6e4,queryFn:N},t[17]=b,t[18]=_,t[19]=N,t[20]=x):x=t[20];const{data:p,isLoading:v,refetch:w,isFetching:g}=Be(x);if(!r)return null;const y=p?.balanceCents!=null?p.balanceCents/100:null;let C;t[21]!==y?(C=y!=null?`$${y.toFixed(2)}`:"—",t[21]=y,t[22]=C):C=t[22];const E=C;let I;t[23]===Symbol.for("react.memo_cache_sentinel")?(I=l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),l.jsx("div",{children:l.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),t[23]=I):I=t[23];let S;t[24]===Symbol.for("react.memo_cache_sentinel")?(S=()=>m(!0),t[24]=S):S=t[24];let k;t[25]!==j?(k=l.jsxs("div",{className:"flex items-center justify-between",children:[I,l.jsx(te,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:S,disabled:j,children:"Disconnect"})]}),t[25]=j,t[26]=k):k=t[26];let T;t[27]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsxs(tt,{children:[l.jsx(et,{children:"Disconnect Deco AI Gateway"}),l.jsx(st,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),t[27]=T):T=t[27];let M;t[28]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsx(lt,{children:"Cancel"}),t[28]=M):M=t[28];let A;t[29]!==f?(A=l.jsxs(ot,{children:[T,l.jsxs(it,{children:[M,l.jsx(nt,{onClick:()=>f(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),t[29]=f,t[30]=A):A=t[30];let R;t[31]!==d||t[32]!==A?(R=l.jsx(rt,{open:d,onOpenChange:m,children:A}),t[31]=d,t[32]=A,t[33]=R):R=t[33];let P;t[34]!==y||t[35]!==E||t[36]!==g||t[37]!==v?(P=v||g?l.jsx(q,{className:"h-9 w-24"}):l.jsx("span",{className:oe("text-3xl font-semibold tabular-nums tracking-tight",y!=null&&Ms(y)),children:E}),t[34]=y,t[35]=E,t[36]=g,t[37]=v,t[38]=P):P=t[38];let L;t[39]!==w?(L=()=>w(),t[39]=w,t[40]=L):L=t[40];const Q=g&&"animate-spin";let U;t[41]!==Q?(U=oe(Q),t[41]=Q,t[42]=U):U=t[42];let $;t[43]!==U?($=l.jsx(Ue,{size:14,className:U}),t[43]=U,t[44]=$):$=t[44];let D;t[45]!==g||t[46]!==L||t[47]!==$?(D=l.jsx("button",{type:"button",onClick:L,disabled:g,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:$}),t[45]=g,t[46]=L,t[47]=$,t[48]=D):D=t[48];let V;t[49]!==P||t[50]!==D?(V=l.jsxs("div",{className:"flex items-baseline gap-2",children:[P,D]}),t[49]=P,t[50]=D,t[51]=V):V=t[51];let B;t[52]===Symbol.for("react.memo_cache_sentinel")?(B=l.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),t[52]=B):B=t[52];let W;t[53]!==V?(W=l.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[V,B]}),t[53]=V,t[54]=W):W=t[54];let G;t[55]===Symbol.for("react.memo_cache_sentinel")?(G=l.jsxs("div",{className:"pt-4 border-t border-border/60",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),l.jsx(Is,{})]}),t[55]=G):G=t[55];let H;return t[56]!==k||t[57]!==R||t[58]!==W?(H=l.jsx(xe,{title:"Deco AI Gateway",children:l.jsx(pe,{children:l.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[k,R,W,G]})})}),t[56]=k,t[57]=R,t[58]=W,t[59]=H):H=t[59],H}function Os(t){Y.error(`Failed to disconnect: ${t.message}`)}function Ts(t){return t.providerId==="deco"}const Rs=t=>t.capabilities?.includes("image")===!0,Ps=t=>{const e=t.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("sonar")||e.includes("deepresearch")},zs={fast:"Fast",smart:"Smart",thinking:"Thinking"},Fs={fast:"Fastest responses, best for quick tasks",smart:"Balanced speed and capability",thinking:"Most capable, best for complex tasks"};function ye(t){const e=K.c(20),{slot:s,onSlotChange:n,filterModels:i,defaultKeyId:o}=t,a=ae(),[r,d]=O.useState(s?.keyId??o);let m;e[0]!==s?(m=()=>{s?.keyId&&d(s.keyId)},e[0]=s,e[1]=m):m=e[1];const c=s?.keyId;let h;e[2]!==c?(h=[c],e[2]=c,e[3]=h):h=e[3],O.useEffect(m,h);const u=r??o;let f;e[4]!==u||e[5]!==a?(f=u?a.find(y=>y.id===u):null,e[4]=u,e[5]=a,e[6]=f):f=e[6];const j=f,{models:b,isLoading:_}=he(i?u??void 0:void 0),N=i?_||b.some(i):!0;let x;e[7]!==s||e[8]!==j?.providerId?(x=s?{modelId:s.modelId,title:s.title??s.modelId,keyId:s.keyId,providerId:j?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[7]=s,e[8]=j?.providerId,e[9]=x):x=e[9];const p=x;if(i&&!N){let y;return e[10]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),e[10]=y):y=e[10],y}let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=y=>d(y),e[11]=v):v=e[11];let w;e[12]!==u||e[13]!==n?(w=y=>{const C=y.keyId??u??"";d(C),n({keyId:C,modelId:y.modelId,title:y.title})},e[12]=u,e[13]=n,e[14]=w):w=e[14];let g;return e[15]!==u||e[16]!==i||e[17]!==p||e[18]!==w?(g=l.jsx(wl,{variant:"bordered",placeholder:"Pick model",model:p,credentialId:u,filterModels:i,onCredentialChange:v,onModelChange:w}),e[15]=u,e[16]=i,e[17]=p,e[18]=w,e[19]=g):g=e[19],g}function Ls(t){const e=K.c(2),{isPending:s,showSaved:n}=t;if(s){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(Ue,{size:12,className:"animate-spin"}),"Saving…"]}),e[0]=i):i=e[0],i}if(n){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(Wt,{size:12}),"Saved"]}),e[1]=i):i=e[1],i}return null}function Ds(){const t=ae(),e=Xt(),s=t.length>0,n=_e({resolver:we(hs),values:e,mode:"onChange"}),{mutate:i,isPending:o,isSuccess:a}=Jt(),r=n.watch(),d=n.formState.isDirty;O.useEffect(()=>{if(!d)return;const x=setTimeout(()=>{i(r,{onSuccess:()=>n.reset(r,{keepValues:!0}),onError:p=>{n.reset(e),Y.error(`Failed to save: ${p.message}`)}})},250);return()=>clearTimeout(x)},[r,d,i,n,e]);const m=t[0],c=t[1],h=t[2],{models:u}=he(m?.id),{models:f}=he(c?.id),{models:j}=he(h?.id),b=x=>{const p=n.getValues("chat");if(x&&!p.fast&&!p.smart&&!p.thinking){const v={};m?.id&&(v[m.id]=u),c?.id&&(v[c.id]=f),h?.id&&(v[h.id]=j);const w=Me(t,v);n.reset({enabled:!0,chat:w.chat,image:w.image,webResearch:w.webResearch},{keepDirty:!0})}else n.setValue("enabled",x,{shouldDirty:!0})};O.useEffect(()=>{s||n.reset({enabled:!1,chat:{fast:null,smart:null,thinking:null},image:null,webResearch:null})},[s,n]),O.useEffect(()=>{const x=n.getValues();if(!x.enabled)return;const p=new Set(t.map(k=>k.id)),v={};m?.id&&(v[m.id]=u),c?.id&&(v[c.id]=f),h?.id&&(v[h.id]=j);const w=k=>k!=null&&!p.has(k.keyId),g={fast:w(x.chat.fast)?null:x.chat.fast,smart:w(x.chat.smart)?null:x.chat.smart,thinking:w(x.chat.thinking)?null:x.chat.thinking},y=w(x.image)?null:x.image,C=w(x.webResearch)?null:x.webResearch,E=!g.fast||!g.smart||!g.thinking||!y||!C,I=g.fast===x.chat.fast&&g.smart===x.chat.smart&&g.thinking===x.chat.thinking;if(!E&&I)return;const S=Me(t,v);n.reset({...x,chat:{fast:g.fast??S.chat.fast,smart:g.smart??S.chat.smart,thinking:g.thinking??S.chat.thinking},image:y??S.image,webResearch:C??S.webResearch},{keepDirty:!0})},[n,t,u,f,j,m?.id,c?.id,h?.id]);const N=n.watch("enabled")&&s;return l.jsx(xe,{title:"Simple model mode",children:l.jsxs(pe,{children:[l.jsx(ue,{title:"Enable simple model mode",description:s?"Replace the model picker with a Fast / Smart / Thinking toggle for all members of this org.":"Connect an AI provider above to enable this feature.",action:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Ls,{isPending:o,showSaved:a&&!d}),l.jsx(Qt,{checked:N,onCheckedChange:b,disabled:o||!s})]})}),N&&l.jsxs(l.Fragment,{children:[["fast","smart","thinking"].map(x=>l.jsx(ve,{control:n.control,name:`chat.${x}`,render:({field:p})=>l.jsx(ue,{title:zs[x],description:Fs[x],action:l.jsx(ye,{slot:p.value,defaultKeyId:t[0]?.id??null,onSlotChange:v=>p.onChange(v)})})},x)),l.jsx("div",{className:"h-px bg-border mx-5"}),l.jsx(ve,{control:n.control,name:"image",render:({field:x})=>l.jsx(ue,{title:"Image",action:l.jsx(ye,{slot:x.value,defaultKeyId:t[0]?.id??null,filterModels:Rs,onSlotChange:p=>x.onChange(p)})})}),l.jsx(ve,{control:n.control,name:"webResearch",render:({field:x})=>l.jsx(ue,{title:"Web research",action:l.jsx(ye,{slot:x.value,defaultKeyId:t[0]?.id??null,filterModels:Ps,onSlotChange:p=>x.onChange(p)})})})]})]})})}function Ks(){const t=K.c(6),s=ae().some($s);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(As,{}),t[0]=n):n=t[0];const i=s?"deco":void 0;let o;t[1]!==i?(o=l.jsx(ct,{hideProviderId:i}),t[1]=i,t[2]=o):o=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=l.jsx(O.Suspense,{fallback:l.jsx(q,{className:"h-16 w-full"}),children:l.jsx(Ds,{})}),t[3]=a):a=t[3];let r;return t[4]!==o?(r=l.jsxs(l.Fragment,{children:[n,o,a]}),t[4]=o,t[5]=r):r=t[5],r}function $s(t){return t.providerId==="deco"}function ii(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx(fe.Title,{children:"AI Providers"}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsx(fe,{children:l.jsx(fe.Content,{children:l.jsx(fe.Body,{children:l.jsxs(Ht,{children:[e,l.jsx($e,{fallback:Bs,children:l.jsx(O.Suspense,{fallback:l.jsx(q,{className:"h-64 w-full"}),children:l.jsx(Ks,{})})})]})})})}),t[1]=s):s=t[1],s}function Bs(t){const{error:e}=t;return l.jsx(fs,{error:e??new Error("Failed to load AI providers")})}function Us(){const t=K.c(9),{org:e}=ie();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s);let i;t[2]!==e.id?(i=X.defaultBrand(e.id),t[2]=e.id,t[3]=i):i=t[3];let o;t[4]!==n?(o=async()=>{const d=await n.callTool({name:"BRAND_CONTEXT_LIST",arguments:{}}),m=es(d);return(Array.isArray(m?.items)?m.items:[]).find(Vs)??null},t[4]=n,t[5]=o):o=t[5];let a;t[6]!==i||t[7]!==o?(a={queryKey:i,queryFn:o},t[6]=i,t[7]=o,t[8]=a):a=t[8];const{data:r}=Be(a);return r??null}function Vs(t){return t.isDefault&&!t.archivedAt}function Ws(t){const e=t.colors;if(!e)return null;if(Array.isArray(e)){const s=e.find(i=>typeof i=="object"&&i!==null&&"label"in i&&/primary|brand|main/i.test(i.label)),n=s?s.value:e[0]?.value;return typeof n=="string"?n:null}if(typeof e=="object"){const s=e;return s.primary??Object.values(s)[0]??null}return null}function qs(t){const e=K.c(31);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{title:n,description:i}=s,{org:o}=ie(),{localMode:a}=gt(),r=Us(),d=o.name;let m;e[2]!==r?(m=r?Ws(r):null,e[2]=r,e[3]=m):m=e[3];const c=m,h=r?.favicon??r?.logo??null,u=n??(d?`${d} is ready for agents`:"Your agents are almost ready"),f=i??"Choose how to power your AI team.",j=!!(h||c);let b;e[4]!==c?(b=c?{backgroundColor:`${c}18`,borderColor:`${c}30`}:void 0,e[4]=c,e[5]=b):b=e[5];const _=b,N=j?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-gradient-to-br from-lime-100 to-yellow-50 dark:from-lime-900/30 dark:to-yellow-900/20 border border-lime-300/40 dark:border-lime-700/30";let x;e[6]!==h||e[7]!==c?(x=h?l.jsx("img",{src:h,alt:"",className:"size-7 rounded object-contain"}):l.jsx(Ut,{size:24,style:c?{color:c}:void 0,className:oe(!c&&"text-lime-600 dark:text-lime-400")}),e[6]=h,e[7]=c,e[8]=x):x=e[8];let p;e[9]!==N||e[10]!==_||e[11]!==x?(p=l.jsx("div",{className:N,style:_,children:x}),e[9]=N,e[10]=_,e[11]=x,e[12]=p):p=e[12];let v;e[13]!==u?(v=l.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:u}),e[13]=u,e[14]=v):v=e[14];let w;e[15]!==f?(w=l.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:f}),e[15]=f,e[16]=w):w=e[16];let g;e[17]!==v||e[18]!==w?(g=l.jsxs("div",{className:"space-y-2",children:[v,w]}),e[17]=v,e[18]=w,e[19]=g):g=e[19];let y;e[20]!==p||e[21]!==g?(y=l.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[p,g]}),e[20]=p,e[21]=g,e[22]=y):y=e[22];let C;e[23]!==a?(C=a&&l.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Local models + use your existing AI provider"}),e[23]=a,e[24]=C):C=e[24];let E;e[25]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx(O.Suspense,{fallback:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full",children:[l.jsx(q,{className:"h-32 w-full rounded-lg"}),l.jsx(q,{className:"h-32 w-full rounded-lg"})]}),children:l.jsx(ct,{})}),e[25]=E):E=e[25];let I;e[26]!==C?(I=l.jsxs("div",{className:"w-full space-y-3",children:[C,E]}),e[26]=C,e[27]=I):I=e[27];let S;return e[28]!==I||e[29]!==y?(S=l.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-2xl px-4",children:[y,I]}),e[28]=I,e[29]=y,e[30]=S):S=e[30],S}function Ie(t){const e=t.title.includes(": ");return{provider:e?t.title.split(": ")[0]??"":t.modelId.split("/")[0]??"",displayName:e?t.title.split(": ").slice(1).join(": "):t.title}}const dt=["smarter","faster","cheaper"],mt={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},Hs=[{tier:"smarter",prefixes:["claude-code:opus","anthropic/claude-opus-4.7","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","codex:gpt-5.4","codex:gpt-5.4-mini","codex:gpt-5.3-codex","codex:gpt-5.2-codex","codex:gpt-5.1-codex-max","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["claude-code:sonnet","anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","codex:gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["claude-code:haiku","google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Qs=Hs.flatMap(({tier:t,prefixes:e})=>e.map(s=>({tier:t,prefix:s}))).sort((t,e)=>e.prefix.length-t.prefix.length),Gs=new Set(["google/gemini-2.5-pro"]),Le=new Map;function Ys(t){const e=Le.get(t);if(e!==void 0)return e;let s=null;if(t.endsWith(":free"))s="cheaper";else e:for(const{tier:n,prefix:i}of Qs)if(t.startsWith(i)){if(Gs.has(i)&&t.length>i.length&&t[i.length]==="-"){const a=t[i.length+1];if(!a||!/\d/.test(a))continue e}s=n;break}return Le.set(t,s),s}function De(t){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const s of t){const n=Ys(s.modelId);e[n??"other"].push(s)}for(const s of Object.keys(e))e[s].sort((n,i)=>n.title.localeCompare(i.title));return e}const ut="mesh:model-shortlist:",Xs=new Set(["anthropic/claude-opus-4.7","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Js(t){try{const e=localStorage.getItem(ut+t);return e?new Set(JSON.parse(e)):null}catch{return null}}function Zs(t,e){localStorage.setItem(ut+t,JSON.stringify([...e]))}function el(t){return t<32e3?{level:1,label:"Small",description:"Short conversations"}:t<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:t<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const tl=["bg-destructive","bg-warning","bg-success","bg-success"],sl=["text-success","text-warning","text-warning","text-destructive"];function ll(t){const e=Math.round(t*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(t*.75)} words`}function il(t){return t<1?{level:1,label:"Cheap"}:t<5?{level:2,label:"Moderate"}:t<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const nl={text:{icon:l.jsx(Lt,{className:"size-3.5"}),label:"Text"},vision:{icon:l.jsx(Ft,{className:"size-3.5"}),label:"Vision"},image:{icon:l.jsx(Dt,{className:"size-3.5"}),label:"Image"},tools:{icon:l.jsx(zt,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:l.jsx(Pt,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:l.jsx(Xe,{className:"size-3.5"}),label:"Web search"}};function ol(t){const e=K.c(5),{capability:s}=t;let n;e[0]!==s?(n=nl[s]??{icon:null,label:s.charAt(0).toUpperCase()+s.slice(1)},e[0]=s,e[1]=n):n=e[1];const i=n;let o;return e[2]!==i.icon||e[3]!==i.label?(o=l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[i.icon,i.label]}),e[2]=i.icon,e[3]=i.label,e[4]=o):o=e[4],o}function rl(t){const e=K.c(49),{model:s,compact:n}=t,i=n===void 0?!1:n;if(!s){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const o=s.costs?.input!=null?s.costs.input*1e6:null,a=s.costs?.output!=null?s.costs.output*1e6:null;let r;e[1]!==s?(r=Ie(s),e[1]=s,e[2]=r):r=e[2];const{provider:d,displayName:m}=r;if(i){let g;e[3]!==s.limits?(g=s.limits?.contextWindow&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Context"}),l.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]}),e[3]=s.limits,e[4]=g):g=e[4];let y;e[5]!==o?(y=o!=null&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Input"}),l.jsxs("span",{className:"text-foreground font-medium",children:["$",o.toFixed(2)," / 1M"]})]}),e[5]=o,e[6]=y):y=e[6];let C;e[7]!==a?(C=a!=null&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Output"}),l.jsxs("span",{className:"text-foreground font-medium",children:["$",a.toFixed(2)," / 1M"]})]}),e[7]=a,e[8]=C):C=e[8];let E;e[9]!==s.limits?(E=s.limits?.maxOutputTokens&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),l.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[9]=s.limits,e[10]=E):E=e[10];let I;return e[11]!==g||e[12]!==y||e[13]!==C||e[14]!==E?(I=l.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,y,C,E]}),e[11]=g,e[12]=y,e[13]=C,e[14]=E,e[15]=I):I=e[15],I}let c;e[16]!==d?(c=l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[16]=d,e[17]=c):c=e[17];let h;e[18]!==s.logo||e[19]!==s.title?(h=s.logo&&l.jsx("img",{src:s.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[18]=s.logo,e[19]=s.title,e[20]=h):h=e[20];let u;e[21]!==m?(u=l.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:m}),e[21]=m,e[22]=u):u=e[22];let f;e[23]!==h||e[24]!==u?(f=l.jsxs("div",{className:"flex items-center gap-2.5",children:[h,u]}),e[23]=h,e[24]=u,e[25]=f):f=e[25];let j;e[26]!==s.modelId?(j=l.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:s.modelId}),e[26]=s.modelId,e[27]=j):j=e[27];let b;e[28]!==c||e[29]!==f||e[30]!==j?(b=l.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[c,f,j]}),e[28]=c,e[29]=f,e[30]=j,e[31]=b):b=e[31];let _;e[32]!==s.capabilities?(_=s.capabilities&&s.capabilities.length>0&&l.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(s.capabilities)].map(al)}),e[32]=s.capabilities,e[33]=_):_=e[33];let N;e[34]!==s.limits?(N=s.limits?.contextWindow&&(()=>{const{level:g,label:y,description:C}=el(s.limits.contextWindow);return l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(E=>l.jsx("div",{className:oe("w-2 h-2 rounded-full",E<=g?tl[g-1]:"bg-muted")},E))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:y}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",C]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[34]=s.limits,e[35]=N):N=e[35];let x;e[36]!==s.limits?(x=s.limits?.maxOutputTokens&&l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsxs("span",{className:"text-sm text-foreground",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]}),l.jsx("span",{className:"text-sm text-muted-foreground",children:ll(s.limits.maxOutputTokens)})]})]}),e[36]=s.limits,e[37]=x):x=e[37];let p;e[38]!==o||e[39]!==a?(p=(o!=null||a!=null)&&(()=>{const{level:g,label:y}=o!=null?il(o):{level:0,label:""};return l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),o!=null&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(C=>l.jsx("span",{className:oe("text-sm font-bold leading-none",C<=g?sl[g-1]:"text-muted-foreground/20"),children:"$"},C))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:y})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[o!=null&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),l.jsxs("span",{className:"text-xs text-foreground",children:["$",o.toFixed(2)," / 1M tokens"]})]}),a!=null&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),l.jsxs("span",{className:"text-xs text-foreground",children:["$",a.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[38]=o,e[39]=a,e[40]=p):p=e[40];let v;e[41]!==N||e[42]!==x||e[43]!==p?(v=l.jsxs("div",{className:"flex flex-col gap-6",children:[N,x,p]}),e[41]=N,e[42]=x,e[43]=p,e[44]=v):v=e[44];let w;return e[45]!==v||e[46]!==b||e[47]!==_?(w=l.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[b,_,v]}),e[45]=v,e[46]=b,e[47]=_,e[48]=w):w=e[48],w}function al(t){return l.jsx(ol,{capability:t},t)}function cl(t){const e=K.c(21),{model:s,onHover:n}=t;let i;e[0]!==s?(i=Ie(s),e[0]=s,e[1]=i):i=e[1];const{displayName:o,provider:a}=i;let r;e[2]!==s?(r=Ce(s),e[2]=s,e[3]=r):r=e[3];const d=r;let m;e[4]!==s||e[5]!==n?(m=()=>n(s),e[4]=s,e[5]=n,e[6]=m):m=e[6];let c;e[7]!==s.title||e[8]!==d?(c=l.jsx("img",{src:d,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[7]=s.title,e[8]=d,e[9]=c):c=e[9];let h;e[10]!==o?(h=l.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=h):h=e[11];let u;e[12]!==a?(u=l.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:a}),e[12]=a,e[13]=u):u=e[13];let f;e[14]!==h||e[15]!==u?(f=l.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[h,u]}),e[14]=h,e[15]=u,e[16]=f):f=e[16];let j;return e[17]!==m||e[18]!==c||e[19]!==f?(j=l.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:m,children:[c,f]}),e[17]=m,e[18]=c,e[19]=f,e[20]=j):j=e[20],j}function dl(t){const e=K.c(10),{error:s,onRetry:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:l.jsx(vt,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const a=s?.message||"Could not fetch models from this provider.";let r;e[2]!==a?(r=l.jsxs("div",{className:"flex flex-col gap-1",children:[o,l.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[a," Try another provider or retry."]})]}),e[2]=a,e[3]=r):r=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=l.jsx(Kt,{className:"size-3.5"}),e[4]=d):d=e[4];let m;e[5]!==n?(m=l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs(te,{variant:"outline",size:"sm",onClick:n,className:"gap-1.5",children:[d,"Retry"]})}),e[5]=n,e[6]=m):m=e[6];let c;return e[7]!==r||e[8]!==m?(c=l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[i,r,m]}),e[7]=r,e[8]=m,e[9]=c):c=e[9],c}function ml(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(ul)}),t[0]=e):e=t[0],e}function ul(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(q,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(q,{className:"flex-1 h-4"}),l.jsx(q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function Ke(t){const e=K.c(12),{label:s,models:n,onSelect:i,onHover:o}=t;if(n.length===0)return null;let a;e[0]!==s?(a=l.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:s}),e[0]=s,e[1]=a):a=e[1];let r;if(e[2]!==n||e[3]!==o||e[4]!==i){let m;e[6]!==o||e[7]!==i?(m=c=>l.jsx("div",{onClick:()=>i(c),className:"cursor-pointer",children:l.jsx(cl,{model:c,onHover:o})},c.modelId),e[6]=o,e[7]=i,e[8]=m):m=e[8],r=n.map(m),e[2]=n,e[3]=o,e[4]=i,e[5]=r}else r=e[5];let d;return e[9]!==a||e[10]!==r?(d=l.jsxs("div",{children:[a,r]}),e[9]=a,e[10]=r,e[11]=d):d=e[11],d}function hl(t){const e=K.c(21),{model:s,isChecked:n,onToggle:i,onHover:o}=t,[a,r]=O.useState(n);a!==n&&r(n);let d;e[0]!==s?(d=Ce(s),e[0]=s,e[1]=d):d=e[1];const m=d;let c;e[2]!==s||e[3]!==o?(c=()=>o(s),e[2]=s,e[3]=o,e[4]=c):c=e[4];let h;e[5]!==s.modelId||e[6]!==i?(h=()=>{r(fl),i(s.modelId)},e[5]=s.modelId,e[6]=i,e[7]=h):h=e[7];let u;e[8]!==a||e[9]!==h?(u=l.jsx(yt,{checked:a,onCheckedChange:h}),e[8]=a,e[9]=h,e[10]=u):u=e[10];let f;e[11]!==m||e[12]!==s.title?(f=l.jsx("img",{src:m,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[11]=m,e[12]=s.title,e[13]=f):f=e[13];let j;e[14]!==s.title?(j=l.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:s.title}),e[14]=s.title,e[15]=j):j=e[15];let b;return e[16]!==c||e[17]!==u||e[18]!==f||e[19]!==j?(b=l.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:c,children:[u,f,j]}),e[16]=c,e[17]=u,e[18]=f,e[19]=j,e[20]=b):b=e[20],b}function fl(t){return!t}function xl(t){const e=[];for(const s of dt)if(t[s].length>0){e.push({type:"header",label:mt[s]});for(const n of t[s])e.push({type:"model",model:n})}if(t.other.length>0){e.push({type:"header",label:"Other"});for(const s of t.other)e.push({type:"model",model:s})}return e}function pl({items:t,shortlistSet:e,onToggle:s,onHover:n}){const i=O.useRef(null),o=us({count:t.length,getScrollElement:()=>i.current,estimateSize:a=>t[a]?.type==="header"?36:44,overscan:6});return l.jsx("div",{ref:i,className:"flex-1 overflow-y-auto",children:l.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(a=>{const r=t[a.index];return r?l.jsx("div",{"data-index":a.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${a.start}px)`},children:r.type==="header"?l.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:r.label}):l.jsx(hl,{model:r.model,isChecked:e.has(r.model.modelId),onToggle:s,onHover:n})},a.key):null})})})}function gl(t){const e=K.c(23),{keyId:s,searchTerm:n,onHover:i,onModelSelect:o,managing:a,onToggleManage:r,filterModels:d}=t,{models:m}=he(s),c=d?m.filter(d):m;let h;e[0]!==s?(h=()=>(s?Js(s):null)??Xs,e[0]=s,e[1]=h):h=e[1];const[u,f]=O.useState(h),[,j]=O.useTransition();let b;e[2]!==s||e[3]!==j?(b=I=>{s&&j(()=>{f(S=>{const k=new Set(S);return k.has(I)?k.delete(I):k.add(I),Zs(s,k),k})})},e[2]=s,e[3]=j,e[4]=b):b=e[4];const _=b,N=n.toLowerCase().trim(),x=I=>N?I.filter(S=>S.title.toLowerCase().includes(N)||S.modelId.toLowerCase().includes(N)):I;if(a){const I=De(x(c)),S=xl(I);let k;e[5]!==u?(k=R=>u.has(R.modelId),e[5]=u,e[6]=k):k=e[6];const T=c.filter(k).length;let M;e[7]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsx($t,{size:14}),e[7]=M):M=e[7];let A;return e[8]!==r?(A=l.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[M,"Back"]}),e[8]=r,e[9]=A):A=e[9],l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[A,l.jsxs("span",{className:"text-xs text-muted-foreground",children:[T," selected"]})]}),l.jsx(pl,{items:S,shortlistSet:u,onToggle:_,onHover:i})]})}let p;e[10]!==u?(p=I=>u.has(I.modelId),e[10]=u,e[11]=p):p=e[11];const v=c.filter(p),w=v.length>0?v:c,g=De(x(w));let y;e[12]!==g||e[13]!==i||e[14]!==o?(y=dt.map(I=>l.jsx(Ke,{label:mt[I],models:g[I],onSelect:o,onHover:i},I)),e[12]=g,e[13]=i,e[14]=o,e[15]=y):y=e[15];let C;e[16]!==g.other||e[17]!==i||e[18]!==o?(C=l.jsx(Ke,{label:"Other",models:g.other,onSelect:o,onHover:i}),e[16]=g.other,e[17]=i,e[18]=o,e[19]=C):C=e[19];let E;return e[20]!==y||e[21]!==C?(E=l.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[y,C]}),e[20]=y,e[21]=C,e[22]=E):E=e[22],E}function ht(t){const e=K.c(19),{model:s,placeholder:n,isLoading:i}=t,o=n===void 0?"Select model":n;if(i===void 0?!1:i){let b;return e[0]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(q,{className:"w-5 h-5 rounded-sm shrink-0"}),l.jsx(q,{className:"w-16 h-3 hidden md:block"})]}),e[0]=b):b=e[0],b}if(!s){let b;e[1]!==o?(b=l.jsx("span",{className:"text-sm text-muted-foreground",children:o}),e[1]=o,e[2]=b):b=e[2];let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=l.jsx(Ee,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[3]=_):_=e[3];let N;return e[4]!==b?(N=l.jsxs("div",{className:"flex items-center gap-1.5",children:[b,_]}),e[4]=b,e[5]=N):N=e[5],N}let r;e[6]!==s?(r=Ie(s),e[6]=s,e[7]=r):r=e[7];const{displayName:d}=r;let m;e[8]!==s?(m=Ce(s),e[8]=s,e[9]=m):m=e[9];const c=m;let h;e[10]!==s.title||e[11]!==c?(h=l.jsx("img",{src:c,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[10]=s.title,e[11]=c,e[12]=h):h=e[12];let u;e[13]!==d?(u=l.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:d}),e[13]=d,e[14]=u):u=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(Ee,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[15]=f):f=e[15];let j;return e[16]!==h||e[17]!==u?(j=l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[h,u,f]}),e[16]=h,e[17]=u,e[18]=j):j=e[18],j}const bl=["vision","image","file","audio","video"],ft=["image/png","image/jpeg","image/gif","image/webp"];function ni(t){const e=t?.capabilities;return e?bl.some(s=>e.includes(s)):!1}function oi(t,e){if(!t)return!1;if(t.startsWith("text/"))return!0;const s=e?.capabilities??[],n=s.includes("vision")||s.includes("image"),i=s.includes("file"),o=s.includes("audio"),a=s.includes("video");return!!(n&&ft.includes(t)||i&&t==="application/pdf"||o&&t.startsWith("audio/")||a&&t.startsWith("video/"))}function ri(t){const e=t?.capabilities??[],s=["text/*"];return(e.includes("vision")||e.includes("image"))&&s.push(...ft),e.includes("file")&&s.push("application/pdf"),e.includes("audio")&&s.push("audio/*"),e.includes("video")&&s.push("video/*"),s.join(",")}function ai(t){const e=t?.capabilities??[],s=[];return(e.includes("vision")||e.includes("image"))&&s.push("images"),e.includes("file")&&s.push("PDFs"),e.includes("audio")&&s.push("audio"),e.includes("video")&&s.push("video"),s.length===0?"text only":s.length===1?s[0]:s.length===2?`${s[0]} and ${s[1]}`:`${s.slice(0,-1).join(", ")}, and ${s.at(-1)}`}function vl(){const t=K.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:l.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[l.jsx(q,{className:"size-4 shrink-0"}),l.jsx(q,{className:"flex-1 h-6"}),l.jsx(q,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,l.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(yl)})]}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx(q,{className:"size-6 shrink-0"}),l.jsx(q,{className:"h-6 w-32"})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[n,l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(q,{className:"h-6 w-20 rounded-md"}),l.jsx(q,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=i):i=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(q,{className:"h-4 w-24"}),l.jsx(q,{className:"h-4 w-32"})]}),t[4]=o):o=t[4];let a;return t[5]===Symbol.for("react.memo_cache_sentinel")?(a=l.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[s,l.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:l.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[i,l.jsxs("div",{className:"flex flex-col gap-4",children:[o,l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(q,{className:"h-4 w-16"}),l.jsx(q,{className:"h-4 w-40"})]})]})]})})]}),t[5]=a):a=t[5],a}function yl(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(q,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(q,{className:"flex-1 h-4"}),l.jsx(q,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function xt(t){const e=K.c(43),{onClose:s,credentialId:n,onCredentialChange:i,selectedModel:o,onModelChange:a,filterModels:r}=t,[d,m]=O.useState(null),[c,h]=O.useState(""),[u,f]=O.useState(!1),j=O.useRef(null),b=Je(),_=ae(),N=Object.fromEntries((b?.providers??[]).map(Nl)),x=bt(),{org:p}=ie();let v;e[0]!==i?(v=F=>{i(F),m(null)},e[0]=i,e[1]=v):v=e[1];const w=v;let g;e[2]!==n||e[3]!==s||e[4]!==a?(g=F=>{n&&(a(F),h(""),s())},e[2]=n,e[3]=s,e[4]=a,e[5]=g):g=e[5];const y=g;if(_.length===0){let F;return e[6]===Symbol.for("react.memo_cache_sentinel")?(F=l.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:l.jsx(qs,{})}),e[6]=F):F=e[6],F}const C="flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",E="flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",I="border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",S="flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text";let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx(Xe,{size:16,className:"text-muted-foreground shrink-0"}),e[7]=k):k=e[7];const T=u?"Search all models...":"Search for a model...";let M;e[8]===Symbol.for("react.memo_cache_sentinel")?(M=F=>h(F.target.value),e[8]=M):M=e[8];let A;e[9]!==c||e[10]!==T?(A=l.jsx(ne,{ref:j,type:"text",placeholder:T,value:c,onChange:M,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[9]=c,e[10]=T,e[11]=A):A=e[11];const R=_.length>0&&l.jsxs(Et,{value:n??"",onValueChange:w,children:[l.jsxs(Mt,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Sl,children:[l.jsx(At,{placeholder:"Key",children:(()=>{const F=_.find(be=>be.id===n),J=F?N[F.providerId]:void 0;return l.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[J?.logo?l.jsx("img",{src:J.logo,alt:J.name,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):l.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:(J?.name??F?.providerId??"?").slice(0,1).toUpperCase()}),l.jsx("span",{className:"text-xs truncate",children:J?.name??F?.providerId??"Key"})]})})()}),l.jsx(Rt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),l.jsx(Ot,{children:_.map(F=>{const J=N[F.providerId];return l.jsx(Tt,{value:F.id,children:l.jsxs("div",{className:"flex items-center gap-2",children:[J?.logo?l.jsx("img",{src:J.logo,alt:J.name,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):l.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:(J?.name??F.providerId).slice(0,1).toUpperCase()}),l.jsxs("span",{children:[J?.name??F.providerId," — ",F.label]})]})},F.id)})})]});let P;e[12]!==A||e[13]!==R||e[14]!==k?(P=l.jsx("div",{className:I,children:l.jsxs("label",{className:S,children:[k,A,R]})}),e[12]=A,e[13]=R,e[14]=k,e[15]=P):P=e[15];let L;e[16]!==n?(L=F=>{const{error:J,resetError:be}=F;return l.jsx(dl,{error:J,onRetry:be,credentialId:n??void 0})},e[16]=n,e[17]=L):L=e[17];let Q;e[18]===Symbol.for("react.memo_cache_sentinel")?(Q=l.jsx(ml,{}),e[18]=Q):Q=e[18];const U=n??void 0;let $;e[19]===Symbol.for("react.memo_cache_sentinel")?($=()=>f(jl),e[19]=$):$=e[19];let D;e[20]!==r||e[21]!==y||e[22]!==u||e[23]!==c||e[24]!==U?(D=l.jsx(O.Suspense,{fallback:Q,children:l.jsx(gl,{keyId:U,searchTerm:c,onHover:m,onModelSelect:y,managing:u,onToggleManage:$,filterModels:r})}),e[20]=r,e[21]=y,e[22]=u,e[23]=c,e[24]=U,e[25]=D):D=e[25];let V;e[26]!==n||e[27]!==L||e[28]!==D?(V=l.jsx($e,{fallback:L,children:D},n),e[26]=n,e[27]=L,e[28]=D,e[29]=V):V=e[29];let B;e[30]!==u||e[31]!==x||e[32]!==p?(B=!u&&l.jsxs("div",{className:"border-t border-border flex",children:[l.jsxs("button",{type:"button",onClick:()=>O.startTransition(()=>f(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[l.jsx(Bt,{className:"size-3.5 shrink-0"}),"Manage models"]}),l.jsx("div",{className:"w-px bg-border shrink-0"}),l.jsxs("button",{type:"button",onClick:()=>x({to:"/$org/settings/ai-providers",params:{org:p.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[l.jsx(Ye,{className:"size-3.5 shrink-0"}),"Manage API keys"]})]}),e[30]=u,e[31]=x,e[32]=p,e[33]=B):B=e[33];let W;e[34]!==P||e[35]!==V||e[36]!==B?(W=l.jsxs("div",{className:E,children:[P,V,B]}),e[34]=P,e[35]=V,e[36]=B,e[37]=W):W=e[37];const G=d??o??null;let H;e[38]!==G?(H=l.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:l.jsx(rl,{model:G})}),e[38]=G,e[39]=H):H=e[39];let ee;return e[40]!==W||e[41]!==H?(ee=l.jsxs("div",{className:C,children:[W,H]}),e[40]=W,e[41]=H,e[42]=ee):ee=e[42],ee}function jl(t){return!t}function Sl(t){return t.stopPropagation()}function Nl(t){return[t.id,t]}function _l(t){const e=K.c(12),{onClose:s}=t,{credentialId:n,setCredentialId:i,selectedModel:o,setModel:a}=Ze();let r;e[0]!==i?(r=c=>{Z("chat_credential_changed",{credential_id:c}),i(c)},e[0]=i,e[1]=r):r=e[1];let d;e[2]!==n||e[3]!==o?.modelId||e[4]!==a?(d=c=>{n&&(Z("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:c.modelId,to_model_provider:c.providerId??null,credential_id:n}),a({...c,keyId:n}))},e[2]=n,e[3]=o?.modelId,e[4]=a,e[5]=d):d=e[5];let m;return e[6]!==n||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==d?(m=l.jsx(xt,{onClose:s,credentialId:n,onCredentialChange:r,selectedModel:o,onModelChange:d}),e[6]=n,e[7]=s,e[8]=o,e[9]=r,e[10]=d,e[11]=m):m=e[11],m}function wl(t){const e=K.c(38),{variant:s,className:n,placeholder:i,model:o,isLoading:a,credentialId:r,onCredentialChange:d,onModelChange:m,filterModels:c}=t,h=s===void 0?"borderless":s,u=i===void 0?"Select model":i,[f,j]=O.useState(!1),b=m!==void 0,_=kt(),N=h==="borderless"?"ghost":"outline",x=h==="borderless"&&"md:border-none";let p;e[0]!==n||e[1]!==x?(p=oe("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",x,n),e[0]=n,e[1]=x,e[2]=p):p=e[2];let v;e[3]!==a||e[4]!==o||e[5]!==u||e[6]!==b?(v=b?l.jsx(ht,{model:o??null,placeholder:u,isLoading:a}):l.jsx(Il,{placeholder:u}),e[3]=a,e[4]=o,e[5]=u,e[6]=b,e[7]=v):v=e[7];let w;e[8]!==N||e[9]!==p||e[10]!==v?(w=l.jsx(te,{variant:N,size:"sm",className:p,children:v}),e[8]=N,e[9]=p,e[10]=v,e[11]=w):w=e[11];const g=w;let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=l.jsx(vl,{}),e[12]=y):y=e[12];let C;e[13]!==r||e[14]!==c||e[15]!==o||e[16]!==d||e[17]!==m||e[18]!==b?(C=l.jsx(O.Suspense,{fallback:y,children:b?l.jsx(xt,{onClose:()=>j(!1),credentialId:r??null,onCredentialChange:d??Cl,selectedModel:o??null,onModelChange:m,filterModels:c}):l.jsx(_l,{onClose:()=>j(!1)})}),e[13]=r,e[14]=c,e[15]=o,e[16]=d,e[17]=m,e[18]=b,e[19]=C):C=e[19];const E=C;if(_){let M;e[20]!==g?(M=l.jsx(_t,{asChild:!0,children:g}),e[20]=g,e[21]=M):M=e[21];let A;e[22]===Symbol.for("react.memo_cache_sentinel")?(A=l.jsx(wt,{className:"sr-only",children:"Select model"}),e[22]=A):A=e[22];let R;e[23]!==E?(R=l.jsxs(Ct,{className:"p-0 flex flex-col max-h-[95vh]",children:[A,l.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:E})]}),e[23]=E,e[24]=R):R=e[24];let P;return e[25]!==f||e[26]!==M||e[27]!==R?(P=l.jsxs(It,{open:f,onOpenChange:j,children:[M,R]}),e[25]=f,e[26]=M,e[27]=R,e[28]=P):P=e[28],P}let I;e[29]!==g?(I=l.jsx(Nt,{asChild:!0,children:g}),e[29]=g,e[30]=I):I=e[30];let S;e[31]===Symbol.for("react.memo_cache_sentinel")?(S=l.jsx(qe,{className:"sr-only",children:"Select model"}),e[31]=S):S=e[31];let k;e[32]!==E?(k=l.jsxs(We,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[S,E]}),e[32]=E,e[33]=k):k=e[33];let T;return e[34]!==f||e[35]!==I||e[36]!==k?(T=l.jsxs(Ve,{open:f,onOpenChange:j,children:[I,k]}),e[34]=f,e[35]=I,e[36]=k,e[37]=T):T=e[37],T}function Cl(){}function Il(t){const e=K.c(4),{placeholder:s}=t,{selectedModel:n,isModelsLoading:i}=Ze();let o;return e[0]!==i||e[1]!==n||e[2]!==s?(o=l.jsx(ht,{model:n,placeholder:s,isLoading:i}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3],o}export{wl as M,qs as N,ii as O,ai as a,ri as g,oi as i,ni as m};