@decocms/mesh 2.87.0 → 2.88.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 (153) hide show
  1. package/dist/client/assets/{AlertCircle-CMI4YiF8.js → AlertCircle-fs-iLCxQ.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-BGF96GWN.js → AlertOctagon-DJgNSLd2.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-F0qy4hoF.js → ArrowLeft-BOU-qvMz.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-Cr88yR39.js → ArrowUp-D5TY17yS.js} +1 -1
  5. package/dist/client/assets/{Calendar-DedByLtP.js → Calendar-Dj0hLzDt.js} +1 -1
  6. package/dist/client/assets/{Check-BVqX6VG5.js → Check-woCJI4Zk.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-ByeMMv-P.js → CheckCircle-Cd6AhXPT.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-CPH_fc9F.js → CheckDone01-CaHocOrI.js} +1 -1
  9. package/dist/client/assets/{ChevronDown-C753dD5M.js → ChevronDown--AD2MLIh.js} +1 -1
  10. package/dist/client/assets/{ChevronRight-sGXl7Bvf.js → ChevronRight-DhFCl7fQ.js} +1 -1
  11. package/dist/client/assets/{Code01-Cz0GM-Ln.js → Code01-DOUE7D86.js} +1 -1
  12. package/dist/client/assets/{Copy01-Bl99tdzP.js → Copy01-DhF1Yrkw.js} +1 -1
  13. package/dist/client/assets/{DotsHorizontal-CWs48tCN.js → DotsHorizontal-DfjT6Blw.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-CWQ3-YKt.js → DotsVertical-BipTn3CF.js} +1 -1
  15. package/dist/client/assets/{Download01-CiBv1aKv.js → Download01-C3-05zuB.js} +1 -1
  16. package/dist/client/assets/{Edit01-DkLw19ks.js → Edit01-DwOJTHYN.js} +1 -1
  17. package/dist/client/assets/{Eye-BiLrFCnc.js → Eye-CJ6PCpWV.js} +1 -1
  18. package/dist/client/assets/{File02-DvBeqAHS.js → File02-COltyyOK.js} +1 -1
  19. package/dist/client/assets/{File06-qYvBtC4a.js → File06-BaXucUWw.js} +1 -1
  20. package/dist/client/assets/{FilterLines-BWCVYnM7.js → FilterLines-D-B6xOx4.js} +1 -1
  21. package/dist/client/assets/{Globe02-Dh-HvcG9.js → Globe02-DvCJ3vRE.js} +1 -1
  22. package/dist/client/assets/{Grid01-BQKiQdYB.js → Grid01-BvWVxRRn.js} +1 -1
  23. package/dist/client/assets/{Home02-DUBJ2iBn.js → Home02-Y_J2Mjhf.js} +1 -1
  24. package/dist/client/assets/{Image01-BuH4rRqA.js → Image01-CD-baYxu.js} +1 -1
  25. package/dist/client/assets/{Inbox01-D63wnQw5.js → Inbox01-nefVdQqD.js} +1 -1
  26. package/dist/client/assets/{InfoCircle-DvVvj0EU.js → InfoCircle-fmFznxid.js} +1 -1
  27. package/dist/client/assets/{LinkExternal01-qLFklxmU.js → LinkExternal01-CTFxzrDd.js} +1 -1
  28. package/dist/client/assets/{List-DbyYoAK0.js → List-D28XJ4eE.js} +1 -1
  29. package/dist/client/assets/{Loading01-DislDZSB.js → Loading01-CVxzxkEA.js} +1 -1
  30. package/dist/client/assets/{Lock01-kQXkJGwl.js → Lock01-B6R6M8mS.js} +1 -1
  31. package/dist/client/assets/{Pin01-CWqaADuz.js → Pin01-B7AGhCqq.js} +1 -1
  32. package/dist/client/assets/{Play-whHXhfHd.js → Play-BLNkF9lh.js} +1 -1
  33. package/dist/client/assets/{Plus-B4n0HRX4.js → Plus-oe5n7shW.js} +1 -1
  34. package/dist/client/assets/{RefreshCcw01-CDxZBXaR.js → RefreshCcw01-DQu-afd1.js} +1 -1
  35. package/dist/client/assets/{SearchMd-BkDBIRnQ.js → SearchMd-Ctirl108.js} +1 -1
  36. package/dist/client/assets/{Settings01-CUwZ36an.js → Settings01-DfshLY3d.js} +1 -1
  37. package/dist/client/assets/{Settings02-C3-5vMxP.js → Settings02-DwBbKcxc.js} +1 -1
  38. package/dist/client/assets/{Share07-DKYwpJPj.js → Share07-DuMFfxOm.js} +1 -1
  39. package/dist/client/assets/{Terminal-rAB0v_E_.js → Terminal-DjfPKa_L.js} +1 -1
  40. package/dist/client/assets/{Tool01-CFguOYlQ.js → Tool01-BnAwUrAq.js} +1 -1
  41. package/dist/client/assets/{Trash01-By04ijdF.js → Trash01-h3f3UFq5.js} +1 -1
  42. package/dist/client/assets/{Upload01-fJcjR0fH.js → Upload01-EBRxETCK.js} +1 -1
  43. package/dist/client/assets/{Users03-DItk6Nms.js → Users03-DUHQ5891.js} +1 -1
  44. package/dist/client/assets/{X-r5buNXf-.js → X-DbHlFzca.js} +1 -1
  45. package/dist/client/assets/{XClose-pySsKDwU.js → XClose-BpJNyKul.js} +1 -1
  46. package/dist/client/assets/{agent-connections-preview-BKCm87yT.js → agent-connections-preview-CyKXZFzV.js} +1 -1
  47. package/dist/client/assets/{agent-detail-CZkw7Ahi.js → agent-detail-YeB6Qz8Q.js} +1 -1
  48. package/dist/client/assets/{agents-BuaAs0iL.js → agents-COk0IQw8.js} +1 -1
  49. package/dist/client/assets/{alert-dialog-D0wLSh9n.js → alert-dialog-DlRleLL5.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-CkUsUOEC.js → auth-catchall-BlLxxa2S.js} +1 -1
  51. package/dist/client/assets/{avatar-DZVTlnSA.js → avatar-CB2Y6aAq.js} +1 -1
  52. package/dist/client/assets/{badge-BfrnxbIP.js → badge-DnrGjfKN.js} +1 -1
  53. package/dist/client/assets/{binder-B99OawxF.js → binder-DWar94Dz.js} +1 -1
  54. package/dist/client/assets/{breadcrumb-2c6yAn4J.js → breadcrumb-C8TKHD4-.js} +1 -1
  55. package/dist/client/assets/{button-CsJ-BTyU.js → button-ds0Xf2u_.js} +1 -1
  56. package/dist/client/assets/{card-CzebRix7.js → card-3Oz-suJe.js} +1 -1
  57. package/dist/client/assets/{checkbox-FhfzoNwb.js → checkbox-oLUg1qlK.js} +1 -1
  58. package/dist/client/assets/{circle-alert-4rPD_PO-.js → circle-alert-D0sAKh3z.js} +1 -1
  59. package/dist/client/assets/{collection-detail-BrenkDdG.js → collection-detail-CP10nfYn.js} +1 -1
  60. package/dist/client/assets/{collection-search-Yrefv2Yh.js → collection-search-kC3At3KN.js} +1 -1
  61. package/dist/client/assets/{collection-tab-Dhc32y8D.js → collection-tab-BooFRSp_.js} +1 -1
  62. package/dist/client/assets/{collection-table-wrapper-D9zZsdiL.js → collection-table-wrapper-DpXz70UJ.js} +1 -1
  63. package/dist/client/assets/{collection-tabs-Q-Uo1s-L.js → collection-tabs-BIrTpgBA.js} +1 -1
  64. package/dist/client/assets/{command-DAtVXyWP.js → command-Dfzr1VvH.js} +1 -1
  65. package/dist/client/assets/{connect-CYIDebRt.js → connect-CulBzmXv.js} +1 -1
  66. package/dist/client/assets/{connection-card-D4lpnLQO.js → connection-card-DW2fxGub.js} +1 -1
  67. package/dist/client/assets/{connection-detail-ClB2aBZr.js → connection-detail-ChWoyIs3.js} +1 -1
  68. package/dist/client/assets/{connections-BfatqPWY.js → connections-tw0HMqWX.js} +1 -1
  69. package/dist/client/assets/constants-DOhkek36.js +1 -0
  70. package/dist/client/assets/{constants-CucT8Y-Y.js → constants-pTCFS1GU.js} +1 -1
  71. package/dist/client/assets/{create-organization-dialog-DwKaHJep.js → create-organization-dialog-DKpRSfJS.js} +1 -1
  72. package/dist/client/assets/{create-project-dialog-C2-PEMvv.js → create-project-dialog-YGz5z2Zi.js} +1 -1
  73. package/dist/client/assets/{dialog-3EB-J4B_.js → dialog-1X4BWtmD.js} +1 -1
  74. package/dist/client/assets/{dropdown-menu-Bshnl7f0.js → dropdown-menu-Ckg1hXqa.js} +1 -1
  75. package/dist/client/assets/{dynamic-plugin-layout-Drg1aSlq.js → dynamic-plugin-layout-CW9-eyML.js} +1 -1
  76. package/dist/client/assets/{empty-state-Bi-BkSth.js → empty-state-CJnfgDRv.js} +1 -1
  77. package/dist/client/assets/{empty-state-1NB9yQ1t.js → empty-state-DFcUAeKs.js} +1 -1
  78. package/dist/client/assets/{env-vars-editor-CbswziBn.js → env-vars-editor-BqFQwm2Y.js} +1 -1
  79. package/dist/client/assets/{error-boundary-CaGh18_R.js → error-boundary-D1nW3qw3.js} +1 -1
  80. package/dist/client/assets/{extract-connection-data-kKvsSLaN.js → extract-connection-data-sEk__aUJ.js} +1 -1
  81. package/dist/client/assets/{file-browser-BzKEwz78.js → file-browser-Av512maH.js} +2 -2
  82. package/dist/client/assets/{form-BlwP3Tk9.js → form-CCnPwGY1.js} +1 -1
  83. package/dist/client/assets/{grid-view-gsYISlPb.js → grid-view-B0N-4HGw.js} +1 -1
  84. package/dist/client/assets/{home-DWWCnfpS.js → home-BwtjBpiC.js} +1 -1
  85. package/dist/client/assets/{index-DwiHvE3c.js → index-9ENdh9Ws.js} +1 -1
  86. package/dist/client/assets/{index-CA62CANi.js → index-B-34EG7J.js} +1 -1
  87. package/dist/client/assets/{index-BF7Y1e9M.js → index-BnM6zXPK.js} +2 -2
  88. package/dist/client/assets/{index-CNTzRs2a.js → index-BzK60eGa.js} +1 -1
  89. package/dist/client/assets/{index-DLNbywI1.js → index-CKSdcgOB.js} +1 -1
  90. package/dist/client/assets/{index-DwztszwS.js → index-DUuy3gyR.js} +1 -1
  91. package/dist/client/assets/{index-CgOYGmVd.js → index-NZL2styZ.js} +1 -1
  92. package/dist/client/assets/{index-DW5LacML.js → index-lkQ_SnE8.js} +2 -2
  93. package/dist/client/assets/{index-DIQUoNYB.js → index-rA5KrK2V.js} +1 -1
  94. package/dist/client/assets/{infiniteQueryObserver-AHDpBxLi.js → infiniteQueryObserver-DwX9yony.js} +1 -1
  95. package/dist/client/assets/{input-Barosnhy.js → input-CoSRI0XN.js} +1 -1
  96. package/dist/client/assets/{integration-icon-DL_7q6rJ.js → integration-icon-GQvaX0z4.js} +1 -1
  97. package/dist/client/assets/{label-CsZ9MmGa.js → label-By7PTlud.js} +1 -1
  98. package/dist/client/assets/{layout-B0BvAjMd.js → layout-DkBop8to.js} +1 -1
  99. package/dist/client/assets/{localstorage-keys-amV_-5pn.js → localstorage-keys-DEZN3FMx.js} +1 -1
  100. package/dist/client/assets/{login-SfQqXsDc.js → login-D3VfENey.js} +1 -1
  101. package/dist/client/assets/{mcp-oauth-BX6v5RXg.js → mcp-oauth-DCI4iUAK.js} +1 -1
  102. package/dist/client/assets/{mcp-server-card-CFw7RlTN.js → mcp-server-card-Bs0aHzvK.js} +1 -1
  103. package/dist/client/assets/{mcp-server-detail-FV0O-BTM.js → mcp-server-detail-C5w_HTBr.js} +2 -2
  104. package/dist/client/assets/{members-SrNL520t.js → members-aNc0Gi8j.js} +1 -1
  105. package/dist/client/assets/{monaco-editor-HT_HkhlE.js → monaco-editor-lPTVHX05.js} +1 -1
  106. package/dist/client/assets/{monitoring-YxclJtDc.js → monitoring-Cm_Om3gn.js} +1 -1
  107. package/dist/client/assets/{oauth-callback-CgawdzC7.js → oauth-callback-B2SdJrTS.js} +1 -1
  108. package/dist/client/assets/{page-CBPeBj68.js → page-CdJDLqyE.js} +1 -1
  109. package/dist/client/assets/{page-BipGfR0N.js → page-DZHkz-Tj.js} +1 -1
  110. package/dist/client/assets/{plugin-empty-state-DmoMnSvF.js → plugin-empty-state-DIxbhbdM.js} +1 -1
  111. package/dist/client/assets/{plugin-header-DrwRXir0.js → plugin-header-30g-NcVC.js} +1 -1
  112. package/dist/client/assets/{popover-Du0axOQk.js → popover-BDHymXMd.js} +1 -1
  113. package/dist/client/assets/{project-layout-CXHLC50z.js → project-layout-CgFaISWb.js} +1 -1
  114. package/dist/client/assets/{project-settings-BdUIjng2.js → project-settings-SUFHJ90C.js} +1 -1
  115. package/dist/client/assets/{projects-list-JxHyiVdW.js → projects-list-CHmkHD4E.js} +1 -1
  116. package/dist/client/assets/{registry-utils-DHqoUP2c.js → registry-utils-BR6BzVeP.js} +1 -1
  117. package/dist/client/assets/{resizable-DKYqWYE_.js → resizable-2kAlJwn8.js} +1 -1
  118. package/dist/client/assets/{select-C2Pbxf7c.js → select-DMMlFWJe.js} +1 -1
  119. package/dist/client/assets/{shell-layout-DuY0czp2.js → shell-layout-BCV_2i2_.js} +3 -3
  120. package/dist/client/assets/{spinner-Bk2Kv7Is.js → spinner-Bx7trFel.js} +1 -1
  121. package/dist/client/assets/{store-invite-DoxlK9jX.js → store-invite-LofqNtSX.js} +1 -1
  122. package/dist/client/assets/{switch-pRBwY2MA.js → switch-C0yi6OVV.js} +1 -1
  123. package/dist/client/assets/{table-Bgaai9wR.js → table-D7pbHUDB.js} +1 -1
  124. package/dist/client/assets/{tasks-CSRJCIUq.js → tasks-MG2GKEVA.js} +1 -1
  125. package/dist/client/assets/{textarea-CUDbyNiv.js → textarea-CeRheA0Q.js} +1 -1
  126. package/dist/client/assets/{tools-list-CjTy5P6D.js → tools-list-CX5YDA_X.js} +1 -1
  127. package/dist/client/assets/{topbar-portal-BJiAJ4h2.js → topbar-portal-C8JJoQbr.js} +1 -1
  128. package/dist/client/assets/{typewriter-title-CGvoRlOT.js → typewriter-title-DmosCyda.js} +1 -1
  129. package/dist/client/assets/{use-binding-ltfl3cPA.js → use-binding-C0O2f-XN.js} +1 -1
  130. package/dist/client/assets/{use-connection-_6bZJd3j.js → use-connection-AuebM5gu.js} +1 -1
  131. package/dist/client/assets/{use-create-virtual-mcp-CSiBFS-p.js → use-create-virtual-mcp-AQ2ouFC3.js} +1 -1
  132. package/dist/client/assets/{use-deco-chat-open-CVTwRQoh.js → use-deco-chat-open-BpzqC0Eg.js} +2 -2
  133. package/dist/client/assets/{use-install-from-registry-Box3PA1m.js → use-install-from-registry-DXItZCB2.js} +1 -1
  134. package/dist/client/assets/{use-list-state-FXqJjHJh.js → use-list-state-sOyPYO4a.js} +1 -1
  135. package/dist/client/assets/{use-llm-CETK0xwr.js → use-llm-D32w61hb.js} +1 -1
  136. package/dist/client/assets/{use-mcp-prompts-DVE5aYwA.js → use-mcp-prompts-GQRi1KzV.js} +1 -1
  137. package/dist/client/assets/{use-mcp-tools-CERNk3IX.js → use-mcp-tools-B0_NUBjt.js} +1 -1
  138. package/dist/client/assets/{use-mobile-DgWdzZzh.js → use-mobile-BxIj_uNd.js} +1 -1
  139. package/dist/client/assets/{use-organization-settings-6lqaWqmf.js → use-organization-settings-Boown5qg.js} +1 -1
  140. package/dist/client/assets/{use-project-CpFgjzox.js → use-project-gMu9ypju.js} +1 -1
  141. package/dist/client/assets/{use-virtual-mcp-BaDN22Su.js → use-virtual-mcp-B-em4IGd.js} +1 -1
  142. package/dist/client/assets/useInfiniteQuery-CnZ5J3_h.js +1 -0
  143. package/dist/client/assets/{useMutation-GLUqnj57.js → useMutation-OCNp6OYx.js} +1 -1
  144. package/dist/client/assets/useQuery-B8N1a1vY.js +1 -0
  145. package/dist/client/assets/{view-mode-toggle-BiQRnCj0.js → view-mode-toggle-DEltdBOB.js} +1 -1
  146. package/dist/client/assets/{workflow-B4shDfav.js → workflow-CCCfkzSk.js} +1 -1
  147. package/dist/client/index.html +1 -1
  148. package/dist/server/cli.js +167 -167
  149. package/dist/server/server.js +148 -148
  150. package/package.json +1 -1
  151. package/dist/client/assets/constants-BSCbneKJ.js +0 -1
  152. package/dist/client/assets/useInfiniteQuery-DUcr56bw.js +0 -1
  153. package/dist/client/assets/useQuery-BS0MQvhs.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as P,c as te,o as li,h as Gx,k as Vx,j as T,s as ys,c1 as Wx,b_ as Ww,bv as Et,c2 as Yw,a2 as Yx,u as ui,t as kn,ai as Kw,c3 as Xw,aY as Kx,c4 as Zw,c5 as sn,c6 as gl,c7 as Qw,c8 as bl,c9 as Jw,ca as eR,cb as tR,cc as nR,n as rR,K as ng,cd as iR,ce as aR,cf as sR,cg as oR,z as Xx,m as Zx,O as ss,b6 as rg,bZ as Ts,g as lR}from"./index-BF7Y1e9M.js";import{B as qe,c as le}from"./button-CsJ-BTyU.js";import{u as Nr,S as jb,c as uR,b as cR,d as dR,i as pR,m as Qx,M as fR,f as Jx,h as ev,C as tv,t as nv,e as hR,n as mR}from"./use-deco-chat-open-CVTwRQoh.js";import{b as ci,P as di,a as pi}from"./popover-Du0axOQk.js";import{S as vo}from"./spinner-Bk2Kv7Is.js";import{b as Cn,T as Nn,a as _n,c as Co,I as No}from"./integration-icon-DL_7q6rJ.js";import{d as rv,u as ig,i as Xr,f as gR}from"./constants-CucT8Y-Y.js";import{u as bR,g as iv,l as qb,a as Gb,r as ER}from"./use-mcp-prompts-DVE5aYwA.js";import{E as yR,i as TR}from"./error-boundary-CaGh18_R.js";import{c as SR,b as AR,e as kR,a as xR,D as vR}from"./dialog-3EB-J4B_.js";import{a as Qh,F as _o,b as Io,c as CR,d as wo,f as Ro}from"./form-BlwP3Tk9.js";import{I as av}from"./input-Barosnhy.js";import{i as NR}from"./ArrowUp-Cr88yR39.js";import{t as Jh}from"./ChevronDown-C753dD5M.js";import{i as _R}from"./Edit01-DkLw19ks.js";import{t as sa}from"./Users03-DItk6Nms.js";import{i as Oo}from"./AlertCircle-CMI4YiF8.js";import{i as IR}from"./X-r5buNXf-.js";import{i as wR}from"./ArrowLeft-F0qy4hoF.js";import{B as RR}from"./badge-BfrnxbIP.js";import{i as va}from"./Check-BVqX6VG5.js";import{i as OR}from"./Code01-Cz0GM-Ln.js";import{b as LR}from"./use-virtual-mcp-BaDN22Su.js";import{i as sv}from"./SearchMd-BkDBIRnQ.js";import{u as DR}from"./use-create-virtual-mcp-CSiBFS-p.js";import{c as MR}from"./usage-B8eRkRZY.js";import{i as ag}from"./ChevronRight-sGXl7Bvf.js";import{a as sg}from"./Copy01-Bl99tdzP.js";import{i as PR}from"./Terminal-rAB0v_E_.js";import{M as ov,s as Vb}from"./monaco-editor-HT_HkhlE.js";import{u as FR,L as BR}from"./localstorage-keys-amV_-5pn.js";import{E as UR}from"./empty-state-Bi-BkSth.js";import{g as HR,h as $R}from"./use-connection-_6bZJd3j.js";import{g as zR}from"./generate-id-Dyweu44Y.js";import{s as jR}from"./Trash01-By04ijdF.js";const lv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M5 12h14m0 0-7-7m7 7-7 7"}));lv.displayName="ArrowRight";const uv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));uv.displayName="Atom02";const cv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m21.152 10.9-9.015 9.015a5.25 5.25 0 0 1-7.425-7.425l9.016-9.015a3.5 3.5 0 1 1 4.95 4.95l-8.662 8.662a1.75 1.75 0 1 1-2.475-2.475l7.601-7.602"}));cv.displayName="Attachment01";const og=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));og.displayName="Coins01";const lg=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m18 10-4-4M2.5 21.5l3.384-.376c.414-.046.62-.069.814-.131a2 2 0 0 0 .485-.234c.17-.111.317-.259.61-.553L21 7a2.828 2.828 0 1 0-4-4L3.794 16.206c-.294.294-.442.442-.553.611a2 2 0 0 0-.234.485c-.062.193-.085.4-.131.814L2.5 21.5Z"}));lg.displayName="Edit02";const dv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));dv.displayName="GitBranch01";const pv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));pv.displayName="Lightbulb01";const Ss=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M10.5 9.002a2.248 2.248 0 0 1 4.369.75C14.869 11.25 12.62 12 12.62 12m.028 3h.01m-.16 5a8.5 8.5 0 1 0-8.056-5.783c.108.32.162.481.172.604a.899.899 0 0 1-.028.326c-.03.12-.098.245-.232.494l-1.636 3.027c-.233.432-.35.648-.324.815a.5.5 0 0 0 .234.35c.144.087.388.062.876.011l5.121-.529c.155-.016.233-.024.303-.021.07.002.12.009.187.024.069.016.155.05.329.116A8.478 8.478 0 0 0 12.5 20Z"}));Ss.displayName="MessageQuestionCircle";const fv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));fv.displayName="Stop";const hv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));hv.displayName="Target04";const mv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));mv.displayName="XCircle";function qR(t){const e={};for(const n of t.arguments??[])e[n.name]=n.required?ys().min(1,"Required"):ys();return li(e)}function GR(t){const e={};for(const n of t.arguments??[])e[n.name]="";return e}function gv(t){const e=te.c(64),{prompt:n,setPrompt:r,onSubmit:i}=t,a=P.useId();let s;if(e[0]!==n){const H=n?qR(n):li({});s=Gx(H),e[0]=n,e[1]=s}else s=e[1];const l=s;let u;e[2]!==n?(u=n?GR(n):{},e[2]=n,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=c):c=e[6];const d=Vx(c);let f;e[7]!==n?.arguments?(f=n?.arguments??[],e[7]=n?.arguments,e[8]=f):f=e[8];const p=f;let h;e[9]!==d||e[10]!==i||e[11]!==r?(h=async H=>{await i(H),r(null),d.reset()},e[9]=d,e[10]=i,e[11]=r,e[12]=h):h=e[12];const g=h;let b;e[13]!==d||e[14]!==r?(b=H=>{H||(d.reset(),r(null))},e[13]=d,e[14]=r,e[15]=b):b=e[15];const E=b;if(!n)return null;let y;e[16]!==n.name||e[17]!==n.title?(y=n.title||n.name.replace(/_/g," "),e[16]=n.name,e[17]=n.title,e[18]=y):y=e[18];let S;e[19]!==y?(S=T.jsx(SR,{children:y}),e[19]=y,e[20]=S):S=e[20];let k;e[21]!==n.description?(k=n.description&&T.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=k):k=e[22];let x;e[23]!==k||e[24]!==S?(x=T.jsxs(AR,{children:[S,k]}),e[23]=k,e[24]=S,e[25]=x):x=e[25];let A;e[26]!==d||e[27]!==g?(A=H=>{H.stopPropagation(),d.handleSubmit(g)(H)},e[26]=d,e[27]=g,e[28]=A):A=e[28];let v;if(e[29]!==p||e[30]!==d.control||e[31]!==d.formState.isSubmitting){let H;e[33]!==d.control||e[34]!==d.formState.isSubmitting?(H=Z=>T.jsx(_o,{control:d.control,name:Z.name,render:I=>{const{field:Y}=I;return T.jsxs(Io,{children:[T.jsxs(CR,{className:"text-xs",children:[Z.name,Z.required?null:T.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),T.jsx(wo,{children:T.jsx(av,{...Y,value:Y.value??"",required:Z.required,placeholder:Z.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),T.jsx(Ro,{})]})}},Z.name),e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=H):H=e[35],v=p.map(H),e[29]=p,e[30]=d.control,e[31]=d.formState.isSubmitting,e[32]=v}else v=e[32];let w;e[36]!==E?(w=()=>E(!1),e[36]=E,e[37]=w):w=e[37];let _;e[38]!==d.formState.isSubmitting||e[39]!==w?(_=T.jsx(qe,{type:"button",variant:"ghost",onClick:w,disabled:d.formState.isSubmitting,children:"Cancel"}),e[38]=d.formState.isSubmitting,e[39]=w,e[40]=_):_=e[40];const C=!d.formState.isValid||d.formState.isSubmitting;let L;e[41]!==d.formState.isSubmitting?(L=d.formState.isSubmitting?T.jsxs("span",{className:"flex items-center gap-2",children:[T.jsx(vo,{size:"xs"}),"Loading..."]}):"Use prompt",e[41]=d.formState.isSubmitting,e[42]=L):L=e[42];let M;e[43]!==a||e[44]!==C||e[45]!==L?(M=T.jsx(qe,{type:"submit",form:a,disabled:C,children:L}),e[43]=a,e[44]=C,e[45]=L,e[46]=M):M=e[46];let z;e[47]!==_||e[48]!==M?(z=T.jsxs(kR,{children:[_,M]}),e[47]=_,e[48]=M,e[49]=z):z=e[49];let F;e[50]!==a||e[51]!==A||e[52]!==v||e[53]!==z?(F=T.jsxs("form",{id:a,className:"space-y-4 py-4",autoComplete:"off",onSubmit:A,children:[v,z]}),e[50]=a,e[51]=A,e[52]=v,e[53]=z,e[54]=F):F=e[54];let B;e[55]!==d||e[56]!==F?(B=T.jsx(Qh,{...d,children:F}),e[55]=d,e[56]=F,e[57]=B):B=e[57];let $;e[58]!==x||e[59]!==B?($=T.jsxs(xR,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[x,B]}),e[58]=x,e[59]=B,e[60]=$):$=e[60];let G;return e[61]!==E||e[62]!==$?(G=T.jsx(vR,{open:!0,onOpenChange:E,children:$}),e[61]=E,e[62]=$,e[63]=G):G=e[63],G}function tt(t){this.content=t}tt.prototype={constructor:tt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new tt(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new tt(n)},addToStart:function(t,e){return new tt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new tt(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new tt(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=tt.from(t),t.size?new tt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=tt.from(t),t.size?new tt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=tt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};tt.from=function(t){if(t instanceof tt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new tt(e)};function bv(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let s=0;i.text[s]==a.text[s];s++)n++;return n}if(i.content.size||a.content.size){let s=bv(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Ev(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let u=0,c=Math.min(s.text.length,o.text.length);for(;u<c&&s.text[s.text.length-u-1]==o.text[o.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let u=Ev(s.content,o.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class W{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;if(u>e&&r(l,i+o,a||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=u},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new W(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=l}return new W(r,i)}cutByIndex(e,n){return e==n?W.empty:e==0&&n==this.content.length?this:new W(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new W(i,a)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return bv(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ev(this,e,n,r)}findIndex(e){if(e==0)return Ba(0,e);if(e==this.size)return Ba(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Ba(n+1,a):Ba(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return W.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new W(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new W(n||e,r)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const El={index:0,offset:0};function Ba(t,e){return El.index=t,El.offset=e,El}function As(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!As(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!As(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let _e=class em{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&As(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return em.none;if(e instanceof em)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};_e.none=[];class ks extends Error{}class ee{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Tv(this.content,e+this.openStart,n);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(yv(this.content,e+this.openStart,n+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,n){if(!n)return ee.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(W.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new ee(e,r,i)}}ee.empty=new ee(W.empty,0,0);function yv(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(yv(a.content,e-i-1,n-i-1)))}function Tv(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),s=t.maybeChild(i);if(a==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=Tv(s.content,e-a-1,n,s);return o&&t.replaceChild(i,s.copy(o))}function VR(t,e,n){if(n.openStart>t.depth)throw new ks("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ks("Inconsistent open depths");return Sv(t,e,n,0)}function Sv(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Sv(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return hr(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=WR(n,t);return hr(a,kv(t,s,o,e,r))}else return hr(a,xs(t,e,r))}function Av(t,e){if(!e.type.compatibleContent(t.type))throw new ks("Cannot join "+e.type.name+" onto "+t.type.name)}function tm(t,e,n){let r=t.node(n);return Av(r,e.node(n)),r}function fr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function $i(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(fr(t.nodeAfter,r),a++));for(let o=a;o<s;o++)fr(i.child(o),r);e&&e.depth==n&&e.textOffset&&fr(e.nodeBefore,r)}function hr(t,e){return t.type.checkContent(e),t.copy(e)}function kv(t,e,n,r,i){let a=t.depth>i&&tm(t,e,i+1),s=r.depth>i&&tm(n,r,i+1),o=[];return $i(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(Av(a,s),fr(hr(a,kv(t,e,n,r,i+1)),o)):(a&&fr(hr(a,xs(t,e,i+1)),o),$i(e,n,i,o),s&&fr(hr(s,xs(n,r,i+1)),o)),$i(r,null,i,o),new W(o)}function xs(t,e,n){let r=[];if($i(null,t,n,r),t.depth>n){let i=tm(t,e,n+1);fr(hr(i,xs(t,e,n+1)),r)}return $i(e,null,n,r),new W(r)}function WR(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(W.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class oa{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new vs(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),u=a-l;if(r.push(s,o,i+l),!u||(s=s.child(o),s.isText))break;a=u-1,i+=l+1}return new oa(n,r,a)}static resolveCached(e,n){let r=Wb.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else Wb.set(e,r=new YR);let i=r.elts[r.i]=oa.resolve(e,n);return r.i=(r.i+1)%KR,i}}class YR{constructor(){this.elts=[],this.i=0}}const KR=12,Wb=new WeakMap;class vs{constructor(e,n,r){this.$from=e,this.$to=n,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 XR=Object.create(null);let Wn=class nm{constructor(e,n,r,i=_e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||W.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&As(this.attrs,n||e.defaultAttrs||XR)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new nm(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new nm(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ee.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),u=i.node(s).content.cut(i.pos-o,a.pos-o);return new ee(u,i.depth-s,a.depth-s)}replace(e,n,r){return VR(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return oa.resolveCached(this,e)}resolveNoCache(e){return oa.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}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()+")"),xv(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=W.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.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=_e.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=W.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};Wn.prototype.text=void 0;class Cs extends Wn{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):xv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Cs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Cs(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function xv(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Tr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new ZR(e,n);if(r.next==null)return Tr.empty;let i=vv(r);r.next&&r.err("Unexpected trailing text");let a=iO(rO(i));return aO(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return W.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=a(d,o.concat(c));if(f)return f}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
1
+ import{r as P,c as te,o as li,h as Gx,k as Vx,j as T,s as ys,c0 as Wx,bZ as Ww,bu as Et,c1 as Yw,a2 as Yx,u as ui,t as kn,ai as Kw,c2 as Xw,aY as Kx,c3 as Zw,c4 as sn,c5 as gl,c6 as Qw,c7 as bl,c8 as Jw,c9 as eR,ca as tR,cb as nR,n as rR,K as ng,cc as iR,cd as aR,ce as sR,cf as oR,z as Xx,m as Zx,O as ss,b5 as rg,bY as Ts,g as lR}from"./index-BnM6zXPK.js";import{B as qe,c as le}from"./button-ds0Xf2u_.js";import{u as Nr,S as jb,c as uR,b as cR,d as dR,i as pR,m as Qx,M as fR,f as Jx,h as ev,C as tv,t as nv,e as hR,n as mR}from"./use-deco-chat-open-BpzqC0Eg.js";import{b as ci,P as di,a as pi}from"./popover-BDHymXMd.js";import{S as vo}from"./spinner-Bx7trFel.js";import{b as Cn,T as Nn,a as _n,c as Co,I as No}from"./integration-icon-GQvaX0z4.js";import{d as rv,u as ig,i as Xr,f as gR}from"./constants-pTCFS1GU.js";import{u as bR,g as iv,l as qb,a as Gb,r as ER}from"./use-mcp-prompts-GQRi1KzV.js";import{E as yR,i as TR}from"./error-boundary-D1nW3qw3.js";import{c as SR,b as AR,e as kR,a as xR,D as vR}from"./dialog-1X4BWtmD.js";import{a as Qh,F as _o,b as Io,c as CR,d as wo,f as Ro}from"./form-CCnPwGY1.js";import{I as av}from"./input-CoSRI0XN.js";import{i as NR}from"./ArrowUp-D5TY17yS.js";import{t as Jh}from"./ChevronDown--AD2MLIh.js";import{i as _R}from"./Edit01-DwOJTHYN.js";import{t as sa}from"./Users03-DUHQ5891.js";import{i as Oo}from"./AlertCircle-fs-iLCxQ.js";import{i as IR}from"./X-DbHlFzca.js";import{i as wR}from"./ArrowLeft-BOU-qvMz.js";import{B as RR}from"./badge-DnrGjfKN.js";import{i as va}from"./Check-woCJI4Zk.js";import{i as OR}from"./Code01-DOUE7D86.js";import{b as LR}from"./use-virtual-mcp-B-em4IGd.js";import{i as sv}from"./SearchMd-Ctirl108.js";import{u as DR}from"./use-create-virtual-mcp-AQ2ouFC3.js";import{c as MR}from"./usage-B8eRkRZY.js";import{i as ag}from"./ChevronRight-DhFCl7fQ.js";import{a as sg}from"./Copy01-DhF1Yrkw.js";import{i as PR}from"./Terminal-DjfPKa_L.js";import{M as ov,s as Vb}from"./monaco-editor-lPTVHX05.js";import{u as FR,L as BR}from"./localstorage-keys-DEZN3FMx.js";import{E as UR}from"./empty-state-CJnfgDRv.js";import{g as HR,h as $R}from"./use-connection-AuebM5gu.js";import{g as zR}from"./generate-id-Dyweu44Y.js";import{s as jR}from"./Trash01-h3f3UFq5.js";const lv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M5 12h14m0 0-7-7m7 7-7 7"}));lv.displayName="ArrowRight";const uv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));uv.displayName="Atom02";const cv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m21.152 10.9-9.015 9.015a5.25 5.25 0 0 1-7.425-7.425l9.016-9.015a3.5 3.5 0 1 1 4.95 4.95l-8.662 8.662a1.75 1.75 0 1 1-2.475-2.475l7.601-7.602"}));cv.displayName="Attachment01";const og=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));og.displayName="Coins01";const lg=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m18 10-4-4M2.5 21.5l3.384-.376c.414-.046.62-.069.814-.131a2 2 0 0 0 .485-.234c.17-.111.317-.259.61-.553L21 7a2.828 2.828 0 1 0-4-4L3.794 16.206c-.294.294-.442.442-.553.611a2 2 0 0 0-.234.485c-.062.193-.085.4-.131.814L2.5 21.5Z"}));lg.displayName="Edit02";const dv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));dv.displayName="GitBranch01";const pv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));pv.displayName="Lightbulb01";const Ss=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M10.5 9.002a2.248 2.248 0 0 1 4.369.75C14.869 11.25 12.62 12 12.62 12m.028 3h.01m-.16 5a8.5 8.5 0 1 0-8.056-5.783c.108.32.162.481.172.604a.899.899 0 0 1-.028.326c-.03.12-.098.245-.232.494l-1.636 3.027c-.233.432-.35.648-.324.815a.5.5 0 0 0 .234.35c.144.087.388.062.876.011l5.121-.529c.155-.016.233-.024.303-.021.07.002.12.009.187.024.069.016.155.05.329.116A8.478 8.478 0 0 0 12.5 20Z"}));Ss.displayName="MessageQuestionCircle";const fv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));fv.displayName="Stop";const hv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));hv.displayName="Target04";const mv=({size:t=24,color:e="currentColor",...n})=>P.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},P.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));mv.displayName="XCircle";function qR(t){const e={};for(const n of t.arguments??[])e[n.name]=n.required?ys().min(1,"Required"):ys();return li(e)}function GR(t){const e={};for(const n of t.arguments??[])e[n.name]="";return e}function gv(t){const e=te.c(64),{prompt:n,setPrompt:r,onSubmit:i}=t,a=P.useId();let s;if(e[0]!==n){const H=n?qR(n):li({});s=Gx(H),e[0]=n,e[1]=s}else s=e[1];const l=s;let u;e[2]!==n?(u=n?GR(n):{},e[2]=n,e[3]=u):u=e[3];let c;e[4]!==l||e[5]!==u?(c={resolver:l,defaultValues:u,mode:"onChange"},e[4]=l,e[5]=u,e[6]=c):c=e[6];const d=Vx(c);let f;e[7]!==n?.arguments?(f=n?.arguments??[],e[7]=n?.arguments,e[8]=f):f=e[8];const p=f;let h;e[9]!==d||e[10]!==i||e[11]!==r?(h=async H=>{await i(H),r(null),d.reset()},e[9]=d,e[10]=i,e[11]=r,e[12]=h):h=e[12];const g=h;let b;e[13]!==d||e[14]!==r?(b=H=>{H||(d.reset(),r(null))},e[13]=d,e[14]=r,e[15]=b):b=e[15];const E=b;if(!n)return null;let y;e[16]!==n.name||e[17]!==n.title?(y=n.title||n.name.replace(/_/g," "),e[16]=n.name,e[17]=n.title,e[18]=y):y=e[18];let S;e[19]!==y?(S=T.jsx(SR,{children:y}),e[19]=y,e[20]=S):S=e[20];let k;e[21]!==n.description?(k=n.description&&T.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=k):k=e[22];let x;e[23]!==k||e[24]!==S?(x=T.jsxs(AR,{children:[S,k]}),e[23]=k,e[24]=S,e[25]=x):x=e[25];let A;e[26]!==d||e[27]!==g?(A=H=>{H.stopPropagation(),d.handleSubmit(g)(H)},e[26]=d,e[27]=g,e[28]=A):A=e[28];let v;if(e[29]!==p||e[30]!==d.control||e[31]!==d.formState.isSubmitting){let H;e[33]!==d.control||e[34]!==d.formState.isSubmitting?(H=Z=>T.jsx(_o,{control:d.control,name:Z.name,render:I=>{const{field:Y}=I;return T.jsxs(Io,{children:[T.jsxs(CR,{className:"text-xs",children:[Z.name,Z.required?null:T.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),T.jsx(wo,{children:T.jsx(av,{...Y,value:Y.value??"",required:Z.required,placeholder:Z.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),T.jsx(Ro,{})]})}},Z.name),e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=H):H=e[35],v=p.map(H),e[29]=p,e[30]=d.control,e[31]=d.formState.isSubmitting,e[32]=v}else v=e[32];let w;e[36]!==E?(w=()=>E(!1),e[36]=E,e[37]=w):w=e[37];let _;e[38]!==d.formState.isSubmitting||e[39]!==w?(_=T.jsx(qe,{type:"button",variant:"ghost",onClick:w,disabled:d.formState.isSubmitting,children:"Cancel"}),e[38]=d.formState.isSubmitting,e[39]=w,e[40]=_):_=e[40];const C=!d.formState.isValid||d.formState.isSubmitting;let L;e[41]!==d.formState.isSubmitting?(L=d.formState.isSubmitting?T.jsxs("span",{className:"flex items-center gap-2",children:[T.jsx(vo,{size:"xs"}),"Loading..."]}):"Use prompt",e[41]=d.formState.isSubmitting,e[42]=L):L=e[42];let M;e[43]!==a||e[44]!==C||e[45]!==L?(M=T.jsx(qe,{type:"submit",form:a,disabled:C,children:L}),e[43]=a,e[44]=C,e[45]=L,e[46]=M):M=e[46];let z;e[47]!==_||e[48]!==M?(z=T.jsxs(kR,{children:[_,M]}),e[47]=_,e[48]=M,e[49]=z):z=e[49];let F;e[50]!==a||e[51]!==A||e[52]!==v||e[53]!==z?(F=T.jsxs("form",{id:a,className:"space-y-4 py-4",autoComplete:"off",onSubmit:A,children:[v,z]}),e[50]=a,e[51]=A,e[52]=v,e[53]=z,e[54]=F):F=e[54];let B;e[55]!==d||e[56]!==F?(B=T.jsx(Qh,{...d,children:F}),e[55]=d,e[56]=F,e[57]=B):B=e[57];let $;e[58]!==x||e[59]!==B?($=T.jsxs(xR,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[x,B]}),e[58]=x,e[59]=B,e[60]=$):$=e[60];let G;return e[61]!==E||e[62]!==$?(G=T.jsx(vR,{open:!0,onOpenChange:E,children:$}),e[61]=E,e[62]=$,e[63]=G):G=e[63],G}function tt(t){this.content=t}tt.prototype={constructor:tt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new tt(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new tt(n)},addToStart:function(t,e){return new tt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new tt(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new tt(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=tt.from(t),t.size?new tt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=tt.from(t),t.size?new tt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=tt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};tt.from=function(t){if(t instanceof tt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new tt(e)};function bv(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let s=0;i.text[s]==a.text[s];s++)n++;return n}if(i.content.size||a.content.size){let s=bv(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Ev(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,r-=l;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let u=0,c=Math.min(s.text.length,o.text.length);for(;u<c&&s.text[s.text.length-u-1]==o.text[o.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||o.content.size){let u=Ev(s.content,o.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class W{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],u=o+l.nodeSize;if(u>e&&r(l,i+o,a||null,s)!==!1&&l.content.size){let c=o+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let u=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=u},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new W(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=l}return new W(r,i)}cutByIndex(e,n){return e==n?W.empty:e==0&&n==this.content.length?this:new W(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new W(i,a)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return bv(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ev(this,e,n,r)}findIndex(e){if(e==0)return Ba(0,e);if(e==this.size)return Ba(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Ba(n+1,a):Ba(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return W.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new W(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new W(n||e,r)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const El={index:0,offset:0};function Ba(t,e){return El.index=t,El.offset=e,El}function As(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!As(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!As(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let _e=class em{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&As(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return em.none;if(e instanceof em)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};_e.none=[];class ks extends Error{}class ee{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Tv(this.content,e+this.openStart,n);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(yv(this.content,e+this.openStart,n+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,n){if(!n)return ee.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(W.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new ee(e,r,i)}}ee.empty=new ee(W.empty,0,0);function yv(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(yv(a.content,e-i-1,n-i-1)))}function Tv(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),s=t.maybeChild(i);if(a==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=Tv(s.content,e-a-1,n,s);return o&&t.replaceChild(i,s.copy(o))}function VR(t,e,n){if(n.openStart>t.depth)throw new ks("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ks("Inconsistent open depths");return Sv(t,e,n,0)}function Sv(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Sv(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return hr(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=WR(n,t);return hr(a,kv(t,s,o,e,r))}else return hr(a,xs(t,e,r))}function Av(t,e){if(!e.type.compatibleContent(t.type))throw new ks("Cannot join "+e.type.name+" onto "+t.type.name)}function tm(t,e,n){let r=t.node(n);return Av(r,e.node(n)),r}function fr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function $i(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(fr(t.nodeAfter,r),a++));for(let o=a;o<s;o++)fr(i.child(o),r);e&&e.depth==n&&e.textOffset&&fr(e.nodeBefore,r)}function hr(t,e){return t.type.checkContent(e),t.copy(e)}function kv(t,e,n,r,i){let a=t.depth>i&&tm(t,e,i+1),s=r.depth>i&&tm(n,r,i+1),o=[];return $i(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(Av(a,s),fr(hr(a,kv(t,e,n,r,i+1)),o)):(a&&fr(hr(a,xs(t,e,i+1)),o),$i(e,n,i,o),s&&fr(hr(s,xs(n,r,i+1)),o)),$i(r,null,i,o),new W(o)}function xs(t,e,n){let r=[];if($i(null,t,n,r),t.depth>n){let i=tm(t,e,n+1);fr(hr(i,xs(t,e,n+1)),r)}return $i(e,null,n,r),new W(r)}function WR(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(W.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class oa{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new vs(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),u=a-l;if(r.push(s,o,i+l),!u||(s=s.child(o),s.isText))break;a=u-1,i+=l+1}return new oa(n,r,a)}static resolveCached(e,n){let r=Wb.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else Wb.set(e,r=new YR);let i=r.elts[r.i]=oa.resolve(e,n);return r.i=(r.i+1)%KR,i}}class YR{constructor(){this.elts=[],this.i=0}}const KR=12,Wb=new WeakMap;class vs{constructor(e,n,r){this.$from=e,this.$to=n,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 XR=Object.create(null);let Wn=class nm{constructor(e,n,r,i=_e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||W.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&As(this.attrs,n||e.defaultAttrs||XR)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new nm(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new nm(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ee.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),u=i.node(s).content.cut(i.pos-o,a.pos-o);return new ee(u,i.depth-s,a.depth-s)}replace(e,n,r){return VR(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return oa.resolveCached(this,e)}resolveNoCache(e){return oa.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}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()+")"),xv(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=W.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=i;l<a;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.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=_e.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!_e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=W.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};Wn.prototype.text=void 0;class Cs extends Wn{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):xv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Cs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Cs(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function xv(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Tr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new ZR(e,n);if(r.next==null)return Tr.empty;let i=vv(r);r.next&&r.err("Unexpected trailing text");let a=iO(rO(i));return aO(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return W.from(o.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=a(d,o.concat(c));if(f)return f}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||l.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
2
2
  `)}}Tr.empty=new Tr(!0);class ZR{constructor(e,n){this.string=e,this.nodeTypes=n,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 vv(t){let e=[];do e.push(QR(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function QR(t){let e=[];do e.push(JR(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function JR(t){let e=nO(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=eO(t,e);else break;return e}function Yb(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function eO(t,e){let n=Yb(t),r=n;return t.eat(",")&&(t.next!="}"?r=Yb(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function tO(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let s=n[a];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function nO(t){if(t.eat("(")){let e=vv(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=tO(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function rO(t){let e=[[]];return i(a(t,0),n()),e;function n(){return e.push([])-1}function r(s,o,l){let u={term:l,to:o};return e[s].push(u),u}function i(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(a(u,o)),[]);if(s.type=="seq")for(let l=0;;l++){let u=a(s.exprs[l],o);if(l==s.exprs.length-1)return u;i(u,o=n())}else if(s.type=="star"){let l=n();return r(o,l),i(a(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(a(s.expr,o),l),i(a(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let u=0;u<s.min;u++){let c=n();i(a(s.expr,l),c),l=c}if(s.max==-1)i(a(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();r(l,c),i(a(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Cv(t,e){return e-t}function Kb(t,e){let n=[];return r(e),n.sort(Cv);function r(i){let a=t[i];if(a.length==1&&!a[0].term)return r(a[0].to);n.push(i);for(let s=0;s<a.length;s++){let{term:o,to:l}=a[s];!o&&n.indexOf(l)==-1&&r(l)}}}function iO(t){let e=Object.create(null);return n(Kb(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let u;for(let c=0;c<i.length;c++)i[c][0]==o&&(u=i[c][1]);Kb(t,l).forEach(c=>{u||i.push([o,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let a=e[r.join(",")]=new Tr(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let o=i[s][1].sort(Cv);a.next.push({type:i[s][0],next:e[o.join(",")]||n(o)})}return a}}function aO(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],a=!i.validEnd,s=[];for(let o=0;o<i.next.length;o++){let{type:l,next:u}=i.next[o];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),r.indexOf(u)==-1&&r.push(u)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Nv(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function _v(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let a=t[r];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Iv(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let a=t[i];a.validate&&a.validate(e[i])}}function wv(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new oO(t,r,e[r]);return n}let Xb=class Rv{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=wv(e,r.attrs),this.defaultAttrs=Nv(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==Tr.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:_v(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Wn(this,this.computeAttrs(e),W.from(n),_e.setFrom(r))}createChecked(e=null,n,r){return n=W.from(n),this.checkContent(n),new Wn(this,this.computeAttrs(e),n,_e.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=W.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(W.empty,!0);return a?new Wn(this,e,n.append(a),_e.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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){Iv(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:_e.none:e}static compile(e,n){let r=Object.create(null);e.forEach((a,s)=>r[a]=new Rv(a,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function sO(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class oO{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sO(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Lo{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=wv(e,i.attrs),this.excluded=null;let a=Nv(this.attrs);this.instance=a?new _e(this,a):null}create(e=null){return!e&&this.instance?this.instance:new _e(this,_v(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,s)=>r[a]=new Lo(a,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Iv(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Ov=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=tt.from(e.nodes),n.marks=tt.from(e.marks||{}),this.nodes=Xb.compile(this.spec.nodes,this),this.marks=Lo.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=r[s]||(r[s]=Tr.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?Zb(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:Zb(this,s.split(" "))}this.nodeFromJSON=i=>Wn.fromJSON(this,i),this.markFromJSON=i=>_e.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Xb){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(n,r,i)}text(e,n){let r=this.nodes.text;return new Cs(r,r.defaultAttrs,e,_e.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function Zb(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.marks[i],s=a;if(a)n.push(a);else for(let o in t.marks){let l=t.marks[o];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function lO(t){return t.tag!=null}function uO(t){return t.style!=null}class Yn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(lO(i))this.tags.push(i);else if(uO(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new Jb(this,n,!1);return r.addAll(e,_e.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Jb(this,n,!0);return r.addAll(e,_e.none,n.from,n.to),ee.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(pO(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,r,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let a=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<a)break}n.splice(s,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(s=>{r(s=eE(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(s=>{r(s=eE(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Yn(e,Yn.schemaRules(e)))}}const Lv={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},cO={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Dv={ol:!0,ul:!0},la=1,rm=2,zi=4;function Qb(t,e,n){return e!=null?(e?la:0)|(e==="full"?rm:0):t&&t.whitespace=="pre"?la|rm:n&~zi}class Ua{constructor(e,n,r,i,a,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=_e.none,this.match=a||(s&zi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(W.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&la)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=W.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(W.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Lv.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Jb{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,s=Qb(null,n.preserveWhitespace,0)|(r?zi:0);i?a=new Ua(i.type,i.attrs,_e.none,!0,n.topMatch||i.type.contentMatch,s):r?a=new Ua(null,null,_e.none,!0,null,s):a=new Ua(e.schema.topNodeType,null,_e.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,a=i.options&rm?"full":this.localPreserveWS||(i.options&la)>0,{schema:s}=this.parser;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=r.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[l]&&this.insertNode(s.text(o[l]),n,!/\S/.test(o[l]));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 o=i.content[i.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;Dv.hasOwnProperty(s)&&this.parser.normalizeLists&&dO(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(l?l.ignore:cO.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(Lv.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),u=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(a),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?o:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],s=r.getPropertyValue(a);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(a,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,r,i){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(a=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}a&&this.sync(o)&&this.open--}addAll(e,n,r,i){let a=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=i==null?null:e.childNodes[i];s!=o;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n,r){let i,a;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+o)&&(i=u,a=l,!u.length))break;if(l.solid){if(r)break;o+=2}}if(!i)return null;this.sync(a);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(n=this.enterInner(a,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let s=_e.none;for(let o of i.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):tE(o.type,e.type))&&(s=o.addToSet(s));return a.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let a=this.findPlace(e.create(n),r,!1);return a&&(a=this.enterInner(e,n,r,!0,i)),a}enterInner(e,n,r,i=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=Qb(e,a,s.options);s.options&zi&&s.content.length==0&&(o|=zi);let l=_e.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):tE(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new Ua(e,n,l,i,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=la)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),s=(o,l)=>{for(;o>=0;o--){let u=n[o];if(u==""){if(o==n.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=a?r.node(l-a).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function dO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Dv.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function pO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function eE(t){let e={};for(let n in t)e[n]=t[n];return e}function tE(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let a=[],s=o=>{a.push(o);for(let l=0;l<o.edgeCount;l++){let{type:u,next:c}=o.edge(l);if(u==e||a.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class _r{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=yl(n).createDocumentFragment());let i=r,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let o=0,l=0;for(;o<a.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(a[o][0])||u.type.spec.spanning===!1)break;o++,l++}for(;o<a.length;)i=a.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(a.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=ls(yl(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&ls(yl(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return ls(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new _r(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=nE(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return nE(e.marks)}}function nE(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function yl(t){return t.document||window.document}const rE=new WeakMap;function fO(t){let e=rE.get(t);return e===void 0&&rE.set(t,e=hO(t)),e}function hO(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function ls(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(a=fO(r))&&a.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 s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let o,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:h}=ls(t,f,n,r);if(l.appendChild(p),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}const Mv=65535,Pv=Math.pow(2,16);function mO(t,e){return t+e*Pv}function iE(t){return t&Mv}function gO(t){return(t-(t&Mv))/Pv}const Fv=1,Bv=2,us=4,Uv=8;class im{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Uv)>0}get deletedBefore(){return(this.delInfo&(Fv|us))>0}get deletedAfter(){return(this.delInfo&(Bv|us))>0}get deletedAcross(){return(this.delInfo&us)>0}}class Mt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Mt.empty)return Mt.empty}recover(e){let n=0,r=iE(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+gO(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[o+a],c=this.ranges[o+s],d=l+u;if(e<=d){let f=u?e==l?-1:e==d?1:n:n,p=l+i+(f<0?0:c);if(r)return p;let h=e==(n<0?l:d)?null:mO(o/3,e-l),g=e==l?Bv:e==d?Fv:us;return(n<0?e!=l:e!=d)&&(g|=Uv),new im(p,g,h)}i+=c-u}return r?e+i:new im(e+i,0,null)}touches(e,n){let r=0,i=iE(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[o+a],c=l+u;if(e<=c&&o==i*3)return!0;r+=this.ranges[o+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let s=this.ranges[i],o=s-(this.inverted?a:0),l=s+(this.inverted?0:a),u=this.ranges[i+n],c=this.ranges[i+r];e(o,o+u,l,l+c),a+=c-u}}invert(){return new Mt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Mt.empty:new Mt(e<0?[0,-e,0]:[0,0,e])}}Mt.empty=new Mt([]);class ua{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ua(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new ua;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(o.recover);continue}}i|=o.delInfo,e=o.pos}return r?e:new im(e,i,null)}}const Tl=Object.create(null);class ct{getMap(){return Mt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Tl[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Tl)throw new RangeError("Duplicate use of step JSON ID "+e);return Tl[e]=n,n.prototype.jsonID=e,n}}class je{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new je(e,null)}static fail(e){return new je(null,e)}static fromReplace(e,n,r,i){try{return je.ok(e.replace(n,r,i))}catch(a){if(a instanceof ks)return je.fail(a.message);throw a}}}function ug(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let a=t.child(i);a.content.size&&(a=a.copy(ug(a.content,e,a))),a.isInline&&(a=e(a,n,i)),r.push(a)}return W.fromArray(r)}class zn extends ct{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),a=new ee(ug(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return je.fromReplace(e,this.from,this.to,a)}invert(){return new Kt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new zn(n.pos,r.pos,this.mark)}merge(e){return e instanceof zn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new zn(n.from,n.to,e.markFromJSON(n.mark))}}ct.jsonID("addMark",zn);class Kt extends ct{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ee(ug(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return je.fromReplace(e,this.from,this.to,r)}invert(){return new zn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Kt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Kt(n.from,n.to,e.markFromJSON(n.mark))}}ct.jsonID("removeMark",Kt);class jn extends ct{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return je.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return je.fromReplace(e,this.pos,this.pos+1,new ee(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new jn(this.pos,n.marks[i]);return new jn(this.pos,this.mark)}}return new Sr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new jn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new jn(n.pos,e.markFromJSON(n.mark))}}ct.jsonID("addNodeMark",jn);class Sr extends ct{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return je.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return je.fromReplace(e,this.pos,this.pos+1,new ee(W.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new jn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Sr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Sr(n.pos,e.markFromJSON(n.mark))}}ct.jsonID("removeNodeMark",Sr);class Ze extends ct{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&am(e,this.from,this.to)?je.fail("Structure replace would overwrite content"):je.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Mt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ze(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ze(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ze)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ze(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ze(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ze(n.from,n.to,ee.fromJSON(e,n.slice),!!n.structure)}}ct.jsonID("replace",Ze);class Je extends ct{constructor(e,n,r,i,a,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=a,this.insert=s,this.structure=o}apply(e){if(this.structure&&(am(e,this.from,this.gapFrom)||am(e,this.gapTo,this.to)))return je.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return je.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?je.fromReplace(e,this.from,this.to,r):je.fail("Content does not fit in gap")}getMap(){return new Mt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Je(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new Je(n.pos,r.pos,i,a,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Je(n.from,n.to,n.gapFrom,n.gapTo,ee.fromJSON(e,n.slice),n.insert,!!n.structure)}}ct.jsonID("replaceAround",Je);function am(t,e,n){let r=t.resolve(e),i=n-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let s=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function bO(t,e,n,r){let i=[],a=[],s,o;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(u,e),p=Math.min(u+l.nodeSize,n),h=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(h)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=p:i.push(s=new Kt(f,p,d[g])));o&&o.to==f?o.to=p:a.push(o=new zn(f,p,r))}}),i.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function EO(t,e,n,r){let i=[],a=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(r instanceof Lo){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(o+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],f;for(let p=0;p<i.length;p++){let h=i[p];h.step==a-1&&d.eq(i[p].style)&&(f=h)}f?(f.to=u,f.step=a):i.push({style:d,from:Math.max(o,e),to:u,step:a})}}}),i.forEach(s=>t.step(new Kt(s.from,s.to,s.style)))}function cg(t,e,n,r=n.contentMatch,i=!0){let a=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<a.childCount;l++){let u=a.child(l),c=o+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new Ze(o,c,ee.empty));else{r=d;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new Kt(o,c,u.marks[f]));if(i&&u.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(u.text);)h||(h=new ee(W.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new Ze(o+f.index,o+f.index+f[0].length,h))}}o=c}if(!r.validEnd){let l=r.fillBefore(W.empty,!0);t.replace(o,o,new ee(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function yO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function fi(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,a=0;;--r){let s=t.$from.node(r),o=t.$from.index(r)+i,l=t.$to.indexAfter(r)-a;if(r<t.depth&&s.canReplace(o,l,n))return r;if(r==0||s.type.spec.isolating||!yO(s,o,l))break;o&&(i=1),l<s.childCount&&(a=1)}return null}function TO(t,e,n){let{$from:r,$to:i,depth:a}=e,s=r.before(a+1),o=i.after(a+1),l=s,u=o,c=W.empty,d=0;for(let h=a,g=!1;h>n;h--)g||r.index(h)>0?(g=!0,c=W.from(r.node(h).copy(c)),d++):l--;let f=W.empty,p=0;for(let h=a,g=!1;h>n;h--)g||i.after(h+1)<i.end(h)?(g=!0,f=W.from(i.node(h).copy(f)),p++):u++;t.step(new Je(l,u,s,o,new ee(c.append(f),d,p),c.size-d,!0))}function dg(t,e,n=null,r=t){let i=SO(t,e),a=i&&AO(r,e);return a?i.map(aE).concat({type:e,attrs:n}).concat(a.map(aE)):null}function aE(t){return{type:t,attrs:null}}function SO(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.contentMatchAt(r).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(r,i,s)?a:null}function AO(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.child(r),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:s}function kO(t,e,n){let r=W.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let o=n[s].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=W.from(n[s].type.create(n[s].attrs,r))}let i=e.start,a=e.end;t.step(new Je(i,a,i,a,new ee(r,0,0),n.length,!0))}function xO(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&vO(t.doc,t.mapping.slice(a).map(o),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?u=!1:!p&&h&&(u=!0)}u===!1&&$v(t,s,o,a),cg(t,t.mapping.slice(a).map(o,1),r,void 0,u===null);let c=t.mapping.slice(a),d=c.map(o,1),f=c.map(o+s.nodeSize,1);return t.step(new Je(d,f,d+1,f-1,new ee(W.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Hv(t,s,o,a),!1}})}function Hv(t,e,n,r){e.forEach((i,a)=>{if(i.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(i.text);){let l=t.mapping.slice(r).map(n+1+a+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function $v(t,e,n,r){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
@@ -97,7 +97,7 @@ ${b}
97
97
  `);x.trim()&&(e.customNestedParser?y=e.customNestedParser(x):y=n.blockTokens(x))}const k=e.createToken(h,y);l.push(k)}if(l.length!==0)return{items:l,raw:u}}function Pg(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[a,...s]=t.content,o=e.renderChildren([a]),l=[`${i}${o}`];return s&&s.length>0&&s.forEach(u=>{const c=e.renderChildren([u]);if(c){const d=c.split(`
98
98
  `).map(f=>f?e.indent(f):"").join(`
99
99
  `);l.push(d)}}),l.join(`
100
- `)}function ZM(t,e,n={}){const{state:r}=e,{doc:i,tr:a}=r,s=t;i.descendants((o,l)=>{const u=a.mapping.map(l),c=a.mapping.map(l)+o.nodeSize;let d=null;if(o.marks.forEach(p=>{if(p!==s)return!1;d=p}),!d)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==d.attrs[p]&&(f=!0)}),f){const p=t.type.create({...t.attrs,...n});a.removeMark(u,c,t.type),a.addMark(u,c,p)}}),a.docChanged&&e.view.dispatch(a)}var kt=class kN extends Lg{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new kN(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},QM=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,a,s,o;const{view:l}=this.editor,u=t.target,c=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(u)||!c)return;let d=0,f=0;if(this.dom!==c){const y=this.dom.getBoundingClientRect(),S=c.getBoundingClientRect(),k=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,x=(s=t.offsetY)!=null?s:(a=t.nativeEvent)==null?void 0:a.offsetY;d=S.x-y.x+k,f=S.y-y.y+x}const p=this.dom.cloneNode(!0);try{const y=this.dom.getBoundingClientRect();p.style.width=`${Math.round(y.width)}px`,p.style.height=`${Math.round(y.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let h=null;try{h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(p),document.body.appendChild(h),(o=t.dataTransfer)==null||o.setDragImage(p,d,f)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=ue.create(l.state.doc,g),E=l.state.tr.setSelection(b);l.dispatch(E)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),a=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!a&&!i)return!0;const{isEditable:o}=this.editor,{isDragging:l}=this,u=!!this.node.type.spec.draggable,c=ue.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",p=t.type==="cut",h=t.type==="mousedown";if(!u&&c&&i&&t.target===this.dom&&t.preventDefault(),u&&i&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(u&&o&&!l&&h){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||a||d||f||p||h&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(ha()||gm())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function xr(t){return new OM({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const a=ve(t.getAttributes,void 0,r,i);if(a===!1||a===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];let u=n.to;if(o){const c=l.search(/\S/),d=n.from+l.indexOf(o),f=d+o.length;if(Og(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(b=>b===t.type&&b!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+o.length,s.addMark(n.from+c,u,t.type.create(a||{})),s.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:JM,getOwnPropertySymbols:e3}=Object,{hasOwnProperty:t3}=Object.prototype;function Ml(t,e){return function(r,i,a){return t(r,i,a)&&e(r,i,a)}}function Va(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:a}=i,s=a.get(n),o=a.get(r);if(s&&o)return s===r&&o===n;a.set(n,r),a.set(r,n);const l=t(n,r,i);return a.delete(n),a.delete(r),l}}function n3(t){return t?.[Symbol.toStringTag]}function e0(t){return JM(t).concat(e3(t))}const r3=Object.hasOwn||((t,e)=>t3.call(t,e));function wr(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const i3="__v",a3="__o",s3="_owner",{getOwnPropertyDescriptor:t0,keys:n0}=Object;function o3(t,e){return t.byteLength===e.byteLength&&Ms(new Uint8Array(t),new Uint8Array(e))}function l3(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function u3(t,e){return t.byteLength===e.byteLength&&Ms(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function c3(t,e){return wr(t.getTime(),e.getTime())}function d3(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function p3(t,e){return t===e}function r0(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),a=t.entries();let s,o,l=0;for(;(s=a.next())&&!s.done;){const u=e.entries();let c=!1,d=0;for(;(o=u.next())&&!o.done;){if(i[d]){d++;continue}const f=s.value,p=o.value;if(n.equals(f[0],p[0],l,d,t,e,n)&&n.equals(f[1],p[1],f[0],p[0],t,e,n)){c=i[d]=!0;break}d++}if(!c)return!1;l++}return!0}const f3=wr;function h3(t,e,n){const r=n0(t);let i=r.length;if(n0(e).length!==i)return!1;for(;i-- >0;)if(!xN(t,e,n,r[i]))return!1;return!0}function xi(t,e,n){const r=e0(t);let i=r.length;if(e0(e).length!==i)return!1;let a,s,o;for(;i-- >0;)if(a=r[i],!xN(t,e,n,a)||(s=t0(t,a),o=t0(e,a),(s||o)&&(!s||!o||s.configurable!==o.configurable||s.enumerable!==o.enumerable||s.writable!==o.writable)))return!1;return!0}function m3(t,e){return wr(t.valueOf(),e.valueOf())}function g3(t,e){return t.source===e.source&&t.flags===e.flags}function i0(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),a=t.values();let s,o;for(;(s=a.next())&&!s.done;){const l=e.values();let u=!1,c=0;for(;(o=l.next())&&!o.done;){if(!i[c]&&n.equals(s.value,o.value,s.value,o.value,t,e,n)){u=i[c]=!0;break}c++}if(!u)return!1}return!0}function Ms(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function b3(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function xN(t,e,n,r){return(r===s3||r===a3||r===i3)&&(t.$$typeof||e.$$typeof)?!0:r3(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const E3="[object ArrayBuffer]",y3="[object Arguments]",T3="[object Boolean]",S3="[object DataView]",A3="[object Date]",k3="[object Error]",x3="[object Map]",v3="[object Number]",C3="[object Object]",N3="[object RegExp]",_3="[object Set]",I3="[object String]",w3={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},R3="[object URL]",O3=Object.prototype.toString;function L3({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:s,areNumbersEqual:o,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:h}){return function(b,E,y){if(b===E)return!0;if(b==null||E==null)return!1;const S=typeof b;if(S!==typeof E)return!1;if(S!=="object")return S==="number"?o(b,E,y):S==="function"?a(b,E,y):!1;const k=b.constructor;if(k!==E.constructor)return!1;if(k===Object)return l(b,E,y);if(Array.isArray(b))return e(b,E,y);if(k===Date)return r(b,E,y);if(k===RegExp)return c(b,E,y);if(k===Map)return s(b,E,y);if(k===Set)return d(b,E,y);const x=O3.call(b);if(x===A3)return r(b,E,y);if(x===N3)return c(b,E,y);if(x===x3)return s(b,E,y);if(x===_3)return d(b,E,y);if(x===C3)return typeof b.then!="function"&&typeof E.then!="function"&&l(b,E,y);if(x===R3)return p(b,E,y);if(x===k3)return i(b,E,y);if(x===y3)return l(b,E,y);if(w3[x])return f(b,E,y);if(x===E3)return t(b,E,y);if(x===S3)return n(b,E,y);if(x===T3||x===v3||x===I3)return u(b,E,y);if(h){let A=h[x];if(!A){const v=n3(b);v&&(A=h[v])}if(A)return A(b,E,y)}return!1}}function D3({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:o3,areArraysEqual:n?xi:l3,areDataViewsEqual:u3,areDatesEqual:c3,areErrorsEqual:d3,areFunctionsEqual:p3,areMapsEqual:n?Ml(r0,xi):r0,areNumbersEqual:f3,areObjectsEqual:n?xi:h3,arePrimitiveWrappersEqual:m3,areRegExpsEqual:g3,areSetsEqual:n?Ml(i0,xi):i0,areTypedArraysEqual:n?Ml(Ms,xi):Ms,areUrlsEqual:b3,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=Va(r.areArraysEqual),a=Va(r.areMapsEqual),s=Va(r.areObjectsEqual),o=Va(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:s,areSetsEqual:o})}return r}function M3(t){return function(e,n,r,i,a,s,o){return t(e,n,o)}}function P3({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(o,l){const{cache:u=t?new WeakMap:void 0,meta:c}=n();return e(o,l,{cache:u,equals:r,meta:c,strict:i})};if(t)return function(o,l){return e(o,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const a={cache:void 0,equals:r,meta:void 0,strict:i};return function(o,l){return e(o,l,a)}}const F3=nr();nr({strict:!0});nr({circular:!0});nr({circular:!0,strict:!0});nr({createInternalComparator:()=>wr});nr({strict:!0,createInternalComparator:()=>wr});nr({circular:!0,createInternalComparator:()=>wr});nr({circular:!0,createInternalComparator:()=>wr,strict:!0});function nr(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,a=D3(t),s=L3(a),o=n?n(s):M3(s);return P3({circular:e,comparator:s,createState:r,equals:o,strict:i})}var B3=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},U3=({contentComponent:t})=>{const e=Wx.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return T.jsx(T.Fragment,{children:Object.values(e)})};function H3(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Yw.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var $3=class extends Et.Component{constructor(t){var e;super(t),this.editorContentRef=Et.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=H3(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return T.jsxs(T.Fragment,{children:[T.jsx("div",{ref:B3(e,this.editorContentRef),...n}),t?.contentComponent&&T.jsx(U3,{contentComponent:t.contentComponent})]})}},z3=P.forwardRef((t,e)=>{const n=Et.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Et.createElement($3,{key:n,innerRef:e,...t})}),Fg=Et.memo(z3),j3=typeof window<"u"?P.useLayoutEffect:P.useEffect,q3=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function G3(t){var e;const[n]=P.useState(()=>new q3(t.editor)),r=Ww.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:F3);return j3(()=>n.watch(t.editor),[t.editor,n]),P.useDebugValue(r),r}var V3=!1,Sm=typeof window>"u",W3=Sm||!!(typeof window<"u"&&window.next),Y3=class vN{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Sm||W3?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onBeforeCreate)==null?void 0:a.call(i,...r)},onBlur:(...r)=>{var i,a;return(a=(i=this.options.current).onBlur)==null?void 0:a.call(i,...r)},onCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onCreate)==null?void 0:a.call(i,...r)},onDestroy:(...r)=>{var i,a;return(a=(i=this.options.current).onDestroy)==null?void 0:a.call(i,...r)},onFocus:(...r)=>{var i,a;return(a=(i=this.options.current).onFocus)==null?void 0:a.call(i,...r)},onSelectionUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onSelectionUpdate)==null?void 0:a.call(i,...r)},onTransaction:(...r)=>{var i,a;return(a=(i=this.options.current).onTransaction)==null?void 0:a.call(i,...r)},onUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onUpdate)==null?void 0:a.call(i,...r)},onContentError:(...r)=>{var i,a;return(a=(i=this.options.current).onContentError)==null?void 0:a.call(i,...r)},onDrop:(...r)=>{var i,a;return(a=(i=this.options.current).onDrop)==null?void 0:a.call(i,...r)},onPaste:(...r)=>{var i,a;return(a=(i=this.options.current).onPaste)==null?void 0:a.call(i,...r)},onDelete:(...r)=>{var i,a;return(a=(i=this.options.current).onDelete)==null?void 0:a.call(i,...r)}};return new $M(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,a)=>{var s;return i===((s=n.extensions)==null?void 0:s[a])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?vN.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function CN(t={},e=[]){const n=P.useRef(t);n.current=t;const[r]=P.useState(()=>new Y3(n)),i=Wx.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return P.useDebugValue(i),P.useEffect(r.onRender(e)),G3({editor:i,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),i}var Wo=P.createContext({editor:null});Wo.Consumer;var NN=()=>P.useContext(Wo),_N=P.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),K3=()=>P.useContext(_N),IN=Et.forwardRef((t,e)=>{const{onDragStart:n}=K3(),r=t.as||"div";return T.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function a0(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function s0(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function X3(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function Z3(t){if(a0(t)||s0(t))return!0;if(X3(t)){const e=t.type;if(e)return a0(e)||s0(e)}return!1}function Q3(){try{if(P.version)return parseInt(P.version.split(".")[0],10)>=19}catch{}return!1}var J3=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Yx.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=Q3(),a=Z3(e),s={...n};s.ref&&!(i||a)&&delete s.ref,!s.ref&&(i||a)&&(s.ref=o=>{this.ref=o}),this.reactElement=T.jsx(e,{...s}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Et.createContext({markViewContentRef:()=>{}});var eP=class extends QM{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){var a;return r==="storage"?(a=t.storage[e.name])!=null?a:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:P.createRef()};if(!this.component.displayName){const l=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,a=P.memo(l=>T.jsx(_N.Provider,{value:r,children:P.createElement(i,l)}));a.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new J3(a,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${o}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,a=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:a,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=ni(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function wN(t,e){return n=>n.editor.contentComponent?new eP(t,n,e):{}}var Bg=P.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Bg.displayName="TiptapContext";var tP=()=>P.useContext(Bg);function RN({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=P.useMemo(()=>({editor:r}),[r]),a=P.useMemo(()=>({editor:r}),[r]);return T.jsx(Wo.Provider,{value:a,children:T.jsx(Bg.Provider,{value:i,children:n})})}RN.displayName="Tiptap";function ON({...t}){const{editor:e}=tP();return T.jsx(Fg,{editor:e,...t})}ON.displayName="Tiptap.Content";Object.assign(RN,{Content:ON});function LN(t,e,n){t.chain().focus().insertContentAt(e,[DN(n),{type:"text",text:" "}]).run()}function DN(t){return{type:"mention",attrs:t}}function nP(t){const e=te.c(7),{node:n,selected:r,view:i}=t,{name:a,char:s}=n.attrs,o=r&&i.editable,u=s==="@"?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",c=o&&"outline-2 outline-blue-300 outline-offset-0";let d;e[0]!==u||e[1]!==c?(d=le("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light",u,c),e[0]=u,e[1]=c,e[2]=d):d=e[2];let f;return e[3]!==s||e[4]!==a||e[5]!==d?(f=T.jsxs(IN,{className:d,children:[s,a]}),e[3]=s,e[4]=a,e[5]=d,e[6]=f):f=e[6],f}const MN=kt.create({name:"mention",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"mention"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.char&&(n["data-char"]=t.attrs.char),t.attrs.metadata&&(n["data-metadata"]=JSON.stringify(t.attrs.metadata)),["span",{...e,...n}]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return wN(nP)}});function rP(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}function iP(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const o0=3;function aP(t){const e=te.c(23),{prompt:n,onSelect:r,isSelected:i,isDisabled:a,isLoading:s}=t,o=n.description??n.name;let l;e[0]!==r||e[1]!==n?(l=()=>r(n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const u=a||s,c=i&&"bg-accent/50 text-foreground",d=s&&"bg-accent/50 text-foreground",f=(a||s)&&"cursor-not-allowed hover:bg-accent/50";let p;e[3]!==c||e[4]!==d||e[5]!==f?(p=le("px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer flex items-center gap-1.5",c,d,f),e[3]=c,e[4]=d,e[5]=f,e[6]=p):p=e[6];const h=n.title??n.name;let g;if(e[7]!==h){let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=/_/g,e[9]=k):k=e[9],g=h.replace(k," "),e[7]=h,e[8]=g}else g=e[8];let b;e[10]!==s?(b=s&&T.jsx(vo,{size:"xs"}),e[10]=s,e[11]=b):b=e[11];let E;e[12]!==l||e[13]!==u||e[14]!==p||e[15]!==g||e[16]!==b?(E=T.jsx(Nn,{asChild:!0,children:T.jsxs("button",{type:"button",onClick:l,disabled:u,className:p,children:[g,b]})}),e[12]=l,e[13]=u,e[14]=p,e[15]=g,e[16]=b,e[17]=E):E=e[17];let y;e[18]!==o?(y=T.jsx(_n,{side:"bottom",className:"max-w-xs",children:T.jsx("p",{className:"text-xs",children:o})}),e[18]=o,e[19]=y):y=e[19];let S;return e[20]!==E||e[21]!==y?(S=T.jsxs(Cn,{children:[E,y]}),e[20]=E,e[21]=y,e[22]=S):S=e[22],S}function sP(t){const e=te.c(23),{prompts:n,onSelect:r,loadingPrompt:i,className:a}=t;if(n.length===0)return null;let s,o,l,u,c;if(e[0]!==a||e[1]!==i||e[2]!==r||e[3]!==n){const p=n.slice(0,o0),h=n.slice(o0),g=h.length>0,b=!!i;s=Co,c=300,e[9]!==a?(o=le("flex flex-wrap items-center justify-center gap-2",a),e[9]=a,e[10]=o):o=e[10];let E;e[11]!==b||e[12]!==i?.name||e[13]!==r?(E=y=>T.jsx(aP,{prompt:y,onSelect:r,isLoading:i?.name===y.name,isDisabled:b&&i?.name!==y.name},y.name),e[11]=b,e[12]=i?.name,e[13]=r,e[14]=E):E=e[14],l=p.map(E),u=g&&T.jsxs(ci,{children:[T.jsx(di,{asChild:!0,children:T.jsxs("button",{type:"button",disabled:b,className:le("size-7 flex items-center justify-center text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer",b&&"opacity-60 cursor-not-allowed"),children:["+",h.length]})}),T.jsx(pi,{side:"bottom",align:"center",className:"w-auto p-2",children:T.jsx("div",{className:"flex flex-col gap-1",children:h.map(y=>{const S=y.description??y.name,k=i?.name===y.name;return T.jsxs(Cn,{children:[T.jsx(Nn,{asChild:!0,children:T.jsxs("button",{type:"button",onClick:()=>r(y),disabled:b&&!k,className:le("px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent/50 rounded-md transition-colors cursor-pointer text-left flex items-center gap-1.5",k&&"bg-accent/50 text-foreground",b&&!k&&"opacity-60 cursor-not-allowed"),children:[(y.title??y.name).replace(/_/g," "),k&&T.jsx(vo,{size:"xs"})]})}),T.jsx(_n,{side:"right",className:"max-w-xs",children:T.jsx("p",{className:"text-xs",children:S})})]},y.name)})})})]}),e[0]=a,e[1]=i,e[2]=r,e[3]=n,e[4]=s,e[5]=o,e[6]=l,e[7]=u,e[8]=c}else s=e[4],o=e[5],l=e[6],u=e[7],c=e[8];let d;e[15]!==o||e[16]!==l||e[17]!==u?(d=T.jsxs("div",{className:o,children:[l,u]}),e[15]=o,e[16]=l,e[17]=u,e[18]=d):d=e[18];let f;return e[19]!==s||e[20]!==c||e[21]!==d?(f=T.jsx(s,{delayDuration:c,children:d}),e[19]=s,e[20]=c,e[21]=d,e[22]=f):f=e[22],f}function oP(){const t=te.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=T.jsxs(T.Fragment,{children:[T.jsx(jb,{className:"h-6 w-20 rounded-full border border-border"}),T.jsx(jb,{className:"h-6 w-24 rounded-full border border-border"})]}),t[0]=e):e=t[0],e}function lP(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function uP(t){const e=te.c(28),{connectionId:n}=t,{tiptapDoc:r,sendMessage:i}=Nr(),{org:a}=ui();let s;e[0]!==n||e[1]!==a.id?(s={connectionId:n,orgId:a.id},e[0]=n,e[1]=a.id,e[2]=s):s=e[2];const o=ig(s);let l;e[3]!==o?(l={client:o,staleTime:6e4},e[3]=o,e[4]=l):l=e[4];const{data:u}=bR(l);let c;e[5]!==u?.prompts?(c=u?.prompts??[],e[5]=u?.prompts,e[6]=c):c=e[6];const d=c;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[7]=f):f=e[7];const[p,h]=P.useReducer(lP,f),[g,b]=P.useState(null);let E;e[8]!==o||e[9]!==i||e[10]!==r?(E=async(M,z)=>{if(!o){kn.error("MCP client not available"),h({type:"RESET"});return}try{const F=await iv(o,M.name,z);h({type:"RESET"});const B=iP(r,{type:"paragraph",content:[DN({id:M.name,name:M.name,metadata:F.messages,char:"/"})]});await i(B)}catch(F){console.error("[ice-breakers] Failed to fetch prompt:",F),kn.error("Failed to load prompt. Please try again."),h({type:"RESET"})}},e[8]=o,e[9]=i,e[10]=r,e[11]=E):E=e[11];const y=E;let S;e[12]!==y?(S=async M=>{if(M.arguments&&M.arguments.length>0){h({type:"SELECT_PROMPT",prompt:M}),b(M);return}h({type:"START_LOADING",prompt:M}),await y(M)},e[12]=y,e[13]=S):S=e[13];const k=S;let x;e[14]!==g||e[15]!==y?(x=async M=>{g&&(h({type:"START_LOADING",prompt:g,arguments:M}),b(null),await y(g,M))},e[14]=g,e[15]=y,e[16]=x):x=e[16];const A=x;if(d.length===0)return null;const v=p.stage==="loading"?p.prompt:null;let w;e[17]!==k||e[18]!==d||e[19]!==v?(w=T.jsx(sP,{prompts:d,onSelect:k,loadingPrompt:v}),e[17]=k,e[18]=d,e[19]=v,e[20]=w):w=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{b(null),h({type:"RESET"})},e[21]=_):_=e[21];let C;e[22]!==g||e[23]!==A?(C=T.jsx(gv,{prompt:g,setPrompt:_,onSubmit:A}),e[22]=g,e[23]=A,e[24]=C):C=e[24];let L;return e[25]!==C||e[26]!==w?(L=T.jsxs("div",{className:"relative w-full",children:[w,C]}),e[25]=C,e[26]=w,e[27]=L):L=e[27],L}function cP(t){const e=te.c(14),{className:n}=t,{selectedVirtualMcp:r}=Nr(),{org:i}=ui();let a;e[0]!==i.id?(a=rv(i.id),e[0]=i.id,e[1]=a):a=e[1];const s=a.id,o=r?.id??s;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={minHeight:"32px"},e[2]=l):l=e[2];let u;e[3]!==n?(u=le("flex flex-wrap items-center justify-center gap-2",n),e[3]=n,e[4]=u):u=e[4];const c=o??"default";let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=T.jsx(oP,{}),e[5]=d):d=e[5];let f;e[6]!==o?(f=T.jsx(uP,{connectionId:o}),e[6]=o,e[7]=f):f=e[7];let p;e[8]!==c||e[9]!==f?(p=T.jsx(yR,{fallback:null,children:T.jsx(P.Suspense,{fallback:d,children:f},c)}),e[8]=c,e[9]=f,e[10]=p):p=e[10];let h;return e[11]!==u||e[12]!==p?(h=T.jsx("div",{style:l,className:u,children:p}),e[11]=u,e[12]=p,e[13]=h):h=e[13],h}const l0=[{border:"border-purple-400",bg:"bg-purple-400",text:"text-white",bgLight:"bg-purple-400/10"},{border:"border-blue-400",bg:"bg-blue-400",text:"text-white",bgLight:"bg-blue-400/10"},{border:"border-indigo-400",bg:"bg-indigo-400",text:"text-white",bgLight:"bg-indigo-400/10"},{border:"border-violet-400",bg:"bg-violet-400",text:"text-white",bgLight:"bg-violet-400/10"},{border:"border-pink-400",bg:"bg-pink-400",text:"text-white",bgLight:"bg-pink-400/10"},{border:"border-fuchsia-400",bg:"bg-fuchsia-400",text:"text-white",bgLight:"bg-fuchsia-400/10"},{border:"border-emerald-400",bg:"bg-emerald-400",text:"text-white",bgLight:"bg-emerald-400/10"},{border:"border-teal-400",bg:"bg-teal-400",text:"text-white",bgLight:"bg-teal-400/10"},{border:"border-cyan-400",bg:"bg-cyan-400",text:"text-white",bgLight:"bg-cyan-400/10"},{border:"border-sky-400",bg:"bg-sky-400",text:"text-white",bgLight:"bg-sky-400/10"},{border:"border-orange-400",bg:"bg-orange-400",text:"text-white",bgLight:"bg-orange-400/10"},{border:"border-amber-400",bg:"bg-amber-400",text:"text-white",bgLight:"bg-amber-400/10"},{border:"border-rose-400",bg:"bg-rose-400",text:"text-white",bgLight:"bg-rose-400/10"},{border:"border-lime-400",bg:"bg-lime-400",text:"text-white",bgLight:"bg-lime-400/10"}];function dP(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return Math.abs(e)}function PN(t){if(t==null)return null;const n=dP(t)%l0.length;return l0[n]}const u0=li({response:ys().min(1,"Response is required")}),pP=li({response:ys().min(1,"Please select or enter an option")}),fP=li({response:Kw(["yes","no"])});function hP(t){switch(t.type){case"text":return u0;case"choice":return pP;case"confirm":return fP;default:return u0}}function mP(t){const e={};for(const n of t)e[n.toolCallId]=hP(n.input);return li(e)}function gP(t){const e=te.c(6),{control:n,name:r,placeholder:i}=t;let a;e[0]!==i?(a=o=>{const{field:l}=o;return T.jsxs(Io,{children:[T.jsx(wo,{children:T.jsx("div",{className:"px-2",children:T.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[T.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:T.jsx(lg,{size:16,className:"text-muted-foreground"})}),T.jsx("input",{...l,type:"text",placeholder:i||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),T.jsx(Ro,{})]})},e[0]=i,e[1]=a):a=e[1];let s;return e[2]!==n||e[3]!==r||e[4]!==a?(s=T.jsx(_o,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=s):s=e[5],s}function bP(t){const e=te.c(10),{control:n,name:r,options:i}=t,[a,s]=P.useState(!1),o=P.useRef(null),l=P.useRef(null);let u,c;if(e[0]!==i?(u=()=>{const p=h=>{const g=h.target.tagName;if(g==="INPUT"||g==="TEXTAREA")return;const b=Number.parseInt(h.key,10);b>=1&&b<=i.length&&l.current&&(h.preventDefault(),l.current.onChange(i[b-1]??""),s(!1))};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},c=[i],e[0]=i,e[1]=u,e[2]=c):(u=e[1],c=e[2]),P.useEffect(u,c),i.length===0)return null;let d;e[3]!==a||e[4]!==i?(d=p=>{const{field:h}=p;l.current=h;const g=a||!!h.value&&!i.includes(h.value);return T.jsxs(Io,{children:[T.jsx(wo,{children:T.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[i.map((b,E)=>{const y=h.value===b;return T.jsxs("button",{type:"button",onClick:()=>{h.onChange(b??""),s(!1)},className:le("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",y&&"bg-accent/50",!y&&"hover:bg-accent/30"),"aria-label":`Select ${b}`,children:[T.jsx("span",{className:le("flex items-center justify-center size-6 rounded-md text-sm shrink-0",y?"bg-chart-1 text-white":"bg-muted text-foreground"),children:E+1}),T.jsx("span",{className:"text-sm text-foreground truncate",children:b})]},`${E}-${b}`)}),T.jsxs("div",{className:le("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",g&&"bg-accent/50",!g&&"hover:bg-accent/30"),onClick:()=>{s(!0),i.includes(h.value)&&h.onChange(""),setTimeout(()=>o.current?.focus(),0)},children:[T.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:T.jsx(lg,{size:16,className:"text-muted-foreground"})}),g?T.jsx("input",{ref:o,type:"text",value:h.value,onChange:b=>h.onChange(b.target.value),placeholder:"Something else...",autoFocus:!0,"aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}):T.jsx("span",{className:"text-sm text-foreground/25",children:"Something else..."})]})]})}),T.jsx(Ro,{})]})},e[3]=a,e[4]=i,e[5]=d):d=e[5];let f;return e[6]!==n||e[7]!==r||e[8]!==d?(f=T.jsx(_o,{control:n,name:r,render:d}),e[6]=n,e[7]=r,e[8]=d,e[9]=f):f=e[9],f}function EP(t){const e=te.c(7),{control:n,name:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["yes","no"],e[0]=i):i=e[0];const a=i,s=P.useRef(null);let o,l;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{const d=f=>{const p=f.target.tagName;p==="INPUT"||p==="TEXTAREA"||(f.key==="1"&&s.current?(f.preventDefault(),s.current.onChange("yes")):f.key==="2"&&s.current&&(f.preventDefault(),s.current.onChange("no")))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},l=[],e[1]=o,e[2]=l):(o=e[1],l=e[2]),P.useEffect(o,l);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=d=>{const{field:f}=d;return s.current=f,T.jsxs(Io,{children:[T.jsx(wo,{children:T.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(p=>{const h=f.value===p;return T.jsxs("button",{type:"button",onClick:()=>f.onChange(p),className:le("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",h&&"bg-accent/50",!h&&"hover:bg-accent/30"),"aria-label":`Confirm ${p}`,children:[T.jsx("span",{className:le("flex items-center justify-center size-6 rounded-md text-sm shrink-0",h?"bg-chart-1 text-white":"bg-muted text-foreground"),children:p==="yes"?1:2}),T.jsx("span",{className:"text-sm text-foreground capitalize",children:p})]},p)})})}),T.jsx(Ro,{})]})},e[3]=u):u=e[3];let c;return e[4]!==n||e[5]!==r?(c=T.jsx(_o,{control:n,name:r,render:u}),e[4]=n,e[5]=r,e[6]=c):c=e[6],c}function c0(t){const e=te.c(13),{input:n,control:r,name:i}=t;switch(n.type){case"text":{let a;return e[0]!==r||e[1]!==n.default||e[2]!==i?(a=T.jsx(gP,{control:r,name:i,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=i,e[3]=a):a=e[3],a}case"choice":{let a;e[4]!==n.options?(a=n.options??[],e[4]=n.options,e[5]=a):a=e[5];let s;return e[6]!==r||e[7]!==i||e[8]!==a?(s=T.jsx(bP,{control:r,name:i,options:a}),e[6]=r,e[7]=i,e[8]=a,e[9]=s):s=e[9],s}case"confirm":{let a;return e[10]!==r||e[11]!==i?(a=T.jsx(EP,{control:r,name:i}),e[10]=r,e[11]=i,e[12]=a):a=e[12],a}default:return null}}function yP(t){const e=te.c(21),{current:n,total:r,onPrev:i,onNext:a}=t;if(r<=1)return null;const s=n===0,o=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let l;e[0]!==o?(l=le("p-0.5 rounded transition-colors",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=T.jsx(wR,{size:14}),e[2]=u):u=e[2];let c;e[3]!==i||e[4]!==s||e[5]!==l?(c=T.jsx("button",{type:"button",onClick:i,disabled:s,className:l,"aria-label":"Previous question",children:u}),e[3]=i,e[4]=s,e[5]=l,e[6]=c):c=e[6];const d=n+1;let f;e[7]!==d||e[8]!==r?(f=T.jsxs("span",{className:"tabular-nums text-xs",children:[d," of ",r]}),e[7]=d,e[8]=r,e[9]=f):f=e[9];const p=n===r-1,h=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==h?(g=le("p-0.5 rounded transition-colors",h),e[10]=h,e[11]=g):g=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=T.jsx(lv,{size:14}),e[12]=b):b=e[12];let E;e[13]!==a||e[14]!==g||e[15]!==p?(E=T.jsx("button",{type:"button",onClick:a,disabled:p,className:g,"aria-label":"Next question",children:b}),e[13]=a,e[14]=g,e[15]=p,e[16]=E):E=e[16];let y;return e[17]!==E||e[18]!==c||e[19]!==f?(y=T.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[c,f,E]}),e[17]=E,e[18]=c,e[19]=f,e[20]=y):y=e[20],y}function d0(t){const e=te.c(15),{title:n,children:r,footerLeft:i,footerRight:a}=t;let s;e[0]!==n?(s=T.jsx("div",{className:"flex items-center gap-2 p-4",children:T.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:n})}),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==r?(o=T.jsx("div",{className:"overflow-clip pb-4",children:r}),e[2]=r,e[3]=o):o=e[3];let l;e[4]!==i?(l=T.jsx("div",{children:i}),e[4]=i,e[5]=l):l=e[5];let u;e[6]!==a?(u=T.jsx("div",{className:"flex items-center gap-2",children:a}),e[6]=a,e[7]=u):u=e[7];let c;e[8]!==l||e[9]!==u?(c=T.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:T.jsxs("div",{className:"flex items-center justify-between",children:[l,u]})}),e[8]=l,e[9]=u,e[10]=c):c=e[10];let d;return e[11]!==s||e[12]!==o||e[13]!==c?(d=T.jsxs("div",{className:"flex flex-col rounded-xl bg-background border border-border shadow-md w-[calc(100%-16px)] max-w-[584px] mx-auto mb-[-16px]",children:[s,o,c]}),e[11]=s,e[12]=o,e[13]=c,e[14]=d):d=e[14],d}function TP({parts:t,onSubmit:e}){const[n,r]=P.useState(t[0]?.toolCallId??""),i=mP(t.map(y=>({toolCallId:y.toolCallId,input:y.input}))),a=Vx({resolver:Gx(i),defaultValues:Object.fromEntries(t.map(y=>[y.toolCallId,{response:""}]))}),s=a.watch(),o=t.findIndex(y=>y.toolCallId===n),l=!!s[n]?.response,u=t.every(y=>!!s[y.toolCallId]?.response),c=y=>{for(const S of t){const k=y[S.toolCallId]?.response;k&&e(S,k)}},d=y=>t.find(S=>!y[S.toolCallId]?.response&&S.toolCallId!==n)??null,f=()=>{const y=a.getValues();if(t.every(k=>!!y[k.toolCallId]?.response))a.handleSubmit(c)();else{const k=d(y);k&&r(k.toolCallId)}},p=()=>{a.setValue(`${n}.response`,"user has skip this question"),f()},h=()=>{if(o>0){const y=t[o-1];y&&r(y.toolCallId)}},g=()=>{if(o<t.length-1){const y=t[o+1];y&&r(y.toolCallId)}},b=T.jsxs(T.Fragment,{children:[T.jsx(qe,{type:"button",variant:"outline",size:"sm",onClick:p,className:"h-7",children:"Skip"}),T.jsx(qe,{type:"button",size:"sm",disabled:!l,onClick:f,className:le("h-7",l?"":"opacity-50"),children:u?"Submit":"Next"})]}),E=T.jsx(yP,{current:o,total:t.length,onPrev:h,onNext:g});if(t.length===1){const y=t[0];return y?.input?T.jsx(Qh,{...a,children:T.jsx("form",{onSubmit:a.handleSubmit(c),autoComplete:"off",children:T.jsx(d0,{title:y.input?.prompt??"Question",footerRight:b,children:T.jsx(c0,{input:y.input,control:a.control,name:`${y.toolCallId}.response`})})})}):null}return T.jsx(Qh,{...a,children:T.jsx("form",{onSubmit:a.handleSubmit(c),autoComplete:"off",children:T.jsx(uR,{value:n,onValueChange:r,children:t.map(y=>T.jsx(cR,{value:y.toolCallId,className:"mt-0",children:T.jsx(d0,{title:y.input?.prompt??"Question",footerLeft:E,footerRight:b,children:T.jsx(c0,{input:y.input,control:a.control,name:`${y.toolCallId}.response`})})},y.toolCallId))})})})}function SP(){const t=te.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=T.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[T.jsx(Ss,{className:"size-5 text-muted-foreground shimmer"}),T.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function FN(t){const e=te.c(6),{userAskParts:n,isStreaming:r,onSubmit:i}=t;let a;e[0]!==n?(a=n.filter(AP),e[0]=n,e[1]=a):a=e[1];const s=a;if(r){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=T.jsx(SP,{}),e[2]=l):l=e[2],l}if(s.length===0)return null;let o;return e[3]!==i||e[4]!==s?(o=T.jsx(TP,{parts:s,onSubmit:i}),e[3]=i,e[4]=s,e[5]=o):o=e[5],o}function AP(t){return t.state==="input-available"}const kP={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function Ps(t){const e=te.c(32),{variant:n,onDismiss:r}=t,i=n==="error",a=i?"Error occurred":"Response incomplete",s=i?t.error.message:kP[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,o=i?"border-destructive/30 bg-destructive/5":"border-amber-500/30 bg-amber-500/5",l=i?"text-destructive":"text-amber-600 dark:text-amber-500",u=i?Oo:TR;let c;e[0]!==o?(c=le("flex items-start gap-2 px-3 py-2.5 rounded-lg border border-dashed text-sm w-full mb-2",o),e[0]=o,e[1]=c):c=e[1];let d;e[2]!==l?(d=le("mt-0.5 shrink-0",l),e[2]=l,e[3]=d):d=e[3];let f;e[4]!==u?(f=T.jsx(u,{size:16}),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==d||e[7]!==f?(p=T.jsx("div",{className:d,children:f}),e[6]=d,e[7]=f,e[8]=p):p=e[8];let h;e[9]!==l?(h=le("text-xs mb-1 font-medium",l),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==h||e[12]!==a?(g=T.jsx("div",{className:h,children:a}),e[11]=h,e[12]=a,e[13]=g):g=e[13];let b;e[14]!==s?(b=T.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground mb-2",children:s}),e[14]=s,e[15]=b):b=e[15];let E;e[16]!==i||e[17]!==t.onContinue||e[18]!==t.onFixInChat?(E=T.jsx("div",{className:"flex gap-2",children:i?T.jsxs(T.Fragment,{children:[T.jsx(qe,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}),T.jsx(qe,{size:"sm",variant:"outline",disabled:!0,className:"h-7 text-xs",children:"Report"})]}):T.jsx(qe,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"})}),e[16]=i,e[17]=t.onContinue,e[18]=t.onFixInChat,e[19]=E):E=e[19];let y;e[20]!==g||e[21]!==b||e[22]!==E?(y=T.jsxs("div",{className:"flex-1 min-w-0",children:[g,b,E]}),e[20]=g,e[21]=b,e[22]=E,e[23]=y):y=e[23];let S;e[24]===Symbol.for("react.memo_cache_sentinel")?(S=T.jsx(IR,{size:14}),e[24]=S):S=e[24];let k;e[25]!==r?(k=T.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Dismiss",children:S}),e[25]=r,e[26]=k):k=e[26];let x;return e[27]!==c||e[28]!==k||e[29]!==p||e[30]!==y?(x=T.jsxs("div",{className:c,children:[p,y,k]}),e[27]=c,e[28]=k,e[29]=p,e[30]=y,e[31]=x):x=e[31],x}function Yo(){const t=te.c(23),{error:e,clearError:n,finishReason:r,clearFinishReason:i,messages:a,isStreaming:s,addToolOutput:o,sendMessage:l}=Nr();let u,c;if(t[0]!==a){const k=a.at(-1);c=k?.role==="assistant"?k.parts.filter(vP):null,u=c?.filter(xP)?.length,t[0]=a,t[1]=u,t[2]=c}else u=t[1],c=t[2];const d=u;let f;t[3]!==e||t[4]!==l?(f=()=>{if(e){const x={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};l(x)}},t[3]=e,t[4]=l,t[5]=f):f=t[5];const p=f;let h;t[6]!==l?(h=()=>{l({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[6]=l,t[7]=h):h=t[7];const g=h;let b;t[8]!==o?(b=(k,x)=>{o({tool:"user_ask",toolCallId:k.toolCallId,output:{response:x}})},t[8]=o,t[9]=b):b=t[9];const E=b;let y;t[10]!==n||t[11]!==i||t[12]!==e||t[13]!==r||t[14]!==g||t[15]!==p||t[16]!==E||t[17]!==s||t[18]!==d||t[19]!==c?(y=d?T.jsx(FN,{userAskParts:c,isStreaming:s,onSubmit:E}):s?null:e?T.jsx(Ps,{variant:"error",error:e,onDismiss:n,onFixInChat:p}):r&&r!=="stop"?T.jsx(Ps,{variant:"warning",finishReason:r,onDismiss:i,onContinue:g}):null,t[10]=n,t[11]=i,t[12]=e,t[13]=r,t[14]=g,t[15]=p,t[16]=E,t[17]=s,t[18]=d,t[19]=c,t[20]=y):y=t[20];let S;return t[21]!==y?(S=T.jsx("div",{className:"flex flex-col w-full",children:y}),t[21]=y,t[22]=S):S=t[22],S}function xP(t){return t.state!=="output-available"}function vP(t){return t.type==="tool-user_ask"}Yo.Error=function(e){return T.jsx(Ps,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Yo.Warning=function(e){return T.jsx(Ps,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Yo.UserAskQuestion=FN;const Fs={passthrough:{label:"Direct access",description:"Best for small teams or when you need predictable behavior",icon:pR},smart_tool_selection:{label:"Smart discovery",description:"Ideal for large teams with many tools - AI finds what it needs",icon:dR},code_execution:{label:"Smart execution",description:"Maximum flexibility - AI can write code to orchestrate tools",icon:OR,recommended:!0}};function CP(t){const e=te.c(24),{mode:n,isSelected:r,onSelect:i}=t,a=Fs[n],s=a.icon,o=r&&"bg-accent";let l;e[0]!==o?(l=le("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-lg transition-colors",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]!==s?(u=T.jsx("div",{className:"p-1.5 shrink-0 rounded-md bg-muted",children:T.jsx(s,{className:"size-4 text-muted-foreground"})}),e[2]=s,e[3]=u):u=e[3];let c;e[4]!==a.label?(c=T.jsx("span",{className:"text-sm font-medium text-foreground",children:a.label}),e[4]=a.label,e[5]=c):c=e[5];let d;e[6]!==a.recommended?(d=a.recommended&&T.jsx(RR,{variant:"outline",className:"text-xs",children:"Recommended"}),e[6]=a.recommended,e[7]=d):d=e[7];let f;e[8]!==r?(f=r&&T.jsx(va,{size:16,className:"text-foreground shrink-0 ml-auto"}),e[8]=r,e[9]=f):f=e[9];let p;e[10]!==c||e[11]!==d||e[12]!==f?(p=T.jsxs("div",{className:"flex items-center gap-2",children:[c,d,f]}),e[10]=c,e[11]=d,e[12]=f,e[13]=p):p=e[13];let h;e[14]!==a.description?(h=T.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:a.description}),e[14]=a.description,e[15]=h):h=e[15];let g;e[16]!==p||e[17]!==h?(g=T.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[p,h]}),e[16]=p,e[17]=h,e[18]=g):g=e[18];let b;return e[19]!==i||e[20]!==l||e[21]!==u||e[22]!==g?(b=T.jsxs("div",{onClick:i,className:l,children:[u,g]}),e[19]=i,e[20]=l,e[21]=u,e[22]=g,e[23]=b):b=e[23],b}function NP(t){const e=te.c(13),{mode:n,placeholder:r}=t,i=r===void 0?"Select mode":r;if(!n){let d;e[0]!==i?(d=T.jsx("span",{className:"text-sm text-muted-foreground",children:i}),e[0]=i,e[1]=d):d=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=T.jsx(Jh,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=f):f=e[2];let p;return e[3]!==d?(p=T.jsxs("div",{className:"flex items-center gap-1.5",children:[d,f]}),e[3]=d,e[4]=p):p=e[4],p}const a=Fs[n],s=a.icon;let o;e[5]!==s?(o=T.jsx(s,{className:"size-4 text-muted-foreground shrink-0"}),e[5]=s,e[6]=o):o=e[6];let l;e[7]!==a.label?(l=T.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",children:a.label}),e[7]=a.label,e[8]=l):l=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=T.jsx(Jh,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[9]=u):u=e[9];let c;return e[10]!==o||e[11]!==l?(c=T.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[o,l,u]}),e[10]=o,e[11]=l,e[12]=c):c=e[12],c}function _P(t){const e=te.c(28),{selectedMode:n,onModeChange:r,variant:i,className:a,placeholder:s,disabled:o}=t,l=i===void 0?"borderless":i,u=s===void 0?"Mode":s,c=o===void 0?!1:o,[d,f]=P.useState(!1);let p;e[0]!==r?(p=z=>{r(z),f(!1)},e[0]=r,e[1]=p):p=e[1];const h=p,g=c?!1:d,b=l==="borderless"?"ghost":"outline",E=l==="borderless"&&"md:border-none",y=c&&"cursor-not-allowed opacity-50";let S;e[2]!==a||e[3]!==E||e[4]!==y?(S=le("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",E,y,a),e[2]=a,e[3]=E,e[4]=y,e[5]=S):S=e[5];const k=d?"open":"closed";let x;e[6]!==u||e[7]!==n?(x=T.jsx(NP,{mode:n,placeholder:u}),e[6]=u,e[7]=n,e[8]=x):x=e[8];let A;e[9]!==c||e[10]!==k||e[11]!==x||e[12]!==b||e[13]!==S?(A=T.jsx(Nn,{asChild:!0,children:T.jsx(di,{asChild:!0,children:T.jsx(qe,{variant:b,size:"sm",className:S,disabled:c,"data-state":k,children:x})})}),e[9]=c,e[10]=k,e[11]=x,e[12]=b,e[13]=S,e[14]=A):A=e[14];const v=Fs[n]?.description??"Choose agent mode";let w;e[15]!==v?(w=T.jsx(_n,{side:"top",className:"text-xs",children:v}),e[15]=v,e[16]=w):w=e[16];let _;e[17]!==A||e[18]!==w?(_=T.jsx(Co,{children:T.jsxs(Cn,{children:[A,w]})}),e[17]=A,e[18]=w,e[19]=_):_=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=Object.keys(Fs),e[20]=C):C=e[20];let L;e[21]!==h||e[22]!==n?(L=T.jsx(pi,{className:"w-[350px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:T.jsx("div",{className:"flex flex-col p-1",children:C.map(z=>T.jsx(CP,{mode:z,isSelected:z===n,onSelect:()=>h(z)},z))})}),e[21]=h,e[22]=n,e[23]=L):L=e[23];let M;return e[24]!==_||e[25]!==L||e[26]!==g?(M=T.jsxs(ci,{open:g,onOpenChange:f,children:[_,L]}),e[24]=_,e[25]=L,e[26]=g,e[27]=M):M=e[27],M}function IP(t){const e=te.c(24),{virtualMcp:n,isSelected:r}=t,i=r&&"bg-accent";let a;e[0]!==i?(a=le("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl transition-colors",i),e[0]=i,e[1]=a):a=e[1];let s;e[2]!==n.fallbackIcon?(s=n.fallbackIcon??T.jsx(sa,{}),e[2]=n.fallbackIcon,e[3]=s):s=e[3];let o;e[4]!==s||e[5]!==n.icon||e[6]!==n.title?(o=T.jsx(No,{icon:n.icon,name:n.title,size:"sm",fallbackIcon:s,className:"rounded-xl border border-border shadow-sm shrink-0 aspect-square"}),e[4]=s,e[5]=n.icon,e[6]=n.title,e[7]=o):o=e[7];let l;e[8]!==n.title?(l=T.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]!==r?(u=r&&T.jsx(va,{size:16,className:"text-foreground shrink-0"}),e[10]=r,e[11]=u):u=e[11];let c;e[12]!==l||e[13]!==u?(c=T.jsxs("div",{className:"flex items-center justify-between",children:[l,u]}),e[12]=l,e[13]=u,e[14]=c):c=e[14];let d;e[15]!==n.description?(d=n.description&&T.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:n.description}),e[15]=n.description,e[16]=d):d=e[16];let f;e[17]!==c||e[18]!==d?(f=T.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[c,d]}),e[17]=c,e[18]=d,e[19]=f):f=e[19];let p;return e[20]!==a||e[21]!==o||e[22]!==f?(p=T.jsxs("div",{className:a,children:[o,f]}),e[20]=a,e[21]=o,e[22]=f,e[23]=p):p=e[23],p}function Ug(t){const e=te.c(33),{virtualMcps:n,selectedVirtualMcpId:r,onVirtualMcpChange:i,searchInputRef:a}=t,[s,o]=P.useState(""),l=P.useRef(null),u=a??l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={navigateOnCreate:!0},e[0]=c):c=e[0];const{createVirtualMCP:d,isCreating:f}=DR(c);let p,h,g,b;if(e[1]!==d||e[2]!==u||e[3]!==f||e[4]!==i||e[5]!==s||e[6]!==r||e[7]!==n){let S;e:{const M=n.filter(wP);if(!s.trim()){S=M;break e}const z=s.toLowerCase();S=M.filter(F=>F.title.toLowerCase().includes(z)||F.description?.toLowerCase().includes(z))}const k=S;let x;e[12]!==i?(x=M=>{i(M),o("")},e[12]=i,e[13]=x):x=e[13];const A=x;g="flex flex-col max-h-[400px]";let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=T.jsx(sv,{size:16,className:"text-muted-foreground pointer-events-none shrink-0"}),e[14]=v):v=e[14];let w;e[15]===Symbol.for("react.memo_cache_sentinel")?(w=M=>o(M.target.value),e[15]=w):w=e[15];let _;e[16]!==u||e[17]!==s?(_=T.jsx(av,{ref:u,type:"text",placeholder:"Search for an agent...",value:s,onChange:w,className:"flex-1 h-8 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none p-0"}),e[16]=u,e[17]=s,e[18]=_):_=e[18];const C=f?"Creating...":"Create Agent";let L;e[19]!==d||e[20]!==f||e[21]!==C?(L=T.jsx(qe,{onClick:d,variant:"outline",size:"sm",className:"h-8 px-3 rounded-lg text-sm font-medium shrink-0",disabled:f,children:C}),e[19]=d,e[20]=f,e[21]=C,e[22]=L):L=e[22],e[23]!==_||e[24]!==L?(b=T.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:T.jsxs("div",{className:"relative flex items-center gap-2",children:[v,_,L]})}),e[23]=_,e[24]=L,e[25]=b):b=e[25],p="overflow-y-auto p-1.5",h=k.length>0?T.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:k.map(M=>T.jsx("div",{role:"button",tabIndex:0,onClick:()=>A(M.id),onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),A(M.id))},className:"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl",children:T.jsx(IP,{virtualMcp:M,isSelected:M.id===r})},M.id))}):T.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No agents found"}),e[1]=d,e[2]=u,e[3]=f,e[4]=i,e[5]=s,e[6]=r,e[7]=n,e[8]=p,e[9]=h,e[10]=g,e[11]=b}else p=e[8],h=e[9],g=e[10],b=e[11];let E;e[26]!==p||e[27]!==h?(E=T.jsx("div",{className:p,children:h}),e[26]=p,e[27]=h,e[28]=E):E=e[28];let y;return e[29]!==g||e[30]!==b||e[31]!==E?(y=T.jsxs("div",{className:g,children:[b,E]}),e[29]=g,e[30]=b,e[31]=E,e[32]=y):y=e[32],y}function wP(t){return!t.id||!Xr(t.id)}function RP(t){const e=te.c(37),{selectedVirtualMcpId:n,onVirtualMcpChange:r,virtualMcps:i,className:a,placeholder:s,showTooltip:o,disabled:l}=t,u=s===void 0?"Select Agent":s,c=o===void 0?!0:o,d=l===void 0?!1:l,[f,p]=P.useState(!1),h=P.useRef(null),g=LR(),b=i??g;let E;e[0]!==b?(E=b.filter(OP),e[0]=b,e[1]=E):E=e[1];const y=E;let S;e[2]!==b||e[3]!==n?(S=n?b.find(Y=>Y.id===n):null,e[2]=b,e[3]=n,e[4]=S):S=e[4];const k=S;let x;e[5]!==r?(x=Y=>{r(Y),p(!1)},e[5]=r,e[6]=x):x=e[6];const A=x;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=Y=>{p(Y)},e[7]=v):v=e[7];const w=v;let _,C;e[8]!==f?(_=()=>{f&&setTimeout(()=>{h.current?.focus()},0)},C=[f],e[8]=f,e[9]=_,e[10]=C):(_=e[9],C=e[10]),P.useEffect(_,C);const L=d?!1:f,M=d?void 0:w,z=d?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-accent";let F;e[11]!==a||e[12]!==z?(F=le("flex items-center justify-center size-8 rounded-full transition-colors shrink-0",z,a),e[11]=a,e[12]=z,e[13]=F):F=e[13];let B;e[14]!==k?(B=k?T.jsx(No,{icon:k.icon,name:k.title,size:"xs",fallbackIcon:T.jsx(sa,{size:16}),className:"rounded-md shrink-0 aspect-square"}):T.jsx(sa,{size:16}),e[14]=k,e[15]=B):B=e[15];let $;e[16]!==d||e[17]!==u||e[18]!==F||e[19]!==B?($=T.jsx(Nn,{asChild:!0,children:T.jsx(di,{asChild:!0,children:T.jsx("button",{type:"button",disabled:d,className:F,"aria-label":u,children:B})})}),e[16]=d,e[17]=u,e[18]=F,e[19]=B,e[20]=$):$=e[20];let G;e[21]!==f||e[22]!==k?.title||e[23]!==c?(G=c&&!f&&T.jsx(_n,{side:"top",className:"text-xs",children:k?.title??"Choose an agent to chat with"}),e[21]=f,e[22]=k?.title,e[23]=c,e[24]=G):G=e[24];let H;e[25]!==$||e[26]!==G?(H=T.jsx(Co,{children:T.jsxs(Cn,{children:[$,G]})}),e[25]=$,e[26]=G,e[27]=H):H=e[27];let Z;e[28]!==A||e[29]!==n||e[30]!==y?(Z=T.jsx(pi,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:T.jsx(Ug,{virtualMcps:y,selectedVirtualMcpId:n,onVirtualMcpChange:A,searchInputRef:h})}),e[28]=A,e[29]=n,e[30]=y,e[31]=Z):Z=e[31];let I;return e[32]!==L||e[33]!==M||e[34]!==H||e[35]!==Z?(I=T.jsxs(ci,{open:L,onOpenChange:M,children:[H,Z]}),e[32]=L,e[33]=M,e[34]=H,e[35]=Z,e[36]=I):I=e[36],I}function OP(t){return!t.id||!Xr(t.id)}function LP(t,e,n){t.chain().focus().insertContentAt(e,[DP(n),{type:"text",text:" "}]).run()}function DP(t){return{type:"file",attrs:t}}function MP(t){const e=te.c(17),{node:n,selected:r,view:i}=t,{name:a,mimeType:s,data:o}=n.attrs,l=r&&i.editable;let u;e[0]!==s?(u=s.startsWith("image/"),e[0]=s,e[1]=u):u=e[1];const c=u,d=l&&"outline-2 outline-blue-300 outline-offset-0";let f;e[2]!==d?(f=le("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",d),e[2]=d,e[3]=f):f=e[3];let p;e[4]!==a?(p=T.jsx(Nn,{asChild:!0,children:T.jsx("span",{children:a})}),e[4]=a,e[5]=p):p=e[5];let h;e[6]!==o||e[7]!==c||e[8]!==s||e[9]!==a?(h=T.jsx(_n,{side:"top",className:"max-w-sm",children:c?T.jsx("img",{src:`data:${s};base64,${o}`,alt:a,className:"max-w-full max-h-64 object-contain rounded"}):T.jsxs("div",{className:"text-xs",children:[T.jsx("div",{className:"font-medium",children:a}),T.jsx("div",{className:"text-muted-foreground mt-1",children:s})]})}),e[6]=o,e[7]=c,e[8]=s,e[9]=a,e[10]=h):h=e[10];let g;e[11]!==p||e[12]!==h?(g=T.jsxs(Cn,{children:[p,h]}),e[11]=p,e[12]=h,e[13]=g):g=e[13];let b;return e[14]!==f||e[15]!==g?(b=T.jsx(IN,{className:f,children:g}),e[14]=f,e[15]=g,e[16]=b):b=e[16],b}const BN=kt.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return wN(MP)}});async function UN(t,e,n,r){if(!Qx(e)){kn.error("Selected model does not support file uploads");return}const i=10*1024*1024;if(n.size>i){kn.error(`File "${n.name}" exceeds 10MB limit`);return}try{const a=new FileReader,s=new Promise((u,c)=>{a.onload=()=>{const d=a.result;if(typeof d!="string"){c(new Error("Failed to read file as data URL"));return}const f=d.includes(",")?d.split(",")[1]??d:d;u(f)},a.onerror=c});a.readAsDataURL(n);const o=await s,l={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:o};LP(t,{from:r,to:r},l)}catch(a){console.error("Failed to process file:",a),kn.error(`Failed to load file "${n.name}"`)}}function PP(t){const e=te.c(7),{editor:n,selectedModel:r}=t,i=P.useRef(FP);let a,s;e[0]!==n||e[1]!==r?(a=()=>{i.current=async(u,c)=>{await UN(n,r,u,c)}},s=[n,r],e[0]=n,e[1]=r,e[2]=a,e[3]=s):(a=e[2],s=e[3]),P.useEffect(a,s);let o,l;return e[4]!==n?(o=()=>{if(n?.isDestroyed)return;const u=new Pe("fileDropHandler");n.state.plugins.find(f=>f.spec.key===u)&&n.unregisterPlugin(u);const d=new Oe({key:u,props:{handleDrop:(f,p,h,g)=>{if(g)return!1;const b=p.dataTransfer?.files;if(!b||b.length===0)return!1;p.preventDefault();const E=f.posAtCoords({left:p.clientX,top:p.clientY});if(!E)return!1;const y=Array.from(b),S=E.pos;for(const k of y)i.current?.(k,S);return!0}}});return n.registerPlugin(d),()=>{n?.isDestroyed||n.unregisterPlugin(u)}},l=[n],e[4]=n,e[5]=o,e[6]=l):(o=e[5],l=e[6]),P.useEffect(o,l),null}function FP(){return Promise.resolve()}function BP(t){const e=te.c(20),{selectedModel:n,isStreaming:r}=t,{editor:i}=NN(),a=P.useRef(null);let s;e[0]!==n?(s=Qx(n),e[0]=n,e[1]=s):s=e[1];const o=s;let l;e[2]!==i||e[3]!==n?(l=async k=>{const x=k.target.files;if(!x||x.length===0||!i)return;const A=Array.from(x),{from:v}=i.state.selection,w=v;for(const _ of A)await UN(i,n,_,w);a.current&&(a.current.value="")},e[2]=i,e[3]=n,e[4]=l):l=e[4];const u=l;if(!i)return null;const c=r||!o;let d;e[5]!==u||e[6]!==c?(d=T.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:u,disabled:c}),e[5]=u,e[6]=c,e[7]=d):d=e[7];const f=r||!o;let p,h;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=()=>a.current?.click(),h=T.jsx(cv,{size:16}),e[8]=p,e[9]=h):(p=e[8],h=e[9]);let g;e[10]!==f?(g=T.jsx(Nn,{asChild:!0,children:T.jsx(qe,{type:"button",variant:"ghost",size:"icon",className:"size-8 rounded-full",disabled:f,onClick:p,children:h})}),e[10]=f,e[11]=g):g=e[11];const b=o?"Add file":"Selected model does not support files";let E;e[12]!==b?(E=T.jsx(_n,{side:"top",children:b}),e[12]=b,e[13]=E):E=e[13];let y;e[14]!==E||e[15]!==g?(y=T.jsxs(Cn,{children:[g,E]}),e[14]=E,e[15]=g,e[16]=y):y=e[16];let S;return e[17]!==y||e[18]!==d?(S=T.jsxs(T.Fragment,{children:[d,y]}),e[17]=y,e[18]=d,e[19]=S):S=e[19],S}function UP(t={}){return new Oe({view(e){return new HP(e,t)}})}class HP{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let a=s=>{this[i](s)};return e.dom.addEventListener(i,a),{name:i,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,a=i.getBoundingClientRect(),s=a.width/i.offsetWidth,o=a.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let h=p.getBoundingClientRect(),g=d?h.bottom:h.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*o;r={left:h.left,right:h.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,p=d.height/l.offsetHeight;u=d.left-l.scrollLeft*f,c=d.top-l.scrollTop*p}this.element.style.left=(r.left-u)/s+"px",this.element.style.top=(r.top-c)/o+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/o+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,a=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!a){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=jv(this.editorView.state.doc,s,this.editorView.dragging.slice);o!=null&&(s=o)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Be extends ge{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Be.valid(r)?new Be(r):ge.near(r)}content(){return ee.empty}eq(e){return e instanceof Be&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Be(e.resolve(n.pos))}getBookmark(){return new Hg(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!$P(e)||!zP(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Be.valid(e))return e;let i=e.pos,a=null;for(let s=e.depth;;s--){let o=e.node(s);if(n>0?e.indexAfter(s)<o.childCount:e.index(s)>0){a=o.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(Be.valid(l))return l}for(;;){let s=n>0?a.firstChild:a.lastChild;if(!s){if(a.isAtom&&!a.isText&&!ue.isSelectable(a)){e=e.doc.resolve(i+a.nodeSize*n),r=!1;continue e}break}a=s,i+=n;let o=e.doc.resolve(i);if(Be.valid(o))return o}return null}}}Be.prototype.visible=!1;Be.findFrom=Be.findGapCursorFrom;ge.jsonID("gapcursor",Be);class Hg{constructor(e){this.pos=e}map(e){return new Hg(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Be.valid(n)?new Be(n):ge.near(n)}}function HN(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function $P(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||HN(i.type))return!0;if(i.inlineContent)return!1}}return!0}function zP(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||HN(i.type))return!0;if(i.inlineContent)return!1}}return!0}function jP(){return new Oe({props:{decorations:WP,createSelectionBetween(t,e,n){return e.pos==n.pos&&Be.valid(n)?new Be(n):null},handleClick:GP,handleKeyDown:qP,handleDOMEvents:{beforeinput:VP}}})}const qP=qC({ArrowLeft:Wa("horiz",-1),ArrowRight:Wa("horiz",1),ArrowUp:Wa("vert",-1),ArrowDown:Wa("vert",1)});function Wa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,a){let s=r.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof fe){if(!a.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=r.doc.resolve(e>0?o.after():o.before())}let u=Be.findGapCursorFrom(o,e,l);return u?(i&&i(r.tr.setSelection(new Be(u))),!0):!1}}function GP(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Be.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&ue.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Be(r))),!0)}function VP(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Be))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=W.empty;for(let s=r.length-1;s>=0;s--)i=W.from(r[s].createAndFill(null,i));let a=t.state.tr.replace(n.pos,n.pos,new ee(i,0,0));return a.setSelection(fe.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function WP(t){if(!(t.selection instanceof Be))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(t.doc,[ot.widget(t.selection.head,e,{key:"gapcursor"})])}var Bs=200,et=function(){};et.prototype.append=function(e){return e.length?(e=et.from(e),!this.length&&e||e.length<Bs&&this.leafAppend(e)||this.length<Bs&&e.leafPrepend(this)||this.appendInner(e)):this};et.prototype.prepend=function(e){return e.length?et.from(e).append(this):this};et.prototype.appendInner=function(e){return new YP(this,e)};et.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?et.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};et.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};et.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};et.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(a,s){return i.push(e(a,s))},n,r),i};et.from=function(e){return e instanceof et?e:e&&e.length?new $N(e):et.empty};var $N=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,a){return i==0&&a==this.length?this:new e(this.values.slice(i,a))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,a,s,o){for(var l=a;l<s;l++)if(i(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,a,s,o){for(var l=a-1;l>=s;l--)if(i(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Bs)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Bs)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(et);et.empty=new $N([]);var YP=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,a,s){var o=this.left.length;if(i<o&&this.left.forEachInner(r,i,Math.min(a,o),s)===!1||a>o&&this.right.forEachInner(r,Math.max(i-o,0),Math.min(this.length,a)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,a,s){var o=this.left.length;if(i>o&&this.right.forEachInvertedInner(r,i-o,Math.max(a,o)-o,s+o)===!1||a<o&&this.left.forEachInvertedInner(r,Math.min(i,o),a,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var a=this.left.length;return i<=a?this.left.slice(r,i):r>=a?this.right.slice(r-a,i-a):this.left.slice(r,a).append(this.right.slice(0,i-a))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(et);const KP=500;class Yt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let s=e.tr,o,l,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),a=i.maps.length),a--,c.push(d);return}if(i){c.push(new tn(d.map));let p=d.step.map(i.slice(a)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],u.push(new tn(h,void 0,void 0,u.length+c.length))),a--,h&&i.appendMap(h,a)}else s.maybeStep(d.step);if(d.selection)return o=i?d.selection.map(i.slice(a)):d.selection,l=new Yt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,r,i){let a=[],s=this.eventCount,o=this.items,l=!i&&o.length?o.get(o.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new tn(e.mapping.maps[c],d,n),p;(p=l&&l.merge(f))&&(f=p,c?a.pop():o=o.slice(0,o.length-1)),a.push(f),n&&(s++,n=void 0),i||(l=f)}let u=s-r.depth;return u>ZP&&(o=XP(o,u),s-=u),new Yt(o.append(a),s)}remapping(e,n){let r=new ua;return this.items.forEach((i,a)=>{let s=i.mirrorOffset!=null&&a-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Yt(this.items.append(e.map(n=>new tn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(f=>{f.selection&&o--},i);let l=n;this.items.forEach(f=>{let p=a.getMirror(--l);if(p==null)return;s=Math.min(s,p);let h=a.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),b=f.selection&&f.selection.map(a.slice(l+1,p));b&&o++,r.push(new tn(h,g,b))}else r.push(new tn(h))},i);let u=[];for(let f=n;f<s;f++)u.push(new tn(a.maps[f]));let c=this.items.slice(0,i).append(u).append(r),d=new Yt(c,o);return d.emptyItemCount()>KP&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],a=0;return this.items.forEach((s,o)=>{if(o>=e)i.push(s),s.selection&&a++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&a++;let d=new tn(u.invert(),l,c),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new Yt(et.from(i.reverse()),a)}}Yt.empty=new Yt(et.empty,0);function XP(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class tn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new tn(n.getMap().invert(),n,this.selection)}}}class Bn{constructor(e,n,r,i,a){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=a}}const ZP=20;function QP(t,e,n,r){let i=n.getMeta(br),a;if(i)return i.historyState;n.getMeta(tF)&&(t=new Bn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(br))return s.getMeta(br).redo?new Bn(t.done.addTransform(n,void 0,r,ds(e)),t.undone,p0(n.mapping.maps),t.prevTime,t.prevComposition):new Bn(t.done,t.undone.addTransform(n,void 0,r,ds(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-r.newGroupDelay||!JP(n,t.prevRanges)),u=s?Pl(t.prevRanges,n.mapping):p0(n.mapping.maps);return new Bn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,ds(e)),Yt.empty,u,n.time,o??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Bn(t.done.rebased(n,a),t.undone.rebased(n,a),Pl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Bn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Pl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function JP(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let a=0;a<e.length;a+=2)r<=e[a+1]&&i>=e[a]&&(n=!0)}),n}function p0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,a,s)=>e.push(a,s));return e}function Pl(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),a=e.map(t[r+1],-1);i<=a&&n.push(i,a)}return n}function eF(t,e,n){let r=ds(e),i=br.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,r);if(!a)return null;let s=a.selection.resolve(a.transform.doc),o=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),i,r),l=new Bn(n?o:a.remaining,n?a.remaining:o,null,0,-1);return a.transform.setSelection(s).setMeta(br,{redo:n,historyState:l})}let Fl=!1,f0=null;function ds(t){let e=t.plugins;if(f0!=e){Fl=!1,f0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fl=!0;break}}return Fl}const br=new Pe("history"),tF=new Pe("closeHistory");function nF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Oe({key:br,state:{init(){return new Bn(Yt.empty,Yt.empty,null,0,-1)},apply(e,n,r){return QP(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?jN:r=="historyRedo"?qN:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function zN(t,e){return(n,r)=>{let i=br.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let a=eF(i,n,t);a&&r(e?a.scrollIntoView():a)}return!0}}const jN=zN(!1,!0),qN=zN(!0,!0);$e.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Oe({key:new Pe("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>i){const s=a-i,o=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(o,l);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=r||i>r&&a>r&&a<=i)return!0;if(i>r&&a>r&&a>i||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=a-r,u=o-l,c=o;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>r)}})]}});var rF=$e.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[UP(this.options)]}});$e.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Oe({key:new Pe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,a=[];if(!n||!r)return De.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,u)=>{if(l.isText)return;if(!(i>=u&&i<=u+l.nodeSize-1))return!1;s+=1});let o=0;return t.descendants((l,u)=>{if(l.isText||!(i>=u&&i<=u+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&s-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";a.push(ot.node(u,u+l.nodeSize,{class:this.options.className}))}),De.create(t,a)}}})]}});var iF=$e.create({name:"gapCursor",addProseMirrorPlugins(){return[jP()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ve(oe(t,"allowGapCursor",n)))!=null?e:null}}}),h0="placeholder";function aF(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var sF=$e.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:h0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${aF(this.options.dataAttribute)}`:`data-${h0}`;return[new Oe({key:new Pe("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;const s=this.editor.isEmpty;return e.descendants((o,l)=>{const u=i>=l&&i<=l+o.nodeSize,c=!o.isLeaf&&qo(o);if((u||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const f=ot.node(l,l+o.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:u}):this.options.placeholder});a.push(f)}return this.options.includeChildren}),De.create(e,a)}}})]}});$e.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Oe({key:new Pe("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||sN(n.selection)||t.view.dragging?null:De.create(n.doc,[ot.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function m0({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var oF=$e.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Pe(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Oe({key:e,appendTransaction:(i,a,s)=>{const{doc:o,tr:l,schema:u}=s,c=e.getState(s),d=o.content.size,f=u.nodes[n];if(c)return l.insert(d,f.create())},state:{init:(i,a)=>{const s=a.tr.doc.lastChild;return!m0({node:s,types:r})},apply:(i,a)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return a;const s=i.doc.lastChild;return!m0({node:s,types:r})}}})]}}),lF=$e.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>jN(t,e),redo:()=>({state:t,dispatch:e})=>qN(t,e)}},addProseMirrorPlugins(){return[nF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),uF=sF,Us=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},cF=/^\s*>\s$/,dF=kt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Us("blockquote",{...Ve(this.options.HTMLAttributes,t),children:Us("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(i=>{const o=e.renderChildren([i]).split(`
100
+ `)}function ZM(t,e,n={}){const{state:r}=e,{doc:i,tr:a}=r,s=t;i.descendants((o,l)=>{const u=a.mapping.map(l),c=a.mapping.map(l)+o.nodeSize;let d=null;if(o.marks.forEach(p=>{if(p!==s)return!1;d=p}),!d)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==d.attrs[p]&&(f=!0)}),f){const p=t.type.create({...t.attrs,...n});a.removeMark(u,c,t.type),a.addMark(u,c,p)}}),a.docChanged&&e.view.dispatch(a)}var kt=class kN extends Lg{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new kN(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},QM=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,a,s,o;const{view:l}=this.editor,u=t.target,c=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(u)||!c)return;let d=0,f=0;if(this.dom!==c){const y=this.dom.getBoundingClientRect(),S=c.getBoundingClientRect(),k=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,x=(s=t.offsetY)!=null?s:(a=t.nativeEvent)==null?void 0:a.offsetY;d=S.x-y.x+k,f=S.y-y.y+x}const p=this.dom.cloneNode(!0);try{const y=this.dom.getBoundingClientRect();p.style.width=`${Math.round(y.width)}px`,p.style.height=`${Math.round(y.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let h=null;try{h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(p),document.body.appendChild(h),(o=t.dataTransfer)==null||o.setDragImage(p,d,f)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=ue.create(l.state.doc,g),E=l.state.tr.setSelection(b);l.dispatch(E)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),a=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!a&&!i)return!0;const{isEditable:o}=this.editor,{isDragging:l}=this,u=!!this.node.type.spec.draggable,c=ue.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",p=t.type==="cut",h=t.type==="mousedown";if(!u&&c&&i&&t.target===this.dom&&t.preventDefault(),u&&i&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(u&&o&&!l&&h){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||a||d||f||p||h&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(ha()||gm())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function xr(t){return new OM({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const a=ve(t.getAttributes,void 0,r,i);if(a===!1||a===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];let u=n.to;if(o){const c=l.search(/\S/),d=n.from+l.indexOf(o),f=d+o.length;if(Og(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(b=>b===t.type&&b!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+o.length,s.addMark(n.from+c,u,t.type.create(a||{})),s.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:JM,getOwnPropertySymbols:e3}=Object,{hasOwnProperty:t3}=Object.prototype;function Ml(t,e){return function(r,i,a){return t(r,i,a)&&e(r,i,a)}}function Va(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:a}=i,s=a.get(n),o=a.get(r);if(s&&o)return s===r&&o===n;a.set(n,r),a.set(r,n);const l=t(n,r,i);return a.delete(n),a.delete(r),l}}function n3(t){return t?.[Symbol.toStringTag]}function e0(t){return JM(t).concat(e3(t))}const r3=Object.hasOwn||((t,e)=>t3.call(t,e));function wr(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const i3="__v",a3="__o",s3="_owner",{getOwnPropertyDescriptor:t0,keys:n0}=Object;function o3(t,e){return t.byteLength===e.byteLength&&Ms(new Uint8Array(t),new Uint8Array(e))}function l3(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function u3(t,e){return t.byteLength===e.byteLength&&Ms(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function c3(t,e){return wr(t.getTime(),e.getTime())}function d3(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function p3(t,e){return t===e}function r0(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),a=t.entries();let s,o,l=0;for(;(s=a.next())&&!s.done;){const u=e.entries();let c=!1,d=0;for(;(o=u.next())&&!o.done;){if(i[d]){d++;continue}const f=s.value,p=o.value;if(n.equals(f[0],p[0],l,d,t,e,n)&&n.equals(f[1],p[1],f[0],p[0],t,e,n)){c=i[d]=!0;break}d++}if(!c)return!1;l++}return!0}const f3=wr;function h3(t,e,n){const r=n0(t);let i=r.length;if(n0(e).length!==i)return!1;for(;i-- >0;)if(!xN(t,e,n,r[i]))return!1;return!0}function xi(t,e,n){const r=e0(t);let i=r.length;if(e0(e).length!==i)return!1;let a,s,o;for(;i-- >0;)if(a=r[i],!xN(t,e,n,a)||(s=t0(t,a),o=t0(e,a),(s||o)&&(!s||!o||s.configurable!==o.configurable||s.enumerable!==o.enumerable||s.writable!==o.writable)))return!1;return!0}function m3(t,e){return wr(t.valueOf(),e.valueOf())}function g3(t,e){return t.source===e.source&&t.flags===e.flags}function i0(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),a=t.values();let s,o;for(;(s=a.next())&&!s.done;){const l=e.values();let u=!1,c=0;for(;(o=l.next())&&!o.done;){if(!i[c]&&n.equals(s.value,o.value,s.value,o.value,t,e,n)){u=i[c]=!0;break}c++}if(!u)return!1}return!0}function Ms(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function b3(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function xN(t,e,n,r){return(r===s3||r===a3||r===i3)&&(t.$$typeof||e.$$typeof)?!0:r3(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const E3="[object ArrayBuffer]",y3="[object Arguments]",T3="[object Boolean]",S3="[object DataView]",A3="[object Date]",k3="[object Error]",x3="[object Map]",v3="[object Number]",C3="[object Object]",N3="[object RegExp]",_3="[object Set]",I3="[object String]",w3={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},R3="[object URL]",O3=Object.prototype.toString;function L3({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:s,areNumbersEqual:o,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:h}){return function(b,E,y){if(b===E)return!0;if(b==null||E==null)return!1;const S=typeof b;if(S!==typeof E)return!1;if(S!=="object")return S==="number"?o(b,E,y):S==="function"?a(b,E,y):!1;const k=b.constructor;if(k!==E.constructor)return!1;if(k===Object)return l(b,E,y);if(Array.isArray(b))return e(b,E,y);if(k===Date)return r(b,E,y);if(k===RegExp)return c(b,E,y);if(k===Map)return s(b,E,y);if(k===Set)return d(b,E,y);const x=O3.call(b);if(x===A3)return r(b,E,y);if(x===N3)return c(b,E,y);if(x===x3)return s(b,E,y);if(x===_3)return d(b,E,y);if(x===C3)return typeof b.then!="function"&&typeof E.then!="function"&&l(b,E,y);if(x===R3)return p(b,E,y);if(x===k3)return i(b,E,y);if(x===y3)return l(b,E,y);if(w3[x])return f(b,E,y);if(x===E3)return t(b,E,y);if(x===S3)return n(b,E,y);if(x===T3||x===v3||x===I3)return u(b,E,y);if(h){let A=h[x];if(!A){const v=n3(b);v&&(A=h[v])}if(A)return A(b,E,y)}return!1}}function D3({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:o3,areArraysEqual:n?xi:l3,areDataViewsEqual:u3,areDatesEqual:c3,areErrorsEqual:d3,areFunctionsEqual:p3,areMapsEqual:n?Ml(r0,xi):r0,areNumbersEqual:f3,areObjectsEqual:n?xi:h3,arePrimitiveWrappersEqual:m3,areRegExpsEqual:g3,areSetsEqual:n?Ml(i0,xi):i0,areTypedArraysEqual:n?Ml(Ms,xi):Ms,areUrlsEqual:b3,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=Va(r.areArraysEqual),a=Va(r.areMapsEqual),s=Va(r.areObjectsEqual),o=Va(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:s,areSetsEqual:o})}return r}function M3(t){return function(e,n,r,i,a,s,o){return t(e,n,o)}}function P3({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(o,l){const{cache:u=t?new WeakMap:void 0,meta:c}=n();return e(o,l,{cache:u,equals:r,meta:c,strict:i})};if(t)return function(o,l){return e(o,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const a={cache:void 0,equals:r,meta:void 0,strict:i};return function(o,l){return e(o,l,a)}}const F3=nr();nr({strict:!0});nr({circular:!0});nr({circular:!0,strict:!0});nr({createInternalComparator:()=>wr});nr({strict:!0,createInternalComparator:()=>wr});nr({circular:!0,createInternalComparator:()=>wr});nr({circular:!0,createInternalComparator:()=>wr,strict:!0});function nr(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,a=D3(t),s=L3(a),o=n?n(s):M3(s);return P3({circular:e,comparator:s,createState:r,equals:o,strict:i})}var B3=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},U3=({contentComponent:t})=>{const e=Wx.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return T.jsx(T.Fragment,{children:Object.values(e)})};function H3(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Yw.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var $3=class extends Et.Component{constructor(t){var e;super(t),this.editorContentRef=Et.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=H3(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return T.jsxs(T.Fragment,{children:[T.jsx("div",{ref:B3(e,this.editorContentRef),...n}),t?.contentComponent&&T.jsx(U3,{contentComponent:t.contentComponent})]})}},z3=P.forwardRef((t,e)=>{const n=Et.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Et.createElement($3,{key:n,innerRef:e,...t})}),Fg=Et.memo(z3),j3=typeof window<"u"?P.useLayoutEffect:P.useEffect,q3=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function G3(t){var e;const[n]=P.useState(()=>new q3(t.editor)),r=Ww.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:F3);return j3(()=>n.watch(t.editor),[t.editor,n]),P.useDebugValue(r),r}var V3=!1,Sm=typeof window>"u",W3=Sm||!!(typeof window<"u"&&window.next),Y3=class vN{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Sm||W3?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onBeforeCreate)==null?void 0:a.call(i,...r)},onBlur:(...r)=>{var i,a;return(a=(i=this.options.current).onBlur)==null?void 0:a.call(i,...r)},onCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onCreate)==null?void 0:a.call(i,...r)},onDestroy:(...r)=>{var i,a;return(a=(i=this.options.current).onDestroy)==null?void 0:a.call(i,...r)},onFocus:(...r)=>{var i,a;return(a=(i=this.options.current).onFocus)==null?void 0:a.call(i,...r)},onSelectionUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onSelectionUpdate)==null?void 0:a.call(i,...r)},onTransaction:(...r)=>{var i,a;return(a=(i=this.options.current).onTransaction)==null?void 0:a.call(i,...r)},onUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onUpdate)==null?void 0:a.call(i,...r)},onContentError:(...r)=>{var i,a;return(a=(i=this.options.current).onContentError)==null?void 0:a.call(i,...r)},onDrop:(...r)=>{var i,a;return(a=(i=this.options.current).onDrop)==null?void 0:a.call(i,...r)},onPaste:(...r)=>{var i,a;return(a=(i=this.options.current).onPaste)==null?void 0:a.call(i,...r)},onDelete:(...r)=>{var i,a;return(a=(i=this.options.current).onDelete)==null?void 0:a.call(i,...r)}};return new $M(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,a)=>{var s;return i===((s=n.extensions)==null?void 0:s[a])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?vN.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function CN(t={},e=[]){const n=P.useRef(t);n.current=t;const[r]=P.useState(()=>new Y3(n)),i=Wx.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return P.useDebugValue(i),P.useEffect(r.onRender(e)),G3({editor:i,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),i}var Wo=P.createContext({editor:null});Wo.Consumer;var NN=()=>P.useContext(Wo),_N=P.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),K3=()=>P.useContext(_N),IN=Et.forwardRef((t,e)=>{const{onDragStart:n}=K3(),r=t.as||"div";return T.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function a0(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function s0(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function X3(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function Z3(t){if(a0(t)||s0(t))return!0;if(X3(t)){const e=t.type;if(e)return a0(e)||s0(e)}return!1}function Q3(){try{if(P.version)return parseInt(P.version.split(".")[0],10)>=19}catch{}return!1}var J3=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Yx.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=Q3(),a=Z3(e),s={...n};s.ref&&!(i||a)&&delete s.ref,!s.ref&&(i||a)&&(s.ref=o=>{this.ref=o}),this.reactElement=T.jsx(e,{...s}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Et.createContext({markViewContentRef:()=>{}});var eP=class extends QM{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){var a;return r==="storage"?(a=t.storage[e.name])!=null?a:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:P.createRef()};if(!this.component.displayName){const l=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,a=P.memo(l=>T.jsx(_N.Provider,{value:r,children:P.createElement(i,l)}));a.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new J3(a,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${o}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,a=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:a,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=ni(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function wN(t,e){return n=>n.editor.contentComponent?new eP(t,n,e):{}}var Bg=P.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Bg.displayName="TiptapContext";var tP=()=>P.useContext(Bg);function RN({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=P.useMemo(()=>({editor:r}),[r]),a=P.useMemo(()=>({editor:r}),[r]);return T.jsx(Wo.Provider,{value:a,children:T.jsx(Bg.Provider,{value:i,children:n})})}RN.displayName="Tiptap";function ON({...t}){const{editor:e}=tP();return T.jsx(Fg,{editor:e,...t})}ON.displayName="Tiptap.Content";Object.assign(RN,{Content:ON});function LN(t,e,n){t.chain().focus().insertContentAt(e,[DN(n),{type:"text",text:" "}]).run()}function DN(t){return{type:"mention",attrs:t}}function nP(t){const e=te.c(7),{node:n,selected:r,view:i}=t,{name:a,char:s}=n.attrs,o=r&&i.editable,u=s==="@"?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",c=o&&"outline-2 outline-blue-300 outline-offset-0";let d;e[0]!==u||e[1]!==c?(d=le("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light",u,c),e[0]=u,e[1]=c,e[2]=d):d=e[2];let f;return e[3]!==s||e[4]!==a||e[5]!==d?(f=T.jsxs(IN,{className:d,children:[s,a]}),e[3]=s,e[4]=a,e[5]=d,e[6]=f):f=e[6],f}const MN=kt.create({name:"mention",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"mention"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.char&&(n["data-char"]=t.attrs.char),t.attrs.metadata&&(n["data-metadata"]=JSON.stringify(t.attrs.metadata)),["span",{...e,...n}]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return wN(nP)}});function rP(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}function iP(t,e){return{type:"doc",content:[...t?.content??[],e].filter(Boolean)}}const o0=3;function aP(t){const e=te.c(23),{prompt:n,onSelect:r,isSelected:i,isDisabled:a,isLoading:s}=t,o=n.description??n.name;let l;e[0]!==r||e[1]!==n?(l=()=>r(n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const u=a||s,c=i&&"bg-accent/50 text-foreground",d=s&&"bg-accent/50 text-foreground",f=(a||s)&&"cursor-not-allowed hover:bg-accent/50";let p;e[3]!==c||e[4]!==d||e[5]!==f?(p=le("px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer flex items-center gap-1.5",c,d,f),e[3]=c,e[4]=d,e[5]=f,e[6]=p):p=e[6];const h=n.title??n.name;let g;if(e[7]!==h){let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=/_/g,e[9]=k):k=e[9],g=h.replace(k," "),e[7]=h,e[8]=g}else g=e[8];let b;e[10]!==s?(b=s&&T.jsx(vo,{size:"xs"}),e[10]=s,e[11]=b):b=e[11];let E;e[12]!==l||e[13]!==u||e[14]!==p||e[15]!==g||e[16]!==b?(E=T.jsx(Nn,{asChild:!0,children:T.jsxs("button",{type:"button",onClick:l,disabled:u,className:p,children:[g,b]})}),e[12]=l,e[13]=u,e[14]=p,e[15]=g,e[16]=b,e[17]=E):E=e[17];let y;e[18]!==o?(y=T.jsx(_n,{side:"bottom",className:"max-w-xs",children:T.jsx("p",{className:"text-xs",children:o})}),e[18]=o,e[19]=y):y=e[19];let S;return e[20]!==E||e[21]!==y?(S=T.jsxs(Cn,{children:[E,y]}),e[20]=E,e[21]=y,e[22]=S):S=e[22],S}function sP(t){const e=te.c(23),{prompts:n,onSelect:r,loadingPrompt:i,className:a}=t;if(n.length===0)return null;let s,o,l,u,c;if(e[0]!==a||e[1]!==i||e[2]!==r||e[3]!==n){const p=n.slice(0,o0),h=n.slice(o0),g=h.length>0,b=!!i;s=Co,c=300,e[9]!==a?(o=le("flex flex-wrap items-center justify-center gap-2",a),e[9]=a,e[10]=o):o=e[10];let E;e[11]!==b||e[12]!==i?.name||e[13]!==r?(E=y=>T.jsx(aP,{prompt:y,onSelect:r,isLoading:i?.name===y.name,isDisabled:b&&i?.name!==y.name},y.name),e[11]=b,e[12]=i?.name,e[13]=r,e[14]=E):E=e[14],l=p.map(E),u=g&&T.jsxs(ci,{children:[T.jsx(di,{asChild:!0,children:T.jsxs("button",{type:"button",disabled:b,className:le("size-7 flex items-center justify-center text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer",b&&"opacity-60 cursor-not-allowed"),children:["+",h.length]})}),T.jsx(pi,{side:"bottom",align:"center",className:"w-auto p-2",children:T.jsx("div",{className:"flex flex-col gap-1",children:h.map(y=>{const S=y.description??y.name,k=i?.name===y.name;return T.jsxs(Cn,{children:[T.jsx(Nn,{asChild:!0,children:T.jsxs("button",{type:"button",onClick:()=>r(y),disabled:b&&!k,className:le("px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent/50 rounded-md transition-colors cursor-pointer text-left flex items-center gap-1.5",k&&"bg-accent/50 text-foreground",b&&!k&&"opacity-60 cursor-not-allowed"),children:[(y.title??y.name).replace(/_/g," "),k&&T.jsx(vo,{size:"xs"})]})}),T.jsx(_n,{side:"right",className:"max-w-xs",children:T.jsx("p",{className:"text-xs",children:S})})]},y.name)})})})]}),e[0]=a,e[1]=i,e[2]=r,e[3]=n,e[4]=s,e[5]=o,e[6]=l,e[7]=u,e[8]=c}else s=e[4],o=e[5],l=e[6],u=e[7],c=e[8];let d;e[15]!==o||e[16]!==l||e[17]!==u?(d=T.jsxs("div",{className:o,children:[l,u]}),e[15]=o,e[16]=l,e[17]=u,e[18]=d):d=e[18];let f;return e[19]!==s||e[20]!==c||e[21]!==d?(f=T.jsx(s,{delayDuration:c,children:d}),e[19]=s,e[20]=c,e[21]=d,e[22]=f):f=e[22],f}function oP(){const t=te.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=T.jsxs(T.Fragment,{children:[T.jsx(jb,{className:"h-6 w-20 rounded-full border border-border"}),T.jsx(jb,{className:"h-6 w-24 rounded-full border border-border"})]}),t[0]=e):e=t[0],e}function lP(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function uP(t){const e=te.c(28),{connectionId:n}=t,{tiptapDoc:r,sendMessage:i}=Nr(),{org:a}=ui();let s;e[0]!==n||e[1]!==a.id?(s={connectionId:n,orgId:a.id},e[0]=n,e[1]=a.id,e[2]=s):s=e[2];const o=ig(s);let l;e[3]!==o?(l={client:o,staleTime:6e4},e[3]=o,e[4]=l):l=e[4];const{data:u}=bR(l);let c;e[5]!==u?.prompts?(c=u?.prompts??[],e[5]=u?.prompts,e[6]=c):c=e[6];const d=c;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[7]=f):f=e[7];const[p,h]=P.useReducer(lP,f),[g,b]=P.useState(null);let E;e[8]!==o||e[9]!==i||e[10]!==r?(E=async(M,z)=>{if(!o){kn.error("MCP client not available"),h({type:"RESET"});return}try{const F=await iv(o,M.name,z);h({type:"RESET"});const B=iP(r,{type:"paragraph",content:[DN({id:M.name,name:M.name,metadata:F.messages,char:"/"})]});await i(B)}catch(F){console.error("[ice-breakers] Failed to fetch prompt:",F),kn.error("Failed to load prompt. Please try again."),h({type:"RESET"})}},e[8]=o,e[9]=i,e[10]=r,e[11]=E):E=e[11];const y=E;let S;e[12]!==y?(S=async M=>{if(M.arguments&&M.arguments.length>0){h({type:"SELECT_PROMPT",prompt:M}),b(M);return}h({type:"START_LOADING",prompt:M}),await y(M)},e[12]=y,e[13]=S):S=e[13];const k=S;let x;e[14]!==g||e[15]!==y?(x=async M=>{g&&(h({type:"START_LOADING",prompt:g,arguments:M}),b(null),await y(g,M))},e[14]=g,e[15]=y,e[16]=x):x=e[16];const A=x;if(d.length===0)return null;const v=p.stage==="loading"?p.prompt:null;let w;e[17]!==k||e[18]!==d||e[19]!==v?(w=T.jsx(sP,{prompts:d,onSelect:k,loadingPrompt:v}),e[17]=k,e[18]=d,e[19]=v,e[20]=w):w=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{b(null),h({type:"RESET"})},e[21]=_):_=e[21];let C;e[22]!==g||e[23]!==A?(C=T.jsx(gv,{prompt:g,setPrompt:_,onSubmit:A}),e[22]=g,e[23]=A,e[24]=C):C=e[24];let L;return e[25]!==C||e[26]!==w?(L=T.jsxs("div",{className:"relative w-full",children:[w,C]}),e[25]=C,e[26]=w,e[27]=L):L=e[27],L}function cP(t){const e=te.c(14),{className:n}=t,{selectedVirtualMcp:r}=Nr(),{org:i}=ui();let a;e[0]!==i.id?(a=rv(i.id),e[0]=i.id,e[1]=a):a=e[1];const s=a.id,o=r?.id??s;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l={minHeight:"32px"},e[2]=l):l=e[2];let u;e[3]!==n?(u=le("flex flex-wrap items-center justify-center gap-2",n),e[3]=n,e[4]=u):u=e[4];const c=o??"default";let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=T.jsx(oP,{}),e[5]=d):d=e[5];let f;e[6]!==o?(f=T.jsx(uP,{connectionId:o}),e[6]=o,e[7]=f):f=e[7];let p;e[8]!==c||e[9]!==f?(p=T.jsx(yR,{fallback:null,children:T.jsx(P.Suspense,{fallback:d,children:f},c)}),e[8]=c,e[9]=f,e[10]=p):p=e[10];let h;return e[11]!==u||e[12]!==p?(h=T.jsx("div",{style:l,className:u,children:p}),e[11]=u,e[12]=p,e[13]=h):h=e[13],h}const l0=[{border:"border-purple-400",bg:"bg-purple-400",text:"text-white",bgLight:"bg-purple-400/10"},{border:"border-blue-400",bg:"bg-blue-400",text:"text-white",bgLight:"bg-blue-400/10"},{border:"border-indigo-400",bg:"bg-indigo-400",text:"text-white",bgLight:"bg-indigo-400/10"},{border:"border-violet-400",bg:"bg-violet-400",text:"text-white",bgLight:"bg-violet-400/10"},{border:"border-pink-400",bg:"bg-pink-400",text:"text-white",bgLight:"bg-pink-400/10"},{border:"border-fuchsia-400",bg:"bg-fuchsia-400",text:"text-white",bgLight:"bg-fuchsia-400/10"},{border:"border-emerald-400",bg:"bg-emerald-400",text:"text-white",bgLight:"bg-emerald-400/10"},{border:"border-teal-400",bg:"bg-teal-400",text:"text-white",bgLight:"bg-teal-400/10"},{border:"border-cyan-400",bg:"bg-cyan-400",text:"text-white",bgLight:"bg-cyan-400/10"},{border:"border-sky-400",bg:"bg-sky-400",text:"text-white",bgLight:"bg-sky-400/10"},{border:"border-orange-400",bg:"bg-orange-400",text:"text-white",bgLight:"bg-orange-400/10"},{border:"border-amber-400",bg:"bg-amber-400",text:"text-white",bgLight:"bg-amber-400/10"},{border:"border-rose-400",bg:"bg-rose-400",text:"text-white",bgLight:"bg-rose-400/10"},{border:"border-lime-400",bg:"bg-lime-400",text:"text-white",bgLight:"bg-lime-400/10"}];function dP(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return Math.abs(e)}function PN(t){if(t==null)return null;const n=dP(t)%l0.length;return l0[n]}const u0=li({response:ys().min(1,"Response is required")}),pP=li({response:ys().min(1,"Please select or enter an option")}),fP=li({response:Kw(["yes","no"])});function hP(t){switch(t.type){case"text":return u0;case"choice":return pP;case"confirm":return fP;default:return u0}}function mP(t){const e={};for(const n of t)e[n.toolCallId]=hP(n.input);return li(e)}function gP(t){const e=te.c(6),{control:n,name:r,placeholder:i}=t;let a;e[0]!==i?(a=o=>{const{field:l}=o;return T.jsxs(Io,{children:[T.jsx(wo,{children:T.jsx("div",{className:"px-2",children:T.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[T.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:T.jsx(lg,{size:16,className:"text-muted-foreground"})}),T.jsx("input",{...l,type:"text",placeholder:i||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),T.jsx(Ro,{})]})},e[0]=i,e[1]=a):a=e[1];let s;return e[2]!==n||e[3]!==r||e[4]!==a?(s=T.jsx(_o,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=s):s=e[5],s}function bP(t){const e=te.c(10),{control:n,name:r,options:i}=t,[a,s]=P.useState(!1),o=P.useRef(null),l=P.useRef(null);let u,c;if(e[0]!==i?(u=()=>{const p=h=>{const g=h.target.tagName;if(g==="INPUT"||g==="TEXTAREA")return;const b=Number.parseInt(h.key,10);b>=1&&b<=i.length&&l.current&&(h.preventDefault(),l.current.onChange(i[b-1]??""),s(!1))};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},c=[i],e[0]=i,e[1]=u,e[2]=c):(u=e[1],c=e[2]),P.useEffect(u,c),i.length===0)return null;let d;e[3]!==a||e[4]!==i?(d=p=>{const{field:h}=p;l.current=h;const g=a||!!h.value&&!i.includes(h.value);return T.jsxs(Io,{children:[T.jsx(wo,{children:T.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[i.map((b,E)=>{const y=h.value===b;return T.jsxs("button",{type:"button",onClick:()=>{h.onChange(b??""),s(!1)},className:le("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",y&&"bg-accent/50",!y&&"hover:bg-accent/30"),"aria-label":`Select ${b}`,children:[T.jsx("span",{className:le("flex items-center justify-center size-6 rounded-md text-sm shrink-0",y?"bg-chart-1 text-white":"bg-muted text-foreground"),children:E+1}),T.jsx("span",{className:"text-sm text-foreground truncate",children:b})]},`${E}-${b}`)}),T.jsxs("div",{className:le("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",g&&"bg-accent/50",!g&&"hover:bg-accent/30"),onClick:()=>{s(!0),i.includes(h.value)&&h.onChange(""),setTimeout(()=>o.current?.focus(),0)},children:[T.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:T.jsx(lg,{size:16,className:"text-muted-foreground"})}),g?T.jsx("input",{ref:o,type:"text",value:h.value,onChange:b=>h.onChange(b.target.value),placeholder:"Something else...",autoFocus:!0,"aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}):T.jsx("span",{className:"text-sm text-foreground/25",children:"Something else..."})]})]})}),T.jsx(Ro,{})]})},e[3]=a,e[4]=i,e[5]=d):d=e[5];let f;return e[6]!==n||e[7]!==r||e[8]!==d?(f=T.jsx(_o,{control:n,name:r,render:d}),e[6]=n,e[7]=r,e[8]=d,e[9]=f):f=e[9],f}function EP(t){const e=te.c(7),{control:n,name:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["yes","no"],e[0]=i):i=e[0];const a=i,s=P.useRef(null);let o,l;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{const d=f=>{const p=f.target.tagName;p==="INPUT"||p==="TEXTAREA"||(f.key==="1"&&s.current?(f.preventDefault(),s.current.onChange("yes")):f.key==="2"&&s.current&&(f.preventDefault(),s.current.onChange("no")))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},l=[],e[1]=o,e[2]=l):(o=e[1],l=e[2]),P.useEffect(o,l);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=d=>{const{field:f}=d;return s.current=f,T.jsxs(Io,{children:[T.jsx(wo,{children:T.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(p=>{const h=f.value===p;return T.jsxs("button",{type:"button",onClick:()=>f.onChange(p),className:le("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",h&&"bg-accent/50",!h&&"hover:bg-accent/30"),"aria-label":`Confirm ${p}`,children:[T.jsx("span",{className:le("flex items-center justify-center size-6 rounded-md text-sm shrink-0",h?"bg-chart-1 text-white":"bg-muted text-foreground"),children:p==="yes"?1:2}),T.jsx("span",{className:"text-sm text-foreground capitalize",children:p})]},p)})})}),T.jsx(Ro,{})]})},e[3]=u):u=e[3];let c;return e[4]!==n||e[5]!==r?(c=T.jsx(_o,{control:n,name:r,render:u}),e[4]=n,e[5]=r,e[6]=c):c=e[6],c}function c0(t){const e=te.c(13),{input:n,control:r,name:i}=t;switch(n.type){case"text":{let a;return e[0]!==r||e[1]!==n.default||e[2]!==i?(a=T.jsx(gP,{control:r,name:i,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=i,e[3]=a):a=e[3],a}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const s=a;let o;return e[6]!==r||e[7]!==i||e[8]!==s?(o=T.jsx(bP,{control:r,name:i,options:s}),e[6]=r,e[7]=i,e[8]=s,e[9]=o):o=e[9],o}case"confirm":{let a;return e[10]!==r||e[11]!==i?(a=T.jsx(EP,{control:r,name:i}),e[10]=r,e[11]=i,e[12]=a):a=e[12],a}default:return null}}function yP(t){const e=te.c(21),{current:n,total:r,onPrev:i,onNext:a}=t;if(r<=1)return null;const s=n===0,o=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let l;e[0]!==o?(l=le("p-0.5 rounded transition-colors",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=T.jsx(wR,{size:14}),e[2]=u):u=e[2];let c;e[3]!==i||e[4]!==s||e[5]!==l?(c=T.jsx("button",{type:"button",onClick:i,disabled:s,className:l,"aria-label":"Previous question",children:u}),e[3]=i,e[4]=s,e[5]=l,e[6]=c):c=e[6];const d=n+1;let f;e[7]!==d||e[8]!==r?(f=T.jsxs("span",{className:"tabular-nums text-xs",children:[d," of ",r]}),e[7]=d,e[8]=r,e[9]=f):f=e[9];const p=n===r-1,h=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let g;e[10]!==h?(g=le("p-0.5 rounded transition-colors",h),e[10]=h,e[11]=g):g=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=T.jsx(lv,{size:14}),e[12]=b):b=e[12];let E;e[13]!==a||e[14]!==g||e[15]!==p?(E=T.jsx("button",{type:"button",onClick:a,disabled:p,className:g,"aria-label":"Next question",children:b}),e[13]=a,e[14]=g,e[15]=p,e[16]=E):E=e[16];let y;return e[17]!==E||e[18]!==c||e[19]!==f?(y=T.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[c,f,E]}),e[17]=E,e[18]=c,e[19]=f,e[20]=y):y=e[20],y}function d0(t){const e=te.c(15),{title:n,children:r,footerLeft:i,footerRight:a}=t;let s;e[0]!==n?(s=T.jsx("div",{className:"flex items-center gap-2 p-4",children:T.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:n})}),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==r?(o=T.jsx("div",{className:"overflow-clip pb-4",children:r}),e[2]=r,e[3]=o):o=e[3];let l;e[4]!==i?(l=T.jsx("div",{children:i}),e[4]=i,e[5]=l):l=e[5];let u;e[6]!==a?(u=T.jsx("div",{className:"flex items-center gap-2",children:a}),e[6]=a,e[7]=u):u=e[7];let c;e[8]!==l||e[9]!==u?(c=T.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:T.jsxs("div",{className:"flex items-center justify-between",children:[l,u]})}),e[8]=l,e[9]=u,e[10]=c):c=e[10];let d;return e[11]!==s||e[12]!==o||e[13]!==c?(d=T.jsxs("div",{className:"flex flex-col rounded-xl bg-background border border-border shadow-md w-[calc(100%-16px)] max-w-[584px] mx-auto mb-[-16px]",children:[s,o,c]}),e[11]=s,e[12]=o,e[13]=c,e[14]=d):d=e[14],d}function TP({parts:t,onSubmit:e}){const[n,r]=P.useState(t[0]?.toolCallId??""),i=mP(t.map(y=>({toolCallId:y.toolCallId,input:y.input}))),a=Vx({resolver:Gx(i),defaultValues:Object.fromEntries(t.map(y=>[y.toolCallId,{response:""}]))}),s=a.watch(),o=t.findIndex(y=>y.toolCallId===n),l=!!s[n]?.response,u=t.every(y=>!!s[y.toolCallId]?.response),c=y=>{for(const S of t){const k=y[S.toolCallId]?.response;k&&e(S,k)}},d=y=>t.find(S=>!y[S.toolCallId]?.response&&S.toolCallId!==n)??null,f=()=>{const y=a.getValues();if(t.every(k=>!!y[k.toolCallId]?.response))a.handleSubmit(c)();else{const k=d(y);k&&r(k.toolCallId)}},p=()=>{a.setValue(`${n}.response`,"user has skip this question"),f()},h=()=>{if(o>0){const y=t[o-1];y&&r(y.toolCallId)}},g=()=>{if(o<t.length-1){const y=t[o+1];y&&r(y.toolCallId)}},b=T.jsxs(T.Fragment,{children:[T.jsx(qe,{type:"button",variant:"outline",size:"sm",onClick:p,className:"h-7",children:"Skip"}),T.jsx(qe,{type:"button",size:"sm",disabled:!l,onClick:f,className:le("h-7",l?"":"opacity-50"),children:u?"Submit":"Next"})]}),E=T.jsx(yP,{current:o,total:t.length,onPrev:h,onNext:g});if(t.length===1){const y=t[0];return y?.input?T.jsx(Qh,{...a,children:T.jsx("form",{onSubmit:a.handleSubmit(c),autoComplete:"off",children:T.jsx(d0,{title:y.input?.prompt??"Question",footerRight:b,children:T.jsx(c0,{input:y.input,control:a.control,name:`${y.toolCallId}.response`})})})}):null}return T.jsx(Qh,{...a,children:T.jsx("form",{onSubmit:a.handleSubmit(c),autoComplete:"off",children:T.jsx(uR,{value:n,onValueChange:r,children:t.map(y=>T.jsx(cR,{value:y.toolCallId,className:"mt-0",children:T.jsx(d0,{title:y.input?.prompt??"Question",footerLeft:E,footerRight:b,children:T.jsx(c0,{input:y.input,control:a.control,name:`${y.toolCallId}.response`})})},y.toolCallId))})})})}function SP(){const t=te.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=T.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[584px] mx-auto mb-2",children:[T.jsx(Ss,{className:"size-5 text-muted-foreground shimmer"}),T.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function FN(t){const e=te.c(6),{userAskParts:n,isStreaming:r,onSubmit:i}=t;let a;e[0]!==n?(a=n.filter(AP),e[0]=n,e[1]=a):a=e[1];const s=a;if(r){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=T.jsx(SP,{}),e[2]=l):l=e[2],l}if(s.length===0)return null;let o;return e[3]!==i||e[4]!==s?(o=T.jsx(TP,{parts:s,onSubmit:i}),e[3]=i,e[4]=s,e[5]=o):o=e[5],o}function AP(t){return t.state==="input-available"}const kP={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function Ps(t){const e=te.c(32),{variant:n,onDismiss:r}=t,i=n==="error",a=i?"Error occurred":"Response incomplete",s=i?t.error.message:kP[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`,o=i?"border-destructive/30 bg-destructive/5":"border-amber-500/30 bg-amber-500/5",l=i?"text-destructive":"text-amber-600 dark:text-amber-500",u=i?Oo:TR;let c;e[0]!==o?(c=le("flex items-start gap-2 px-3 py-2.5 rounded-lg border border-dashed text-sm w-full mb-2",o),e[0]=o,e[1]=c):c=e[1];let d;e[2]!==l?(d=le("mt-0.5 shrink-0",l),e[2]=l,e[3]=d):d=e[3];let f;e[4]!==u?(f=T.jsx(u,{size:16}),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==d||e[7]!==f?(p=T.jsx("div",{className:d,children:f}),e[6]=d,e[7]=f,e[8]=p):p=e[8];let h;e[9]!==l?(h=le("text-xs mb-1 font-medium",l),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==h||e[12]!==a?(g=T.jsx("div",{className:h,children:a}),e[11]=h,e[12]=a,e[13]=g):g=e[13];let b;e[14]!==s?(b=T.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground mb-2",children:s}),e[14]=s,e[15]=b):b=e[15];let E;e[16]!==i||e[17]!==t.onContinue||e[18]!==t.onFixInChat?(E=T.jsx("div",{className:"flex gap-2",children:i?T.jsxs(T.Fragment,{children:[T.jsx(qe,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}),T.jsx(qe,{size:"sm",variant:"outline",disabled:!0,className:"h-7 text-xs",children:"Report"})]}):T.jsx(qe,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"})}),e[16]=i,e[17]=t.onContinue,e[18]=t.onFixInChat,e[19]=E):E=e[19];let y;e[20]!==g||e[21]!==b||e[22]!==E?(y=T.jsxs("div",{className:"flex-1 min-w-0",children:[g,b,E]}),e[20]=g,e[21]=b,e[22]=E,e[23]=y):y=e[23];let S;e[24]===Symbol.for("react.memo_cache_sentinel")?(S=T.jsx(IR,{size:14}),e[24]=S):S=e[24];let k;e[25]!==r?(k=T.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Dismiss",children:S}),e[25]=r,e[26]=k):k=e[26];let x;return e[27]!==c||e[28]!==k||e[29]!==p||e[30]!==y?(x=T.jsxs("div",{className:c,children:[p,y,k]}),e[27]=c,e[28]=k,e[29]=p,e[30]=y,e[31]=x):x=e[31],x}function Yo(){const t=te.c(23),{error:e,clearError:n,finishReason:r,clearFinishReason:i,messages:a,isStreaming:s,addToolOutput:o,sendMessage:l}=Nr();let u,c;if(t[0]!==a){const k=a.at(-1);c=k?.role==="assistant"?k.parts.filter(vP):null,u=c?.filter(xP)?.length,t[0]=a,t[1]=u,t[2]=c}else u=t[1],c=t[2];const d=u;let f;t[3]!==e||t[4]!==l?(f=()=>{if(e){const x={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};l(x)}},t[3]=e,t[4]=l,t[5]=f):f=t[5];const p=f;let h;t[6]!==l?(h=()=>{l({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[6]=l,t[7]=h):h=t[7];const g=h;let b;t[8]!==o?(b=(k,x)=>{o({tool:"user_ask",toolCallId:k.toolCallId,output:{response:x}})},t[8]=o,t[9]=b):b=t[9];const E=b;let y;t[10]!==n||t[11]!==i||t[12]!==e||t[13]!==r||t[14]!==g||t[15]!==p||t[16]!==E||t[17]!==s||t[18]!==d||t[19]!==c?(y=d?T.jsx(FN,{userAskParts:c,isStreaming:s,onSubmit:E}):s?null:e?T.jsx(Ps,{variant:"error",error:e,onDismiss:n,onFixInChat:p}):r&&r!=="stop"?T.jsx(Ps,{variant:"warning",finishReason:r,onDismiss:i,onContinue:g}):null,t[10]=n,t[11]=i,t[12]=e,t[13]=r,t[14]=g,t[15]=p,t[16]=E,t[17]=s,t[18]=d,t[19]=c,t[20]=y):y=t[20];let S;return t[21]!==y?(S=T.jsx("div",{className:"flex flex-col w-full",children:y}),t[21]=y,t[22]=S):S=t[22],S}function xP(t){return t.state!=="output-available"}function vP(t){return t.type==="tool-user_ask"}Yo.Error=function(e){return T.jsx(Ps,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};Yo.Warning=function(e){return T.jsx(Ps,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};Yo.UserAskQuestion=FN;const Fs={passthrough:{label:"Direct access",description:"Best for small teams or when you need predictable behavior",icon:pR},smart_tool_selection:{label:"Smart discovery",description:"Ideal for large teams with many tools - AI finds what it needs",icon:dR},code_execution:{label:"Smart execution",description:"Maximum flexibility - AI can write code to orchestrate tools",icon:OR,recommended:!0}};function CP(t){const e=te.c(24),{mode:n,isSelected:r,onSelect:i}=t,a=Fs[n],s=a.icon,o=r&&"bg-accent";let l;e[0]!==o?(l=le("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-lg transition-colors",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]!==s?(u=T.jsx("div",{className:"p-1.5 shrink-0 rounded-md bg-muted",children:T.jsx(s,{className:"size-4 text-muted-foreground"})}),e[2]=s,e[3]=u):u=e[3];let c;e[4]!==a.label?(c=T.jsx("span",{className:"text-sm font-medium text-foreground",children:a.label}),e[4]=a.label,e[5]=c):c=e[5];let d;e[6]!==a.recommended?(d=a.recommended&&T.jsx(RR,{variant:"outline",className:"text-xs",children:"Recommended"}),e[6]=a.recommended,e[7]=d):d=e[7];let f;e[8]!==r?(f=r&&T.jsx(va,{size:16,className:"text-foreground shrink-0 ml-auto"}),e[8]=r,e[9]=f):f=e[9];let p;e[10]!==c||e[11]!==d||e[12]!==f?(p=T.jsxs("div",{className:"flex items-center gap-2",children:[c,d,f]}),e[10]=c,e[11]=d,e[12]=f,e[13]=p):p=e[13];let h;e[14]!==a.description?(h=T.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:a.description}),e[14]=a.description,e[15]=h):h=e[15];let g;e[16]!==p||e[17]!==h?(g=T.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[p,h]}),e[16]=p,e[17]=h,e[18]=g):g=e[18];let b;return e[19]!==i||e[20]!==l||e[21]!==u||e[22]!==g?(b=T.jsxs("div",{onClick:i,className:l,children:[u,g]}),e[19]=i,e[20]=l,e[21]=u,e[22]=g,e[23]=b):b=e[23],b}function NP(t){const e=te.c(13),{mode:n,placeholder:r}=t,i=r===void 0?"Select mode":r;if(!n){let d;e[0]!==i?(d=T.jsx("span",{className:"text-sm text-muted-foreground",children:i}),e[0]=i,e[1]=d):d=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=T.jsx(Jh,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=f):f=e[2];let p;return e[3]!==d?(p=T.jsxs("div",{className:"flex items-center gap-1.5",children:[d,f]}),e[3]=d,e[4]=p):p=e[4],p}const a=Fs[n],s=a.icon;let o;e[5]!==s?(o=T.jsx(s,{className:"size-4 text-muted-foreground shrink-0"}),e[5]=s,e[6]=o):o=e[6];let l;e[7]!==a.label?(l=T.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",children:a.label}),e[7]=a.label,e[8]=l):l=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=T.jsx(Jh,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[9]=u):u=e[9];let c;return e[10]!==o||e[11]!==l?(c=T.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[o,l,u]}),e[10]=o,e[11]=l,e[12]=c):c=e[12],c}function _P(t){const e=te.c(28),{selectedMode:n,onModeChange:r,variant:i,className:a,placeholder:s,disabled:o}=t,l=i===void 0?"borderless":i,u=s===void 0?"Mode":s,c=o===void 0?!1:o,[d,f]=P.useState(!1);let p;e[0]!==r?(p=z=>{r(z),f(!1)},e[0]=r,e[1]=p):p=e[1];const h=p,g=c?!1:d,b=l==="borderless"?"ghost":"outline",E=l==="borderless"&&"md:border-none",y=c&&"cursor-not-allowed opacity-50";let S;e[2]!==a||e[3]!==E||e[4]!==y?(S=le("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",E,y,a),e[2]=a,e[3]=E,e[4]=y,e[5]=S):S=e[5];const k=d?"open":"closed";let x;e[6]!==u||e[7]!==n?(x=T.jsx(NP,{mode:n,placeholder:u}),e[6]=u,e[7]=n,e[8]=x):x=e[8];let A;e[9]!==c||e[10]!==k||e[11]!==x||e[12]!==b||e[13]!==S?(A=T.jsx(Nn,{asChild:!0,children:T.jsx(di,{asChild:!0,children:T.jsx(qe,{variant:b,size:"sm",className:S,disabled:c,"data-state":k,children:x})})}),e[9]=c,e[10]=k,e[11]=x,e[12]=b,e[13]=S,e[14]=A):A=e[14];const v=Fs[n]?.description??"Choose agent mode";let w;e[15]!==v?(w=T.jsx(_n,{side:"top",className:"text-xs",children:v}),e[15]=v,e[16]=w):w=e[16];let _;e[17]!==A||e[18]!==w?(_=T.jsx(Co,{children:T.jsxs(Cn,{children:[A,w]})}),e[17]=A,e[18]=w,e[19]=_):_=e[19];let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=Object.keys(Fs),e[20]=C):C=e[20];let L;e[21]!==h||e[22]!==n?(L=T.jsx(pi,{className:"w-[350px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:T.jsx("div",{className:"flex flex-col p-1",children:C.map(z=>T.jsx(CP,{mode:z,isSelected:z===n,onSelect:()=>h(z)},z))})}),e[21]=h,e[22]=n,e[23]=L):L=e[23];let M;return e[24]!==_||e[25]!==L||e[26]!==g?(M=T.jsxs(ci,{open:g,onOpenChange:f,children:[_,L]}),e[24]=_,e[25]=L,e[26]=g,e[27]=M):M=e[27],M}function IP(t){const e=te.c(24),{virtualMcp:n,isSelected:r}=t,i=r&&"bg-accent";let a;e[0]!==i?(a=le("flex items-start gap-3 py-3 px-3 hover:bg-accent cursor-pointer rounded-xl transition-colors",i),e[0]=i,e[1]=a):a=e[1];let s;e[2]!==n.fallbackIcon?(s=n.fallbackIcon??T.jsx(sa,{}),e[2]=n.fallbackIcon,e[3]=s):s=e[3];let o;e[4]!==s||e[5]!==n.icon||e[6]!==n.title?(o=T.jsx(No,{icon:n.icon,name:n.title,size:"sm",fallbackIcon:s,className:"rounded-xl border border-border shadow-sm shrink-0 aspect-square"}),e[4]=s,e[5]=n.icon,e[6]=n.title,e[7]=o):o=e[7];let l;e[8]!==n.title?(l=T.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]!==r?(u=r&&T.jsx(va,{size:16,className:"text-foreground shrink-0"}),e[10]=r,e[11]=u):u=e[11];let c;e[12]!==l||e[13]!==u?(c=T.jsxs("div",{className:"flex items-center justify-between",children:[l,u]}),e[12]=l,e[13]=u,e[14]=c):c=e[14];let d;e[15]!==n.description?(d=n.description&&T.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 leading-relaxed",children:n.description}),e[15]=n.description,e[16]=d):d=e[16];let f;e[17]!==c||e[18]!==d?(f=T.jsxs("div",{className:"flex flex-col flex-1 min-w-0 gap-0.5",children:[c,d]}),e[17]=c,e[18]=d,e[19]=f):f=e[19];let p;return e[20]!==a||e[21]!==o||e[22]!==f?(p=T.jsxs("div",{className:a,children:[o,f]}),e[20]=a,e[21]=o,e[22]=f,e[23]=p):p=e[23],p}function Ug(t){const e=te.c(33),{virtualMcps:n,selectedVirtualMcpId:r,onVirtualMcpChange:i,searchInputRef:a}=t,[s,o]=P.useState(""),l=P.useRef(null),u=a??l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={navigateOnCreate:!0},e[0]=c):c=e[0];const{createVirtualMCP:d,isCreating:f}=DR(c);let p,h,g,b;if(e[1]!==d||e[2]!==u||e[3]!==f||e[4]!==i||e[5]!==s||e[6]!==r||e[7]!==n){let S;e:{const M=n.filter(wP);if(!s.trim()){S=M;break e}const z=s.toLowerCase();S=M.filter(F=>F.title.toLowerCase().includes(z)||F.description?.toLowerCase().includes(z))}const k=S;let x;e[12]!==i?(x=M=>{i(M),o("")},e[12]=i,e[13]=x):x=e[13];const A=x;g="flex flex-col max-h-[400px]";let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=T.jsx(sv,{size:16,className:"text-muted-foreground pointer-events-none shrink-0"}),e[14]=v):v=e[14];let w;e[15]===Symbol.for("react.memo_cache_sentinel")?(w=M=>o(M.target.value),e[15]=w):w=e[15];let _;e[16]!==u||e[17]!==s?(_=T.jsx(av,{ref:u,type:"text",placeholder:"Search for an agent...",value:s,onChange:w,className:"flex-1 h-8 text-sm border-0 focus-visible:ring-0 focus-visible:ring-offset-0 shadow-none p-0"}),e[16]=u,e[17]=s,e[18]=_):_=e[18];const C=f?"Creating...":"Create Agent";let L;e[19]!==d||e[20]!==f||e[21]!==C?(L=T.jsx(qe,{onClick:d,variant:"outline",size:"sm",className:"h-8 px-3 rounded-lg text-sm font-medium shrink-0",disabled:f,children:C}),e[19]=d,e[20]=f,e[21]=C,e[22]=L):L=e[22],e[23]!==_||e[24]!==L?(b=T.jsx("div",{className:"border-b px-4 py-3 bg-background/95 backdrop-blur sticky top-0 z-10",children:T.jsxs("div",{className:"relative flex items-center gap-2",children:[v,_,L]})}),e[23]=_,e[24]=L,e[25]=b):b=e[25],p="overflow-y-auto p-1.5",h=k.length>0?T.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:k.map(M=>T.jsx("div",{role:"button",tabIndex:0,onClick:()=>A(M.id),onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),A(M.id))},className:"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl",children:T.jsx(IP,{virtualMcp:M,isSelected:M.id===r})},M.id))}):T.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No agents found"}),e[1]=d,e[2]=u,e[3]=f,e[4]=i,e[5]=s,e[6]=r,e[7]=n,e[8]=p,e[9]=h,e[10]=g,e[11]=b}else p=e[8],h=e[9],g=e[10],b=e[11];let E;e[26]!==p||e[27]!==h?(E=T.jsx("div",{className:p,children:h}),e[26]=p,e[27]=h,e[28]=E):E=e[28];let y;return e[29]!==g||e[30]!==b||e[31]!==E?(y=T.jsxs("div",{className:g,children:[b,E]}),e[29]=g,e[30]=b,e[31]=E,e[32]=y):y=e[32],y}function wP(t){return!t.id||!Xr(t.id)}function RP(t){const e=te.c(37),{selectedVirtualMcpId:n,onVirtualMcpChange:r,virtualMcps:i,className:a,placeholder:s,showTooltip:o,disabled:l}=t,u=s===void 0?"Select Agent":s,c=o===void 0?!0:o,d=l===void 0?!1:l,[f,p]=P.useState(!1),h=P.useRef(null),g=LR(),b=i??g;let E;e[0]!==b?(E=b.filter(OP),e[0]=b,e[1]=E):E=e[1];const y=E;let S;e[2]!==b||e[3]!==n?(S=n?b.find(Y=>Y.id===n):null,e[2]=b,e[3]=n,e[4]=S):S=e[4];const k=S;let x;e[5]!==r?(x=Y=>{r(Y),p(!1)},e[5]=r,e[6]=x):x=e[6];const A=x;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=Y=>{p(Y)},e[7]=v):v=e[7];const w=v;let _,C;e[8]!==f?(_=()=>{f&&setTimeout(()=>{h.current?.focus()},0)},C=[f],e[8]=f,e[9]=_,e[10]=C):(_=e[9],C=e[10]),P.useEffect(_,C);const L=d?!1:f,M=d?void 0:w,z=d?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-accent";let F;e[11]!==a||e[12]!==z?(F=le("flex items-center justify-center size-8 rounded-full transition-colors shrink-0",z,a),e[11]=a,e[12]=z,e[13]=F):F=e[13];let B;e[14]!==k?(B=k?T.jsx(No,{icon:k.icon,name:k.title,size:"xs",fallbackIcon:T.jsx(sa,{size:16}),className:"rounded-md shrink-0 aspect-square"}):T.jsx(sa,{size:16}),e[14]=k,e[15]=B):B=e[15];let $;e[16]!==d||e[17]!==u||e[18]!==F||e[19]!==B?($=T.jsx(Nn,{asChild:!0,children:T.jsx(di,{asChild:!0,children:T.jsx("button",{type:"button",disabled:d,className:F,"aria-label":u,children:B})})}),e[16]=d,e[17]=u,e[18]=F,e[19]=B,e[20]=$):$=e[20];let G;e[21]!==f||e[22]!==k?.title||e[23]!==c?(G=c&&!f&&T.jsx(_n,{side:"top",className:"text-xs",children:k?.title??"Choose an agent to chat with"}),e[21]=f,e[22]=k?.title,e[23]=c,e[24]=G):G=e[24];let H;e[25]!==$||e[26]!==G?(H=T.jsx(Co,{children:T.jsxs(Cn,{children:[$,G]})}),e[25]=$,e[26]=G,e[27]=H):H=e[27];let Z;e[28]!==A||e[29]!==n||e[30]!==y?(Z=T.jsx(pi,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:T.jsx(Ug,{virtualMcps:y,selectedVirtualMcpId:n,onVirtualMcpChange:A,searchInputRef:h})}),e[28]=A,e[29]=n,e[30]=y,e[31]=Z):Z=e[31];let I;return e[32]!==L||e[33]!==M||e[34]!==H||e[35]!==Z?(I=T.jsxs(ci,{open:L,onOpenChange:M,children:[H,Z]}),e[32]=L,e[33]=M,e[34]=H,e[35]=Z,e[36]=I):I=e[36],I}function OP(t){return!t.id||!Xr(t.id)}function LP(t,e,n){t.chain().focus().insertContentAt(e,[DP(n),{type:"text",text:" "}]).run()}function DP(t){return{type:"file",attrs:t}}function MP(t){const e=te.c(17),{node:n,selected:r,view:i}=t,{name:a,mimeType:s,data:o}=n.attrs,l=r&&i.editable;let u;e[0]!==s?(u=s.startsWith("image/"),e[0]=s,e[1]=u):u=e[1];const c=u,d=l&&"outline-2 outline-blue-300 outline-offset-0";let f;e[2]!==d?(f=le("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",d),e[2]=d,e[3]=f):f=e[3];let p;e[4]!==a?(p=T.jsx(Nn,{asChild:!0,children:T.jsx("span",{children:a})}),e[4]=a,e[5]=p):p=e[5];let h;e[6]!==o||e[7]!==c||e[8]!==s||e[9]!==a?(h=T.jsx(_n,{side:"top",className:"max-w-sm",children:c?T.jsx("img",{src:`data:${s};base64,${o}`,alt:a,className:"max-w-full max-h-64 object-contain rounded"}):T.jsxs("div",{className:"text-xs",children:[T.jsx("div",{className:"font-medium",children:a}),T.jsx("div",{className:"text-muted-foreground mt-1",children:s})]})}),e[6]=o,e[7]=c,e[8]=s,e[9]=a,e[10]=h):h=e[10];let g;e[11]!==p||e[12]!==h?(g=T.jsxs(Cn,{children:[p,h]}),e[11]=p,e[12]=h,e[13]=g):g=e[13];let b;return e[14]!==f||e[15]!==g?(b=T.jsx(IN,{className:f,children:g}),e[14]=f,e[15]=g,e[16]=b):b=e[16],b}const BN=kt.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return wN(MP)}});async function UN(t,e,n,r){if(!Qx(e)){kn.error("Selected model does not support file uploads");return}const i=10*1024*1024;if(n.size>i){kn.error(`File "${n.name}" exceeds 10MB limit`);return}try{const a=new FileReader,s=new Promise((u,c)=>{a.onload=()=>{const d=a.result;if(typeof d!="string"){c(new Error("Failed to read file as data URL"));return}const f=d.includes(",")?d.split(",")[1]??d:d;u(f)},a.onerror=c});a.readAsDataURL(n);const o=await s,l={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:o};LP(t,{from:r,to:r},l)}catch(a){console.error("Failed to process file:",a),kn.error(`Failed to load file "${n.name}"`)}}function PP(t){const e=te.c(7),{editor:n,selectedModel:r}=t,i=P.useRef(FP);let a,s;e[0]!==n||e[1]!==r?(a=()=>{i.current=async(u,c)=>{await UN(n,r,u,c)}},s=[n,r],e[0]=n,e[1]=r,e[2]=a,e[3]=s):(a=e[2],s=e[3]),P.useEffect(a,s);let o,l;return e[4]!==n?(o=()=>{if(n?.isDestroyed)return;const u=new Pe("fileDropHandler");n.state.plugins.find(f=>f.spec.key===u)&&n.unregisterPlugin(u);const d=new Oe({key:u,props:{handleDrop:(f,p,h,g)=>{if(g)return!1;const b=p.dataTransfer?.files;if(!b||b.length===0)return!1;p.preventDefault();const E=f.posAtCoords({left:p.clientX,top:p.clientY});if(!E)return!1;const y=Array.from(b),S=E.pos;for(const k of y)i.current?.(k,S);return!0}}});return n.registerPlugin(d),()=>{n?.isDestroyed||n.unregisterPlugin(u)}},l=[n],e[4]=n,e[5]=o,e[6]=l):(o=e[5],l=e[6]),P.useEffect(o,l),null}function FP(){return Promise.resolve()}function BP(t){const e=te.c(20),{selectedModel:n,isStreaming:r}=t,{editor:i}=NN(),a=P.useRef(null);let s;e[0]!==n?(s=Qx(n),e[0]=n,e[1]=s):s=e[1];const o=s;let l;e[2]!==i||e[3]!==n?(l=async k=>{const x=k.target.files;if(!x||x.length===0||!i)return;const A=Array.from(x),{from:v}=i.state.selection,w=v;for(const _ of A)await UN(i,n,_,w);a.current&&(a.current.value="")},e[2]=i,e[3]=n,e[4]=l):l=e[4];const u=l;if(!i)return null;const c=r||!o;let d;e[5]!==u||e[6]!==c?(d=T.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:u,disabled:c}),e[5]=u,e[6]=c,e[7]=d):d=e[7];const f=r||!o;let p,h;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=()=>a.current?.click(),h=T.jsx(cv,{size:16}),e[8]=p,e[9]=h):(p=e[8],h=e[9]);let g;e[10]!==f?(g=T.jsx(Nn,{asChild:!0,children:T.jsx(qe,{type:"button",variant:"ghost",size:"icon",className:"size-8 rounded-full",disabled:f,onClick:p,children:h})}),e[10]=f,e[11]=g):g=e[11];const b=o?"Add file":"Selected model does not support files";let E;e[12]!==b?(E=T.jsx(_n,{side:"top",children:b}),e[12]=b,e[13]=E):E=e[13];let y;e[14]!==E||e[15]!==g?(y=T.jsxs(Cn,{children:[g,E]}),e[14]=E,e[15]=g,e[16]=y):y=e[16];let S;return e[17]!==y||e[18]!==d?(S=T.jsxs(T.Fragment,{children:[d,y]}),e[17]=y,e[18]=d,e[19]=S):S=e[19],S}function UP(t={}){return new Oe({view(e){return new HP(e,t)}})}class HP{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let a=s=>{this[i](s)};return e.dom.addEventListener(i,a),{name:i,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,a=i.getBoundingClientRect(),s=a.width/i.offsetWidth,o=a.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let h=p.getBoundingClientRect(),g=d?h.bottom:h.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*o;r={left:h.left,right:h.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,p=d.height/l.offsetHeight;u=d.left-l.scrollLeft*f,c=d.top-l.scrollTop*p}this.element.style.left=(r.left-u)/s+"px",this.element.style.top=(r.top-c)/o+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/o+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,a=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!a){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=jv(this.editorView.state.doc,s,this.editorView.dragging.slice);o!=null&&(s=o)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Be extends ge{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Be.valid(r)?new Be(r):ge.near(r)}content(){return ee.empty}eq(e){return e instanceof Be&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Be(e.resolve(n.pos))}getBookmark(){return new Hg(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!$P(e)||!zP(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Be.valid(e))return e;let i=e.pos,a=null;for(let s=e.depth;;s--){let o=e.node(s);if(n>0?e.indexAfter(s)<o.childCount:e.index(s)>0){a=o.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(Be.valid(l))return l}for(;;){let s=n>0?a.firstChild:a.lastChild;if(!s){if(a.isAtom&&!a.isText&&!ue.isSelectable(a)){e=e.doc.resolve(i+a.nodeSize*n),r=!1;continue e}break}a=s,i+=n;let o=e.doc.resolve(i);if(Be.valid(o))return o}return null}}}Be.prototype.visible=!1;Be.findFrom=Be.findGapCursorFrom;ge.jsonID("gapcursor",Be);class Hg{constructor(e){this.pos=e}map(e){return new Hg(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Be.valid(n)?new Be(n):ge.near(n)}}function HN(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function $P(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||HN(i.type))return!0;if(i.inlineContent)return!1}}return!0}function zP(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||HN(i.type))return!0;if(i.inlineContent)return!1}}return!0}function jP(){return new Oe({props:{decorations:WP,createSelectionBetween(t,e,n){return e.pos==n.pos&&Be.valid(n)?new Be(n):null},handleClick:GP,handleKeyDown:qP,handleDOMEvents:{beforeinput:VP}}})}const qP=qC({ArrowLeft:Wa("horiz",-1),ArrowRight:Wa("horiz",1),ArrowUp:Wa("vert",-1),ArrowDown:Wa("vert",1)});function Wa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,a){let s=r.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof fe){if(!a.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=r.doc.resolve(e>0?o.after():o.before())}let u=Be.findGapCursorFrom(o,e,l);return u?(i&&i(r.tr.setSelection(new Be(u))),!0):!1}}function GP(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Be.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&ue.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Be(r))),!0)}function VP(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Be))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=W.empty;for(let s=r.length-1;s>=0;s--)i=W.from(r[s].createAndFill(null,i));let a=t.state.tr.replace(n.pos,n.pos,new ee(i,0,0));return a.setSelection(fe.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function WP(t){if(!(t.selection instanceof Be))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(t.doc,[ot.widget(t.selection.head,e,{key:"gapcursor"})])}var Bs=200,et=function(){};et.prototype.append=function(e){return e.length?(e=et.from(e),!this.length&&e||e.length<Bs&&this.leafAppend(e)||this.length<Bs&&e.leafPrepend(this)||this.appendInner(e)):this};et.prototype.prepend=function(e){return e.length?et.from(e).append(this):this};et.prototype.appendInner=function(e){return new YP(this,e)};et.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?et.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};et.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};et.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};et.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(a,s){return i.push(e(a,s))},n,r),i};et.from=function(e){return e instanceof et?e:e&&e.length?new $N(e):et.empty};var $N=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,a){return i==0&&a==this.length?this:new e(this.values.slice(i,a))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,a,s,o){for(var l=a;l<s;l++)if(i(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,a,s,o){for(var l=a-1;l>=s;l--)if(i(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Bs)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Bs)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(et);et.empty=new $N([]);var YP=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,a,s){var o=this.left.length;if(i<o&&this.left.forEachInner(r,i,Math.min(a,o),s)===!1||a>o&&this.right.forEachInner(r,Math.max(i-o,0),Math.min(this.length,a)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,a,s){var o=this.left.length;if(i>o&&this.right.forEachInvertedInner(r,i-o,Math.max(a,o)-o,s+o)===!1||a<o&&this.left.forEachInvertedInner(r,Math.min(i,o),a,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var a=this.left.length;return i<=a?this.left.slice(r,i):r>=a?this.right.slice(r-a,i-a):this.left.slice(r,a).append(this.right.slice(0,i-a))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(et);const KP=500;class Yt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let s=e.tr,o,l,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),a=i.maps.length),a--,c.push(d);return}if(i){c.push(new tn(d.map));let p=d.step.map(i.slice(a)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],u.push(new tn(h,void 0,void 0,u.length+c.length))),a--,h&&i.appendMap(h,a)}else s.maybeStep(d.step);if(d.selection)return o=i?d.selection.map(i.slice(a)):d.selection,l=new Yt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,r,i){let a=[],s=this.eventCount,o=this.items,l=!i&&o.length?o.get(o.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new tn(e.mapping.maps[c],d,n),p;(p=l&&l.merge(f))&&(f=p,c?a.pop():o=o.slice(0,o.length-1)),a.push(f),n&&(s++,n=void 0),i||(l=f)}let u=s-r.depth;return u>ZP&&(o=XP(o,u),s-=u),new Yt(o.append(a),s)}remapping(e,n){let r=new ua;return this.items.forEach((i,a)=>{let s=i.mirrorOffset!=null&&a-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Yt(this.items.append(e.map(n=>new tn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(f=>{f.selection&&o--},i);let l=n;this.items.forEach(f=>{let p=a.getMirror(--l);if(p==null)return;s=Math.min(s,p);let h=a.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),b=f.selection&&f.selection.map(a.slice(l+1,p));b&&o++,r.push(new tn(h,g,b))}else r.push(new tn(h))},i);let u=[];for(let f=n;f<s;f++)u.push(new tn(a.maps[f]));let c=this.items.slice(0,i).append(u).append(r),d=new Yt(c,o);return d.emptyItemCount()>KP&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],a=0;return this.items.forEach((s,o)=>{if(o>=e)i.push(s),s.selection&&a++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&a++;let d=new tn(u.invert(),l,c),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new Yt(et.from(i.reverse()),a)}}Yt.empty=new Yt(et.empty,0);function XP(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class tn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new tn(n.getMap().invert(),n,this.selection)}}}class Bn{constructor(e,n,r,i,a){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=a}}const ZP=20;function QP(t,e,n,r){let i=n.getMeta(br),a;if(i)return i.historyState;n.getMeta(tF)&&(t=new Bn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(br))return s.getMeta(br).redo?new Bn(t.done.addTransform(n,void 0,r,ds(e)),t.undone,p0(n.mapping.maps),t.prevTime,t.prevComposition):new Bn(t.done,t.undone.addTransform(n,void 0,r,ds(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-r.newGroupDelay||!JP(n,t.prevRanges)),u=s?Pl(t.prevRanges,n.mapping):p0(n.mapping.maps);return new Bn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,ds(e)),Yt.empty,u,n.time,o??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Bn(t.done.rebased(n,a),t.undone.rebased(n,a),Pl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Bn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Pl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function JP(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let a=0;a<e.length;a+=2)r<=e[a+1]&&i>=e[a]&&(n=!0)}),n}function p0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,a,s)=>e.push(a,s));return e}function Pl(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),a=e.map(t[r+1],-1);i<=a&&n.push(i,a)}return n}function eF(t,e,n){let r=ds(e),i=br.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,r);if(!a)return null;let s=a.selection.resolve(a.transform.doc),o=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),i,r),l=new Bn(n?o:a.remaining,n?a.remaining:o,null,0,-1);return a.transform.setSelection(s).setMeta(br,{redo:n,historyState:l})}let Fl=!1,f0=null;function ds(t){let e=t.plugins;if(f0!=e){Fl=!1,f0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fl=!0;break}}return Fl}const br=new Pe("history"),tF=new Pe("closeHistory");function nF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Oe({key:br,state:{init(){return new Bn(Yt.empty,Yt.empty,null,0,-1)},apply(e,n,r){return QP(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?jN:r=="historyRedo"?qN:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function zN(t,e){return(n,r)=>{let i=br.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let a=eF(i,n,t);a&&r(e?a.scrollIntoView():a)}return!0}}const jN=zN(!1,!0),qN=zN(!0,!0);$e.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Oe({key:new Pe("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>i){const s=a-i,o=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(o,l);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=r||i>r&&a>r&&a<=i)return!0;if(i>r&&a>r&&a>i||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=a-r,u=o-l,c=o;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>r)}})]}});var rF=$e.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[UP(this.options)]}});$e.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Oe({key:new Pe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,a=[];if(!n||!r)return De.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,u)=>{if(l.isText)return;if(!(i>=u&&i<=u+l.nodeSize-1))return!1;s+=1});let o=0;return t.descendants((l,u)=>{if(l.isText||!(i>=u&&i<=u+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&s-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";a.push(ot.node(u,u+l.nodeSize,{class:this.options.className}))}),De.create(t,a)}}})]}});var iF=$e.create({name:"gapCursor",addProseMirrorPlugins(){return[jP()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ve(oe(t,"allowGapCursor",n)))!=null?e:null}}}),h0="placeholder";function aF(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var sF=$e.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:h0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${aF(this.options.dataAttribute)}`:`data-${h0}`;return[new Oe({key:new Pe("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;const s=this.editor.isEmpty;return e.descendants((o,l)=>{const u=i>=l&&i<=l+o.nodeSize,c=!o.isLeaf&&qo(o);if((u||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const f=ot.node(l,l+o.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:u}):this.options.placeholder});a.push(f)}return this.options.includeChildren}),De.create(e,a)}}})]}});$e.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Oe({key:new Pe("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||sN(n.selection)||t.view.dragging?null:De.create(n.doc,[ot.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function m0({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var oF=$e.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Pe(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Oe({key:e,appendTransaction:(i,a,s)=>{const{doc:o,tr:l,schema:u}=s,c=e.getState(s),d=o.content.size,f=u.nodes[n];if(c)return l.insert(d,f.create())},state:{init:(i,a)=>{const s=a.tr.doc.lastChild;return!m0({node:s,types:r})},apply:(i,a)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return a;const s=i.doc.lastChild;return!m0({node:s,types:r})}}})]}}),lF=$e.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>jN(t,e),redo:()=>({state:t,dispatch:e})=>qN(t,e)}},addProseMirrorPlugins(){return[nF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),uF=sF,Us=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},cF=/^\s*>\s$/,dF=kt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Us("blockquote",{...Ve(this.options.HTMLAttributes,t),children:Us("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(i=>{const o=e.renderChildren([i]).split(`
101
101
  `).map(l=>l.trim()===""?n:`${n} ${l}`);r.push(o.join(`
102
102
  `))}),r.join(`
103
103
  ${n}