@decocms/mesh 2.36.0 → 2.37.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 (133) hide show
  1. package/dist/client/assets/{AlertCircle-BBsdPk4A.js → AlertCircle-lJsd1WSR.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-lAQVNIGz.js → ArrowLeft-NyGN8FtU.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BkY-zg6S.js → ArrowUp-Cfl4EAcS.js} +1 -1
  4. package/dist/client/assets/{Check-DGEt7a83.js → Check-DmxydjBL.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-_zx6MDun.js → ChevronDown-C6ZdTyfO.js} +1 -1
  6. package/dist/client/assets/{Code01-CmmNAHsX.js → Code01-CtKfiTDD.js} +1 -1
  7. package/dist/client/assets/{Copy01-CmWQCnTv.js → Copy01-BMcgKhFM.js} +1 -1
  8. package/dist/client/assets/{CpuChip02-Y9BwtyF4.js → CpuChip02-CJ6MB_gs.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-DTu7bAhT.js → DotsHorizontal-BUtSXkqI.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DU5ZLUiI.js → DotsVertical-Dz9n-5F-.js} +1 -1
  11. package/dist/client/assets/{Download01-CXS8zZq_.js → Download01-xZY3OR1j.js} +1 -1
  12. package/dist/client/assets/{Edit01-BtkO_1-v.js → Edit01-BT4G_YIy.js} +1 -1
  13. package/dist/client/assets/{File06-DHAbXIko.js → File06-uEDwGa2p.js} +1 -1
  14. package/dist/client/assets/{FilterLines-DTGz1gEp.js → FilterLines-CAbmAqd-.js} +1 -1
  15. package/dist/client/assets/{FlipBackward-DmF6z19I.js → FlipBackward-CGc38rD2.js} +1 -1
  16. package/dist/client/assets/{GitBranch01-C4GFwoAm.js → GitBranch01-Ca-8ywjS.js} +1 -1
  17. package/dist/client/assets/{Grid01-CHl0QRcb.js → Grid01-D-48LkYB.js} +1 -1
  18. package/dist/client/assets/{Home02-BpRxtXpM.js → Home02-D4_hiRAj.js} +1 -1
  19. package/dist/client/assets/{Image01-CJcWxxNs.js → Image01-9m5NEF--.js} +1 -1
  20. package/dist/client/assets/{Inbox01-CldQXPkN.js → Inbox01-C3nQFXch.js} +1 -1
  21. package/dist/client/assets/{InfoCircle-o5q6AEn7.js → InfoCircle-nF74NMP8.js} +1 -1
  22. package/dist/client/assets/{Key01-2_mWB2Wx.js → Key01-xCvKojzf.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-C6sRVA41.js → LinkExternal01-DyfF0hfT.js} +1 -1
  24. package/dist/client/assets/{List-DWNVti9u.js → List-CbDyi-_I.js} +1 -1
  25. package/dist/client/assets/{Loading01-CDpaj5xb.js → Loading01-CN4PjLYm.js} +1 -1
  26. package/dist/client/assets/{Lock01-CdD_G1hu.js → Lock01-WemfJe2M.js} +1 -1
  27. package/dist/client/assets/{Play-DzzNNlsC.js → Play-_NYO0aZO.js} +1 -1
  28. package/dist/client/assets/{Plus-DTb2SFi0.js → Plus-D1XC-LWM.js} +1 -1
  29. package/dist/client/assets/{SearchMd-1nRZ9845.js → SearchMd-BgsYwh_0.js} +1 -1
  30. package/dist/client/assets/{Terminal-rdYS7kTQ.js → Terminal-DNQvnGyj.js} +1 -1
  31. package/dist/client/assets/{Trash01-BFIjJzbg.js → Trash01-XWQVxRUg.js} +1 -1
  32. package/dist/client/assets/{Upload01-_xk69_8v.js → Upload01-Bx3FQ-WR.js} +1 -1
  33. package/dist/client/assets/{X-y6tkt_Qn.js → X-BHMn15uu.js} +1 -1
  34. package/dist/client/assets/{XClose-BURK0juR.js → XClose-DrrGYZAf.js} +1 -1
  35. package/dist/client/assets/{agent-detail-RaHHrR9c.js → agent-detail-BSaqEYBm.js} +1 -1
  36. package/dist/client/assets/{agents-Dn2s7GO4.js → agents-Cax61kmw.js} +1 -1
  37. package/dist/client/assets/{alert-dialog-BEOI40du.js → alert-dialog-BXDbbD3T.js} +1 -1
  38. package/dist/client/assets/{auth-catchall-3OHJ7w3t.js → auth-catchall-BzJ9XgEE.js} +1 -1
  39. package/dist/client/assets/{avatar-C6jnW0d_.js → avatar-DszQRzwK.js} +1 -1
  40. package/dist/client/assets/{badge-yRhV1lXK.js → badge-ZMieXKPf.js} +1 -1
  41. package/dist/client/assets/{binder-Bh4xSKt2.js → binder-sRiH1ogE.js} +1 -1
  42. package/dist/client/assets/{button-DzrgKrxD.js → button-Bu5b3WTW.js} +1 -1
  43. package/dist/client/assets/{card-CYpriTCV.js → card-huVl9i-i.js} +1 -1
  44. package/dist/client/assets/{checkbox-R8OS6sPG.js → checkbox-DLuP_uee.js} +1 -1
  45. package/dist/client/assets/collection-detail-Bq6ZFqnT.js +26 -0
  46. package/dist/client/assets/{collection-display-button-BJuzX0-p.js → collection-display-button-Cb5uS-rc.js} +1 -1
  47. package/dist/client/assets/{collection-header-CT7Ib-40.js → collection-header-CemM_w2D.js} +1 -1
  48. package/dist/client/assets/{collection-page-C6HTnQmO.js → collection-page-VnMc_pGz.js} +1 -1
  49. package/dist/client/assets/{collection-search-CFyt0qeQ.js → collection-search-BVQF86eY.js} +1 -1
  50. package/dist/client/assets/{collection-tab-CEi5v-D8.js → collection-tab-ClpFqQOx.js} +1 -1
  51. package/dist/client/assets/{collection-table-wrapper-B1x7AuZ2.js → collection-table-wrapper-HRrsYLN0.js} +1 -1
  52. package/dist/client/assets/{connection-card-D1saTy4l.js → connection-card-DiYaoNe1.js} +1 -1
  53. package/dist/client/assets/{connection-detail-gn1oAek1.js → connection-detail-c39fzg2m.js} +1 -1
  54. package/dist/client/assets/{connections-C7lkwJOp.js → connections-CixvFZTx.js} +1 -1
  55. package/dist/client/assets/{constants-3YpuE-Vv.js → constants-C9jqRuDQ.js} +1 -1
  56. package/dist/client/assets/constants-Gfu8WPug.js +1 -0
  57. package/dist/client/assets/{create-organization-dialog-DOpykuY0.js → create-organization-dialog-CeY4ItWb.js} +1 -1
  58. package/dist/client/assets/{dialog-BDHOz3nW.js → dialog-CZLL2sHo.js} +1 -1
  59. package/dist/client/assets/{dropdown-menu-BHPkWxBp.js → dropdown-menu-BI7MuzMw.js} +1 -1
  60. package/dist/client/assets/{dynamic-plugin-layout-BuvyMpR6.js → dynamic-plugin-layout-D1oi470P.js} +1 -1
  61. package/dist/client/assets/{empty-state-BrfqjrV-.js → empty-state-BQfx1mwp.js} +1 -1
  62. package/dist/client/assets/{empty-state-X8MXdG5Z.js → empty-state-CgeXBI1W.js} +1 -1
  63. package/dist/client/assets/{env-vars-editor-Wp6Snysg.js → env-vars-editor-4EC6mCOl.js} +1 -1
  64. package/dist/client/assets/{error-boundary-B-c4BWIE.js → error-boundary-BaL_ffEC.js} +1 -1
  65. package/dist/client/assets/{estree-BOE5AzoZ.js → estree-CwOGYdhi.js} +2 -2
  66. package/dist/client/assets/{extract-connection-data-DG-j8HCd.js → extract-connection-data-DHRsnn5P.js} +1 -1
  67. package/dist/client/assets/{file-browser-7I8T9yi5.js → file-browser-_UBJPTIe.js} +2 -2
  68. package/dist/client/assets/{form-y1IQzViO.js → form-CoBL4_XN.js} +1 -1
  69. package/dist/client/assets/{grid-view-D_ickWXK.js → grid-view-D2Vn-CMC.js} +1 -1
  70. package/dist/client/assets/{home-BnnHcLCc.js → home-D2LI09X7.js} +1 -1
  71. package/dist/client/assets/{index-CPmmTuFq.js → index-B84yJOSG.js} +6 -6
  72. package/dist/client/assets/{index-DmftKlwh.js → index-BMTlZmWp.js} +1 -1
  73. package/dist/client/assets/index-CbebK-uV.js +25 -0
  74. package/dist/client/assets/{index-Mbq6x7Op.js → index-DJl8OcA5.js} +1 -1
  75. package/dist/client/assets/{index-DWUVjbey.js → index-DtkdBBYP.js} +3 -3
  76. package/dist/client/assets/{index-Dow0noXS.js → index-xK97rkRU.js} +1 -1
  77. package/dist/client/assets/{infiniteQueryObserver-DjPCEmbf.js → infiniteQueryObserver-BPcOZkH7.js} +1 -1
  78. package/dist/client/assets/{input-C0Akiz8R.js → input-CHbrtiSE.js} +1 -1
  79. package/dist/client/assets/{layout-C0pqJaEl.js → layout-BZs9w_M3.js} +1 -1
  80. package/dist/client/assets/{localstorage-keys-CDgA0mNW.js → localstorage-keys-Dzdim8m6.js} +1 -1
  81. package/dist/client/assets/{login-BvbZP2v1.js → login-L-IHcABm.js} +1 -1
  82. package/dist/client/assets/{mcp-oauth-DiLYfZmf.js → mcp-oauth-BxZXA3Xr.js} +1 -1
  83. package/dist/client/assets/{mcp-server-card-BqbhSqHE.js → mcp-server-card-MC8v04QK.js} +1 -1
  84. package/dist/client/assets/{mcp-server-detail-Biy1kzwO.js → mcp-server-detail-zNAPbUAw.js} +2 -2
  85. package/dist/client/assets/{members-l0ZyLo5_.js → members-DJdUGw0D.js} +1 -1
  86. package/dist/client/assets/{monaco-editor-BT5PdnDo.js → monaco-editor-C3ascXjJ.js} +2 -2
  87. package/dist/client/assets/{monitoring-TeCDGdQP.js → monitoring-JAuBbZfp.js} +3 -3
  88. package/dist/client/assets/{oauth-callback-DKUkdoUO.js → oauth-callback-BcGogxXg.js} +1 -1
  89. package/dist/client/assets/{page-C_xusawf.js → page-BxPZxw8o.js} +1 -1
  90. package/dist/client/assets/{page-CK0YoHAp.js → page-CUrPd-rM.js} +1 -1
  91. package/dist/client/assets/{pin-to-sidebar-button-Diw5MUhg.js → pin-to-sidebar-button-DSKZ2Fdq.js} +1 -1
  92. package/dist/client/assets/{plugin-empty-state-DVjr7TTM.js → plugin-empty-state-Cuv_BgUO.js} +1 -1
  93. package/dist/client/assets/{plugin-header-CQLZoMwl.js → plugin-header-DPgrCf4u.js} +1 -1
  94. package/dist/client/assets/{plugins-B8uvk-2S.js → plugins-CJ0UbjgM.js} +1 -1
  95. package/dist/client/assets/{popover-Bqjp3lef.js → popover-BxnPal23.js} +1 -1
  96. package/dist/client/assets/{registry-utils-BjTEfbyx.js → registry-utils-aIrZuCgt.js} +1 -1
  97. package/dist/client/assets/{resizable-khgBITYU.js → resizable-CaoQeLjg.js} +1 -1
  98. package/dist/client/assets/{resource-tabs-CEzwvbtD.js → resource-tabs-CPGMnxBP.js} +1 -1
  99. package/dist/client/assets/{select-BsBmus1d.js → select-B908g1mB.js} +1 -1
  100. package/dist/client/assets/{settings-NNXgTLFy.js → settings-LRlnP2Lc.js} +1 -1
  101. package/dist/client/assets/{shell-layout-w6NT453w.js → shell-layout-DRozOWy1.js} +1 -1
  102. package/dist/client/assets/{spinner-BR-31pbW.js → spinner-CsK38Tsy.js} +1 -1
  103. package/dist/client/assets/{switch-DyGK9gv4.js → switch-CUTLvBMT.js} +1 -1
  104. package/dist/client/assets/{textarea-DUQNyBVS.js → textarea-CbUKoeLq.js} +1 -1
  105. package/dist/client/assets/{tool-set-selector-B23zyGSI.js → tool-set-selector-fEQOYxCL.js} +1 -1
  106. package/dist/client/assets/{tools-list-B-1VFGOM.js → tools-list-CX7oXeq_.js} +1 -1
  107. package/dist/client/assets/{tooltip-D2-8cdBQ.js → tooltip-Dk0Jzfvj.js} +1 -1
  108. package/dist/client/assets/{typewriter-title-Jt5k5OMq.js → typewriter-title-DPdfdL2f.js} +1 -1
  109. package/dist/client/assets/{use-binding-BjjhbO1q.js → use-binding-D-hqNLrQ.js} +1 -1
  110. package/dist/client/assets/{use-collections-CuJOSiIW.js → use-collections-A_XW_jU_.js} +1 -1
  111. package/dist/client/assets/{use-connection-CS5XiP__.js → use-connection-BIIOhc_X.js} +1 -1
  112. package/dist/client/assets/{use-create-virtual-mcp-BEBnxDaS.js → use-create-virtual-mcp-DWkiDqVu.js} +1 -1
  113. package/dist/client/assets/{use-list-state-Dhz45fzB.js → use-list-state-C8RoL1ci.js} +1 -1
  114. package/dist/client/assets/{use-members-Dn_Ol9A3.js → use-members-C93PMRIh.js} +1 -1
  115. package/dist/client/assets/{use-mobile-DmXzMUON.js → use-mobile-DIF2qUK5.js} +1 -1
  116. package/dist/client/assets/{use-organization-settings-DAb84vu_.js → use-organization-settings-BGsA2C0p.js} +1 -1
  117. package/dist/client/assets/{use-virtual-mcp-Cs8LMHmN.js → use-virtual-mcp-ygO0Mzk-.js} +1 -1
  118. package/dist/client/assets/useInfiniteQuery-BHxWaPEq.js +1 -0
  119. package/dist/client/assets/{useMutation-DacqSeBC.js → useMutation-BW_aGPem.js} +1 -1
  120. package/dist/client/assets/useQuery-CgyESPOI.js +1 -0
  121. package/dist/client/assets/{value-BbMvoXrk.js → value-BL9_bCwS.js} +1 -1
  122. package/dist/client/assets/{view-mode-toggle-9cI1FT02.js → view-mode-toggle-ByWv0ljG.js} +1 -1
  123. package/dist/client/assets/{virtual-mcp-DK-R1jvj.js → virtual-mcp-vOZXwxjs.js} +1 -1
  124. package/dist/client/assets/{workflow-BZYK8eRi.js → workflow-CpI2biho.js} +1 -1
  125. package/dist/client/index.html +1 -1
  126. package/dist/server/cli.js +118 -118
  127. package/dist/server/server.js +86 -86
  128. package/package.json +1 -1
  129. package/dist/client/assets/collection-detail-CX-FJ5sT.js +0 -26
  130. package/dist/client/assets/constants-Bqhh0LV9.js +0 -1
  131. package/dist/client/assets/index-BoRv814R.js +0 -25
  132. package/dist/client/assets/useInfiniteQuery-DiGWO7yY.js +0 -1
  133. package/dist/client/assets/useQuery-CRLVjwLh.js +0 -1
@@ -1,10 +1,10 @@
1
- import{r as M,c as ne,j as S,bL as $O,bM as zO,t as jO,a5 as jt,s as ee,bN as io,bO as a_,bf as qO,bg as GO,bd as VO,a2 as Ot,a3 as Ma,h as rs,o as Oe,be as de,a4 as Zn,bP as WO,bQ as ze,_ as YO,bm as ul,i as s_,K as Hi,u as o_,E as Gg,a0 as un,d as l_,a as KO,b as XO,F as u_,bR as c_,bI as ZO,bq as Lt,bS as QO,bT as JO,aP as d_,bU as eL,bV as vn,bW as Xl,bX as tL,bY as Zl,bZ as nL,b_ as rL,b$ as iL,c0 as aL,c1 as sL,c2 as oL,c3 as lL,c4 as uL,e as p_,bH as ao,aa as Vg,ab as cL,ad as dL,a6 as pL,a8 as fL,a9 as hL,b3 as mL,ai as gL}from"./index-CPmmTuFq.js";import{c as me,B as gt}from"./button-DzrgKrxD.js";import{i as bL}from"./X-y6tkt_Qn.js";import{u as Gn}from"./virtual-mcp-DK-R1jvj.js";import{u as Qr,W as Wg,d as EL}from"./constants-3YpuE-Vv.js";import{u as f_}from"./use-virtual-mcp-Cs8LMHmN.js";import{a as yL}from"./use-collections-CuJOSiIW.js";import{a as h_,u as TL}from"./use-connection-CS5XiP__.js";import{a as SL}from"./use-binding-BjjhbO1q.js";import{u as AL,M as m_,s as HE}from"./monaco-editor-BT5PdnDo.js";import{u as ma,L as so}from"./localstorage-keys-CDgA0mNW.js";import{I as Yg}from"./input-C0Akiz8R.js";import{a as is,b as as,P as ss}from"./popover-Bqjp3lef.js";import{S as kL,a as xL,b as vL,c as _L,d as CL}from"./select-BsBmus1d.js";import{i as IL}from"./File06-DHAbXIko.js";import{c as NL,i as g_}from"./Grid01-CHl0QRcb.js";import{a as wL}from"./Image01-CJcWxxNs.js";import{i as cl}from"./SearchMd-1nRZ9845.js";import{S as dl}from"./spinner-BR-31pbW.js";import{c as Jr,T as ei,a as ti,b as Kg}from"./tooltip-D2-8cdBQ.js";import{useMCPPromptsList as RL,getPrompt as b_,listPrompts as $E,listResources as zE,readResource as OL}from"./index-DmftKlwh.js";import{E as LL,i as DL}from"./error-boundary-B-c4BWIE.js";import{c as ML,b as PL,e as FL,a as BL,D as UL}from"./dialog-BDHOz3nW.js";import{a as HL,F as $L,b as zL,c as jL,d as qL,f as GL}from"./form-y1IQzViO.js";import{I as Xg,E as VL}from"./empty-state-X8MXdG5Z.js";import{i as E_}from"./AlertCircle-BBsdPk4A.js";import{i as WL}from"./ArrowUp-BkY-zg6S.js";import{t as YL}from"./ChevronDown-_zx6MDun.js";import{i as Zg}from"./CpuChip02-Y9BwtyF4.js";import{i as KL}from"./Edit01-BtkO_1-v.js";import{i as pl}from"./Check-DGEt7a83.js";import{a as Qg}from"./Copy01-CmWQCnTv.js";import{i as XL}from"./Terminal-rdYS7kTQ.js";import{g as ZL}from"./generate-id-Dyweu44Y.js";import{s as QL}from"./Trash01-BFIjJzbg.js";import{u as JL}from"./use-create-virtual-mcp-BEBnxDaS.js";import{s as e2}from"./Plus-DTb2SFi0.js";var Pa;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(const o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Pa||(Pa={}));var jE;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(jE||(jE={}));Pa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Pa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class oo extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){const u=s.path[l];l===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return i(this),r}static assert(e){if(!(e instanceof oo))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pa.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}oo.create=t=>new oo(t);var qE;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(qE||(qE={}));var ge;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ge||(ge={}));const y_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));y_.displayName="Atom02";const T_=({size:t=24,color:e="currentColor",...n})=>M.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},M.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));T_.displayName="ChevronSelectorVertical";const S_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));S_.displayName="Coins01";const A_=({size:t=24,color:e="currentColor",...n})=>M.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},M.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));A_.displayName="CurrencyDollar";const k_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));k_.displayName="Lightbulb01";const x_=({size:t=24,color:e="currentColor",...n})=>M.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},M.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));x_.displayName="LogOut04";const fl=({size:t=24,color:e="currentColor",...n})=>M.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},M.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));fl.displayName="Stars01";const v_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));v_.displayName="Stop";const __=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));__.displayName="Target04";const C_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));C_.displayName="XCircle";function yt(t){const e=ne.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=me("bg-accent animate-pulse rounded-md",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=S.jsx("div",{"data-slot":"skeleton",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function t2(){const t=ne.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=so.developerMode(),t[0]=e):e=t[0],ma(e,!1)}var I_="vercel.ai.error",n2=Symbol.for(I_),GE,VE,Cn=class N_ extends(VE=Error,GE=n2,VE){constructor({name:e,message:n,cause:r}){super(n),this[GE]=!0,this.name=e,this.cause=r}static isInstance(e){return N_.hasMarker(e,I_)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function w_(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var R_="AI_InvalidArgumentError",O_=`vercel.ai.error.${R_}`,r2=Symbol.for(O_),WE,YE,i2=class extends(YE=Cn,WE=r2,YE){constructor({message:t,cause:e,argument:n}){super({name:R_,message:t,cause:e}),this[WE]=!0,this.argument=n}static isInstance(t){return Cn.hasMarker(t,O_)}},L_="AI_JSONParseError",D_=`vercel.ai.error.${L_}`,a2=Symbol.for(D_),KE,XE,ZE=class extends(XE=Cn,KE=a2,XE){constructor({text:t,cause:e}){super({name:L_,message:`JSON parsing failed: Text: ${t}.
1
+ import{r as M,c as ne,j as S,bM as $O,bN as zO,t as jO,a5 as jt,s as ee,bO as io,bP as a_,bf as qO,bg as GO,bd as VO,a2 as Ot,a3 as Ma,h as rs,o as Oe,be as de,a4 as Zn,bQ as WO,bR as ze,_ as YO,bm as ul,i as s_,K as Hi,u as o_,E as Gg,a0 as un,d as l_,a as KO,b as XO,F as u_,bS as c_,bJ as ZO,br as Lt,bT as QO,bU as JO,aP as d_,bV as eL,bW as vn,bX as Xl,bY as tL,bZ as Zl,b_ as nL,b$ as rL,c0 as iL,c1 as aL,c2 as sL,c3 as oL,c4 as lL,c5 as uL,e as p_,bI as ao,aa as Vg,ab as cL,ad as dL,a6 as pL,a8 as fL,a9 as hL,b3 as mL,ai as gL}from"./index-B84yJOSG.js";import{c as me,B as gt}from"./button-Bu5b3WTW.js";import{i as bL}from"./X-BHMn15uu.js";import{u as Gn}from"./virtual-mcp-vOZXwxjs.js";import{u as Qr,W as Wg,d as EL}from"./constants-C9jqRuDQ.js";import{u as f_}from"./use-virtual-mcp-ygO0Mzk-.js";import{a as yL}from"./use-collections-A_XW_jU_.js";import{a as h_,u as TL}from"./use-connection-BIIOhc_X.js";import{a as SL}from"./use-binding-D-hqNLrQ.js";import{u as AL,M as m_,s as HE}from"./monaco-editor-C3ascXjJ.js";import{u as ma,L as so}from"./localstorage-keys-Dzdim8m6.js";import{I as Yg}from"./input-CHbrtiSE.js";import{a as is,b as as,P as ss}from"./popover-BxnPal23.js";import{S as kL,a as xL,b as vL,c as _L,d as CL}from"./select-B908g1mB.js";import{i as IL}from"./File06-uEDwGa2p.js";import{c as NL,i as g_}from"./Grid01-D-48LkYB.js";import{a as wL}from"./Image01-9m5NEF--.js";import{i as cl}from"./SearchMd-BgsYwh_0.js";import{S as dl}from"./spinner-CsK38Tsy.js";import{c as Jr,T as ei,a as ti,b as Kg}from"./tooltip-Dk0Jzfvj.js";import{useMCPPromptsList as RL,getPrompt as b_,listPrompts as $E,listResources as zE,readResource as OL}from"./index-BMTlZmWp.js";import{E as LL,i as DL}from"./error-boundary-BaL_ffEC.js";import{c as ML,b as PL,e as FL,a as BL,D as UL}from"./dialog-CZLL2sHo.js";import{a as HL,F as $L,b as zL,c as jL,d as qL,f as GL}from"./form-CoBL4_XN.js";import{I as Xg,E as VL}from"./empty-state-CgeXBI1W.js";import{i as E_}from"./AlertCircle-lJsd1WSR.js";import{i as WL}from"./ArrowUp-Cfl4EAcS.js";import{t as YL}from"./ChevronDown-C6ZdTyfO.js";import{i as Zg}from"./CpuChip02-CJ6MB_gs.js";import{i as KL}from"./Edit01-BT4G_YIy.js";import{i as pl}from"./Check-DmxydjBL.js";import{a as Qg}from"./Copy01-BMcgKhFM.js";import{i as XL}from"./Terminal-DNQvnGyj.js";import{g as ZL}from"./generate-id-Dyweu44Y.js";import{s as QL}from"./Trash01-XWQVxRUg.js";import{u as JL}from"./use-create-virtual-mcp-DWkiDqVu.js";import{s as e2}from"./Plus-D1XC-LWM.js";var Pa;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(const o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Pa||(Pa={}));var jE;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(jE||(jE={}));Pa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Pa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class oo extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){const u=s.path[l];l===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return i(this),r}static assert(e){if(!(e instanceof oo))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pa.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}oo.create=t=>new oo(t);var qE;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(qE||(qE={}));var ge;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ge||(ge={}));const y_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));y_.displayName="Atom02";const T_=({size:t=24,color:e="currentColor",...n})=>M.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},M.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));T_.displayName="ChevronSelectorVertical";const S_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));S_.displayName="Coins01";const A_=({size:t=24,color:e="currentColor",...n})=>M.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},M.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));A_.displayName="CurrencyDollar";const k_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));k_.displayName="Lightbulb01";const x_=({size:t=24,color:e="currentColor",...n})=>M.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},M.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));x_.displayName="LogOut04";const fl=({size:t=24,color:e="currentColor",...n})=>M.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},M.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));fl.displayName="Stars01";const v_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));v_.displayName="Stop";const __=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));__.displayName="Target04";const C_=({size:t=24,color:e="currentColor",...n})=>M.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},M.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"}));C_.displayName="XCircle";function yt(t){const e=ne.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=me("bg-accent animate-pulse rounded-md",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=S.jsx("div",{"data-slot":"skeleton",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function t2(){const t=ne.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=so.developerMode(),t[0]=e):e=t[0],ma(e,!1)}var I_="vercel.ai.error",n2=Symbol.for(I_),GE,VE,Cn=class N_ extends(VE=Error,GE=n2,VE){constructor({name:e,message:n,cause:r}){super(n),this[GE]=!0,this.name=e,this.cause=r}static isInstance(e){return N_.hasMarker(e,I_)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function w_(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var R_="AI_InvalidArgumentError",O_=`vercel.ai.error.${R_}`,r2=Symbol.for(O_),WE,YE,i2=class extends(YE=Cn,WE=r2,YE){constructor({message:t,cause:e,argument:n}){super({name:R_,message:t,cause:e}),this[WE]=!0,this.argument=n}static isInstance(t){return Cn.hasMarker(t,O_)}},L_="AI_JSONParseError",D_=`vercel.ai.error.${L_}`,a2=Symbol.for(D_),KE,XE,ZE=class extends(XE=Cn,KE=a2,XE){constructor({text:t,cause:e}){super({name:L_,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${w_(e)}`,cause:e}),this[KE]=!0,this.text=t}static isInstance(t){return Cn.hasMarker(t,D_)}},M_="AI_TypeValidationError",P_=`vercel.ai.error.${M_}`,s2=Symbol.for(P_),QE,JE,Ii=class Mm extends(JE=Cn,QE=s2,JE){constructor({value:e,cause:n}){super({name:M_,message:`Type validation failed: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${w_(n)}`,cause:n}),this[QE]=!0,this.value=e}static isInstance(e){return Cn.hasMarker(e,P_)}static wrap({value:e,cause:n}){return Mm.isInstance(n)&&n.value===e?n:new Mm({value:e,cause:n})}},ls=({prefix:t,size:e=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=()=>{const a=n.length,s=new Array(e);for(let o=0;o<e;o++)s[o]=n[Math.random()*a|0];return s.join("")};if(t==null)return i;if(n.includes(r))throw new i2({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${t}${r}${i()}`},o2=ls();function e0(t=globalThis){var e,n,r;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(r=(n=t.process)==null?void 0:n.versions)!=null&&r.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function wr(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((n,r)=>{e[r.toLowerCase()]=n});else{Array.isArray(t)||(t=Object.entries(t));for(const[n,r]of t)r!=null&&(e[n.toLowerCase()]=r)}return e}function t0(t,...e){const n=new Headers(wr(t)),r=n.get("user-agent")||"";return n.set("user-agent",[r,...e].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var l2=/"__proto__"\s*:/,u2=/"constructor"\s*:/;function n0(t){const e=JSON.parse(t);return e===null||typeof e!="object"||l2.test(t)===!1&&u2.test(t)===!1?e:c2(e)}function c2(t){let e=[t];for(;e.length;){const n=e;e=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in r){const a=r[i];a&&typeof a=="object"&&e.push(a)}}}return t}function d2(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return n0(t)}try{return n0(t)}finally{Error.stackTraceLimit=e}}function Jg(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:n}=t;if(n!=null)for(const r of Object.keys(n))n[r]=Cr(n[r])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(Cr):Cr(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(Cr)),t.allOf!=null&&(t.allOf=t.allOf.map(Cr)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(Cr));const{definitions:e}=t;if(e!=null)for(const n of Object.keys(e))e[n]=Cr(e[n]);return t}function Cr(t){return typeof t=="boolean"?t:Jg(t)}var p2=Symbol("Let zodToJsonSchema decide on which parser to use"),r0={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},f2=t=>typeof t=="string"?{...r0,name:t}:{...r0,...t};function Qt(){return{}}function h2(t,e){var n,r,i;const a={type:"array"};return(n=t.type)!=null&&n._def&&((i=(r=t.type)==null?void 0:r._def)==null?void 0:i.typeName)!==ge.ZodAny&&(a.items=De(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(a.minItems=t.minLength.value),t.maxLength&&(a.maxItems=t.maxLength.value),t.exactLength&&(a.minItems=t.exactLength.value,a.maxItems=t.exactLength.value),a}function m2(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function g2(){return{type:"boolean"}}function F_(t,e){return De(t.type._def,e)}var b2=(t,e)=>De(t.innerType._def,e);function B_(t,e,n){const r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,a)=>B_(t,e,i))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return E2(t)}}var E2=t=>{const e={type:"integer",format:"unix-time"};for(const n of t.checks)switch(n.kind){case"min":e.minimum=n.value;break;case"max":e.maximum=n.value;break}return e};function y2(t,e){return{...De(t.innerType._def,e),default:t.defaultValue()}}function T2(t,e){return e.effectStrategy==="input"?De(t.schema._def,e):Qt()}function S2(t){return{type:"string",enum:Array.from(t.values)}}var A2=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function k2(t,e){const n=[De(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),De(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return n.forEach(i=>{if(A2(i))r.push(...i.allOf);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:s,...o}=i;a=o}r.push(a)}}),r.length?{allOf:r}:void 0}function x2(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Ql=void 0,pn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ql===void 0&&(Ql=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ql),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function U_(t,e){const n={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":fn(n,"email",r.message,e);break;case"format:idn-email":fn(n,"idn-email",r.message,e);break;case"pattern:zod":Rt(n,pn.email,r.message,e);break}break;case"url":fn(n,"uri",r.message,e);break;case"uuid":fn(n,"uuid",r.message,e);break;case"regex":Rt(n,r.regex,r.message,e);break;case"cuid":Rt(n,pn.cuid,r.message,e);break;case"cuid2":Rt(n,pn.cuid2,r.message,e);break;case"startsWith":Rt(n,RegExp(`^${Jl(r.value,e)}`),r.message,e);break;case"endsWith":Rt(n,RegExp(`${Jl(r.value,e)}$`),r.message,e);break;case"datetime":fn(n,"date-time",r.message,e);break;case"date":fn(n,"date",r.message,e);break;case"time":fn(n,"time",r.message,e);break;case"duration":fn(n,"duration",r.message,e);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{Rt(n,RegExp(Jl(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&fn(n,"ipv4",r.message,e),r.version!=="v4"&&fn(n,"ipv6",r.message,e);break}case"base64url":Rt(n,pn.base64url,r.message,e);break;case"jwt":Rt(n,pn.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&Rt(n,pn.ipv4Cidr,r.message,e),r.version!=="v4"&&Rt(n,pn.ipv6Cidr,r.message,e);break}case"emoji":Rt(n,pn.emoji(),r.message,e);break;case"ulid":{Rt(n,pn.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{fn(n,"binary",r.message,e);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{Rt(n,pn.base64,r.message,e);break}}break}case"nanoid":Rt(n,pn.nanoid,r.message,e)}return n}function Jl(t,e){return e.patternStrategy==="escape"?_2(t):t}var v2=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _2(t){let e="";for(let n=0;n<t.length;n++)v2.has(t[n])||(e+="\\"),e+=t[n];return e}function fn(t,e,n,r){var i;t.format||(i=t.anyOf)!=null&&i.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...n&&r.errorMessages&&{errorMessage:{format:n}}})):t.format=e}function Rt(t,e,n,r){var i;t.pattern||(i=t.allOf)!=null&&i.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:i0(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):t.pattern=i0(e,r)}function i0(t,e){var n;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=r.i?t.source.toLowerCase():t.source;let a="",s=!1,o=!1,l=!1;for(let u=0;u<i.length;u++){if(s){a+=i[u],s=!1;continue}if(r.i){if(o){if(i[u].match(/[a-z]/)){l?(a+=i[u],a+=`${i[u-2]}-${i[u]}`.toUpperCase(),l=!1):i[u+1]==="-"&&((n=i[u+2])!=null&&n.match(/[a-z]/))?(a+=i[u],l=!0):a+=`${i[u]}${i[u].toUpperCase()}`;continue}}else if(i[u].match(/[a-z]/)){a+=`[${i[u]}${i[u].toUpperCase()}]`;continue}}if(r.m){if(i[u]==="^"){a+=`(^|(?<=[\r
4
4
  ]))`;continue}else if(i[u]==="$"){a+=`($|(?=[\r
5
5
  ]))`;continue}}if(r.s&&i[u]==="."){a+=o?`${i[u]}\r
6
6
  `:`[${i[u]}\r
7
- ]`;continue}a+=i[u],i[u]==="\\"?s=!0:o&&i[u]==="]"?o=!1:!o&&i[u]==="["&&(o=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function H_(t,e){var n,r,i,a,s,o;const l={type:"object",additionalProperties:(n=De(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ge.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:u,...c}=U_(t.keyType._def,e);return{...l,propertyNames:c}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ge.ZodEnum)return{...l,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ge.ZodBranded&&t.keyType._def.type._def.typeName===ge.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:u,...c}=F_(t.keyType._def,e);return{...l,propertyNames:c}}}return l}function C2(t,e){if(e.mapStrategy==="record")return H_(t,e);const n=De(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Qt(),r=De(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Qt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function I2(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function N2(){return{not:Qt()}}function w2(){return{type:"null"}}var Pm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function R2(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Pm&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=Pm[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];case"symbol":case"undefined":case"function":default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,o)=>o.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return O2(t,e)}var O2=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>De(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function L2(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[Pm[t.innerType._def.typeName],"null"]};const n=De(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function D2(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function M2(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let o=i[s];if(o===void 0||o._def===void 0)continue;const l=F2(o),u=De(o._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});u!==void 0&&(n.properties[s]=u,l||r.push(s))}r.length&&(n.required=r);const a=P2(t,e);return a!==void 0&&(n.additionalProperties=a),n}function P2(t,e){if(t.catchall._def.typeName!=="ZodNever")return De(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function F2(t){try{return t.isOptional()}catch{return!0}}var B2=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return De(t.innerType._def,e);const r=De(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Qt()},r]}:Qt()},U2=(t,e)=>{if(e.pipeStrategy==="input")return De(t.in._def,e);if(e.pipeStrategy==="output")return De(t.out._def,e);const n=De(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=De(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function H2(t,e){return De(t.type._def,e)}function $2(t,e){const r={type:"array",uniqueItems:!0,items:De(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function z2(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>De(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:De(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>De(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function j2(){return{not:Qt()}}function q2(){return Qt()}var G2=(t,e)=>De(t.innerType._def,e),V2=(t,e,n)=>{switch(e){case ge.ZodString:return U_(t,n);case ge.ZodNumber:return D2(t);case ge.ZodObject:return M2(t,n);case ge.ZodBigInt:return m2(t);case ge.ZodBoolean:return g2();case ge.ZodDate:return B_(t,n);case ge.ZodUndefined:return j2();case ge.ZodNull:return w2();case ge.ZodArray:return h2(t,n);case ge.ZodUnion:case ge.ZodDiscriminatedUnion:return R2(t,n);case ge.ZodIntersection:return k2(t,n);case ge.ZodTuple:return z2(t,n);case ge.ZodRecord:return H_(t,n);case ge.ZodLiteral:return x2(t);case ge.ZodEnum:return S2(t);case ge.ZodNativeEnum:return I2(t);case ge.ZodNullable:return L2(t,n);case ge.ZodOptional:return B2(t,n);case ge.ZodMap:return C2(t,n);case ge.ZodSet:return $2(t,n);case ge.ZodLazy:return()=>t.getter()._def;case ge.ZodPromise:return H2(t,n);case ge.ZodNaN:case ge.ZodNever:return N2();case ge.ZodEffects:return T2(t,n);case ge.ZodAny:return Qt();case ge.ZodUnknown:return q2();case ge.ZodDefault:return y2(t,n);case ge.ZodBranded:return F_(t,n);case ge.ZodReadonly:return G2(t,n);case ge.ZodCatch:return b2(t,n);case ge.ZodPipeline:return U2(t,n);case ge.ZodFunction:case ge.ZodVoid:case ge.ZodSymbol:return;default:return(r=>{})()}},W2=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function De(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const l=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(l!==p2)return l}if(i&&!n){const l=Y2(i,e);if(l!==void 0)return l}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=V2(t,t.typeName,e),o=typeof s=="function"?De(s(),e):s;if(o&&K2(t,e,o),e.postProcess){const l=e.postProcess(o,t,e);return a.jsonSchema=o,l}return a.jsonSchema=o,o}var Y2=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:W2(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Qt()):e.$refStrategy==="seen"?Qt():void 0}},K2=(t,e,n)=>(t.description&&(n.description=t.description),n),X2=t=>{const e=f2(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},Z2=(t,e)=>{var n;const r=X2(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[c,d])=>{var p;return{...u,[c]:(p=De(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,c]},!0))!=null?p:Qt()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=De(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:Qt(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(s.title=o);const l=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return l.$schema="http://json-schema.org/draft-07/schema#",l},Fm=Symbol.for("vercel.ai.schema");function Q2(t){let e;return()=>(e==null&&(e=t()),e)}function hl(t,{validate:e}={}){return{[Fm]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function J2(t){return typeof t=="object"&&t!==null&&Fm in t&&t[Fm]===!0&&"jsonSchema"in t&&"validate"in t}function eb(t){return t==null?hl({properties:{},additionalProperties:!1}):J2(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?$_(t):eD(t):t()}function eD(t){return hl(()=>Jg(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Ii({value:e,cause:n.issues})}}})}function tD(t,e){var n;const r=(n=void 0)!=null?n:!1;return hl(()=>Z2(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function nD(t,e){var n;const r=(n=void 0)!=null?n:!1;return hl(()=>Jg(jO(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await zO(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function rD(t){return"_zod"in t}function $_(t,e){return rD(t)?nD(t):tD(t)}async function a0({value:t,schema:e}){const n=await Fa({value:t,schema:e});if(!n.success)throw Ii.wrap({value:t,cause:n.error});return n.value}async function Fa({value:t,schema:e}){const n=eb(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Ii.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:Ii.wrap({value:t,cause:r}),rawValue:t}}}async function qr({text:t,schema:e}){try{const n=d2(t);return e==null?{success:!0,value:n,rawValue:n}:await Fa({value:n,schema:e})}catch(n){return{success:!1,error:ZE.isInstance(n)?n:new ZE({text:t,cause:n}),rawValue:void 0}}}function iD({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new $O).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await qr({text:n,schema:e}))}}))}async function nr(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var aD=Object.defineProperty,sD=(t,e)=>{for(var n in e)aD(t,n,{get:e[n],enumerable:!0})},z_="AI_NoObjectGeneratedError",j_=`vercel.ai.error.${z_}`,oD=Symbol.for(j_),q_,fr=class extends Cn{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:z_,message:t,cause:e}),this[q_]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return Cn.hasMarker(t,j_)}};q_=oD;var G_="AI_UIMessageStreamError",V_=`vercel.ai.error.${G_}`,lD=Symbol.for(V_),W_,ui=class extends Cn{constructor({chunkType:t,chunkId:e,message:n}){super({name:G_,message:n}),this[W_]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return Cn.hasMarker(t,V_)}};W_=lD;var s0="6.0.49",Y_=jt([ee(),io(Uint8Array),io(ArrayBuffer),a_(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),Ba=qO(()=>jt([GO(),ee(),VO(),Ot(),Ma(ee(),Ba.optional()),rs(Ba)])),xe=Ma(ee(),Ma(ee(),Ba.optional())),K_=Oe({type:de("text"),text:ee(),providerOptions:xe.optional()}),uD=Oe({type:de("image"),image:jt([Y_,io(URL)]),mediaType:ee().optional(),providerOptions:xe.optional()}),X_=Oe({type:de("file"),data:jt([Y_,io(URL)]),filename:ee().optional(),mediaType:ee(),providerOptions:xe.optional()}),cD=Oe({type:de("reasoning"),text:ee(),providerOptions:xe.optional()}),dD=Oe({type:de("tool-call"),toolCallId:ee(),toolName:ee(),input:Zn(),providerOptions:xe.optional(),providerExecuted:Ot().optional()}),pD=WO("type",[Oe({type:de("text"),value:ee(),providerOptions:xe.optional()}),Oe({type:de("json"),value:Ba,providerOptions:xe.optional()}),Oe({type:de("execution-denied"),reason:ee().optional(),providerOptions:xe.optional()}),Oe({type:de("error-text"),value:ee(),providerOptions:xe.optional()}),Oe({type:de("error-json"),value:Ba,providerOptions:xe.optional()}),Oe({type:de("content"),value:rs(jt([Oe({type:de("text"),text:ee(),providerOptions:xe.optional()}),Oe({type:de("media"),data:ee(),mediaType:ee()}),Oe({type:de("file-data"),data:ee(),mediaType:ee(),filename:ee().optional(),providerOptions:xe.optional()}),Oe({type:de("file-url"),url:ee(),providerOptions:xe.optional()}),Oe({type:de("file-id"),fileId:jt([ee(),Ma(ee(),ee())]),providerOptions:xe.optional()}),Oe({type:de("image-data"),data:ee(),mediaType:ee(),providerOptions:xe.optional()}),Oe({type:de("image-url"),url:ee(),providerOptions:xe.optional()}),Oe({type:de("image-file-id"),fileId:jt([ee(),Ma(ee(),ee())]),providerOptions:xe.optional()}),Oe({type:de("custom"),providerOptions:xe.optional()})]))})]),Z_=Oe({type:de("tool-result"),toolCallId:ee(),toolName:ee(),output:pD,providerOptions:xe.optional()}),fD=Oe({type:de("tool-approval-request"),approvalId:ee(),toolCallId:ee()}),hD=Oe({type:de("tool-approval-response"),approvalId:ee(),approved:Ot(),reason:ee().optional()}),mD=Oe({role:de("system"),content:ee(),providerOptions:xe.optional()}),gD=Oe({role:de("user"),content:jt([ee(),rs(jt([K_,uD,X_]))]),providerOptions:xe.optional()}),bD=Oe({role:de("assistant"),content:jt([ee(),rs(jt([K_,X_,cD,dD,Z_,fD]))]),providerOptions:xe.optional()}),ED=Oe({role:de("tool"),content:rs(jt([Z_,hD])),providerOptions:xe.optional()});jt([mD,gD,bD,ED]);function Q_(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),o=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&o?n[r]=Q_(a,i):n[r]=i}return n}var yD={};sD(yD,{array:()=>kD,choice:()=>xD,json:()=>vD,object:()=>AD,text:()=>SD});function TD(t){const e=["ROOT"];let n=-1,r=null;function i(l,u,c){switch(l){case'"':{n=u,e.pop(),e.push(c),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=u,r=u,e.pop(),e.push(c),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(c),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=u,e.pop(),e.push(c),e.push("INSIDE_NUMBER");break}case"{":{n=u,e.pop(),e.push(c),e.push("INSIDE_OBJECT_START");break}case"[":{n=u,e.pop(),e.push(c),e.push("INSIDE_ARRAY_START");break}}}function a(l,u){switch(l){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=u,e.pop();break}}}function s(l,u){switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=u,e.pop();break}}}for(let l=0;l<t.length;l++){const u=t[l];switch(e[e.length-1]){case"ROOT":i(u,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(u){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(u){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(u){case'"':{e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(u){case":":{e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(u,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(u,l);break}case"INSIDE_STRING":{switch(u){case'"':{e.pop(),n=l;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{switch(u){case"]":{n=l,e.pop();break}default:{n=l,i(u,l,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(u){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(u,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=l;break}case"INSIDE_NUMBER":{switch(u){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,l);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,l);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const d=t.substring(r,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(u,l):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l)):n=l;break}}}let o=t.slice(0,n+1);for(let l=e.length-1;l>=0;l--)switch(e[l]){case"INSIDE_STRING":{o+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{o+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{o+="]";break}case"INSIDE_LITERAL":{const c=t.substring(r,t.length);"true".startsWith(c)?o+="true".slice(c.length):"false".startsWith(c)?o+="false".slice(c.length):"null".startsWith(c)&&(o+="null".slice(c.length))}}return o}async function us(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await qr({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await qr({text:TD(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var SD=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),AD=({schema:t,name:e,description:n})=>{const r=eb(t);return{name:"object",responseFormat:nr(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await qr({text:i});if(!s.success)throw new fr({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=await Fa({value:s.value,schema:r});if(!o.success)throw new fr({message:"No object generated: response did not match schema.",cause:o.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return o.value},async parsePartialOutput({text:i}){const a=await us(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}},createElementStreamTransform(){}}},kD=({element:t,name:e,description:n})=>{const r=eb(t);return{name:"array",responseFormat:nr(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await qr({text:i});if(!s.success)throw new fr({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=s.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new fr({message:"No object generated: response did not match schema.",cause:new Ii({value:o,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const l of o.elements){const u=await Fa({value:l,schema:r});if(!u.success)throw new fr({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return o.elements},async parsePartialOutput({text:i}){const a=await us(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const o=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,l=[];for(const u of o){const c=await Fa({value:u,schema:r});c.success&&l.push(c.value)}return{partial:l}}}},createElementStreamTransform(){let i=0;return new TransformStream({transform({partialOutput:a},s){if(a!=null)for(;i<a.length;i++)s.enqueue(a[i])}})}}},xD=({options:t,name:e,description:n})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await qr({text:r});if(!a.success)throw new fr({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new fr({message:"No object generated: response did not match schema.",cause:new Ii({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await us(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(o=>o.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}},createElementStreamTransform(){}}),vD=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await qr({text:n});if(!i.success)throw new fr({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await us(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});ls({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
7
+ ]`;continue}a+=i[u],i[u]==="\\"?s=!0:o&&i[u]==="]"?o=!1:!o&&i[u]==="["&&(o=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function H_(t,e){var n,r,i,a,s,o;const l={type:"object",additionalProperties:(n=De(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ge.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:u,...c}=U_(t.keyType._def,e);return{...l,propertyNames:c}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ge.ZodEnum)return{...l,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ge.ZodBranded&&t.keyType._def.type._def.typeName===ge.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:u,...c}=F_(t.keyType._def,e);return{...l,propertyNames:c}}}return l}function C2(t,e){if(e.mapStrategy==="record")return H_(t,e);const n=De(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Qt(),r=De(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Qt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function I2(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function N2(){return{not:Qt()}}function w2(){return{type:"null"}}var Pm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function R2(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Pm&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=Pm[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,o)=>o.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return O2(t,e)}var O2=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>De(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function L2(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[Pm[t.innerType._def.typeName],"null"]};const n=De(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function D2(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function M2(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let o=i[s];if(o===void 0||o._def===void 0)continue;const l=F2(o),u=De(o._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});u!==void 0&&(n.properties[s]=u,l||r.push(s))}r.length&&(n.required=r);const a=P2(t,e);return a!==void 0&&(n.additionalProperties=a),n}function P2(t,e){if(t.catchall._def.typeName!=="ZodNever")return De(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function F2(t){try{return t.isOptional()}catch{return!0}}var B2=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return De(t.innerType._def,e);const r=De(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Qt()},r]}:Qt()},U2=(t,e)=>{if(e.pipeStrategy==="input")return De(t.in._def,e);if(e.pipeStrategy==="output")return De(t.out._def,e);const n=De(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=De(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function H2(t,e){return De(t.type._def,e)}function $2(t,e){const r={type:"array",uniqueItems:!0,items:De(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function z2(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>De(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:De(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>De(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function j2(){return{not:Qt()}}function q2(){return Qt()}var G2=(t,e)=>De(t.innerType._def,e),V2=(t,e,n)=>{switch(e){case ge.ZodString:return U_(t,n);case ge.ZodNumber:return D2(t);case ge.ZodObject:return M2(t,n);case ge.ZodBigInt:return m2(t);case ge.ZodBoolean:return g2();case ge.ZodDate:return B_(t,n);case ge.ZodUndefined:return j2();case ge.ZodNull:return w2();case ge.ZodArray:return h2(t,n);case ge.ZodUnion:case ge.ZodDiscriminatedUnion:return R2(t,n);case ge.ZodIntersection:return k2(t,n);case ge.ZodTuple:return z2(t,n);case ge.ZodRecord:return H_(t,n);case ge.ZodLiteral:return x2(t);case ge.ZodEnum:return S2(t);case ge.ZodNativeEnum:return I2(t);case ge.ZodNullable:return L2(t,n);case ge.ZodOptional:return B2(t,n);case ge.ZodMap:return C2(t,n);case ge.ZodSet:return $2(t,n);case ge.ZodLazy:return()=>t.getter()._def;case ge.ZodPromise:return H2(t,n);case ge.ZodNaN:case ge.ZodNever:return N2();case ge.ZodEffects:return T2(t,n);case ge.ZodAny:return Qt();case ge.ZodUnknown:return q2();case ge.ZodDefault:return y2(t,n);case ge.ZodBranded:return F_(t,n);case ge.ZodReadonly:return G2(t,n);case ge.ZodCatch:return b2(t,n);case ge.ZodPipeline:return U2(t,n);case ge.ZodFunction:case ge.ZodVoid:case ge.ZodSymbol:return;default:return(r=>{})()}},W2=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function De(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const l=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(l!==p2)return l}if(i&&!n){const l=Y2(i,e);if(l!==void 0)return l}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=V2(t,t.typeName,e),o=typeof s=="function"?De(s(),e):s;if(o&&K2(t,e,o),e.postProcess){const l=e.postProcess(o,t,e);return a.jsonSchema=o,l}return a.jsonSchema=o,o}var Y2=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:W2(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Qt()):e.$refStrategy==="seen"?Qt():void 0}},K2=(t,e,n)=>(t.description&&(n.description=t.description),n),X2=t=>{const e=f2(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},Z2=(t,e)=>{var n;const r=X2(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[c,d])=>{var p;return{...u,[c]:(p=De(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,c]},!0))!=null?p:Qt()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=De(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:Qt(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(s.title=o);const l=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return l.$schema="http://json-schema.org/draft-07/schema#",l},Fm=Symbol.for("vercel.ai.schema");function Q2(t){let e;return()=>(e==null&&(e=t()),e)}function hl(t,{validate:e}={}){return{[Fm]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function J2(t){return typeof t=="object"&&t!==null&&Fm in t&&t[Fm]===!0&&"jsonSchema"in t&&"validate"in t}function eb(t){return t==null?hl({properties:{},additionalProperties:!1}):J2(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?$_(t):eD(t):t()}function eD(t){return hl(()=>Jg(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Ii({value:e,cause:n.issues})}}})}function tD(t,e){var n;const r=(n=void 0)!=null?n:!1;return hl(()=>Z2(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function nD(t,e){var n;const r=(n=void 0)!=null?n:!1;return hl(()=>Jg(jO(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await zO(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function rD(t){return"_zod"in t}function $_(t,e){return rD(t)?nD(t):tD(t)}async function a0({value:t,schema:e}){const n=await Fa({value:t,schema:e});if(!n.success)throw Ii.wrap({value:t,cause:n.error});return n.value}async function Fa({value:t,schema:e}){const n=eb(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Ii.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:Ii.wrap({value:t,cause:r}),rawValue:t}}}async function qr({text:t,schema:e}){try{const n=d2(t);return e==null?{success:!0,value:n,rawValue:n}:await Fa({value:n,schema:e})}catch(n){return{success:!1,error:ZE.isInstance(n)?n:new ZE({text:t,cause:n}),rawValue:void 0}}}function iD({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new $O).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await qr({text:n,schema:e}))}}))}async function nr(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var aD=Object.defineProperty,sD=(t,e)=>{for(var n in e)aD(t,n,{get:e[n],enumerable:!0})},z_="AI_NoObjectGeneratedError",j_=`vercel.ai.error.${z_}`,oD=Symbol.for(j_),q_,fr=class extends Cn{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:z_,message:t,cause:e}),this[q_]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return Cn.hasMarker(t,j_)}};q_=oD;var G_="AI_UIMessageStreamError",V_=`vercel.ai.error.${G_}`,lD=Symbol.for(V_),W_,ui=class extends Cn{constructor({chunkType:t,chunkId:e,message:n}){super({name:G_,message:n}),this[W_]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return Cn.hasMarker(t,V_)}};W_=lD;var s0="6.0.49",Y_=jt([ee(),io(Uint8Array),io(ArrayBuffer),a_(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),Ba=qO(()=>jt([GO(),ee(),VO(),Ot(),Ma(ee(),Ba.optional()),rs(Ba)])),xe=Ma(ee(),Ma(ee(),Ba.optional())),K_=Oe({type:de("text"),text:ee(),providerOptions:xe.optional()}),uD=Oe({type:de("image"),image:jt([Y_,io(URL)]),mediaType:ee().optional(),providerOptions:xe.optional()}),X_=Oe({type:de("file"),data:jt([Y_,io(URL)]),filename:ee().optional(),mediaType:ee(),providerOptions:xe.optional()}),cD=Oe({type:de("reasoning"),text:ee(),providerOptions:xe.optional()}),dD=Oe({type:de("tool-call"),toolCallId:ee(),toolName:ee(),input:Zn(),providerOptions:xe.optional(),providerExecuted:Ot().optional()}),pD=WO("type",[Oe({type:de("text"),value:ee(),providerOptions:xe.optional()}),Oe({type:de("json"),value:Ba,providerOptions:xe.optional()}),Oe({type:de("execution-denied"),reason:ee().optional(),providerOptions:xe.optional()}),Oe({type:de("error-text"),value:ee(),providerOptions:xe.optional()}),Oe({type:de("error-json"),value:Ba,providerOptions:xe.optional()}),Oe({type:de("content"),value:rs(jt([Oe({type:de("text"),text:ee(),providerOptions:xe.optional()}),Oe({type:de("media"),data:ee(),mediaType:ee()}),Oe({type:de("file-data"),data:ee(),mediaType:ee(),filename:ee().optional(),providerOptions:xe.optional()}),Oe({type:de("file-url"),url:ee(),providerOptions:xe.optional()}),Oe({type:de("file-id"),fileId:jt([ee(),Ma(ee(),ee())]),providerOptions:xe.optional()}),Oe({type:de("image-data"),data:ee(),mediaType:ee(),providerOptions:xe.optional()}),Oe({type:de("image-url"),url:ee(),providerOptions:xe.optional()}),Oe({type:de("image-file-id"),fileId:jt([ee(),Ma(ee(),ee())]),providerOptions:xe.optional()}),Oe({type:de("custom"),providerOptions:xe.optional()})]))})]),Z_=Oe({type:de("tool-result"),toolCallId:ee(),toolName:ee(),output:pD,providerOptions:xe.optional()}),fD=Oe({type:de("tool-approval-request"),approvalId:ee(),toolCallId:ee()}),hD=Oe({type:de("tool-approval-response"),approvalId:ee(),approved:Ot(),reason:ee().optional()}),mD=Oe({role:de("system"),content:ee(),providerOptions:xe.optional()}),gD=Oe({role:de("user"),content:jt([ee(),rs(jt([K_,uD,X_]))]),providerOptions:xe.optional()}),bD=Oe({role:de("assistant"),content:jt([ee(),rs(jt([K_,X_,cD,dD,Z_,fD]))]),providerOptions:xe.optional()}),ED=Oe({role:de("tool"),content:rs(jt([Z_,hD])),providerOptions:xe.optional()});jt([mD,gD,bD,ED]);function Q_(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),o=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&o?n[r]=Q_(a,i):n[r]=i}return n}var yD={};sD(yD,{array:()=>kD,choice:()=>xD,json:()=>vD,object:()=>AD,text:()=>SD});function TD(t){const e=["ROOT"];let n=-1,r=null;function i(l,u,c){switch(l){case'"':{n=u,e.pop(),e.push(c),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=u,r=u,e.pop(),e.push(c),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(c),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=u,e.pop(),e.push(c),e.push("INSIDE_NUMBER");break}case"{":{n=u,e.pop(),e.push(c),e.push("INSIDE_OBJECT_START");break}case"[":{n=u,e.pop(),e.push(c),e.push("INSIDE_ARRAY_START");break}}}function a(l,u){switch(l){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=u,e.pop();break}}}function s(l,u){switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=u,e.pop();break}}}for(let l=0;l<t.length;l++){const u=t[l];switch(e[e.length-1]){case"ROOT":i(u,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(u){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{u==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{u==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{u===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(u,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(u,l);break}case"INSIDE_STRING":{switch(u){case'"':{e.pop(),n=l;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{u==="]"?(n=l,e.pop()):(n=l,i(u,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(u){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(u,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=l;break}case"INSIDE_NUMBER":{switch(u){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,l);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,l);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const d=t.substring(r,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(u,l):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l)):n=l;break}}}let o=t.slice(0,n+1);for(let l=e.length-1;l>=0;l--)switch(e[l]){case"INSIDE_STRING":{o+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{o+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{o+="]";break}case"INSIDE_LITERAL":{const c=t.substring(r,t.length);"true".startsWith(c)?o+="true".slice(c.length):"false".startsWith(c)?o+="false".slice(c.length):"null".startsWith(c)&&(o+="null".slice(c.length))}}return o}async function us(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await qr({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await qr({text:TD(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var SD=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),AD=({schema:t,name:e,description:n})=>{const r=eb(t);return{name:"object",responseFormat:nr(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await qr({text:i});if(!s.success)throw new fr({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=await Fa({value:s.value,schema:r});if(!o.success)throw new fr({message:"No object generated: response did not match schema.",cause:o.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return o.value},async parsePartialOutput({text:i}){const a=await us(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}},createElementStreamTransform(){}}},kD=({element:t,name:e,description:n})=>{const r=eb(t);return{name:"array",responseFormat:nr(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await qr({text:i});if(!s.success)throw new fr({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=s.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new fr({message:"No object generated: response did not match schema.",cause:new Ii({value:o,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const l of o.elements){const u=await Fa({value:l,schema:r});if(!u.success)throw new fr({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return o.elements},async parsePartialOutput({text:i}){const a=await us(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const o=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,l=[];for(const u of o){const c=await Fa({value:u,schema:r});c.success&&l.push(c.value)}return{partial:l}}}},createElementStreamTransform(){let i=0;return new TransformStream({transform({partialOutput:a},s){if(a!=null)for(;i<a.length;i++)s.enqueue(a[i])}})}}},xD=({options:t,name:e,description:n})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await qr({text:r});if(!a.success)throw new fr({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new fr({message:"No object generated: response did not match schema.",cause:new Ii({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await us(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(o=>o.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}},createElementStreamTransform(){}}),vD=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await qr({text:n});if(!i.success)throw new fr({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await us(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});ls({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
8
8
 
9
9
  `)},flush(t){t.enqueue(`data: [DONE]
10
10
 
@@ -31,7 +31,7 @@ ${i}`}]}catch(i){console.error("Failed to decode text file:",i)}return[{type:"fi
31
31
  `);return{dom:l,text:p,slice:e}}function bI(t,e,n,r,i){let a=i.parent.type.spec.code,s,o;if(!n&&!e)return null;let l=!!e&&(r||a||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,a||r,t)}),a)return o=new re(Y.from(t.state.schema.text(e.replace(/\r\n?/g,`
32
32
  `))),0,0),t.someProp("transformPasted",p=>{o=p(o,t,!0)}),o;let d=t.someProp("clipboardTextParser",p=>p(e,i,r,t));if(d)o=d;else{let p=i.marks(),{schema:f}=t.state,h=ni.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=s.appendChild(document.createElement("p"));g&&b.appendChild(h.serializeNode(f.text(g,p)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=NP(n),ps&&wP(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(o||(o=(t.someProp("clipboardParser")||t.someProp("domParser")||mr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!_P.test(p.parentNode.nodeName)?{ignore:!0}:null}})),c)o=RP(Z0(o,+c[1],+c[2]),c[4]);else if(o=re.maxOpen(CP(o.content,i),!0),o.openStart||o.openEnd){let d=0,p=0;for(let f=o.content.firstChild;d<o.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=o.content.lastChild;p<o.openEnd&&!f.type.spec.isolating;p++,f=f.lastChild);o=Z0(o,d,p)}return t.someProp("transformPasted",d=>{o=d(o,t,l)}),o}const _P=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function CP(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),a,s=[];if(t.forEach(o=>{if(!s)return;let l=i.findWrapping(o.type),u;if(!l)return s=null;if(u=s.length&&a.length&&yI(l,a,o,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=TI(s[s.length-1],a.length));let c=EI(o,l);s.push(c),i=i.matchType(c.type),a=l}}),s)return Y.from(s)}return t}function EI(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Y.from(t));return t}function yI(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let a=yI(t,e,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(Y.from(EI(n,t,i+1))))}}function TI(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,TI(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Y.empty,!0);return t.copy(n.append(r))}function rg(t,e,n,r,i,a){let s=e<0?t.firstChild:t.lastChild,o=s.content;return t.childCount>1&&(a=0),i<r-1&&(o=rg(o,e,n,r,i+1,a)),i>=n&&(o=e<0?s.contentMatchAt(0).fillBefore(o,a<=i).append(o):o.append(s.contentMatchAt(s.childCount).fillBefore(Y.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(o))}function Z0(t,e,n){return e<t.openStart&&(t=new re(rg(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new re(rg(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const SI={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Q0=null;function AI(){return Q0||(Q0=document.implementation.createHTMLDocument("title"))}let du=null;function IP(t){let e=window.trustedTypes;return e?(du||(du=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),du.createHTML(t)):t}function NP(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=AI().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&SI[r[1].toLowerCase()])&&(t=i.map(a=>"<"+a+">").join("")+t+i.map(a=>"</"+a+">").reverse().join("")),n.innerHTML=IP(t),i)for(let a=0;a<i.length;a++)n=n.querySelector(i[a])||n;return n}function wP(t){let e=t.querySelectorAll(ct?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function RP(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:a,openEnd:s}=t;for(let o=r.length-2;o>=0;o-=2){let l=n.nodes[r[o]];if(!l||l.hasRequiredAttrs())break;i=Y.from(l.create(r[o+1],i)),a++,s++}return new re(i,a,s)}const Pt={},Ft={},OP={touchstart:!0,touchmove:!0};class LP{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function DP(t){for(let e in Pt){let n=Pt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{PP(t,r)&&!gb(t,r)&&(t.editable||!(r.type in Ft))&&n(t,r)},OP[e]?{passive:!0}:void 0)}bt&&t.dom.addEventListener("input",()=>null),ig(t)}function cr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function MP(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ig(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>gb(t,r))})}function gb(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function PP(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function FP(t,e){!gb(t,e)&&Pt[e.type]&&(t.editable||!(e.type in Ft))&&Pt[e.type](t,e)}Ft.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!xI(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Hn&&ct&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Oi&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Rr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||vP(t,n)?n.preventDefault():cr(t,"key")};Ft.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ft.keypress=(t,e)=>{let n=e;if(xI(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||an&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof he)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,a))&&t.dispatch(a()),n.preventDefault()}};function Sl(t){return{left:t.clientX,top:t.clientY}}function BP(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function bb(t,e,n,r,i){if(r==-1)return!1;let a=t.state.doc.resolve(r);for(let s=a.depth+1;s>0;s--)if(t.someProp(e,o=>s>a.depth?o(t,n,a.nodeAfter,a.before(s),i,!0):o(t,n,a.node(s),a.before(s),i,!1)))return!0;return!1}function _i(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function UP(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ue.isSelectable(r)?(_i(t,new ue(n)),!0):!1}function HP(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ue&&(r=n.node);let a=t.state.doc.resolve(e);for(let s=a.depth+1;s>0;s--){let o=s>a.depth?a.nodeAfter:a.node(s);if(ue.isSelectable(o)){r&&n.$from.depth>0&&s>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?i=a.before(n.$from.depth):i=a.before(s);break}}return i!=null?(_i(t,ue.create(t.state.doc,i)),!0):!1}function $P(t,e,n,r,i){return bb(t,"handleClickOn",e,n,r)||t.someProp("handleClick",a=>a(t,e,r))||(i?HP(t,n):UP(t,n))}function zP(t,e,n,r){return bb(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function jP(t,e,n,r){return bb(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||qP(t,n,r)}function qP(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(_i(t,he.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let a=i.depth+1;a>0;a--){let s=a>i.depth?i.nodeAfter:i.node(a),o=i.before(a);if(s.inlineContent)_i(t,he.create(r,o+1,o+1+s.content.size));else if(ue.isSelectable(s))_i(t,ue.create(r,o));else continue;return!0}}function Eb(t){return go(t)}const kI=an?"metaKey":"ctrlKey";Pt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Eb(t),i=Date.now(),a="singleClick";i-t.input.lastClick.time<500&&BP(n,t.input.lastClick)&&!n[kI]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let s=t.posAtCoords(Sl(n));s&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new GP(t,s,n,!!r)):(a=="doubleClick"?zP:jP)(t,s.pos,s.inside,n)?n.preventDefault():cr(t,"pointer"))};class GP{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[kI],this.allowDefault=r.shiftKey;let a,s;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);a=c.parent,s=c.depth?c.before():0}const o=i?null:r.target,l=o?e.docView.nearestDesc(o,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||u instanceof ue&&u.from<=s&&u.to>s)&&(this.mightDrag={node:a,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&cn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),cr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>qn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Sl(e))),this.updateAllowDefault(e),this.allowDefault||!n?cr(this.view,"pointer"):$P(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||bt&&this.mightDrag&&!this.mightDrag.node.isAtom||ct&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(_i(this.view,ye.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):cr(this.view,"pointer")}move(e){this.updateAllowDefault(e),cr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Pt.touchstart=t=>{t.input.lastTouch=Date.now(),Eb(t),cr(t,"pointer")};Pt.touchmove=t=>{t.input.lastTouch=Date.now(),cr(t,"pointer")};Pt.contextmenu=t=>Eb(t);function xI(t,e){return t.composing?!0:bt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const VP=Hn?5e3:-1;Ft.compositionstart=Ft.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof he&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ct&&tI&&WP(t)))t.markCursor=t.state.storedMarks||n.marks(),go(t,!0),t.markCursor=null;else if(go(t,!e.selection.empty),cn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){let s=a<0?i.lastChild:i.childNodes[a-1];if(!s)break;if(s.nodeType==3){let o=t.domSelection();o&&o.collapse(s,s.nodeValue.length);break}else i=s,a=-1}}t.input.composing=!0}vI(t,VP)};function WP(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ft.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,vI(t,20))};function vI(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>go(t),e))}function _I(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=KP());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function YP(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=H3(e.focusNode,e.focusOffset),r=$3(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function KP(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function go(t,e=!1){if(!(Hn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),_I(t),e||t.docView&&t.docView.dirty){let n=fb(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function XP(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ja=qt&&gr<15||Oi&&G3<604;Pt.copy=Ft.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let a=ja?null:n.clipboardData,s=r.content(),{dom:o,text:l}=mb(t,s);a?(n.preventDefault(),a.clearData(),a.setData("text/html",o.innerHTML),a.setData("text/plain",l)):XP(t,o),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ZP(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function QP(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?qa(t,r.value,null,i,e):qa(t,r.textContent,r.innerHTML,i,e)},50)}function qa(t,e,n,r,i){let a=bI(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,a||re.empty)))return!0;if(!a)return!1;let s=ZP(a),o=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(a);return t.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function CI(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ft.paste=(t,e)=>{let n=e;if(t.composing&&!Hn)return;let r=ja?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&qa(t,CI(r),r.getData("text/html"),i,n)?n.preventDefault():QP(t,n)};class II{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const JP=an?"altKey":"ctrlKey";function NI(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[JP]}Pt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,a=i.empty?null:t.posAtCoords(Sl(n)),s;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof ue?i.to-1:i.to))){if(r&&r.mightDrag)s=ue.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=ue.create(t.state.doc,d.posBefore))}}let o=(s||t.state.selection).content(),{dom:l,text:u,slice:c}=mb(t,o);(!n.dataTransfer.files.length||!ct||eI>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ja?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ja||n.dataTransfer.setData("text/plain",u),t.dragging=new II(c,NI(t,n),s)};Pt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ft.dragover=Ft.dragenter=(t,e)=>e.preventDefault();Ft.drop=(t,e)=>{try{eF(t,e,t.dragging)}finally{t.dragging=null}};function eF(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Sl(e));if(!r)return;let i=t.state.doc.resolve(r.pos),a=n&&n.slice;a?t.someProp("transformPasted",f=>{a=f(a,t,!1)}):a=bI(t,CI(e.dataTransfer),ja?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&NI(t,e));if(t.someProp("handleDrop",f=>f(t,e,a||re.empty,s))){e.preventDefault();return}if(!a)return;e.preventDefault();let o=a?LC(t.state.doc,i.pos,a):i.pos;o==null&&(o=i.pos);let l=t.state.tr;if(s){let{node:f}=n;f?f.replace(l):l.deleteSelection()}let u=l.mapping.map(o),c=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=l.doc;if(c?l.replaceRangeWith(u,u,a.content.firstChild):l.replaceRange(u,u,a),l.doc.eq(d))return;let p=l.doc.resolve(u);if(c&&ue.isSelectable(a.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new ue(p));else{let f=l.mapping.map(o);l.mapping.maps[l.mapping.maps.length-1].forEach((h,g,b,E)=>f=E),l.setSelection(hb(t,p,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}Pt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&qn(t)},20))};Pt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Pt.beforeinput=(t,e)=>{if(ct&&Hn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,Rr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Ft)Pt[t]=Ft[t];function Ga(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class bo{constructor(e,n){this.toDOM=e,this.spec=n||Ur,this.side=this.spec.side||0}map(e,n,r,i){let{pos:a,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new St(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof bo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ga(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Er{constructor(e,n){this.attrs=e,this.spec=n||Ur}map(e,n,r,i){let a=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return a>=s?null:new St(a,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Er&&Ga(this.attrs,e.attrs)&&Ga(this.spec,e.spec)}static is(e){return e.type instanceof Er}destroy(){}}class yb{constructor(e,n){this.attrs=e,this.spec=n||Ur}map(e,n,r,i){let a=e.mapResult(n.from+i,1);if(a.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=a.pos?null:new St(a.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),a;return i==n.from&&!(a=e.child(r)).isText&&i+a.nodeSize==n.to}eq(e){return this==e||e instanceof yb&&Ga(this.attrs,e.attrs)&&Ga(this.spec,e.spec)}destroy(){}}class St{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new St(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new St(e,e,new bo(n,r))}static inline(e,n,r,i){return new St(e,n,new Er(r,i))}static node(e,n,r,i){return new St(e,n,new yb(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Er}get widget(){return this.type instanceof bo}}const bi=[],Ur={};class Ye{constructor(e,n){this.local=e.length?e:bi,this.children=n.length?n:bi}static create(e,n){return n.length?Eo(n,e,0,Ur):Tt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,a){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=n&&o.to>=e&&(!a||a(o.spec))&&r.push(o.copy(o.from+i,o.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,n-o,r,i+o,a)}}map(e,n,r){return this==Tt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ur)}mapInner(e,n,r,i,a){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):a.onRemove&&a.onRemove(this.local[o].spec)}return this.children.length?tF(this.children,s||[],e,n,r,i,a):s?new Ye(s.sort(Hr),bi):Tt}add(e,n){return n.length?this==Tt?Ye.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,a=0;e.forEach((o,l)=>{let u=l+r,c;if(c=RI(n,o,u)){for(i||(i=this.children.slice());a<i.length&&i[a]<l;)a+=3;i[a]==l?i[a+2]=i[a+2].addInner(o,c,u+1):i.splice(a,0,l,l+o.nodeSize,Eo(c,o,u+1,Ur)),a+=3}});let s=wI(a?OI(n):n,-r);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||s.splice(o--,1);return new Ye(s.length?this.local.concat(s).sort(Hr):this.local,i||this.children)}remove(e){return e.length==0||this==Tt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let a=0;a<r.length;a+=3){let s,o=r[a]+n,l=r[a+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>o&&d.to<l&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[a+2].removeInner(s,o+1);u!=Tt?r[a+2]=u:(r.splice(a,3),a-=3)}if(i.length){for(let a=0,s;a<e.length;a++)if(s=e[a])for(let o=0;o<i.length;o++)i[o].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(o--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Ye(i,r):Tt}forChild(e,n){if(this==Tt)return this;if(n.isLeaf)return Ye.empty;let r,i;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(r=this.children[o+2]);break}let a=e+1,s=a+n.content.size;for(let o=0;o<this.local.length;o++){let l=this.local[o];if(l.from<s&&l.to>a&&l.type instanceof Er){let u=Math.max(a,l.from)-a,c=Math.min(s,l.to)-a;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let o=new Ye(i.sort(Hr),bi);return r?new sr([o,r]):o}return r||Tt}eq(e){if(this==e)return!0;if(!(e instanceof Ye)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Tb(this.localsInner(e))}localsInner(e){if(this==Tt)return bi;if(e.inlineContent||!this.local.some(Er.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Er||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Ye.empty=new Ye([],[]);Ye.removeOverlap=Tb;const Tt=Ye.empty;class sr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Ur));return sr.from(r)}forChild(e,n){if(n.isLeaf)return Ye.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(e,n);a!=Tt&&(a instanceof sr?r=r.concat(a.members):r.push(a))}return sr.from(r)}eq(e){if(!(e instanceof sr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let a=this.members[i].localsInner(e);if(a.length)if(!n)n=a;else{r&&(n=n.slice(),r=!1);for(let s=0;s<a.length;s++)n.push(a[s])}}return n?Tb(r?n:n.sort(Hr)):bi}static from(e){switch(e.length){case 0:return Tt;case 1:return e[0];default:return new sr(e.every(n=>n instanceof Ye)?e:e.reduce((n,r)=>n.concat(r instanceof Ye?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function tF(t,e,n,r,i,a,s){let o=t.slice();for(let u=0,c=a;u<n.maps.length;u++){let d=0;n.maps[u].forEach((p,f,h,g)=>{let b=g-h-(f-p);for(let E=0;E<o.length;E+=3){let T=o[E+1];if(T<0||p>T+c-d)continue;let y=o[E]+c-d;f>=y?o[E+1]=p<=y?-2:-1:p>=c&&b&&(o[E]+=b,o[E+1]+=b)}d+=b}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u<o.length;u+=3)if(o[u+1]<0){if(o[u+1]==-2){l=!0,o[u+1]=-1;continue}let c=n.map(t[u]+a),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let p=n.map(t[u+1]+a,-1),f=p-i,{index:h,offset:g}=r.content.findIndex(d),b=r.maybeChild(h);if(b&&g==d&&g+b.nodeSize==f){let E=o[u+2].mapInner(n,b,c+1,t[u]+a+1,s);E!=Tt?(o[u]=d,o[u+1]=f,o[u+2]=E):(o[u+1]=-2,l=!0)}else l=!0}if(l){let u=nF(o,t,e,n,i,a,s),c=Eo(u,r,0,s);e=c.local;for(let d=0;d<o.length;d+=3)o[d+1]<0&&(o.splice(d,3),d-=3);for(let d=0,p=0;d<c.children.length;d+=3){let f=c.children[d];for(;p<o.length&&o[p]<f;)p+=3;o.splice(p,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Ye(e.sort(Hr),o)}function wI(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new St(i.from+e,i.to+e,i.type))}return n}function nF(t,e,n,r,i,a,s){function o(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(r,i,u);d?n.push(d):s.onRemove&&s.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)o(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&o(t[l+2],e[l]+a+1);return n}function RI(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let a=0,s;a<t.length;a++)(s=t[a])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[a]=null);return i}function OI(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Eo(t,e,n,r){let i=[],a=!1;e.forEach((o,l)=>{let u=RI(t,o,l+n);if(u){a=!0;let c=Eo(u,o,n+l+1,r);c!=Tt&&i.push(l,l+o.nodeSize,c)}});let s=wI(a?OI(t):t,-n).sort(Hr);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||(r.onRemove&&r.onRemove(s[o].spec),s.splice(o--,1));return s.length||i.length?new Ye(s,i):Tt}function Hr(t,e){return t.from-e.from||t.to-e.to}function Tb(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let a=e[i];if(a.from==r.from){a.to!=r.to&&(e==t&&(e=t.slice()),e[i]=a.copy(a.from,r.to),J0(e,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,a.from),J0(e,i,r.copy(a.from,r.to)));break}}}return e}function J0(t,e,n){for(;e<t.length&&Hr(n,t[e])>0;)e++;t.splice(e,0,n)}function pu(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Tt&&e.push(r)}),t.cursorWrapper&&e.push(Ye.create(t.state.doc,[t.cursorWrapper.deco])),sr.from(e)}const rF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},iF=qt&&gr<=11;class aF{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class sF{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new aF,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);qt&&gr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():bt&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),iF&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(G0(this.view)){if(this.suppressingSelectionUpdates)return qn(this.view);if(qt&&gr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Wr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let a=e.focusNode;a;a=Ri(a))n.add(a);for(let a=e.anchorNode;a;a=Ri(a))if(n.has(a)){r=a;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&G0(e)&&!this.ignoreSelectionChange(r),a=-1,s=-1,o=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],l);d&&(a=a<0?d.from:Math.min(d.from,a),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(o=!0))}if(cn&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,p]=c;d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let p of c){let f=p.parentNode;f&&f.nodeName=="LI"&&(!d||uF(e,d)!=f)&&p.remove()}}}else if((ct||bt)&&l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let u=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&yl(r)&&(u=fb(e))&&u.eq(ye.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,qn(e),this.currentSelection.set(r),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,s),oF(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,cF(e,l)),this.handleDOMChange(a,s,o,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||qn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,a=e.nextSibling;if(qt&&gr<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:p}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(a=p)}let s=i&&i.parentNode==e.target?ht(i)+1:0,o=r.localPosFromDOM(e.target,s,-1),l=a&&a.parentNode==e.target?ht(a):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:o,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ey=new WeakMap,ty=!1;function oF(t){if(!ey.has(t)&&(ey.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=cn,ty)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),ty=!0}}function ny(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,a=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Wr(s.node,s.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function lF(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return ny(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?ny(t,n):null}function uF(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function cF(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let a of e)if(((n=a.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=a.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let o=s;for(;;){let l=o.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;o=l}o.insertBefore(a,o.firstChild),r==a&&t.domSelection().collapse(a,i)}else a.parentNode.removeChild(a)}}function dF(t,e,n){let{node:r,fromOffset:i,toOffset:a,from:s,to:o}=t.docView.parseRange(e,n),l=t.domSelectionRange(),u,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],yl(l)||u.push({node:l.focusNode,offset:l.focusOffset})),ct&&t.input.lastKeyCode===8)for(let b=a;b>i;b--){let E=r.childNodes[b-1],T=E.pmViewDesc;if(E.nodeName=="BR"&&!T){a=b;break}if(!T||T.size)break}let d=t.state.doc,p=t.someProp("domParser")||mr.fromSchema(t.state.schema),f=d.resolve(s),h=null,g=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:a,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:pF,context:f});if(u&&u[0].pos!=null){let b=u[0].pos,E=u[1]&&u[1].pos;E==null&&(E=b),h={anchor:b+s,head:E+s}}return{doc:g,sel:h,from:s,to:o}}function pF(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(bt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||bt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const fF=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function hF(t,e,n,r,i){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let v=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,w=fb(t,v);if(w&&!t.state.selection.eq(w)){if(ct&&Hn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",_=>_(t,Rr(13,"Enter"))))return;let C=t.state.tr.setSelection(w);v=="pointer"?C.setMeta("pointer",!0):v=="key"&&C.scrollIntoView(),a&&C.setMeta("composition",a),t.dispatch(C)}return}let s=t.state.doc.resolve(e),o=s.sharedDepth(n);e=s.before(o+1),n=t.state.doc.resolve(n).after(o+1);let l=t.state.selection,u=dF(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),p,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,f="end"):(p=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let h=bF(d.content,u.doc.content,u.from,p,f);if(h&&t.input.domChangeCount++,(Oi&&t.input.lastIOSEnter>Date.now()-225||Hn)&&i.some(v=>v.nodeType==1&&!fF.test(v.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",v=>v(t,Rr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof he&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let v=ry(t,t.state.doc,u.sel);if(v&&!v.eq(t.state.selection)){let w=t.state.tr.setSelection(v);a&&w.setMeta("composition",a),t.dispatch(w)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof he&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),qt&&gr<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>u.from&&u.doc.textBetween(h.start-u.from-1,h.start-u.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let g=u.doc.resolveNoCache(h.start-u.from),b=u.doc.resolveNoCache(h.endB-u.from),E=c.resolve(h.start),T=g.sameParent(b)&&g.parent.inlineContent&&E.end()>=h.endA;if((Oi&&t.input.lastIOSEnter>Date.now()-225&&(!T||i.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!T&&g.pos<u.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(u.doc.textBetween(g.pos,b.pos,"","")))&&t.someProp("handleKeyDown",v=>v(t,Rr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&gF(c,h.start,h.endA,g,b)&&t.someProp("handleKeyDown",v=>v(t,Rr(8,"Backspace")))){Hn&&ct&&t.domObserver.suppressSelectionUpdates();return}ct&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),Hn&&!T&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==h.endA&&(h.endB-=2,b=u.doc.resolveNoCache(h.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(v){return v(t,Rr(13,"Enter"))})},20));let y=h.start,k=h.endA,x=v=>{let w=v||t.state.tr.replace(y,k,u.doc.slice(h.start-u.from,h.endB-u.from));if(u.sel){let C=ry(t,w.doc,u.sel);C&&!(ct&&t.composing&&C.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(C.head==y||C.head==w.mapping.map(k)-1)||qt&&C.empty&&C.head==y)&&w.setSelection(C)}return a&&w.setMeta("composition",a),w.scrollIntoView()},A;if(T)if(g.pos==b.pos){qt&&gr<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>qn(t),20));let v=x(t.state.tr.delete(y,k)),w=c.resolve(h.start).marksAcross(c.resolve(h.endA));w&&v.ensureMarks(w),t.dispatch(v)}else if(h.endA==h.endB&&(A=mF(g.parent.content.cut(g.parentOffset,b.parentOffset),E.parent.content.cut(E.parentOffset,h.endA-E.start())))){let v=x(t.state.tr);A.type=="add"?v.addMark(y,k,A.mark):v.removeMark(y,k,A.mark),t.dispatch(v)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let v=g.parent.textBetween(g.parentOffset,b.parentOffset),w=()=>x(t.state.tr.insertText(v,y,k));t.someProp("handleTextInput",C=>C(t,y,k,v,w))||t.dispatch(w())}else t.dispatch(x());else t.dispatch(x())}function ry(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:hb(t,e.resolve(n.anchor),e.resolve(n.head))}function mF(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,a=r,s,o,l;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)a=n[c].removeFromSet(a);if(i.length==1&&a.length==0)o=i[0],s="add",l=c=>c.mark(o.addToSet(c.marks));else if(i.length==0&&a.length==1)o=a[0],s="remove",l=c=>c.mark(o.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(Y.from(u).eq(t))return{mark:o,type:s}}function gF(t,e,n,r,i){if(n-e<=i.pos-r.pos||fu(r,!0,!1)<i.pos)return!1;let a=t.resolve(e);if(!r.parent.isTextblock){let o=a.nodeAfter;return o!=null&&n==e+o.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let s=t.resolve(fu(a,!0,!0));return!s.parent.isTextblock||s.pos>n||fu(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function fu(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function bF(t,e,n,r,i){let a=t.findDiffStart(e,n);if(a==null)return null;let{a:s,b:o}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,a-Math.min(s,o));r-=s+l-a}if(s<a&&t.size<e.size){let l=r<=a&&r>=s?a-r:0;a-=l,a&&a<e.size&&iy(e.textBetween(a-1,a+1))&&(a+=l?1:-1),o=a+(o-s),s=a}else if(o<a){let l=r<=a&&r>=o?a-r:0;a-=l,a&&a<t.size&&iy(t.textBetween(a-1,a+1))&&(a+=l?1:-1),s=a+(s-o),o=a}return{start:a,endA:s,endB:o}}function iy(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class LI{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new LP,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(uy),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=oy(this),sy(this),this.nodeViews=ly(this),this.docView=U0(this.state.doc,ay(this),pu(this),this.dom,this),this.domObserver=new sF(this,(r,i,a,s)=>hF(this,r,i,a,s)),this.domObserver.start(),DP(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ig(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(uy),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,a=!1,s=!1;e.storedMarks&&this.composing&&(_I(this),s=!0),this.state=e;let o=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(o||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=ly(this);yF(f,this.nodeViews)&&(this.nodeViews=f,a=!0)}(o||n.handleDOMEvents!=this._props.handleDOMEvents)&&ig(this),this.editable=oy(this),sy(this);let l=pu(this),u=ay(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=a||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(s=!0);let p=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Y3(this);if(s){this.domObserver.stop();let f=d&&(qt||ct)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&EF(i.selection,e.selection);if(d){let h=ct?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=YP(this)),(a||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=U0(e.doc,u,l,this.dom,this)),h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&EP(this))?qn(this,f):(hI(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():p&&K3(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ue){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&L0(this,n.getBoundingClientRect(),e)}else L0(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let a=r.from+(this.state.doc.content.size-n.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==r.node&&(i=a)}this.dragging=new II(e.slice,e.move,i<0?void 0:ue.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let o=this.directPlugins[s].props[e];if(o!=null&&(i=n?n(o):o))return i}let a=this.state.plugins;if(a)for(let s=0;s<a.length;s++){let o=a[s].props[e];if(o!=null&&(i=n?n(o):o))return i}}hasFocus(){if(qt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&X3(this.dom),qn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return tP(this,e)}coordsAtPos(e,n=1){return sI(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return sP(this,n||this.state,e)}pasteHTML(e,n){return qa(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return qa(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return mb(this,e)}destroy(){this.docView&&(MP(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],pu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,B3())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return FP(this,e)}domSelectionRange(){let e=this.domSelection();return e?bt&&this.root.nodeType===11&&j3(this.dom.ownerDocument)==this.dom&&lF(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}LI.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function ay(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[St.node(0,t.state.doc.content.size,e)]}function sy(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:St.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function oy(t){return!t.someProp("editable",e=>e(t.state)===!1)}function EF(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function ly(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function yF(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function uy(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var yr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},yo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},TF=typeof navigator<"u"&&/Mac/.test(navigator.platform),SF=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var mt=0;mt<10;mt++)yr[48+mt]=yr[96+mt]=String(mt);for(var mt=1;mt<=24;mt++)yr[mt+111]="F"+mt;for(var mt=65;mt<=90;mt++)yr[mt]=String.fromCharCode(mt+32),yo[mt]=String.fromCharCode(mt);for(var hu in yr)yo.hasOwnProperty(hu)||(yo[hu]=yr[hu]);function AF(t){var e=TF&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||SF&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?yo:yr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const kF=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),xF=typeof navigator<"u"&&/Win/.test(navigator.platform);function vF(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,a,s;for(let o=0;o<e.length-1;o++){let l=e[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))kF?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),a&&(n="Shift-"+n),n}function _F(t){let e=Object.create(null);for(let n in t)e[vF(n)]=t[n];return e}function mu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function CF(t){return new Ge({props:{handleKeyDown:DI(t)}})}function DI(t){let e=_F(t);return function(n,r){let i=AF(r),a,s=e[mu(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let o=e[mu(i,r,!1)];if(o&&o(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(xF&&r.ctrlKey&&r.altKey)&&(a=yr[r.keyCode])&&a!=i){let o=e[mu(a,r)];if(o&&o(n.state,n.dispatch,n))return!0}}return!1}}var IF=Object.defineProperty,Sb=(t,e)=>{for(var n in e)IF(t,n,{get:e[n],enumerable:!0})};function Al(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var kl=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([s,o])=>[s,(...u)=>{const c=o(...u)(a);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:a}=r,s=[],o=!!t,l=t||i.tr,u=()=>(!o&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(l),s.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,p])=>[d,(...h)=>{const g=this.buildProps(l,e),b=p(...h)(g);return s.push(b),c}])),run:u};return c}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,a=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([o,l])=>[o,(...u)=>l(...u)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:a}=r,s={tr:t,editor:r,view:a,state:Al({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([o,l])=>[o,(...u)=>l(...u)(s)]))}};return s}},MI={};Sb(MI,{blur:()=>NF,clearContent:()=>wF,clearNodes:()=>RF,command:()=>OF,createParagraphNear:()=>LF,cut:()=>DF,deleteCurrentNode:()=>MF,deleteNode:()=>PF,deleteRange:()=>FF,deleteSelection:()=>BF,enter:()=>UF,exitCode:()=>HF,extendMarkRange:()=>$F,first:()=>zF,focus:()=>qF,forEach:()=>GF,insertContent:()=>VF,insertContentAt:()=>KF,joinBackward:()=>QF,joinDown:()=>ZF,joinForward:()=>JF,joinItemBackward:()=>eB,joinItemForward:()=>tB,joinTextblockBackward:()=>nB,joinTextblockForward:()=>rB,joinUp:()=>XF,keyboardShortcut:()=>aB,lift:()=>sB,liftEmptyBlock:()=>oB,liftListItem:()=>lB,newlineInCode:()=>uB,resetAttributes:()=>cB,scrollIntoView:()=>dB,selectAll:()=>pB,selectNodeBackward:()=>fB,selectNodeForward:()=>hB,selectParentNode:()=>mB,selectTextblockEnd:()=>gB,selectTextblockStart:()=>bB,setContent:()=>EB,setMark:()=>BB,setMeta:()=>UB,setNode:()=>HB,setNodeSelection:()=>$B,setTextDirection:()=>zB,setTextSelection:()=>jB,sinkListItem:()=>qB,splitBlock:()=>GB,splitListItem:()=>VB,toggleList:()=>WB,toggleMark:()=>YB,toggleNode:()=>KB,toggleWrap:()=>XB,undoInputRule:()=>ZB,unsetAllMarks:()=>QB,unsetMark:()=>JB,unsetTextDirection:()=>e4,updateAttributes:()=>t4,wrapIn:()=>n4,wrapInList:()=>r4});var NF=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),wF=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),RF=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:a,$to:s})=>{t.doc.nodesBetween(a.pos,s.pos,(o,l)=>{if(o.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),p=u.resolve(c.map(l+o.nodeSize)),f=d.blockRange(p);if(!f)return;const h=$i(f);if(o.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,g)}(h||h===0)&&e.lift(f,h)})}),!0},OF=t=>e=>t(e),LF=()=>({state:t,dispatch:e})=>KC(t,e),DF=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,a=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,a.content),r.setSelection(new he(r.doc.resolve(Math.max(s-1,0)))),!0},MF=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r.type){if(e){const o=i.before(a),l=i.after(a);t.delete(o,l).scrollIntoView()}return!0}return!1};function rt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var PF=t=>({tr:e,state:n,dispatch:r})=>{const i=rt(t,n.schema),a=e.selection.$anchor;for(let s=a.depth;s>0;s-=1)if(a.node(s).type===i){if(r){const l=a.before(s),u=a.after(s);e.delete(l,u).scrollIntoView()}return!0}return!1},FF=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},BF=()=>({state:t,dispatch:e})=>ob(t,e),UF=()=>({commands:t})=>t.keyboardShortcut("Enter"),HF=()=>({state:t,dispatch:e})=>k3(t,e);function Ab(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function To(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Ab(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function PI(t,e,n={}){return t.find(r=>r.type===e&&To(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function cy(t,e,n={}){return!!PI(t,e,n)}function kb(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!PI([...i.node.marks],e,n)))return;let s=i.index,o=t.start()+i.offset,l=s+1,u=o+i.node.nodeSize;for(;s>0&&cy([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&cy([...t.parent.child(l).marks],e,n);)u+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:u}}function Vn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var $F=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const a=Vn(t,r.schema),{doc:s,selection:o}=n,{$from:l,from:u,to:c}=o;if(i){const d=kb(l,a,e);if(d&&d.from<=u&&d.to>=c){const p=he.create(s,d.from,d.to);n.setSelection(p)}}return!0},zF=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function FI(t){return t instanceof he}function Dr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function BI(t,e=null){if(!e)return null;const n=ye.atStart(t),r=ye.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,a=r.to;return e==="all"?he.create(t,Dr(0,i,a),Dr(t.content.size,i,a)):he.create(t,Dr(e,i,a),Dr(e,i,a))}function ag(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Va(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function jF(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var qF=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:a})=>{e={scrollIntoView:!0,...e};const s=()=>{(Va()||ag())&&r.dom.focus(),jF()&&!Va()&&!ag()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(a&&t===null&&!FI(n.state.selection))return s(),!0;const o=BI(i.doc,t)||n.state.selection,l=n.state.selection.eq(o);return a&&(l||i.setSelection(o),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},GF=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),VF=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),UI=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&UI(r)}return t};function _s(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return UI(n)}function Wa(t,e,n){if(t instanceof hr||t instanceof Y)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Y.fromArray(t.map(o=>e.nodeFromJSON(o)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),Wa("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,o="";const l=new AC({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,o=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?mr.fromSchema(l).parseSlice(_s(t),n.parseOptions):mr.fromSchema(l).parse(_s(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const a=mr.fromSchema(e);return n.slice?a.parseSlice(_s(t),n.parseOptions).content:a.parse(_s(t),n.parseOptions)}return Wa("",e,n)}function WF(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof lt||i instanceof dt))return;const a=t.mapping.maps[r];let s=0;a.forEach((o,l,u,c)=>{s===0&&(s=c)}),t.setSelection(ye.near(t.doc.resolve(s),n))}var YF=t=>!("type"in t),KF=(t,e,n)=>({tr:r,dispatch:i,editor:a})=>{var s;if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let o;const l=b=>{a.emit("contentError",{editor:a,error:b,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Wa(e,a.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(b){l(b)}try{o=Wa(e,a.schema,{parseOptions:u,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:a.options.enableContentCheck})}catch(b){return l(b),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,f=!0;if((YF(o)?o:[o]).forEach(b=>{b.check(),p=p?b.isText&&b.marks.length===0:!1,f=f?b.isBlock:!1}),c===d&&f){const{parent:b}=r.doc.resolve(c);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(c-=1,d+=1)}let g;if(p){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof Y){let b="";e.forEach(E=>{E.text&&(b+=E.text)}),g=b}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,c,d)}else{g=o;const b=r.doc.resolve(c),E=b.node(),T=b.parentOffset===0,y=E.isText||E.isTextblock,k=E.content.size>0;T&&y&&k&&(c=Math.max(0,c-1)),r.replaceWith(c,d,g)}n.updateSelection&&WF(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:g})}return!0},XF=()=>({state:t,dispatch:e})=>T3(t,e),ZF=()=>({state:t,dispatch:e})=>S3(t,e),QF=()=>({state:t,dispatch:e})=>zC(t,e),JF=()=>({state:t,dispatch:e})=>VC(t,e),eB=()=>({state:t,dispatch:e,tr:n})=>{try{const r=gl(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},tB=()=>({state:t,dispatch:e,tr:n})=>{try{const r=gl(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},nB=()=>({state:t,dispatch:e})=>E3(t,e),rB=()=>({state:t,dispatch:e})=>y3(t,e);function HI(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function iB(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,a,s;for(let o=0;o<e.length-1;o+=1){const l=e[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))Va()||HI()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var aB=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const a=iB(t).split(/-(?!$)/),s=a.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),o=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,o))});return l?.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function Tr(t,e,n={}){const{from:r,to:i,empty:a}=t.selection,s=e?rt(e,t.schema):null,o=[];t.doc.nodesBetween(r,i,(d,p)=>{if(d.isText)return;const f=Math.max(r,p),h=Math.min(i,p+d.nodeSize);o.push({node:d,from:f,to:h})});const l=i-r,u=o.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>To(d.node.attrs,n,{strict:!1}));return a?!!u.length:u.reduce((d,p)=>d+p.to-p.from,0)>=l}var sB=(t,e={})=>({state:n,dispatch:r})=>{const i=rt(t,n.schema);return Tr(n,i,e)?A3(n,r):!1},oB=()=>({state:t,dispatch:e})=>XC(t,e),lB=t=>({state:e,dispatch:n})=>{const r=rt(t,e.schema);return D3(r)(e,n)},uB=()=>({state:t,dispatch:e})=>YC(t,e);function xl(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function dy(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var cB=(t,e)=>({tr:n,state:r,dispatch:i})=>{let a=null,s=null;const o=xl(typeof t=="string"?t:t.name,r.schema);if(!o)return!1;o==="node"&&(a=rt(t,r.schema)),o==="mark"&&(s=Vn(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{a&&a===c.type&&(l=!0,i&&n.setNodeMarkup(d,void 0,dy(c.attrs,e))),s&&c.marks.length&&c.marks.forEach(p=>{s===p.type&&(l=!0,i&&n.addMark(d,d+c.nodeSize,s.create(dy(p.attrs,e))))})})}),l},dB=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),pB=()=>({tr:t,dispatch:e})=>{if(e){const n=new Xt(t.doc);t.setSelection(n)}return!0},fB=()=>({state:t,dispatch:e})=>qC(t,e),hB=()=>({state:t,dispatch:e})=>WC(t,e),mB=()=>({state:t,dispatch:e})=>_3(t,e),gB=()=>({state:t,dispatch:e})=>N3(t,e),bB=()=>({state:t,dispatch:e})=>I3(t,e);function sg(t,e,n={},r={}){return Wa(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var EB=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:s,commands:o})=>{const{doc:l}=a;if(r.preserveWhitespace!=="full"){const u=sg(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&a.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!n),!0}return s&&a.setMeta("preventUpdate",!n),o.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function $I(t,e){const n=Vn(e,t.schema),{from:r,to:i,empty:a}=t.selection,s=[];a?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const o=s.find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function zI(t,e){const n=new BC(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function yB(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function TB(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,a)=>{n(i)&&r.push({node:i,pos:a})}),r}function SB(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function vl(t){return e=>SB(e.$from,t)}function le(t,e,n){return t.config[e]===void 0&&t.parent?le(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?le(t.parent,e,n):null}):t.config[e]}function xb(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=le(e,"addExtensions",n);return r?[e,...xb(r())]:e}).flat(10)}function vb(t,e){const n=ni.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function jI(t){return typeof t=="function"}function Re(t,e=void 0,...n){return jI(t)?e?t.bind(e)(...n):t(...n):t}function AB(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Li(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function qI(t){const e=[],{nodeExtensions:n,markExtensions:r}=Li(t),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const o={name:s.name,options:s.options,storage:s.storage,extensions:i},l=le(s,"addGlobalAttributes",o);if(!l)return;l().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([p,f])=>{e.push({type:d,name:p,attribute:{...a,...f}})})})})}),i.forEach(s=>{const o={name:s.name,options:s.options,storage:s.storage},l=le(s,"addAttributes",o);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const p={...a,...d};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:s.name,name:c,attribute:p})})}),e}function it(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,a])=>{if(!r[i]){r[i]=a;return}if(i==="class"){const o=a?String(a).split(" "):[],l=r[i]?r[i].split(" "):[],u=o.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else if(i==="style"){const o=a?a.split(";").map(c=>c.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;l.forEach(c=>{const[d,p]=c.split(":").map(f=>f.trim());u.set(d,p)}),o.forEach(c=>{const[d,p]=c.split(":").map(f=>f.trim());u.set(d,p)}),r[i]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=a}),r},{})}function Di(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>it(n,r),{})}function kB(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function py(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((a,s)=>{const o=s.attribute.parseHTML?s.attribute.parseHTML(n):kB(n.getAttribute(s.name));return o==null?a:{...a,[s.name]:o}},{});return{...r,...i}}}}function fy(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&AB(n)?!1:n!=null))}function hy(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function xB(t,e){var n;const r=qI(t),{nodeExtensions:i,markExtensions:a}=Li(t),s=(n=i.find(u=>le(u,"topNode")))==null?void 0:n.name,o=Object.fromEntries(i.map(u=>{const c=r.filter(E=>E.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},p=t.reduce((E,T)=>{const y=le(T,"extendNodeSchema",d);return{...E,...y?y(u):{}}},{}),f=fy({...p,content:Re(le(u,"content",d)),marks:Re(le(u,"marks",d)),group:Re(le(u,"group",d)),inline:Re(le(u,"inline",d)),atom:Re(le(u,"atom",d)),selectable:Re(le(u,"selectable",d)),draggable:Re(le(u,"draggable",d)),code:Re(le(u,"code",d)),whitespace:Re(le(u,"whitespace",d)),linebreakReplacement:Re(le(u,"linebreakReplacement",d)),defining:Re(le(u,"defining",d)),isolating:Re(le(u,"isolating",d)),attrs:Object.fromEntries(c.map(hy))}),h=Re(le(u,"parseHTML",d));h&&(f.parseDOM=h.map(E=>py(E,c)));const g=le(u,"renderHTML",d);g&&(f.toDOM=E=>g({node:E,HTMLAttributes:Di(E,c)}));const b=le(u,"renderText",d);return b&&(f.toText=b),[u.name,f]})),l=Object.fromEntries(a.map(u=>{const c=r.filter(b=>b.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},p=t.reduce((b,E)=>{const T=le(E,"extendMarkSchema",d);return{...b,...T?T(u):{}}},{}),f=fy({...p,inclusive:Re(le(u,"inclusive",d)),excludes:Re(le(u,"excludes",d)),group:Re(le(u,"group",d)),spanning:Re(le(u,"spanning",d)),code:Re(le(u,"code",d)),attrs:Object.fromEntries(c.map(hy))}),h=Re(le(u,"parseHTML",d));h&&(f.parseDOM=h.map(b=>py(b,c)));const g=le(u,"renderHTML",d);return g&&(f.toDOM=b=>g({mark:b,HTMLAttributes:Di(b,c)})),[u.name,f]}));return new AC({topNode:s,nodes:o,marks:l})}function vB(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function So(t){return t.sort((n,r)=>{const i=le(n,"priority")||100,a=le(r,"priority")||100;return i>a?-1:i<a?1:0})}function GI(t){const e=So(xb(t)),n=vB(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function VI(t,e,n){const{from:r,to:i}=e,{blockSeparator:a=`
33
33
 
34
- `,textSerializers:s={}}=n||{};let o="";return t.nodesBetween(r,i,(l,u,c,d)=>{var p;l.isBlock&&u>r&&(o+=a);const f=s?.[l.type.name];if(f)return c&&(o+=f({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(o+=(p=l?.text)==null?void 0:p.slice(Math.max(r,u)-u,i-u))}),o}function _B(t,e){const n={from:0,to:t.content.size};return VI(t,n,e)}function WI(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function CB(t,e){const n=rt(e,t.schema),{from:r,to:i}=t.selection,a=[];t.doc.nodesBetween(r,i,o=>{a.push(o)});const s=a.reverse().find(o=>o.type.name===n.name);return s?{...s.attrs}:{}}function YI(t,e){const n=xl(typeof e=="string"?e:e.name,t.schema);return n==="node"?CB(t,e):n==="mark"?$I(t,e):{}}function IB(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function NB(t){const e=IB(t);return e.length===1?e:e.filter((n,r)=>!e.filter((a,s)=>s!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function KI(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,a)=>{const s=[];if(i.ranges.length)i.forEach((o,l)=>{s.push({from:o,to:l})});else{const{from:o,to:l}=n[a];if(o===void 0||l===void 0)return;s.push({from:o,to:l})}s.forEach(({from:o,to:l})=>{const u=e.slice(a).map(o,-1),c=e.slice(a).map(l),d=e.invert().map(u,-1),p=e.invert().map(c);r.push({oldRange:{from:d,to:p},newRange:{from:u,to:c}})})}),NB(r)}function _b(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const a=n.resolve(t),s=kb(a,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,a)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:a,to:a+i.nodeSize,mark:s})))}),r}var wB=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let a=r,s=null;for(;a>0&&s===null;){const o=i.node(a);o?.type.name===e?s=o:a-=1}return[s,a]};function Cs(t,e){return e.nodes[t]||e.marks[t]||null}function Ks(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(a=>a.type===e&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var RB=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,a,s,o)=>{var l,u;const c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:a,parent:s,index:o}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-a))}),n};function og(t,e,n={}){const{empty:r,ranges:i}=t.selection,a=e?Vn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>a?a.name===d.type.name:!0).find(d=>To(d.attrs,n,{strict:!1}));let s=0;const o=[];if(i.forEach(({$from:d,$to:p})=>{const f=d.pos,h=p.pos;t.doc.nodesBetween(f,h,(g,b)=>{if(!g.isText&&!g.marks.length)return;const E=Math.max(f,b),T=Math.min(h,b+g.nodeSize),y=T-E;s+=y,o.push(...g.marks.map(k=>({mark:k,from:E,to:T})))})}),s===0)return!1;const l=o.filter(d=>a?a.name===d.mark.type.name:!0).filter(d=>To(d.mark.attrs,n,{strict:!1})).reduce((d,p)=>d+p.to-p.from,0),u=o.filter(d=>a?d.mark.type!==a&&d.mark.type.excludes(a):!0).reduce((d,p)=>d+p.to-p.from,0);return(l>0?l+u:l)>=s}function OB(t,e,n={}){if(!e)return Tr(t,null,n)||og(t,null,n);const r=xl(e,t.schema);return r==="node"?Tr(t,e,n):r==="mark"?og(t,e,n):!1}var LB=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const a=vl(o=>o.type.name===e)(t.selection);if(!a)return!1;const s=t.doc.resolve(a.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},DB=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function my(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function gy(t,e){const{nodeExtensions:n}=Li(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},a=Re(le(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function _l(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(a=>{i!==!1&&(_l(a,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function XI(t){return t instanceof ue}var ZI=class QI{constructor(e){this.position=e}static fromJSON(e){return new QI(e.position)}toJSON(){return{position:this.position}}};function MB(t,e){const n=e.mapping.mapResult(t.position);return{position:new ZI(n.pos),mapResult:n}}function PB(t){return new ZI(t)}function FB(t,e,n){var r;const{selection:i}=e;let a=null;if(FI(i)&&(a=i.$cursor),a){const o=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(o)||!o.some(u=>u.type.excludes(n)))}const{ranges:s}=i;return s.some(({$from:o,$to:l})=>{let u=o.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(o.pos,l.pos,(c,d,p)=>{if(u)return!1;if(c.isInline){const f=!p||p.type.allowsMarkType(n),h=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=f&&h}return!u}),u})}var BB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=n,{empty:s,ranges:o}=a,l=Vn(t,r.schema);if(i)if(s){const u=$I(r,l);n.addStoredMark(l.create({...u,...e}))}else o.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(p,f)=>{const h=Math.max(f,c),g=Math.min(f+p.nodeSize,d);p.marks.find(E=>E.type===l)?p.marks.forEach(E=>{l===E.type&&n.addMark(h,g,l.create({...E.attrs,...e}))}):n.addMark(h,g,l.create(e))})});return FB(r,n,l)},UB=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),HB=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const a=rt(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:o})=>w0(a,{...s,...e})(n)?!0:o.clearNodes()).command(({state:o})=>w0(a,{...s,...e})(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},$B=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Dr(t,0,r.content.size),a=ue.create(r,i);e.setSelection(a)}return!0},zB=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=r;let s,o;return typeof e=="number"?(s=e,o=e):e&&"from"in e&&"to"in e?(s=e.from,o=e.to):(s=a.from,o=a.to),i&&n.doc.nodesBetween(s,o,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:t})}),!0},jB=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,s=he.atStart(r).from,o=he.atEnd(r).to,l=Dr(i,s,o),u=Dr(a,s,o),c=he.create(r,l,u);e.setSelection(c)}return!0},qB=t=>({state:e,dispatch:n})=>{const r=rt(t,e.schema);return F3(r)(e,n)};function by(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var GB=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:a,doc:s}=e,{$from:o,$to:l}=a,u=i.extensionManager.attributes,c=Ks(u,o.node().type.name,o.node().attrs);if(a instanceof ue&&a.node.isBlock)return!o.parentOffset||!jn(s,o.pos)?!1:(r&&(t&&by(n,i.extensionManager.splittableMarks),e.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,p=o.depth===0?void 0:yB(o.node(-1).contentMatchAt(o.indexAfter(-1)));let f=d&&p?[{type:p,attrs:c}]:void 0,h=jn(e.doc,e.mapping.map(o.pos),1,f);if(!f&&!h&&jn(e.doc,e.mapping.map(o.pos),1,p?[{type:p}]:void 0)&&(h=!0,f=p?[{type:p,attrs:c}]:void 0),r){if(h&&(a instanceof he&&e.deleteSelection(),e.split(e.mapping.map(o.pos),1,f),p&&!d&&!o.parentOffset&&o.parent.type!==p)){const g=e.mapping.map(o.before()),b=e.doc.resolve(g);o.node(-1).canReplaceWith(b.index(),b.index()+1,p)&&e.setNodeMarkup(e.mapping.map(o.before()),p)}t&&by(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},VB=(t,e={})=>({tr:n,state:r,dispatch:i,editor:a})=>{var s;const o=rt(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==o)return!1;const p=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let E=Y.empty;const T=l.index(-1)?1:l.index(-2)?2:3;for(let w=l.depth-T;w>=l.depth-3;w-=1)E=Y.from(l.node(w).copy(E));const y=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...Ks(p,l.node().type.name,l.node().attrs),...e},x=((s=o.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;E=E.append(Y.from(o.createAndFill(null,x)||void 0));const A=l.before(l.depth-(T-1));n.replace(A,l.after(-y),new re(E,4-T,0));let v=-1;n.doc.nodesBetween(A,n.doc.content.size,(w,C)=>{if(v>-1)return!1;w.isTextblock&&w.content.size===0&&(v=C+1)}),v>-1&&n.setSelection(he.near(n.doc.resolve(v))),n.scrollIntoView()}return!0}const f=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...Ks(p,d.type.name,d.attrs),...e},g={...Ks(p,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const b=f?[{type:o,attrs:h},{type:f,attrs:g}]:[{type:o,attrs:h}];if(!jn(n.doc,l.pos,2))return!1;if(i){const{selection:E,storedMarks:T}=r,{splittableMarks:y}=a.extensionManager,k=T||E.$to.parentOffset&&E.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!k||!i)return!0;const x=k.filter(A=>y.includes(A.type.name));n.ensureMarks(x)}return!0},gu=(t,e)=>{const n=vl(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Sr(t.doc,n.pos)&&t.join(n.pos),!0},bu=(t,e)=>{const n=vl(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Sr(t.doc,r)&&t.join(r),!0},WB=(t,e,n,r={})=>({editor:i,tr:a,state:s,dispatch:o,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:p}=i.extensionManager,f=rt(t,s.schema),h=rt(e,s.schema),{selection:g,storedMarks:b}=s,{$from:E,$to:T}=g,y=E.blockRange(T),k=b||g.$to.parentOffset&&g.$from.marks();if(!y)return!1;const x=vl(A=>gy(A.type.name,d))(g);if(y.depth>=1&&x&&y.depth-x.depth<=1){if(x.node.type===f)return u.liftListItem(h);if(gy(x.node.type.name,d)&&f.validContent(x.node.content)&&o)return l().command(()=>(a.setNodeMarkup(x.pos,f),!0)).command(()=>gu(a,f)).command(()=>bu(a,f)).run()}return!n||!k||!o?l().command(()=>c().wrapInList(f,r)?!0:u.clearNodes()).wrapInList(f,r).command(()=>gu(a,f)).command(()=>bu(a,f)).run():l().command(()=>{const A=c().wrapInList(f,r),v=k.filter(w=>p.includes(w.type.name));return a.ensureMarks(v),A?!0:u.clearNodes()}).wrapInList(f,r).command(()=>gu(a,f)).command(()=>bu(a,f)).run()},YB=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:a=!1}=n,s=Vn(t,r.schema);return og(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:a}):i.setMark(s,e)},KB=(t,e,n={})=>({state:r,commands:i})=>{const a=rt(t,r.schema),s=rt(e,r.schema),o=Tr(r,a,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),o?i.setNode(s,l):i.setNode(a,{...l,...n})},XB=(t,e={})=>({state:n,commands:r})=>{const i=rt(t,n.schema);return Tr(n,i,e)?r.lift(i):r.wrapIn(i,e)},ZB=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let a;if(i.spec.isInputRules&&(a=i.getState(t))){if(e){const s=t.tr,o=a.transform;for(let l=o.steps.length-1;l>=0;l-=1)s.step(o.steps[l].invert(o.docs[l]));if(a.text){const l=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,t.schema.text(a.text,l))}else s.delete(a.from,a.to)}return!0}}return!1},QB=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},JB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var a;const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,l=Vn(t,r.schema),{$from:u,empty:c,ranges:d}=o;if(!i)return!0;if(c&&s){let{from:p,to:f}=o;const h=(a=u.marks().find(b=>b.type===l))==null?void 0:a.attrs,g=kb(u,l,h);g&&(p=g.from,f=g.to),n.removeMark(p,f,l)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},e4=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let a,s;return typeof t=="number"?(a=t,s=t):t&&"from"in t&&"to"in t?(a=t.from,s=t.to):(a=i.from,s=i.to),r&&e.doc.nodesBetween(a,s,(o,l)=>{if(o.isText)return;const u={...o.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},t4=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let a=null,s=null;const o=xl(typeof t=="string"?t:t.name,r.schema);if(!o)return!1;o==="node"&&(a=rt(t,r.schema)),o==="mark"&&(s=Vn(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let p,f,h,g;n.selection.empty?r.doc.nodesBetween(c,d,(b,E)=>{a&&a===b.type&&(l=!0,h=Math.max(E,c),g=Math.min(E+b.nodeSize,d),p=E,f=b)}):r.doc.nodesBetween(c,d,(b,E)=>{E<c&&a&&a===b.type&&(l=!0,h=Math.max(E,c),g=Math.min(E+b.nodeSize,d),p=E,f=b),E>=c&&E<=d&&(a&&a===b.type&&(l=!0,i&&n.setNodeMarkup(E,void 0,{...b.attrs,...e})),s&&b.marks.length&&b.marks.forEach(T=>{if(s===T.type&&(l=!0,i)){const y=Math.max(E,c),k=Math.min(E+b.nodeSize,d);n.addMark(y,k,s.create({...T.attrs,...e}))}}))}),f&&(p!==void 0&&i&&n.setNodeMarkup(p,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(b=>{s===b.type&&i&&n.addMark(h,g,s.create({...b.attrs,...e}))}))}),l},n4=(t,e={})=>({state:n,dispatch:r})=>{const i=rt(t,n.schema);return w3(i,e)(n,r)},r4=(t,e={})=>({state:n,dispatch:r})=>{const i=rt(t,n.schema);return R3(i,e)(n,r)},i4=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Cl=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},a4=(t,e)=>{if(Ab(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Is(t){var e;const{editor:n,from:r,to:i,text:a,rules:s,plugin:o}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let c=!1;const d=RB(u)+a;return s.forEach(p=>{if(c)return;const f=a4(d,p.find);if(!f)return;const h=l.state.tr,g=Al({state:l.state,transaction:h}),b={from:r-(f[0].length-a.length),to:i},{commands:E,chain:T,can:y}=new kl({editor:n,state:g});p.handler({state:g,range:b,match:f,commands:E,chain:T,can:y})===null||!h.steps.length||(p.undoable&&h.setMeta(o,{transform:h,from:r,to:i,text:a}),l.dispatch(h),c=!0)}),c}function s4(t){const{editor:e,rules:n}=t,r=new Ge({state:{init(){return null},apply(i,a,s){const o=i.getMeta(r);if(o)return o;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=vb(Y.from(c),s.schema);const{from:d}=l,p=d+c.length;Is({editor:e,from:d,to:p,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,s,o){return Is({editor:e,from:a,to:s,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&Is({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?Is({editor:e,from:s.pos,to:s.pos,text:`
34
+ `,textSerializers:s={}}=n||{};let o="";return t.nodesBetween(r,i,(l,u,c,d)=>{var p;l.isBlock&&u>r&&(o+=a);const f=s?.[l.type.name];if(f)return c&&(o+=f({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(o+=(p=l?.text)==null?void 0:p.slice(Math.max(r,u)-u,i-u))}),o}function _B(t,e){const n={from:0,to:t.content.size};return VI(t,n,e)}function WI(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function CB(t,e){const n=rt(e,t.schema),{from:r,to:i}=t.selection,a=[];t.doc.nodesBetween(r,i,o=>{a.push(o)});const s=a.reverse().find(o=>o.type.name===n.name);return s?{...s.attrs}:{}}function YI(t,e){const n=xl(typeof e=="string"?e:e.name,t.schema);return n==="node"?CB(t,e):n==="mark"?$I(t,e):{}}function IB(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function NB(t){const e=IB(t);return e.length===1?e:e.filter((n,r)=>!e.filter((a,s)=>s!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function KI(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,a)=>{const s=[];if(i.ranges.length)i.forEach((o,l)=>{s.push({from:o,to:l})});else{const{from:o,to:l}=n[a];if(o===void 0||l===void 0)return;s.push({from:o,to:l})}s.forEach(({from:o,to:l})=>{const u=e.slice(a).map(o,-1),c=e.slice(a).map(l),d=e.invert().map(u,-1),p=e.invert().map(c);r.push({oldRange:{from:d,to:p},newRange:{from:u,to:c}})})}),NB(r)}function _b(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const a=n.resolve(t),s=kb(a,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,a)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:a,to:a+i.nodeSize,mark:s})))}),r}var wB=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let a=r,s=null;for(;a>0&&s===null;){const o=i.node(a);o?.type.name===e?s=o:a-=1}return[s,a]};function Cs(t,e){return e.nodes[t]||e.marks[t]||null}function Ks(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(a=>a.type===e&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var RB=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,a,s,o)=>{var l,u;const c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:a,parent:s,index:o}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-a))}),n};function og(t,e,n={}){const{empty:r,ranges:i}=t.selection,a=e?Vn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>a?a.name===d.type.name:!0).find(d=>To(d.attrs,n,{strict:!1}));let s=0;const o=[];if(i.forEach(({$from:d,$to:p})=>{const f=d.pos,h=p.pos;t.doc.nodesBetween(f,h,(g,b)=>{if(!g.isText&&!g.marks.length)return;const E=Math.max(f,b),T=Math.min(h,b+g.nodeSize),y=T-E;s+=y,o.push(...g.marks.map(k=>({mark:k,from:E,to:T})))})}),s===0)return!1;const l=o.filter(d=>a?a.name===d.mark.type.name:!0).filter(d=>To(d.mark.attrs,n,{strict:!1})).reduce((d,p)=>d+p.to-p.from,0),u=o.filter(d=>a?d.mark.type!==a&&d.mark.type.excludes(a):!0).reduce((d,p)=>d+p.to-p.from,0);return(l>0?l+u:l)>=s}function OB(t,e,n={}){if(!e)return Tr(t,null,n)||og(t,null,n);const r=xl(e,t.schema);return r==="node"?Tr(t,e,n):r==="mark"?og(t,e,n):!1}var LB=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const a=vl(o=>o.type.name===e)(t.selection);if(!a)return!1;const s=t.doc.resolve(a.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},DB=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function my(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function gy(t,e){const{nodeExtensions:n}=Li(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},a=Re(le(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function _l(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(a=>{i!==!1&&(_l(a,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function XI(t){return t instanceof ue}var ZI=class QI{constructor(e){this.position=e}static fromJSON(e){return new QI(e.position)}toJSON(){return{position:this.position}}};function MB(t,e){const n=e.mapping.mapResult(t.position);return{position:new ZI(n.pos),mapResult:n}}function PB(t){return new ZI(t)}function FB(t,e,n){var r;const{selection:i}=e;let a=null;if(FI(i)&&(a=i.$cursor),a){const o=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(o)||!o.some(u=>u.type.excludes(n)))}const{ranges:s}=i;return s.some(({$from:o,$to:l})=>{let u=o.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(o.pos,l.pos,(c,d,p)=>{if(u)return!1;if(c.isInline){const f=!p||p.type.allowsMarkType(n),h=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=f&&h}return!u}),u})}var BB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=n,{empty:s,ranges:o}=a,l=Vn(t,r.schema);if(i)if(s){const u=$I(r,l);n.addStoredMark(l.create({...u,...e}))}else o.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(p,f)=>{const h=Math.max(f,c),g=Math.min(f+p.nodeSize,d);p.marks.find(E=>E.type===l)?p.marks.forEach(E=>{l===E.type&&n.addMark(h,g,l.create({...E.attrs,...e}))}):n.addMark(h,g,l.create(e))})});return FB(r,n,l)},UB=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),HB=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const a=rt(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:o})=>w0(a,{...s,...e})(n)?!0:o.clearNodes()).command(({state:o})=>w0(a,{...s,...e})(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},$B=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Dr(t,0,r.content.size),a=ue.create(r,i);e.setSelection(a)}return!0},zB=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:a}=r;let s,o;return typeof e=="number"?(s=e,o=e):e&&"from"in e&&"to"in e?(s=e.from,o=e.to):(s=a.from,o=a.to),i&&n.doc.nodesBetween(s,o,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:t})}),!0},jB=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,s=he.atStart(r).from,o=he.atEnd(r).to,l=Dr(i,s,o),u=Dr(a,s,o),c=he.create(r,l,u);e.setSelection(c)}return!0},qB=t=>({state:e,dispatch:n})=>{const r=rt(t,e.schema);return F3(r)(e,n)};function by(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var GB=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:a,doc:s}=e,{$from:o,$to:l}=a,u=i.extensionManager.attributes,c=Ks(u,o.node().type.name,o.node().attrs);if(a instanceof ue&&a.node.isBlock)return!o.parentOffset||!jn(s,o.pos)?!1:(r&&(t&&by(n,i.extensionManager.splittableMarks),e.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,p=o.depth===0?void 0:yB(o.node(-1).contentMatchAt(o.indexAfter(-1)));let f=d&&p?[{type:p,attrs:c}]:void 0,h=jn(e.doc,e.mapping.map(o.pos),1,f);if(!f&&!h&&jn(e.doc,e.mapping.map(o.pos),1,p?[{type:p}]:void 0)&&(h=!0,f=p?[{type:p,attrs:c}]:void 0),r){if(h&&(a instanceof he&&e.deleteSelection(),e.split(e.mapping.map(o.pos),1,f),p&&!d&&!o.parentOffset&&o.parent.type!==p)){const g=e.mapping.map(o.before()),b=e.doc.resolve(g);o.node(-1).canReplaceWith(b.index(),b.index()+1,p)&&e.setNodeMarkup(e.mapping.map(o.before()),p)}t&&by(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},VB=(t,e={})=>({tr:n,state:r,dispatch:i,editor:a})=>{var s;const o=rt(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==o)return!1;const p=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let E=Y.empty;const T=l.index(-1)?1:l.index(-2)?2:3;for(let w=l.depth-T;w>=l.depth-3;w-=1)E=Y.from(l.node(w).copy(E));const y=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...Ks(p,l.node().type.name,l.node().attrs),...e},x=((s=o.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;E=E.append(Y.from(o.createAndFill(null,x)||void 0));const A=l.before(l.depth-(T-1));n.replace(A,l.after(-y),new re(E,4-T,0));let v=-1;n.doc.nodesBetween(A,n.doc.content.size,(w,C)=>{if(v>-1)return!1;w.isTextblock&&w.content.size===0&&(v=C+1)}),v>-1&&n.setSelection(he.near(n.doc.resolve(v))),n.scrollIntoView()}return!0}const f=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...Ks(p,d.type.name,d.attrs),...e},g={...Ks(p,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const b=f?[{type:o,attrs:h},{type:f,attrs:g}]:[{type:o,attrs:h}];if(!jn(n.doc,l.pos,2))return!1;if(i){const{selection:E,storedMarks:T}=r,{splittableMarks:y}=a.extensionManager,k=T||E.$to.parentOffset&&E.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!k||!i)return!0;const x=k.filter(A=>y.includes(A.type.name));n.ensureMarks(x)}return!0},gu=(t,e)=>{const n=vl(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Sr(t.doc,n.pos)&&t.join(n.pos),!0},bu=(t,e)=>{const n=vl(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Sr(t.doc,r)&&t.join(r),!0},WB=(t,e,n,r={})=>({editor:i,tr:a,state:s,dispatch:o,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:p}=i.extensionManager,f=rt(t,s.schema),h=rt(e,s.schema),{selection:g,storedMarks:b}=s,{$from:E,$to:T}=g,y=E.blockRange(T),k=b||g.$to.parentOffset&&g.$from.marks();if(!y)return!1;const x=vl(A=>gy(A.type.name,d))(g);if(y.depth>=1&&x&&y.depth-x.depth<=1){if(x.node.type===f)return u.liftListItem(h);if(gy(x.node.type.name,d)&&f.validContent(x.node.content)&&o)return l().command(()=>(a.setNodeMarkup(x.pos,f),!0)).command(()=>gu(a,f)).command(()=>bu(a,f)).run()}return!n||!k||!o?l().command(()=>c().wrapInList(f,r)?!0:u.clearNodes()).wrapInList(f,r).command(()=>gu(a,f)).command(()=>bu(a,f)).run():l().command(()=>{const A=c().wrapInList(f,r),v=k.filter(w=>p.includes(w.type.name));return a.ensureMarks(v),A?!0:u.clearNodes()}).wrapInList(f,r).command(()=>gu(a,f)).command(()=>bu(a,f)).run()},YB=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:a=!1}=n,s=Vn(t,r.schema);return og(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:a}):i.setMark(s,e)},KB=(t,e,n={})=>({state:r,commands:i})=>{const a=rt(t,r.schema),s=rt(e,r.schema),o=Tr(r,a,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),o?i.setNode(s,l):i.setNode(a,{...l,...n})},XB=(t,e={})=>({state:n,commands:r})=>{const i=rt(t,n.schema);return Tr(n,i,e)?r.lift(i):r.wrapIn(i,e)},ZB=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let a;if(i.spec.isInputRules&&(a=i.getState(t))){if(e){const s=t.tr,o=a.transform;for(let l=o.steps.length-1;l>=0;l-=1)s.step(o.steps[l].invert(o.docs[l]));if(a.text){const l=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,t.schema.text(a.text,l))}else s.delete(a.from,a.to)}return!0}}return!1},QB=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},JB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var a;const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,l=Vn(t,r.schema),{$from:u,empty:c,ranges:d}=o;if(!i)return!0;if(c&&s){let{from:p,to:f}=o;const h=(a=u.marks().find(b=>b.type===l))==null?void 0:a.attrs,g=kb(u,l,h);g&&(p=g.from,f=g.to),n.removeMark(p,f,l)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},e4=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let a,s;return typeof t=="number"?(a=t,s=t):t&&"from"in t&&"to"in t?(a=t.from,s=t.to):(a=i.from,s=i.to),r&&e.doc.nodesBetween(a,s,(o,l)=>{if(o.isText)return;const u={...o.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},t4=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let a=null,s=null;const o=xl(typeof t=="string"?t:t.name,r.schema);if(!o)return!1;o==="node"&&(a=rt(t,r.schema)),o==="mark"&&(s=Vn(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let p,f,h,g;n.selection.empty?r.doc.nodesBetween(c,d,(b,E)=>{a&&a===b.type&&(l=!0,h=Math.max(E,c),g=Math.min(E+b.nodeSize,d),p=E,f=b)}):r.doc.nodesBetween(c,d,(b,E)=>{E<c&&a&&a===b.type&&(l=!0,h=Math.max(E,c),g=Math.min(E+b.nodeSize,d),p=E,f=b),E>=c&&E<=d&&(a&&a===b.type&&(l=!0,i&&n.setNodeMarkup(E,void 0,{...b.attrs,...e})),s&&b.marks.length&&b.marks.forEach(T=>{if(s===T.type&&(l=!0,i)){const y=Math.max(E,c),k=Math.min(E+b.nodeSize,d);n.addMark(y,k,s.create({...T.attrs,...e}))}}))}),f&&(p!==void 0&&i&&n.setNodeMarkup(p,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(b=>{s===b.type&&i&&n.addMark(h,g,s.create({...b.attrs,...e}))}))}),l},n4=(t,e={})=>({state:n,dispatch:r})=>{const i=rt(t,n.schema);return w3(i,e)(n,r)},r4=(t,e={})=>({state:n,dispatch:r})=>{const i=rt(t,n.schema);return R3(i,e)(n,r)},i4=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Cl=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},a4=(t,e)=>{if(Ab(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Is(t){var e;const{editor:n,from:r,to:i,text:a,rules:s,plugin:o}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let c=!1;const d=RB(u)+a;return s.forEach(p=>{if(c)return;const f=a4(d,p.find);if(!f)return;const h=l.state.tr,g=Al({state:l.state,transaction:h}),b={from:r-(f[0].length-a.length),to:i},{commands:E,chain:T,can:y}=new kl({editor:n,state:g});p.handler({state:g,range:b,match:f,commands:E,chain:T,can:y})===null||!h.steps.length||(p.undoable&&h.setMeta(o,{transform:h,from:r,to:i,text:a}),l.dispatch(h),c=!0)}),c}function s4(t){const{editor:e,rules:n}=t,r=new Ge({state:{init(){return null},apply(i,a,s){const o=i.getMeta(r);if(o)return o;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=vb(Y.from(c),s.schema);const{from:d}=l,p=d+c.length;Is({editor:e,from:d,to:p,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,s,o){return Is({editor:e,from:a,to:s,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&Is({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?Is({editor:e,from:s.pos,to:s.pos,text:`
35
35
  `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function o4(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ns(t){return o4(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function JI(t,e){const n={...t};return Ns(t)&&Ns(e)&&Object.keys(e).forEach(r=>{Ns(e[r])&&Ns(t[r])?n[r]=JI(t[r],e[r]):n[r]=e[r]}),n}var Cb=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Re(le(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Re(le(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>JI(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},ri=class eN extends Cb{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new eN(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(u=>u?.type.name===n.name))return!1;const l=s.find(u=>u?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function l4(t){return typeof t=="number"}var u4=class{constructor(t){this.find=t.find,this.handler=t.handler}},c4=(t,e,n)=>{if(Ab(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const a=[i.text];return a.index=i.index,a.input=t,a.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(i.replaceWith)),a}):[]};function d4(t){const{editor:e,state:n,from:r,to:i,rule:a,pasteEvent:s,dropEvent:o}=t,{commands:l,chain:u,can:c}=new kl({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,h)=>{var g,b,E,T,y;if((b=(g=f.type)==null?void 0:g.spec)!=null&&b.code||!(f.isText||f.isTextblock||f.isInline))return;const k=(y=(T=(E=f.content)==null?void 0:E.size)!=null?T:f.nodeSize)!=null?y:0,x=Math.max(r,h),A=Math.min(i,h+k);if(x>=A)return;const v=f.isText?f.text||"":f.textBetween(x-h,A-h,void 0,"");c4(v,a.find,s).forEach(C=>{if(C.index===void 0)return;const _=x+C.index+1,D=_+C[0].length,P={from:n.tr.mapping.map(_),to:n.tr.mapping.map(D)},z=a.handler({state:n,range:P,match:C,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:o});d.push(z)})}),d.every(f=>f!==null)}var ws=null,p4=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function f4(t){const{editor:e,rules:n}=t;let r=null,i=!1,a=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,o;try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}const l=({state:c,from:d,to:p,rule:f,pasteEvt:h})=>{const g=c.tr,b=Al({state:c,transaction:g});if(!(!d4({editor:e,state:b,from:Math.max(d-1,0),to:p.b-1,rule:f,pasteEvent:h,dropEvent:o})||!g.steps.length)){try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(c=>new Ge({view(d){const p=h=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(h.target)?d.dom.parentElement:null,r&&(ws=e)},f=()=>{ws&&(ws=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,p)=>{if(a=r===d.dom.parentElement,o=p,!a){const f=ws;f?.isEditable&&setTimeout(()=>{const h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,p)=>{var f;const h=(f=p.clipboardData)==null?void 0:f.getData("text/html");return s=p,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(d,p,f)=>{const h=d[0],g=h.getMeta("uiEvent")==="paste"&&!i,b=h.getMeta("uiEvent")==="drop"&&!a,E=h.getMeta("applyPasteRules"),T=!!E;if(!g&&!b&&!T)return;if(T){let{text:x}=E;typeof x=="string"?x=x:x=vb(Y.from(x),f.schema);const{from:A}=E,v=A+x.length,w=p4(x);return l({rule:c,state:f,from:A,to:{b:v},pasteEvt:w})}const y=p.doc.content.findDiffStart(f.doc.content),k=p.doc.content.findDiffEnd(f.doc.content);if(!(!l4(y)||!k||y===k.b))return l({rule:c,state:f,from:y,to:k,pasteEvt:s})}}))}var Il=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=GI(t),this.schema=xB(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Cs(e.name,this.schema)},r=le(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return So([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Cs(r.name,this.schema)},a=[],s=le(r,"addKeyboardShortcuts",i);let o={};if(r.type==="mark"&&le(r,"exitable",i)&&(o.ArrowRight=()=>ri.handleExit({editor:t,mark:r})),s){const p=Object.fromEntries(Object.entries(s()).map(([f,h])=>[f,()=>h({editor:t})]));o={...o,...p}}const l=CF(o);a.push(l);const u=le(r,"addInputRules",i);if(my(r,t.options.enableInputRules)&&u){const p=u();if(p&&p.length){const f=s4({editor:t,rules:p}),h=Array.isArray(f)?f:[f];a.push(...h)}}const c=le(r,"addPasteRules",i);if(my(r,t.options.enablePasteRules)&&c){const p=c();if(p&&p.length){const f=f4({editor:t,rules:p});a.push(...f)}}const d=le(r,"addProseMirrorPlugins",i);if(d){const p=d();a.push(...p)}return a})}get attributes(){return qI(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Li(this.extensions);return Object.fromEntries(e.filter(n=>!!le(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:rt(n.name,this.schema)},a=le(n,"addNodeView",i);if(!a)return[];const s=a();if(!s)return[];const o=(l,u,c,d,p)=>{const f=Di(l,r);return s({node:l,view:u,getPos:c,decorations:d,innerDecorations:p,editor:t,extension:n,HTMLAttributes:f})};return[n.name,o]}))}dispatchTransaction(t){const{editor:e}=this;return So([...this.extensions].reverse()).reduceRight((r,i)=>{const a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Cs(i.name,this.schema)},s=le(i,"dispatchTransaction",a);return s?o=>{s.call(a,{transaction:o,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Li(this.extensions);return Object.fromEntries(e.filter(n=>!!le(n,"addMarkView")).map(n=>{const r=this.attributes.filter(o=>o.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Vn(n.name,this.schema)},a=le(n,"addMarkView",i);if(!a)return[];const s=(o,l,u)=>{const c=Di(o,r);return a()({mark:o,view:l,inline:u,editor:t,extension:n,HTMLAttributes:c,updateAttributes:d=>{I4(o,t,d)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Cs(e.name,this.schema)};e.type==="mark"&&((n=Re(le(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=le(e,"onBeforeCreate",r),a=le(e,"onCreate",r),s=le(e,"onUpdate",r),o=le(e,"onSelectionUpdate",r),l=le(e,"onTransaction",r),u=le(e,"onFocus",r),c=le(e,"onBlur",r),d=le(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),a&&this.editor.on("create",a),s&&this.editor.on("update",s),o&&this.editor.on("selectionUpdate",o),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};Il.resolve=GI;Il.sort=So;Il.flatten=xb;var h4={};Sb(h4,{ClipboardTextSerializer:()=>nN,Commands:()=>rN,Delete:()=>iN,Drop:()=>aN,Editable:()=>sN,FocusEvents:()=>lN,Keymap:()=>uN,Paste:()=>cN,Tabindex:()=>dN,TextDirection:()=>pN,focusEventsPluginKey:()=>oN});var et=class tN extends Cb{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new tN(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},nN=et.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ge({key:new Xe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:a}=i,s=Math.min(...a.map(c=>c.$from.pos)),o=Math.max(...a.map(c=>c.$to.pos)),l=WI(n);return VI(r,{from:s,to:o},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),rN=et.create({name:"commands",addCommands(){return{...MI}}}),iN=et.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const a=()=>{var s,o,l,u;if((u=(l=(o=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:o.filterTransaction)==null?void 0:l.call(o,t))!=null?u:t.getMeta("y-sync$"))return;const c=zI(t.before,[t,...e]);KI(c).forEach(f=>{c.mapping.mapResult(f.oldRange.from).deletedAfter&&c.mapping.mapResult(f.oldRange.to).deletedBefore&&c.before.nodesBetween(f.oldRange.from,f.oldRange.to,(h,g)=>{const b=g+h.nodeSize-2,E=f.oldRange.from<=g&&b<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:g,to:b,newFrom:c.mapping.map(g),newTo:c.mapping.map(b),deletedRange:f.oldRange,newRange:f.newRange,partial:!E,editor:this.editor,transaction:t,combinedTransform:c})})});const p=c.mapping;c.steps.forEach((f,h)=>{var g,b;if(f instanceof mn){const E=p.slice(h).map(f.from,-1),T=p.slice(h).map(f.to),y=p.invert().map(E,-1),k=p.invert().map(T),x=(g=c.doc.nodeAt(E-1))==null?void 0:g.marks.some(v=>v.eq(f.mark)),A=(b=c.doc.nodeAt(T))==null?void 0:b.marks.some(v=>v.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:y,to:k},newRange:{from:E,to:T},partial:!!(A||x),editor:this.editor,transaction:t,combinedTransform:c})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(a,0):a()}}),aN=et.create({name:"drop",addProseMirrorPlugins(){return[new Ge({key:new Xe("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),sN=et.create({name:"editable",addProseMirrorPlugins(){return[new Ge({key:new Xe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),oN=new Xe("focusEvents"),lN=et.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ge({key:oN,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),uN=et.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:o})=>{const{selection:l,doc:u}=o,{empty:c,$anchor:d}=l,{pos:p,parent:f}=d,h=d.parent.isTextblock&&p>0?o.doc.resolve(p-1):d,g=h.parent.type.spec.isolating,b=d.pos-d.parentOffset,E=g&&h.parent.childCount===1?b===d.pos:ye.atStart(u).from===p;return!c||!f.type.isTextblock||f.textContent.length||!E||E&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},a={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Va()||HI()?a:i},addProseMirrorPlugins(){return[new Ge({key:new Xe("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:a,from:s,to:o}=e.selection,l=ye.atStart(e.doc).from,u=ye.atEnd(e.doc).to;if(a||!(s===l&&o===u)||!_l(n.doc))return;const p=n.tr,f=Al({state:n,transaction:p}),{commands:h}=new kl({editor:this.editor,state:f});if(h.clearNodes(),!!p.steps.length)return p}})]}}),cN=et.create({name:"paste",addProseMirrorPlugins(){return[new Ge({key:new Xe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),dN=et.create({name:"tabindex",addProseMirrorPlugins(){return[new Ge({key:new Xe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),pN=et.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Li(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ge({key:new Xe("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),m4=class Ei{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Ei(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Ei(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Ei(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,s=this.pos+r+(a?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const l=new Ei(o,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new Ei(o,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const a=i.node.attrs,s=Object.keys(n);for(let o=0;o<s.length;o+=1){const l=s[o];if(a[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const a=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&a.every(l=>n[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},g4=`.ProseMirror {
36
36
  position: relative;
37
37
  }