reactjs-tiptap-editor 0.3.31 → 0.4.1

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 (275) hide show
  1. package/README.md +8 -2
  2. package/lib/{ActionMenuButton-BCgqJsST.cjs → ActionMenuButton-CYdM1xx5.cjs} +1 -1
  3. package/lib/{ActionMenuButton-D97K0UWT.js → ActionMenuButton-DKRF6oa0.js} +1 -1
  4. package/lib/Attachment.cjs +2 -2
  5. package/lib/Attachment.d.cts +25 -29
  6. package/lib/Attachment.d.ts +25 -29
  7. package/lib/Attachment.js +7 -6
  8. package/lib/BaseKit.cjs +3 -0
  9. package/lib/BaseKit.d.cts +481 -0
  10. package/lib/BaseKit.d.ts +481 -0
  11. package/lib/BaseKit.js +132 -0
  12. package/lib/Blockquote.cjs +5 -1
  13. package/lib/Blockquote.d.cts +25 -29
  14. package/lib/Blockquote.d.ts +25 -29
  15. package/lib/Blockquote.js +33 -17
  16. package/lib/Bold.cjs +1 -1
  17. package/lib/Bold.d.cts +25 -29
  18. package/lib/Bold.d.ts +25 -29
  19. package/lib/Bold.js +23 -16
  20. package/lib/BulletList.cjs +1 -1
  21. package/lib/BulletList.d.cts +26 -30
  22. package/lib/BulletList.d.ts +26 -30
  23. package/lib/BulletList.js +11 -57
  24. package/lib/Clear.cjs +1 -1
  25. package/lib/Clear.d.cts +25 -29
  26. package/lib/Clear.d.ts +25 -29
  27. package/lib/Clear.js +4 -2
  28. package/lib/Code.cjs +1 -1
  29. package/lib/Code.d.cts +25 -29
  30. package/lib/Code.d.ts +25 -29
  31. package/lib/Code.js +29 -25
  32. package/lib/CodeBlock.cjs +2 -2
  33. package/lib/CodeBlock.d.cts +25 -29
  34. package/lib/CodeBlock.d.ts +25 -29
  35. package/lib/CodeBlock.js +3 -3
  36. package/lib/CodeView.cjs +1 -1
  37. package/lib/CodeView.d.cts +25 -29
  38. package/lib/CodeView.d.ts +25 -29
  39. package/lib/CodeView.js +3 -2
  40. package/lib/Color.cjs +1 -1
  41. package/lib/Color.d.cts +26 -30
  42. package/lib/Color.d.ts +26 -30
  43. package/lib/Color.js +42 -74
  44. package/lib/Document.cjs +1 -1
  45. package/lib/Document.d.cts +25 -29
  46. package/lib/Document.d.ts +25 -29
  47. package/lib/Document.js +4 -8
  48. package/lib/{Drawer-BHkje8ys.js → Drawer-CaAfmqNo.js} +37 -35
  49. package/lib/{Drawer-5Q_-WRhc.cjs → Drawer-CdvCMSzN.cjs} +1 -1
  50. package/lib/Drawer.cjs +1 -1
  51. package/lib/Drawer.d.cts +25 -29
  52. package/lib/Drawer.d.ts +25 -29
  53. package/lib/Drawer.js +4 -4
  54. package/lib/Emoji.cjs +1 -1
  55. package/lib/Emoji.d.cts +28 -30
  56. package/lib/Emoji.d.ts +28 -30
  57. package/lib/Emoji.js +19795 -184
  58. package/lib/{Excalidraw-GUVW-IqC.cjs → Excalidraw-BbMQhNvs.cjs} +1 -1
  59. package/lib/{Excalidraw-CG498239.js → Excalidraw-CVWz2Vyn.js} +20 -20
  60. package/lib/Excalidraw.cjs +1 -1
  61. package/lib/Excalidraw.d.cts +25 -29
  62. package/lib/Excalidraw.d.ts +25 -29
  63. package/lib/Excalidraw.js +3 -3
  64. package/lib/ExportPdf.cjs +1 -1
  65. package/lib/ExportPdf.d.cts +25 -29
  66. package/lib/ExportPdf.d.ts +25 -29
  67. package/lib/ExportPdf.js +4 -2
  68. package/lib/ExportWord.cjs +1 -1
  69. package/lib/ExportWord.d.cts +25 -29
  70. package/lib/ExportWord.d.ts +25 -29
  71. package/lib/ExportWord.js +22 -51
  72. package/lib/FontFamily.cjs +1 -1
  73. package/lib/FontFamily.d.cts +26 -30
  74. package/lib/FontFamily.d.ts +26 -30
  75. package/lib/FontFamily.js +44 -73
  76. package/lib/FontSize.cjs +1 -1
  77. package/lib/FontSize.d.cts +25 -29
  78. package/lib/FontSize.d.ts +25 -29
  79. package/lib/FontSize.js +7 -5
  80. package/lib/FormatPainter.cjs +1 -1
  81. package/lib/FormatPainter.d.cts +25 -29
  82. package/lib/FormatPainter.d.ts +25 -29
  83. package/lib/FormatPainter.js +4 -2
  84. package/lib/Heading.cjs +1 -1
  85. package/lib/Heading.d.cts +25 -29
  86. package/lib/Heading.d.ts +25 -29
  87. package/lib/Heading.js +71 -60
  88. package/lib/Highlight.cjs +1 -1
  89. package/lib/Highlight.d.cts +25 -29
  90. package/lib/Highlight.d.ts +25 -29
  91. package/lib/Highlight.js +5 -4
  92. package/lib/History.cjs +1 -1
  93. package/lib/History.d.cts +27 -31
  94. package/lib/History.d.ts +27 -31
  95. package/lib/History.js +39 -403
  96. package/lib/HorizontalRule.cjs +1 -1
  97. package/lib/HorizontalRule.d.cts +25 -29
  98. package/lib/HorizontalRule.d.ts +25 -29
  99. package/lib/HorizontalRule.js +16 -65
  100. package/lib/Iframe.cjs +1 -1
  101. package/lib/Iframe.d.cts +25 -29
  102. package/lib/Iframe.d.ts +25 -29
  103. package/lib/Iframe.js +4 -4
  104. package/lib/Image.cjs +1 -1
  105. package/lib/Image.d.cts +25 -29
  106. package/lib/Image.d.ts +25 -29
  107. package/lib/Image.js +3 -3
  108. package/lib/ImageGif.cjs +1 -1
  109. package/lib/ImageGif.d.cts +25 -29
  110. package/lib/ImageGif.d.ts +25 -29
  111. package/lib/ImageGif.js +5 -5
  112. package/lib/ImportWord.cjs +72 -72
  113. package/lib/ImportWord.d.cts +25 -29
  114. package/lib/ImportWord.d.ts +25 -29
  115. package/lib/ImportWord.js +5652 -5615
  116. package/lib/Indent.cjs +1 -1
  117. package/lib/Indent.d.cts +25 -29
  118. package/lib/Indent.d.ts +25 -29
  119. package/lib/Indent.js +4 -2
  120. package/lib/Italic.cjs +1 -1
  121. package/lib/Italic.d.cts +25 -29
  122. package/lib/Italic.d.ts +25 -29
  123. package/lib/Italic.js +20 -14
  124. package/lib/Katex.cjs +1 -1
  125. package/lib/Katex.d.cts +25 -29
  126. package/lib/Katex.d.ts +25 -29
  127. package/lib/Katex.js +12 -12
  128. package/lib/LineHeight.cjs +1 -1
  129. package/lib/LineHeight.d.cts +25 -29
  130. package/lib/LineHeight.d.ts +25 -29
  131. package/lib/LineHeight.js +5 -3
  132. package/lib/Link.cjs +1 -1
  133. package/lib/Link.d.cts +25 -29
  134. package/lib/Link.d.ts +25 -29
  135. package/lib/Link.js +4 -4
  136. package/lib/ListItem.cjs +1 -1
  137. package/lib/ListItem.d.cts +30 -30
  138. package/lib/ListItem.d.ts +30 -30
  139. package/lib/ListItem.js +4 -30
  140. package/lib/Mention.cjs +1 -1
  141. package/lib/Mention.d.cts +25 -29
  142. package/lib/Mention.d.ts +25 -29
  143. package/lib/Mention.js +161 -132
  144. package/lib/Mermaid.cjs +2 -2
  145. package/lib/Mermaid.d.cts +25 -29
  146. package/lib/Mermaid.d.ts +25 -29
  147. package/lib/Mermaid.js +50 -48
  148. package/lib/MoreMark.cjs +1 -1
  149. package/lib/MoreMark.d.cts +25 -29
  150. package/lib/MoreMark.d.ts +25 -29
  151. package/lib/MoreMark.js +5 -3
  152. package/lib/MultiColumn.cjs +1 -1
  153. package/lib/MultiColumn.d.cts +25 -29
  154. package/lib/MultiColumn.d.ts +25 -29
  155. package/lib/MultiColumn.js +2 -2
  156. package/lib/OrderedList.cjs +1 -1
  157. package/lib/OrderedList.d.cts +26 -30
  158. package/lib/OrderedList.d.ts +26 -30
  159. package/lib/OrderedList.js +11 -75
  160. package/lib/RichTextEditor-CxvwGvQG.cjs +142 -0
  161. package/lib/RichTextEditor-DGcKEUGr.js +22166 -0
  162. package/lib/SearchAndReplace.cjs +1 -1
  163. package/lib/SearchAndReplace.d.cts +38 -112
  164. package/lib/SearchAndReplace.d.ts +38 -112
  165. package/lib/SearchAndReplace.js +204 -192
  166. package/lib/Selection.cjs +1 -1
  167. package/lib/Selection.d.cts +25 -29
  168. package/lib/Selection.d.ts +25 -29
  169. package/lib/Selection.js +1 -1
  170. package/lib/SlashCommand.cjs +1 -1
  171. package/lib/SlashCommand.d.cts +25 -29
  172. package/lib/SlashCommand.d.ts +25 -29
  173. package/lib/SlashCommand.js +178 -223
  174. package/lib/Strike.cjs +1 -1
  175. package/lib/Strike.d.cts +25 -29
  176. package/lib/Strike.d.ts +25 -29
  177. package/lib/Strike.js +20 -14
  178. package/lib/SubAndSuperScript.cjs +1 -1
  179. package/lib/SubAndSuperScript.d.cts +25 -29
  180. package/lib/SubAndSuperScript.d.ts +25 -29
  181. package/lib/SubAndSuperScript.js +5 -3
  182. package/lib/Table.cjs +8 -10
  183. package/lib/Table.d.cts +28 -32
  184. package/lib/Table.d.ts +28 -32
  185. package/lib/Table.js +382 -2022
  186. package/lib/TableOfContent.cjs +1 -1
  187. package/lib/TableOfContent.d.cts +25 -29
  188. package/lib/TableOfContent.d.ts +25 -29
  189. package/lib/TableOfContent.js +5 -5
  190. package/lib/TaskList.cjs +1 -1
  191. package/lib/TaskList.d.cts +27 -31
  192. package/lib/TaskList.d.ts +27 -31
  193. package/lib/TaskList.js +12 -154
  194. package/lib/TextAlign.cjs +1 -1
  195. package/lib/TextAlign.d.cts +25 -29
  196. package/lib/TextAlign.d.ts +25 -29
  197. package/lib/TextAlign.js +11 -9
  198. package/lib/TextBubble.cjs +1 -1
  199. package/lib/TextBubble.d.cts +25 -29
  200. package/lib/TextBubble.d.ts +25 -29
  201. package/lib/TextBubble.js +5 -3
  202. package/lib/TextDirection.cjs +1 -1
  203. package/lib/TextDirection.d.cts +25 -29
  204. package/lib/TextDirection.d.ts +25 -29
  205. package/lib/TextDirection.js +2 -3
  206. package/lib/TextUnderline.cjs +1 -1
  207. package/lib/TextUnderline.d.cts +25 -29
  208. package/lib/TextUnderline.d.ts +25 -29
  209. package/lib/TextUnderline.js +40 -12
  210. package/lib/TrailingNode.cjs +1 -1
  211. package/lib/TrailingNode.d.cts +25 -29
  212. package/lib/TrailingNode.d.ts +25 -29
  213. package/lib/TrailingNode.js +1 -1
  214. package/lib/Twitter-BFULyqdR.js +1628 -0
  215. package/lib/Twitter-Cutpkh3h.cjs +1 -0
  216. package/lib/Twitter.cjs +1 -1
  217. package/lib/Twitter.d.cts +25 -29
  218. package/lib/Twitter.d.ts +25 -29
  219. package/lib/Twitter.js +3 -3
  220. package/lib/Video.cjs +1 -1
  221. package/lib/Video.d.cts +25 -29
  222. package/lib/Video.d.ts +25 -29
  223. package/lib/Video.js +3 -3
  224. package/lib/bubble-extra.cjs +2 -2
  225. package/lib/bubble-extra.d.cts +25 -29
  226. package/lib/bubble-extra.d.ts +25 -29
  227. package/lib/bubble-extra.js +200 -192
  228. package/lib/dom-dataset-_6-diIRQ.cjs +33 -0
  229. package/lib/dom-dataset-lYeH6gfI.js +2361 -0
  230. package/lib/index-5iBZLua9.cjs +12 -0
  231. package/lib/index-6D1J-A-o.cjs +1 -0
  232. package/lib/index-B96Cclrj.cjs +3 -0
  233. package/lib/index-BBz7Nmv9.js +55 -0
  234. package/lib/index-BeCTd5v2.cjs +1 -0
  235. package/lib/index-ByurDDMv.js +237 -0
  236. package/lib/index-CUogRI7j.cjs +1 -0
  237. package/lib/index-Ch6dBBad.js +709 -0
  238. package/lib/index-DF2Lp4HZ.cjs +100 -0
  239. package/lib/{index-LUL9mqY4.js → index-D_L6n8O8.js} +4 -4
  240. package/lib/index-Dbvi-Bvh.cjs +1 -0
  241. package/lib/index-DpCrt7xs.cjs +1 -0
  242. package/lib/index-DsAX1Vq8.cjs +1 -0
  243. package/lib/index-Dy4DlW9o.js +12 -0
  244. package/lib/index-J3jHHZ4d.js +200 -0
  245. package/lib/{index-CsK90iVd.js → index-LmrOdnen.js} +302 -389
  246. package/lib/index-VvXaaKe3.js +898 -0
  247. package/lib/index-kbO3iWqL.js +13432 -0
  248. package/lib/index.cjs +1 -2
  249. package/lib/index.d.cts +26 -229
  250. package/lib/index.d.ts +26 -229
  251. package/lib/index.js +2 -588
  252. package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
  253. package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
  254. package/lib/locale-bundle.cjs +1 -1
  255. package/lib/locale-bundle.d.cts +25 -29
  256. package/lib/locale-bundle.d.ts +25 -29
  257. package/lib/locale-bundle.js +1 -1
  258. package/lib/style.css +1 -1
  259. package/lib/{textarea-DdH64g04.cjs → textarea-DFo_aXnj.cjs} +1 -1
  260. package/lib/{textarea-CktfkXNe.js → textarea-aPtytkDx.js} +1 -1
  261. package/package.json +76 -70
  262. package/lib/RichTextEditor-DWlLqTl9.cjs +0 -140
  263. package/lib/RichTextEditor-KP2Rgcqe.js +0 -12751
  264. package/lib/Twitter-99ivY5qv.js +0 -1744
  265. package/lib/Twitter-BvfvUtNT.cjs +0 -17
  266. package/lib/dom-dataset-Byuf1YmW.cjs +0 -33
  267. package/lib/dom-dataset-Di3tIRrR.js +0 -1031
  268. package/lib/index-BI-IcZcN.cjs +0 -1
  269. package/lib/index-ByRfqzMr.cjs +0 -89
  270. package/lib/index-C1fzuXpN.js +0 -46
  271. package/lib/index-CbQQFj2T.js +0 -133
  272. package/lib/index-DI9T3iLd.js +0 -12354
  273. package/lib/index-D_A0TBRA.cjs +0 -1
  274. package/lib/index-DclQSrIx.cjs +0 -1
  275. package/lib/index-Z4b9rzn-.cjs +0 -1
@@ -0,0 +1,142 @@
1
+ "use strict";const f=require("react/jsx-runtime"),C=require("react"),re=require("./dom-dataset-_6-diIRQ.cjs"),v=require("./index-DF2Lp4HZ.cjs"),ep=require("react-dom"),tp=require("@radix-ui/react-slot"),z=require("./index-6D1J-A-o.cjs"),I0=require("@radix-ui/react-separator"),_0=require("@radix-ui/react-toast"),L=require("lucide-react"),R0=require("@radix-ui/react-tooltip"),O0=require("@radix-ui/react-toggle"),li=require("@radix-ui/react-icons"),j0=require("@radix-ui/react-popover"),M0=require("@radix-ui/react-label"),N0=require("@radix-ui/react-dialog"),P0=require("re-resizable"),L0=require("react-image-crop"),D0=require("@radix-ui/react-tabs"),$0=require("@radix-ui/react-checkbox"),B0=require("react-colorful"),H0=require("@radix-ui/react-switch"),z0=require("@radix-ui/react-dropdown-menu");function nt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ae=nt(C),np=nt(I0),Xe=nt(_0),Xr=nt(R0),rp=nt(O0),Rr=nt(j0),ip=nt(M0),tt=nt(N0),In=nt(D0),Sl=nt($0),Cl=nt(H0),be=nt(z0);var Or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function op(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function sp(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var ap=typeof global=="object"&&global&&global.Object===Object&&global,U0=typeof self=="object"&&self&&self.Object===Object&&self,At=ap||U0||Function("return this")(),St=At.Symbol,lp=Object.prototype,F0=lp.hasOwnProperty,q0=lp.toString,fr=St?St.toStringTag:void 0;function V0(e){var t=F0.call(e,fr),n=e[fr];try{e[fr]=void 0;var r=!0}catch{}var i=q0.call(e);return r&&(t?e[fr]=n:delete e[fr]),i}var W0=Object.prototype,G0=W0.toString;function K0(e){return G0.call(e)}var Y0="[object Null]",X0="[object Undefined]",Nu=St?St.toStringTag:void 0;function gn(e){return e==null?e===void 0?X0:Y0:Nu&&Nu in Object(e)?V0(e):K0(e)}function Bt(e){return e!=null&&typeof e=="object"}var J0="[object Symbol]";function _o(e){return typeof e=="symbol"||Bt(e)&&gn(e)==J0}function cp(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var Ct=Array.isArray,Pu=St?St.prototype:void 0,Lu=Pu?Pu.toString:void 0;function $i(e){if(typeof e=="string")return e;if(Ct(e))return cp(e,$i)+"";if(_o(e))return Lu?Lu.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Z0=/\s/;function Q0(e){for(var t=e.length;t--&&Z0.test(e.charAt(t)););return t}var ex=/^\s+/;function tx(e){return e&&e.slice(0,Q0(e)+1).replace(ex,"")}function cn(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Du=NaN,nx=/^[-+]0x[0-9a-f]+$/i,rx=/^0b[01]+$/i,ix=/^0o[0-7]+$/i,ox=parseInt;function zn(e){if(typeof e=="number")return e;if(_o(e))return Du;if(cn(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=cn(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=tx(e);var n=rx.test(e);return n||ix.test(e)?ox(e.slice(2),n?2:8):nx.test(e)?Du:+e}var $u=1/0,sx=17976931348623157e292;function ax(e){if(!e)return e===0?e:0;if(e=zn(e),e===$u||e===-$u){var t=e<0?-1:1;return t*sx}return e===e?e:0}function lx(e){var t=ax(e),n=t%1;return t===t?n?t-n:t:0}function mc(e){return e}var cx="[object AsyncFunction]",ux="[object Function]",dx="[object GeneratorFunction]",hx="[object Proxy]";function up(e){if(!cn(e))return!1;var t=gn(e);return t==ux||t==dx||t==cx||t==hx}var ds=At["__core-js_shared__"],Bu=(function(){var e=/[^.]+$/.exec(ds&&ds.keys&&ds.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function fx(e){return!!Bu&&Bu in e}var px=Function.prototype,gx=px.toString;function _n(e){if(e!=null){try{return gx.call(e)}catch{}try{return e+""}catch{}}return""}var mx=/[\\^$.*+?()[\]{}|]/g,xx=/^\[object .+?Constructor\]$/,yx=Function.prototype,vx=Object.prototype,bx=yx.toString,wx=vx.hasOwnProperty,Sx=RegExp("^"+bx.call(wx).replace(mx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Cx(e){if(!cn(e)||fx(e))return!1;var t=up(e)?Sx:xx;return t.test(_n(e))}function Ax(e,t){return e==null?void 0:e[t]}function Rn(e,t){var n=Ax(e,t);return Cx(n)?n:void 0}var Al=Rn(At,"WeakMap");function kx(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Ex=800,Tx=16,Ix=Date.now;function _x(e){var t=0,n=0;return function(){var r=Ix(),i=Tx-(r-n);if(n=r,i>0){if(++t>=Ex)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Rx(e){return function(){return e}}var Hu=(function(){try{var e=Rn(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Ox=Hu?function(e,t){return Hu(e,"toString",{configurable:!0,enumerable:!1,value:Rx(t),writable:!0})}:mc,jx=_x(Ox);function Mx(e,t,n,r){for(var i=e.length,o=n+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function Nx(e){return e!==e}function Px(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Lx(e,t,n){return t===t?Px(e,t,n):Mx(e,Nx,n)}function Dx(e,t){var n=e==null?0:e.length;return!!n&&Lx(e,t,0)>-1}var $x=9007199254740991,Bx=/^(?:0|[1-9]\d*)$/;function dp(e,t){var n=typeof e;return t=t??$x,!!t&&(n=="number"||n!="symbol"&&Bx.test(e))&&e>-1&&e%1==0&&e<t}function hp(e,t){return e===t||e!==e&&t!==t}var zu=Math.max;function Hx(e,t,n){return t=zu(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=zu(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),kx(e,this,a)}}function zx(e,t){return jx(Hx(e,t,mc),e+"")}var Ux=9007199254740991;function xc(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ux}function fp(e){return e!=null&&xc(e.length)&&!up(e)}var Fx=Object.prototype;function qx(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Fx;return e===n}function Vx(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Wx="[object Arguments]";function Uu(e){return Bt(e)&&gn(e)==Wx}var pp=Object.prototype,Gx=pp.hasOwnProperty,Kx=pp.propertyIsEnumerable,yc=Uu((function(){return arguments})())?Uu:function(e){return Bt(e)&&Gx.call(e,"callee")&&!Kx.call(e,"callee")};function Yx(){return!1}var gp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fu=gp&&typeof module=="object"&&module&&!module.nodeType&&module,Xx=Fu&&Fu.exports===gp,qu=Xx?At.Buffer:void 0,Jx=qu?qu.isBuffer:void 0,kl=Jx||Yx,Zx="[object Arguments]",Qx="[object Array]",ey="[object Boolean]",ty="[object Date]",ny="[object Error]",ry="[object Function]",iy="[object Map]",oy="[object Number]",sy="[object Object]",ay="[object RegExp]",ly="[object Set]",cy="[object String]",uy="[object WeakMap]",dy="[object ArrayBuffer]",hy="[object DataView]",fy="[object Float32Array]",py="[object Float64Array]",gy="[object Int8Array]",my="[object Int16Array]",xy="[object Int32Array]",yy="[object Uint8Array]",vy="[object Uint8ClampedArray]",by="[object Uint16Array]",wy="[object Uint32Array]",me={};me[fy]=me[py]=me[gy]=me[my]=me[xy]=me[yy]=me[vy]=me[by]=me[wy]=!0;me[Zx]=me[Qx]=me[dy]=me[ey]=me[hy]=me[ty]=me[ny]=me[ry]=me[iy]=me[oy]=me[sy]=me[ay]=me[ly]=me[cy]=me[uy]=!1;function Sy(e){return Bt(e)&&xc(e.length)&&!!me[gn(e)]}function vc(e){return function(t){return e(t)}}var mp=typeof exports=="object"&&exports&&!exports.nodeType&&exports,br=mp&&typeof module=="object"&&module&&!module.nodeType&&module,Cy=br&&br.exports===mp,hs=Cy&&ap.process,Bi=(function(){try{var e=br&&br.require&&br.require("util").types;return e||hs&&hs.binding&&hs.binding("util")}catch{}})(),Vu=Bi&&Bi.isTypedArray,xp=Vu?vc(Vu):Sy,Ay=Object.prototype,ky=Ay.hasOwnProperty;function Ey(e,t){var n=Ct(e),r=!n&&yc(e),i=!n&&!r&&kl(e),o=!n&&!r&&!i&&xp(e),s=n||r||i||o,a=s?Vx(e.length,String):[],l=a.length;for(var c in e)ky.call(e,c)&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||dp(c,l)))&&a.push(c);return a}function Ty(e,t){return function(n){return e(t(n))}}var Iy=Ty(Object.keys,Object),_y=Object.prototype,Ry=_y.hasOwnProperty;function Oy(e){if(!qx(e))return Iy(e);var t=[];for(var n in Object(e))Ry.call(e,n)&&n!="constructor"&&t.push(n);return t}function yp(e){return fp(e)?Ey(e):Oy(e)}var jy=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,My=/^\w*$/;function bc(e,t){if(Ct(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||_o(e)?!0:My.test(e)||!jy.test(e)||t!=null&&e in Object(t)}var jr=Rn(Object,"create");function Ny(){this.__data__=jr?jr(null):{},this.size=0}function Py(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ly="__lodash_hash_undefined__",Dy=Object.prototype,$y=Dy.hasOwnProperty;function By(e){var t=this.__data__;if(jr){var n=t[e];return n===Ly?void 0:n}return $y.call(t,e)?t[e]:void 0}var Hy=Object.prototype,zy=Hy.hasOwnProperty;function Uy(e){var t=this.__data__;return jr?t[e]!==void 0:zy.call(t,e)}var Fy="__lodash_hash_undefined__";function qy(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=jr&&t===void 0?Fy:t,this}function Sn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Sn.prototype.clear=Ny;Sn.prototype.delete=Py;Sn.prototype.get=By;Sn.prototype.has=Uy;Sn.prototype.set=qy;function Vy(){this.__data__=[],this.size=0}function Ro(e,t){for(var n=e.length;n--;)if(hp(e[n][0],t))return n;return-1}var Wy=Array.prototype,Gy=Wy.splice;function Ky(e){var t=this.__data__,n=Ro(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Gy.call(t,n,1),--this.size,!0}function Yy(e){var t=this.__data__,n=Ro(t,e);return n<0?void 0:t[n][1]}function Xy(e){return Ro(this.__data__,e)>-1}function Jy(e,t){var n=this.__data__,r=Ro(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function zt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}zt.prototype.clear=Vy;zt.prototype.delete=Ky;zt.prototype.get=Yy;zt.prototype.has=Xy;zt.prototype.set=Jy;var Mr=Rn(At,"Map");function Zy(){this.size=0,this.__data__={hash:new Sn,map:new(Mr||zt),string:new Sn}}function Qy(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Oo(e,t){var n=e.__data__;return Qy(t)?n[typeof t=="string"?"string":"hash"]:n.map}function e1(e){var t=Oo(this,e).delete(e);return this.size-=t?1:0,t}function t1(e){return Oo(this,e).get(e)}function n1(e){return Oo(this,e).has(e)}function r1(e,t){var n=Oo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Ut(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ut.prototype.clear=Zy;Ut.prototype.delete=e1;Ut.prototype.get=t1;Ut.prototype.has=n1;Ut.prototype.set=r1;var i1="Expected a function";function wc(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(i1);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(wc.Cache||Ut),n}wc.Cache=Ut;var o1=500;function s1(e){var t=wc(e,function(r){return n.size===o1&&n.clear(),r}),n=t.cache;return t}var a1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l1=/\\(\\)?/g,c1=s1(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(a1,function(n,r,i,o){t.push(i?o.replace(l1,"$1"):r||n)}),t});function El(e){return e==null?"":$i(e)}function vp(e,t){return Ct(e)?e:bc(e,t)?[e]:c1(El(e))}function jo(e){if(typeof e=="string"||_o(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function bp(e,t){t=vp(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[jo(t[n++])];return n&&n==r?e:void 0}function u1(e,t,n){var r=e==null?void 0:bp(e,t);return r===void 0?n:r}function wp(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Wu=St?St.isConcatSpreadable:void 0;function d1(e){return Ct(e)||yc(e)||!!(Wu&&e&&e[Wu])}function h1(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=d1),i||(i=[]);++o<s;){var a=e[o];n(a)&&wp(i,a)}return i}function f1(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}function p1(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:f1(e,t,n)}var g1="\\ud800-\\udfff",m1="\\u0300-\\u036f",x1="\\ufe20-\\ufe2f",y1="\\u20d0-\\u20ff",v1=m1+x1+y1,b1="\\ufe0e\\ufe0f",w1="\\u200d",S1=RegExp("["+w1+g1+v1+b1+"]");function Sc(e){return S1.test(e)}function C1(e){return e.split("")}var Sp="\\ud800-\\udfff",A1="\\u0300-\\u036f",k1="\\ufe20-\\ufe2f",E1="\\u20d0-\\u20ff",T1=A1+k1+E1,I1="\\ufe0e\\ufe0f",_1="["+Sp+"]",Tl="["+T1+"]",Il="\\ud83c[\\udffb-\\udfff]",R1="(?:"+Tl+"|"+Il+")",Cp="[^"+Sp+"]",Ap="(?:\\ud83c[\\udde6-\\uddff]){2}",kp="[\\ud800-\\udbff][\\udc00-\\udfff]",O1="\\u200d",Ep=R1+"?",Tp="["+I1+"]?",j1="(?:"+O1+"(?:"+[Cp,Ap,kp].join("|")+")"+Tp+Ep+")*",M1=Tp+Ep+j1,N1="(?:"+[Cp+Tl+"?",Tl,Ap,kp,_1].join("|")+")",P1=RegExp(Il+"(?="+Il+")|"+N1+M1,"g");function L1(e){return e.match(P1)||[]}function D1(e){return Sc(e)?L1(e):C1(e)}function $1(e,t,n){return e===e&&(n!==void 0&&(e=e<=n?e:n),t!==void 0&&(e=e>=t?e:t)),e}function Ip(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=zn(n),n=n===n?n:0),t!==void 0&&(t=zn(t),t=t===t?t:0),$1(zn(e),t,n)}function B1(){this.__data__=new zt,this.size=0}function H1(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function z1(e){return this.__data__.get(e)}function U1(e){return this.__data__.has(e)}var F1=200;function q1(e,t){var n=this.__data__;if(n instanceof zt){var r=n.__data__;if(!Mr||r.length<F1-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ut(r)}return n.set(e,t),this.size=n.size,this}function Lt(e){var t=this.__data__=new zt(e);this.size=t.size}Lt.prototype.clear=B1;Lt.prototype.delete=H1;Lt.prototype.get=z1;Lt.prototype.has=U1;Lt.prototype.set=q1;function V1(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function W1(){return[]}var G1=Object.prototype,K1=G1.propertyIsEnumerable,Gu=Object.getOwnPropertySymbols,Y1=Gu?function(e){return e==null?[]:(e=Object(e),V1(Gu(e),function(t){return K1.call(e,t)}))}:W1;function X1(e,t,n){var r=t(e);return Ct(e)?r:wp(r,n(e))}function Ku(e){return X1(e,yp,Y1)}var _l=Rn(At,"DataView"),Rl=Rn(At,"Promise"),Ol=Rn(At,"Set"),Yu="[object Map]",J1="[object Object]",Xu="[object Promise]",Ju="[object Set]",Zu="[object WeakMap]",Qu="[object DataView]",Z1=_n(_l),Q1=_n(Mr),ev=_n(Rl),tv=_n(Ol),nv=_n(Al),nn=gn;(_l&&nn(new _l(new ArrayBuffer(1)))!=Qu||Mr&&nn(new Mr)!=Yu||Rl&&nn(Rl.resolve())!=Xu||Ol&&nn(new Ol)!=Ju||Al&&nn(new Al)!=Zu)&&(nn=function(e){var t=gn(e),n=t==J1?e.constructor:void 0,r=n?_n(n):"";if(r)switch(r){case Z1:return Qu;case Q1:return Yu;case ev:return Xu;case tv:return Ju;case nv:return Zu}return t});var ed=At.Uint8Array,rv="__lodash_hash_undefined__";function iv(e){return this.__data__.set(e,rv),this}function ov(e){return this.__data__.has(e)}function Nr(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Ut;++t<n;)this.add(e[t])}Nr.prototype.add=Nr.prototype.push=iv;Nr.prototype.has=ov;function sv(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function _p(e,t){return e.has(t)}var av=1,lv=2;function Rp(e,t,n,r,i,o){var s=n&av,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),d=o.get(t);if(c&&d)return c==t&&d==e;var u=-1,h=!0,p=n&lv?new Nr:void 0;for(o.set(e,t),o.set(t,e);++u<a;){var g=e[u],m=t[u];if(r)var x=s?r(m,g,u,t,e,o):r(g,m,u,e,t,o);if(x!==void 0){if(x)continue;h=!1;break}if(p){if(!sv(t,function(y,w){if(!_p(p,w)&&(g===y||i(g,y,n,r,o)))return p.push(w)})){h=!1;break}}else if(!(g===m||i(g,m,n,r,o))){h=!1;break}}return o.delete(e),o.delete(t),h}function cv(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function uv(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var dv=1,hv=2,fv="[object Boolean]",pv="[object Date]",gv="[object Error]",mv="[object Map]",xv="[object Number]",yv="[object RegExp]",vv="[object Set]",bv="[object String]",wv="[object Symbol]",Sv="[object ArrayBuffer]",Cv="[object DataView]",td=St?St.prototype:void 0,fs=td?td.valueOf:void 0;function Av(e,t,n,r,i,o,s){switch(n){case Cv:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Sv:return!(e.byteLength!=t.byteLength||!o(new ed(e),new ed(t)));case fv:case pv:case xv:return hp(+e,+t);case gv:return e.name==t.name&&e.message==t.message;case yv:case bv:return e==t+"";case mv:var a=cv;case vv:var l=r&dv;if(a||(a=uv),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=hv,s.set(e,t);var d=Rp(a(e),a(t),r,i,o,s);return s.delete(e),d;case wv:if(fs)return fs.call(e)==fs.call(t)}return!1}var kv=1,Ev=Object.prototype,Tv=Ev.hasOwnProperty;function Iv(e,t,n,r,i,o){var s=n&kv,a=Ku(e),l=a.length,c=Ku(t),d=c.length;if(l!=d&&!s)return!1;for(var u=l;u--;){var h=a[u];if(!(s?h in t:Tv.call(t,h)))return!1}var p=o.get(e),g=o.get(t);if(p&&g)return p==t&&g==e;var m=!0;o.set(e,t),o.set(t,e);for(var x=s;++u<l;){h=a[u];var y=e[h],w=t[h];if(r)var A=s?r(w,y,h,t,e,o):r(y,w,h,e,t,o);if(!(A===void 0?y===w||i(y,w,n,r,o):A)){m=!1;break}x||(x=h=="constructor")}if(m&&!x){var I=e.constructor,E=t.constructor;I!=E&&"constructor"in e&&"constructor"in t&&!(typeof I=="function"&&I instanceof I&&typeof E=="function"&&E instanceof E)&&(m=!1)}return o.delete(e),o.delete(t),m}var _v=1,nd="[object Arguments]",rd="[object Array]",ci="[object Object]",Rv=Object.prototype,id=Rv.hasOwnProperty;function Ov(e,t,n,r,i,o){var s=Ct(e),a=Ct(t),l=s?rd:nn(e),c=a?rd:nn(t);l=l==nd?ci:l,c=c==nd?ci:c;var d=l==ci,u=c==ci,h=l==c;if(h&&kl(e)){if(!kl(t))return!1;s=!0,d=!1}if(h&&!d)return o||(o=new Lt),s||xp(e)?Rp(e,t,n,r,i,o):Av(e,t,l,n,r,i,o);if(!(n&_v)){var p=d&&id.call(e,"__wrapped__"),g=u&&id.call(t,"__wrapped__");if(p||g){var m=p?e.value():e,x=g?t.value():t;return o||(o=new Lt),i(m,x,n,r,o)}}return h?(o||(o=new Lt),Iv(e,t,n,r,i,o)):!1}function Cc(e,t,n,r,i){return e===t?!0:e==null||t==null||!Bt(e)&&!Bt(t)?e!==e&&t!==t:Ov(e,t,n,r,Cc,i)}var jv=1,Mv=2;function Nv(e,t,n,r){var i=n.length,o=i;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var a=s[0],l=e[a],c=s[1];if(s[2]){if(l===void 0&&!(a in e))return!1}else{var d=new Lt,u;if(!(u===void 0?Cc(c,l,jv|Mv,r,d):u))return!1}}return!0}function Op(e){return e===e&&!cn(e)}function Pv(e){for(var t=yp(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Op(i)]}return t}function jp(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Lv(e){var t=Pv(e);return t.length==1&&t[0][2]?jp(t[0][0],t[0][1]):function(n){return n===e||Nv(n,e,t)}}function Dv(e,t){return e!=null&&t in Object(e)}function $v(e,t,n){t=vp(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=jo(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&xc(i)&&dp(s,i)&&(Ct(e)||yc(e)))}function Bv(e,t){return e!=null&&$v(e,t,Dv)}var Hv=1,zv=2;function Uv(e,t){return bc(e)&&Op(t)?jp(jo(e),t):function(n){var r=u1(n,e);return r===void 0&&r===t?Bv(n,e):Cc(t,r,Hv|zv)}}function Mp(e){return function(t){return t==null?void 0:t[e]}}function Fv(e){return function(t){return bp(t,e)}}function qv(e){return bc(e)?Mp(jo(e)):Fv(e)}function Vv(e){return typeof e=="function"?e:e==null?mc:typeof e=="object"?Ct(e)?Uv(e[0],e[1]):Lv(e):qv(e)}var ps=function(){return At.Date.now()},Wv="Expected a function",Gv=Math.max,Kv=Math.min;function Mo(e,t,n){var r,i,o,s,a,l,c=0,d=!1,u=!1,h=!0;if(typeof e!="function")throw new TypeError(Wv);t=zn(t)||0,cn(n)&&(d=!!n.leading,u="maxWait"in n,o=u?Gv(zn(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h);function p(M){var T=r,_=i;return r=i=void 0,c=M,s=e.apply(_,T),s}function g(M){return c=M,a=setTimeout(y,t),d?p(M):s}function m(M){var T=M-l,_=M-c,R=t-T;return u?Kv(R,o-_):R}function x(M){var T=M-l,_=M-c;return l===void 0||T>=t||T<0||u&&_>=o}function y(){var M=ps();if(x(M))return w(M);a=setTimeout(y,m(M))}function w(M){return a=void 0,h&&r?p(M):(r=i=void 0,s)}function A(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function I(){return a===void 0?s:w(ps())}function E(){var M=ps(),T=x(M);if(r=arguments,i=this,l=M,T){if(a===void 0)return g(l);if(u)return clearTimeout(a),a=setTimeout(y,t),p(l)}return a===void 0&&(a=setTimeout(y,t)),s}return E.cancel=A,E.flush=I,E}function gs(e){return Bt(e)&&fp(e)}var Yv=200;function Xv(e,t,n,r){var i=-1,o=Dx,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=cp(t,vc(n))),t.length>=Yv&&(o=_p,s=!1,t=new Nr(t));e:for(;++i<a;){var d=e[i],u=n==null?d:n(d);if(d=d!==0?d:0,s&&u===u){for(var h=c;h--;)if(t[h]===u)continue e;l.push(d)}else o(t,u,r)||l.push(d)}return l}function Jv(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Zv=zx(function(e,t){var n=Jv(t);return gs(n)&&(n=void 0),gs(e)?Xv(e,h1(t,1,gs),Vv(n)):[]}),Qv="[object Number]";function Hi(e){return typeof e=="number"||Bt(e)&&gn(e)==Qv}var eb="[object RegExp]";function tb(e){return Bt(e)&&gn(e)==eb}var od=Bi&&Bi.isRegExp,nb=od?vc(od):tb,rb=Mp("length"),Np="\\ud800-\\udfff",ib="\\u0300-\\u036f",ob="\\ufe20-\\ufe2f",sb="\\u20d0-\\u20ff",ab=ib+ob+sb,lb="\\ufe0e\\ufe0f",cb="["+Np+"]",jl="["+ab+"]",Ml="\\ud83c[\\udffb-\\udfff]",ub="(?:"+jl+"|"+Ml+")",Pp="[^"+Np+"]",Lp="(?:\\ud83c[\\udde6-\\uddff]){2}",Dp="[\\ud800-\\udbff][\\udc00-\\udfff]",db="\\u200d",$p=ub+"?",Bp="["+lb+"]?",hb="(?:"+db+"(?:"+[Pp,Lp,Dp].join("|")+")"+Bp+$p+")*",fb=Bp+$p+hb,pb="(?:"+[Pp+jl+"?",jl,Lp,Dp,cb].join("|")+")",sd=RegExp(Ml+"(?="+Ml+")|"+pb+fb,"g");function gb(e){for(var t=sd.lastIndex=0;sd.test(e);)++t;return t}function mb(e){return Sc(e)?gb(e):rb(e)}var xb="Expected a function";function Kn(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(xb);return cn(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Mo(e,t,{leading:r,maxWait:t,trailing:i})}var yb=30,vb="...",bb=/\w*$/;function wb(e,t){var n=yb,r=vb;if(cn(t)){var i="separator"in t?t.separator:i;n="length"in t?lx(t.length):n,r="omission"in t?$i(t.omission):r}e=El(e);var o=e.length;if(Sc(e)){var s=D1(e);o=s.length}if(n>=o)return e;var a=n-mb(r);if(a<1)return r;var l=s?p1(s,0,a).join(""):e.slice(0,a);if(i===void 0)return l+r;if(s&&(a+=l.length-a),nb(i)){if(e.slice(a).search(i)){var c,d=l;for(i.global||(i=RegExp(i.source,El(bb.exec(i))+"g")),i.lastIndex=0;c=i.exec(d);)var u=c.index;l=l.slice(0,u===void 0?a:u)}}else if(e.indexOf($i(i),a)!=a){var h=l.lastIndexOf(i);h>-1&&(l=l.slice(0,h))}return l+r}const Ac="-",Sb=e=>{const t=Ab(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(Ac);return a[0]===""&&a.length!==1&&a.shift(),Hp(a,t)||Cb(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},Hp=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?Hp(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Ac);return(s=t.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId},ad=/^\[(.+)\]$/,Cb=e=>{if(ad.test(e)){const t=ad.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Ab=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Eb(Object.entries(e.classGroups),n).forEach(([o,s])=>{Nl(s,r,o,t)}),r},Nl=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:ld(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(kb(i)){Nl(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{Nl(s,ld(t,o),n,r)})})},ld=(e,t)=>{let n=e;return t.split(Ac).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},kb=e=>e.isThemeGetter,Eb=(e,t)=>t?e.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[t+s,a])):o);return[n,i]}):e,Tb=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},zp="!",Ib=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],o=t.length,s=a=>{const l=[];let c=0,d=0,u;for(let x=0;x<a.length;x++){let y=a[x];if(c===0){if(y===i&&(r||a.slice(x,x+o)===t)){l.push(a.slice(d,x)),d=x+o;continue}if(y==="/"){u=x;continue}}y==="["?c++:y==="]"&&c--}const h=l.length===0?a:a.substring(d),p=h.startsWith(zp),g=p?h.substring(1):h,m=u&&u>d?u-d:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?a=>n({className:a,parseClassName:s}):s},_b=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Rb=e=>({cache:Tb(e.cacheSize),parseClassName:Ib(e),...Sb(e)}),Ob=/\s+/,jb=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=[],s=e.trim().split(Ob);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:p}=n(c);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){a=c+(a.length>0?" "+a:a);continue}if(m=r(h),!m){a=c+(a.length>0?" "+a:a);continue}g=!1}const x=_b(d).join(":"),y=u?x+zp:x,w=y+m;if(o.includes(w))continue;o.push(w);const A=i(m,g);for(let I=0;I<A.length;++I){const E=A[I];o.push(y+E)}a=c+(a.length>0?" "+a:a)}return a};function Mb(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Up(t))&&(r&&(r+=" "),r+=n);return r}const Up=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Up(e[r]))&&(n&&(n+=" "),n+=t);return n};function Nb(e,...t){let n,r,i,o=s;function s(l){const c=t.reduce((d,u)=>u(d),e());return n=Rb(c),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=jb(l,n);return i(l,d),d}return function(){return o(Mb.apply(null,arguments))}}const ge=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Fp=/^\[(?:([a-z-]+):)?(.+)\]$/i,Pb=/^\d+\/\d+$/,Lb=new Set(["px","full","screen"]),Db=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$b=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Bb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Hb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rt=e=>Un(e)||Lb.has(e)||Pb.test(e),Zt=e=>er(e,"length",Yb),Un=e=>!!e&&!Number.isNaN(Number(e)),ms=e=>er(e,"number",Un),pr=e=>!!e&&Number.isInteger(Number(e)),Ub=e=>e.endsWith("%")&&Un(e.slice(0,-1)),Y=e=>Fp.test(e),Qt=e=>Db.test(e),Fb=new Set(["length","size","percentage"]),qb=e=>er(e,Fb,qp),Vb=e=>er(e,"position",qp),Wb=new Set(["image","url"]),Gb=e=>er(e,Wb,Jb),Kb=e=>er(e,"",Xb),gr=()=>!0,er=(e,t,n)=>{const r=Fp.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Yb=e=>$b.test(e)&&!Bb.test(e),qp=()=>!1,Xb=e=>Hb.test(e),Jb=e=>zb.test(e),Zb=()=>{const e=ge("colors"),t=ge("spacing"),n=ge("blur"),r=ge("brightness"),i=ge("borderColor"),o=ge("borderRadius"),s=ge("borderSpacing"),a=ge("borderWidth"),l=ge("contrast"),c=ge("grayscale"),d=ge("hueRotate"),u=ge("invert"),h=ge("gap"),p=ge("gradientColorStops"),g=ge("gradientColorStopPositions"),m=ge("inset"),x=ge("margin"),y=ge("opacity"),w=ge("padding"),A=ge("saturate"),I=ge("scale"),E=ge("sepia"),M=ge("skew"),T=ge("space"),_=ge("translate"),R=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",Y,t],k=()=>[Y,t],O=()=>["",Rt,Zt],B=()=>["auto",Un,Y],q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],te=()=>["","0",Y],He=()=>["auto","avoid","all","avoid-page","page","left","right","column"],je=()=>[Un,Y];return{cacheSize:500,separator:":",theme:{colors:[gr],spacing:[Rt,Zt],blur:["none","",Qt,Y],brightness:je(),borderColor:[e],borderRadius:["none","","full",Qt,Y],borderSpacing:k(),borderWidth:O(),contrast:je(),grayscale:te(),hueRotate:je(),invert:te(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[Ub,Zt],inset:P(),margin:P(),opacity:je(),padding:k(),saturate:je(),scale:je(),sepia:te(),skew:je(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",Y]}],container:["container"],columns:[{columns:[Qt]}],"break-after":[{"break-after":He()}],"break-before":[{"break-before":He()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...q(),Y]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",pr,Y]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Y]}],grow:[{grow:te()}],shrink:[{shrink:te()}],order:[{order:["first","last","none",pr,Y]}],"grid-cols":[{"grid-cols":[gr]}],"col-start-end":[{col:["auto",{span:["full",pr,Y]},Y]}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":[gr]}],"row-start-end":[{row:["auto",{span:[pr,Y]},Y]}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Y]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Y]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Y,t]}],"min-w":[{"min-w":[Y,t,"min","max","fit"]}],"max-w":[{"max-w":[Y,t,"none","full","min","max","fit","prose",{screen:[Qt]},Qt]}],h:[{h:[Y,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Y,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Y,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Y,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Qt,Zt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ms]}],"font-family":[{font:[gr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Y]}],"line-clamp":[{"line-clamp":["none",Un,ms]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Rt,Y]}],"list-image":[{"list-image":["none",Y]}],"list-style-type":[{list:["none","disc","decimal",Y]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Rt,Zt]}],"underline-offset":[{"underline-offset":["auto",Rt,Y]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Y]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Y]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...q(),Vb]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",qb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Gb]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:U()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[Rt,Y]}],"outline-w":[{outline:[Rt,Zt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Rt,Zt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Qt,Kb]}],"shadow-color":[{shadow:[gr]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Qt,Y]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[u]}],saturate:[{saturate:[A]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Y]}],duration:[{duration:je()}],ease:[{ease:["linear","in","out","in-out",Y]}],delay:[{delay:je()}],animate:[{animate:["none","spin","ping","pulse","bounce",Y]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[I]}],"scale-x":[{"scale-x":[I]}],"scale-y":[{"scale-y":[I]}],rotate:[{rotate:[pr,Y]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[M]}],"skew-y":[{"skew-y":[M]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Y]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Y]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Y]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Rt,Zt,ms]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Qb=Nb(Zb);function ie(...e){return Qb(re.clsx(e))}let xs;function ys(){return xs===void 0&&(xs=navigator.platform.includes("Mac")),xs}function Vp(e){return`${e}`.toLowerCase()==="mod"?ys()?"⌘":"Ctrl":`${e}`.toLowerCase()==="alt"?ys()?"⌥":"Alt":`${e}`.toLowerCase()==="shift"?ys()?"⇧":"Shift":e}function Wp(e){return e.map(Vp).join(" ")}const V=C.forwardRef((e,t)=>{const{icon:n=void 0,tooltip:r=void 0,disabled:i=!1,customClass:o="",loading:s=void 0,shortcutKeys:a=void 0,tooltipOptions:l={},action:c=void 0,isActive:d=void 0,children:u,asChild:h=!1,upload:p=!1,initialDisplayedColor:g=void 0,...m}=e,x=qc[n],y=h?tp.Slot:uu;return f.jsxs(du,{children:[f.jsx(hu,{asChild:!0,children:f.jsxs(y,{"data-state":d!=null&&d()?"on":"off",onClick:c,ref:t,size:"sm",className:ie("richtext-w-[32px] richtext-h-[32px]",o),disabled:i,...m,children:[x&&f.jsx(x,{className:"richtext-size-4"}),u]})}),r&&f.jsx(Jo,{...l,children:f.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[f.jsx("div",{children:r}),!!(a!=null&&a.length)&&f.jsx("span",{children:Wp(a)})]})})]})});function ew(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`image-${r}`,component:V,componentProps:{tooltip:z.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateImage({width:z.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:z.IMAGE_SIZE[r]})}}))}function tw(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`image-${r}`,component:V,componentProps:{tooltip:z.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateImageGif({width:z.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:z.IMAGE_SIZE[r]})}}))}function nw(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:V,componentProps:{tooltip:z.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,o;return(o=(i=e.commands)==null?void 0:i.setAlignImage)==null?void 0:o.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function rw(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:V,componentProps:{tooltip:z.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,o;return(o=(i=e.commands)==null?void 0:i.setAlignImageGif)==null?void 0:o.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function iw(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:V,componentProps:{tooltip:z.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,o;return(o=(i=e.commands)==null?void 0:i.setAlignImageMermaid)==null?void 0:o.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ow(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:V,componentProps:{tooltip:z.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,o;return(o=(i=e.commands)==null?void 0:i.setAlignImageDrawer)==null?void 0:o.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function sw(e){return[{type:"flex-start",icon:"AlignLeft",tooltip:"Align left"},{type:"center",icon:"AlignCenter",tooltip:"Align center"},{type:"flex-end",icon:"AlignRight",tooltip:"Align right"}].map(n=>({type:`video-align-${n.type}`,component:V,componentProps:{tooltip:n.tooltip,icon:n.icon,action:()=>e.commands.updateVideo({align:n.type}),isActive:()=>e.getAttributes("video").align===n.type}}))}function aw(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`video-${r}`,component:V,componentProps:{tooltip:z.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateVideo({width:z.VIDEO_SIZE[r]}),isActive:()=>e.isActive("video",{width:z.VIDEO_SIZE[r]})}}))}function lw(e){return[{type:"flipX",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const t=e.getAttributes("image"),{flipX:n}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!n}).run()}}},{type:"flipY",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const t=e.getAttributes("image"),{flipY:n}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!n}).run()}}},...ew(e),...nw(e),{type:"remove",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;v.deleteSelection(t,n)}}}]}function cw(e){return[...tw(e),...rw(e),{type:"remove",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;v.deleteSelection(t,n)}}}]}function uw(e){return[...iw(e),{type:"edit",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;v.deleteSelection(t,n)}}}]}function dw(e){return[...ow(e),{type:"edit",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.edit"),icon:"Pencil",action:()=>(console.log("AAA"),!0)}},{type:"remove",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;v.deleteSelection(t,n)}}}]}function hw(e){return[...aw(e),...sw(e),{type:"remove",component:V,componentProps:{editor:e,tooltip:z.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;v.deleteSelection(t,n)}}}]}function fw(e,t){return z.BUBBLE_TEXT_LIST.reduce((n,r)=>{if(r==="divider"&&n.length>0)return[...n,{type:"divider",component:void 0,componentProps:{}}];const i=e.extensionManager.extensions.find(o=>o.name===r);return i&&i.configure().options.button?[...n,i.configure().options.button({editor:e,t,extension:i})]:n},[])}const lt=()=>new Map,Pl=e=>{const t=lt();return e.forEach((n,r)=>{t.set(r,n)}),t},Ft=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},pw=(e,t)=>{const n=[];for(const[r,i]of e)n.push(t(i,r));return n},gw=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Cn=()=>new Set,vs=e=>e[e.length-1],mw=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},An=Array.from,xw=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},Ll=Array.isArray;class Gp{constructor(){this._observers=lt()}on(t,n){return Ft(this._observers,t,Cn).add(n),n}once(t,n){const r=(...i)=>{this.off(t,r),n(...i)};this.on(t,r)}off(t,n){const r=this._observers.get(t);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(t))}emit(t,n){return An((this._observers.get(t)||lt()).values()).forEach(r=>r(...n))}destroy(){this._observers=lt()}}const Ht=Math.floor,Ti=Math.abs,Yn=(e,t)=>e<t?e:t,un=(e,t)=>e>t?e:t,Kp=e=>e!==0?e<0:1/e<0,cd=1,ud=2,bs=4,ws=8,Pr=32,Dt=64,Be=128,yw=1<<29,No=31,Dl=63,wn=127,vw=2147483647,Yp=Number.MAX_SAFE_INTEGER,bw=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ht(e)===e),ww=String.fromCharCode,Sw=e=>e.toLowerCase(),Cw=/^\s*/g,Aw=e=>e.replace(Cw,""),kw=/([A-Z])/g,dd=(e,t)=>Aw(e.replace(kw,n=>`${t}${Sw(n)}`)),Ew=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=t.codePointAt(i);return r},Lr=typeof TextEncoder<"u"?new TextEncoder:null,Tw=e=>Lr.encode(e),Iw=Lr?Tw:Ew;let wr=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});wr&&wr.decode(new Uint8Array).length===1&&(wr=null);class Jr{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Zr=()=>new Jr,_w=e=>{const t=Zr();return e(t),at(t)},Rw=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},at=e=>{const t=new Uint8Array(Rw(e));let n=0;for(let r=0;r<e.bufs.length;r++){const i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},Ow=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(un(n,t)*2),e.cpos=0)},_e=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},$l=_e,se=(e,t)=>{for(;t>wn;)_e(e,Be|wn&t),t=Ht(t/128);_e(e,wn&t)},kc=(e,t)=>{const n=Kp(t);for(n&&(t=-t),_e(e,(t>Dl?Be:0)|(n?Dt:0)|Dl&t),t=Ht(t/64);t>0;)_e(e,(t>wn?Be:0)|wn&t),t=Ht(t/128)},Bl=new Uint8Array(3e4),jw=Bl.length/3,Mw=(e,t)=>{if(t.length<jw){const n=Lr.encodeInto(t,Bl).written||0;se(e,n);for(let r=0;r<n;r++)_e(e,Bl[r])}else Ke(e,Iw(t))},Nw=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;se(e,r);for(let i=0;i<r;i++)_e(e,n.codePointAt(i))},Fn=Lr&&Lr.encodeInto?Mw:Nw,Po=(e,t)=>{const n=e.cbuf.length,r=e.cpos,i=Yn(n-r,t.length),o=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,o>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(un(n*2,o)),e.cbuf.set(t.subarray(i)),e.cpos=o)},Ke=(e,t)=>{se(e,t.byteLength),Po(e,t)},Ec=(e,t)=>{Ow(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Pw=(e,t)=>Ec(e,4).setFloat32(0,t,!1),Lw=(e,t)=>Ec(e,8).setFloat64(0,t,!1),Dw=(e,t)=>Ec(e,8).setBigInt64(0,t,!1),hd=new DataView(new ArrayBuffer(4)),$w=e=>(hd.setFloat32(0,e),hd.getFloat32(0)===e),Xn=(e,t)=>{switch(typeof t){case"string":_e(e,119),Fn(e,t);break;case"number":bw(t)&&Ti(t)<=vw?(_e(e,125),kc(e,t)):$w(t)?(_e(e,124),Pw(e,t)):(_e(e,123),Lw(e,t));break;case"bigint":_e(e,122),Dw(e,t);break;case"object":if(t===null)_e(e,126);else if(Ll(t)){_e(e,117),se(e,t.length);for(let n=0;n<t.length;n++)Xn(e,t[n])}else if(t instanceof Uint8Array)_e(e,116),Ke(e,t);else{_e(e,118);const n=Object.keys(t);se(e,n.length);for(let r=0;r<n.length;r++){const i=n[r];Fn(e,i),Xn(e,t[i])}}break;case"boolean":_e(e,t?120:121);break;default:_e(e,127)}};class fd extends Jr{constructor(t){super(),this.w=t,this.s=null,this.count=0}write(t){this.s===t?this.count++:(this.count>0&&se(this,this.count-1),this.count=1,this.w(this,t),this.s=t)}}const pd=e=>{e.count>0&&(kc(e.encoder,e.count===1?e.s:-e.s),e.count>1&&se(e.encoder,e.count-2))};class Ii{constructor(){this.encoder=new Jr,this.s=0,this.count=0}write(t){this.s===t?this.count++:(pd(this),this.count=1,this.s=t)}toUint8Array(){return pd(this),at(this.encoder)}}const gd=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);kc(e.encoder,t),e.count>1&&se(e.encoder,e.count-2)}};class Ss{constructor(){this.encoder=new Jr,this.s=0,this.count=0,this.diff=0}write(t){this.diff===t-this.s?(this.s=t,this.count++):(gd(this),this.count=1,this.diff=t-this.s,this.s=t)}toUint8Array(){return gd(this),at(this.encoder)}}class Bw{constructor(){this.sarr=[],this.s="",this.lensE=new Ii}write(t){this.s+=t,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(t.length)}toUint8Array(){const t=new Jr;return this.sarr.push(this.s),this.s="",Fn(t,this.sarr.join("")),Po(t,this.lensE.toUint8Array()),at(t)}}const dn=e=>new Error(e),ct=()=>{throw dn("Method unimplemented")},We=()=>{throw dn("Unexpected case")},Xp=dn("Unexpected end of array"),Jp=dn("Integer out of Range");class Lo{constructor(t){this.arr=t,this.pos=0}}const Tc=e=>new Lo(e),Hw=e=>e.pos!==e.arr.length,zw=(e,t)=>{const n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},Ze=e=>zw(e,ye(e)),Dr=e=>e.arr[e.pos++],ye=e=>{let t=0,n=1;const r=e.arr.length;for(;e.pos<r;){const i=e.arr[e.pos++];if(t=t+(i&wn)*n,n*=128,i<Be)return t;if(t>Yp)throw Jp}throw Xp},Ic=e=>{let t=e.arr[e.pos++],n=t&Dl,r=64;const i=(t&Dt)>0?-1:1;if((t&Be)===0)return i*n;const o=e.arr.length;for(;e.pos<o;){if(t=e.arr[e.pos++],n=n+(t&wn)*r,r*=128,t<Be)return i*n;if(n>Yp)throw Jp}throw Xp},Uw=e=>{let t=ye(e);if(t===0)return"";{let n=String.fromCodePoint(Dr(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Dr(e));else for(;t>0;){const r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Fw=e=>wr.decode(Ze(e)),Hl=wr?Fw:Uw,_c=(e,t)=>{const n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},qw=e=>_c(e,4).getFloat32(0,!1),Vw=e=>_c(e,8).getFloat64(0,!1),Ww=e=>_c(e,8).getBigInt64(0,!1),Gw=[e=>{},e=>null,Ic,qw,Vw,Ww,e=>!1,e=>!0,Hl,e=>{const t=ye(e),n={};for(let r=0;r<t;r++){const i=Hl(e);n[i]=zi(e)}return n},e=>{const t=ye(e),n=[];for(let r=0;r<t;r++)n.push(zi(e));return n},Ze],zi=e=>Gw[127-Dr(e)](e);class md extends Lo{constructor(t,n){super(t),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Hw(this)?this.count=ye(this)+1:this.count=-1),this.count--,this.s}}class _i extends Lo{constructor(t){super(t),this.s=0,this.count=0}read(){if(this.count===0){this.s=Ic(this);const t=Kp(this.s);this.count=1,t&&(this.s=-this.s,this.count=ye(this)+2)}return this.count--,this.s}}class Cs extends Lo{constructor(t){super(t),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const t=Ic(this),n=t&1;this.diff=Ht(t/2),this.count=1,n&&(this.count=ye(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Kw{constructor(t){this.decoder=new _i(t),this.str=Hl(this.decoder),this.spos=0}read(){const t=this.spos+this.decoder.read(),n=this.str.slice(this.spos,t);return this.spos=t,n}}const Yw=crypto.getRandomValues.bind(crypto),Xw=Math.random,Zp=()=>Yw(new Uint32Array(1))[0],Jw=e=>e[Ht(Xw()*e.length)],Zw="10000000-1000-4000-8000"+-1e11,Qw=()=>Zw.replace(/[018]/g,e=>(e^Zp()&15>>e/4).toString(16)),eS=Date.now,xd=e=>new Promise(e);Promise.all.bind(Promise);const yd=e=>e===void 0?null:e;class tS{constructor(){this.map=new Map}setItem(t,n){this.map.set(t,n)}getItem(t){return this.map.get(t)}}let Qp=new tS,nS=!0;try{typeof localStorage<"u"&&localStorage&&(Qp=localStorage,nS=!1)}catch{}const rS=Qp,iS=Object.assign,eg=Object.keys,oS=(e,t)=>{for(const n in e)t(e[n],n)},vd=e=>eg(e).length,sS=e=>{for(const t in e)return!1;return!0},tg=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},aS=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),lS=(e,t)=>e===t||vd(e)===vd(t)&&tg(e,(n,r)=>(n!==void 0||aS(t,r))&&t[r]===n),cS=Object.freeze,ng=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&ng(e[t])}return cS(e)},Rc=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Rc(e,t,n+1)}},uS=(e,t)=>t.includes(e),Jn=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",rg=typeof window<"u"&&typeof document<"u"&&!Jn;let mt;const dS=()=>{if(mt===void 0)if(Jn){mt=lt();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&mt.set(t,""),t=r):t!==null&&(mt.set(t,r),t=null)}t!==null&&mt.set(t,"")}else typeof location=="object"?(mt=lt(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");mt.set(`--${dd(t,"-")}`,n),mt.set(`-${dd(t,"-")}`,n)}})):mt=lt();return mt},zl=e=>dS().has(e),Ui=e=>yd(Jn?process.env[e.toUpperCase().replaceAll("-","_")]:rS.getItem(e)),ig=e=>zl("--"+e)||Ui(e)!==null;ig("production");const hS=Jn&&uS(process.env.FORCE_COLOR,["true","1","2"]),fS=hS||!zl("--no-colors")&&!ig("no-color")&&(!Jn||process.stdout.isTTY)&&(!Jn||zl("--color")||Ui("COLORTERM")!==null||(Ui("TERM")||"").includes("color")),pS=e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=ww(e[n]);return btoa(t)},gS=e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"),mS=rg?pS:gS,xS=e=>_w(t=>Xn(t,e));class yS{constructor(t,n){this.left=t,this.right=n}}const Ot=(e,t)=>new yS(e,t),vS=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const bS=e=>pw(e,(t,n)=>`${n}:${t};`).join(""),wS=e=>class{constructor(n){this._=n}destroy(){e(this._)}},SS=wS(clearTimeout),og=(e,t)=>new SS(setTimeout(t,e)),qt=Symbol,sg=qt(),ag=qt(),CS=qt(),AS=qt(),kS=qt(),lg=qt(),ES=qt(),Oc=qt(),TS=qt(),IS=e=>{var i;e.length===1&&((i=e[0])==null?void 0:i.constructor)===Function&&(e=e[0]());const t=[],n=[];let r=0;for(;r<e.length;r++){const o=e[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)t.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){const o=e[r];o instanceof Symbol||n.push(o)}return n},_S={[sg]:Ot("font-weight","bold"),[ag]:Ot("font-weight","normal"),[CS]:Ot("color","blue"),[kS]:Ot("color","green"),[AS]:Ot("color","grey"),[lg]:Ot("color","red"),[ES]:Ot("color","purple"),[Oc]:Ot("color","orange"),[TS]:Ot("color","black")},RS=e=>{var s;e.length===1&&((s=e[0])==null?void 0:s.constructor)===Function&&(e=e[0]());const t=[],n=[],r=lt();let i=[],o=0;for(;o<e.length;o++){const a=e[o],l=_S[a];if(l!==void 0)r.set(l.left,l.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const c=bS(r);o>0||c.length>0?(t.push("%c"+a),n.push(c)):t.push(a)}else break}}for(o>0&&(i=n,i.unshift(t.join("")));o<e.length;o++){const a=e[o];a instanceof Symbol||i.push(a)}return i},cg=fS?RS:IS,OS=(...e)=>{console.log(...cg(e)),dg.forEach(t=>t.print(e))},ug=(...e)=>{console.warn(...cg(e)),e.unshift(Oc),dg.forEach(t=>t.print(e))},dg=Cn(),hg=e=>({[Symbol.iterator](){return this},next:e}),jS=(e,t)=>hg(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),As=(e,t)=>hg(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}});class jc{constructor(t,n){this.clock=t,this.len=n}}class tr{constructor(){this.clients=new Map}}const hn=(e,t,n)=>t.clients.forEach((r,i)=>{const o=e.doc.store.clients.get(i);if(o!=null){const s=o[o.length-1],a=s.id.clock+s.length;for(let l=0,c=r[l];l<r.length&&c.clock<a;c=r[++l])bg(e,o,c.clock,c.len,n)}}),MS=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const i=Ht((n+r)/2),o=e[i],s=o.clock;if(s<=t){if(t<s+o.len)return i;n=i+1}else r=i-1}return null},nr=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&MS(n,t.clock)!==null},Mc=e=>{e.clients.forEach(t=>{t.sort((i,o)=>i.clock-o.clock);let n,r;for(n=1,r=1;n<t.length;n++){const i=t[r-1],o=t[n];i.clock+i.len>=o.clock?i.len=un(i.len,o.clock+o.len-i.clock):(r<n&&(t[r]=o),r++)}t.length=r})},Ul=e=>{const t=new tr;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){const o=r.slice();for(let s=n+1;s<e.length;s++)mw(o,e[s].clients.get(i)||[]);t.clients.set(i,o)}});return Mc(t),t},$r=(e,t,n,r)=>{Ft(e.clients,t,()=>[]).push(new jc(n,r))},fg=()=>new tr,NS=e=>{const t=fg();return e.clients.forEach((n,r)=>{const i=[];for(let o=0;o<n.length;o++){const s=n[o];if(s.deleted){const a=s.id.clock;let l=s.length;if(o+1<n.length)for(let c=n[o+1];o+1<n.length&&c.deleted;c=n[++o+1])l+=c.length;i.push(new jc(a,l))}}i.length>0&&t.clients.set(r,i)}),t},Nc=(e,t)=>{se(e.restEncoder,t.clients.size),An(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),se(e.restEncoder,n);const i=r.length;se(e.restEncoder,i);for(let o=0;o<i;o++){const s=r[o];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},PS=e=>{const t=new tr,n=ye(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();const i=ye(e.restDecoder),o=ye(e.restDecoder);if(o>0){const s=Ft(t.clients,i,()=>[]);for(let a=0;a<o;a++)s.push(new jc(e.readDsClock(),e.readDsLen()))}}return t},bd=(e,t,n)=>{const r=new tr,i=ye(e.restDecoder);for(let o=0;o<i;o++){e.resetDsCurVal();const s=ye(e.restDecoder),a=ye(e.restDecoder),l=n.clients.get(s)||[],c=Ae(n,s);for(let d=0;d<a;d++){const u=e.readDsClock(),h=u+e.readDsLen();if(u<c){c<h&&$r(r,s,c,h-c);let p=dt(l,u),g=l[p];for(!g.deleted&&g.id.clock<u&&(l.splice(p+1,0,Yi(t,g,u-g.id.clock)),p++);p<l.length&&(g=l[p++],g.id.clock<h);)g.deleted||(h<g.id.clock+g.length&&l.splice(p,0,Yi(t,g,h-g.id.clock)),g.delete(t))}else $r(r,s,u,h-u)}}if(r.clients.size>0){const o=new Do;return se(o.restEncoder,0),Nc(o,r),o.toUint8Array()}return null},pg=Zp;class On extends Gp{constructor({guid:t=Qw(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:o=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=pg(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new yg,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=xd(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>xd(c=>{const d=u=>{(u===void 0||u===!0)&&(this.off("sync",d),c())};this.on("sync",d)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&de(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(An(this.subdocs).map(t=>t.guid))}transact(t,n=null){return de(this,t,n)}get(t,n=Re){const r=Ft(this.share,t,()=>{const o=new n;return o._integrate(this,null),o}),i=r.constructor;if(n!==Re&&i!==n)if(i===Re){const o=new n;o._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=o}),o._start=r._start;for(let s=o._start;s!==null;s=s.right)s.parent=o;return o._length=r._length,this.share.set(t,o),o._integrate(this,null),o}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,Wn)}getText(t=""){return this.get(t,fn)}getMap(t=""){return this.get(t,Zn)}getXmlElement(t=""){return this.get(t,Ne)}getXmlFragment(t=""){return this.get(t,kn)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,An(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new On({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,de(t.parent.doc,r=>{const i=n.doc;t.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class LS{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=ye(this.restDecoder),this.dsCurrVal}readDsLen(){const t=ye(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class Fi extends LS{constructor(t){super(t),this.keys=[],ye(t),this.keyClockDecoder=new Cs(Ze(t)),this.clientDecoder=new _i(Ze(t)),this.leftClockDecoder=new Cs(Ze(t)),this.rightClockDecoder=new Cs(Ze(t)),this.infoDecoder=new md(Ze(t),Dr),this.stringDecoder=new Kw(Ze(t)),this.parentInfoDecoder=new md(Ze(t),Dr),this.typeRefDecoder=new _i(Ze(t)),this.lenDecoder=new _i(Ze(t))}readLeftID(){return new qn(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new qn(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return zi(this.restDecoder)}readBuf(){return Ze(this.restDecoder)}readJSON(){return zi(this.restDecoder)}readKey(){const t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class DS{constructor(){this.restEncoder=Zr()}toUint8Array(){return at(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){se(this.restEncoder,t)}writeDsLen(t){se(this.restEncoder,t)}}class $S extends DS{writeLeftID(t){se(this.restEncoder,t.client),se(this.restEncoder,t.clock)}writeRightID(t){se(this.restEncoder,t.client),se(this.restEncoder,t.clock)}writeClient(t){se(this.restEncoder,t)}writeInfo(t){$l(this.restEncoder,t)}writeString(t){Fn(this.restEncoder,t)}writeParentInfo(t){se(this.restEncoder,t?1:0)}writeTypeRef(t){se(this.restEncoder,t)}writeLen(t){se(this.restEncoder,t)}writeAny(t){Xn(this.restEncoder,t)}writeBuf(t){Ke(this.restEncoder,t)}writeJSON(t){Fn(this.restEncoder,JSON.stringify(t))}writeKey(t){Fn(this.restEncoder,t)}}class BS{constructor(){this.restEncoder=Zr(),this.dsCurrVal=0}toUint8Array(){return at(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){const n=t-this.dsCurrVal;this.dsCurrVal=t,se(this.restEncoder,n)}writeDsLen(t){t===0&&We(),se(this.restEncoder,t-1),this.dsCurrVal+=t}}class Do extends BS{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Ss,this.clientEncoder=new Ii,this.leftClockEncoder=new Ss,this.rightClockEncoder=new Ss,this.infoEncoder=new fd($l),this.stringEncoder=new Bw,this.parentInfoEncoder=new fd($l),this.typeRefEncoder=new Ii,this.lenEncoder=new Ii}toUint8Array(){const t=Zr();return se(t,0),Ke(t,this.keyClockEncoder.toUint8Array()),Ke(t,this.clientEncoder.toUint8Array()),Ke(t,this.leftClockEncoder.toUint8Array()),Ke(t,this.rightClockEncoder.toUint8Array()),Ke(t,at(this.infoEncoder)),Ke(t,this.stringEncoder.toUint8Array()),Ke(t,at(this.parentInfoEncoder)),Ke(t,this.typeRefEncoder.toUint8Array()),Ke(t,this.lenEncoder.toUint8Array()),Po(t,at(this.restEncoder)),at(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){Xn(this.restEncoder,t)}writeBuf(t){Ke(this.restEncoder,t)}writeJSON(t){Xn(this.restEncoder,t)}writeKey(t){const n=this.keyMap.get(t);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(n)}}const HS=(e,t,n,r)=>{r=un(r,t[0].id.clock);const i=dt(t,r);se(e.restEncoder,t.length-i),e.writeClient(n),se(e.restEncoder,r);const o=t[i];o.write(e,r-o.id.clock);for(let s=i+1;s<t.length;s++)t[s].write(e,0)},gg=(e,t,n)=>{const r=new Map;n.forEach((i,o)=>{Ae(t,o)>i&&r.set(o,i)}),$o(t).forEach((i,o)=>{n.has(o)||r.set(o,0)}),se(e.restEncoder,r.size),An(r.entries()).sort((i,o)=>o[0]-i[0]).forEach(([i,o])=>{HS(e,t.clients.get(i),i,o)})},zS=(e,t)=>{const n=lt(),r=ye(e.restDecoder);for(let i=0;i<r;i++){const o=ye(e.restDecoder),s=new Array(o),a=e.readClient();let l=ye(e.restDecoder);n.set(a,{i:0,refs:s});for(let c=0;c<o;c++){const d=e.readInfo();switch(No&d){case 0:{const u=e.readLen();s[c]=new et(ee(a,l),u),l+=u;break}case 10:{const u=ye(e.restDecoder);s[c]=new st(ee(a,l),u),l+=u;break}default:{const u=(d&(Dt|Be))===0,h=new ue(ee(a,l),null,(d&Be)===Be?e.readLeftID():null,null,(d&Dt)===Dt?e.readRightID():null,u?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,u&&(d&Pr)===Pr?e.readString():null,Ug(e,d));s[c]=h,l+=h.length}}}}return n},US=(e,t,n)=>{const r=[];let i=An(n.keys()).sort((p,g)=>p-g);if(i.length===0)return null;const o=()=>{if(i.length===0)return null;let p=n.get(i[i.length-1]);for(;p.refs.length===p.i;)if(i.pop(),i.length>0)p=n.get(i[i.length-1]);else return null;return p};let s=o();if(s===null)return null;const a=new yg,l=new Map,c=(p,g)=>{const m=l.get(p);(m==null||m>g)&&l.set(p,g)};let d=s.refs[s.i++];const u=new Map,h=()=>{for(const p of r){const g=p.id.client,m=n.get(g);m?(m.i--,a.clients.set(g,m.refs.slice(m.i)),n.delete(g),m.i=0,m.refs=[]):a.clients.set(g,[p]),i=i.filter(x=>x!==g)}r.length=0};for(;;){if(d.constructor!==st){const g=Ft(u,d.id.client,()=>Ae(t,d.id.client))-d.id.clock;if(g<0)r.push(d),c(d.id.client,d.id.clock-1),h();else{const m=d.getMissing(e,t);if(m!==null){r.push(d);const x=n.get(m)||{refs:[],i:0};if(x.refs.length===x.i)c(m,Ae(t,m)),h();else{d=x.refs[x.i++];continue}}else(g===0||g<d.length)&&(d.integrate(e,g),u.set(d.id.client,d.id.clock+d.length))}}if(r.length>0)d=r.pop();else if(s!==null&&s.i<s.refs.length)d=s.refs[s.i++];else{if(s=o(),s===null)break;d=s.refs[s.i++]}}if(a.clients.size>0){const p=new Do;return gg(p,a,new Map),se(p.restEncoder,0),{missing:l,update:p.toUint8Array()}}return null},FS=(e,t)=>gg(e,t.doc.store,t.beforeState),qS=(e,t,n,r=new Fi(e))=>de(t,i=>{i.local=!1;let o=!1;const s=i.doc,a=s.store,l=zS(r,s),c=US(i,a,l),d=a.pendingStructs;if(d){for(const[h,p]of d.missing)if(p<Ae(a,h)){o=!0;break}if(c){for(const[h,p]of c.missing){const g=d.missing.get(h);(g==null||g>p)&&d.missing.set(h,p)}d.update=_d([d.update,c.update])}}else a.pendingStructs=c;const u=bd(r,i,a);if(a.pendingDs){const h=new Fi(Tc(a.pendingDs));ye(h.restDecoder);const p=bd(h,i,a);u&&p?a.pendingDs=_d([u,p]):a.pendingDs=u||p}else a.pendingDs=u;if(o){const h=a.pendingStructs.update;a.pendingStructs=null,Fl(i.doc,h)}},n,!1),Fl=(e,t,n,r=Fi)=>{const i=Tc(t);qS(i,e,n,new r(i))};class VS{constructor(){this.l=[]}}const wd=()=>new VS,Sd=(e,t)=>e.l.push(t),Cd=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter(i=>t!==i),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},mg=(e,t,n)=>Rc(e.l,[t,n]);class qn{constructor(t,n){this.client=t,this.clock=n}}const ui=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,ee=(e,t)=>new qn(e,t),Br=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw We()},Hr=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1};class qi{constructor(t,n,r,i=0){this.type=t,this.tname=n,this.item=r,this.assoc=i}}class WS{constructor(t,n,r=0){this.type=t,this.index=n,this.assoc=r}}const GS=(e,t,n=0)=>new WS(e,t,n),di=(e,t,n)=>{let r=null,i=null;return e._item===null?i=Br(e):r=ee(e._item.id.client,e._item.id.clock),new qi(r,i,t,n)},ks=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return di(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return di(e,ee(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return di(e,r.lastId,n);r=r.right}return di(e,null,n)},KS=(e,t)=>{const n=Vn(e,t),r=t.clock-n.id.clock;return{item:n,diff:r}},YS=(e,t,n=!0)=>{const r=t.store,i=e.item,o=e.type,s=e.tname,a=e.assoc;let l=null,c=0;if(i!==null){if(Ae(r,i.client)<=i.clock)return null;const d=n?Gl(r,i):KS(r,i),u=d.item;if(!(u instanceof ue))return null;if(l=u.parent,l._item===null||!l._item.deleted){c=u.deleted||!u.countable?0:d.diff+(a>=0?0:1);let h=u.left;for(;h!==null;)!h.deleted&&h.countable&&(c+=h.length),h=h.left}}else{if(s!==null)l=t.get(s);else if(o!==null){if(Ae(r,o.client)<=o.clock)return null;const{item:d}=n?Gl(r,o):{item:Vn(r,o)};if(d instanceof ue&&d.content instanceof ft)l=d.content.type;else return null}else throw We();a>=0?c=l._length:c=0}return GS(l,c,e.assoc)};class Pc{constructor(t,n){this.ds=t,this.sv=n}}const xg=(e,t)=>new Pc(e,t),Es=e=>xg(NS(e.store),$o(e.store)),yn=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!nr(t.ds,e.id),ql=(e,t)=>{const n=Ft(e.meta,ql,Cn),r=e.doc.store;n.has(t)||(t.sv.forEach((i,o)=>{i<Ae(r,o)&&Fe(e,ee(o,i))}),hn(e,t.ds,i=>{}),n.add(t))};class yg{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const $o=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const i=n[n.length-1];t.set(r,i.id.clock+i.length)}),t},Ae=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},vg=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==t.id.clock)throw We()}n.push(t)},dt=(e,t)=>{let n=0,r=e.length-1,i=e[r],o=i.id.clock;if(o===t)return r;let s=Ht(t/(o+i.length-1)*r);for(;n<=r;){if(i=e[s],o=i.id.clock,o<=t){if(t<o+i.length)return s;n=s+1}else r=s-1;s=Ht((n+r)/2)}throw We()},XS=(e,t)=>{const n=e.clients.get(t.client);return n[dt(n,t.clock)]},Vn=XS,Vl=(e,t,n)=>{const r=dt(t,n),i=t[r];return i.id.clock<n&&i instanceof ue?(t.splice(r+1,0,Yi(e,i,n-i.id.clock)),r+1):r},Fe=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[Vl(e,n,t.clock)]},Ad=(e,t,n)=>{const r=t.clients.get(n.client),i=dt(r,n.clock),o=r[i];return n.clock!==o.id.clock+o.length-1&&o.constructor!==et&&r.splice(i+1,0,Yi(e,o,n.clock-o.id.clock+1)),o},JS=(e,t,n)=>{const r=e.clients.get(t.id.client);r[dt(r,t.id.clock)]=n},bg=(e,t,n,r,i)=>{if(r===0)return;const o=n+r;let s=Vl(e,t,n),a;do a=t[s++],o<a.id.clock+a.length&&Vl(e,t,o),i(a);while(s<t.length&&t[s].id.clock<o)};class ZS{constructor(t,n,r){this.doc=t,this.deleteSet=new tr,this.beforeState=$o(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const kd=(e,t)=>t.deleteSet.clients.size===0&&!gw(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(Mc(t.deleteSet),FS(e,t),Nc(e,t.deleteSet),!0),Ed=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ft(e.changed,t,Cn).add(n)},Ri=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof ue&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const o=t-i;return o&&e.splice(t+1-o,o),o},QS=(e,t,n)=>{for(const[r,i]of e.clients.entries()){const o=t.clients.get(r);for(let s=i.length-1;s>=0;s--){const a=i[s],l=a.clock+a.len;for(let c=dt(o,a.clock),d=o[c];c<o.length&&d.id.clock<l;d=o[++c]){const u=o[c];if(a.clock+a.len<=u.id.clock)break;u instanceof ue&&u.deleted&&!u.keep&&n(u)&&u.gc(t,!1)}}}},e2=(e,t)=>{e.clients.forEach((n,r)=>{const i=t.clients.get(r);for(let o=n.length-1;o>=0;o--){const s=n[o],a=Yn(i.length-1,1+dt(i,s.clock+s.len-1));for(let l=a,c=i[l];l>0&&c.id.clock>=s.clock;c=i[l])l-=1+Ri(i,l)}})},wg=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,i=r.store,o=n.deleteSet,s=n._mergeStructs;try{Mc(o),n.afterState=$o(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,c)=>a.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=c,d._path=null}),l.sort((d,u)=>d.path.length-u.path.length),mg(c._dEH,l,n))})}),a.push(()=>r.emit("afterTransaction",[n,r])),Rc(a,[]),n._needFormattingCleanup&&b2(n)}finally{r.gc&&QS(o,i,r.gcFilter),e2(o,i),n.afterState.forEach((d,u)=>{const h=n.beforeState.get(u)||0;if(h!==d){const p=i.clients.get(u),g=un(dt(p,h),1);for(let m=p.length-1;m>=g;)m-=1+Ri(p,m)}});for(let d=s.length-1;d>=0;d--){const{client:u,clock:h}=s[d].id,p=i.clients.get(u),g=dt(p,h);g+1<p.length&&Ri(p,g+1)>1||g>0&&Ri(p,g)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(OS(Oc,sg,"[yjs] ",ag,lg,"Changed the client-id because another client seems to be using it."),r.clientID=pg()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new $S;kd(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new Do;kd(d,n)&&r.emit("updateV2",[d.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:c}=n;(a.size>0||c.size>0||l.size>0)&&(a.forEach(d=>{d.clientID=r.clientID,d.collectionid==null&&(d.collectionid=r.collectionid),r.subdocs.add(d)}),c.forEach(d=>r.subdocs.delete(d)),r.emit("subdocs",[{loaded:l,added:a,removed:c},r,n]),c.forEach(d=>d.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):wg(e,t+1)}}},de=(e,t,n=null,r=!0)=>{const i=e._transactionCleanups;let o=!1,s=null;e._transaction===null&&(o=!0,e._transaction=new ZS(e,n,r),i.push(e._transaction),i.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=t(e._transaction)}finally{if(o){const a=e._transaction===i[0];e._transaction=null,a&&wg(i,0)}}return s};class t2{constructor(t,n){this.insertions=n,this.deletions=t,this.meta=new Map}}const Td=(e,t,n)=>{hn(e,n.deletions,r=>{r instanceof ue&&t.scope.some(i=>i===e.doc||Hr(i,r))&&Hc(r,!1)})},Id=(e,t,n)=>{let r=null;const i=e.doc,o=e.scope;de(i,a=>{for(;t.length>0&&e.currStackItem===null;){const l=i.store,c=t.pop(),d=new Set,u=[];let h=!1;hn(a,c.insertions,p=>{if(p instanceof ue){if(p.redone!==null){let{item:g,diff:m}=Gl(l,p.id);m>0&&(g=Fe(a,ee(g.id.client,g.id.clock+m))),p=g}!p.deleted&&o.some(g=>g===a.doc||Hr(g,p))&&u.push(p)}}),hn(a,c.deletions,p=>{p instanceof ue&&o.some(g=>g===a.doc||Hr(g,p))&&!nr(c.insertions,p.id)&&d.add(p)}),d.forEach(p=>{h=zg(a,p,d,c.insertions,e.ignoreRemoteMapChanges,e)!==null||h});for(let p=u.length-1;p>=0;p--){const g=u[p];e.deleteFilter(g)&&(g.delete(a),h=!0)}e.currStackItem=h?c:null}a.changed.forEach((l,c)=>{l.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=a},e);const s=e.currStackItem;if(s!=null){const a=r.changedParentTypes;e.emit("stack-item-popped",[{stackItem:s,type:n,changedParentTypes:a,origin:e},e]),e.currStackItem=null}return s};class Sg extends Gp{constructor(t,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:i=()=>!0,trackedOrigins:o=new Set([null]),ignoreRemoteMapChanges:s=!1,doc:a=Ll(t)?t[0].doc:t instanceof On?t:t.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(t),this.deleteFilter=i,o.add(this),this.trackedOrigins=o,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=s,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(x=>l.changedParentTypes.has(x)||x===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const c=this.undoing,d=this.redoing,u=c?this.redoStack:this.undoStack;c?this.stopCapturing():d||this.clear(!1,!0);const h=new tr;l.afterState.forEach((x,y)=>{const w=l.beforeState.get(y)||0,A=x-w;A>0&&$r(h,y,w,A)});const p=eS();let g=!1;if(this.lastChange>0&&p-this.lastChange<this.captureTimeout&&u.length>0&&!c&&!d){const x=u[u.length-1];x.deletions=Ul([x.deletions,l.deleteSet]),x.insertions=Ul([x.insertions,h])}else u.push(new t2(l.deleteSet,h)),g=!0;!c&&!d&&(this.lastChange=p),hn(l,l.deleteSet,x=>{x instanceof ue&&this.scope.some(y=>y===l.doc||Hr(y,x))&&Hc(x,!0)});const m=[{stackItem:u[u.length-1],origin:l.origin,type:c?"redo":"undo",changedParentTypes:l.changedParentTypes},this];g?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(t){const n=new Set(this.scope);t=Ll(t)?t:[t],t.forEach(r=>{n.has(r)||(n.add(r),(r instanceof Re?r.doc!==this.doc:r!==this.doc)&&ug("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,n=!0){(t&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{t&&(this.undoStack.forEach(i=>Td(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>Td(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=Id(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=Id(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*n2(e){const t=ye(e.restDecoder);for(let n=0;n<t;n++){const r=ye(e.restDecoder),i=e.readClient();let o=ye(e.restDecoder);for(let s=0;s<r;s++){const a=e.readInfo();if(a===10){const l=ye(e.restDecoder);yield new st(ee(i,o),l),o+=l}else if((No&a)!==0){const l=(a&(Dt|Be))===0,c=new ue(ee(i,o),null,(a&Be)===Be?e.readLeftID():null,null,(a&Dt)===Dt?e.readRightID():null,l?e.readParentInfo()?e.readString():e.readLeftID():null,l&&(a&Pr)===Pr?e.readString():null,Ug(e,a));yield c,o+=c.length}else{const l=e.readLen();yield new et(ee(i,o),l),o+=l}}}}class r2{constructor(t,n){this.gen=n2(t),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===st);return this.curr}}class i2{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}const o2=(e,t)=>{if(e.constructor===et){const{client:n,clock:r}=e.id;return new et(ee(n,r+t),e.length-t)}else if(e.constructor===st){const{client:n,clock:r}=e.id;return new st(ee(n,r+t),e.length-t)}else{const n=e,{client:r,clock:i}=n.id;return new ue(ee(r,i+t),null,ee(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},_d=(e,t=Fi,n=Do)=>{if(e.length===1)return e[0];const r=e.map(d=>new t(Tc(d)));let i=r.map(d=>new r2(d,!0)),o=null;const s=new n,a=new i2(s);for(;i=i.filter(h=>h.curr!==null),i.sort((h,p)=>{if(h.curr.id.client===p.curr.id.client){const g=h.curr.id.clock-p.curr.id.clock;return g===0?h.curr.constructor===p.curr.constructor?0:h.curr.constructor===st?1:-1:g}else return p.curr.id.client-h.curr.id.client}),i.length!==0;){const d=i[0],u=d.curr.id.client;if(o!==null){let h=d.curr,p=!1;for(;h!==null&&h.id.clock+h.length<=o.struct.id.clock+o.struct.length&&h.id.client>=o.struct.id.client;)h=d.next(),p=!0;if(h===null||h.id.client!==u||p&&h.id.clock>o.struct.id.clock+o.struct.length)continue;if(u!==o.struct.id.client)mr(a,o.struct,o.offset),o={struct:h,offset:0},d.next();else if(o.struct.id.clock+o.struct.length<h.id.clock)if(o.struct.constructor===st)o.struct.length=h.id.clock+h.length-o.struct.id.clock;else{mr(a,o.struct,o.offset);const g=h.id.clock-o.struct.id.clock-o.struct.length;o={struct:new st(ee(u,o.struct.id.clock+o.struct.length),g),offset:0}}else{const g=o.struct.id.clock+o.struct.length-h.id.clock;g>0&&(o.struct.constructor===st?o.struct.length-=g:h=o2(h,g)),o.struct.mergeWith(h)||(mr(a,o.struct,o.offset),o={struct:h,offset:0},d.next())}}else o={struct:d.curr,offset:0},d.next();for(let h=d.curr;h!==null&&h.id.client===u&&h.id.clock===o.struct.id.clock+o.struct.length&&h.constructor!==st;h=d.next())mr(a,o.struct,o.offset),o={struct:h,offset:0}}o!==null&&(mr(a,o.struct,o.offset),o=null),s2(a);const l=r.map(d=>PS(d)),c=Ul(l);return Nc(s,c),s.toUint8Array()},Cg=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:at(e.encoder.restEncoder)}),e.encoder.restEncoder=Zr(),e.written=0)},mr=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&Cg(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),se(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},s2=e=>{Cg(e);const t=e.encoder.restEncoder;se(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){const r=e.clientStructs[n];se(t,r.written),Po(t,r.restEncoder)}},Rd="You must not compute changes after the event-handler fired.";class Bo{constructor(t,n){this.target=t,this.currentTarget=t,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=a2(this.currentTarget,this.target))}deletes(t){return nr(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw dn(Rd);const t=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const o=n._map.get(i);let s,a;if(this.adds(o)){let l=o.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(o))if(l!==null&&this.deletes(l))s="delete",a=vs(l.content.getContent());else return;else l!==null&&this.deletes(l)?(s="update",a=vs(l.content.getContent())):(s="add",a=void 0)}else if(this.deletes(o))s="delete",a=vs(o.content.getContent());else return;t.set(i,{action:s,oldValue:a})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw dn(Rd);const n=this.target,r=Cn(),i=Cn(),o=[];if(t={added:r,deleted:i,delta:o,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&o.push(a)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=c.length,i.add(c)):this.adds(c)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(c.content.getContent()),r.add(c)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=c.length);a!==null&&a.retain===void 0&&l()}this._changes=t}return t}}const a2=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,i=t._item.parent._start;for(;i!==t._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}t=t._item.parent}return n},Pe=()=>{ug("Invalid access: Add Yjs type to a document before reading data.")},Ag=80;let Lc=0;class l2{constructor(t,n){t.marker=!0,this.p=t,this.index=n,this.timestamp=Lc++}}const c2=e=>{e.timestamp=Lc++},kg=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Lc++},u2=(e,t,n)=>{if(e.length>=Ag){const r=e.reduce((i,o)=>i.timestamp<o.timestamp?i:o);return kg(r,t,n),r}else{const r=new l2(t,n);return e.push(r),r}},Ho=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((o,s)=>Ti(t-o.index)<Ti(t-s.index)?o:s);let r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,c2(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&Ti(n.index-i)<r.parent.length/Ag?(kg(n,r,i),n):u2(e._searchMarker,r,i)},zr=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const i=e[r];if(n>0){let o=i.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)o=o.left,o&&!o.deleted&&o.countable&&(i.index-=o.length);if(o===null||o.marker===!0){e.splice(r,1);continue}i.p=o,o.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=un(t,i.index+n))}},zo=(e,t,n)=>{const r=e,i=t.changedParentTypes;for(;Ft(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;mg(r._eH,n,t)};class Re{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=wd(),this._dEH=wd(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,n){this.doc=t,this._item=n}_copy(){throw ct()}clone(){throw ct()}_write(t){}get _first(){let t=this._start;for(;t!==null&&t.deleted;)t=t.right;return t}_callObserver(t,n){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){Sd(this._eH,t)}observeDeep(t){Sd(this._dEH,t)}unobserve(t){Cd(this._eH,t)}unobserveDeep(t){Cd(this._dEH,t)}toJSON(){}}const Eg=(e,t,n)=>{e.doc??Pe(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const i=[];let o=e._start;for(;o!==null&&r>0;){if(o.countable&&!o.deleted){const s=o.content.getContent();if(s.length<=t)t-=s.length;else{for(let a=t;a<s.length&&r>0;a++)i.push(s[a]),r--;t=0}}o=o.right}return i},Tg=e=>{e.doc??Pe();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)t.push(r[i])}n=n.right}return t},Ig=(e,t)=>{const n=[];let r=e._start;for(;r!==null;){if(r.countable&&yn(r,t)){const i=r.content.getContent();for(let o=0;o<i.length;o++)n.push(i[o])}r=r.right}return n},Ur=(e,t)=>{let n=0,r=e._start;for(e.doc??Pe();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let o=0;o<i.length;o++)t(i[o],n++,e)}r=r.right}},_g=(e,t)=>{const n=[];return Ur(e,(r,i)=>{n.push(t(r,i,e))}),n},d2=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},Rg=(e,t)=>{e.doc??Pe();const n=Ho(e,t);let r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},Vi=(e,t,n,r)=>{let i=n;const o=e.doc,s=o.clientID,a=o.store,l=n===null?t._start:n.right;let c=[];const d=()=>{c.length>0&&(i=new ue(ee(s,Ae(a,s)),i,i&&i.lastId,l,l&&l.id,t,null,new En(c)),i.integrate(e,0),c=[])};r.forEach(u=>{if(u===null)c.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(u);break;default:switch(d(),u.constructor){case Uint8Array:case ArrayBuffer:i=new ue(ee(s,Ae(a,s)),i,i&&i.lastId,l,l&&l.id,t,null,new Qr(new Uint8Array(u))),i.integrate(e,0);break;case On:i=new ue(ee(s,Ae(a,s)),i,i&&i.lastId,l,l&&l.id,t,null,new ei(u)),i.integrate(e,0);break;default:if(u instanceof Re)i=new ue(ee(s,Ae(a,s)),i,i&&i.lastId,l,l&&l.id,t,null,new ft(u)),i.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},Og=()=>dn("Length exceeded!"),jg=(e,t,n,r)=>{if(n>t._length)throw Og();if(n===0)return t._searchMarker&&zr(t._searchMarker,n,r.length),Vi(e,t,null,r);const i=n,o=Ho(t,n);let s=t._start;for(o!==null&&(s=o.p,n-=o.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&Fe(e,ee(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&zr(t._searchMarker,i,r.length),Vi(e,t,s,r)},h2=(e,t,n)=>{let i=(t._searchMarker||[]).reduce((o,s)=>s.index>o.index?s:o,{index:0,p:t._start}).p;if(i)for(;i.right;)i=i.right;return Vi(e,t,i,n)},Mg=(e,t,n,r)=>{if(r===0)return;const i=n,o=r,s=Ho(t,n);let a=t._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Fe(e,ee(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Fe(e,ee(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw Og();t._searchMarker&&zr(t._searchMarker,i,-o+r)},Wi=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},Dc=(e,t,n,r)=>{const i=t._map.get(n)||null,o=e.doc,s=o.clientID;let a;if(r==null)a=new En([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new En([r]);break;case Uint8Array:a=new Qr(r);break;case On:a=new ei(r);break;default:if(r instanceof Re)a=new ft(r);else throw new Error("Unexpected content type")}new ue(ee(s,Ae(o.store,s)),i,i&&i.lastId,null,null,t,n,a).integrate(e,0)},$c=(e,t)=>{e.doc??Pe();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Ng=e=>{const t={};return e.doc??Pe(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},Pg=(e,t)=>{e.doc??Pe();const n=e._map.get(t);return n!==void 0&&!n.deleted},f2=(e,t)=>{const n={};return e._map.forEach((r,i)=>{let o=r;for(;o!==null&&(!t.sv.has(o.id.client)||o.id.clock>=(t.sv.get(o.id.client)||0));)o=o.left;o!==null&&yn(o,t)&&(n[i]=o.content.getContent()[o.length-1])}),n},hi=e=>(e.doc??Pe(),jS(e._map.entries(),t=>!t[1].deleted));class p2 extends Bo{}class Wn extends Re{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new Wn;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Wn}clone(){const t=new Wn;return t.insert(0,this.toArray().map(n=>n instanceof Re?n.clone():n)),t}get length(){return this.doc??Pe(),this._length}_callObserver(t,n){super._callObserver(t,n),zo(this,t,new p2(this,t))}insert(t,n){this.doc!==null?de(this.doc,r=>{jg(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?de(this.doc,n=>{h2(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?de(this.doc,r=>{Mg(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return Rg(this,t)}toArray(){return Tg(this)}slice(t=0,n=this.length){return Eg(this,t,n)}toJSON(){return this.map(t=>t instanceof Re?t.toJSON():t)}map(t){return _g(this,t)}forEach(t){Ur(this,t)}[Symbol.iterator](){return d2(this)}_write(t){t.writeTypeRef(B2)}}const g2=e=>new Wn;class m2 extends Bo{constructor(t,n,r){super(t,n),this.keysChanged=r}}class Zn extends Re{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new Zn}clone(){const t=new Zn;return this.forEach((n,r)=>{t.set(r,n instanceof Re?n.clone():n)}),t}_callObserver(t,n){zo(this,t,new m2(this,t,n))}toJSON(){this.doc??Pe();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];t[r]=i instanceof Re?i.toJSON():i}}),t}get size(){return[...hi(this)].length}keys(){return As(hi(this),t=>t[0])}values(){return As(hi(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return As(hi(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??Pe(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?de(this.doc,n=>{Wi(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?de(this.doc,r=>{Dc(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return $c(this,t)}has(t){return Pg(this,t)}clear(){this.doc!==null?de(this.doc,t=>{this.forEach(function(n,r,i){Wi(t,i,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(H2)}}const x2=e=>new Zn,an=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&lS(e,t);class Wl{constructor(t,n,r,i){this.left=t,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&We(),this.right.content.constructor){case Ee:this.right.deleted||rr(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const Od=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case Ee:t.right.deleted||rr(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&Fe(e,ee(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},fi=(e,t,n,r)=>{const i=new Map,o=r?Ho(t,n):null;if(o){const s=new Wl(o.p.left,o.p,o.index,i);return Od(e,s,n-o.index)}else{const s=new Wl(null,t._start,0,i);return Od(e,s,n)}},Lg=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Ee&&an(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=e.doc,o=i.clientID;r.forEach((s,a)=>{const l=n.left,c=n.right,d=new ue(ee(o,Ae(i.store,o)),l,l&&l.lastId,c,c&&c.id,t,null,new Ee(a,s));d.integrate(e,0),n.right=d,n.forward()})},rr=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},Dg=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Ee&&an(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},$g=(e,t,n,r)=>{const i=e.doc,o=i.clientID,s=new Map;for(const a in r){const l=r[a],c=n.currentAttributes.get(a)??null;if(!an(c,l)){s.set(a,c);const{left:d,right:u}=n;n.right=new ue(ee(o,Ae(i.store,o)),d,d&&d.lastId,u,u&&u.id,t,null,new Ee(a,l)),n.right.integrate(e,0),n.forward()}}return s},Ts=(e,t,n,r,i)=>{n.currentAttributes.forEach((h,p)=>{i[p]===void 0&&(i[p]=null)});const o=e.doc,s=o.clientID;Dg(n,i);const a=$g(e,t,n,i),l=r.constructor===String?new ht(r):r instanceof Re?new ft(r):new jn(r);let{left:c,right:d,index:u}=n;t._searchMarker&&zr(t._searchMarker,n.index,l.getLength()),d=new ue(ee(s,Ae(o.store,s)),c,c&&c.lastId,d,d&&d.id,t,null,l),d.integrate(e,0),n.right=d,n.index=u,n.forward(),Lg(e,t,n,a)},jd=(e,t,n,r,i)=>{const o=e.doc,s=o.clientID;Dg(n,i);const a=$g(e,t,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Ee));){if(!n.right.deleted)switch(n.right.content.constructor){case Ee:{const{key:l,value:c}=n.right.content,d=i[l];if(d!==void 0){if(an(d,c))a.delete(l);else{if(r===0)break e;a.set(l,c)}n.right.delete(e)}else n.currentAttributes.set(l,c);break}default:r<n.right.length&&Fe(e,ee(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
2
+ `;n.right=new ue(ee(s,Ae(o.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new ht(l)),n.right.integrate(e,0),n.forward()}Lg(e,t,n,a)},Bg=(e,t,n,r,i)=>{let o=t;const s=lt();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===Ee){const c=o.content;s.set(c.key,c)}o=o.right}let a=0,l=!1;for(;t!==o;){if(n===t&&(l=!0),!t.deleted){const c=t.content;switch(c.constructor){case Ee:{const{key:d,value:u}=c,h=r.get(d)??null;(s.get(d)!==c||h===u)&&(t.delete(e),a++,!l&&(i.get(d)??null)===u&&h!==u&&(h===null?i.delete(d):i.set(d,h))),!l&&!t.deleted&&rr(i,c);break}}}t=t.right}return a},y2=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Ee){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},v2=e=>{let t=0;return de(e.doc,n=>{let r=e._start,i=e._start,o=lt();const s=Pl(o);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case Ee:rr(s,i.content);break;default:t+=Bg(n,r,i,o,s),o=Pl(s),r=i;break}i=i.right}}),t},b2=e=>{const t=new Set,n=e.doc;for(const[r,i]of e.afterState.entries()){const o=e.beforeState.get(r)||0;i!==o&&bg(e,n.store.clients.get(r),o,i,s=>{!s.deleted&&s.content.constructor===Ee&&s.constructor!==et&&t.add(s.parent)})}de(n,r=>{hn(e,e.deleteSet,i=>{if(i instanceof et||!i.parent._hasFormatting||t.has(i.parent))return;const o=i.parent;i.content.constructor===Ee?t.add(o):y2(r,i)});for(const i of t)v2(i)})},Md=(e,t,n)=>{const r=n,i=Pl(t.currentAttributes),o=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case ft:case jn:case ht:n<t.right.length&&Fe(e,ee(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}o&&Bg(e,o,t.right,i,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&zr(s._searchMarker,t.index,-r+n),t};class w2 extends Bo{constructor(t,n,r){super(t,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){const t=this.target.doc,n=[];de(t,r=>{const i=new Map,o=new Map;let s=this.target._start,a=null;const l={};let c="",d=0,u=0;const h=()=>{if(a!==null){let p=null;switch(a){case"delete":u>0&&(p={delete:u}),u=0;break;case"insert":(typeof c=="object"||c.length>0)&&(p={insert:c},i.size>0&&(p.attributes={},i.forEach((g,m)=>{g!==null&&(p.attributes[m]=g)}))),c="";break;case"retain":d>0&&(p={retain:d},sS(l)||(p.attributes=iS({},l))),d=0;break}p&&n.push(p),a=null}};for(;s!==null;){switch(s.content.constructor){case ft:case jn:this.adds(s)?this.deletes(s)||(h(),a="insert",c=s.content.getContent()[0],h()):this.deletes(s)?(a!=="delete"&&(h(),a="delete"),u+=1):s.deleted||(a!=="retain"&&(h(),a="retain"),d+=1);break;case ht:this.adds(s)?this.deletes(s)||(a!=="insert"&&(h(),a="insert"),c+=s.content.str):this.deletes(s)?(a!=="delete"&&(h(),a="delete"),u+=s.length):s.deleted||(a!=="retain"&&(h(),a="retain"),d+=s.length);break;case Ee:{const{key:p,value:g}=s.content;if(this.adds(s)){if(!this.deletes(s)){const m=i.get(p)??null;an(m,g)?g!==null&&s.delete(r):(a==="retain"&&h(),an(g,o.get(p)??null)?delete l[p]:l[p]=g)}}else if(this.deletes(s)){o.set(p,g);const m=i.get(p)??null;an(m,g)||(a==="retain"&&h(),l[p]=m)}else if(!s.deleted){o.set(p,g);const m=l[p];m!==void 0&&(an(m,g)?m!==null&&s.delete(r):(a==="retain"&&h(),g===null?delete l[p]:l[p]=g))}s.deleted||(a==="insert"&&h(),rr(i,s.content));break}}s=s.right}for(h();n.length>0;){const p=n[n.length-1];if(p.retain!==void 0&&p.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class fn extends Re{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Pe(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new fn}clone(){const t=new fn;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new w2(this,t,n);zo(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??Pe();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ht&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?de(this.doc,r=>{const i=new Wl(null,this._start,0,new Map);for(let o=0;o<t.length;o++){const s=t[o];if(s.insert!==void 0){const a=!n&&typeof s.insert=="string"&&o===t.length-1&&i.right===null&&s.insert.slice(-1)===`
3
+ `?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&Ts(r,this,i,a,s.attributes||{})}else s.retain!==void 0?jd(r,this,i,s.retain,s.attributes||{}):s.delete!==void 0&&Md(r,i,s.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,r){this.doc??Pe();const i=[],o=new Map,s=this.doc;let a="",l=this._start;function c(){if(a.length>0){const u={};let h=!1;o.forEach((g,m)=>{h=!0,u[m]=g});const p={insert:a};h&&(p.attributes=u),i.push(p),a=""}}const d=()=>{for(;l!==null;){if(yn(l,t)||n!==void 0&&yn(l,n))switch(l.content.constructor){case ht:{const u=o.get("ychange");t!==void 0&&!yn(l,t)?(u===void 0||u.user!==l.id.client||u.type!=="removed")&&(c(),o.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!yn(l,n)?(u===void 0||u.user!==l.id.client||u.type!=="added")&&(c(),o.set("ychange",r?r("added",l.id):{type:"added"})):u!==void 0&&(c(),o.delete("ychange")),a+=l.content.str;break}case ft:case jn:{c();const u={insert:l.content.getContent()[0]};if(o.size>0){const h={};u.attributes=h,o.forEach((p,g)=>{h[g]=p})}i.push(u);break}case Ee:yn(l,t)&&(c(),rr(o,l.content));break}l=l.right}c()};return t||n?de(s,u=>{t&&ql(u,t),n&&ql(u,n),d()},"cleanup"):d(),i}insert(t,n,r){if(n.length<=0)return;const i=this.doc;i!==null?de(i,o=>{const s=fi(o,this,t,!r);r||(r={},s.currentAttributes.forEach((a,l)=>{r[l]=a})),Ts(o,this,s,n,r)}):this._pending.push(()=>this.insert(t,n,r))}insertEmbed(t,n,r){const i=this.doc;i!==null?de(i,o=>{const s=fi(o,this,t,!r);Ts(o,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(t,n,r||{}))}delete(t,n){if(n===0)return;const r=this.doc;r!==null?de(r,i=>{Md(i,fi(i,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,r){if(n===0)return;const i=this.doc;i!==null?de(i,o=>{const s=fi(o,this,t,!1);s.right!==null&&jd(o,this,s,n,r)}):this._pending.push(()=>this.format(t,n,r))}removeAttribute(t){this.doc!==null?de(this.doc,n=>{Wi(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?de(this.doc,r=>{Dc(r,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return $c(this,t)}getAttributes(){return Ng(this)}_write(t){t.writeTypeRef(z2)}}const S2=e=>new fn;class Is{constructor(t,n=()=>!0){this._filter=n,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??Pe()}[Symbol.iterator](){return this}next(){let t=this._currentNode,n=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(n)))do if(n=t.content.type,!t.deleted&&(n.constructor===Ne||n.constructor===kn)&&n._start!==null)t=n._start;else for(;t!==null;){const r=t.next;if(r!==null){t=r;break}else t.parent===this._root?t=null:t=t.parent._item}while(t!==null&&(t.deleted||!this._filter(t.content.type)));return this._firstCall=!1,t===null?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}class kn extends Re{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new kn}clone(){const t=new kn;return t.insert(0,this.toArray().map(n=>n instanceof Re?n.clone():n)),t}get length(){return this.doc??Pe(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new Is(this,t)}querySelector(t){t=t.toUpperCase();const r=new Is(this,i=>i.nodeName&&i.nodeName.toUpperCase()===t).next();return r.done?null:r.value}querySelectorAll(t){return t=t.toUpperCase(),An(new Is(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){zo(this,t,new k2(this,n,t))}toString(){return _g(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},r){const i=t.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Ur(this,o=>{i.insertBefore(o.toDOM(t,n,r),null)}),i}insert(t,n){this.doc!==null?de(this.doc,r=>{jg(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)de(this.doc,r=>{const i=t&&t instanceof Re?t._item:t;Vi(r,this,i,n)});else{const r=this._prelimContent,i=t===null?0:r.findIndex(o=>o===t)+1;if(i===0&&t!==null)throw dn("Reference item not found");r.splice(i,0,...n)}}delete(t,n=1){this.doc!==null?de(this.doc,r=>{Mg(r,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return Tg(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return Rg(this,t)}slice(t=0,n=this.length){return Eg(this,t,n)}forEach(t){Ur(this,t)}_write(t){t.writeTypeRef(F2)}}const C2=e=>new kn;class Ne extends kn{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new Ne(this.nodeName)}clone(){const t=new Ne(this.nodeName),n=this.getAttributes();return oS(n,(r,i)=>{typeof r=="string"&&t.setAttribute(i,r)}),t.insert(0,this.toArray().map(r=>r instanceof Re?r.clone():r)),t}toString(){const t=this.getAttributes(),n=[],r=[];for(const a in t)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];n.push(l+'="'+t[l]+'"')}const o=this.nodeName.toLocaleLowerCase(),s=n.length>0?" "+n.join(" "):"";return`<${o}${s}>${super.toString()}</${o}>`}removeAttribute(t){this.doc!==null?de(this.doc,n=>{Wi(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?de(this.doc,r=>{Dc(r,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return $c(this,t)}hasAttribute(t){return Pg(this,t)}getAttributes(t){return t?f2(this,t):Ng(this)}toDOM(t=document,n={},r){const i=t.createElement(this.nodeName),o=this.getAttributes();for(const s in o){const a=o[s];typeof a=="string"&&i.setAttribute(s,a)}return Ur(this,s=>{i.appendChild(s.toDOM(t,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(t){t.writeTypeRef(U2),t.writeKey(this.nodeName)}}const A2=e=>new Ne(e.readKey());class k2 extends Bo{constructor(t,n,r){super(t,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class Gi extends Zn{constructor(t){super(),this.hookName=t}_copy(){return new Gi(this.hookName)}clone(){const t=new Gi(this.hookName);return this.forEach((n,r)=>{t.set(r,n)}),t}toDOM(t=document,n={},r){const i=n[this.hookName];let o;return i!==void 0?o=i.createDom(this):o=document.createElement(this.hookName),o.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(o,this),o}_write(t){t.writeTypeRef(q2),t.writeKey(this.hookName)}}const E2=e=>new Gi(e.readKey());class qe extends fn{get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new qe}clone(){const t=new qe;return t.applyDelta(this.toDelta()),t}toDOM(t=document,n,r){const i=t.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(t=>{const n=[];for(const i in t.attributes){const o=[];for(const s in t.attributes[i])o.push({key:s,value:t.attributes[i][s]});o.sort((s,a)=>s.key<a.key?-1:1),n.push({nodeName:i,attrs:o})}n.sort((i,o)=>i.nodeName<o.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const o=n[i];r+=`<${o.nodeName}`;for(let s=0;s<o.attrs.length;s++){const a=o.attrs[s];r+=` ${a.key}="${a.value}"`}r+=">"}r+=t.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(V2)}}const T2=e=>new qe;class Bc{constructor(t,n){this.id=t,this.length=n}get deleted(){throw ct()}mergeWith(t){return!1}write(t,n,r){throw ct()}integrate(t,n){throw ct()}}const I2=0;class et extends Bc{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){n>0&&(this.id.clock+=n,this.length-=n),vg(t.doc.store,this)}write(t,n){t.writeInfo(I2),t.writeLen(this.length-n)}getMissing(t,n){return null}}class Qr{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Qr(this.content)}splice(t){throw ct()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}}const _2=e=>new Qr(e.readBuf());class Fr{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Fr(this.len)}splice(t){const n=new Fr(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){$r(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}}const R2=e=>new Fr(e.readLen()),Hg=(e,t)=>new On({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1});class ei{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new ei(Hg(this.doc.guid,this.opts))}splice(t){throw ct()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}const O2=e=>new ei(Hg(e.readString(),e.readAny()));class jn{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new jn(this.embed)}splice(t){throw ct()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}}const j2=e=>new jn(e.readJSON());class Ee{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Ee(this.key,this.value)}splice(t){throw ct()}mergeWith(t){return!1}integrate(t,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}const M2=e=>new Ee(e.readKey(),e.readJSON());class Ki{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ki(this.arr)}splice(t){const n=new Ki(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let i=n;i<r;i++){const o=this.arr[i];t.writeString(o===void 0?"undefined":JSON.stringify(o))}}getRef(){return 2}}const N2=e=>{const t=e.readLen(),n=[];for(let r=0;r<t;r++){const i=e.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new Ki(n)},P2=Ui("node_env")==="development";class En{constructor(t){this.arr=t,P2&&ng(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new En(this.arr)}splice(t){const n=new En(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let i=n;i<r;i++){const o=this.arr[i];t.writeAny(o)}}getRef(){return 8}}const L2=e=>{const t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new En(n)};class ht{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ht(this.str)}splice(t){const n=new ht(this.str.slice(t));this.str=this.str.slice(0,t);const r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const D2=e=>new ht(e.readString()),$2=[g2,x2,S2,A2,C2,E2,T2],B2=0,H2=1,z2=2,U2=3,F2=4,q2=5,V2=6;class ft{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new ft(this.type._copy())}splice(t){throw ct()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(t.beforeState.get(r.id.client)||0)&&t._mergeStructs.push(r):r.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}}const W2=e=>new ft($2[e.readTypeRef()](e)),Gl=(e,t)=>{let n=t,r=0,i;do r>0&&(n=ee(n.client,n.clock+r)),i=Vn(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof ue);return{item:i,diff:r}},Hc=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},Yi=(e,t,n)=>{const{client:r,clock:i}=t.id,o=new ue(ee(r,i+n),t,ee(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&o.markDeleted(),t.keep&&(o.keep=!0),t.redone!==null&&(o.redone=ee(t.redone.client,t.redone.clock+n)),t.right=o,o.right!==null&&(o.right.left=o),e._mergeStructs.push(o),o.parentSub!==null&&o.right===null&&o.parent._map.set(o.parentSub,o),t.length=n,o},Nd=(e,t)=>xw(e,n=>nr(n.deletions,t)),zg=(e,t,n,r,i,o)=>{const s=e.doc,a=s.store,l=s.clientID,c=t.redone;if(c!==null)return Fe(e,c);let d=t.parent._item,u=null,h;if(d!==null&&d.deleted===!0){if(d.redone===null&&(!n.has(d)||zg(e,d,n,r,i,o)===null))return null;for(;d.redone!==null;)d=Fe(e,d.redone)}const p=d===null?t.parent:d.content.type;if(t.parentSub===null){for(u=t.left,h=t;u!==null;){let y=u;for(;y!==null&&y.parent._item!==d;)y=y.redone===null?null:Fe(e,y.redone);if(y!==null&&y.parent._item===d){u=y;break}u=u.left}for(;h!==null;){let y=h;for(;y!==null&&y.parent._item!==d;)y=y.redone===null?null:Fe(e,y.redone);if(y!==null&&y.parent._item===d){h=y;break}h=h.right}}else if(h=null,t.right&&!i){for(u=t;u!==null&&u.right!==null&&(u.right.redone||nr(r,u.right.id)||Nd(o.undoStack,u.right.id)||Nd(o.redoStack,u.right.id));)for(u=u.right;u.redone;)u=Fe(e,u.redone);if(u&&u.right!==null)return null}else u=p._map.get(t.parentSub)||null;const g=Ae(a,l),m=ee(l,g),x=new ue(m,u,u&&u.lastId,h,h&&h.id,p,t.parentSub,t.content.copy());return t.redone=m,Hc(x,!0),x.integrate(e,0),x};class ue extends Bc{constructor(t,n,r,i,o,s,a,l){super(t,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=o,this.parent=s,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?ud:0}set marker(t){(this.info&ws)>0!==t&&(this.info^=ws)}get marker(){return(this.info&ws)>0}get keep(){return(this.info&cd)>0}set keep(t){this.keep!==t&&(this.info^=cd)}get countable(){return(this.info&ud)>0}get deleted(){return(this.info&bs)>0}set deleted(t){this.deleted!==t&&(this.info^=bs)}markDeleted(){this.info|=bs}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ae(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ae(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===qn&&this.id.client!==this.parent.client&&this.parent.clock>=Ae(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Ad(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Fe(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===et||this.right&&this.right.constructor===et)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===ue?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===ue&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===qn){const r=Vn(n,this.parent);r.constructor===et?this.parent=null:this.parent=r.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=Ad(t,t.doc.store,ee(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const o=new Set,s=new Set;for(;i!==null&&i!==this.right;){if(s.add(i),o.add(i),ui(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,o.clear();else if(ui(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&s.has(Vn(t.doc.store,i.origin)))o.has(Vn(t.doc.store,i.origin))||(r=i,o.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),vg(t.doc.store,this),this.content.integrate(t,this),Ed(t,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new et(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:ee(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&ui(t.origin,this.lastId)&&this.right===t&&ui(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===t&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),$r(t.deleteSet,this.id.client,this.id.clock,this.length),Ed(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw We();this.content.gc(t),n?JS(t,this,new et(this.id,this.length)):this.content=new Fr(this.length)}write(t,n){const r=n>0?ee(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,o=this.parentSub,s=this.content.getRef()&No|(r===null?0:Be)|(i===null?0:Dt)|(o===null?0:Pr);if(t.writeInfo(s),r!==null&&t.writeLeftID(r),i!==null&&t.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const c=Br(a);t.writeParentInfo(!0),t.writeString(c)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else a.constructor===String?(t.writeParentInfo(!0),t.writeString(a)):a.constructor===qn?(t.writeParentInfo(!1),t.writeLeftID(a)):We();o!==null&&t.writeString(o)}this.content.write(t,n)}}const Ug=(e,t)=>G2[t&No](e),G2=[()=>{We()},R2,N2,_2,D2,j2,M2,W2,L2,O2,()=>{We()}],K2=10;class st extends Bc{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor!==t.constructor?!1:(this.length+=t.length,!0)}integrate(t,n){We()}write(t,n){t.writeInfo(K2),se(t.restEncoder,this.length-n)}getMissing(t,n){return null}}const Fg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},qg="__ $YJS$ __";Fg[qg]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");Fg[qg]=!0;const Y2=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},X2=/[\uD800-\uDBFF]/,J2=/[\uDC00-\uDFFF]/,Z2=(e,t)=>{let n=0,r=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;for(n>0&&X2.test(e[n-1])&&n--;r+n<e.length&&r+n<t.length&&e[e.length-r-1]===t[t.length-r-1];)r++;return r>0&&J2.test(e[e.length-r])&&r--,{index:n,remove:e.length-n-r,insert:t.slice(n,t.length-r)}},Q2=Z2,bt=(e,t)=>e>>>t|e<<32-t,eC=e=>bt(e,2)^bt(e,13)^bt(e,22),tC=e=>bt(e,6)^bt(e,11)^bt(e,25),nC=e=>bt(e,7)^bt(e,18)^e>>>3,rC=e=>bt(e,17)^bt(e,19)^e>>>10,iC=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),oC=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class sC{constructor(){const t=new ArrayBuffer(320);this._H=new Uint32Array(t,0,8),this._H.set(oC),this._W=new Uint32Array(t,64,64)}_updateHash(){const t=this._H,n=this._W;for(let u=16;u<64;u++)n[u]=rC(n[u-2])+n[u-7]+nC(n[u-15])+n[u-16];let r=t[0],i=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],d=t[7];for(let u=0,h,p;u<64;u++)h=d+tC(a)+(a&l^~a&c)+iC[u]+n[u]>>>0,p=eC(r)+(r&i^r&o^i&o)>>>0,d=c,c=l,l=a,a=s+h>>>0,s=o,o=i,i=r,r=h+p>>>0;t[0]+=r,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=l,t[6]+=c,t[7]+=d}digest(t){let n=0;for(;n+56<=t.length;){let s=0;for(;s<16&&n+3<t.length;s++)this._W[s]=t[n++]<<24|t[n++]<<16|t[n++]<<8|t[n++];if(n%64!==0){for(this._W.fill(0,s,16);n<t.length;)this._W[s]|=t[n]<<(3-n%4)*8,n++;this._W[s]|=Be<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<t.length;i++)for(let s=3;s>=0&&n<t.length;s--)this._W[i]|=t[n++]<<s*8;r||(this._W[i-(n%4===0?0:1)]|=Be<<(3-n%4)*8),this._W[14]=t.byteLength/yw,this._W[15]=t.byteLength*8,this._updateHash();const o=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let a=0;a<4;a++)o[s*4+a]=this._H[s]>>>(3-a)*8;return o}}const aC=e=>new sC().digest(e),ve=new v.PluginKey("y-sync"),$t=new v.PluginKey("y-undo");new v.PluginKey("yjs-cursor");const lC=e=>{for(let n=6;n<e.length;n++)e[n%6]=e[n%6]^e[n];return e.slice(0,6)},cC=e=>mS(lC(aC(xS(e)))),Xi=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&t.sv.get(e.id.client)>e.id.clock&&!nr(t.ds,e.id),uC=[{light:"#ecd44433",dark:"#ecd444"}],dC=(e,t,n)=>{if(!e.has(n)){if(e.size<t.length){const r=Cn();e.forEach(i=>r.add(i)),t=t.filter(i=>!r.has(i))}e.set(n,Jw(t))}return e.get(n)},hC=(e,{colors:t=uC,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:o}={})=>{let s=!1;const a=new gC(e,o),l=new v.Plugin({props:{editable:c=>{const d=ve.getState(c);return d.snapshot==null&&d.prevSnapshot==null}},key:ve,state:{init:(c,d)=>({type:e,doc:e.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:t,colorMapping:n,permanentUserData:r}),apply:(c,d)=>{const u=c.getMeta(ve);if(u!==void 0){d=Object.assign({},d);for(const h in u)d[h]=u[h]}return d.addToHistory=c.getMeta("addToHistory")!==!1,d.isChangeOrigin=u!==void 0&&!!u.isChangeOrigin,d.isUndoRedoOperation=u!==void 0&&!!u.isChangeOrigin&&!!u.isUndoRedoOperation,a.prosemirrorView!==null&&u!==void 0&&(u.snapshot!=null||u.prevSnapshot!=null)&&og(0,()=>{a.prosemirrorView!=null&&(u.restore==null?a._renderSnapshot(u.snapshot,u.prevSnapshot,d):(a._renderSnapshot(u.snapshot,u.snapshot,d),delete d.restore,delete d.snapshot,delete d.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),d}},view:c=>(a.initView(c),o==null&&a._forceRerender(),i(),{update:()=>{const d=l.getState(c.state);if(d.snapshot==null&&d.prevSnapshot==null&&(s||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(s=!0,d.addToHistory===!1&&!d.isChangeOrigin){const u=$t.getState(c.state),h=u&&u.undoManager;h&&h.stopCapturing()}a.mux(()=>{d.doc.transact(u=>{u.meta.set("addToHistory",d.addToHistory),a._prosemirrorChanged(c.state.doc)},ve)})}},destroy:()=>{a.destroy()}})});return l},fC=(e,t,n)=>{if(t!==null&&t.anchor!==null&&t.head!==null)if(t.type==="all")e.setSelection(new v.AllSelection(e.doc));else if(t.type==="node"){const r=Sr(n.doc,n.type,t.anchor,n.mapping);e.setSelection(pC(e,r))}else{const r=Sr(n.doc,n.type,t.anchor,n.mapping),i=Sr(n.doc,n.type,t.head,n.mapping);r!==null&&i!==null&&e.setSelection(v.TextSelection.between(e.doc.resolve(r),e.doc.resolve(i)))}},pC=(e,t)=>{const n=e.doc.resolve(t);return n.nodeAfter?v.NodeSelection.create(e.doc,t):v.TextSelection.near(n)},Kl=(e,t)=>({type:t.selection.jsonID,anchor:Zi(t.selection.anchor,e.type,e.mapping),head:Zi(t.selection.head,e.type,e.mapping)});class gC{constructor(t,n=new Map){this.type=t,this.prosemirrorView=null,this.mux=Y2(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=t.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Kl(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(rg&&this._domSelectionInView===null&&(og(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const t=this.prosemirrorView._root.getSelection();if(t==null||t.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(t.anchorNode,t.anchorOffset),n.setEnd(t.focusNode,t.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),o=vS.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||o.clientWidth||0)&&i.top<=(window.innerHeight||o.clientHeight||0)}renderSnapshot(t,n){n||(n=xg(fg(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(ve,{snapshot:t,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const t=this.type.toArray().map(r=>Oi(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new v.Slice(v.Fragment.from(t),0,0));n.setMeta(ve,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const t=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>Oi(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new v.Slice(v.Fragment.from(n),0,0));if(t){const i=Yn(un(t.anchor,0),r.doc.content.size),o=Yn(un(t.head,0),r.doc.content.size);r.setSelection(v.TextSelection.create(r.doc,i,o))}this.prosemirrorView.dispatch(r.setMeta(ve,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(t,n,r){let i=this.doc,o=this.type;if(t||(t=Es(this.doc)),t instanceof Uint8Array||n instanceof Uint8Array)if((!(t instanceof Uint8Array)||!(n instanceof Uint8Array))&&We(),i=new On({gc:!1}),Fl(i,n),n=Es(i),Fl(i,t),t=Es(i),o._item===null){const s=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);o=i.getXmlFragment(s)}else{const s=i.store.clients.get(o._item.id.client)??[],a=dt(s,o._item.id.clock);o=s[a].content.type}this.mapping.clear(),this.mux(()=>{i.transact(s=>{const a=r.permanentUserData;a&&a.dss.forEach(u=>{hn(s,u,h=>{})});const l=(u,h)=>{const p=u==="added"?a.getUserByClientId(h.client):a.getUserByDeletedId(h);return{user:p,type:u,color:dC(r.colorMapping,r.colors,p)}},c=Ig(o,new Pc(n.ds,t.sv)).map(u=>!u._item.deleted||Xi(u._item,t)||Xi(u._item,n)?Oi(u,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},t,n,l):null).filter(u=>u!==null),d=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new v.Slice(v.Fragment.from(c),0,0));this.prosemirrorView.dispatch(d.setMeta(ve,{isChangeOrigin:!0}))},ve)})}_typeChanged(t,n){if(this.prosemirrorView==null)return;const r=ve.getState(this.prosemirrorView.state);if(t.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(a,l)=>this.mapping.delete(l);hn(n,n.deleteSet,a=>{if(a.constructor===ue){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const o=this.type.toArray().map(a=>Vg(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new v.Slice(v.Fragment.from(o),0,0));fC(s,this.beforeTransactionSelection,this),s=s.setMeta(ve,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof Sg}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(t){this.doc.transact(()=>{Xl(this.doc,this.type,t,this),this.beforeTransactionSelection=Kl(this,this.prosemirrorView.state)},ve)}initView(t){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=t,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const Vg=(e,t,n,r,i,o)=>{const s=n.mapping.get(e);if(s===void 0){if(e instanceof Ne)return Oi(e,t,n,r,i,o);throw ct()}return s},Oi=(e,t,n,r,i,o)=>{const s=[],a=l=>{var c,d;if(l instanceof Ne){const u=Vg(l,t,n,r,i,o);u!==null&&s.push(u)}else{const u=(d=(c=l._item.right)==null?void 0:c.content)==null?void 0:d.type;u instanceof fn&&!u._item.deleted&&u._item.id.client===u.doc.clientID&&(l.applyDelta([{retain:l.length},...u.toDelta()]),u.doc.transact(p=>{u._item.delete(p)}));const h=mC(l,t,n,r,i,o);h!==null&&h.forEach(p=>{p!==null&&s.push(p)})}};r===void 0||i===void 0?e.toArray().forEach(a):Ig(e,new Pc(i.ds,r.sv)).forEach(a);try{const l=e.getAttributes(r);r!==void 0&&(Xi(e._item,r)?Xi(e._item,i)||(l.ychange=o?o("added",e._item.id):{type:"added"}):l.ychange=o?o("removed",e._item.id):{type:"removed"});const c=t.node(e.nodeName,l,s);return n.mapping.set(e,c),c}catch{return e.doc.transact(c=>{e._item.delete(c)},ve),n.mapping.delete(e),null}},mC=(e,t,n,r,i,o)=>{const s=[],a=e.toDelta(r,i,o);try{for(let l=0;l<a.length;l++){const c=a[l];s.push(t.text(c.insert,SC(c.attributes,t)))}}catch{return e.doc.transact(c=>{e._item.delete(c)},ve),null}return s},xC=(e,t)=>{const n=new qe,r=e.map(i=>({insert:i.text,attributes:Gg(i.marks,t)}));return n.applyDelta(r),t.mapping.set(n,e),n},yC=(e,t)=>{const n=new Ne(e.type.name);for(const r in e.attrs){const i=e.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,Uo(e).map(r=>Yl(r,t))),t.mapping.set(n,e),n},Yl=(e,t)=>e instanceof Array?xC(e,t):yC(e,t),Pd=e=>typeof e=="object"&&e!==null,zc=(e,t)=>{const n=Object.keys(e).filter(i=>e[i]!==null);let r=n.length===Object.keys(t).filter(i=>t[i]!==null).length;for(let i=0;i<n.length&&r;i++){const o=n[i],s=e[o],a=t[o];r=o==="ychange"||s===a||Pd(s)&&Pd(a)&&zc(s,a)}return r},Uo=e=>{const t=e.content.content,n=[];for(let r=0;r<t.length;r++){const i=t[r];if(i.isText){const o=[];for(let s=t[r];r<t.length&&s.isText;s=t[++r])o.push(s);r--,n.push(o)}else n.push(i)}return n},Wg=(e,t)=>{const n=e.toDelta();return n.length===t.length&&n.every((r,i)=>r.insert===t[i].text&&eg(r.attributes||{}).length===t[i].marks.length&&tg(r.attributes,(o,s)=>{var d;const a=Uc(s),l=t[i].marks;return l.find(u=>u.type.name===a)?zc(o,(d=l.find(u=>u.type.name===a))==null?void 0:d.attrs):!1}))},qr=(e,t)=>{if(e instanceof Ne&&!(t instanceof Array)&&Jl(e,t)){const n=Uo(t);return e._length===n.length&&zc(e.getAttributes(),t.attrs)&&e.toArray().every((r,i)=>qr(r,n[i]))}return e instanceof qe&&t instanceof Array&&Wg(e,t)},Ji=(e,t)=>e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((n,r)=>t[r]===n),Ld=(e,t,n)=>{const r=e.toArray(),i=Uo(t),o=i.length,s=r.length,a=Yn(s,o);let l=0,c=0,d=!1;for(;l<a;l++){const u=r[l],h=i[l];if(Ji(n.mapping.get(u),h))d=!0;else if(!qr(u,h))break}for(;l+c<a;c++){const u=r[s-c-1],h=i[o-c-1];if(Ji(n.mapping.get(u),h))d=!0;else if(!qr(u,h))break}return{equalityFactor:l+c,foundMappedChild:d}},vC=e=>{let t="",n=e._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof ht?t+=n.content.str:n.content instanceof Ee&&(r[n.content.key]=null)),n=n.right;return{str:t,nAttrs:r}},bC=(e,t,n)=>{n.mapping.set(e,t);const{nAttrs:r,str:i}=vC(e),o=t.map(c=>({insert:c.text,attributes:Object.assign({},r,Gg(c.marks,n))})),{insert:s,remove:a,index:l}=Q2(i,o.map(c=>c.insert).join(""));e.delete(l,a),e.insert(l,s),e.applyDelta(o.map(c=>({retain:c.insert.length,attributes:c.attributes})))},wC=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Uc=e=>{var t;return((t=wC.exec(e))==null?void 0:t[1])??e},SC=(e,t)=>{const n=[];for(const r in e)n.push(t.mark(Uc(r),e[r]));return n},Gg=(e,t)=>{const n={};return e.forEach(r=>{if(r.type.name!=="ychange"){const i=Ft(t.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${cC(r.toJSON())}`:r.type.name]=r.attrs}}),n},Xl=(e,t,n,r)=>{if(t instanceof Ne&&t.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(t,n),t instanceof Ne){const u=t.getAttributes(),h=n.attrs;for(const p in h)h[p]!==null?u[p]!==h[p]&&p!=="ychange"&&t.setAttribute(p,h[p]):t.removeAttribute(p);for(const p in u)h[p]===void 0&&t.removeAttribute(p)}const i=Uo(n),o=i.length,s=t.toArray(),a=s.length,l=Yn(o,a);let c=0,d=0;for(;c<l;c++){const u=s[c],h=i[c];if(!Ji(r.mapping.get(u),h))if(qr(u,h))r.mapping.set(u,h);else break}for(;d+c+1<l;d++){const u=s[a-d-1],h=i[o-d-1];if(!Ji(r.mapping.get(u),h))if(qr(u,h))r.mapping.set(u,h);else break}e.transact(()=>{for(;a-c-d>0&&o-c-d>0;){const h=s[c],p=i[c],g=s[a-d-1],m=i[o-d-1];if(h instanceof qe&&p instanceof Array)Wg(h,p)||bC(h,p,r),c+=1;else{let x=h instanceof Ne&&Jl(h,p),y=g instanceof Ne&&Jl(g,m);if(x&&y){const w=Ld(h,p,r),A=Ld(g,m,r);w.foundMappedChild&&!A.foundMappedChild?y=!1:!w.foundMappedChild&&A.foundMappedChild||w.equalityFactor<A.equalityFactor?x=!1:y=!1}x?(Xl(e,h,p,r),c+=1):y?(Xl(e,g,m,r),d+=1):(r.mapping.delete(t.get(c)),t.delete(c,1),t.insert(c,[Yl(p,r)]),c+=1)}}const u=a-c-d;if(a===1&&o===0&&s[0]instanceof qe?(r.mapping.delete(s[0]),s[0].delete(0,s[0].length)):u>0&&(t.slice(c,c+u).forEach(h=>r.mapping.delete(h)),t.delete(c,u)),c+d<o){const h=[];for(let p=c;p<o-d;p++)h.push(Yl(i[p],r));t.insert(c,h)}},ve)},Jl=(e,t)=>!(t instanceof Array)&&e.nodeName===t.type.name,Zi=(e,t,n)=>{if(e===0)return ks(t,0,-1);let r=t._first===null?null:t._first.content.type;for(;r!==null&&t!==r;){if(r instanceof qe){if(r._length>=e)return ks(r,e,-1);if(e-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,e--;while(r!==t&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==t&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&e<i)r=r._first.content.type,e--;else{if(e===1&&r._length===0&&i>1)return new qi(r._item===null?null:r._item.id,r._item===null?Br(r):null,null);if(e-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(e===0)return r=r._item===null?r:r._item.parent,new qi(r._item===null?null:r._item.id,r._item===null?Br(r):null,null);do r=r._item.parent,e--;while(r!==t&&r._item.next===null);r!==t&&(r=r._item.next.content.type)}}}if(r===null)throw We();if(e===0&&r.constructor!==qe&&r!==t)return CC(r._item.parent,r._item)}return ks(t,t._length,-1)},CC=(e,t)=>{let n=null,r=null;return e._item===null?r=Br(e):n=ee(e._item.id.client,e._item.id.clock),new qi(n,r,t.id)},Sr=(e,t,n,r)=>{const i=YS(n,e);if(i===null||i.type!==t&&!Hr(t,i.type._item))return null;let o=i.type,s=0;if(o.constructor===qe)s=i.index;else if(o._item===null||!o._item.deleted){let a=o._first,l=0;for(;l<o._length&&l<i.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof qe?s+=c._length:s+=r.get(c).nodeSize}a=a.right}s+=1}for(;o!==t&&o._item!==null;){const a=o._item.parent;if(a._item===null||!a._item.deleted){s+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===o)break;l.deleted||(c instanceof qe?s+=c._length:s+=r.get(c).nodeSize),l=l.right}}o=a}return s-1};function AC(e){const t=e.toArray(),n=r=>{let i;if(r instanceof qe)i=r.toDelta().map(s=>{const a={type:"text",text:s.insert};return s.attributes&&(a.marks=Object.keys(s.attributes).map(l=>{const c=s.attributes[l],u={type:Uc(l)};return Object.keys(c)&&(u.attrs=c),u})),a});else if(r instanceof Ne){i={type:r.nodeName};const o=r.getAttributes();Object.keys(o).length&&(i.attrs=o);const s=r.toArray();s.length&&(i.content=s.map(n).flat())}else We();return i};return{type:"doc",content:t.map(n)}}const kC=e=>{const t=$t.getState(e).undoManager;if(t!=null)return t.undo(),!0},EC=e=>{const t=$t.getState(e).undoManager;if(t!=null)return t.redo(),!0},TC=new Set(["paragraph"]),IC=(e,t)=>!(e instanceof ue)||!(e.content instanceof ft)||!(e.content.type instanceof fn||e.content.type instanceof Ne&&t.has(e.content.type.nodeName))||e.content.type._length===0,_C=({protectedNodes:e=TC,trackedOrigins:t=[],undoManager:n=null}={})=>new v.Plugin({key:$t,state:{init:(r,i)=>{const o=ve.getState(i),s=n||new Sg(o.type,{trackedOrigins:new Set([ve].concat(t)),deleteFilter:a=>IC(a,e),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(r,i,o,s)=>{const a=ve.getState(s).binding,l=i.undoManager,c=l.undoStack.length>0,d=l.redoStack.length>0;return a?{undoManager:l,prevSel:Kl(a,o),hasUndoOps:c,hasRedoOps:d}:c!==i.hasUndoOps||d!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):i}},view:r=>{const i=ve.getState(r.state),o=$t.getState(r.state).undoManager;return o.on("stack-item-added",({stackItem:s})=>{const a=i.binding;a&&s.meta.set(a,$t.getState(r.state).prevSel)}),o.on("stack-item-popped",({stackItem:s})=>{const a=i.binding;a&&(a.beforeTransactionSelection=s.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{o.destroy()}}}});function Kg(e){return!!e.getMeta(ve)}function RC(e,t){const n=ve.getState(e);return Sr(n.doc,n.type,t,n.binding.mapping)||0}function Yg(e,t){const n=ve.getState(e);return Zi(t,n.type,n.binding.mapping)}var ji=class Xg extends v.MappablePosition{constructor(t,n){super(t),this.yRelativePosition=n}static fromJSON(t){return new Xg(t.position,t.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function OC(e,t){const n=Yg(t,e);return new ji(e,n)}function jC(e,t,n){const r=e instanceof ji?e.yRelativePosition:null;if(Kg(t)&&r){const s=RC(n,r);return{position:new ji(s,r),mapResult:null}}const i=v.getUpdatedPosition(e,t),o=i.position.position;return{position:new ji(o,r??Yg(n,o)),mapResult:i.mapResult}}v.Extension.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(e=>e.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(e,t)=>jC(e,t,this.editor.state),this.editor.utils.createMappablePosition=e=>OC(e,this.editor.state)},addCommands(){return{undo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta("preventDispatch",!0),$t.getState(t).undoManager.undoStack.length===0?!1:n?kC(t):!0),redo:()=>({tr:e,state:t,dispatch:n})=>(e.setMeta("preventDispatch",!0),$t.getState(t).undoManager.redoStack.length===0?!1:n?EC(t):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var e;const t=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),n=_C(this.options.yUndoOptions),r=n.spec.view;n.spec.view=s=>{const{undoManager:a}=$t.getState(s.state);a.restore&&(a.restore(),a.restore=()=>{});const l=r?r(s):void 0;return{destroy:()=>{const c=a.trackedOrigins.has(a),d=a._observers;a.restore=()=>{c&&a.trackedOrigins.add(a),a.doc.on("afterTransaction",a.afterTransactionHandler),a._observers=d},l!=null&&l.destroy&&l.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},o=hC(t,i);return this.editor.options.enableContentCheck&&((e=t.doc)==null||e.on("beforeTransaction",()=>{try{const s=AC(t);if(s.content.length===0)return;this.editor.schema.nodeFromJSON(s).check()}catch(s){return this.editor.emit("contentError",{error:s,editor:this.editor,disableCollaboration:()=>{var a;(a=t.doc)==null||a.destroy(),this.storage.isDisabled=!0}}),!1}})),[o,n,this.editor.options.enableContentCheck&&new v.Plugin({key:new v.PluginKey("filterInvalidContent"),filterTransaction:()=>{var s;return this.storage.isDisabled!==!1&&((s=t.doc)==null||s.destroy()),!0}})].filter(Boolean)}});function Dd(e){if(!e.length)return v.DecorationSet.empty;const t=[],n=e[0].$from.node(0);return e.forEach(r=>{const i=r.$from.pos,o=r.$from.nodeAfter;o&&t.push(v.Decoration.node(i,i+o.nodeSize,{class:"ProseMirror-selectednoderange"}))}),v.DecorationSet.create(n,t)}function Fo(e,t,n){const r=[],i=e.node(0);typeof n=="number"&&n>=0||(e.sameParent(t)?n=Math.max(0,e.sharedDepth(t.pos)-1):n=e.sharedDepth(t.pos));const o=new v.NodeRange(e,t,n),s=o.depth===0?0:i.resolve(o.start).posAtIndex(0);return o.parent.forEach((a,l)=>{const c=s+l,d=c+a.nodeSize;if(c<o.start||c>=o.end)return;const u=new v.SelectionRange(i.resolve(c),i.resolve(d));r.push(u)}),r}var MC=class Jg{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Jg(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return new ln(n,r)}},ln=class tn extends v.Selection{constructor(t,n,r,i=1){const{doc:o}=t,s=t===n,a=t.pos===o.content.size&&n.pos===o.content.size,l=s&&!a?o.resolve(n.pos+(i>0?1:-1)):n,c=s&&a?o.resolve(t.pos-(i>0?1:-1)):t,d=Fo(c.min(l),c.max(l),r),u=l.pos>=t.pos?d[0].$from:d[d.length-1].$to,h=l.pos>=t.pos?d[d.length-1].$to:d[0].$from;super(u,h,d),this.depth=r}get $to(){return this.ranges[this.ranges.length-1].$to}eq(t){return t instanceof tn&&t.$from.pos===this.$from.pos&&t.$to.pos===this.$to.pos}map(t,n){const r=t.resolve(n.map(this.anchor)),i=t.resolve(n.map(this.head));return new tn(r,i)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:t}=this.$from;if(this.isForwards&&this.ranges.length>1){const i=this.ranges.slice(0,-1),o=i[0].$from,s=i[i.length-1].$to;return new tn(o,s,this.depth)}const n=this.ranges[0],r=t.resolve(Math.max(0,n.$from.pos-1));return new tn(this.$anchor,r,this.depth)}extendForwards(){const{doc:t}=this.$from;if(this.isBackwards&&this.ranges.length>1){const i=this.ranges.slice(1),o=i[0].$from,s=i[i.length-1].$to;return new tn(s,o,this.depth)}const n=this.ranges[this.ranges.length-1],r=t.resolve(Math.min(t.content.size,n.$to.pos+1));return new tn(this.$anchor,r,this.depth)}static fromJSON(t,n){return new tn(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r,i,o=1){return new this(t.resolve(n),t.resolve(r),i,o)}getBookmark(){return new MC(this.anchor,this.head)}};ln.prototype.visible=!1;function pi(e){return e instanceof ln}v.Extension.create({name:"nodeRange",addOptions(){return{depth:void 0,key:"Mod"}},addKeyboardShortcuts(){return{"Shift-ArrowUp":({editor:e})=>{const{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:o,tr:s}=r,{anchor:a,head:l}=o;if(!pi(o)){const d=ln.create(i,a,l,t,-1);return s.setSelection(d),n.dispatch(s),!0}const c=o.extendBackwards();return s.setSelection(c),n.dispatch(s),!0},"Shift-ArrowDown":({editor:e})=>{const{depth:t}=this.options,{view:n,state:r}=e,{doc:i,selection:o,tr:s}=r,{anchor:a,head:l}=o;if(!pi(o)){const d=ln.create(i,a,l,t);return s.setSelection(d),n.dispatch(s),!0}const c=o.extendForwards();return s.setSelection(c),n.dispatch(s),!0},"Mod-a":({editor:e})=>{const{depth:t}=this.options,{view:n,state:r}=e,{doc:i,tr:o}=r,s=ln.create(i,0,i.content.size,t);return o.setSelection(s),n.dispatch(o),!0}}},onSelectionUpdate(){const{selection:e}=this.editor.state;pi(e)&&this.editor.view.dom.classList.add("ProseMirror-noderangeselection")},addProseMirrorPlugins(){let e=!1,t=!1;return[new v.Plugin({key:new v.PluginKey("nodeRange"),props:{attributes:()=>e?{class:"ProseMirror-noderangeselection"}:{class:""},handleDOMEvents:{mousedown:(n,r)=>{const{key:i}=this.options,o=/Mac/.test(navigator.platform),s=!!r.shiftKey,a=!!r.ctrlKey,l=!!r.altKey,c=!!r.metaKey,d=o?c:a;return(i==null||i==="Shift"&&s||i==="Control"&&a||i==="Alt"&&l||i==="Meta"&&c||i==="Mod"&&d)&&(t=!0),t&&document.addEventListener("mouseup",()=>{t=!1;const{state:u}=n,{doc:h,selection:p,tr:g}=u,{$anchor:m,$head:x}=p;if(m.sameParent(x))return;const y=ln.create(h,m.pos,x.pos,this.options.depth);g.setSelection(y),n.dispatch(g)},{once:!0}),!1}},decorations:n=>{const{selection:r}=n,i=pi(r);if(e=!1,!t)return i?(e=!0,Dd(r.ranges)):null;const{$from:o,$to:s}=r;if(!i&&o.sameParent(s))return null;const a=Fo(o,s,this.options.depth);return a.length?(e=!0,Dd(a)):null}}})]}});function NC(e){let t="";const n=getComputedStyle(e);for(let r=0;r<n.length;r+=1)t+=`${n[r]}:${n.getPropertyValue(n[r])};`;return t}function PC(e){const t=e.cloneNode(!0),n=[e,...Array.from(e.getElementsByTagName("*"))],r=[t,...Array.from(t.getElementsByTagName("*"))];return n.forEach((i,o)=>{r[o].style.cssText=NC(i)}),t}function LC(e,t){let n=e;for(;n!=null&&n.parentElement&&n.parentElement!==t.dom;)n=n.parentElement;return(n==null?void 0:n.parentElement)===t.dom?n:void 0}function DC(e,t,n,r=5){const i=e.dom,o=i.firstElementChild,s=i.lastElementChild;if(!o||!s)return{x:t,y:n};const a=o.getBoundingClientRect(),l=s.getBoundingClientRect(),c=Math.min(Math.max(a.top+r,n),l.bottom-r),d=.5,u=Math.abs(a.left-l.left)<d,h=Math.abs(a.right-l.right)<d;let p=a;return u&&h&&(p=a),{x:Math.min(Math.max(p.left+r,t),p.right-r),y:c}}var Zg=e=>{const{x:t,y:n,editor:r}=e,{view:i,state:o}=r,{x:s,y:a}=DC(i,t,n,5),l=i.root.elementsFromPoint(s,a);let c;if(Array.prototype.some.call(l,h=>{if(!i.dom.contains(h))return!1;const p=LC(h,i);return p?(c=p,!0):!1}),!c)return{resultElement:null,resultNode:null,pos:null};let d;try{d=i.posAtDOM(c,0)}catch{return{resultElement:null,resultNode:null,pos:null}}const u=o.doc.nodeAt(d);return{resultElement:c,resultNode:u,pos:d}};function gi(e,t){return window.getComputedStyle(e)[t]}function $C(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function BC(e,t,n){const r=parseInt(gi(e.dom,"paddingLeft"),10),i=parseInt(gi(e.dom,"paddingRight"),10),o=parseInt(gi(e.dom,"borderLeftWidth"),10),s=parseInt(gi(e.dom,"borderLeftWidth"),10),a=e.dom.getBoundingClientRect();return{left:$C(t,a.left+r+o,a.right-i-s),top:n}}function Qg(e){var t;(t=e.parentNode)==null||t.removeChild(e)}function HC(e,t){const{doc:n}=t.view.state,r=Zg({editor:t,x:e.clientX,y:e.clientY});if(!r.resultNode||r.pos===null)return[];const i=e.clientX,o=BC(t.view,i,e.clientY),s=t.view.posAtCoords(o);if(!s)return[];const{pos:a}=s;if(!n.resolve(a).parent)return[];const c=n.resolve(r.pos),d=n.resolve(r.pos+1);return Fo(c,d,0)}function zC(e,t){const{view:n}=t;if(!e.dataTransfer)return;const{empty:r,$from:i,$to:o}=n.state.selection,s=HC(e,t),a=Fo(i,o,0),l=a.some(x=>s.find(y=>y.$from===x.$from&&y.$to===x.$to)),c=r||!l?s:a;if(!c.length)return;const{tr:d}=n.state,u=document.createElement("div"),h=c[0].$from.pos,p=c[c.length-1].$to.pos,g=ln.create(n.state.doc,h,p),m=g.content();c.forEach(x=>{const y=n.nodeDOM(x.$from.pos),w=PC(y);u.append(w)}),u.style.position="absolute",u.style.top="-10000px",document.body.append(u),e.dataTransfer.clearData(),e.dataTransfer.setDragImage(u,0,0),n.dragging={slice:m,move:!0},d.setSelection(g),n.dispatch(d),document.addEventListener("drop",()=>Qg(u),{once:!0})}var $d=(e,t)=>{const n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1},Bd=(e,t)=>{const n=e.nodeAt(t),r=e.resolve(t);let{depth:i}=r,o=n;for(;i>0;){const s=r.node(i);i-=1,i===0&&(o=s)}return o},_s=(e,t)=>{const n=ve.getState(e);return n?Zi(t,n.type,n.binding.mapping):null},UC=(e,t)=>{const n=ve.getState(e);return n?Sr(n.doc,n.type,t,n.binding.mapping)||0:-1},Hd=(e,t)=>{let n=t;for(;n!=null&&n.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n},em=new v.PluginKey("dragHandle"),tm=({pluginKey:e=em,element:t,editor:n,computePositionConfig:r,getReferencedVirtualElement:i,onNodeChange:o,onElementDragStart:s,onElementDragEnd:a})=>{const l=document.createElement("div");let c=!1,d=null,u=-1,h,p=null,g=null;function m(){t&&(t.style.visibility="hidden",t.style.pointerEvents="none")}function x(){if(t){if(!n.isEditable){m();return}t.style.visibility="",t.style.pointerEvents="auto"}}function y(I){const E=(i==null?void 0:i())||{getBoundingClientRect:()=>I.getBoundingClientRect()};re.computePosition(E,t,r).then(M=>{Object.assign(t.style,{position:M.strategy,left:`${M.x}px`,top:`${M.y}px`})})}function w(I){s==null||s(I),zC(I,n),setTimeout(()=>{t&&(t.style.pointerEvents="none")},0)}function A(I){a==null||a(I),m(),t&&(t.style.pointerEvents="auto")}return t.addEventListener("dragstart",w),t.addEventListener("dragend",A),l.appendChild(t),{unbind(){t.removeEventListener("dragstart",w),t.removeEventListener("dragend",A),p&&(cancelAnimationFrame(p),p=null,g=null)},plugin:new v.Plugin({key:typeof e=="string"?new v.PluginKey(e):e,state:{init(){return{locked:!1}},apply(I,E,M,T){const _=I.getMeta("lockDragHandle"),R=I.getMeta("hideDragHandle");if(_!==void 0&&(c=_),R)return m(),c=!1,d=null,u=-1,o==null||o({editor:n,node:null,pos:-1}),E;if(I.docChanged&&u!==-1&&t)if(Kg(I)){const D=UC(T,h);D!==u&&(u=D)}else{const D=I.mapping.map(u);D!==u&&(u=D,h=_s(T,u))}return E}},view:I=>{var E;return t.draggable=!0,t.style.pointerEvents="auto",(E=n.view.dom.parentElement)==null||E.appendChild(l),l.style.pointerEvents="none",l.style.position="absolute",l.style.top="0",l.style.left="0",{update(M,T){if(!t)return;if(!n.isEditable){m();return}if(c?t.draggable=!1:t.draggable=!0,I.state.doc.eq(T.doc)||u===-1)return;let _=I.nodeDOM(u);if(_=Hd(I,_),_===I.dom||(_==null?void 0:_.nodeType)!==1)return;const R=I.posAtDOM(_,0),D=Bd(n.state.doc,R),P=$d(n.state.doc,R);d=D,u=P,h=_s(I.state,u),o==null||o({editor:n,node:d,pos:u}),y(_)},destroy(){p&&(cancelAnimationFrame(p),p=null,g=null),t&&Qg(l)}}},props:{handleDOMEvents:{keydown(I){return!t||c||I.hasFocus()&&(m(),d=null,u=-1,o==null||o({editor:n,node:null,pos:-1})),!1},mouseleave(I,E){return c||E.target&&!l.contains(E.relatedTarget)&&(m(),d=null,u=-1,o==null||o({editor:n,node:null,pos:-1})),!1},mousemove(I,E){return!t||c||(g={x:E.clientX,y:E.clientY},p)||(p=requestAnimationFrame(()=>{if(p=null,!g)return;const{x:M,y:T}=g;g=null;const _=Zg({x:M,y:T,editor:n});if(!_.resultElement)return;let R=_.resultElement;if(R=Hd(I,R),R===I.dom||(R==null?void 0:R.nodeType)!==1)return;const D=I.posAtDOM(R,0),P=Bd(n.state.doc,D);if(P!==d){const k=$d(n.state.doc,D);d=P,u=k,h=_s(I.state,u),o==null||o({editor:n,node:d,pos:u}),y(R),x()}})),!1}}}})}},Zl={placement:"left-start",strategy:"absolute"};v.Extension.create({name:"dragHandle",addOptions(){return{render(){const e=document.createElement("div");return e.classList.add("drag-handle"),e},computePositionConfig:{},locked:!1,onNodeChange:()=>null,onElementDragStart:void 0,onElementDragEnd:void 0}},addCommands(){return{lockDragHandle:()=>({editor:e})=>(this.options.locked=!0,e.commands.setMeta("lockDragHandle",this.options.locked)),unlockDragHandle:()=>({editor:e})=>(this.options.locked=!1,e.commands.setMeta("lockDragHandle",this.options.locked)),toggleDragHandle:()=>({editor:e})=>(this.options.locked=!this.options.locked,e.commands.setMeta("lockDragHandle",this.options.locked))}},addProseMirrorPlugins(){const e=this.options.render();return[tm({computePositionConfig:{...Zl,...this.options.computePositionConfig},getReferencedVirtualElement:this.options.getReferencedVirtualElement,element:e,editor:this.editor,onNodeChange:this.options.onNodeChange,onElementDragStart:this.options.onElementDragStart,onElementDragEnd:this.options.onElementDragEnd}).plugin]}});var FC=e=>{const{className:t="drag-handle",children:n,editor:r,pluginKey:i=em,onNodeChange:o,onElementDragStart:s,onElementDragEnd:a,computePositionConfig:l=Zl}=e,[c,d]=C.useState(null),u=C.useRef(null);return C.useEffect(()=>{let h=null;return c?r.isDestroyed?()=>{u.current=null}:(u.current||(h=tm({editor:r,element:c,pluginKey:i,computePositionConfig:{...Zl,...l},onElementDragStart:s,onElementDragEnd:a,onNodeChange:o}),u.current=h.plugin,r.registerPlugin(u.current)),()=>{r.unregisterPlugin(i),u.current=null,h&&(h.unbind(),h=null)}):()=>{u.current=null}},[c,r,o,i,l,s,a]),f.jsx("div",{className:t,style:{visibility:"hidden",position:"absolute"},ref:d,children:n})},qC=FC,Qi=(e=>(e[e.max=7]="max",e[e.min=0]="min",e[e.more=1]="more",e[e.less=-1]="less",e))(Qi||{});function VC(e,t,n){return e<t?t:e>n?n:e}function WC(e,t,n,r){const{doc:i,selection:o}=e;if(!i||!o||!(o instanceof v.TextSelection||o instanceof v.AllSelection))return e;const{from:s,to:a}=o;return i.nodesBetween(s,a,(l,c)=>{const d=l.type;return n.includes(d.name)?(e=Ql(e,c,t),!1):!v.isList(l.type.name,r.extensionManager.extensions)}),e}function Ql(e,t,n){if(!e.doc)return e;const r=e.doc.nodeAt(t);if(!r)return e;const s=VC((r.attrs.indent||0)+n,0,7);if(s===r.attrs.indent)return e;const a={...r.attrs,indent:s};return e.setNodeMarkup(t,r.type,a,r.marks)}function GC({delta:e,types:t}){return({state:n,dispatch:r,editor:i})=>{const{selection:o}=n;let{tr:s}=n;return s=s.setSelection(o),s=WC(s,e,t,i),s.docChanged?(r&&r(s),!0):!1}}function KC(e){var E,M;const{t}=z.useLocale(),[n,r]=C.useState(null),[i,o]=C.useState(-1),[s,a]=C.useState(!1),l=e.editor.extensionManager.extensions.some(T=>T.name==="textAlign"),c=e.editor.extensionManager.extensions.some(T=>T.name==="indent"),d=e.editor.extensionManager.extensions.some(T=>T.name==="clear");function u(){const T=e.editor.chain();T.setNodeSelection(i).unsetAllMarks(),(n==null?void 0:n.type.name)!=="paragraph"&&T.setParagraph(),T.run()}function h(){e.editor.chain().focus().setNodeSelection(i).run(),document.execCommand("copy")}function p(){e.editor.commands.setNodeSelection(i);const{$anchor:T}=e.editor.state.selection,_=T.node(1)||e.editor.state.selection.node;e.editor.chain().setMeta("hideDragHandle",!0).insertContentAt(i+((n==null?void 0:n.nodeSize)||0),_.toJSON()).run()}function g(T){e.editor.commands.setTextAlign(T)}function m(){const T=Ql(e.editor.state.tr,i,1);T.setMeta("hideDragHandle",!0),e.editor.view.dispatch&&e.editor.view.dispatch(T)}function x(){const T=Ql(e.editor.state.tr,i,-1);e.editor.view.dispatch&&e.editor.view.dispatch(T)}function y(){e.editor.chain().setMeta("hideDragHandle",!0).setNodeSelection(i).deleteSelection().run()}function w({node:T,pos:_}){T&&r(T),o(_)}function A(){var T;if(i!==-1){const _=(n==null?void 0:n.nodeSize)||0,R=i+_,D=(n==null?void 0:n.type.name)==="paragraph"&&((T=n==null?void 0:n.content)==null?void 0:T.size)===0,P=D?i+2:R+2;e.editor.chain().command(({dispatch:k,tr:O,state:B})=>k?(D?O.insertText("/",i,i+1):O.insert(R,B.schema.nodes.paragraph.create(null,[B.schema.text("/")])),k(O)):!0).focus(P).run()}}C.useEffect(()=>(s?e.editor.commands.setMeta("lockDragHandle",!0):e.editor.commands.setMeta("lockDragHandle",!1),()=>{e.editor.commands.setMeta("lockDragHandle",!1)}),[s]);const I=T=>{e!=null&&e.disabled||a(T)};return f.jsx(qC,{editor:e==null?void 0:e.editor,onNodeChange:w,children:f.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-0.5 richtext-duration-200 richtext-ease-in-out [transition-property:top,_left]",children:[f.jsx(Oe,{className:"!richtext-size-7 richtext-cursor-grab",disabled:e==null?void 0:e.disabled,onClick:A,size:"icon",type:"button",variant:"ghost",children:f.jsx(Ce,{className:"richtext-text-lg richtext-text-neutral-600 dark:richtext-text-neutral-200",name:"Plus"})}),f.jsxs(Dm,{onOpenChange:I,open:s,children:[f.jsxs("div",{className:"richtext-relative richtext-flex richtext-flex-col",children:[f.jsxs(du,{children:[f.jsx(hu,{asChild:!0,disabled:e==null?void 0:e.disabled,children:f.jsx(Oe,{className:"richtext-relative richtext-z-[1] !richtext-size-7 richtext-cursor-grab",disabled:e==null?void 0:e.disabled,size:"icon",type:"button",variant:"ghost",onMouseUp:T=>{T.preventDefault(),!(e!=null&&e.disabled)&&a(!0)},children:f.jsx(Ce,{className:"richtext-text-sm richtext-text-neutral-600 dark:richtext-text-neutral-200",name:"Grip"})})}),f.jsx(Jo,{children:t("editor.draghandle.tooltip")})]}),f.jsx($m,{className:"richtext-absolute richtext-left-0 richtext-top-0 richtext-z-0 richtext-size-[28px]"})]}),f.jsxs(su,{align:"start",className:"richtext-w-48",side:"bottom",sideOffset:0,children:[f.jsxs(xt,{className:"richtext-flex richtext-gap-3 richtext-bg-opacity-10 hover:richtext-bg-red-400 hover:richtext-bg-opacity-20 focus:richtext-bg-red-400 focus:richtext-bg-opacity-30 focus:richtext-text-red-500 dark:hover:richtext-bg-opacity-20 dark:hover:richtext-text-red-500",onClick:y,children:[f.jsx(Ce,{name:"Trash2"}),f.jsx("span",{children:t("editor.remove")})]}),d?f.jsxs(xt,{className:"richtext-flex richtext-gap-3",onClick:u,children:[f.jsx(Ce,{name:"PaintRoller"}),f.jsx("span",{children:t("editor.clear.tooltip")})]}):null,f.jsxs(xt,{className:"richtext-flex richtext-gap-3",onClick:h,children:[f.jsx(Ce,{name:"Clipboard"}),f.jsx("span",{children:t("editor.copyToClipboard")})]}),f.jsxs(xt,{className:"richtext-flex richtext-gap-3",onClick:p,children:[f.jsx(Ce,{name:"Copy"}),f.jsx("span",{children:t("editor.copy")})]}),l||c?f.jsx(au,{}):null,l?f.jsxs(ah,{children:[f.jsxs(fc,{className:"richtext-flex richtext-gap-3",children:[f.jsx(Ce,{name:"AlignCenter"}),f.jsx("span",{children:t("editor.textalign.tooltip")})]}),f.jsx(sh,{children:f.jsxs(pc,{children:[f.jsxs(xt,{className:"richtext-flex richtext-gap-3",onClick:()=>g("left"),children:[f.jsx(Ce,{name:"AlignLeft"}),f.jsx("span",{children:t("editor.textalign.left.tooltip")})]}),f.jsxs(xt,{className:"richtext-flex richtext-gap-3",onClick:()=>g("center"),children:[f.jsx(Ce,{name:"AlignCenter"}),f.jsx("span",{children:t("editor.textalign.center.tooltip")})]}),f.jsxs(xt,{className:"richtext-flex richtext-gap-3",onClick:()=>g("right"),children:[f.jsx(Ce,{name:"AlignRight"}),f.jsx("span",{children:t("editor.textalign.right.tooltip")})]})]})})]}):null,c?f.jsxs(ah,{children:[f.jsxs(fc,{className:"richtext-flex richtext-gap-3",children:[f.jsx(Ce,{name:"IndentIncrease"}),f.jsx("span",{children:t("editor.indent")})]}),f.jsx(sh,{children:f.jsxs(pc,{children:[f.jsxs(xt,{className:"richtext-flex richtext-gap-3",disabled:((E=n==null?void 0:n.attrs)==null?void 0:E.indent)>=Qi.max,onClick:m,children:[f.jsx(Ce,{name:"IndentIncrease"}),f.jsx("span",{children:t("editor.indent.tooltip")})]}),f.jsxs(xt,{className:"richtext-flex richtext-gap-3",disabled:((M=n==null?void 0:n.attrs)==null?void 0:M.indent)<=Qi.min,onClick:x,children:[f.jsx(Ce,{name:"IndentDecrease"}),f.jsx("span",{children:t("editor.outdent.tooltip")})]})]})})]}):null]})]})]})})}var ec,tc;if(typeof WeakMap<"u"){let e=new WeakMap;ec=t=>e.get(t),tc=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;ec=r=>{for(let i=0;i<e.length;i+=2)if(e[i]==r)return e[i+1]},tc=(r,i)=>(n==10&&(n=0),e[n++]=r,e[n++]=i)}var Se=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,i=t/this.width|0;let o=r+1,s=i+1;for(let a=1;o<this.width&&this.map[t+a]==n;a++)o++;for(let a=1;s<this.height&&this.map[t+this.width*a]==n;a++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:i,top:o,bottom:s}=this.findCell(e);return t=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(e,t){const{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==e.left&&i&&this.map[o-1]==s||r==e.top&&r&&this.map[o-this.width]==s)&&t.push(s))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==e){let s=t+e*this.width;const a=(e+1)*this.width;for(;s<a&&this.map[s]<i;)s++;return s==a?o-1:this.map[s]}i=o}}static get(e){return ec(e)||tc(e,YC(e))}};function YC(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=XC(e),n=e.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,d=t*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){const u=e.child(c);d++;for(let g=0;;g++){for(;i<r.length&&r[i]!=0;)i++;if(g==u.childCount)break;const m=u.child(g),{colspan:x,rowspan:y,colwidth:w}=m.attrs;for(let A=0;A<y;A++){if(A+c>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:d,n:y-A});break}const I=i+A*t;for(let E=0;E<x;E++){r[I+E]==0?r[I+E]=d:(o||(o=[])).push({type:"collision",row:c,pos:d,n:x-E});const M=w&&w[E];if(M){const T=(I+E)%t*2,_=s[T];_==null||_!=M&&s[T+1]==1?(s[T]=M,s[T+1]=1):_==M&&s[T+1]++}}}i+=x,d+=m.nodeSize}const h=(c+1)*t;let p=0;for(;i<h;)r[i++]==0&&p++;p&&(o||(o=[])).push({type:"missing",row:c,n:p}),d++}(t===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const a=new Se(t,n,r,o);let l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(l=!0);return l&&JC(a,s,e),a}function XC(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const i=e.child(r);let o=0;if(n)for(let s=0;s<r;s++){const a=e.child(s);for(let l=0;l<a.childCount;l++){const c=a.child(l);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const a=i.child(s);o+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}t==-1?t=o:t!=o&&(t=Math.max(t,o))}return t}function JC(e,t,n){e.problems||(e.problems=[]);const r={};for(let i=0;i<e.map.length;i++){const o=e.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null;const l=s.attrs;for(let c=0;c<l.colspan;c++){const d=(i+c)%e.width,u=t[d*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=ZC(l)))[c]=u)}a&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}function ZC(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Le(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var on=new v.PluginKey("selectingCells");function ir(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function QC(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function pt(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function qo(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=ir(t.$head)||eA(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function eA(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function nc(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function tA(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function Fc(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function nm(e,t,n){const r=e.node(-1),i=Se.get(r),o=e.start(-1),s=i.nextCell(e.pos-o,t,n);return s==null?null:e.node(0).resolve(o+s)}function Tn(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function rm(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(t,0,0)}return r}function nA(e,t,n){const r=Le(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var fe=class Nt extends v.Selection{constructor(t,n=t){const r=t.node(-1),i=Se.get(r),o=t.start(-1),s=i.rectBetween(t.pos-o,n.pos-o),a=t.node(0),l=i.cellsInRect(s).filter(d=>d!=n.pos-o);l.unshift(n.pos-o);const c=l.map(d=>{const u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);const h=o+d+1;return new v.SelectionRange(a.resolve(h),a.resolve(h+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(nc(r)&&nc(i)&&Fc(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Nt.rowSelection(r,i):o&&this.isColSelection()?Nt.colSelection(r,i):new Nt(r,i)}return v.TextSelection.between(r,i)}content(){const t=this.$anchorCell.node(-1),n=Se.get(t),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let d=l*n.width+i.left,u=i.left;u<i.right;u++,d++){const h=n.map[d];if(o[h])continue;o[h]=!0;const p=n.findCell(h);let g=t.nodeAt(h);if(!g)throw RangeError(`No cell with offset ${h} found`);const m=i.left-p.left,x=p.right-i.right;if(m>0||x>0){let y=g.attrs;if(m>0&&(y=Tn(y,0,m)),x>0&&(y=Tn(y,y.colspan-x,x)),p.left<i.left){if(g=g.type.createAndFill(y),!g)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else g=g.type.create(y,g.content)}if(p.top<i.top||p.bottom>i.bottom){const y={...g.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?g=g.type.createAndFill(y):g=g.type.create(y,g.content)}c.push(g)}s.push(t.child(l).copy(v.Fragment.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?t:s;return new v.Slice(v.Fragment.from(a),1,1)}replace(t,n=v.Slice.empty){const r=t.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:a,$to:l}=i[s],c=t.mapping.slice(r);t.replace(c.map(a.pos),c.map(l.pos),s?v.Slice.empty:n)}const o=v.Selection.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);o&&t.setSelection(o)}replaceWith(t,n){this.replace(t,new v.Slice(v.Fragment.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),r=Se.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)t(n.nodeAt(o[s]),i+o[s])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const r=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),i=Se.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(t=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Nt(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=Se.get(t),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(t){return t instanceof Nt&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),i=Se.get(r),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(n.pos-o),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(t=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new Nt(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new Nt(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new Nt(t.resolve(n),t.resolve(r))}getBookmark(){return new rA(this.$anchorCell.pos,this.$headCell.pos)}};fe.prototype.visible=!1;v.Selection.jsonID("cell",fe);var rA=class im{constructor(t,n){this.anchor=t,this.head=n}map(t){return new im(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Fc(n,r)?new fe(n,r):v.Selection.near(r,1)}};function iA(e){if(!(e.selection instanceof fe))return null;const t=[];return e.selection.forEachCell((n,r)=>{t.push(v.Decoration.node(r,r+n.nodeSize,{class:"selectedCell"}))}),v.DecorationSet.create(e.doc,t)}function oA({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let o=t.depth;o>=0&&!(t.before(o+1)>t.start(o));o--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function sA({$from:e,$to:t}){let n,r;for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=t.depth;i>0;i--){const o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&t.parentOffset===0}function aA(e,t,n){const r=(t||e).selection,i=(t||e).doc;let o,s;if(r instanceof v.NodeSelection&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=fe.create(i,r.from);else if(s=="row"){const a=i.resolve(r.from+1);o=fe.rowSelection(a,a)}else if(!n){const a=Se.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];o=fe.create(i,l+1,c)}}else r instanceof v.TextSelection&&oA(r)?o=v.TextSelection.create(i,r.from):r instanceof v.TextSelection&&sA(r)&&(o=v.TextSelection.create(i,r.$from.start(),r.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}var lA=new v.PluginKey("fix-tables");function om(e,t,n,r){const i=e.childCount,o=t.childCount;e:for(let s=0,a=0;s<o;s++){const l=t.child(s);for(let c=a,d=Math.min(i,s+3);c<d;c++)if(e.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<i&&e.child(a).sameMarkup(l)?om(e.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function sm(e,t){let n;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=cA(e,i,o,n))};return t?t.doc!=e.doc&&om(t.doc,e.doc,0,r):e.doc.descendants(r),n}function cA(e,t,n,r){const i=Se.get(t);if(!i.problems)return r;r||(r=e.tr);const o=[];for(let l=0;l<i.height;l++)o.push(0);for(let l=0;l<i.problems.length;l++){const c=i.problems[l];if(c.type=="collision"){const d=t.nodeAt(c.pos);if(!d)continue;const u=d.attrs;for(let h=0;h<u.rowspan;h++)o[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Tn(u,u.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=t.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=t.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+t.nodeSize)}}let s,a;for(let l=0;l<o.length;l++)o[l]&&(s==null&&(s=l),a=l);for(let l=0,c=n+1;l<i.height;l++){const d=t.child(l),u=c+d.nodeSize,h=o[l];if(h>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);const g=[];for(let x=0;x<h;x++){const y=Le(e.schema)[p].createAndFill();y&&g.push(y)}const m=(l==0||s==l-1)&&a==l?c+1:u-1;r.insert(r.mapping.map(m),g)}c=u}return r.setMeta(lA,{fixTables:!0})}function kt(e){const t=e.selection,n=qo(e),r=n.node(-1),i=n.start(-1),o=Se.get(r);return{...t instanceof fe?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function am(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;nA(t,r,i+o)&&(o=i==0||i==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+i;if(i>0&&i<t.width&&t.map[a-1]==t.map[a]){const l=t.map[a],c=r.nodeAt(l);e.setNodeMarkup(e.mapping.map(n+l),null,rm(c.attrs,i-t.colCount(l))),s+=c.attrs.rowspan-1}else{const l=o==null?Le(r.type.schema).cell:r.nodeAt(t.map[a+o]).type,c=t.positionAt(s,i,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function uA(e,t){if(!pt(e))return!1;if(t){const n=kt(e);t(am(e.tr,n,n.left))}return!0}function dA(e,t){if(!pt(e))return!1;if(t){const n=kt(e);t(am(e.tr,n,n.right))}return!0}function hA(e,{map:t,table:n,tableStart:r},i){const o=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+i,l=t.map[a],c=n.nodeAt(l),d=c.attrs;if(i>0&&t.map[a-1]==l||i<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(o).map(r+l),null,Tn(d,i-t.colCount(l)));else{const u=e.mapping.slice(o).map(r+l);e.delete(u,u+c.nodeSize)}s+=d.rowspan}}function fA(e,t){if(!pt(e))return!1;if(t){const n=kt(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;hA(r,n,i),i!=n.left;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw RangeError("No table found");n.table=o,n.map=Se.get(o)}t(r)}return!0}function pA(e,t,n){var r;const i=Le(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if(((r=t.nodeAt(e.map[o+n*e.width]))==null?void 0:r.type)!=i)return!1;return!0}function lm(e,{map:t,tableStart:n,table:r},i){var o;let s=n;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const a=[];let l=i>0?-1:0;pA(t,r,i+l)&&(l=i==0||i==t.height?null:0);for(let c=0,d=t.width*i;c<t.width;c++,d++)if(i>0&&i<t.height&&t.map[d]==t.map[d-t.width]){const u=t.map[d],h=r.nodeAt(u).attrs;e.setNodeMarkup(n+u,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{const u=l==null?Le(r.type.schema).cell:(o=r.nodeAt(t.map[d+l*t.width]))==null?void 0:o.type,h=u==null?void 0:u.createAndFill();h&&a.push(h)}return e.insert(s,Le(r.type.schema).row.create(null,a)),e}function gA(e,t){if(!pt(e))return!1;if(t){const n=kt(e);t(lm(e.tr,n,n.top))}return!0}function mA(e,t){if(!pt(e))return!1;if(t){const n=kt(e);t(lm(e.tr,n,n.bottom))}return!0}function xA(e,{map:t,table:n,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=n.child(c).nodeSize;const s=o+n.child(i).nodeSize,a=e.mapping.maps.length;e.delete(o+r,s+r);const l=new Set;for(let c=0,d=i*t.width;c<t.width;c++,d++){const u=t.map[d];if(!l.has(u)){if(l.add(u),i>0&&u==t.map[d-t.width]){const h=n.nodeAt(u).attrs;e.setNodeMarkup(e.mapping.slice(a).map(u+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<t.height&&u==t.map[d+t.width]){const h=n.nodeAt(u),p=h.attrs,g=h.type.create({...p,rowspan:h.attrs.rowspan-1},h.content),m=t.positionAt(i+1,c,n);e.insert(e.mapping.slice(a).map(r+m),g),c+=p.colspan-1}}}}function yA(e,t){if(!pt(e))return!1;if(t){const n=kt(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;xA(r,n,i),i!=n.top;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw RangeError("No table found");n.table=o,n.map=Se.get(n.table)}t(r)}return!0}function zd(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function vA({width:e,height:t,map:n},r){let i=r.top*e+r.left,o=i,s=(r.bottom-1)*e+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[o]==n[o-1]||r.right<e&&n[a]==n[a+1])return!0;o+=e,a+=e}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[s]==n[s+e])return!0;i++,s++}return!1}function bA(e,t){const n=e.selection;if(!(n instanceof fe)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=kt(e),{map:i}=r;if(vA(i,r))return!1;if(t){const o=e.tr,s={};let a=v.Fragment.empty,l,c;for(let d=r.top;d<r.bottom;d++)for(let u=r.left;u<r.right;u++){const h=i.map[d*i.width+u],p=r.table.nodeAt(h);if(!(s[h]||!p))if(s[h]=!0,l==null)l=h,c=p;else{zd(p)||(a=a.append(p.content));const g=o.mapping.map(h+r.tableStart);o.delete(g,g+p.nodeSize)}}if(l==null||c==null)return!0;if(o.setNodeMarkup(l+r.tableStart,null,{...rm(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const d=l+1+c.content.size,u=zd(c)?l+1:d;o.replaceWith(u+r.tableStart,d+r.tableStart,a)}o.setSelection(new fe(o.doc.resolve(l+r.tableStart))),t(o)}return!0}function wA(e,t){const n=Le(e.schema);return SA(({node:r})=>n[r.type.spec.tableRole])(e,t)}function SA(e){return(t,n)=>{var r;const i=t.selection;let o,s;if(i instanceof fe){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=QC(i.$from),!o)return!1;s=(r=ir(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let a=o.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const d=kt(t),u=t.tr;for(let p=0;p<d.right-d.left;p++)l.push(c?{...a,colwidth:c&&c[p]?[c[p]]:null}:a);let h;for(let p=d.top;p<d.bottom;p++){let g=d.map.positionAt(p,d.left,d.table);p==d.top&&(g+=o.nodeSize);for(let m=d.left,x=0;m<d.right;m++,x++)m==d.left&&p==d.top||u.insert(h=u.mapping.map(g+d.tableStart,1),e({node:o,row:p,col:m}).createAndFill(l[x]))}u.setNodeMarkup(s,e({node:o,row:d.top,col:d.left}),l[0]),i instanceof fe&&u.setSelection(new fe(u.doc.resolve(i.$anchorCell.pos),h?u.doc.resolve(h):void 0)),n(u)}return!0}}function CA(e,t){return function(n,r){if(!pt(n))return!1;const i=qo(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){const o=n.tr;n.selection instanceof fe?n.selection.forEachCell((s,a)=>{s.attrs[e]!==t&&o.setNodeMarkup(a,null,{...s.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0}}function AA(e){return function(t,n){if(!pt(t))return!1;if(n){const r=Le(t.schema),i=kt(t),o=t.tr,s=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[l],r.cell,a[l].attrs);if(o.steps.length==0)for(let l=0;l<s.length;l++)o.setNodeMarkup(i.tableStart+s[l],r.header_cell,a[l].attrs);n(o)}return!0}}function Ud(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<r.length;i++){const o=t.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function Vo(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?AA(e):function(n,r){if(!pt(n))return!1;if(r){const i=Le(n.schema),o=kt(n),s=n.tr,a=Ud("row",o,i),l=Ud("column",o,i),d=(e==="column"?a:e==="row"?l:!1)?1:0,u=e=="column"?{left:0,top:d,right:1,bottom:o.map.height}:e=="row"?{left:d,top:0,right:o.map.width,bottom:1}:o,h=e=="column"?l?i.cell:i.header_cell:e=="row"?a?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(p=>{const g=p+o.tableStart,m=s.doc.nodeAt(g);m&&s.setNodeMarkup(g,h,m.attrs)}),r(s)}return!0}}Vo("row",{useDeprecatedLogic:!0});Vo("column",{useDeprecatedLogic:!0});var kA=Vo("cell",{useDeprecatedLogic:!0});function EA(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let r=e.index(-1)-1,i=e.before();r>=0;r--){const o=e.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let r=e.indexAfter(-1),i=e.after();r<n.childCount;r++){const o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function TA(e){return function(t,n){if(!pt(t))return!1;const r=EA(qo(t),e);if(r==null)return!1;if(n){const i=t.doc.resolve(r);n(t.tr.setSelection(v.TextSelection.between(i,tA(i))).scrollIntoView())}return!0}}function IA(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function mi(e,t){const n=e.selection;if(!(n instanceof fe))return!1;if(t){const r=e.tr,i=Le(e.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new v.Slice(i,0,0))}),r.docChanged&&t(r)}return!0}function _A(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole=="table");)n--,r--,t=t.child(0).content;const i=t.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if(o=="row")for(let l=0;l<t.childCount;l++){let c=t.child(l).content;const d=l?0:Math.max(0,n-1),u=l<t.childCount-1?0:Math.max(0,r-1);(d||u)&&(c=rc(Le(s).row,new v.Slice(c,d,u)).content),a.push(c)}else if(o=="cell"||o=="header_cell")a.push(n||r?rc(Le(s).row,new v.Slice(t,n,r)).content:t);else return null;return RA(s,a)}function RA(e,t){const n=[];for(let i=0;i<t.length;i++){const o=t[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:a,colspan:l}=o.child(s).attrs;for(let c=i;c<i+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(v.Fragment.empty),n[i]<r){const o=Le(e).cell.createAndFill(),s=[];for(let a=n[i];a<r;a++)s.push(o);t[i]=t[i].append(v.Fragment.from(s))}return{height:t.length,width:r,rows:t}}function rc(e,t){const n=e.createAndFill();return new v.Transform(n).replace(0,n.content.size,t).doc}function OA({width:e,height:t,rows:n},r,i){if(e!=r){const o=[],s=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let d=o[a]||0,u=0;d<r;u++){let h=l.child(u%l.childCount);d+h.attrs.colspan>r&&(h=h.type.createChecked(Tn(h.attrs,h.attrs.colspan,d+h.attrs.colspan-r),h.content)),c.push(h),d+=h.attrs.colspan;for(let p=1;p<h.attrs.rowspan;p++)o[a+p]=(o[a+p]||0)+h.attrs.colspan}s.push(v.Fragment.from(c))}n=s,e=r}if(t!=i){const o=[];for(let s=0,a=0;s<i;s++,a++){const l=[],c=n[a%t];for(let d=0;d<c.childCount;d++){let u=c.child(d);s+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),l.push(u)}o.push(v.Fragment.from(l))}n=o,t=i}return{width:e,height:t,rows:n}}function jA(e,t,n,r,i,o,s){const a=e.doc.type.schema,l=Le(a);let c,d;if(i>t.width)for(let u=0,h=0;u<t.height;u++){const p=n.child(u);h+=p.nodeSize;const g=[];let m;p.lastChild==null||p.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=d||(d=l.header_cell.createAndFill());for(let x=t.width;x<i;x++)g.push(m);e.insert(e.mapping.slice(s).map(h-1+r),g)}if(o>t.height){const u=[];for(let g=0,m=(t.height-1)*t.width;g<Math.max(t.width,i);g++){const x=g>=t.width?!1:n.nodeAt(t.map[m+g]).type==l.header_cell;u.push(x?d||(d=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,v.Fragment.from(u)),p=[];for(let g=t.height;g<o;g++)p.push(h);e.insert(e.mapping.slice(s).map(r+n.nodeSize-2),p)}return!!(c||d)}function Fd(e,t,n,r,i,o,s,a){if(s==0||s==t.height)return!1;let l=!1;for(let c=i;c<o;c++){const d=s*t.width+c,u=t.map[d];if(t.map[d-t.width]==u){l=!0;const h=n.nodeAt(u),{top:p,left:g}=t.findCell(u);e.setNodeMarkup(e.mapping.slice(a).map(u+r),null,{...h.attrs,rowspan:s-p}),e.insert(e.mapping.slice(a).map(t.positionAt(s,g,n)),h.type.createAndFill({...h.attrs,rowspan:p+h.attrs.rowspan-s})),c+=h.attrs.colspan-1}}return l}function qd(e,t,n,r,i,o,s,a){if(s==0||s==t.width)return!1;let l=!1;for(let c=i;c<o;c++){const d=c*t.width+s,u=t.map[d];if(t.map[d-1]==u){l=!0;const h=n.nodeAt(u),p=t.colCount(u),g=e.mapping.slice(a).map(u+r);e.setNodeMarkup(g,null,Tn(h.attrs,s-p,h.attrs.colspan-(s-p))),e.insert(g+h.nodeSize,h.type.createAndFill(Tn(h.attrs,0,s-p))),c+=h.attrs.rowspan-1}}return l}function Vd(e,t,n,r,i){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw new Error("No table found");let s=Se.get(o);const{top:a,left:l}=r,c=l+i.width,d=a+i.height,u=e.tr;let h=0;function p(){if(o=n?u.doc.nodeAt(n-1):u.doc,!o)throw new Error("No table found");s=Se.get(o),h=u.mapping.maps.length}jA(u,s,o,n,c,d,h)&&p(),Fd(u,s,o,n,l,c,a,h)&&p(),Fd(u,s,o,n,l,c,d,h)&&p(),qd(u,s,o,n,a,d,l,h)&&p(),qd(u,s,o,n,a,d,c,h)&&p();for(let g=a;g<d;g++){const m=s.positionAt(g,l,o),x=s.positionAt(g,c,o);u.replace(u.mapping.slice(h).map(m+n),u.mapping.slice(h).map(x+n),new v.Slice(i.rows[g-a],0,0))}p(),u.setSelection(new fe(u.doc.resolve(n+s.positionAt(a,l,o)),u.doc.resolve(n+s.positionAt(d-1,c-1,o)))),t(u)}var MA=v.keydownHandler({ArrowLeft:xi("horiz",-1),ArrowRight:xi("horiz",1),ArrowUp:xi("vert",-1),ArrowDown:xi("vert",1),"Shift-ArrowLeft":yi("horiz",-1),"Shift-ArrowRight":yi("horiz",1),"Shift-ArrowUp":yi("vert",-1),"Shift-ArrowDown":yi("vert",1),Backspace:mi,"Mod-Backspace":mi,Delete:mi,"Mod-Delete":mi});function Mi(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function xi(e,t){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof fe)return Mi(n,r,v.Selection.near(o.$headCell,t));if(e!="horiz"&&!o.empty)return!1;const s=cm(i,e,t);if(s==null)return!1;if(e=="horiz")return Mi(n,r,v.Selection.near(n.doc.resolve(o.head+t),t));{const a=n.doc.resolve(s),l=nm(a,e,t);let c;return l?c=v.Selection.near(l,1):t<0?c=v.Selection.near(n.doc.resolve(a.before(-1)),-1):c=v.Selection.near(n.doc.resolve(a.after(-1)),1),Mi(n,r,c)}}}function yi(e,t){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof fe)s=o;else{const l=cm(i,e,t);if(l==null)return!1;s=new fe(n.doc.resolve(l))}const a=nm(s.$headCell,e,t);return a?Mi(n,r,new fe(s.$anchorCell,a)):!1}}function NA(e,t){const n=e.state.doc,r=ir(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new fe(r))),!0):!1}function PA(e,t,n){if(!pt(e.state))return!1;let r=_A(n);const i=e.state.selection;if(i instanceof fe){r||(r={width:1,height:1,rows:[v.Fragment.from(rc(Le(e.state.schema).cell,n))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=Se.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=OA(r,a.right-a.left,a.bottom-a.top),Vd(e.state,e.dispatch,s,a,r),!0}else if(r){const o=qo(e.state),s=o.start(-1);return Vd(e.state,e.dispatch,s,Se.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function LA(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=Wd(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof fe)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&(i=ir(e.state.selection.$anchor))!=null&&((n=Rs(e,t))==null?void 0:n.pos)!=i.pos)o(i,t),t.preventDefault();else if(!r)return;function o(l,c){let d=Rs(e,c);const u=on.getState(e.state)==null;if(!d||!Fc(l,d))if(u)d=l;else return;const h=new fe(l,d);if(u||!e.state.selection.eq(h)){const p=e.state.tr.setSelection(h);u&&p.setMeta(on,l.pos),e.dispatch(p)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),on.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(on,-1))}function a(l){const c=l,d=on.getState(e.state);let u;if(d!=null)u=e.state.doc.resolve(d);else if(Wd(e,c.target)!=r&&(u=Rs(e,t),!u))return s();u&&o(u,c)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function cm(e,t,n){if(!(e.state.selection instanceof v.TextSelection))return null;const{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const a=r.before(i),l=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?a:null}}return null}function Wd(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Rs(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?ir(e.state.doc.resolve(n.pos)):null}var DA=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ic(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ic(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ic(e,t,n,r,i,o){var s;let a=0,l=!0,c=t.firstChild;const d=e.firstChild;if(d){for(let u=0,h=0;u<d.childCount;u++){const{colspan:p,colwidth:g}=d.child(u).attrs;for(let m=0;m<p;m++,h++){const x=i==h?o:g&&g[m],y=x?x+"px":"";if(a+=x||r,x||(l=!1),c)c.style.width!=y&&(c.style.width=y),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=y,t.appendChild(w)}}}for(;c;){const u=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=u}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var Ye=new v.PluginKey("tableColumnResizing");function $A({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=DA,lastColumnResizable:i=!0}={}){const o=new v.Plugin({key:Ye,state:{init(s,a){var l,c;const d=(c=(l=o.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,u=Le(a.schema).table.name;return r&&d&&(d[u]=(h,p)=>new r(h,n,p)),new BA(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=Ye.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{HA(s,a,e,i)},mouseleave:s=>{zA(s)},mousedown:(s,a)=>{UA(s,a,t,n)}},decorations:s=>{const a=Ye.getState(s);if(a&&a.activeHandle>-1)return GA(s,a.activeHandle)},nodeViews:{}}});return o}var BA=class Ni{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,r=t.getMeta(Ye);if(r&&r.setHandle!=null)return new Ni(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Ni(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let i=t.mapping.map(n.activeHandle,-1);return nc(t.doc.resolve(i))||(i=-1),new Ni(i,n.dragging)}return n}};function HA(e,t,n,r){if(!e.editable)return;const i=Ye.getState(e.state);if(i&&!i.dragging){const o=qA(t.target);let s=-1;if(o){const{left:a,right:l}=o.getBoundingClientRect();t.clientX-a<=n?s=Gd(e,t,"left",n):l-t.clientX<=n&&(s=Gd(e,t,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){const a=e.state.doc.resolve(s),l=a.node(-1),c=Se.get(l),d=a.start(-1);if(c.colCount(a.pos-d)+a.nodeAfter.attrs.colspan-1==c.width-1)return}um(e,s)}}}function zA(e){if(!e.editable)return;const t=Ye.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&um(e,-1)}function UA(e,t,n,r){var i;if(!e.editable)return!1;const o=(i=e.dom.ownerDocument.defaultView)!=null?i:window,s=Ye.getState(e.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=e.state.doc.nodeAt(s.activeHandle),l=FA(e,s.activeHandle,a.attrs);e.dispatch(e.state.tr.setMeta(Ye,{setDragging:{startX:t.clientX,startWidth:l}}));function c(u){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);const h=Ye.getState(e.state);h!=null&&h.dragging&&(VA(e,h.activeHandle,Kd(h.dragging,u,n)),e.dispatch(e.state.tr.setMeta(Ye,{setDragging:null})))}function d(u){if(!u.which)return c(u);const h=Ye.getState(e.state);if(h&&h.dragging){const p=Kd(h.dragging,u,n);Yd(e,h.activeHandle,p,r)}}return Yd(e,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),t.preventDefault(),!0}function FA(e,t,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=e.domAtPos(t);let a=o.node.childNodes[o.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],l--);return a/l}function qA(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function Gd(e,t,n,r){const i=n=="right"?-r:r,o=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!o)return-1;const{pos:s}=o,a=ir(e.state.doc.resolve(s));if(!a)return-1;if(n=="right")return a.pos;const l=Se.get(a.node(-1)),c=a.start(-1),d=l.map.indexOf(a.pos-c);return d%l.width==0?-1:c+l.map[d-1]}function Kd(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function um(e,t){e.dispatch(e.state.tr.setMeta(Ye,{setHandle:t}))}function VA(e,t,n){const r=e.state.doc.resolve(t),i=r.node(-1),o=Se.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let c=0;c<o.height;c++){const d=c*o.width+a;if(c&&o.map[d]==o.map[d-o.width])continue;const u=o.map[d],h=i.nodeAt(u).attrs,p=h.colspan==1?0:a-o.colCount(u);if(h.colwidth&&h.colwidth[p]==n)continue;const g=h.colwidth?h.colwidth.slice():WA(h.colspan);g[p]=n,l.setNodeMarkup(s+u,null,{...h,colwidth:g})}l.docChanged&&e.dispatch(l)}function Yd(e,t,n,r){const i=e.state.doc.resolve(t),o=i.node(-1),s=i.start(-1),a=Se.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let l=e.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&ic(o,l.firstChild,l,r,a,n)}function WA(e){return Array(e).fill(0)}function GA(e,t){var n;const r=[],i=e.doc.resolve(t),o=i.node(-1);if(!o)return v.DecorationSet.empty;const s=Se.get(o),a=i.start(-1),l=s.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const d=l+c*s.width;if((l==s.width-1||s.map[d]!=s.map[d+1])&&(c==0||s.map[d]!=s.map[d-s.width])){const u=s.map[d],h=a+u+o.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=Ye.getState(e))!=null&&n.dragging&&r.push(v.Decoration.node(a+u,a+u+o.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),r.push(v.Decoration.widget(h,p))}}return v.DecorationSet.create(e.doc,r)}function KA({allowTableNodeSelection:e=!1}={}){return new v.Plugin({key:on,state:{init(){return null},apply(t,n){const r=t.getMeta(on);if(r!=null)return r==-1?null:r;if(n==null||!t.docChanged)return n;const{deleted:i,pos:o}=t.mapping.mapResult(n);return i?null:o}},props:{decorations:iA,handleDOMEvents:{mousedown:LA},createSelectionBetween(t){return on.getState(t.state)!=null?t.state.selection:null},handleTripleClick:NA,handleKeyDown:MA,handlePaste:PA},appendTransaction(t,n,r){return aA(r,sm(r,n),e)}})}function YA(e,t){const n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),s=Math.max(e.right,t.right)-i,a=r-n,l=i,c=n;return new DOMRect(l,c,s,a)}var XA=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:a,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:u,from:h,to:p})=>{const{doc:g,selection:m}=u,{empty:x}=m,y=!g.textBetween(h,p).length&&v.isTextSelection(u.selection),w=this.element.contains(document.activeElement);return!(!(d.hasFocus()||w)||x||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var u;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d!=null&&d.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(d.relatedTarget))||(d==null?void 0:d.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,u)=>{const h=!(u!=null&&u.selection.eq(d.state.selection)),p=!(u!=null&&u.doc.eq(d.state.doc));!h&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,h,p,u)},this.updateDelay))},this.updateHandler=(d,u,h,p)=>{const{composing:g}=d;if(g||!u&&!h)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:d})=>{d.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var c;this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=s,this.scrollTarget=(c=l==null?void 0:l.scrollTarget)!=null?c:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(re.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(re.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(re.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(re.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(re.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(re.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(re.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(re.inline(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e;const{selection:t}=this.editor.state,n=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(n)return n;const r=v.posToDOMRect(this.view,t.from,t.to);let i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(t instanceof v.NodeSelection){let o=this.view.nodeDOM(t.from);const s=o.dataset.nodeViewWrapper?o:o.querySelector("[data-node-view-wrapper]");s&&(o=s),o&&(i={getBoundingClientRect:()=>o.getBoundingClientRect(),getClientRects:()=>[o.getBoundingClientRect()]})}if(t instanceof fe){const{$anchorCell:o,$headCell:s}=t,a=o?o.pos:s.pos,l=s?s.pos:o.pos,c=this.view.nodeDOM(a),d=this.view.nodeDOM(l);if(!c||!d)return;const u=c===d?c.getBoundingClientRect():YA(c.getBoundingClientRect(),d.getBoundingClientRect());i={getBoundingClientRect:()=>u,getClientRects:()=>[u]}}return i}updatePosition(){const e=this.virtualElement;e&&re.computePosition(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:n,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${t}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}const i=!(t!=null&&t.selection.eq(e.state.selection)),o=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,i,o,t)}getShouldShow(e){var t;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:e,from:o,to:s}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},dm=e=>new v.Plugin({key:typeof e.pluginKey=="string"?new v.PluginKey(e.pluginKey):e.pluginKey,view:t=>new XA({view:t,...e})});v.Extension.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[dm({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var JA=class{constructor({editor:e,element:t,view:n,options:r,appendTo:i,shouldShow:o}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:s,state:a})=>{const{selection:l}=a,{$anchor:c,empty:d}=l,u=c.depth===1,h=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!s.hasFocus()||!d||!u||!h||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(s,a,l,c)=>{const{composing:d}=s;if(d||!a&&!l)return;if(!this.getShouldShow(c)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&((a=this.element.parentNode)!=null&&a.contains(s.relatedTarget))||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.editor=e,this.element=t,this.view=n,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...r},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return v.getText(e,{textSerializers:v.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(re.flip(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(re.shift(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(re.offset(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(re.arrow(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(re.size(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(re.autoPlacement(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(re.hide(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(re.inline(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:n,oldState:e,from:o,to:s})}updatePosition(){const{selection:e}=this.editor.state,t=v.posToDOMRect(this.view,e.from,e.to),n={getBoundingClientRect:()=>t,getClientRects:()=>[t]};re.computePosition(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const n=!(t!=null&&t.selection.eq(e.state.selection)),r=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,n,r,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},hm=e=>new v.Plugin({key:typeof e.pluginKey=="string"?new v.PluginKey(e.pluginKey):e.pluginKey,view:t=>new JA({view:t,...e})});v.Extension.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[hm({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var Vt=C.forwardRef(({pluginKey:e="bubbleMenu",editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,getReferencedVirtualElement:s,options:a,children:l,...c},d)=>{const u=C.useRef(document.createElement("div"));typeof d=="function"?d(u.current):d&&(d.current=u.current);const{editor:h}=re.useCurrentEditor(),p=t||h,g={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:e,shouldShow:o,getReferencedVirtualElement:s,options:a},m=C.useRef(g);return m.current=g,C.useEffect(()=>{if(p!=null&&p.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const x=u.current;x.style.visibility="hidden",x.style.position="absolute";const y=dm({...m.current,editor:p,element:x});p.registerPlugin(y);const w=m.current.pluginKey;return()=>{p.unregisterPlugin(w),window.requestAnimationFrame(()=>{x.parentNode&&x.parentNode.removeChild(x)})}},[p]),ep.createPortal(f.jsx("div",{...c,children:l}),u.current)});C.forwardRef(({pluginKey:e="floatingMenu",editor:t,appendTo:n,shouldShow:r=null,options:i,children:o,...s},a)=>{const l=C.useRef(document.createElement("div"));typeof a=="function"?a(l.current):a&&(a.current=l.current);const{editor:c}=re.useCurrentEditor();return C.useEffect(()=>{const d=l.current;if(d.style.visibility="hidden",d.style.position="absolute",t!=null&&t.isDestroyed||c!=null&&c.isDestroyed)return;const u=t||c;if(!u){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const h=hm({editor:u,element:d,pluginKey:e,appendTo:n,shouldShow:r,options:i});return u.registerPlugin(h),()=>{u.unregisterPlugin(e),window.requestAnimationFrame(()=>{d.parentNode&&d.parentNode.removeChild(d)})}},[t,c,n,e,r,i]),ep.createPortal(f.jsx("div",{...s,children:o}),l.current)});function ZA({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?f.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n}):f.jsx(f.Fragment,{})}function QA(e){const{t,lang:n}=z.useLocale(),r=({editor:o})=>{const{selection:s}=o.view.state,{$from:a,to:l}=s;return a.pos===l?!1:s instanceof v.TextSelection},i=C.useMemo(()=>e.disabled||!(e!=null&&e.editor)?[]:fw(e.editor,t),[e.disabled,e.editor,n,t]);return f.jsx(Vt,{editor:e==null?void 0:e.editor,shouldShow:r,children:i!=null&&i.length?f.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:f.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-gap-[4px] richtext-whitespace-nowrap",children:i==null?void 0:i.map((o,s)=>(o==null?void 0:o.type)==="divider"?f.jsx(ut,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"},`bubbleMenu-divider-${s}`):f.jsx(ZA,{disabled:e.disabled,editor:e.editor,item:o},`bubbleMenu-text-${s}`))})}):f.jsx(f.Fragment,{})})}function ek(e){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:f.jsx("path",{fill:"currentColor",d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H3V5h18z"})})}function tk(e){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:f.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 15h15m0 4H6m9-8h6m0-4h-6M9 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2M3 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2"})})}function nk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"richtext-w-4 richtext-h-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5.5 3c1.404 0 2.107 0 2.611.38c.219.164.406.375.552.62C9 4.568 9 5.358 9 6.938v10.125c0 1.58 0 2.37-.337 2.937a2.1 2.1 0 0 1-.552.621c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C2 19.432 2 18.642 2 17.062V6.938c0-1.58 0-2.37.337-2.938a2.1 2.1 0 0 1 .552-.62C3.393 3 4.096 3 5.5 3M20 11.938v5.124c0 1.58 0 2.37-.337 2.938a2.1 2.1 0 0 1-.552.62c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C13 19.433 13 18.642 13 17.063V6.938c0-1.58 0-2.37.337-2.938M22 9l-6-6m6 0l-6 6",color:"currentColor"})})}function rk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"richtext-w-4 richtext-h-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M21 18.5c0 1.404 0 2.107-.38 2.611a2.1 2.1 0 0 1-.62.552c-.567.337-1.358.337-2.937.337H6.938c-1.58 0-2.37 0-2.938-.337a2.1 2.1 0 0 1-.62-.552C3 20.607 3 19.904 3 18.5s0-2.107.38-2.611c.163-.218.374-.406.62-.552C4.567 15 5.357 15 6.938 15h10.125c1.58 0 2.37 0 2.937.337c.246.146.457.334.62.552c.38.504.38 1.207.38 2.611M12.063 4H6.937C5.358 4 4.568 4 4 4.337a2.1 2.1 0 0 0-.62.552C3 5.393 3 6.096 3 7.5s0 2.107.38 2.611c.163.218.374.406.62.552C4.567 11 5.357 11 6.938 11h10.125c1.58 0 2.37 0 2.937-.337M21 8l-6-6m6 0l-6 6",color:"currentColor"})})}function ik(e){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:f.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}function Ce(e){const t=qc[e.name];return t?f.jsx(t,{onClick:e==null?void 0:e.onClick,className:`richtext-w-4 richtext-h-4 ${(e==null?void 0:e.className)||""}`}):null}function ok(e){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:f.jsx("path",{fill:"currentColor",d:"M21 22H3v-2h18zm0-18H3V2h18zm-11 9.7h4l-2-5.4zM11.2 6h1.7l4.7 12h-2l-.9-2.6H9.4L8.5 18h-2z"})})}function fm(e){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 48 48",...e,children:f.jsx("path",{fill:"currentColor",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:4,d:"M36 19L24 31L12 19z"})})}function sk(e){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:f.jsx("path",{fill:"currentColor",d:"M9 7v10h6v-2h-4V7z"})})}function ak(e){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:f.jsx("path",{fill:"currentColor",d:"M9 7c-1.1 0-2 .9-2 2v8h2V9h2v7h2V9h2v8h2V9a2 2 0 0 0-2-2z"})})}function lk(e){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:f.jsx("path",{fill:"currentColor",d:"M11 7c-1.1 0-2 .9-2 2v2a2 2 0 0 0 2 2h2v2H9v2h4c1.11 0 2-.89 2-2v-2a2 2 0 0 0-2-2h-2V9h4V7z"})})}function ck(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"currentColor",d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6l1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6l-1.4-1.4z"})})}function uk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M14 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m-9 8h4m-2-2v4"})})}function dk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m9 8h4m-2-2v4"})})}function hk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 21v-4m0-4V9m0-4V3m-2 18h4M8 5v4h11l2-2l-2-2zm6 8v4H6l-2-2l2-2z"})})}function fk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"currentColor",d:"M23.943 19.806a.2.2 0 0 0-.168-.034c-1.26-1.855-2.873-3.61-4.419-5.315l-.252-.284c-.001-.073-.067-.12-.134-.15l-.084-.084c-.05-.1-.169-.167-.286-.1c-.47.234-.907.585-1.327.919c-.554.434-1.109.87-1.63 1.354a5 5 0 0 0-.588.618c-.084.117-.017.217.084.267c-.37.368-.74.736-1.109 1.12a.2.2 0 0 0-.05.134c0 .05.033.1.067.117l.655.502v.016c.924.92 2.554 2.173 4.285 3.527c.251.201.52.402.773.602c.117.134.234.285.335.418c.05.066.169.084.236.033c.033.034.084.067.118.1a.24.24 0 0 0 .1.034a.15.15 0 0 0 .135-.066a.24.24 0 0 0 .033-.1c.017 0 .017.016.034.016a.2.2 0 0 0 .134-.05l3.058-3.327c.12-.116.014-.267 0-.267m-7.628-.134l-1.546-1.17l-.15-.1c-.035-.017-.068-.05-.102-.067l-.117-.1c.66-.66 1.33-1.308 2-1.956c-.488.484-1.463 1.906-1.261 2.373c.002 0 .018.042.067.084zm4.1 3.126l-1.277-.97a27 27 0 0 0-1.58-1.504c.69.518 1.277.97 1.361 1.053c.673.585.638.485 1.093.87l.554.4c-.074.103-.151.148-.151.151m.336.25l-.034-.016a1 1 0 0 0 .152-.117zM.588 3.476c.033.217.084.435.117.636c.201 1.103.403 2.106.772 2.858l.152.568c.05.217.134.485.219.552a67 67 0 0 0 3.578 2.942a.18.18 0 0 0 .219 0s0 .016.016.016a.15.15 0 0 0 .118.05a.2.2 0 0 0 .134-.05c1.798-1.989 3.142-3.627 4.1-4.998c.068-.066.084-.167.084-.25c.067-.067.118-.151.185-.201c.067-.067.067-.184 0-.235l-.017-.016c0-.033-.017-.084-.05-.1c-.42-.401-.722-.685-1.042-.986a94 94 0 0 1-2.352-2.273c-.017-.017-.034-.034-.067-.034c-.336-.117-1.025-.234-1.882-.385c-1.277-.216-3.008-.517-4.57-.986c0 0-.101 0-.118.017l-.05.05C.05.714.022.707 0 .718c.017.1.017.167.05.284c0 .033.068.301.068.334zm7.19 4.78l-.033.034a.036.036 0 0 1 .033-.034M6.553 2.238c.101.1.521.502.622.585c-.437-.2-1.529-.702-2.034-.869c.505.1 1.194.201 1.412.284M.79 1.403c.252.434.454 1.939.655 3.41c-.118-.469-.201-.936-.302-1.372C.992 2.673.84 1.988.638 1.386c.124 0 .152.021.152.017m-.286-.369c0-.016 0-.033-.017-.033c.085 0 .135.017.202.05c0 .006-.145-.017-.185-.017m23.17-.217c.017-.066-.336-.367-.219-.384c.253-.017.253-.401 0-.401c-.335.017-.688.1-1.008.15c-.587.117-1.192.234-1.78.367a80 80 0 0 0-3.949.937c-.403.117-.857.2-1.243.401c-.135.067-.118.2-.05.284c-.034.017-.051.017-.085.034c-.117.017-.218.034-.335.05c-.102.017-.152.1-.135.2c0 .017.017.05.017.067c-.706.936-1.496 1.923-2.353 2.976c-.84.969-1.73 1.989-2.62 3.042c-2.84 3.31-6.05 7.07-9.594 10.38a.16.16 0 0 0 0 .234c.016.016.033.033.05.033c-.05.05-.101.085-.152.134q-.05.05-.05.1a.4.4 0 0 0-.067.084c-.067.067-.067.184.017.234c.067.066.185.066.235-.017c.017-.017.017-.033.033-.033a.265.265 0 0 1 .37 0c.202.217.404.435.588.618l-.42-.35c-.067-.067-.184-.05-.234.016c-.068.066-.051.184.016.234l4.469 3.727c.034.034.067.034.118.034a.15.15 0 0 0 .117-.05l.101-.1c.017.016.05.016.067.016c.05 0 .084-.016.118-.05c6.049-6.05 10.922-10.614 16.5-14.693c.05-.033.067-.1.067-.15c.067 0 .118-.05.15-.117c1.026-3.125 1.228-5.9 1.295-7.27c0-.059.016-.038.016-.068c.017-.033.017-.05.017-.05a.98.98 0 0 0-.067-.619m-10.82 4.915c.268-.301.537-.619.806-.903c-1.73 2.273-4.603 5.767-8.67 9.929c2.773-3.059 5.562-6.218 7.864-9.026M5.14 23.466c-.016-.017-.016-.017 0-.017zm2.504-2.156c.135-.15.27-.284.42-.434c0 0 0 .016.017.016c-.224.198-.433.418-.437.418m.69-.668c.099-.1.14-.173.284-.318c.992-1.02 2.017-2.04 3.059-3.076l.016-.016c.252-.2.555-.418.824-.619a228 228 0 0 0-4.184 4.029M14.852 3.91c-.554.719-1.176 1.671-1.697 2.423c-1.646 2.374-6.94 8.174-7.057 8.274a1190 1190 0 0 1-4.839 4.597l-.1.1c-.085-.1-.085-.25.016-.334C8.652 11.966 13.19 6.133 15.021 3.576c-.05.116-.084.216-.168.334zm2.906 3.427c-.671-.386-.99-.987-.806-1.572l.05-.2a.8.8 0 0 1 .085-.167a1.9 1.9 0 0 1 .756-.703c.016 0 .033 0 .05-.016c-.017-.034-.017-.084-.017-.134c.017-.1.085-.167.202-.167c.202 0 .824.184 1.059.384c.067.05.134.117.202.184c.084.1.218.268.285.401c.034.017.067.184.118.268c.033.134.067.284.05.418c-.017.016 0 .116-.017.116a1.6 1.6 0 0 1-.218.619c-.03.03.006.012-.05.067a1.2 1.2 0 0 1-.32.334a1.49 1.49 0 0 1-1.26.234a2 2 0 0 0-.169-.066m4.37 1.403c0 .017-.017.05 0 .067c-.034 0-.05.017-.085.034a110 110 0 0 0-3.915 3.025c1.11-.986 2.218-1.989 3.378-2.975c.336-.301.571-.686.638-1.12l.168-1.003v-.033c.085-.201.404-.118.353.1c-.004-.001-.173.795-.537 1.905"})})}function pm(){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 32 32",children:[f.jsx("path",{fill:"currentColor",d:"M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"}),f.jsx("path",{fill:"currentColor",d:"M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"})]})}function gm(){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",className:"icon",viewBox:"0 0 1024 1024",children:[f.jsx("path",{fill:"currentColor",d:"M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"}),f.jsx("path",{fill:"currentColor",d:"m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"})]})}function pk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",color:"currentColor",children:[f.jsx("path",{d:"M14.86 22h-4.312c-3.291 0-4.937 0-6.08-.798a4.2 4.2 0 0 1-.863-.805c-.855-1.066-.855-2.6-.855-5.67v-2.545c0-2.963 0-4.445.473-5.628c.761-1.903 2.37-3.403 4.41-4.113C8.9 2 10.49 2 13.667 2c1.816 0 2.723 0 3.448.252c1.166.406 2.085 1.263 2.52 2.35c.27.676.27 1.523.27 3.216V10"}),f.jsx("path",{d:"M2.75 12c0-1.84 1.506-3.333 3.364-3.333c.672 0 1.464.116 2.117-.057a1.67 1.67 0 0 0 1.19-1.179c.174-.647.057-1.432.057-2.098C9.478 3.493 10.984 2 12.84 2m.002 16h2.523m-4.949-4.15c-.126-.8-.281-.801-1.61-.85h-1.01c-.557 0-1.009.448-1.009 1v3c0 .552.452 1 1.01 1h1.816c.39 0 .803-.313.803-.7v-1.1c0-.11-.113-.304-.224-.304H9.068M12.842 13h1.261m0 0h1.262m-1.262 0v4.875M21.251 13h-2.523c-.557 0-1.009.448-1.009 1v1.5m0 0V18m0-2.5h2.523"})]})})}function gk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:f.jsx("path",{fill:"currentColor",d:"M6.5 3a.75.75 0 0 1 .697.471l3 7.5a.75.75 0 0 1-1.393.557L7.992 9.5H5.008l-.811 2.028a.75.75 0 0 1-1.393-.556l3-7.5A.75.75 0 0 1 6.5 3m0 2.77L5.608 8h1.784zm8.28-1.55a.75.75 0 1 0-1.06 1.06l.72.72h-3.69a.75.75 0 0 0 0 1.5h3.69l-.72.72a.75.75 0 0 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06zm0 7.5a.75.75 0 1 0-1.06 1.06l.72.72H3.75a.75.75 0 0 0 0 1.5h10.69l-.72.72a.75.75 0 1 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06z"})})}function mk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",children:f.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"4",children:[f.jsx("circle",{cx:"10",cy:"24",r:"4"}),f.jsx("circle",{cx:"38",cy:"10",r:"4"}),f.jsx("circle",{cx:"38",cy:"24",r:"4"}),f.jsx("circle",{cx:"38",cy:"38",r:"4"}),f.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M34 38H22V10h12M14 24h20"})]})})}function xk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:f.jsx("path",{fill:"currentColor",d:"M13.5 3a.75.75 0 0 0-.697.471l-3 7.5a.75.75 0 0 0 1.393.557l.812-2.028h2.984l.811 2.028a.75.75 0 0 0 1.393-.556l-3-7.5A.75.75 0 0 0 13.5 3m0 2.77L14.392 8h-1.784zM5.22 4.22a.75.75 0 0 1 1.06 1.06L5.56 6h3.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 0 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06zm0 7.5a.75.75 0 0 1 1.06 1.06l-.72.72h10.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06z"})})}function yk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"m3 21l7.548-7.548M21 3l-7.548 7.548m0 0L8 3H3l7.548 10.452m2.904-2.904L21 21h-5l-5.452-7.548",color:"currentColor"})})}function vk(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}const qc={Bold:L.Bold,LoaderCircle:L.LoaderCircle,Italic:L.Italic,Underline:L.Underline,Quote:L.Quote,TextQuote:tk,Strikethrough:L.Strikethrough,Minus:L.Minus,Eraser:L.Eraser,PaintRoller:L.PaintRoller,Redo2:L.Redo2,Undo2:L.Undo2,AlignCenter:li.TextAlignCenterIcon,AlignJustify:li.TextAlignJustifyIcon,AlignLeft:li.TextAlignLeftIcon,AlignRight:li.TextAlignRightIcon,ChevronDown:L.ChevronDown,Subscript:L.Subscript,Superscript:L.Superscript,Code:L.Code,Code2:L.CodeXml,Type:L.Type,IndentIncrease:L.IndentIncrease,IndentDecrease:L.IndentDecrease,List:L.List,ListOrdered:L.ListOrdered,ListTodo:L.ListTodo,Link:L.Link,ImageUp:L.ImageUp,Video:L.Video,Maximize:L.Maximize,Minimize:L.Minimize,Table:L.Table,Sparkles:L.Sparkles,Pencil:L.Pencil,Unlink:L.Unlink,BetweenHorizonalEnd:L.BetweenHorizonalEnd,BetweenHorizonalStart:L.BetweenHorizonalStart,BetweenVerticalStart:L.BetweenVerticalStart,BetweenVerticalEnd:L.BetweenVerticalEnd,TableCellsMerge:L.TableCellsMerge,TableCellsSplit:L.TableCellsSplit,Trash2:L.Trash2,Trash:L.Trash,Replace:L.Replace,ChevronsUpDown:L.ChevronsUpDown,LineHeight:ok,Word:ik,Heading1:L.Heading1,Heading2:L.Heading2,Heading3:L.Heading3,Heading4:L.Heading4,Heading5:L.Heading5,Heading6:L.Heading6,Columns2:L.Columns2,Columns3:L.Columns3,Columns4:L.Columns4,Plus:L.Plus,Grip:L.GripVertical,Copy:L.Copy,Clipboard:L.Clipboard,PanelLeft:L.PanelLeft,PanelRight:L.PanelRight,Columns:L.Columns2,Iframe:L.Frame,MenuDown:fm,SizeS:lk,SizeM:ak,SizeL:sk,AspectRatio:ek,Emoji:L.SmilePlus,DeleteColumn:nk,DeleteRow:rk,SearchAndReplace:L.Replace,EmojiIcon:L.SmilePlusIcon,KatexIcon:L.Sigma,ExportPdf:pm,ExportWord:gm,ImportWord:vk,ColumnAddLeft:uk,ColumnAddRight:dk,BookMarked:L.BookMarked,Excalidraw:fk,ZoomIn:L.ZoomIn,ZoomOut:L.ZoomOut,Settings:L.Settings,Eye:L.Eye,TextDirection:hk,LeftToRight:gk,RightToLeft:xk,Attachment:L.Paperclip,GifIcon:pk,ChevronUp:L.ChevronUp,Crop:L.CropIcon,Mermaid:mk,Twitter:yk,CodeView:ck,FlipX:L.FlipVertical,FlipY:L.FlipHorizontal,PencilRuler:L.PencilRuler,WrapText:L.WrapText,Loader:L.Loader2};function bk({fill:e}){return f.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("g",{id:"icon/填充色",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:f.jsxs("g",{id:"icon/背景颜色",children:[f.jsx("g",{id:"编组",fill:"currentColor",children:f.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",id:"矩形",children:[f.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),f.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),f.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),f.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",id:"矩形",fill:e||"none"})]})})})}function mm(e){const[t,n]=C.useState(e==null?void 0:e.defaultColor);function r(s){var a;(a=e.action)==null||a.call(e,s)}function i(){var s;(s=e.action)==null||s.call(e,t)}const o=C.useCallback(Mo(s=>{n(s)},350),[]);return f.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-[32px]",children:[f.jsx(V,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:i,tooltipOptions:e==null?void 0:e.tooltipOptions,shortcutKeys:e==null?void 0:e.shortcutKeys,children:f.jsx("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-text-sm",children:f.jsx(bk,{fill:t})})}),f.jsx(v0,{selectedColor:t,setSelectedColor:o,onChange:r,highlight:!0,disabled:e==null?void 0:e.disabled,children:f.jsx(Oe,{variant:"ghost",size:"icon",className:"!richtext-w-3 !richtext-h-[32px]",disabled:e==null?void 0:e.disabled,children:f.jsx(Ce,{className:"!richtext-w-3 !richtext-h-3 richtext-text-zinc-500",name:"MenuDown"})})})]})}function wk({editor:e,disabled:t,actions:n,hiddenActions:r=[]}){var y,w,A,I,E,M,T,_,R,D,P,k,O,B,q,U,Z,ce;const i=({editor:te})=>v.isActive(te.view.state,"table"),{t:o}=z.useLocale(),s=te=>r.includes(te);function a(){e.chain().focus().addColumnBefore().run()}function l(){e.chain().focus().addColumnAfter().run()}function c(){e.chain().focus().deleteColumn().run()}function d(){e.chain().focus().addRowBefore().run()}function u(){e.chain().focus().addRowAfter().run()}function h(){e.chain().focus().deleteRow().run()}function p(){e.chain().focus().mergeCells().run()}function g(){e==null||e.chain().focus().splitCell().run()}function m(){e.chain().focus().deleteTable().run()}function x(te){e.chain().focus().setTableCellBackground(te).run()}return f.jsx(Vt,{editor:e,pluginKey:"table",shouldShow:i,updateDelay:0,options:{autoPlacement:!0},children:t?f.jsx(f.Fragment,{}):f.jsxs("div",{className:"richtext-flex richtext-size-full richtext-min-w-32 richtext-flex-row richtext-items-center richtext-gap-0.5 richtext-rounded-lg !richtext-border richtext-border-border richtext-bg-background richtext-p-2 richtext-leading-none richtext-shadow-sm",children:[!s("addColumnBefore")&&f.jsx(V,{action:a,disabled:!((w=(y=e==null?void 0:e.can())==null?void 0:y.addColumnBefore)!=null&&w.call(y)),icon:"BetweenHorizonalEnd",tooltip:o("editor.table.menu.insertColumnBefore"),"tooltip-options":{sideOffset:15}}),!s("addColumnAfter")&&f.jsx(V,{action:l,disabled:!((I=(A=e==null?void 0:e.can())==null?void 0:A.addColumnAfter)!=null&&I.call(A)),icon:"BetweenHorizonalStart",tooltip:o("editor.table.menu.insertColumnAfter"),"tooltip-options":{sideOffset:15}}),!s("deleteColumn")&&f.jsx(V,{action:c,disabled:!((M=e==null?void 0:(E=e.can()).deleteColumn)!=null&&M.call(E)),icon:"DeleteColumn",tooltip:o("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15}}),f.jsx(ut,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!s("addRowAbove")&&f.jsx(V,{action:d,disabled:!((_=e==null?void 0:(T=e.can()).addRowBefore)!=null&&_.call(T)),icon:"BetweenVerticalEnd",tooltip:o("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15}}),!s("addRowBelow")&&f.jsx(V,{action:u,disabled:!((D=(R=e==null?void 0:e.can())==null?void 0:R.addRowAfter)!=null&&D.call(R)),icon:"BetweenVerticalStart",tooltip:o("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15}}),!s("deleteRow")&&f.jsx(V,{action:h,disabled:!((k=(P=e==null?void 0:e.can())==null?void 0:P.deleteRow)!=null&&k.call(P)),icon:"DeleteRow",tooltip:o("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15}}),f.jsx(ut,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!s("mergeCells")&&f.jsx(V,{action:p,disabled:!((B=(O=e==null?void 0:e.can())==null?void 0:O.mergeCells)!=null&&B.call(O)),icon:"TableCellsMerge",tooltip:o("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15}}),!s("splitCells")&&f.jsx(V,{action:g,disabled:!((U=(q=e==null?void 0:e.can())==null?void 0:q.splitCell)!=null&&U.call(q)),icon:"TableCellsSplit",tooltip:o("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15}}),f.jsx(ut,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}),!s("setCellBackground")&&f.jsx(mm,{action:x,editor:e,tooltip:o("editor.table.menu.setCellsBgColor"),tooltipOptions:{sideOffset:15}}),!s("deleteTable")&&f.jsx(V,{action:m,disabled:!((ce=(Z=e==null?void 0:e.can())==null?void 0:Z.deleteTable)!=null&&ce.call(Z)),icon:"Trash2",tooltip:o("editor.table.menu.deleteTable"),"tooltip-options":{sideOffset:15}}),n&&n.map((te,He)=>f.jsx(V,{...te},He))]})})}const Sk="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Ck="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",oc="numeric",sc="ascii",ac="alpha",Cr="asciinumeric",vr="alphanumeric",lc="domain",xm="emoji",Ak="scheme",kk="slashscheme",Os="whitespace";function Ek(e,t){return e in t||(t[e]=[]),t[e]}function bn(e,t,n){t[oc]&&(t[Cr]=!0,t[vr]=!0),t[sc]&&(t[Cr]=!0,t[ac]=!0),t[Cr]&&(t[vr]=!0),t[ac]&&(t[vr]=!0),t[vr]&&(t[lc]=!0),t[xm]&&(t[lc]=!0);for(const r in t){const i=Ek(r,n);i.indexOf(e)<0&&i.push(e)}}function Tk(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Ue(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Ue.groups={};Ue.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const i=t.jr[r][0],o=t.jr[r][1];if(o&&i.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r=r||Ue.groups;let i;return t&&t.j?i=t:(i=new Ue(t),n&&r&&bn(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this;const o=e.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(e[s]);return i.tt(e[o-1],t,n,r)},tt(e,t,n,r){r=r||Ue.groups;const i=this;if(t&&t.j)return i.j[e]=t,t;const o=t;let s,a=i.go(e);if(a?(s=new Ue,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Ue,o){if(r)if(s.t&&typeof s.t=="string"){const l=Object.assign(Tk(s.t,r),n);bn(o,l,r)}else n&&bn(o,n,r);s.t=o}return i.j[e]=s,s}};const J=(e,t,n,r,i)=>e.ta(t,n,r,i),we=(e,t,n,r,i)=>e.tr(t,n,r,i),Xd=(e,t,n,r,i)=>e.ts(t,n,r,i),N=(e,t,n,r,i)=>e.tt(t,n,r,i),Pt="WORD",cc="UWORD",ym="ASCIINUMERICAL",vm="ALPHANUMERICAL",Vr="LOCALHOST",uc="TLD",dc="UTLD",Pi="SCHEME",Hn="SLASH_SCHEME",Vc="NUM",hc="WS",Wc="NL",Ar="OPENBRACE",kr="CLOSEBRACE",eo="OPENBRACKET",to="CLOSEBRACKET",no="OPENPAREN",ro="CLOSEPAREN",io="OPENANGLEBRACKET",oo="CLOSEANGLEBRACKET",so="FULLWIDTHLEFTPAREN",ao="FULLWIDTHRIGHTPAREN",lo="LEFTCORNERBRACKET",co="RIGHTCORNERBRACKET",uo="LEFTWHITECORNERBRACKET",ho="RIGHTWHITECORNERBRACKET",fo="FULLWIDTHLESSTHAN",po="FULLWIDTHGREATERTHAN",go="AMPERSAND",mo="APOSTROPHE",xo="ASTERISK",rn="AT",yo="BACKSLASH",vo="BACKTICK",bo="CARET",sn="COLON",Gc="COMMA",wo="DOLLAR",yt="DOT",So="EQUALS",Kc="EXCLAMATION",Qe="HYPHEN",Er="PERCENT",Co="PIPE",Ao="PLUS",ko="POUND",Tr="QUERY",Yc="QUOTE",bm="FULLWIDTHMIDDLEDOT",Xc="SEMI",vt="SLASH",Ir="TILDE",Eo="UNDERSCORE",wm="EMOJI",To="SYM";var Sm=Object.freeze({__proto__:null,ALPHANUMERICAL:vm,AMPERSAND:go,APOSTROPHE:mo,ASCIINUMERICAL:ym,ASTERISK:xo,AT:rn,BACKSLASH:yo,BACKTICK:vo,CARET:bo,CLOSEANGLEBRACKET:oo,CLOSEBRACE:kr,CLOSEBRACKET:to,CLOSEPAREN:ro,COLON:sn,COMMA:Gc,DOLLAR:wo,DOT:yt,EMOJI:wm,EQUALS:So,EXCLAMATION:Kc,FULLWIDTHGREATERTHAN:po,FULLWIDTHLEFTPAREN:so,FULLWIDTHLESSTHAN:fo,FULLWIDTHMIDDLEDOT:bm,FULLWIDTHRIGHTPAREN:ao,HYPHEN:Qe,LEFTCORNERBRACKET:lo,LEFTWHITECORNERBRACKET:uo,LOCALHOST:Vr,NL:Wc,NUM:Vc,OPENANGLEBRACKET:io,OPENBRACE:Ar,OPENBRACKET:eo,OPENPAREN:no,PERCENT:Er,PIPE:Co,PLUS:Ao,POUND:ko,QUERY:Tr,QUOTE:Yc,RIGHTCORNERBRACKET:co,RIGHTWHITECORNERBRACKET:ho,SCHEME:Pi,SEMI:Xc,SLASH:vt,SLASH_SCHEME:Hn,SYM:To,TILDE:Ir,TLD:uc,UNDERSCORE:Eo,UTLD:dc,UWORD:cc,WORD:Pt,WS:hc});const jt=/[a-z]/,xr=new RegExp("\\p{L}","u"),js=new RegExp("\\p{Emoji}","u"),Mt=/\d/,Ms=/\s/,Jd="\r",Ns=`
4
+ `,Ik="️",_k="‍",Ps="";let vi=null,bi=null;function Rk(e=[]){const t={};Ue.groups=t;const n=new Ue;vi==null&&(vi=Zd(Sk)),bi==null&&(bi=Zd(Ck)),N(n,"'",mo),N(n,"{",Ar),N(n,"}",kr),N(n,"[",eo),N(n,"]",to),N(n,"(",no),N(n,")",ro),N(n,"<",io),N(n,">",oo),N(n,"(",so),N(n,")",ao),N(n,"「",lo),N(n,"」",co),N(n,"『",uo),N(n,"』",ho),N(n,"<",fo),N(n,">",po),N(n,"&",go),N(n,"*",xo),N(n,"@",rn),N(n,"`",vo),N(n,"^",bo),N(n,":",sn),N(n,",",Gc),N(n,"$",wo),N(n,".",yt),N(n,"=",So),N(n,"!",Kc),N(n,"-",Qe),N(n,"%",Er),N(n,"|",Co),N(n,"+",Ao),N(n,"#",ko),N(n,"?",Tr),N(n,'"',Yc),N(n,"/",vt),N(n,";",Xc),N(n,"~",Ir),N(n,"_",Eo),N(n,"\\",yo),N(n,"・",bm);const r=we(n,Mt,Vc,{[oc]:!0});we(r,Mt,r);const i=we(r,jt,ym,{[Cr]:!0}),o=we(r,xr,vm,{[vr]:!0}),s=we(n,jt,Pt,{[sc]:!0});we(s,Mt,i),we(s,jt,s),we(i,Mt,i),we(i,jt,i);const a=we(n,xr,cc,{[ac]:!0});we(a,jt),we(a,Mt,o),we(a,xr,a),we(o,Mt,o),we(o,jt),we(o,xr,o);const l=N(n,Ns,Wc,{[Os]:!0}),c=N(n,Jd,hc,{[Os]:!0}),d=we(n,Ms,hc,{[Os]:!0});N(n,Ps,d),N(c,Ns,l),N(c,Ps,d),we(c,Ms,d),N(d,Jd),N(d,Ns),we(d,Ms,d),N(d,Ps,d);const u=we(n,js,wm,{[xm]:!0});N(u,"#"),we(u,js,u),N(u,Ik,u);const h=N(u,_k);N(h,"#"),we(h,js,u);const p=[[jt,s],[Mt,i]],g=[[jt,null],[xr,a],[Mt,o]];for(let m=0;m<vi.length;m++)en(n,vi[m],uc,Pt,p);for(let m=0;m<bi.length;m++)en(n,bi[m],dc,cc,g);bn(uc,{tld:!0,ascii:!0},t),bn(dc,{utld:!0,alpha:!0},t),en(n,"file",Pi,Pt,p),en(n,"mailto",Pi,Pt,p),en(n,"http",Hn,Pt,p),en(n,"https",Hn,Pt,p),en(n,"ftp",Hn,Pt,p),en(n,"ftps",Hn,Pt,p),bn(Pi,{scheme:!0,ascii:!0},t),bn(Hn,{slashscheme:!0,ascii:!0},t),e=e.sort((m,x)=>m[0]>x[0]?1:-1);for(let m=0;m<e.length;m++){const x=e[m][0],w=e[m][1]?{[Ak]:!0}:{[kk]:!0};x.indexOf("-")>=0?w[lc]=!0:jt.test(x)?Mt.test(x)?w[Cr]=!0:w[sc]=!0:w[oc]=!0,Xd(n,x,x,w)}return Xd(n,"localhost",Vr,{ascii:!0}),n.jd=new Ue(To),{start:n,tokens:Object.assign({groups:t},Sm)}}function Cm(e,t){const n=Ok(t.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let o=0,s=0;for(;s<r;){let a=e,l=null,c=0,d=null,u=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(u=0,h=0,d=a):u>=0&&(u+=n[s].length,h++),c+=n[s].length,o+=n[s].length,s++;o-=u,s-=h,c-=u,i.push({t:d.t,v:t.slice(o-c,o),s:o-c,e:o})}return i}function Ok(e){const t=[],n=e.length;let r=0;for(;r<n;){let i=e.charCodeAt(r),o,s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}function en(e,t,n,r,i){let o;const s=t.length;for(let a=0;a<s-1;a++){const l=t[a];e.j[l]?o=e.j[l]:(o=new Ue(r),o.jr=i.slice(),e.j[l]=o),e=o}return o=new Ue(n),o.jr=i.slice(),e.j[t[s-1]]=o,o}function Zd(e){const t=[],n=[];let r=0,i="0123456789";for(;r<e.length;){let o=0;for(;i.indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let s=parseInt(e.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(e[r]),r++}return t}const Wr={defaultProtocol:"http",events:null,format:Qd,formatHref:Qd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Jc(e,t=null){let n=Object.assign({},Wr);e&&(n=Object.assign(n,e instanceof Jc?e.o:e));const r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}Jc.prototype={o:Wr,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let i=this.o[e];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Wr[e],typeof i=="function"&&r&&(i=i(t,n))):typeof i=="function"&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function Qd(e){return e}function Am(e,t){this.t="token",this.v=e,this.tk=t}Am.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Wr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),i=e.get("tagName",n,t),o=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),d=e.getObj("attributes",n,t),u=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&Object.assign(s,d),{tagName:i,attributes:s,content:o,eventListeners:u}}};function Wo(e,t){class n extends Am{constructor(i,o){super(i,o),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const eh=Wo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),th=Wo("text"),jk=Wo("nl"),wi=Wo("url",{isLink:!0,toHref(e=Wr.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==Vr&&e[1].t===sn}}),Je=e=>new Ue(e);function Mk({groups:e}){const t=e.domain.concat([go,xo,rn,yo,vo,bo,wo,So,Qe,Vc,Er,Co,Ao,ko,vt,To,Ir,Eo]),n=[mo,sn,Gc,yt,Kc,Er,Tr,Yc,Xc,io,oo,Ar,kr,to,eo,no,ro,so,ao,lo,co,uo,ho,fo,po],r=[go,mo,xo,yo,vo,bo,wo,So,Qe,Ar,kr,Er,Co,Ao,ko,Tr,vt,To,Ir,Eo],i=Je(),o=N(i,Ir);J(o,r,o),J(o,e.domain,o);const s=Je(),a=Je(),l=Je();J(i,e.domain,s),J(i,e.scheme,a),J(i,e.slashscheme,l),J(s,r,o),J(s,e.domain,s);const c=N(s,rn);N(o,rn,c),N(a,rn,c),N(l,rn,c);const d=N(o,yt);J(d,r,o),J(d,e.domain,o);const u=Je();J(c,e.domain,u),J(u,e.domain,u);const h=N(u,yt);J(h,e.domain,u);const p=Je(eh);J(h,e.tld,p),J(h,e.utld,p),N(c,Vr,p);const g=N(u,Qe);N(g,Qe,g),J(g,e.domain,u),J(p,e.domain,u),N(p,yt,h),N(p,Qe,g);const m=N(p,sn);J(m,e.numeric,eh);const x=N(s,Qe),y=N(s,yt);N(x,Qe,x),J(x,e.domain,s),J(y,r,o),J(y,e.domain,s);const w=Je(wi);J(y,e.tld,w),J(y,e.utld,w),J(w,e.domain,s),J(w,r,o),N(w,yt,y),N(w,Qe,x),N(w,rn,c);const A=N(w,sn),I=Je(wi);J(A,e.numeric,I);const E=Je(wi),M=Je();J(E,t,E),J(E,n,M),J(M,t,E),J(M,n,M),N(w,vt,E),N(I,vt,E);const T=N(a,sn),_=N(l,sn),R=N(_,vt),D=N(R,vt);J(a,e.domain,s),N(a,yt,y),N(a,Qe,x),J(l,e.domain,s),N(l,yt,y),N(l,Qe,x),J(T,e.domain,E),N(T,vt,E),N(T,Tr,E),J(D,e.domain,E),J(D,t,E),N(D,vt,E);const P=[[Ar,kr],[eo,to],[no,ro],[io,oo],[so,ao],[lo,co],[uo,ho],[fo,po]];for(let k=0;k<P.length;k++){const[O,B]=P[k],q=N(E,O);N(M,O,q),N(q,B,E);const U=Je(wi);J(q,t,U);const Z=Je();J(q,n),J(U,t,U),J(U,n,Z),J(Z,t,U),J(Z,n,Z),N(U,B,E),N(Z,B,E)}return N(i,Vr,w),N(i,Wc,jk),{start:i,tokens:Sm}}function Nk(e,t,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let a=e,l=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(l=a.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,a=c,a.accepts()?(h=0,u=a):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(Ls(th,t,s)),s=[]),i-=h,d-=h;const p=u.t,g=n.slice(i-d,i);o.push(Ls(p,t,g))}}return s.length>0&&o.push(Ls(th,t,s)),o}function Ls(e,t,n){const r=n[0].s,i=n[n.length-1].e,o=t.slice(r,i);return new e(o,n)}const Pk=typeof console<"u"&&console&&console.warn||(()=>{}),Lk="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",xe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Dk(){return Ue.groups={},xe.scanner=null,xe.parser=null,xe.tokenQueue=[],xe.pluginQueue=[],xe.customSchemes=[],xe.initialized=!1,xe}function nh(e,t=!1){if(xe.initialized&&Pk(`linkifyjs: already initialized - will not register custom scheme "${e}" ${Lk}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
5
+ 1. Must only contain digits, lowercase ASCII letters or "-"
6
+ 2. Cannot start or end with "-"
7
+ 3. "-" cannot repeat`);xe.customSchemes.push([e,t])}function $k(){xe.scanner=Rk(xe.customSchemes);for(let e=0;e<xe.tokenQueue.length;e++)xe.tokenQueue[e][1]({scanner:xe.scanner});xe.parser=Mk(xe.scanner.tokens);for(let e=0;e<xe.pluginQueue.length;e++)xe.pluginQueue[e][1]({scanner:xe.scanner,parser:xe.parser});return xe.initialized=!0,xe}function Zc(e){return xe.initialized||$k(),Nk(xe.parser.start,e,Cm(xe.scanner.start,e))}Zc.scan=Cm;function km(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new Jc(n),i=Zc(e),o=[];for(let s=0;s<i.length;s++){const a=i[s];a.isLink&&(!t||a.t===t)&&r.check(a)&&o.push(a.toFormattedObject(r))}return o}var Qc="[\0-   ᠎ -\u2029  ]",Bk=new RegExp(Qc),Hk=new RegExp(`${Qc}$`),zk=new RegExp(Qc,"g");function Uk(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Fk(e){return new v.Plugin({key:new v.PluginKey("autolink"),appendTransaction:(t,n,r)=>{const i=t.some(c=>c.docChanged)&&!n.doc.eq(r.doc),o=t.some(c=>c.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,a=v.combineTransactionSteps(n.doc,[...t]);if(v.getChangedRanges(a).forEach(({newRange:c})=>{const d=v.findChildrenInRange(r.doc,c,p=>p.isTextblock);let u,h;if(d.length>1)u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(c.from,c.to," "," ");if(!Hk.test(p))return;u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&h){const p=h.split(Bk).filter(Boolean);if(p.length<=0)return!1;const g=p[p.length-1],m=u.pos+h.lastIndexOf(g);if(!g)return!1;const x=Zc(g).map(y=>y.toObject(e.defaultProtocol));if(!Uk(x))return!1;x.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>e.validate(y.value)).filter(y=>e.shouldAutoLink(y.value)).forEach(y=>{v.getMarksBetween(y.from,y.to,r.doc).some(w=>w.mark.type===e.type)||s.addMark(y.from,y.to,e.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function qk(e){return new v.Plugin({key:new v.PluginKey("handleClickLink"),props:{handleClick:(t,n,r)=>{var i,o;if(r.button!==0||!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let d=r.target;const u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;s=u.find(h=>h.nodeName==="A")}if(!s)return!1;const a=v.getAttributes(t.state,e.type.name),l=(i=s==null?void 0:s.href)!=null?i:a.href,c=(o=s==null?void 0:s.target)!=null?o:a.target;return e.enableClickSelection&&e.editor.commands.extendMarkRange(e.type.name),s&&l?(window.open(l,c),!0):!1}}})}function Vk(e){return new v.Plugin({key:new v.PluginKey("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:i}=e,{state:o}=t,{selection:s}=o,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const c=km(l,{defaultProtocol:e.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||i!==void 0&&!i(c.href)?!1:e.editor.commands.setMark(e.type,{href:c.href})}}})}function xn(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!e||e.replace(zk,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Wk=v.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){nh(e);return}nh(e.scheme,e.optionalSlashes)})},onDestroy(){Dk()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!xn(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!xn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!xn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",v.mergeAttributes(this.options.HTMLAttributes,e),0]:["a",v.mergeAttributes(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n;const r=((n=e.attrs)==null?void 0:n.href)||"";return`[${t.renderChildren(e)}](${r})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!xn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!xn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[v.markPasteRule({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,i=km(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!xn(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>{this.options.shouldAutoLink(o.value)&&t.push({text:o.value,data:{href:o.href},index:o.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Fk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!xn(i,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(qk({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Vk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}});function Gk(e){const[t,n]=C.useState(!1);function r(i,o,s){e.action&&(e.action({link:i,text:o,openInNewTab:s}),n(!1))}return f.jsxs(ar,{modal:!0,open:t,onOpenChange:n,children:[f.jsx(lr,{disabled:e==null?void 0:e.disabled,asChild:!0,children:f.jsx(V,{tooltip:e==null?void 0:e.tooltip,tooltipOptions:e==null?void 0:e.tooltipOptions,isActive:e==null?void 0:e.isActive,disabled:e==null?void 0:e.disabled,children:f.jsx(Ce,{name:e==null?void 0:e.icon})})}),f.jsx(Mn,{hideWhenDetached:!0,className:"richtext-w-full",align:"start",side:"bottom",children:f.jsx(Tm,{editor:e.editor,onSetLink:r,open:t,target:e.target})})]})}const Em=Wk.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:e}){return["a",v.mergeAttributes(this.options.HTMLAttributes,e,{class:"link"}),0]},addOptions(){var n,r;const e=((n=this.parent)==null?void 0:n.call(this))||{},t=(r=e.HTMLAttributes)==null?void 0:r.target;return{...e,openOnClick:!0,button:({editor:i,t:o})=>({component:Gk,componentProps:{editor:i,action:s=>{const{link:a,text:l,openInNewTab:c}=s;if(!a){i.chain().extendMarkRange("link").unsetLink().run();return}i.isActive("link")&&i.chain().extendMarkRange("link").run();const{from:d}=i.state.selection,u=l.length;i.chain().insertContent({type:"text",text:l,marks:[{type:"link",attrs:{href:/^https?:\/\//i.test(a)?a:`http://${a}`,target:t??(c?"_blank":"")}}]}).setLink({href:a}).setTextSelection({from:d,to:d+u}).focus().run()},id:"linkk",isActive:()=>i.isActive("link")||!1,disabled:!i.can().setLink({href:""}),icon:"Link",tooltip:o("editor.link.tooltip"),target:t}})}},addProseMirrorPlugins(){return[new v.Plugin({props:{handleClick:(e,t)=>{const{schema:n,doc:r,tr:i}=e.state,o=v.getMarkRange(r.resolve(t),n.marks.link);if(!o)return!1;let s=null;if(r.nodesBetween(o.from,o.to,d=>(s=d.marks.find(u=>u.type===n.marks.link),!s)),this.options.openOnClick&&(s!=null&&s.attrs.href)&&t!==o.to)return window.open(s.attrs.href,s.attrs.target||"_self"),!0;const a=r.resolve(o.from),l=r.resolve(o.to),c=i.setSelection(new v.TextSelection(a,l));e.dispatch(c)}}})]}});function Tm(e){const{t}=z.useLocale(),[n,r]=C.useState({text:"",link:""}),[i,o]=C.useState(!1),s=C.useRef(null),a=C.useRef(null);C.useEffect(()=>{const c=()=>{var w,A,I,E;const{from:d,to:u,empty:h}=e.editor.state.selection,p=(w=e.editor.extensionManager.extensions.find(M=>M.name===Em.name))==null?void 0:w.options;let g="",m="",x=(A=p==null?void 0:p.HTMLAttributes)==null?void 0:A.target;const y=e.editor.state.doc.nodeAt(d);if(y){const M=y.marks.find(T=>T.type.name==="link");M?(m=M.attrs.href||"",x=M.attrs.target,h?g=y.text||"":g=e.editor.state.doc.textBetween(d,u," ")):g=e.editor.state.doc.textBetween(d,u," ")}y||(g=e.editor.state.doc.textBetween(d,u," ")),r({link:m,text:g}),o(e.target?e.target==="_blank":x==="_blank"),e.open&&(g===""?(I=s.current)==null||I.focus():(E=a.current)==null||E.focus())};return c(),e.editor.on("selectionUpdate",c),()=>{e.editor.off("selectionUpdate",c)}},[e.editor,e.open]);function l(c){c.preventDefault(),c.stopPropagation(),e==null||e.onSetLink(n.link,n.text,i),r({text:"",link:""})}return f.jsx("div",{className:"border-neutral-200 richtext-rounded-lg !richtext-border richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:f.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-gap-2",children:[f.jsx(wt,{className:"mb-[6px]",children:t("editor.link.dialog.text")}),f.jsx("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:f.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:f.jsx(Ve,{ref:s,className:"richtext-w-80",onChange:c=>r({...n,text:c.target.value}),placeholder:"Text",required:!0,type:"text",value:n.text})})}),f.jsx(wt,{className:"mb-[6px]",children:t("editor.link.dialog.link")}),f.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:f.jsxs("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:[f.jsx(Ve,{ref:a,className:"richtext-pl-10",onChange:c=>r({...n,link:c.target.value}),required:!0,type:"url",value:n.link}),f.jsx("span",{className:"richtext-absolute richtext-inset-y-0 richtext-start-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2",children:f.jsx(Ce,{className:"richtext-size-5 richtext-text-muted-foreground",name:"Link"})})]})}),!e.target&&f.jsxs("div",{className:"richtext-flex richtext-items-center richtext-space-x-2",children:[f.jsx(wt,{children:t("editor.link.dialog.openInNewTab")}),f.jsx(lu,{checked:i,onCheckedChange:c=>{o(c)}})]}),f.jsx(Oe,{className:"richtext-mt-2 richtext-self-end",onClick:l,type:"button",children:t("editor.link.dialog.button.apply")})]})})}function Kk(e){const{t}=z.useLocale();return f.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800",children:[f.jsx("a",{href:e==null?void 0:e.link,target:"_blank",rel:"noopener noreferrer",className:"richtext-text-sm richtext-underline richtext-break-all",children:wb(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&f.jsx(ut,{orientation:"vertical",className:"!richtext-h-4"}),f.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[f.jsx(V,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),f.jsx(V,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})}function Yk({editor:e,disabled:t}){const[n,r]=C.useState(!1),i=C.useMemo(()=>{const{href:l}=e.getAttributes("link");return l},[e]),o=C.useCallback(({editor:l})=>l.isActive("link"),[]),s=(l,c,d)=>{const u=e.state.selection,{from:h}=u,p=(c==null?void 0:c.length)??0,g=h+p;e.chain().extendMarkRange("link").insertContent({type:"text",text:c,marks:[{type:"link",attrs:{href:l,target:d?"_blank":""}}]}).setLink({href:l}).setTextSelection({from:h,to:g}).focus().run(),r(!1)},a=C.useCallback(()=>{e.chain().extendMarkRange("link").unsetLink().focus().run(),r(!1)},[e]);return f.jsx(f.Fragment,{children:f.jsx(Vt,{editor:e,shouldShow:o,options:{placement:"bottom-start",offset:{alignmentAxis:6,crossAxis:6}},children:t?f.jsx(f.Fragment,{}):f.jsx(f.Fragment,{children:n?f.jsx(Tm,{editor:e,onSetLink:s}):f.jsx(Kk,{editor:e,link:i,onClear:a,onEdit:()=>{r(!0)}})})})})}var Xk=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Jk=v.Node3.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",v.mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,i,o,s;const a=(n=(t=e.attrs)==null?void 0:t.src)!=null?n:"",l=(i=(r=e.attrs)==null?void 0:r.alt)!=null?i:"",c=(s=(o=e.attrs)==null?void 0:o.title)!=null?s:"";return c?`![${l}](${a} "${c}")`:`![${l}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u"||!this.editor.isEditable)return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:o,HTMLAttributes:s})=>{const a=document.createElement("img");Object.entries(s).forEach(([d,u])=>{if(u!=null)switch(d){case"width":case"height":break;default:a.setAttribute(d,u);break}}),a.src=s.src;const l=new v.ResizableNodeView({element:a,node:i,getPos:o,onResize:(d,u)=>{a.style.width=`${d}px`,a.style.height=`${u}px`},onCommit:(d,u)=>{const h=o();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:d,height:u}).run()},onUpdate:(d,u,h)=>d.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),c=l.dom;return c.style.visibility="hidden",c.style.pointerEvents="none",a.onload=()=>{c.style.visibility="",c.style.pointerEvents=""},l}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[v.nodeInputRule({find:Xk,type:this.type,getAttributes:e=>{const[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),eu=Jk;const ti=tt.Root,ni=tt.Trigger,Zk=tt.Portal,Im=ae.forwardRef(({className:e,...t},n)=>f.jsx(tt.Overlay,{ref:n,className:ie("richtext-fixed richtext-inset-0 richtext-z-50 richtext-bg-black/80 richtext- data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0",e),...t}));Im.displayName=tt.Overlay.displayName;const or=ae.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(Zk,{children:[f.jsx(Im,{}),f.jsxs(tt.Content,{ref:r,className:ie("richtext-dialog-content richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg",e),...n,children:[t,f.jsxs(tt.Close,{className:"richtext-absolute richtext-right-4 richtext-top-4 richtext-rounded-sm richtext-opacity-70 richtext-ring-offset-background richtext-transition-opacity hover:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none data-[state=open]:richtext-bg-accent data-[state=open]:richtext-text-muted-foreground",children:[f.jsx(L.X,{className:"richtext-h-4 richtext-w-4"}),f.jsx("span",{className:"richtext-sr-only",children:"Close"})]})]})]}));or.displayName=tt.Content.displayName;function _m({className:e,...t}){return f.jsx("div",{className:ie("richtext-flex richtext-flex-col richtext-space-y-1.5 richtext-text-center sm:richtext-text-left",e),...t})}_m.displayName="DialogHeader";function Go({className:e,...t}){return f.jsx("div",{className:ie("richtext-flex richtext-flex-col-reverse sm:richtext-flex-row sm:richtext-justify-end sm:richtext-space-x-2",e),...t})}Go.displayName="DialogFooter";const sr=ae.forwardRef(({className:e,...t},n)=>f.jsx(tt.Title,{ref:n,className:ie("richtext-text-lg richtext-font-semibold richtext-leading-none richtext-tracking-tight",e),...t}));sr.displayName=tt.Title.displayName;const Qk=ae.forwardRef(({className:e,...t},n)=>f.jsx(tt.Description,{ref:n,className:ie("richtext-text-sm richtext-text-muted-foreground",e),...t}));Qk.displayName=tt.Description.displayName;const rh=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ih=re.clsx,Ko=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ih(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(c=>{const d=n==null?void 0:n[c],u=o==null?void 0:o[c];if(d===null)return null;const h=rh(d)||rh(u);return i[c][h]}),a=n&&Object.entries(n).reduce((c,d)=>{let[u,h]=d;return h===void 0||(c[u]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:u,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,x]=g;return Array.isArray(x)?x.includes({...o,...a}[m]):{...o,...a}[m]===x})?[...c,u,h]:c},[]);return ih(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},eE=Ko("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50",{variants:{variant:{default:"!richtext-bg-primary !richtext-text-primary-foreground hover:!richtext-bg-primary/90",destructive:"richtext-bg-destructive richtext-text-destructive-foreground hover:richtext-bg-destructive/90",outline:"richtext-border richtext-border-input richtext-bg-background hover:richtext-bg-accent hover:richtext-text-accent-foreground",secondary:"richtext-bg-secondary richtext-text-secondary-foreground hover:richtext-bg-secondary/80",ghost:"hover:richtext-bg-accent hover:richtext-text-accent-foreground",link:"richtext-text-primary richtext-underline-offset-4 hover:richtext-underline"},size:{default:"richtext-h-10 richtext-px-4 richtext-py-2",sm:"richtext-h-9 richtext-rounded-md richtext-px-3",lg:"richtext-h-11 richtext-rounded-md richtext-px-8",icon:"richtext-h-10 richtext-w-10"}},defaultVariants:{variant:"default",size:"default"}}),Oe=ae.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const s=r?tp.Slot:"button";return f.jsx(s,{className:ie(eE({variant:t,size:n,className:e})),ref:o,...i})});Oe.displayName="Button";function tE(e){return e.replace(/^.*\/|\..+$/g,"")}function nE(e){return e.split(".").pop()}function rE(e){return e<1024?`${e} Byte`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function iE(e){return e?e==="application/pdf"?"pdf":e.startsWith("application/")&&[".document","word"].some(t=>e.includes(t))?"word":e.startsWith("application/")&&["presentation"].some(t=>e.includes(t))?"excel":e.startsWith("application/")&&["sheet"].some(t=>e.includes(t))?"ppt":e.startsWith("image")?"image":e.startsWith("audio")?"audio":e.startsWith("video")?"video":"file":"file"}function oE(e){return new Promise(t=>{const n=new FileReader;n.addEventListener("load",()=>{t({alt:e.name,src:n.result})},!1),n.readAsDataURL(e)})}function Rm(e,t){const n=e.split(","),r=n[0].match(/:(.*?);/)[1],i=atob(n[n.length-1]);let o=i.length;const s=new Uint8Array(o);for(;o--;)s[o]=i.charCodeAt(o);return new File([s],t,{type:r})}function sE(e,t){const n=e.type,r=e.name.toLowerCase(),i=r.split(".").pop();if(!i)return!1;const s=n||{heif:"image/heif",heic:"image/heic",dng:"image/x-adobe-dng",cr2:"image/x-canon-cr2",nef:"image/x-nikon-nef",arw:"image/x-sony-arw",raf:"image/x-fuji-raf",orf:"image/x-olympus-orf"}[i];return t.some(a=>{if(a.startsWith("."))return r.endsWith(a);if(a.endsWith("/*")){const l=a.split("/")[0];return s==null?void 0:s.startsWith(l+"/")}return s===a})}function Om(e,t){const{acceptMimes:n,maxSize:r,t:i,toast:o}=t,s=[];return(Array.isArray(e)?e:Object.values(e)).forEach(l=>{if(!sE(l,n)){t.onError?t.onError({type:"type",message:i("editor.upload.fileTypeNotSupported",{fileName:l.name}),file:l}):o({variant:"default",title:i("editor.upload.fileTypeNotSupported",{fileName:l.name})});return}if(l.size>r){const c=(r/1024/1024).toFixed(2);t.onError?t.onError({type:"size",message:i("editor.upload.fileSizeTooBig",{fileName:l.name,size:c}),file:l}):o({variant:"default",title:i("editor.upload.fileSizeTooBig",{fileName:l.name,size:c})});return}s.push(l)}),s}function aE({editor:e,imageInline:t,onClose:n,disabled:r,alt:i}){var D,P;const{t:o}=z.useLocale(),{toast:s}=Zo(),[a,l]=C.useState(!1),[c,d]=C.useState(!1),u=C.useRef(null),[h,p]=C.useState(),[g,m]=C.useState(""),x=C.useRef(null),[y,w]=C.useState({src:"",file:null}),A=C.useMemo(()=>{var k;return(k=e.extensionManager.extensions.find(O=>O.name===Qn.name))==null?void 0:k.options},[e]);function I(k){if(u.current&&k.width&&k.height){const O=E(u.current,k);m(O)}}function E(k,O){const B=document.createElement("canvas"),q=k.naturalWidth/k.width,U=k.naturalHeight/k.height;B.width=O.width*q,B.height=O.height*U;const Z=B.getContext("2d");return Z&&(Z.imageSmoothingEnabled=!1,Z.drawImage(k,O.x*q,O.y*U,O.width*q,O.height*U,0,0,O.width*q,O.height*U)),B.toDataURL("image/png",1)}const M=C.useCallback(async()=>{var k;if(!c){d(!0);try{const O=Rm(g,((k=y==null?void 0:y.file)==null?void 0:k.name)||"image.png");let B="";A.upload?B=await A.upload(O):B=URL.createObjectURL(O),e.chain().focus().setImageInline({src:B,inline:t,alt:i}).run(),l(!1),w({src:"",file:null}),R(),n()}catch(O){console.log("Error cropping image",O)}finally{d(!1)}}},[g,e,t,c,n,(D=y==null?void 0:y.file)==null?void 0:D.name,A]);function T(k){var O;k.preventDefault(),(O=x.current)==null||O.click()}const _=async k=>{var Z;const O=(Z=k==null?void 0:k.target)==null?void 0:Z.files;if(!e||e.isDestroyed||O.length===0){k.target.value="";return}const B=Om(O,{acceptMimes:A==null?void 0:A.acceptMimes,maxSize:A==null?void 0:A.maxSize,t:o,toast:s,onError:A.onError});if(B.length<=0){k.target.value="";return}const q=B[0],U=await oE(q);l(!0),w({src:U.src,file:q})},R=()=>{x.current&&(x.current.value="")};return f.jsxs(f.Fragment,{children:[f.jsx(Oe,{className:"richtext-mt-1 richtext-w-full",disabled:r,onClick:T,size:"sm",children:o("editor.image.dialog.tab.uploadCrop")}),f.jsxs(ti,{open:a,onOpenChange:k=>{l(k),k||(w({src:"",file:null}),R())},children:[f.jsx(ni,{}),f.jsxs(or,{children:[f.jsx(sr,{children:o("editor.image.dialog.tab.uploadCrop")}),f.jsx("div",{children:y.src&&f.jsx(L0,{className:"richtext-w-full",crop:h,onChange:k=>p(k),onComplete:k=>I(k),children:f.jsx("img",{alt:"Crop me",ref:u,src:y.src})})}),f.jsxs(Go,{children:[f.jsxs(Oe,{disabled:c,onClick:()=>{l(!1),w({src:"",file:null}),R()},children:[o("editor.imageUpload.cancel"),f.jsx(Ce,{className:"richtext-ml-1",name:"Trash2"})]}),f.jsx(Oe,{className:"richtext-w-fit",disabled:c||!h,onClick:M,children:c?f.jsxs(f.Fragment,{children:[o("editor.imageUpload.uploading"),f.jsx(Ce,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):f.jsxs(f.Fragment,{children:[o("editor.imageUpload.crop"),f.jsx(Ce,{className:"richtext-ml-1",name:"Crop"})]})})]})]})]}),f.jsx("input",{accept:((P=A==null?void 0:A.acceptMimes)==null?void 0:P.join(","))||"image/*",multiple:!1,onChange:_,ref:x,style:{display:"none"},type:"file"})]})}function Yo(e){function t(){const o=C.useRef(e),s=C.useCallback(()=>o.current,[]),a=C.useRef(new Set),l=C.useCallback(d=>{o.current={...o.current,...d},a.current.forEach(u=>u())},[]),c=C.useCallback(d=>(a.current.add(d),()=>a.current.delete(d)),[]);return{get:s,set:l,subscribe:c}}const n=C.createContext(null);function r({children:o}){return f.jsx(n.Provider,{value:t(),children:o})}function i(o){const s=C.useContext(n);if(!s)throw new Error("Store not found");return[C.useSyncExternalStore(s.subscribe,()=>o(s.get()),()=>o(e)),s.set]}return{Provider:r,useStore:i}}Yo({value:!1});Yo({value:!1});const{Provider:lE,useStore:jm}=Yo({value:!1}),{Provider:cE,useStore:Mm}=Yo({value:"light"});z.d("0");function Io(e,t){return window.addEventListener(e,t),()=>{window.removeEventListener(e,t)}}function Xo(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}const pn={UPLOAD_IMAGE:e=>`UPLOAD_IMAGE-${e}`,UPLOAD_VIDEO:e=>`UPLOAD_VIDEO-${e}`,EDIT:e=>`EDIT-${e}`,UPDATE_THEME:e=>`UPDATE_THEME-${e}`},Nm={setOpen:(e,t)=>{Xo(pn.UPLOAD_IMAGE(e),t)}};function uE(e){var I;const{t}=z.useLocale(),{toast:n}=Zo(),[r,i]=C.useState(!1),[o,s]=C.useState(!1),a=E=>{i(E.detail)},[l,c]=C.useState(""),[d,u]=C.useState(""),h=C.useRef(null),p=((I=e.editor.extensionManager.extensions.find(E=>E.name===Qn.name))==null?void 0:I.options.defaultInline)||!1,[g,m]=C.useState(p),x=C.useMemo(()=>{var M;return(M=e.editor.extensionManager.extensions.find(T=>T.name===Qn.name))==null?void 0:M.options},[e.editor]);C.useEffect(()=>{const E=Io(pn.UPLOAD_IMAGE(e.editor.id),a);return()=>{E()}},[]);async function y(E){var _;const M=(_=E==null?void 0:E.target)==null?void 0:_.files;if(!e.editor||e.editor.isDestroyed||M.length===0||o){E.target.value="";return}const T=Om(M,{acceptMimes:x==null?void 0:x.acceptMimes,maxSize:x==null?void 0:x.maxSize,t,toast:n,onError:x.onError});if(T.length<=0){E.target.value="";return}s(!0);try{if(x!=null&&x.multiple){const R=T.map(async P=>{let k="";return x.upload?k=await x.upload(P):k=URL.createObjectURL(P),k});(await Promise.all(R)).forEach(P=>{e.editor.chain().focus().setImageInline({src:P,inline:g,alt:d}).run()})}else{const R=T[0];let D="";x.upload?D=await x.upload(R):D=URL.createObjectURL(R),e.editor.chain().focus().setImageInline({src:D,inline:g,alt:d}).run()}i(!1),u(""),m(p)}catch(R){console.error("Error uploading image",R),x.onError?x.onError({type:"upload",message:t("editor.upload.error")}):n({variant:"destructive",title:t("editor.upload.error")})}finally{s(!1),E.target.value=""}}function w(E){E.preventDefault(),E.stopPropagation(),e.editor.chain().focus().setImageInline({src:l,inline:g,alt:d}).run(),i(!1),m(p),c(""),u("")}function A(E){var M;E.preventDefault(),(M=h.current)==null||M.click()}return f.jsxs(ti,{onOpenChange:i,open:r,children:[f.jsx(ni,{asChild:!0,children:f.jsx(V,{action:()=>i(!0),icon:e.icon,tooltip:e.tooltip,tooltipOptions:e.tooltipOptions})}),f.jsxs(or,{children:[f.jsx(sr,{children:t("editor.image.dialog.title")}),f.jsxs(zm,{activationMode:"manual",defaultValue:x.resourceImage==="both"||x.resourceImage==="upload"?"upload":"link",children:[x.resourceImage==="both"&&f.jsxs(cu,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[f.jsx(Kr,{value:"upload",children:t("editor.image.dialog.tab.upload")}),f.jsx(Kr,{value:"link",children:t("editor.image.dialog.tab.url")})]}),f.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]",children:[f.jsx(Gm,{checked:g,onCheckedChange:E=>{m(E)}}),f.jsx(wt,{children:t("editor.link.dialog.inline")})]}),x.enableAlt&&f.jsxs("div",{className:"richtext-my-[10px] ",children:[f.jsx(wt,{className:"mb-[6px]",children:t("editor.imageUpload.alt")}),f.jsx(Ve,{onChange:E=>u(E.target.value),required:!0,type:"text",value:d})]}),f.jsxs(Yr,{value:"upload",children:[f.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[f.jsx(Oe,{className:"richtext-mt-1 richtext-w-full",disabled:o,onClick:A,size:"sm",children:o?f.jsxs(f.Fragment,{children:[t("editor.imageUpload.uploading"),f.jsx(Ce,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):t("editor.image.dialog.tab.upload")}),f.jsx(aE,{alt:d,disabled:o,editor:e.editor,imageInline:g,onClose:()=>{Nm.setOpen(e.editor.id,!1),u("")}})]}),f.jsx("input",{accept:x.acceptMimes.join(",")||"image/*",multiple:x.multiple,onChange:y,ref:h,style:{display:"none"},type:"file"})]}),f.jsx(Yr,{value:"link",children:f.jsx("form",{onSubmit:w,children:f.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[f.jsx(Ve,{autoFocus:!0,onChange:E=>c(E.target.value),placeholder:t("editor.image.dialog.placeholder"),required:!0,type:"url",value:l}),f.jsx(Oe,{type:"submit",children:t("editor.image.dialog.button.apply")})]})})})]})]})]})}const Si={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function dE(e){var _,R,D;const[t,n]=C.useState({width:z.IMAGE_MAX_SIZE,height:z.IMAGE_MAX_SIZE}),[r,i]=C.useState({width:0,height:0}),[o]=C.useState([Si.TOP_LEFT,Si.TOP_RIGHT,Si.BOTTOM_LEFT,Si.BOTTOM_RIGHT]),[s,a]=C.useState(!1),[l,c]=C.useState({x:0,y:0,w:0,h:0,dir:""}),{align:d,inline:u}=(_=e==null?void 0:e.node)==null?void 0:_.attrs,h=u&&(d==="left"||d==="right"),p=C.useMemo(()=>{var gt;const{src:P,alt:k,width:O,height:B,flipX:q,flipY:U}=(gt=e==null?void 0:e.node)==null?void 0:gt.attrs,Z=Hi(O)?`${O}px`:O,ce=Hi(B)?`${B}px`:B,te=[];q&&te.push("rotateX(180deg)"),U&&te.push("rotateY(180deg)");const He=te.join(" ");return{src:P||void 0,alt:k||void 0,style:{width:Z||void 0,height:ce||void 0,transform:He||"none",...h?{float:d}:{}}}},[(R=e==null?void 0:e.node)==null?void 0:R.attrs]),g=C.useMemo(()=>{const{style:{width:P}}=p;return{width:P==="100%"?P:void 0}},[p]);function m(P){i({width:P.target.width,height:P.target.height})}function x(){const{editor:P,getPos:k}=e;P.commands.setNodeSelection(k())}const y=C.useCallback(Kn(()=>{const{editor:P}=e,{width:k}=getComputedStyle(P.view.dom);n(O=>({...O,width:Number.parseInt(k,10)}))},z.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function w(P,k){P.preventDefault(),P.stopPropagation();const O=r.width,B=r.height,q=O/B;let U=Number(e.node.attrs.width),Z=Number(e.node.attrs.height);const ce=t.width;U&&!Z?(U=U>ce?ce:U,Z=Math.round(U/q)):Z&&!U?(U=Math.round(Z*q),U=U>ce?ce:U):!U&&!Z?(U=O>ce?ce:O,Z=Math.round(U/q)):U=U>ce?ce:U,a(!0),c({x:P.clientX,y:P.clientY,w:U,h:Z,dir:k})}const A=C.useCallback(Kn(P=>{if(P.preventDefault(),P.stopPropagation(),!s)return;const{x:k,w:O,dir:B}=l,q=(P.clientX-k)*(/l/.test(B)?-1:1),U=Ip(O+q,z.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:U,height:null})},z.IMAGE_THROTTLE_WAIT_TIME),[s,l,t,e.updateAttributes]),I=C.useCallback(P=>{P.preventDefault(),P.stopPropagation(),s&&(c({x:0,y:0,w:0,h:0,dir:""}),a(!1),x())},[s,x]),E=C.useCallback(()=>{document==null||document.addEventListener("mousemove",A,!0),document==null||document.addEventListener("mouseup",I,!0)},[A,I]),M=C.useCallback(()=>{document==null||document.removeEventListener("mousemove",A,!0),document==null||document.removeEventListener("mouseup",I,!0)},[A,I]);C.useEffect(()=>(s?E():M(),()=>{M()}),[s,E,M]);const T=C.useMemo(()=>new ResizeObserver(()=>y()),[y]);return C.useEffect(()=>(T.observe(e.editor.view.dom),()=>{T.disconnect()}),[e.editor.view.dom,T]),f.jsx(re.NodeViewWrapper,{as:u?"span":"div",className:"image-view",style:{float:h?d:void 0,margin:h?d==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:u?"inline":"block",textAlign:h?void 0:d,width:((D=p.style)==null?void 0:D.width)??"auto",...h?{}:g},children:f.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:g,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[f.jsx("img",{alt:p.alt,className:"image-view__body__image block",height:"auto",onClick:x,onLoad:m,src:p.src,style:p.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&f.jsx("div",{className:"image-resizer",children:o==null?void 0:o.map(P=>f.jsx("span",{className:`image-resizer__handler image-resizer__handler--${P}`,onMouseDown:k=>w(k,P)},`image-dir-${P}`))})]})})}const Gn=new v.PluginKey("upload-image");function hE(){return new v.Plugin({key:Gn,state:{init(){return v.DecorationSet.empty},apply(e,t){t=t.map(e.mapping,e.doc);const n=e.getMeta(Gn);if(n!=null&&n.add)for(const{id:r,pos:i,src:o}of n.add){const s=fE(o),a=v.Decoration.widget(i,s,{id:r});t=t.add(e.doc,[a])}else if(n!=null&&n.remove)for(const r of n.remove)t=t.remove(t.find(void 0,void 0,i=>i.id===r));return t}},props:{decorations(e){return this.getState(e)}}})}function fE(e){const t=document.createElement("div"),n=document.createElement("img");return n.setAttribute("class","opacity-50"),n.src=e,n.addEventListener("load",()=>{t.setAttribute("class","img-placeholder")}),t.append(n),t}function pE(e,t){var i;const r=Gn.getState(e).find(void 0,void 0,o=>o.id===t);return r.length>0?(i=r[0])==null?void 0:i.from:null}function gE({validateFn:e,onUpload:t,postUpload:n,defaultInline:r=!1}){return(i,o,s)=>{for(const a of i){if(e&&!e(a))continue;const l=Date.now().toString(),c=o.state.tr;c.selection.empty||c.deleteSelection();const d=URL.createObjectURL(a);c.setMeta(Gn,{add:[{id:l,pos:s,src:d}]}),o.dispatch(c),t(a).then(async u=>{var w;n&&typeof u=="string"&&(u=await n(u));const{schema:h}=o.state;let p=pE(o.state,l);if(p===null)return;const g=typeof u=="object"?d:u,m=(w=h.nodes.image)==null?void 0:w.create({src:g,inline:r});if(!m)return;const{doc:x}=o.state;p>x.content.size&&(p=x.content.size-1);const y=o.state.tr.replaceWith(p,p,m).setMeta(Gn,{remove:[l]});o.dispatch(y)},()=>{const u=o.state.tr.delete(s,s).setMeta(Gn,{remove:[l]});o.dispatch(u)})}}}function mE(e,t,n){var i;const r=[...((i=t.clipboardData)==null?void 0:i.files)||[]];if(r.length>0){t.preventDefault();const o=e.state.selection.from;return n(r,e,o+1),!0}return!1}function xE(e,t,n,r){var o;const i=[...((o=t.dataTransfer)==null?void 0:o.files)||[]];if(!n&&i.length>0){t.preventDefault();const s=e.posAtCoords({left:t.clientX,top:t.clientY});if(s)return r(i,e,s.pos+1),!0}return!1}const yE={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,multiple:!0,resourceImage:"both",defaultInline:!1,enableAlt:!0},Qn=eu.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var e;return{...yE,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:n,t:r})=>{var i,o;return{component:uE,componentProps:{action:()=>!0,upload:n.options.upload,disabled:!((o=(i=t.can()).setImage)!=null&&o.call(i,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip"),editor:t}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:t=>{const n=t.style.width||t.getAttribute("width")||null;return n?Number.parseInt(n,10):null},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})},inline:{default:!1,parseHTML:t=>!!t.getAttribute("inline"),renderHTML:t=>({inline:t.inline})},alt:{default:"",parseHTML:t=>t.getAttribute("alt"),renderHTML:t=>({alt:t.alt})}}},addNodeView(){return re.ReactNodeViewRenderer(dE)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageInline:t=>({commands:n})=>n.insertContent({type:this.name,attrs:{...t,inline:t.inline??this.options.defaultInline}}),updateImage:t=>({commands:n})=>n.updateAttributes(this.name,t),setAlignImage:t=>({commands:n})=>n.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{flipX:t,flipY:n,align:r,inline:i}=e,o=i&&(r==="left"||r==="right"),s=t||n?`transform: rotateX(${t?"180":"0"}deg) rotateY(${n?"180":"0"}deg);`:"",a=o?"":`text-align: ${r};`,d=`${o?`float: ${r};`:""}${o?r==="left"?"margin: 1em 1em 1em 0;":"margin: 1em 0 1em 1em;":""}${s}`;return[i?"span":"div",{style:a,class:"image"},["img",v.mergeAttributes({height:"auto",style:d},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"span.image img",getAttrs:e=>{var o;const t=e==null?void 0:e.parentElement,n=e==null?void 0:e.getAttribute("width"),r=(e==null?void 0:e.getAttribute("flipx"))||!1,i=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:n?Number.parseInt(n,10):null,align:(e==null?void 0:e.getAttribute("align"))||((o=t==null?void 0:t.style)==null?void 0:o.textAlign)||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:r==="true",flipY:i==="true"}}},{tag:"div[class=image]",getAttrs:e=>{const t=e.querySelector("img"),n=t==null?void 0:t.getAttribute("width"),r=(t==null?void 0:t.getAttribute("flipx"))||!1,i=(t==null?void 0:t.getAttribute("flipy"))||!1;return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),caption:t==null?void 0:t.getAttribute("caption"),width:n?Number.parseInt(n,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null,inline:(t==null?void 0:t.getAttribute("inline"))||!1,flipX:r==="true",flipY:i==="true"}}},{tag:'img[src]:not([src^="data:"])'}]},addProseMirrorPlugins(){const t=gE({validateFn:n=>!(!this.options.acceptMimes.includes(n.type)||n.size>this.options.maxSize),onUpload:this.options.upload,defaultInline:this.options.defaultInline});return[hE(),new v.Plugin({key:new v.PluginKey("image"),props:{handlePaste:(n,r)=>{var s;return r.clipboardData&&r.clipboardData.files&&((s=r.clipboardData.files)==null?void 0:s.length)?[...r.clipboardData.files||[]].some(a=>a.type==="text/html")?!1:mE(n,r,t):void 0},handleDrop:(n,r,i,o)=>(!(r instanceof DragEvent)||!r.dataTransfer||xE(n,r,o,t),!1)}})]}});async function vE(e){var r;const n=await(await fetch(`https://api.giphy.com/v1/gifs/trending?q=&limit=15&api_key=${e}`)).json();return(r=n==null?void 0:n.data)==null?void 0:r.map(i=>{var o,s,a;return{id:i==null?void 0:i.id,src:(o=i==null?void 0:i.images.original)==null?void 0:o.url,width:+((s=i==null?void 0:i.images.original)==null?void 0:s.width),height:+((a=i==null?void 0:i.images.original)==null?void 0:a.width)}})}async function bE(e,t){var i;const r=await(await fetch(`https://api.giphy.com/v1/gifs/search?q=${e}&limit=15&api_key=${t}`)).json();return(i=r==null?void 0:r.data)==null?void 0:i.map(o=>{var s,a,l;return{id:o==null?void 0:o.id,src:(s=o==null?void 0:o.images.original)==null?void 0:s.url,width:+((a=o==null?void 0:o.images.original)==null?void 0:a.width),height:+((l=o==null?void 0:o.images.original)==null?void 0:l.width)}})}async function wE(e){var o,s;const t=await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`),n=await(t==null?void 0:t.json()),i=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(o=n==null?void 0:n.results)==null?void 0:o[0]}&limit=15`)).json();return(s=i==null?void 0:i.results)==null?void 0:s.map(a=>{var l,c,d,u,h,p,g,m;return{id:a==null?void 0:a.id,src:(c=(l=a==null?void 0:a.media_formats)==null?void 0:l.gif)==null?void 0:c.url,width:(h=(u=(d=a==null?void 0:a.media_formats)==null?void 0:d.gif)==null?void 0:u.dims)==null?void 0:h[0],height:(m=(g=(p=a==null?void 0:a.media_formats)==null?void 0:p.gif)==null?void 0:g.dims)==null?void 0:m[1]}})}async function SE(e,t){var i;const r=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();return(i=r==null?void 0:r.results)==null?void 0:i.map(o=>{var s,a,l,c,d,u,h,p;return{id:o==null?void 0:o.id,src:(a=(s=o==null?void 0:o.media_formats)==null?void 0:s.gif)==null?void 0:a.url,width:(d=(c=(l=o==null?void 0:o.media_formats)==null?void 0:l.gif)==null?void 0:c.dims)==null?void 0:d[0],height:(p=(h=(u=o==null?void 0:o.media_formats)==null?void 0:u.gif)==null?void 0:h.dims)==null?void 0:p[1]}})}function CE(e,t){return{searchTrending:async()=>t?e==="giphy"?vE(t):e==="tenor"?wE(t):[]:[],searchWord:async i=>t?e==="giphy"?bE(i,t):e==="tenor"?SE(i,t):[]:[]}}function AE({selectImage:e,apiKey:t,provider:n,children:r}){const[i,o]=C.useState([]),s=C.useRef(null),{searchTrending:a,searchWord:l}=CE(n,t);C.useEffect(()=>{(async()=>{const d=await a();o(d)})()},[]);const c=C.useCallback(Mo(async d=>{if(!d.target.value){const h=await a();o(h);return}const u=await l(d.target.value);o(u)},350),[]);return f.jsxs(ar,{modal:!0,children:[f.jsx(lr,{asChild:!0,children:r}),f.jsx(Mn,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:t?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"richtext-mb-[10px] richtext-w-full",children:f.jsx(Ve,{onChange:c,placeholder:"Search GIF",ref:s,type:"text"})}),f.jsx("div",{className:"richtext-max-h-[280px] !richtext-max-w-[400px] richtext-overflow-y-auto",children:f.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1 ",children:i!=null&&i.length?i==null?void 0:i.map(d=>f.jsx("img",{alt:"",className:"richtext-cursor-pointer richtext-object-contain richtext-text-center",onClick:()=>e(d.src),src:d.src},d.id)):f.jsx("p",{children:"No GIFs found"})})})]}):f.jsx("div",{children:f.jsx("p",{children:"Missing Giphy API Key"})})})]})}function kE({editor:e,icon:t,provider:n,apiKey:r,...i}){const o=s=>{e.chain().focus().setImageGif({src:s}).run()};return f.jsx(AE,{apiKey:r,provider:n,selectImage:o,children:f.jsx(V,{icon:t,tooltip:i==null?void 0:i.tooltip,tooltipOptions:i==null?void 0:i.tooltipOptions})})}const Ci={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function EE(e){var M,T;const[t,n]=C.useState({width:z.IMAGE_MAX_SIZE,height:z.IMAGE_MAX_SIZE}),[r,i]=C.useState({width:0,height:0}),[o]=C.useState([Ci.TOP_LEFT,Ci.TOP_RIGHT,Ci.BOTTOM_LEFT,Ci.BOTTOM_RIGHT]),[s,a]=C.useState(!1),[l,c]=C.useState({x:0,y:0,w:0,h:0,dir:""}),{align:d}=(M=e==null?void 0:e.node)==null?void 0:M.attrs,u=C.useMemo(()=>{var B;const{src:_,alt:R,width:D,height:P}=(B=e==null?void 0:e.node)==null?void 0:B.attrs,k=Hi(D)?`${D}px`:D,O=Hi(P)?`${P}px`:P;return{src:_||void 0,alt:R||void 0,style:{width:k||void 0,height:O||void 0}}},[(T=e==null?void 0:e.node)==null?void 0:T.attrs]),h=C.useMemo(()=>{const{style:{width:_}}=u;return{width:_==="100%"?_:void 0}},[u]);function p(_){i({width:_.target.width,height:_.target.height})}function g(){const{editor:_,getPos:R}=e;_.commands.setNodeSelection(R())}const m=C.useCallback(Kn(()=>{const{editor:_}=e,{width:R}=getComputedStyle(_.view.dom);n(D=>({...D,width:Number.parseInt(R,10)}))},z.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function x(_,R){_.preventDefault(),_.stopPropagation();const D=r.width,P=r.height,k=D/P;let O=Number(e.node.attrs.width),B=Number(e.node.attrs.height);const q=t.width;O&&!B?(O=O>q?q:O,B=Math.round(O/k)):B&&!O?(O=Math.round(B*k),O=O>q?q:O):!O&&!B?(O=D>q?q:D,B=Math.round(O/k)):O=O>q?q:O,a(!0),c({x:_.clientX,y:_.clientY,w:O,h:B,dir:R})}const y=C.useCallback(Kn(_=>{if(_.preventDefault(),_.stopPropagation(),!s)return;const{x:R,w:D,dir:P}=l,k=(_.clientX-R)*(/l/.test(P)?-1:1),O=Ip(D+k,z.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:O,height:null})},z.IMAGE_THROTTLE_WAIT_TIME),[s,l,t,e.updateAttributes]),w=C.useCallback(_=>{_.preventDefault(),_.stopPropagation(),s&&(c({x:0,y:0,w:0,h:0,dir:""}),a(!1),g())},[s,g]),A=C.useCallback(()=>{document==null||document.addEventListener("mousemove",y,!0),document==null||document.addEventListener("mouseup",w,!0)},[y,w]),I=C.useCallback(()=>{document==null||document.removeEventListener("mousemove",y,!0),document==null||document.removeEventListener("mouseup",w,!0)},[y,w]);C.useEffect(()=>(s?A():I(),()=>{I()}),[s,A,I]);const E=C.useMemo(()=>new ResizeObserver(()=>m()),[m]);return C.useEffect(()=>(E.observe(e.editor.view.dom),()=>{E.disconnect()}),[e.editor.view.dom,E]),f.jsx(re.NodeViewWrapper,{className:"image-view",style:{...h,width:"100%",textAlign:d},children:f.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:h,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[f.jsx("img",{alt:u.alt,className:"image-view__body__image block",height:"auto",onClick:g,onLoad:p,src:u.src,style:u.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&f.jsx("div",{className:"image-resizer",children:o==null?void 0:o.map(_=>f.jsx("span",{className:`image-resizer__handler image-resizer__handler--${_}`,onMouseDown:R=>x(R,_)},`image-dir-${_}`))})]})})}const tu=eu.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",API_KEY:"",provider:"giphy",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:n,t:r})=>{var s,a;const i=((s=n==null?void 0:n.options)==null?void 0:s.provider)||"",o=((a=n==null?void 0:n.options)==null?void 0:a.API_KEY)||"";return{component:kE,componentProps:{editor:t,action:()=>{},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:r("editor.imageGif.tooltip"),apiKey:o,provider:i}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const n=t.style.width||t.getAttribute("width")||"10";return n===void 0?null:Number.parseInt(`${n}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return re.ReactNodeViewRenderer(EE)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:n})=>n.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:n})=>n.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:n})=>n.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",v.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),n=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:n?Number.parseInt(n,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});function TE(e,t){let n;try{n=new URL(e)}catch{return!1}return!(t!=null&&t.length)||t.length===1&&t[0]==="."?!0:t.some(r=>{if(r.includes("*")){const i=r.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(n.hostname)}return n.hostname.includes(r)})}function IE(e){const{t}=z.useLocale(),[n,r]=C.useState(""),i=C.useRef(null),[o,s]=C.useState(""),[a,l]=C.useState(!1),c=g=>{l(g.detail)};C.useEffect(()=>{const g=Io(pn.UPLOAD_VIDEO(e.editor.id),c);return()=>{g()}},[]);const d=C.useMemo(()=>{var m;return(m=e.editor.extensionManager.extensions.find(x=>x.name===nu.name))==null?void 0:m.options},[e.editor]);async function u(g){var w;const m=(w=g==null?void 0:g.target)==null?void 0:w.files;if(!e.editor||e.editor.isDestroyed||m.length===0)return;const x=m[0];let y="";d.upload?y=await d.upload(x):y=URL.createObjectURL(x),e.editor.chain().focus().setVideo({src:y,width:"100%"}).run(),l(!1)}function h(g){g.preventDefault(),g.stopPropagation(),n&&(e.editor.chain().focus().setVideo({src:n,width:"100%"}).run(),l(!1),r(""))}function p(g){var m;g.preventDefault(),(m=i.current)==null||m.click()}return f.jsxs(ti,{onOpenChange:l,open:a,children:[f.jsx(ni,{asChild:!0,children:f.jsx(V,{action:()=>l(!0),icon:e.icon,tooltip:e.tooltip,tooltipOptions:e.tooltipOptions})}),f.jsxs(or,{children:[f.jsx(sr,{children:t("editor.video.dialog.title")}),f.jsxs(zm,{activationMode:"manual",defaultValue:(d==null?void 0:d.resourceVideo)==="both"||(d==null?void 0:d.resourceVideo)==="upload"?"upload":"link",children:[f.jsxs(cu,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((d==null?void 0:d.resourceVideo)==="both"||(d==null?void 0:d.resourceVideo)==="upload")&&f.jsx(Kr,{value:"upload",children:t("editor.video.dialog.tab.upload")}),((d==null?void 0:d.resourceVideo)==="both"||(d==null?void 0:d.resourceVideo)==="link")&&f.jsx(Kr,{value:"link",children:t("editor.video.dialog.link")})]}),f.jsxs(Yr,{value:"upload",children:[f.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:f.jsx(Oe,{className:"richtext-mt-1 richtext-w-full",onClick:p,size:"sm",children:t("editor.video.dialog.tab.upload")})}),f.jsx("input",{accept:"video/*",multiple:!0,onChange:u,ref:i,type:"file",style:{display:"none"}})]}),f.jsxs(Yr,{value:"link",children:[f.jsx("div",{children:f.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[f.jsx(Ve,{autoFocus:!0,placeholder:t("editor.video.dialog.placeholder"),required:!0,type:"url",value:n,onChange:g=>{r(g.target.value)},onBlur:g=>{const m=g.target.value,x=d.videoProviders||["."];m&&!TE(m,x)?s("Invalid video URL"):s("")}}),f.jsx(Oe,{type:"button",onClick:h,children:t("editor.video.dialog.button.apply")})]})}),o&&f.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:o})]})]})]})]})}function _E(e,t,n){return e<t?t:e>n?n:e}const RE=e=>typeof e=="number",OE=e=>typeof e=="string",jE=e=>typeof e=="function";function ME(e,t="px"){if(!e)return e;const n=RE(e)?String(e):e,r=Number.parseFloat(n),i=n.match(/[%a-z]+$/i),o=i?i[0]:t;return Number.isNaN(r)?e:r+o}function Pm(e,t){if(!e)return!1;const{extensions:n=[]}=(e==null?void 0:e.extensionManager)??{};return!!n.find(i=>i.name===t)}function NE(e){return e.map(t=>OE(t)?{value:t,name:t}:t)}function PE(e){e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/");const t=e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);t&&(e=`https://www.youtube.com/embed/${t[1]}`);const n=e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);if(n){const i=n[1],o=n[2];o?e=`https://player.vimeo.com/video/${i}?h=${o}`:e=`https://player.vimeo.com/video/${i}`}return/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const nu=v.Node3.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:z.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper"},button:({editor:e,t})=>{var n,r;return{component:IE,componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((r=(n=e.can()).setVideo)!=null&&r.call(n,{})),icon:"Video",tooltip:t("editor.video.tooltip"),videoProviders:["."],editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?PE(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:ME(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},align:{default:"center",renderHTML:({align:e})=>({align:e})}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%",align:n="center"}=e??{},r={...e,width:"100%",height:"100%"},i=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,o=`flex: 1;padding-bottom: ${9/16*100}%;`,d=["div",{style:`display: flex; justify-content: ${n};`},["div",{style:i},["div",{style:o}],["iframe",r]]];return["div",{...this.options.HTMLAttributes,class:"iframe-wrapper","data-video":""},d]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}});function ru({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?f.jsx(C.Fragment,{children:e.type==="divider"?f.jsx(ut,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):f.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):f.jsx(f.Fragment,{})}function LE(e){return e.type.name===Qn.name}function DE(e){return e.type.name===tu.name}function $E(e){return e.type.name===nu.name}function BE(e){const{lang:t}=z.useLocale(),n=({editor:i})=>{const{selection:o}=i.view.state,{$from:s,to:a}=o;let l=!1;return i.view.state.doc.nodesBetween(s.pos,a,c=>{if(LE(c))return l=!0,!1}),l},r=C.useMemo(()=>e.disabled?[]:lw(e.editor),[e.disabled,e.editor,t]);return f.jsx(f.Fragment,{children:f.jsx(Vt,{editor:e==null?void 0:e.editor,shouldShow:n,children:r!=null&&r.length?f.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:f.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((i,o)=>f.jsx(ru,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-${o}`))})}):f.jsx(f.Fragment,{})})})}function HE(e){const{lang:t}=z.useLocale(),n=({editor:i})=>{const{selection:o}=i.view.state,{$from:s,to:a}=o;let l=!1;return i.view.state.doc.nodesBetween(s.pos,a,c=>{if(DE(c))return l=!0,!1}),l},r=C.useMemo(()=>e.disabled?[]:cw(e.editor),[e.disabled,e.editor,t]);return f.jsx(f.Fragment,{children:f.jsx(Vt,{editor:e==null?void 0:e.editor,shouldShow:n,children:r!=null&&r.length?f.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:f.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((i,o)=>f.jsx(ru,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-gif-${o}`))})}):f.jsx(f.Fragment,{})})})}function zE(e){const{lang:t}=z.useLocale(),n=({editor:i})=>{const{selection:o}=i.view.state,{$from:s,to:a}=o;let l=!1;return i.view.state.doc.nodesBetween(s.pos,a,c=>{if($E(c))return l=!0,!1}),l},r=C.useMemo(()=>e.disabled?[]:hw(e.editor),[e.editor,e.disabled,t]);return f.jsx(f.Fragment,{children:f.jsx(Vt,{editor:e==null?void 0:e.editor,shouldShow:n,children:r!=null&&r.length?f.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:f.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:r==null?void 0:r.map((i,o)=>f.jsx(ru,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-video-${o}`))})}):f.jsx(f.Fragment,{})})})}function UE(e,t,n=null){return n?e.createChecked({index:t},n):e.createAndFill({index:t})}function FE(e){if(e.cached.columnsNodeTypes)return e.cached.columnsNodeTypes;const t={columns:e.nodes.columns,column:e.nodes.column};return e.cached.columnsNodeTypes=t,t}function qE(e,t,n=null){const r=FE(e),i=[];for(let o=0;o<t;o+=1){const s=UE(r.column,o,n);s&&i.push(s)}return r.columns.createChecked({cols:t},i)}function Ds({state:e,dispatch:t,type:n}){const r=v.findParentNode(o=>o.type.name===Gr.name)(e.selection),i=v.findParentNode(o=>o.type.name===iu.name)(e.selection);if(t&&r&&i){const o=r.node,s=i.node.attrs.index,a=o.toJSON();let l=s;n==="delete"?(l=s-1,a.content.splice(s,1)):(l=n==="addBefore"?s:s+1,a.content.splice(l,0,{type:"column",attrs:{index:s},content:[{type:"paragraph"}]})),a.attrs.cols=a.content.length,a.content.forEach((h,p)=>{h.attrs.index=p});const c=v.Node.fromJSON(e.schema,a);let d=r.pos;c.content.forEach((h,p,g)=>{g<l&&(d+=h.nodeSize)});const u=e.tr.setTime(Date.now());u.replaceWith(r.pos,r.pos+r.node.nodeSize,c).setSelection(v.TextSelection.near(u.doc.resolve(d))),t(u)}return!0}function oh({state:e,dispatch:t,type:n}){const r=v.findParentNode(o=>o.type.name===Gr.name)(e.selection),i=v.findParentNode(o=>o.type.name===iu.name)(e.selection);if(t&&r&&i){const o=r.node,s=i.node.attrs.index;let a=0;n==="before"?a=(s-1+o.attrs.cols)%o.attrs.cols:a=(s+1)%o.attrs.cols;let l=r.pos;o.content.forEach((d,u,h)=>{h<a&&(l+=d.nodeSize)});const c=e.tr.setTime(Date.now());return c.setSelection(v.TextSelection.near(c.doc.resolve(l))),t(c),!0}return!1}const iu=v.Node3.create({name:"column",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"column"}}},addAttributes(){return{index:{default:0,parseHTML:e=>e.getAttribute("index")}}},parseHTML(){return[{tag:"div[class=column]"}]},renderHTML({HTMLAttributes:e}){return["div",v.mergeAttributes(this.options.HTMLAttributes,e),0]}}),VE=v.Extension.create({name:"columnActionButton",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:V,componentProps:{action:()=>{t.chain().focus().insertColumns({cols:2}).run()},icon:"Columns",tooltip:n("editor.columns.tooltip")}})}}}),Lm=200,Gr=v.Node3.create({name:"columns",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"column{1,}",priority:Lm,addOptions(){return{HTMLAttributes:{class:"columns"}}},addAttributes(){return{cols:{default:2,parseHTML:e=>e.getAttribute("cols")}}},parseHTML(){return[{tag:"div[class=grid]"}]},renderHTML({HTMLAttributes:e}){return["div",v.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{insertColumns:e=>({tr:t,dispatch:n,editor:r})=>{const i=qE(r.schema,e&&e.cols||3);if(n){const o=t.selection.anchor+1;t.replaceSelectionWith(i).scrollIntoView().setSelection(v.TextSelection.near(t.doc.resolve(o)))}return!0},addColBefore:()=>({dispatch:e,state:t})=>Ds({dispatch:e,state:t,type:"addBefore"}),addColAfter:()=>({dispatch:e,state:t})=>Ds({dispatch:e,state:t,type:"addAfter"}),deleteCol:()=>({dispatch:e,state:t})=>Ds({dispatch:e,state:t,type:"delete"})}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertColumns(),Tab:()=>oh({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"after"}),"Shift-Tab":()=>oh({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"before"})}}});function ou(e,t){const{state:n}=t,r=n.selection.$anchor;let i=!1;if(r.depth)for(let o=r.depth;o>0;o--)r.node(o).type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(n.tr.delete(r.before(o),r.after(o)).scrollIntoView()),i=!0);else{const o=n.selection.node;o&&o.type.name===e&&(t.chain().deleteSelection().run(),i=!0)}if(!i){const o=r.pos;if(o){const s=n.tr.doc.nodeAt(o);s&&s.type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(n.tr.delete(o,o+s.nodeSize)),i=!0)}}return i}function WE({editor:e}){const{t}=z.useLocale(),n=C.useCallback(()=>e.isActive(Gr.name),[e]),r=C.useCallback(()=>ou(Gr.name,e),[e]),i=C.useCallback(()=>e.chain().focus().addColBefore().run(),[e]),o=C.useCallback(()=>e.chain().focus().addColAfter().run(),[e]),s=C.useCallback(()=>e.chain().focus().deleteCol().run(),[e]);return f.jsx(Vt,{editor:e,pluginKey:"columns-bubble-menu",shouldShow:n,options:{placement:"bottom-start",offset:{alignmentAxis:6,crossAxis:6}},children:f.jsxs("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:[f.jsx(V,{action:i,icon:"ColumnAddLeft",tooltip:t("editor.table.menu.insertColumnBefore")}),f.jsx(V,{action:o,icon:"ColumnAddRight",tooltip:t("editor.table.menu.insertColumnAfter")}),f.jsx(V,{action:s,icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn")}),f.jsx(V,{action:r,icon:"Trash2",tooltip:t("editor.table.menu.delete_column")})]})})}const Dm=be.Root,$m=be.Trigger,sh=be.Portal,ah=be.Sub,fc=ae.forwardRef(({className:e,inset:t,children:n,...r},i)=>f.jsxs(be.SubTrigger,{ref:i,className:ie("richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none focus:richtext-bg-accent data-[state=open]:richtext-bg-accent",t&&"richtext-pl-8",e),...r,children:[n,f.jsx(L.ChevronRight,{className:"richtext-ml-auto richtext-h-4 richtext-w-4"})]}));fc.displayName=be.SubTrigger.displayName;const pc=ae.forwardRef(({className:e,...t},n)=>f.jsx(be.SubContent,{ref:n,className:ie("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-lg data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",e),...t}));pc.displayName=be.SubContent.displayName;const su=ae.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(be.Portal,{children:f.jsx(be.Content,{ref:r,sideOffset:t,className:ie("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",e),...n})}));su.displayName=be.Content.displayName;const xt=ae.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(be.Item,{ref:r,className:ie("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",t&&"richtext-pl-8",e),...n}));xt.displayName=be.Item.displayName;const Bm=ae.forwardRef(({className:e,children:t,checked:n,...r},i)=>f.jsxs(be.CheckboxItem,{ref:i,className:ie("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:f.jsx(be.ItemIndicator,{children:f.jsx(L.Check,{className:"richtext-h-4 richtext-w-4"})})}),t]}));Bm.displayName=be.CheckboxItem.displayName;const GE=ae.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(be.RadioItem,{ref:r,className:ie("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),...n,children:[f.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:f.jsx(be.ItemIndicator,{children:f.jsx(L.Circle,{className:"richtext-h-2 richtext-w-2 richtext-fill-current"})})}),t]}));GE.displayName=be.RadioItem.displayName;const KE=ae.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(be.Label,{ref:r,className:ie("richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-font-semibold",t&&"richtext-pl-8",e),...n}));KE.displayName=be.Label.displayName;const au=ae.forwardRef(({className:e,...t},n)=>f.jsx(be.Separator,{ref:n,className:ie("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),...t}));au.displayName=be.Separator.displayName;function Hm({className:e,...t}){return f.jsx("span",{className:ie("richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",e),...t})}Hm.displayName="DropdownMenuShortcut";const Ve=ae.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:ie("richtext-flex richtext-h-10 richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background file:richtext-border-0 file:richtext-bg-transparent file:richtext-text-sm file:richtext-font-medium placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),ref:r,...n}));Ve.displayName="Input";const YE=Ko("richtext-text-sm richtext-font-medium richtext-leading-none peer-disabled:richtext-cursor-not-allowed peer-disabled:richtext-opacity-70"),wt=ae.forwardRef(({className:e,...t},n)=>f.jsx(ip.Root,{ref:n,className:ie(YE(),e),...t}));wt.displayName=ip.Root.displayName;const ar=Rr.Root,lr=Rr.Trigger,Mn=ae.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>f.jsx(Rr.Portal,{children:f.jsx(Rr.Content,{ref:i,align:t,sideOffset:n,className:ie("richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",e),...r})}));Mn.displayName=Rr.Content.displayName;const ut=ae.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},i)=>f.jsx(np.Root,{ref:i,decorative:n,orientation:t,className:ie("richtext-shrink-0 richtext-bg-border",t==="horizontal"?"richtext-h-[1px] richtext-w-full":"richtext-h-full richtext-w-[1px]",e),...r}));ut.displayName=np.Root.displayName;const lu=ae.forwardRef(({className:e,...t},n)=>f.jsx(Cl.Root,{className:ie("richtext-peer richtext-inline-flex richtext-h-6 richtext-w-11 richtext-shrink-0 richtext-cursor-pointer richtext-items-center richtext-rounded-full richtext-border-2 richtext-border-transparent richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 focus-visible:richtext-ring-offset-background disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 data-[state=checked]:richtext-bg-primary data-[state=unchecked]:richtext-bg-input",e),...t,ref:n,children:f.jsx(Cl.Thumb,{className:ie("richtext-pointer-events-none richtext-block richtext-h-5 richtext-w-5 richtext-rounded-full richtext-bg-background richtext-shadow-lg richtext-ring-0 richtext-transition-transform data-[state=checked]:richtext-translate-x-5 data-[state=unchecked]:richtext-translate-x-0")})}));lu.displayName=Cl.Root.displayName;const zm=In.Root,cu=ae.forwardRef(({className:e,...t},n)=>f.jsx(In.List,{ref:n,className:ie("richtext-inline-flex richtext-h-10 richtext-items-center richtext-justify-center richtext-rounded-md richtext-bg-muted richtext-p-1 richtext-text-muted-foreground",e),...t}));cu.displayName=In.List.displayName;const Kr=ae.forwardRef(({className:e,...t},n)=>f.jsx(In.Trigger,{ref:n,className:ie("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-sm richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-all focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=active]:richtext-bg-background data-[state=active]:richtext-text-foreground data-[state=active]:richtext-shadow-sm",e),...t}));Kr.displayName=In.Trigger.displayName;const Yr=ae.forwardRef(({className:e,...t},n)=>f.jsx(In.Content,{ref:n,className:ie("richtext-mt-2 richtext-ring-offset-background focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2",e),...t}));Yr.displayName=In.Content.displayName;const XE=Xe.Provider,Um=ae.forwardRef(({className:e,...t},n)=>f.jsx(Xe.Viewport,{ref:n,className:ie("richtext-fixed richtext-top-0 richtext-z-[100] richtext-flex richtext-max-h-screen richtext-w-full richtext-flex-col-reverse richtext-p-4 sm:richtext-bottom-0 sm:richtext-right-0 sm:richtext-top-auto sm:richtext-flex-col md:richtext-max-w-[420px]",e),...t}));Um.displayName=Xe.Viewport.displayName;const JE=Ko("richtext-group richtext-pointer-events-auto richtext-relative richtext-flex richtext-w-full richtext-items-center richtext-justify-between richtext-space-x-4 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-p-6 richtext-pr-8 richtext-shadow-lg richtext-transition-all data-[swipe=cancel]:richtext-translate-x-0 data-[swipe=end]:richtext-translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:richtext-translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:richtext-transition-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[swipe=end]:richtext-animate-out data-[state=closed]:richtext-fade-out-80 data-[state=closed]:richtext-slide-out-to-right-full data-[state=open]:richtext-slide-in-from-top-full data-[state=open]:sm:richtext-slide-in-from-bottom-full",{variants:{variant:{default:"richtext-border richtext-bg-background richtext-text-foreground",destructive:"richtext-destructive richtext-group richtext-border-destructive richtext-bg-destructive richtext-text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Fm=ae.forwardRef(({className:e,variant:t,...n},r)=>f.jsx(Xe.Root,{ref:r,className:ie(JE({variant:t}),e),...n}));Fm.displayName=Xe.Root.displayName;const ZE=ae.forwardRef(({className:e,...t},n)=>f.jsx(Xe.Action,{ref:n,className:ie("richtext-inline-flex richtext-h-8 richtext-shrink-0 richtext-items-center richtext-justify-center richtext-rounded-md !richtext-border richtext-bg-transparent richtext-px-3 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-secondary focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 group-[.destructive]:richtext-border-muted/40 group-[.destructive]:hover:richtext-border-destructive/30 group-[.destructive]:hover:richtext-bg-destructive group-[.destructive]:hover:richtext-text-destructive-foreground group-[.destructive]:focus:richtext-ring-destructive",e),...t}));ZE.displayName=Xe.Action.displayName;const qm=ae.forwardRef(({className:e,...t},n)=>f.jsx(Xe.Close,{ref:n,className:ie("richtext-absolute richtext-right-2 richtext-top-2 richtext-rounded-md richtext-p-1 richtext-text-foreground/50 richtext-opacity-0 richtext-transition-opacity hover:richtext-text-foreground focus:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 group-hover:richtext-opacity-100 group-[.destructive]:richtext-text-red-300 group-[.destructive]:hover:richtext-text-red-50 group-[.destructive]:focus:richtext-ring-red-400 group-[.destructive]:focus:richtext-ring-offset-red-600",e),"toast-close":"",...t,children:f.jsx(L.X,{className:"richtext-h-4 richtext-w-4"})}));qm.displayName=Xe.Close.displayName;const Vm=ae.forwardRef(({className:e,...t},n)=>f.jsx(Xe.Title,{ref:n,className:ie("richtext-text-sm richtext-font-semibold",e),...t}));Vm.displayName=Xe.Title.displayName;const Wm=ae.forwardRef(({className:e,...t},n)=>f.jsx(Xe.Description,{ref:n,className:ie("richtext-text-sm richtext-opacity-90",e),...t}));Wm.displayName=Xe.Description.displayName;const QE=Ko("richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",{variants:{variant:{default:"richtext-bg-transparent",outline:"richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"},size:{default:"richtext-h-10 richtext-px-3",sm:"richtext-h-9 richtext-px-2",lg:"richtext-h-11 richtext-px-5"}},defaultVariants:{variant:"default",size:"default"}}),uu=ae.forwardRef(({className:e,variant:t,size:n,...r},i)=>f.jsx(rp.Root,{ref:i,className:ie(QE({variant:t,size:n,className:e})),...r}));uu.displayName=rp.Root.displayName;const e3=Xr.Provider,du=Xr.Root,hu=Xr.Trigger,Jo=ae.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(Xr.Content,{ref:r,sideOffset:t,className:ie("richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-popover-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",e),...n}));Jo.displayName=Xr.Content.displayName;const t3=1,n3=1e6;let $s=0;function r3(){return $s=($s+1)%Number.MAX_SAFE_INTEGER,$s.toString()}const Bs=new Map;function lh(e){if(Bs.has(e))return;const t=setTimeout(()=>{Bs.delete(e),_r({type:"REMOVE_TOAST",toastId:e})},n3);Bs.set(e,t)}function i3(e,t){switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,t3)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?lh(n):e.toasts.forEach(r=>{lh(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}}const Li=[];let Di={toasts:[]};function _r(e){Di=i3(Di,e),Li.forEach(t=>{t(Di)})}function o3({...e}){const t=r3(),n=i=>_r({type:"UPDATE_TOAST",toast:{...i,id:t}}),r=()=>_r({type:"DISMISS_TOAST",toastId:t});return _r({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||r()}}}),{id:t,dismiss:r,update:n}}function Zo(){const[e,t]=ae.useState(Di);return ae.useEffect(()=>(Li.push(t),()=>{const n=Li.indexOf(t);n>-1&&Li.splice(n,1)}),[e]),{...e,toast:o3,dismiss:n=>_r({type:"DISMISS_TOAST",toastId:n})}}const Gm=ae.forwardRef(({className:e,...t},n)=>f.jsx(Sl.Root,{ref:n,className:ie("!richtext-peer !richtext-h-4 !richtext-w-4 !richtext-p-0 !richtext-shrink-0 !richtext-rounded-sm !richtext-border !richtext-border-primary !richtext-ring-offset-background focus-visible:!richtext-outline-none focus-visible:!richtext-ring-2 focus-visible:!richtext-ring-ring focus-visible:!richtext-ring-offset-2 disabled:!richtext-cursor-not-allowed disabled:!richtext-opacity-50 data-[state=checked]:!richtext-bg-primary data-[state=checked]:!richtext-text-primary-foreground",e),...t,children:f.jsx(Sl.Indicator,{className:ie("!richtext-flex !richtext-p-0 !richtext-items-center !richtext-justify-center !richtext-text-current"),children:f.jsx(L.Check,{className:"!richtext-h-4 !richtext-w-4"})})}));Gm.displayName=Sl.Root.displayName;const s3={padding:"0 12px 12px"},Km=({width:e,maxWidth:t,height:n,onOk:r,children:i})=>{const{t:o}=z.useLocale(),[s,a]=C.useState({width:"",height:"",maxWidth:""});C.useEffect(()=>{a({width:e,height:n,maxWidth:t})},[n,t,e]);function l(c){c.preventDefault(),c.stopPropagation(),r(s)}return f.jsxs(ar,{modal:!0,children:[f.jsx(lr,{asChild:!0,children:i}),f.jsx(Mn,{children:f.jsx("div",{style:s3,children:f.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:l,children:[f.jsx(wt,{className:"mb-[6px]",children:"Width"}),f.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:f.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:f.jsx(Ve,{type:"number",value:s.width,required:!0,onChange:c=>a({...s,width:c.target.value})})})}),f.jsx(wt,{className:"mb-[6px]",children:"Max Width"}),f.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:f.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:f.jsx(Ve,{type:"number",value:s.maxWidth,required:!0,onChange:c=>a({...s,maxWidth:c.target.value})})})}),f.jsx(wt,{className:"mb-[6px]",children:"Height"}),f.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:f.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:f.jsx(Ve,{type:"number",value:s.height,required:!0,onChange:c=>a({...s,height:c.target.value})})})}),f.jsx(Oe,{type:"submit",className:"richtext-self-end richtext-mt-2",children:o("editor.link.dialog.button.apply")})]})})})]})},cr={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function a3(e){const t=cr.youtube,n=e.matchedUrl;e.validLink=!0;const r=n.split("="),i=r.length;if(i>0){const o=r[i-1];e.src=`${t.srcPrefix}/${o}`,e.validId=!0}return e}function l3(e){const t=cr.youku,n=e.matchedUrl,r=t.idRule,i=new RegExp(r),o=n.match(i);if(o&&o.length>0){const s=o[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${s}`}else e.validId=!1;return e}function c3(e){const t=cr.bilibili,r=e.matchedUrl.split("/"),i=r.length;if(i>0){const o=r[i-1];e.src=`${t.srcPrefix}=${o}`,e.validId=!0}return e}function u3(e){const t=cr.qqvideo,r=e.matchedUrl.split("/"),i=r.length;if(i>0){const o=r[i-1];e.src=`${t.srcPrefix}=${o}`,e.validId=!0}return e}function d3(e,t){return t.src=e,t.validId=!0,t}function h3(e,t){return t.src=e,t.validId=!0,t}function f3(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function p3(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function g3(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function m3(e){const t=cr.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function x3(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function y3(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function v3(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function b3(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function w3(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function S3(e,t,n){if(e==="googlemaps")return n.validLink=!0,n.matchedUrl=t,n;const i=cr[e].linkRule;for(const o of i){const s=new RegExp(o),a=t.match(s);if(a&&a.length>0)return n.validLink=!0,n.matchedUrl=e==="youtube"?a[1]:a[0],n}return n}function C3(e){var n,r;let t="iframe";return((n=e.includes)!=null&&n.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function Ym(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const n=C3(e);if(t=S3(n,e,t),!t.validLink)return t;switch(n){case"youtube":return a3(t);case"youku":return l3(t);case"bilibili":return c3(t);case"qqvideo":return u3(t);case"amap":return d3(e,t);case"baidu_map":return h3(e,t);case"googlemaps":return f3(e,t);case"modao":return p3(t);case"lanhu":return g3(t);case"figma":return m3(t);case"canva":return x3(e,t);case"processon":return y3(e,t);case"codepen":return v3(t);case"jinshuju":return b3(e,t);case"iframe":return w3(e,t);default:return e}}function Xm(){const[e]=jm(t=>t.value);return e}const A3={setDisable:(e,t)=>{Xo(pn.EDIT(e),t)}},k3="_wrap_5y04w_1",E3="_innerWrap_5y04w_15",ch={wrap:k3,innerWrap:E3};function T3({editor:e,node:t,updateAttributes:n}){const r=Xm(),{src:i,width:o,height:s}=t.attrs,[a,l]=C.useState("");function c(){if(!a)return;const u=Ym(a);e.chain().updateAttributes(vn.name,{src:(u==null?void 0:u.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const d=C.useCallback(u=>{n({width:u.width,height:u.height})},[n]);return f.jsxs(re.NodeViewWrapper,{children:[!i&&f.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-[#ccc] richtext-p-[10px]",children:[f.jsx(Ve,{autoFocus:!0,className:"richtext-flex-1",onInput:u=>l(u.target.value),placeholder:"Enter link",type:"url",value:a}),f.jsx(Oe,{className:"richtext-w-[60px]",onClick:c,children:"OK"})]}),i&&f.jsx(P0.Resizable,{size:{width:Number.parseInt(o),height:Number.parseInt(s)},onResizeStop:(u,h,p,g)=>{d({width:Number.parseInt(o)+g.width,height:Number.parseInt(s)+g.height})},children:f.jsx("div",{className:re.clsx(ch.wrap,"render-wrapper"),children:f.jsx("div",{className:ch.innerWrap,style:{pointerEvents:r?"none":"auto"},children:f.jsx("iframe",{className:"richtext-my-[12px] ",src:i})})})})]})}const vn=v.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:n,t:r})=>({component:V,componentProps:{action:i=>t.commands.setIframe(i),upload:n.options.upload,disabled:!t.can().setIframe({}),icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:re.getDatasetAttribute("width")},height:{default:300,parseHTML:re.getDatasetAttribute("height")},src:{default:null,parseHTML:re.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",v.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:n,chain:r})=>{var o,s,a;if(((a=(s=(o=t.selection)==null?void 0:o.node)==null?void 0:s.type)==null?void 0:a.name)==this.name)return n.updateAttributes(this.name,e);const i=e||{url:""};return r().insertContent({type:this.name,attrs:i}).run()}}},addInputRules(){return[v.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return re.ReactNodeViewRenderer(T3)}});var Hs,uh;function Jm(){if(uh)return Hs;uh=1;var e=Object.prototype.toString;return Hs=function(n){var r=e.call(n),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&n!==null&&typeof n=="object"&&typeof n.length=="number"&&n.length>=0&&e.call(n.callee)==="[object Function]"),i},Hs}var zs,dh;function I3(){if(dh)return zs;dh=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Jm(),i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(h){var p=h.constructor;return p&&p.prototype===h},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=(function(){if(typeof window>"u")return!1;for(var h in window)try{if(!c["$"+h]&&t.call(window,h)&&window[h]!==null&&typeof window[h]=="object")try{l(window[h])}catch{return!0}}catch{return!0}return!1})(),u=function(h){if(typeof window>"u"||!d)return l(h);try{return l(h)}catch{return!1}};e=function(p){var g=p!==null&&typeof p=="object",m=n.call(p)==="[object Function]",x=r(p),y=g&&n.call(p)==="[object String]",w=[];if(!g&&!m&&!x)throw new TypeError("Object.keys called on a non-object");var A=s&&m;if(y&&p.length>0&&!t.call(p,0))for(var I=0;I<p.length;++I)w.push(String(I));if(x&&p.length>0)for(var E=0;E<p.length;++E)w.push(String(E));else for(var M in p)!(A&&M==="prototype")&&t.call(p,M)&&w.push(String(M));if(o)for(var T=u(p),_=0;_<a.length;++_)!(T&&a[_]==="constructor")&&t.call(p,a[_])&&w.push(a[_]);return w}}return zs=e,zs}var Us,hh;function fu(){if(hh)return Us;hh=1;var e=Array.prototype.slice,t=Jm(),n=Object.keys,r=n?function(s){return n(s)}:I3(),i=Object.keys;return r.shim=function(){if(Object.keys){var s=(function(){var a=Object.keys(arguments);return a&&a.length===arguments.length})(1,2);s||(Object.keys=function(l){return t(l)?i(e.call(l)):i(l)})}else Object.keys=r;return Object.keys||r},Us=r,Us}var Fs,fh;function Qo(){if(fh)return Fs;fh=1;var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Fs=e,Fs}var qs,ph;function pu(){return ph||(ph=1,qs=SyntaxError),qs}var Vs,gh;function rt(){return gh||(gh=1,Vs=TypeError),Vs}var Ws,mh;function _3(){return mh||(mh=1,Ws=Object.getOwnPropertyDescriptor),Ws}var Gs,xh;function Nn(){if(xh)return Gs;xh=1;var e=_3();if(e)try{e([],"length")}catch{e=null}return Gs=e,Gs}var Ks,yh;function gu(){if(yh)return Ks;yh=1;var e=Qo(),t=pu(),n=rt(),r=Nn();return Ks=function(o,s,a){if(!o||typeof o!="object"&&typeof o!="function")throw new n("`obj` must be an object or a function`");if(typeof s!="string"&&typeof s!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,h=!!r&&r(o,s);if(e)e(o,s,{configurable:d===null&&h?h.configurable:!d,enumerable:l===null&&h?h.enumerable:!l,value:a,writable:c===null&&h?h.writable:!c});else if(u||!l&&!c&&!d)o[s]=a;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ks}var Ys,vh;function mu(){if(vh)return Ys;vh=1;var e=Qo(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return e([],"length",{value:1}).length!==1}catch{return!0}},Ys=t,Ys}var Xs,bh;function Pn(){if(bh)return Xs;bh=1;var e=fu(),t=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",n=Object.prototype.toString,r=Array.prototype.concat,i=gu(),o=function(c){return typeof c=="function"&&n.call(c)==="[object Function]"},s=mu()(),a=function(c,d,u,h){if(d in c){if(h===!0){if(c[d]===u)return}else if(!o(h)||!h())return}s?i(c,d,u,!0):i(c,d,u)},l=function(c,d){var u=arguments.length>2?arguments[2]:{},h=e(d);t&&(h=r.call(h,Object.getOwnPropertySymbols(d)));for(var p=0;p<h.length;p+=1)a(c,h[p],d[h[p]],u[h[p]])};return l.supportsDescriptors=!!s,Xs=l,Xs}var Js={exports:{}},Zs,wh;function xu(){return wh||(wh=1,Zs=Object),Zs}var Qs,Sh;function Zm(){return Sh||(Sh=1,Qs=Error),Qs}var ea,Ch;function R3(){return Ch||(Ch=1,ea=EvalError),ea}var ta,Ah;function O3(){return Ah||(Ah=1,ta=RangeError),ta}var na,kh;function j3(){return kh||(kh=1,na=ReferenceError),na}var ra,Eh;function M3(){return Eh||(Eh=1,ra=URIError),ra}var ia,Th;function N3(){return Th||(Th=1,ia=Math.abs),ia}var oa,Ih;function P3(){return Ih||(Ih=1,oa=Math.floor),oa}var sa,_h;function L3(){return _h||(_h=1,sa=Math.max),sa}var aa,Rh;function D3(){return Rh||(Rh=1,aa=Math.min),aa}var la,Oh;function $3(){return Oh||(Oh=1,la=Math.pow),la}var ca,jh;function B3(){return jh||(jh=1,ca=Math.round),ca}var ua,Mh;function H3(){return Mh||(Mh=1,ua=Number.isNaN||function(t){return t!==t}),ua}var da,Nh;function z3(){if(Nh)return da;Nh=1;var e=H3();return da=function(n){return e(n)||n===0?n:n<0?-1:1},da}var ha,Ph;function es(){return Ph||(Ph=1,ha=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;t[n]=i;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var s=Object.getOwnPropertySymbols(t);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(t,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,n);if(a.value!==i||a.enumerable!==!0)return!1}return!0}),ha}var fa,Lh;function yu(){if(Lh)return fa;Lh=1;var e=typeof Symbol<"u"&&Symbol,t=es();return fa=function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},fa}var pa,Dh;function Qm(){return Dh||(Dh=1,pa=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),pa}var ga,$h;function e0(){if($h)return ga;$h=1;var e=xu();return ga=e.getPrototypeOf||null,ga}var ma,Bh;function U3(){if(Bh)return ma;Bh=1;var e="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,n=Math.max,r="[object Function]",i=function(l,c){for(var d=[],u=0;u<l.length;u+=1)d[u]=l[u];for(var h=0;h<c.length;h+=1)d[h+l.length]=c[h];return d},o=function(l,c){for(var d=[],u=c,h=0;u<l.length;u+=1,h+=1)d[h]=l[u];return d},s=function(a,l){for(var c="",d=0;d<a.length;d+=1)c+=a[d],d+1<a.length&&(c+=l);return c};return ma=function(l){var c=this;if(typeof c!="function"||t.apply(c)!==r)throw new TypeError(e+c);for(var d=o(arguments,1),u,h=function(){if(this instanceof u){var y=c.apply(this,i(d,arguments));return Object(y)===y?y:this}return c.apply(l,i(d,arguments))},p=n(0,c.length-d.length),g=[],m=0;m<p;m++)g[m]="$"+m;if(u=Function("binder","return function ("+s(g,",")+"){ return binder.apply(this,arguments); }")(h),c.prototype){var x=function(){};x.prototype=c.prototype,u.prototype=new x,x.prototype=null}return u},ma}var xa,Hh;function ri(){if(Hh)return xa;Hh=1;var e=U3();return xa=Function.prototype.bind||e,xa}var ya,zh;function vu(){return zh||(zh=1,ya=Function.prototype.call),ya}var va,Uh;function bu(){return Uh||(Uh=1,va=Function.prototype.apply),va}var ba,Fh;function F3(){return Fh||(Fh=1,ba=typeof Reflect<"u"&&Reflect&&Reflect.apply),ba}var wa,qh;function t0(){if(qh)return wa;qh=1;var e=ri(),t=bu(),n=vu(),r=F3();return wa=r||e.call(n,t),wa}var Sa,Vh;function wu(){if(Vh)return Sa;Vh=1;var e=ri(),t=rt(),n=vu(),r=t0();return Sa=function(o){if(o.length<1||typeof o[0]!="function")throw new t("a function is required");return r(e,n,o)},Sa}var Ca,Wh;function q3(){if(Wh)return Ca;Wh=1;var e=wu(),t=Nn(),n;try{n=[].__proto__===Array.prototype}catch(s){if(!s||typeof s!="object"||!("code"in s)||s.code!=="ERR_PROTO_ACCESS")throw s}var r=!!n&&t&&t(Object.prototype,"__proto__"),i=Object,o=i.getPrototypeOf;return Ca=r&&typeof r.get=="function"?e([r.get]):typeof o=="function"?function(a){return o(a==null?a:i(a))}:!1,Ca}var Aa,Gh;function Su(){if(Gh)return Aa;Gh=1;var e=Qm(),t=e0(),n=q3();return Aa=e?function(i){return e(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:n?function(i){return n(i)}:null,Aa}var ka,Kh;function Cu(){if(Kh)return ka;Kh=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,n=ri();return ka=n.call(e,t),ka}var Ea,Yh;function Wt(){if(Yh)return Ea;Yh=1;var e,t=xu(),n=Zm(),r=R3(),i=O3(),o=j3(),s=pu(),a=rt(),l=M3(),c=N3(),d=P3(),u=L3(),h=D3(),p=$3(),g=B3(),m=z3(),x=Function,y=function(oe){try{return x('"use strict"; return ('+oe+").constructor;")()}catch{}},w=Nn(),A=Qo(),I=function(){throw new a},E=w?(function(){try{return arguments.callee,I}catch{try{return w(arguments,"callee").get}catch{return I}}})():I,M=yu()(),T=Su(),_=e0(),R=Qm(),D=bu(),P=vu(),k={},O=typeof Uint8Array>"u"||!T?e:T(Uint8Array),B={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?e:ArrayBuffer,"%ArrayIteratorPrototype%":M&&T?T([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":k,"%AsyncGenerator%":k,"%AsyncGeneratorFunction%":k,"%AsyncIteratorPrototype%":k,"%Atomics%":typeof Atomics>"u"?e:Atomics,"%BigInt%":typeof BigInt>"u"?e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":r,"%Float16Array%":typeof Float16Array>"u"?e:Float16Array,"%Float32Array%":typeof Float32Array>"u"?e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?e:FinalizationRegistry,"%Function%":x,"%GeneratorFunction%":k,"%Int8Array%":typeof Int8Array>"u"?e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":M&&T?T(T([][Symbol.iterator]())):e,"%JSON%":typeof JSON=="object"?JSON:e,"%Map%":typeof Map>"u"?e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!M||!T?e:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":w,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?e:Promise,"%Proxy%":typeof Proxy>"u"?e:Proxy,"%RangeError%":i,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!M||!T?e:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":M&&T?T(""[Symbol.iterator]()):e,"%Symbol%":M?Symbol:e,"%SyntaxError%":s,"%ThrowTypeError%":E,"%TypedArray%":O,"%TypeError%":a,"%Uint8Array%":typeof Uint8Array>"u"?e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?e:Uint32Array,"%URIError%":l,"%WeakMap%":typeof WeakMap>"u"?e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?e:WeakSet,"%Function.prototype.call%":P,"%Function.prototype.apply%":D,"%Object.defineProperty%":A,"%Object.getPrototypeOf%":_,"%Math.abs%":c,"%Math.floor%":d,"%Math.max%":u,"%Math.min%":h,"%Math.pow%":p,"%Math.round%":g,"%Math.sign%":m,"%Reflect.getPrototypeOf%":R};if(T)try{null.error}catch(oe){var q=T(T(oe));B["%Error.prototype%"]=q}var U=function oe(F){var W;if(F==="%AsyncFunction%")W=y("async function () {}");else if(F==="%GeneratorFunction%")W=y("function* () {}");else if(F==="%AsyncGeneratorFunction%")W=y("async function* () {}");else if(F==="%AsyncGenerator%"){var H=oe("%AsyncGeneratorFunction%");H&&(W=H.prototype)}else if(F==="%AsyncIteratorPrototype%"){var X=oe("%AsyncGenerator%");X&&T&&(W=T(X.prototype))}return B[F]=W,W},Z={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ce=ri(),te=Cu(),He=ce.call(P,Array.prototype.concat),je=ce.call(D,Array.prototype.splice),gt=ce.call(P,String.prototype.replace),Gt=ce.call(P,String.prototype.slice),j=ce.call(P,RegExp.prototype.exec),$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,G=function(F){var W=Gt(F,0,1),H=Gt(F,-1);if(W==="%"&&H!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(H==="%"&&W!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var X=[];return gt(F,$,function(ke,Te,Ie,Me){X[X.length]=Ie?gt(Me,K,"$1"):Te||ke}),X},ne=function(F,W){var H=F,X;if(te(Z,H)&&(X=Z[H],H="%"+X[0]+"%"),te(B,H)){var ke=B[H];if(ke===k&&(ke=U(H)),typeof ke>"u"&&!W)throw new a("intrinsic "+F+" exists, but is not available. Please file an issue!");return{alias:X,name:H,value:ke}}throw new s("intrinsic "+F+" does not exist!")};return Ea=function(F,W){if(typeof F!="string"||F.length===0)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof W!="boolean")throw new a('"allowMissing" argument must be a boolean');if(j(/^%?[^%]*%?$/,F)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var H=G(F),X=H.length>0?H[0]:"",ke=ne("%"+X+"%",W),Te=ke.name,Ie=ke.value,Me=!1,$e=ke.alias;$e&&(X=$e[0],je(H,He([0,1],$e)));for(var Et=1,it=!0;Et<H.length;Et+=1){var ze=H[Et],Tt=Gt(ze,0,1),It=Gt(ze,-1);if((Tt==='"'||Tt==="'"||Tt==="`"||It==='"'||It==="'"||It==="`")&&Tt!==It)throw new s("property names with quotes must have matching quotes");if((ze==="constructor"||!it)&&(Me=!0),X+="."+ze,Te="%"+X+"%",te(B,Te))Ie=B[Te];else if(Ie!=null){if(!(ze in Ie)){if(!W)throw new a("base intrinsic for "+F+" exists, but the property is not available.");return}if(w&&Et+1>=H.length){var _t=w(Ie,ze);it=!!_t,it&&"get"in _t&&!("originalValue"in _t.get)?Ie=_t.get:Ie=Ie[ze]}else it=te(Ie,ze),Ie=Ie[ze];it&&!Me&&(B[Te]=Ie)}}return Ie},Ea}var Ta,Xh;function V3(){if(Xh)return Ta;Xh=1;var e=Wt(),t=gu(),n=mu()(),r=Nn(),i=rt(),o=e("%Math.floor%");return Ta=function(a,l){if(typeof a!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||o(l)!==l)throw new i("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],d=!0,u=!0;if("length"in a&&r){var h=r(a,"length");h&&!h.configurable&&(d=!1),h&&!h.writable&&(u=!1)}return(d||u||!c)&&(n?t(a,"length",l,!0,!0):t(a,"length",l)),a},Ta}var Ia,Jh;function W3(){if(Jh)return Ia;Jh=1;var e=ri(),t=bu(),n=t0();return Ia=function(){return n(e,t,arguments)},Ia}var Zh;function ur(){return Zh||(Zh=1,(function(e){var t=V3(),n=Qo(),r=wu(),i=W3();e.exports=function(s){var a=r(arguments),l=s.length-(arguments.length-1);return t(a,1+(l>0?l:0),!0)},n?n(e.exports,"apply",{value:i}):e.exports.apply=i})(Js)),Js.exports}var _a,Qh;function De(){if(Qh)return _a;Qh=1;var e=Wt(),t=wu(),n=t([e("%String.prototype.indexOf%")]);return _a=function(i,o){var s=e(i,!!o);return typeof s=="function"&&n(i,".prototype.")>-1?t([s]):s},_a}var Ra,ef;function n0(){if(ef)return Ra;ef=1;var e=fu(),t=es()(),n=De(),r=xu(),i=n("Array.prototype.push"),o=n("Object.prototype.propertyIsEnumerable"),s=t?r.getOwnPropertySymbols:null;return Ra=function(l,c){if(l==null)throw new TypeError("target must be an object");var d=r(l);if(arguments.length===1)return d;for(var u=1;u<arguments.length;++u){var h=r(arguments[u]),p=e(h),g=t&&(r.getOwnPropertySymbols||s);if(g)for(var m=g(h),x=0;x<m.length;++x){var y=m[x];o(h,y)&&i(p,y)}for(var w=0;w<p.length;++w){var A=p[w];if(o(h,A)){var I=h[A];d[A]=I}}}return d},Ra}var Oa,tf;function r0(){if(tf)return Oa;tf=1;var e=n0(),t=function(){if(!Object.assign)return!1;for(var r="abcdefghijklmnopqrst",i=r.split(""),o={},s=0;s<i.length;++s)o[i[s]]=i[s];var a=Object.assign({},o),l="";for(var c in a)l+=c;return r!==l},n=function(){if(!Object.assign||!Object.preventExtensions)return!1;var r=Object.preventExtensions({1:2});try{Object.assign(r,"xy")}catch{return r[1]==="y"}return!1};return Oa=function(){return!Object.assign||t()||n()?e:Object.assign},Oa}var ja,nf;function G3(){if(nf)return ja;nf=1;var e=Pn(),t=r0();return ja=function(){var r=t();return e(Object,{assign:r},{assign:function(){return Object.assign!==r}}),r},ja}var Ma,rf;function K3(){if(rf)return Ma;rf=1;var e=Pn(),t=ur(),n=n0(),r=r0(),i=G3(),o=t.apply(r()),s=function(l,c){return o(Object,arguments)};return e(s,{getPolyfill:r,implementation:n,shim:i}),Ma=s,Ma}var Na,of;function i0(){if(of)return Na;of=1;var e=Wt(),t=ur(),n=t(e("String.prototype.indexOf"));return Na=function(i,o){var s=e(i,!!o);return typeof s=="function"&&n(i,".prototype.")>-1?t(s):s},Na}var Pa,sf;function Y3(){if(sf)return Pa;sf=1;var e=function(){return typeof(function(){}).name=="string"},t=Object.getOwnPropertyDescriptor;if(t)try{t([],"length")}catch{t=null}e.functionsHaveConfigurableNames=function(){if(!e()||!t)return!1;var i=t(function(){},"name");return!!i&&!!i.configurable};var n=Function.prototype.bind;return e.boundFunctionsHaveNames=function(){return e()&&typeof n=="function"&&(function(){}).bind().name!==""},Pa=e,Pa}var La,af;function X3(){if(af)return La;af=1;var e=gu(),t=mu()(),n=Y3().functionsHaveConfigurableNames(),r=rt();return La=function(o,s){if(typeof o!="function")throw new r("`fn` is not a function");var a=arguments.length>2&&!!arguments[2];return(!a||n)&&(t?e(o,"name",s,!0,!0):e(o,"name",s)),o},La}var Da,lf;function o0(){if(lf)return Da;lf=1;var e=X3(),t=rt(),n=Object;return Da=e(function(){if(this==null||this!==n(this))throw new t("RegExp.prototype.flags getter called on non-object");var i="";return this.hasIndices&&(i+="d"),this.global&&(i+="g"),this.ignoreCase&&(i+="i"),this.multiline&&(i+="m"),this.dotAll&&(i+="s"),this.unicode&&(i+="u"),this.unicodeSets&&(i+="v"),this.sticky&&(i+="y"),i},"get flags",!0),Da}var $a,cf;function s0(){if(cf)return $a;cf=1;var e=o0(),t=Pn().supportsDescriptors,n=Object.getOwnPropertyDescriptor;return $a=function(){if(t&&/a/mig.flags==="gim"){var i=n(RegExp.prototype,"flags");if(i&&typeof i.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var o="",s={};if(Object.defineProperty(s,"hasIndices",{get:function(){o+="d"}}),Object.defineProperty(s,"sticky",{get:function(){o+="y"}}),i.get.call(s),o==="dy")return i.get}}return e},$a}var Ba,uf;function J3(){if(uf)return Ba;uf=1;var e=Pn().supportsDescriptors,t=s0(),n=Nn(),r=Object.defineProperty,i=Zm(),o=Su(),s=/a/;return Ba=function(){if(!e||!o)throw new i("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var l=t(),c=o(s),d=n(c,"flags");return(!d||d.get!==l)&&r(c,"flags",{configurable:!0,enumerable:!1,get:l}),l},Ba}var Ha,df;function Z3(){if(df)return Ha;df=1;var e=Pn(),t=ur(),n=o0(),r=s0(),i=J3(),o=t(r());return e(o,{getPolyfill:r,implementation:n,shim:i}),Ha=o,Ha}var yr={exports:{}},za,hf;function Ln(){if(hf)return za;hf=1;var e=es();return za=function(){return e()&&!!Symbol.toStringTag},za}var Ua,ff;function a0(){if(ff)return Ua;ff=1;var e=Ln()(),t=De(),n=t("Object.prototype.toString"),r=function(a){return e&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},i=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&"length"in a&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&"callee"in a&&n(a.callee)==="[object Function]"},o=(function(){return r(arguments)})();return r.isLegacyArguments=i,Ua=o?r:i,Ua}const Q3={},eT=Object.freeze(Object.defineProperty({__proto__:null,default:Q3},Symbol.toStringTag,{value:"Module"})),tT=sp(eT);var Fa,pf;function ts(){if(pf)return Fa;pf=1;var e=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,n=e&&t&&typeof t.get=="function"?t.get:null,r=e&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,s=i&&o&&typeof o.get=="function"?o.get:null,a=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,c=l?WeakMap.prototype.has:null,d=typeof WeakSet=="function"&&WeakSet.prototype,u=d?WeakSet.prototype.has:null,h=typeof WeakRef=="function"&&WeakRef.prototype,p=h?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,m=Object.prototype.toString,x=Function.prototype.toString,y=String.prototype.match,w=String.prototype.slice,A=String.prototype.replace,I=String.prototype.toUpperCase,E=String.prototype.toLowerCase,M=RegExp.prototype.test,T=Array.prototype.concat,_=Array.prototype.join,R=Array.prototype.slice,D=Math.floor,P=typeof BigInt=="function"?BigInt.prototype.valueOf:null,k=Object.getOwnPropertySymbols,O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,B=typeof Symbol=="function"&&typeof Symbol.iterator=="object",q=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===B||!0)?Symbol.toStringTag:null,U=Object.prototype.propertyIsEnumerable,Z=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(b){return b.__proto__}:null);function ce(b,S){if(b===1/0||b===-1/0||b!==b||b&&b>-1e3&&b<1e3||M.call(/e/,S))return S;var le=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof b=="number"){var he=b<0?-D(-b):D(b);if(he!==b){var pe=String(he),Q=w.call(S,pe.length+1);return A.call(pe,le,"$&_")+"."+A.call(A.call(Q,/([0-9]{3})/g,"$&_"),/_$/,"")}}return A.call(S,le,"$&_")}var te=tT,He=te.custom,je=ke(He)?He:null,gt={__proto__:null,double:'"',single:"'"},Gt={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Fa=function b(S,le,he,pe){var Q=le||{};if(Me(Q,"quoteStyle")&&!Me(gt,Q.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Me(Q,"maxStringLength")&&(typeof Q.maxStringLength=="number"?Q.maxStringLength<0&&Q.maxStringLength!==1/0:Q.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Xt=Me(Q,"customInspect")?Q.customInspect:!0;if(typeof Xt!="boolean"&&Xt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Me(Q,"indent")&&Q.indent!==null&&Q.indent!==" "&&!(parseInt(Q.indent,10)===Q.indent&&Q.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Me(Q,"numericSeparator")&&typeof Q.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var mn=Q.numericSeparator;if(typeof S>"u")return"undefined";if(S===null)return"null";if(typeof S=="boolean")return S?"true":"false";if(typeof S=="string")return Dn(S,Q);if(typeof S=="number"){if(S===0)return 1/0/S>0?"0":"-0";var Ge=String(S);return mn?ce(S,Ge):Ge}if(typeof S=="bigint"){var Jt=String(S)+"n";return mn?ce(S,Jt):Jt}var is=typeof Q.depth>"u"?5:Q.depth;if(typeof he>"u"&&(he=0),he>=is&&is>0&&typeof S=="object")return G(S)?"[Array]":"[Object]";var $n=k0(Q,he);if(typeof pe>"u")pe=[];else if(it(pe,S)>=0)return"[Circular]";function ot(Bn,ai,T0){if(ai&&(pe=R.call(pe),pe.push(ai)),T0){var Mu={depth:Q.depth};return Me(Q,"quoteStyle")&&(Mu.quoteStyle=Q.quoteStyle),b(Bn,Mu,he+1,pe)}return b(Bn,Q,he+1,pe)}if(typeof S=="function"&&!oe(S)){var Eu=Et(S),Tu=oi(S,ot);return"[Function"+(Eu?": "+Eu:" (anonymous)")+"]"+(Tu.length>0?" { "+_.call(Tu,", ")+" }":"")}if(ke(S)){var Iu=B?A.call(String(S),/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(S);return typeof S=="object"&&!B?Yt(Iu):Iu}if(Kt(S)){for(var hr="<"+E.call(String(S.nodeName)),os=S.attributes||[],si=0;si<os.length;si++)hr+=" "+os[si].name+"="+j($(os[si].value),"double",Q);return hr+=">",S.childNodes&&S.childNodes.length&&(hr+="..."),hr+="</"+E.call(String(S.nodeName))+">",hr}if(G(S)){if(S.length===0)return"[]";var ss=oi(S,ot);return $n&&!A0(ss)?"["+rs(ss,$n)+"]":"[ "+_.call(ss,", ")+" ]"}if(F(S)){var as=oi(S,ot);return!("cause"in Error.prototype)&&"cause"in S&&!U.call(S,"cause")?"{ ["+String(S)+"] "+_.call(T.call("[cause]: "+ot(S.cause),as),", ")+" }":as.length===0?"["+String(S)+"]":"{ ["+String(S)+"] "+_.call(as,", ")+" }"}if(typeof S=="object"&&Xt){if(je&&typeof S[je]=="function"&&te)return te(S,{depth:is-he});if(Xt!=="symbol"&&typeof S.inspect=="function")return S.inspect()}if(ze(S)){var _u=[];return r&&r.call(S,function(Bn,ai){_u.push(ot(ai,S,!0)+" => "+ot(Bn,S))}),ku("Map",n.call(S),_u,$n)}if(_t(S)){var Ru=[];return a&&a.call(S,function(Bn){Ru.push(ot(Bn,S))}),ku("Set",s.call(S),Ru,$n)}if(Tt(S))return ns("WeakMap");if(ii(S))return ns("WeakSet");if(It(S))return ns("WeakRef");if(H(S))return Yt(ot(Number(S)));if(Te(S))return Yt(ot(P.call(S)));if(X(S))return Yt(g.call(S));if(W(S))return Yt(ot(String(S)));if(typeof window<"u"&&S===window)return"{ [object Window] }";if(typeof globalThis<"u"&&S===globalThis||typeof Or<"u"&&S===Or)return"{ [object globalThis] }";if(!ne(S)&&!oe(S)){var ls=oi(S,ot),Ou=Z?Z(S)===Object.prototype:S instanceof Object||S.constructor===Object,cs=S instanceof Object?"":"null prototype",ju=!Ou&&q&&Object(S)===S&&q in S?w.call($e(S),8,-1):cs?"Object":"",E0=Ou||typeof S.constructor!="function"?"":S.constructor.name?S.constructor.name+" ":"",us=E0+(ju||cs?"["+_.call(T.call([],ju||[],cs||[]),": ")+"] ":"");return ls.length===0?us+"{}":$n?us+"{"+rs(ls,$n)+"}":us+"{ "+_.call(ls,", ")+" }"}return String(S)};function j(b,S,le){var he=le.quoteStyle||S,pe=gt[he];return pe+b+pe}function $(b){return A.call(String(b),/"/g,"&quot;")}function K(b){return!q||!(typeof b=="object"&&(q in b||typeof b[q]<"u"))}function G(b){return $e(b)==="[object Array]"&&K(b)}function ne(b){return $e(b)==="[object Date]"&&K(b)}function oe(b){return $e(b)==="[object RegExp]"&&K(b)}function F(b){return $e(b)==="[object Error]"&&K(b)}function W(b){return $e(b)==="[object String]"&&K(b)}function H(b){return $e(b)==="[object Number]"&&K(b)}function X(b){return $e(b)==="[object Boolean]"&&K(b)}function ke(b){if(B)return b&&typeof b=="object"&&b instanceof Symbol;if(typeof b=="symbol")return!0;if(!b||typeof b!="object"||!O)return!1;try{return O.call(b),!0}catch{}return!1}function Te(b){if(!b||typeof b!="object"||!P)return!1;try{return P.call(b),!0}catch{}return!1}var Ie=Object.prototype.hasOwnProperty||function(b){return b in this};function Me(b,S){return Ie.call(b,S)}function $e(b){return m.call(b)}function Et(b){if(b.name)return b.name;var S=y.call(x.call(b),/^function\s*([\w$]+)/);return S?S[1]:null}function it(b,S){if(b.indexOf)return b.indexOf(S);for(var le=0,he=b.length;le<he;le++)if(b[le]===S)return le;return-1}function ze(b){if(!n||!b||typeof b!="object")return!1;try{n.call(b);try{s.call(b)}catch{return!0}return b instanceof Map}catch{}return!1}function Tt(b){if(!c||!b||typeof b!="object")return!1;try{c.call(b,c);try{u.call(b,u)}catch{return!0}return b instanceof WeakMap}catch{}return!1}function It(b){if(!p||!b||typeof b!="object")return!1;try{return p.call(b),!0}catch{}return!1}function _t(b){if(!s||!b||typeof b!="object")return!1;try{s.call(b);try{n.call(b)}catch{return!0}return b instanceof Set}catch{}return!1}function ii(b){if(!u||!b||typeof b!="object")return!1;try{u.call(b,u);try{c.call(b,c)}catch{return!0}return b instanceof WeakSet}catch{}return!1}function Kt(b){return!b||typeof b!="object"?!1:typeof HTMLElement<"u"&&b instanceof HTMLElement?!0:typeof b.nodeName=="string"&&typeof b.getAttribute=="function"}function Dn(b,S){if(b.length>S.maxStringLength){var le=b.length-S.maxStringLength,he="... "+le+" more character"+(le>1?"s":"");return Dn(w.call(b,0,S.maxStringLength),S)+he}var pe=Gt[S.quoteStyle||"single"];pe.lastIndex=0;var Q=A.call(A.call(b,pe,"\\$1"),/[\x00-\x1f]/g,dr);return j(Q,"single",S)}function dr(b){var S=b.charCodeAt(0),le={8:"b",9:"t",10:"n",12:"f",13:"r"}[S];return le?"\\"+le:"\\x"+(S<16?"0":"")+I.call(S.toString(16))}function Yt(b){return"Object("+b+")"}function ns(b){return b+" { ? }"}function ku(b,S,le,he){var pe=he?rs(le,he):_.call(le,", ");return b+" ("+S+") {"+pe+"}"}function A0(b){for(var S=0;S<b.length;S++)if(it(b[S],`
8
+ `)>=0)return!1;return!0}function k0(b,S){var le;if(b.indent===" ")le=" ";else if(typeof b.indent=="number"&&b.indent>0)le=_.call(Array(b.indent+1)," ");else return null;return{base:le,prev:_.call(Array(S+1),le)}}function rs(b,S){if(b.length===0)return"";var le=`
9
+ `+S.prev+S.base;return le+_.call(b,","+le)+`
10
+ `+S.prev}function oi(b,S){var le=G(b),he=[];if(le){he.length=b.length;for(var pe=0;pe<b.length;pe++)he[pe]=Me(b,pe)?S(b[pe],b):""}var Q=typeof k=="function"?k(b):[],Xt;if(B){Xt={};for(var mn=0;mn<Q.length;mn++)Xt["$"+Q[mn]]=Q[mn]}for(var Ge in b)Me(b,Ge)&&(le&&String(Number(Ge))===Ge&&Ge<b.length||B&&Xt["$"+Ge]instanceof Symbol||(M.call(/[^\w$]/,Ge)?he.push(S(Ge,b)+": "+S(b[Ge],b)):he.push(Ge+": "+S(b[Ge],b))));if(typeof k=="function")for(var Jt=0;Jt<Q.length;Jt++)U.call(b,Q[Jt])&&he.push("["+S(Q[Jt])+"]: "+S(b[Q[Jt]],b));return he}return Fa}var qa,gf;function nT(){if(gf)return qa;gf=1;var e=ts(),t=rt(),n=function(a,l,c){for(var d=a,u;(u=d.next)!=null;d=u)if(u.key===l)return d.next=u.next,c||(u.next=a.next,a.next=u),u},r=function(a,l){if(a){var c=n(a,l);return c&&c.value}},i=function(a,l,c){var d=n(a,l);d?d.value=c:a.next={key:l,next:a.next,value:c}},o=function(a,l){return a?!!n(a,l):!1},s=function(a,l){if(a)return n(a,l,!0)};return qa=function(){var l,c={assert:function(d){if(!c.has(d))throw new t("Side channel does not contain "+e(d))},delete:function(d){var u=l&&l.next,h=s(l,d);return h&&u&&u===h&&(l=void 0),!!h},get:function(d){return r(l,d)},has:function(d){return o(l,d)},set:function(d,u){l||(l={next:void 0}),i(l,d,u)}};return c},qa}var Va,mf;function l0(){if(mf)return Va;mf=1;var e=Wt(),t=De(),n=ts(),r=rt(),i=e("%Map%",!0),o=t("Map.prototype.get",!0),s=t("Map.prototype.set",!0),a=t("Map.prototype.has",!0),l=t("Map.prototype.delete",!0),c=t("Map.prototype.size",!0);return Va=!!i&&function(){var u,h={assert:function(p){if(!h.has(p))throw new r("Side channel does not contain "+n(p))},delete:function(p){if(u){var g=l(u,p);return c(u)===0&&(u=void 0),g}return!1},get:function(p){if(u)return o(u,p)},has:function(p){return u?a(u,p):!1},set:function(p,g){u||(u=new i),s(u,p,g)}};return h},Va}var Wa,xf;function rT(){if(xf)return Wa;xf=1;var e=Wt(),t=De(),n=ts(),r=l0(),i=rt(),o=e("%WeakMap%",!0),s=t("WeakMap.prototype.get",!0),a=t("WeakMap.prototype.set",!0),l=t("WeakMap.prototype.has",!0),c=t("WeakMap.prototype.delete",!0);return Wa=o?function(){var u,h,p={assert:function(g){if(!p.has(g))throw new i("Side channel does not contain "+n(g))},delete:function(g){if(o&&g&&(typeof g=="object"||typeof g=="function")){if(u)return c(u,g)}else if(r&&h)return h.delete(g);return!1},get:function(g){return o&&g&&(typeof g=="object"||typeof g=="function")&&u?s(u,g):h&&h.get(g)},has:function(g){return o&&g&&(typeof g=="object"||typeof g=="function")&&u?l(u,g):!!h&&h.has(g)},set:function(g,m){o&&g&&(typeof g=="object"||typeof g=="function")?(u||(u=new o),a(u,g,m)):r&&(h||(h=r()),h.set(g,m))}};return p}:r,Wa}var Ga,yf;function c0(){if(yf)return Ga;yf=1;var e=rt(),t=ts(),n=nT(),r=l0(),i=rT(),o=i||r||n;return Ga=function(){var a,l={assert:function(c){if(!l.has(c))throw new e("Side channel does not contain "+t(c))},delete:function(c){return!!a&&a.delete(c)},get:function(c){return a&&a.get(c)},has:function(c){return!!a&&a.has(c)},set:function(c,d){a||(a=o()),a.set(c,d)}};return l},Ga}var Ka,vf;function iT(){if(vf)return Ka;vf=1;var e=Cu(),t=c0()(),n=rt(),r={assert:function(i,o){if(!i||typeof i!="object"&&typeof i!="function")throw new n("`O` is not an object");if(typeof o!="string")throw new n("`slot` must be a string");if(t.assert(i),!r.has(i,o))throw new n("`"+o+"` is not present on `O`")},get:function(i,o){if(!i||typeof i!="object"&&typeof i!="function")throw new n("`O` is not an object");if(typeof o!="string")throw new n("`slot` must be a string");var s=t.get(i);return s&&s["$"+o]},has:function(i,o){if(!i||typeof i!="object"&&typeof i!="function")throw new n("`O` is not an object");if(typeof o!="string")throw new n("`slot` must be a string");var s=t.get(i);return!!s&&e(s,"$"+o)},set:function(i,o,s){if(!i||typeof i!="object"&&typeof i!="function")throw new n("`O` is not an object");if(typeof o!="string")throw new n("`slot` must be a string");var a=t.get(i);a||(a={},t.set(i,a)),a["$"+o]=s}};return Object.freeze&&Object.freeze(r),Ka=r,Ka}var Ya,bf;function oT(){if(bf)return Ya;bf=1;var e=iT(),t=pu(),n=typeof StopIteration=="object"?StopIteration:null;return Ya=function(i){if(!n)throw new t("this environment lacks StopIteration");e.set(i,"[[Done]]",!1);var o={next:function(){var a=e.get(this,"[[Iterator]]"),l=!!e.get(a,"[[Done]]");try{return{done:l,value:l?void 0:a.next()}}catch(c){if(e.set(a,"[[Done]]",!0),c!==n)throw c;return{done:!0,value:void 0}}}};return e.set(o,"[[Iterator]]",i),o},Ya}var Xa,wf;function u0(){if(wf)return Xa;wf=1;var e={}.toString;return Xa=Array.isArray||function(t){return e.call(t)=="[object Array]"},Xa}var Ja,Sf;function d0(){if(Sf)return Ja;Sf=1;var e=De(),t=e("String.prototype.valueOf"),n=function(a){try{return t(a),!0}catch{return!1}},r=e("Object.prototype.toString"),i="[object String]",o=Ln()();return Ja=function(a){return typeof a=="string"?!0:!a||typeof a!="object"?!1:o?n(a):r(a)===i},Ja}var Za,Cf;function h0(){if(Cf)return Za;Cf=1;var e=typeof Map=="function"&&Map.prototype?Map:null,t=typeof Set=="function"&&Set.prototype?Set:null,n;e||(n=function(s){return!1});var r=e?Map.prototype.has:null,i=t?Set.prototype.has:null;return!n&&!r&&(n=function(s){return!1}),Za=n||function(s){if(!s||typeof s!="object")return!1;try{if(r.call(s),i)try{i.call(s)}catch{return!0}return s instanceof e}catch{}return!1},Za}var Qa,Af;function f0(){if(Af)return Qa;Af=1;var e=typeof Map=="function"&&Map.prototype?Map:null,t=typeof Set=="function"&&Set.prototype?Set:null,n;t||(n=function(s){return!1});var r=e?Map.prototype.has:null,i=t?Set.prototype.has:null;return!n&&!i&&(n=function(s){return!1}),Qa=n||function(s){if(!s||typeof s!="object")return!1;try{if(i.call(s),r)try{r.call(s)}catch{return!0}return s instanceof t}catch{}return!1},Qa}var kf;function sT(){if(kf)return yr.exports;kf=1;var e=a0(),t=oT();if(yu()()||es()()){var n=Symbol.iterator;yr.exports=function(R){if(R!=null&&typeof R[n]<"u")return R[n]();if(e(R))return Array.prototype[n].call(R)}}else{var r=u0(),i=d0(),o=Wt(),s=o("%Map%",!0),a=o("%Set%",!0),l=i0(),c=l("Array.prototype.push"),d=l("String.prototype.charCodeAt"),u=l("String.prototype.slice"),h=function(R,D){var P=R.length;if(D+1>=P)return D+1;var k=d(R,D);if(k<55296||k>56319)return D+1;var O=d(R,D+1);return O<56320||O>57343?D+1:D+2},p=function(R){var D=0;return{next:function(){var k=D>=R.length,O;return k||(O=R[D],D+=1),{done:k,value:O}}}},g=function(R,D){if(r(R)||e(R))return p(R);if(i(R)){var P=0;return{next:function(){var O=h(R,P),B=u(R,P,O);return P=O,{done:O>R.length,value:B}}}}if(D&&typeof R["_es6-shim iterator_"]<"u")return R["_es6-shim iterator_"]()};if(!s&&!a)yr.exports=function(R){if(R!=null)return g(R,!0)};else{var m=h0(),x=f0(),y=l("Map.prototype.forEach",!0),w=l("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var A=l("Map.prototype.iterator",!0),I=l("Set.prototype.iterator",!0);var E=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),M=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0),T=function(R){if(m(R)){if(A)return t(A(R));if(E)return E(R);if(y){var D=[];return y(R,function(k,O){c(D,[O,k])}),p(D)}}if(x(R)){if(I)return t(I(R));if(M)return M(R);if(w){var P=[];return w(R,function(k){c(P,k)}),p(P)}}};yr.exports=function(R){return T(R)||g(R)}}}return yr.exports}var el,Ef;function p0(){if(Ef)return el;Ef=1;var e=function(t){return t!==t};return el=function(n,r){return n===0&&r===0?1/n===1/r:!!(n===r||e(n)&&e(r))},el}var tl,Tf;function g0(){if(Tf)return tl;Tf=1;var e=p0();return tl=function(){return typeof Object.is=="function"?Object.is:e},tl}var nl,If;function aT(){if(If)return nl;If=1;var e=g0(),t=Pn();return nl=function(){var r=e();return t(Object,{is:r},{is:function(){return Object.is!==r}}),r},nl}var rl,_f;function lT(){if(_f)return rl;_f=1;var e=Pn(),t=ur(),n=p0(),r=g0(),i=aT(),o=t(r(),Object);return e(o,{getPolyfill:r,implementation:n,shim:i}),rl=o,rl}var il,Rf;function m0(){if(Rf)return il;Rf=1;var e=ur(),t=De(),n=Wt(),r=n("%ArrayBuffer%",!0),i=t("ArrayBuffer.prototype.byteLength",!0),o=t("Object.prototype.toString"),s=!!r&&!i&&new r(0).slice,a=!!s&&e(s);return il=i||a?function(c){if(!c||typeof c!="object")return!1;try{return i?i(c):a(c,0),!0}catch{return!1}}:r?function(c){return o(c)==="[object ArrayBuffer]"}:function(c){return!1},il}var ol,Of;function cT(){if(Of)return ol;Of=1;var e=De(),t=e("Date.prototype.getDay"),n=function(a){try{return t(a),!0}catch{return!1}},r=e("Object.prototype.toString"),i="[object Date]",o=Ln()();return ol=function(a){return typeof a!="object"||a===null?!1:o?n(a):r(a)===i},ol}var sl,jf;function x0(){if(jf)return sl;jf=1;var e=De(),t=Ln()(),n=Cu(),r=Nn(),i;if(t){var o=e("RegExp.prototype.exec"),s={},a=function(){throw s},l={toString:a,valueOf:a};typeof Symbol.toPrimitive=="symbol"&&(l[Symbol.toPrimitive]=a),i=function(h){if(!h||typeof h!="object")return!1;var p=r(h,"lastIndex"),g=p&&n(p,"value");if(!g)return!1;try{o(h,l)}catch(m){return m===s}}}else{var c=e("Object.prototype.toString"),d="[object RegExp]";i=function(h){return!h||typeof h!="object"&&typeof h!="function"?!1:c(h)===d}}return sl=i,sl}var al,Mf;function uT(){if(Mf)return al;Mf=1;var e=De(),t=e("SharedArrayBuffer.prototype.byteLength",!0);return al=t?function(r){if(!r||typeof r!="object")return!1;try{return t(r),!0}catch{return!1}}:function(r){return!1},al}var ll,Nf;function dT(){if(Nf)return ll;Nf=1;var e=De(),t=e("Number.prototype.toString"),n=function(a){try{return t(a),!0}catch{return!1}},r=e("Object.prototype.toString"),i="[object Number]",o=Ln()();return ll=function(a){return typeof a=="number"?!0:!a||typeof a!="object"?!1:o?n(a):r(a)===i},ll}var cl,Pf;function hT(){if(Pf)return cl;Pf=1;var e=De(),t=e("Boolean.prototype.toString"),n=e("Object.prototype.toString"),r=function(a){try{return t(a),!0}catch{return!1}},i="[object Boolean]",o=Ln()();return cl=function(a){return typeof a=="boolean"?!0:a===null||typeof a!="object"?!1:o?r(a):n(a)===i},cl}var Ai={exports:{}},ul,Lf;function fT(){if(Lf)return ul;Lf=1;var e=De(),t=x0(),n=e("RegExp.prototype.exec"),r=rt();return ul=function(o){if(!t(o))throw new r("`regex` must be a RegExp");return function(a){return n(o,a)!==null}},ul}var Df;function pT(){if(Df)return Ai.exports;Df=1;var e=De(),t=e("Object.prototype.toString"),n=yu()(),r=fT();if(n){var i=e("Symbol.prototype.toString"),o=r(/^Symbol\(.*\)$/),s=function(l){return typeof l.valueOf()!="symbol"?!1:o(i(l))};Ai.exports=function(l){if(typeof l=="symbol")return!0;if(!l||typeof l!="object"||t(l)!=="[object Symbol]")return!1;try{return s(l)}catch{return!1}}}else Ai.exports=function(l){return!1};return Ai.exports}var ki={exports:{}},dl,$f;function gT(){if($f)return dl;$f=1;var e=typeof BigInt<"u"&&BigInt;return dl=function(){return typeof e=="function"&&typeof BigInt=="function"&&typeof e(42)=="bigint"&&typeof BigInt(42)=="bigint"},dl}var Bf;function mT(){if(Bf)return ki.exports;Bf=1;var e=gT()();if(e){var t=BigInt.prototype.valueOf,n=function(i){try{return t.call(i),!0}catch{}return!1};ki.exports=function(i){return i===null||typeof i>"u"||typeof i=="boolean"||typeof i=="string"||typeof i=="number"||typeof i=="symbol"||typeof i=="function"?!1:typeof i=="bigint"?!0:n(i)}}else ki.exports=function(i){return!1};return ki.exports}var hl,Hf;function xT(){if(Hf)return hl;Hf=1;var e=d0(),t=dT(),n=hT(),r=pT(),i=mT();return hl=function(s){if(s==null||typeof s!="object"&&typeof s!="function")return null;if(e(s))return"String";if(t(s))return"Number";if(n(s))return"Boolean";if(r(s))return"Symbol";if(i(s))return"BigInt"},hl}var fl,zf;function yT(){if(zf)return fl;zf=1;var e=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,t=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,n;e||(n=function(s){return!1});var r=e?e.prototype.has:null,i=t?t.prototype.has:null;return!n&&!r&&(n=function(s){return!1}),fl=n||function(s){if(!s||typeof s!="object")return!1;try{if(r.call(s,r),i)try{i.call(s,i)}catch{return!0}return s instanceof e}catch{}return!1},fl}var Ei={exports:{}},Uf;function vT(){if(Uf)return Ei.exports;Uf=1;var e=Wt(),t=De(),n=e("%WeakSet%",!0),r=t("WeakSet.prototype.has",!0);if(r){var i=t("WeakMap.prototype.has",!0);Ei.exports=function(s){if(!s||typeof s!="object")return!1;try{if(r(s,r),i)try{i(s,i)}catch{return!0}return s instanceof n}catch{}return!1}}else Ei.exports=function(s){return!1};return Ei.exports}var pl,Ff;function bT(){if(Ff)return pl;Ff=1;var e=h0(),t=f0(),n=yT(),r=vT();return pl=function(o){if(o&&typeof o=="object"){if(e(o))return"Map";if(t(o))return"Set";if(n(o))return"WeakMap";if(r(o))return"WeakSet"}return!1},pl}var gl,qf;function wT(){if(qf)return gl;qf=1;var e=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},t(function(){throw 42},null,n)}catch(w){w!==r&&(t=null)}else t=null;var i=/^\s*class\b/,o=function(A){try{var I=e.call(A);return i.test(I)}catch{return!1}},s=function(A){try{return o(A)?!1:(e.call(A),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",c="[object Function]",d="[object GeneratorFunction]",u="[object HTMLAllCollection]",h="[object HTML document.all class]",p="[object HTMLCollection]",g=typeof Symbol=="function"&&!!Symbol.toStringTag,m=!(0 in[,]),x=function(){return!1};if(typeof document=="object"){var y=document.all;a.call(y)===a.call(document.all)&&(x=function(A){if((m||!A)&&(typeof A>"u"||typeof A=="object"))try{var I=a.call(A);return(I===u||I===h||I===p||I===l)&&A("")==null}catch{}return!1})}return gl=t?function(A){if(x(A))return!0;if(!A||typeof A!="function"&&typeof A!="object")return!1;try{t(A,null,n)}catch(I){if(I!==r)return!1}return!o(A)&&s(A)}:function(A){if(x(A))return!0;if(!A||typeof A!="function"&&typeof A!="object")return!1;if(g)return s(A);if(o(A))return!1;var I=a.call(A);return I!==c&&I!==d&&!/^\[object HTML/.test(I)?!1:s(A)},gl}var ml,Vf;function ST(){if(Vf)return ml;Vf=1;var e=wT(),t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,c,d){for(var u=0,h=l.length;u<h;u++)n.call(l,u)&&(d==null?c(l[u],u,l):c.call(d,l[u],u,l))},i=function(l,c,d){for(var u=0,h=l.length;u<h;u++)d==null?c(l.charAt(u),u,l):c.call(d,l.charAt(u),u,l)},o=function(l,c,d){for(var u in l)n.call(l,u)&&(d==null?c(l[u],u,l):c.call(d,l[u],u,l))};function s(a){return t.call(a)==="[object Array]"}return ml=function(l,c,d){if(!e(c))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=d),s(l)?r(l,c,u):typeof l=="string"?i(l,c,u):o(l,c,u)},ml}var xl,Wf;function CT(){return Wf||(Wf=1,xl=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),xl}var yl,Gf;function AT(){if(Gf)return yl;Gf=1;var e=CT(),t=typeof globalThis>"u"?Or:globalThis;return yl=function(){for(var r=[],i=0;i<e.length;i++)typeof t[e[i]]=="function"&&(r[r.length]=e[i]);return r},yl}var vl,Kf;function kT(){if(Kf)return vl;Kf=1;var e=ST(),t=AT(),n=ur(),r=De(),i=Nn(),o=Su(),s=r("Object.prototype.toString"),a=Ln()(),l=typeof globalThis>"u"?Or:globalThis,c=t(),d=r("String.prototype.slice"),u=r("Array.prototype.indexOf",!0)||function(x,y){for(var w=0;w<x.length;w+=1)if(x[w]===y)return w;return-1},h={__proto__:null};a&&i&&o?e(c,function(m){var x=new l[m];if(Symbol.toStringTag in x&&o){var y=o(x),w=i(y,Symbol.toStringTag);if(!w&&y){var A=o(y);w=i(A,Symbol.toStringTag)}h["$"+m]=n(w.get)}}):e(c,function(m){var x=new l[m],y=x.slice||x.set;y&&(h["$"+m]=n(y))});var p=function(x){var y=!1;return e(h,function(w,A){if(!y)try{"$"+w(x)===A&&(y=d(A,1))}catch{}}),y},g=function(x){var y=!1;return e(h,function(w,A){if(!y)try{w(x),y=d(A,1)}catch{}}),y};return vl=function(x){if(!x||typeof x!="object")return!1;if(!a){var y=d(s(x),8,-1);return u(c,y)>-1?y:y!=="Object"?!1:g(x)}return i?p(x):null},vl}var bl,Yf;function ET(){if(Yf)return bl;Yf=1;var e=De(),t=e("ArrayBuffer.prototype.byteLength",!0),n=m0();return bl=function(i){return n(i)?t?t(i):i.byteLength:NaN},bl}var wl,Xf;function TT(){if(Xf)return wl;Xf=1;var e=K3(),t=i0(),n=Z3(),r=Wt(),i=sT(),o=c0(),s=lT(),a=a0(),l=u0(),c=m0(),d=cT(),u=x0(),h=uT(),p=fu(),g=xT(),m=bT(),x=kT(),y=ET(),w=t("SharedArrayBuffer.prototype.byteLength",!0),A=t("Date.prototype.getTime"),I=Object.getPrototypeOf,E=t("Object.prototype.toString"),M=r("%Set%",!0),T=t("Map.prototype.has",!0),_=t("Map.prototype.get",!0),R=t("Map.prototype.size",!0),D=t("Set.prototype.add",!0),P=t("Set.prototype.delete",!0),k=t("Set.prototype.has",!0),O=t("Set.prototype.size",!0);function B(j,$,K,G){for(var ne=i(j),oe;(oe=ne.next())&&!oe.done;)if(te($,oe.value,K,G))return P(j,oe.value),!0;return!1}function q(j){if(typeof j>"u")return null;if(typeof j!="object")return typeof j=="symbol"?!1:typeof j=="string"||typeof j=="number"?+j==+j:!0}function U(j,$,K,G,ne,oe){var F=q(K);if(F!=null)return F;var W=_($,F),H=e({},ne,{strict:!1});return typeof W>"u"&&!T($,F)||!te(G,W,H,oe)?!1:!T(j,F)&&te(G,W,H,oe)}function Z(j,$,K){var G=q(K);return G??(k($,G)&&!k(j,G))}function ce(j,$,K,G,ne,oe){for(var F=i(j),W,H;(W=F.next())&&!W.done;)if(H=W.value,te(K,H,ne,oe)&&te(G,_($,H),ne,oe))return P(j,H),!0;return!1}function te(j,$,K,G){var ne=K||{};if(ne.strict?s(j,$):j===$)return!0;var oe=g(j),F=g($);if(oe!==F)return!1;if(!j||!$||typeof j!="object"&&typeof $!="object")return ne.strict?s(j,$):j==$;var W=G.has(j),H=G.has($),X;if(W&&H){if(G.get(j)===G.get($))return!0}else X={};return W||G.set(j,X),H||G.set($,X),Gt(j,$,ne,G)}function He(j){return!j||typeof j!="object"||typeof j.length!="number"||typeof j.copy!="function"||typeof j.slice!="function"||j.length>0&&typeof j[0]!="number"?!1:!!(j.constructor&&j.constructor.isBuffer&&j.constructor.isBuffer(j))}function je(j,$,K,G){if(O(j)!==O($))return!1;for(var ne=i(j),oe=i($),F,W,H;(F=ne.next())&&!F.done;)if(F.value&&typeof F.value=="object")H||(H=new M),D(H,F.value);else if(!k($,F.value)){if(K.strict||!Z(j,$,F.value))return!1;H||(H=new M),D(H,F.value)}if(H){for(;(W=oe.next())&&!W.done;)if(W.value&&typeof W.value=="object"){if(!B(H,W.value,K.strict,G))return!1}else if(!K.strict&&!k(j,W.value)&&!B(H,W.value,K.strict,G))return!1;return O(H)===0}return!0}function gt(j,$,K,G){if(R(j)!==R($))return!1;for(var ne=i(j),oe=i($),F,W,H,X,ke,Te;(F=ne.next())&&!F.done;)if(X=F.value[0],ke=F.value[1],X&&typeof X=="object")H||(H=new M),D(H,X);else if(Te=_($,X),typeof Te>"u"&&!T($,X)||!te(ke,Te,K,G)){if(K.strict||!U(j,$,X,ke,K,G))return!1;H||(H=new M),D(H,X)}if(H){for(;(W=oe.next())&&!W.done;)if(X=W.value[0],Te=W.value[1],X&&typeof X=="object"){if(!ce(H,j,X,Te,K,G))return!1}else if(!K.strict&&(!j.has(X)||!te(_(j,X),Te,K,G))&&!ce(H,j,X,Te,e({},K,{strict:!1}),G))return!1;return O(H)===0}return!0}function Gt(j,$,K,G){var ne,oe;if(typeof j!=typeof $||j==null||$==null||E(j)!==E($)||a(j)!==a($))return!1;var F=l(j),W=l($);if(F!==W)return!1;var H=j instanceof Error,X=$ instanceof Error;if(H!==X||(H||X)&&(j.name!==$.name||j.message!==$.message))return!1;var ke=u(j),Te=u($);if(ke!==Te||(ke||Te)&&(j.source!==$.source||n(j)!==n($)))return!1;var Ie=d(j),Me=d($);if(Ie!==Me||(Ie||Me)&&A(j)!==A($)||K.strict&&I&&I(j)!==I($))return!1;var $e=x(j),Et=x($);if($e!==Et)return!1;if($e||Et){if(j.length!==$.length)return!1;for(ne=0;ne<j.length;ne++)if(j[ne]!==$[ne])return!1;return!0}var it=He(j),ze=He($);if(it!==ze)return!1;if(it||ze){if(j.length!==$.length)return!1;for(ne=0;ne<j.length;ne++)if(j[ne]!==$[ne])return!1;return!0}var Tt=c(j),It=c($);if(Tt!==It)return!1;if(Tt||It)return y(j)!==y($)?!1:typeof Uint8Array=="function"&&te(new Uint8Array(j),new Uint8Array($),K,G);var _t=h(j),ii=h($);if(_t!==ii)return!1;if(_t||ii)return w(j)!==w($)?!1:typeof Uint8Array=="function"&&te(new Uint8Array(j),new Uint8Array($),K,G);if(typeof j!=typeof $)return!1;var Kt=p(j),Dn=p($);if(Kt.length!==Dn.length)return!1;for(Kt.sort(),Dn.sort(),ne=Kt.length-1;ne>=0;ne--)if(Kt[ne]!=Dn[ne])return!1;for(ne=Kt.length-1;ne>=0;ne--)if(oe=Kt[ne],!te(j[oe],$[oe],K,G))return!1;var dr=m(j),Yt=m($);return dr!==Yt?!1:dr==="Set"||Yt==="Set"?je(j,$,K,G):dr==="Map"?gt(j,$,K,G):!0}return wl=function($,K,G){return te($,K,G,o())},wl}var IT=TT();const _T=op(IT);function RT(e){return e}function y0(e,t,n,r){const i=RT,[o,s]=C.useState(i(n)),a=C.useRef(o);return C.useEffect(()=>{const l=()=>{const c={...n,...e.getAttributes(t)};Object.keys(c).forEach(u=>{(c[u]===null||c[u]===void 0)&&(c[u]=n?n[u]:null)});const d=i(c);_T(a.current,d)||(s(d),a.current=d)};return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e,n,t,i]),o}function OT({editor:e}){const{t}=z.useLocale(),{width:n,height:r,src:i}=y0(e,vn.name,{width:0,height:0,src:"",defaultShowPicker:!1}),[o,s]=C.useState(!1),[a,l]=C.useState(""),c=C.useCallback(()=>{s(!1)},[s]);C.useEffect(()=>{o&&l(i)},[o,i]);const d=C.useCallback(()=>{const x=Ym(a);e.chain().updateAttributes(vn.name,{src:(x==null?void 0:x.src)||a}).setNodeSelection(e.state.selection.from).focus().run(),s(!1)},[e,a,s]),u=C.useCallback(()=>{window.open(i,"_blank")},[i]),h=C.useCallback(()=>{s(!0)},[s]),p=C.useCallback(x=>{e.chain().updateAttributes(vn.name,x).setNodeSelection(e.state.selection.from).focus().run()},[e]),g=C.useCallback(()=>e.isActive(vn.name)&&!i,[e,i]),m=C.useCallback(()=>ou(vn.name,e),[e]);return f.jsxs(f.Fragment,{children:[f.jsx(Vt,{className:"bubble-menu",editor:e,pluginKey:"iframe-bubble-menu",shouldShow:g,options:{placement:"bottom-start",offset:{alignmentAxis:6,crossAxis:6}},children:f.jsxs("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:[f.jsx(V,{action:u,icon:"Eye",tooltip:"Visit Link"}),f.jsx(V,{action:h,icon:"Pencil",tooltip:"Open Edit Link"}),f.jsx(Km,{height:r,onOk:p,width:n,children:f.jsx(V,{icon:"Settings",tooltip:t("editor.settings")})}),f.jsx(V,{action:m,icon:"Trash2",tooltip:t("editor.delete")})]})}),f.jsxs(ti,{onOpenChange:s,open:o,children:[f.jsx(ni,{}),f.jsxs(or,{children:[f.jsx(_m,{children:f.jsx(sr,{children:"Edit Link Iframe"})}),f.jsx(Ve,{autoFocus:!0,onInput:x=>l(x.target.value),placeholder:"Enter link",type:"url",value:a}),f.jsxs(Go,{children:[f.jsx(Oe,{onClick:c,children:"Cancel"}),f.jsx(Oe,{onClick:d,children:"OK"})]})]})]})]})}function jT({editor:e,disabled:t,bubbleMenu:n}){const r=e.extensionManager.extensions.map(o=>o.name),i=()=>{var o,s,a,l,c,d,u,h,p,g,m;return[r.includes("columns")&&!((o=n==null?void 0:n.columnConfig)!=null&&o.hidden)?f.jsx(WE,{editor:e},"columns"):null,r.includes("table")&&!((s=n==null?void 0:n.tableConfig)!=null&&s.hidden)?f.jsx(wk,{actions:(a=n==null?void 0:n.tableConfig)==null?void 0:a.actions,editor:e,hiddenActions:(l=n==null?void 0:n.tableConfig)==null?void 0:l.hiddenActions},"table"):null,r.includes("link")&&!((c=n==null?void 0:n.linkConfig)!=null&&c.hidden)?f.jsx(Yk,{disabled:t,editor:e},"link"):null,r.includes(Qn.name)&&!((d=n==null?void 0:n.imageConfig)!=null&&d.hidden)?f.jsx(BE,{disabled:t,editor:e},"image"):null,r.includes(tu.name)&&!((u=n==null?void 0:n.imageGifConfig)!=null&&u.hidden)?f.jsx(HE,{disabled:t,editor:e},"imageGif"):null,r.includes("video")&&!((h=n==null?void 0:n.videoConfig)!=null&&h.hidden)?f.jsx(zE,{disabled:t,editor:e},"video"):null,r.includes("iframe")&&!((p=n==null?void 0:n.iframeConfig)!=null&&p.hidden)?f.jsx(OT,{disabled:t,editor:e},"iframe"):null,(g=n==null?void 0:n.floatingMenuConfig)!=null&&g.hidden?null:f.jsx(KC,{disabled:t,editor:e},"content"),(m=n==null?void 0:n.textConfig)!=null&&m.hidden?null:f.jsx(QA,{disabled:t,editor:e},"text")]};return n!=null&&n.render?n.render({editor:e,disabled:t||!1,extensionsNames:r,bubbleMenu:n},i()):i().filter(Boolean)}function Jf(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:f.jsx("path",{fill:"currentColor",d:"M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59c.09-.42.14-.86.14-1.31m-.88 3.12L12.5 12.5L5.27 5.27L4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6c1.52 0 2.9-.57 3.96-1.5l2.63 2.63l1.27-1.27z"})})}function v0(e){const{t}=z.useLocale(),{highlight:n=!1,disabled:r=!1,selectedColor:i,setSelectedColor:o,onChange:s,colors:a=z.COLORS_LIST}=e,l=C.useMemo(()=>{const p=a,g=[];for(let m=0;m<p.length;m+=10)g.push(p.slice(m,m+10));return g},[a]),[c,d]=C.useState([]),u=p=>{const g=[...c],m=g.indexOf(p);m!==-1&&g.splice(m,1),g.unshift(p),g.length>10&&g.pop(),d(g)};function h(p){if(p===void 0){o==null||o(p),s==null||s(p);return}/^#([\da-f]{3}){1,2}$/i.test(p)&&(o==null||o(p),s==null||s(p),u(p))}return f.jsxs(ar,{modal:!0,children:[f.jsx(lr,{asChild:!0,className:"!richtext-p-0",disabled:r,children:e==null?void 0:e.children}),f.jsx(Mn,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:f.jsxs("div",{className:"richtext-flex richtext-flex-col",children:[n?f.jsxs("div",{className:"rd-1 richtext-flex richtext-cursor-pointer richtext-items-center richtext-gap-[4px] richtext-p-1 hover:richtext-bg-accent",onClick:()=>h(void 0),children:[f.jsx(Jf,{}),f.jsx("span",{className:"richtext-ml-1 richtext-text-sm",children:t("editor.nofill")})]}):f.jsxs("div",{className:"rd-1 richtext-flex richtext-cursor-pointer richtext-items-center richtext-gap-[4px] richtext-p-1 hover:richtext-bg-accent",onClick:()=>{h(void 0)},children:[f.jsx(Jf,{}),f.jsx("span",{className:"richtext-ml-1 richtext-text-sm",children:t("editor.default")})]}),l.map((p,g)=>f.jsx("span",{className:"richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-p-0 last:richtext-pb-2",children:p.map((m,x)=>f.jsx("span",{className:"richtext-inline-block richtext-size-6 richtext-flex-[0_0_auto] richtext-cursor-pointer richtext-rounded-sm !richtext-border richtext-border-transparent richtext-p-0.5 hover:richtext-border-border hover:richtext-shadow-sm",onClick:()=>h(m),children:f.jsx("span",{className:"richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px] richtext-border-transparent",style:{backgroundColor:m},children:m===i?f.jsx("svg",{className:"richtext-absolute -richtext-top-px richtext-left-px richtext-block richtext-size-3",viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)"},children:f.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})}):f.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:f.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-${x}`))},g)),f.jsxs("div",{children:[f.jsx("div",{className:"richtext-my-1 richtext-text-sm",children:t("editor.recent")}),f.jsx("span",{className:"richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-p-0 last:richtext-pb-2",children:c==null?void 0:c.map((p,g)=>f.jsx("span",{className:"richtext-inline-block richtext-size-6 richtext-flex-[0_0_auto] richtext-cursor-pointer richtext-rounded-sm !richtext-border richtext-border-transparent richtext-p-0.5 hover:richtext-border-border hover:richtext-shadow-sm",onClick:()=>h(p),children:f.jsx("span",{className:"richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px] richtext-border-transparent",style:{backgroundColor:p},children:f.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:f.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-recent-${g}`))})]}),f.jsx(MT,{setColor:h})]})})]})}function MT({setColor:e}){const[t,n]=C.useState("#000000"),[r,i]=C.useState(!1),{t:o}=z.useLocale();return C.useEffect(()=>()=>{i(!1)},[]),f.jsxs(ar,{open:r,children:[f.jsx(lr,{asChild:!0,children:f.jsxs("div",{className:"richtext-p-1.5 richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent",onClick:s=>{s.preventDefault(),i(!0)},children:[o("editor.color.more"),"..."]})}),f.jsxs(Mn,{children:[f.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-justify-center",children:[f.jsx(B0.HexColorPicker,{color:t,onChange:n}),f.jsx(Ve,{className:"richtext-mt-[8px] richtext-w-full",type:"text",value:t.slice(1),onChange:s=>{s.preventDefault(),n(`#${s.target.value}`)}})]}),f.jsx(ut,{className:"richtext-my-[10px]"}),f.jsx(Oe,{className:"richtext-w-full",onClick:s=>{s.preventDefault(),e(t),i(!1)},children:f.jsx(L.Plus,{size:16})})]})]})}function NT({editor:e,disabled:t,toolbar:n}){const{t:r,lang:i}=z.useLocale(),o=C.useMemo(()=>{const c=[...e.extensionManager.extensions].sort((u,h)=>{const p=u.options.sort??-1,g=h.options.sort??-1;return p-g});let d=[];for(const u of c){const{button:h,divider:p=!1,spacer:g=!1,toolbar:m=!0}=u.options;if(!h||!jE(h)||!m)continue;const x=h({editor:e,extension:u,t:r});if(Array.isArray(x)){const y=x.map((w,A)=>({button:w,divider:A===x.length-1?p:!1,spacer:A===0?g:!1,type:u.type,name:u.name}));d=[...d,...y];continue}d.push({button:x,divider:p,spacer:g,type:u.type,name:u.name})}return d},[e,r,i]),s=l=>f.jsx("div",{className:"richtext-px-1 richtext-py-2 !richtext-border-b",style:{pointerEvents:t?"none":"auto",opacity:t?.5:1},children:f.jsx("div",{className:"richtext-relative richtext-flex richtext-flex-wrap richtext-h-auto richtext-gap-y-1 richtext-gap-x-1",children:l})}),a=o.map((l,c)=>{var u,h,p,g;const d=l.button.component;return f.jsxs("div",{className:"richtext-flex richtext-items-center",children:[(l==null?void 0:l.spacer)&&f.jsx(ut,{orientation:"vertical",className:"!richtext-h-[16px] !richtext-mx-[10px]"}),f.jsx(d,{...l.button.componentProps,disabled:t||((h=(u=l==null?void 0:l.button)==null?void 0:u.componentProps)==null?void 0:h.disabled),tooltipOptions:{...(g=(p=l==null?void 0:l.button)==null?void 0:p.componentProps)==null?void 0:g.tooltipOptions,side:(n==null?void 0:n.tooltipSide)??"top"}}),(l==null?void 0:l.divider)&&f.jsx(ut,{orientation:"vertical",className:"!richtext-h-auto !richtext-mx-2"})]},`toolbar-item-${c}`)});return n&&(n!=null&&n.render)?n.render({editor:e,disabled:t||!1},o,a,s):s(a)}function PT({editor:e,extensions:t}){const{t:n}=z.useLocale(),r=C.useMemo(()=>{var a,l,c;return(c=(l=(a=t==null?void 0:t.find(d=>d.name==="base-kit"))==null?void 0:a.options)==null?void 0:l.characterCount)==null?void 0:c.limit},[t]),{charactersCount:i,wordsCount:o}=re.useEditorState({editor:e,selector:a=>({charactersCount:a.editor.storage.characterCount.characters(),wordsCount:a.editor.storage.characterCount.words()})});if(!e)return null;const s=e?Math.round(100/(r||1)*i):0;return r?f.jsxs("div",{className:`character-count ${i===r?"character-count--warning":""}`,children:[f.jsxs("svg",{height:"20",viewBox:"0 0 20 20",width:"20",children:[f.jsx("circle",{cx:"10",cy:"10",fill:"#e9ecef",r:"10"}),f.jsx("circle",{cx:"10",cy:"10",fill:"transparent",r:"5",stroke:"currentColor",strokeDasharray:`calc(${s} * 31.4 / 100) 31.4`,strokeWidth:"10",transform:"rotate(-90) translate(-20)"}),f.jsx("circle",{cx:"10",cy:"10",fill:"white",r:"6"})]}),i," ","/",r," ",n("editor.characters"),f.jsx("br",{}),o," ",n("editor.words")]}):f.jsxs("div",{className:`character-count ${i===r?"character-count--warning":""}`,children:[f.jsxs("svg",{height:"20",viewBox:"0 0 20 20",width:"20",children:[f.jsx("circle",{cx:"10",cy:"10",fill:"#e9ecef",r:"10"}),f.jsx("circle",{cx:"10",cy:"10",fill:"transparent",r:"5",stroke:"currentColor",strokeDasharray:`calc(${s} * 31.4 / 100) 31.4`,strokeWidth:"10",transform:"rotate(-90) translate(-20)"}),f.jsx("circle",{cx:"10",cy:"10",fill:"white",r:"6"})]}),i," ","/"," ",n("editor.characters"),f.jsx("br",{}),o," ",n("editor.words")]})}function LT(){const{toasts:e}=Zo();return f.jsxs(XE,{children:[e.map(({id:t,title:n,description:r,action:i,...o})=>f.jsxs(Fm,{...o,children:[f.jsxs("div",{className:"richtext-grid richtext-gap-1",children:[n&&f.jsx(Vm,{children:n}),r&&f.jsx(Wm,{children:r})]}),i,f.jsx(qm,{})]},t)),f.jsx(Um,{})]})}const DT=`
11
+ .reactjs-tiptap-editor,
12
+ .richtext-dialog-content {
13
+ color: hsl(var(--richtext-foreground));
14
+
15
+ button,
16
+ input:where([type=button]),
17
+ input:where([type=reset]),
18
+ input:where([type=submit]) {
19
+ -webkit-appearance: button;
20
+ background-color: transparent;
21
+ background-image: none;
22
+ }
23
+
24
+ input,
25
+ optgroup,
26
+ select {
27
+ font-family: inherit;
28
+ font-feature-settings: inherit;
29
+ font-variation-settings: inherit;
30
+ font-size: 100%;
31
+ font-weight: inherit;
32
+ line-height: inherit;
33
+ letter-spacing: inherit;
34
+ color: inherit;
35
+ }
36
+
37
+ button {
38
+ font-family: inherit;
39
+ font-feature-settings: inherit;
40
+ font-variation-settings: inherit;
41
+ font-size: 100%;
42
+ font-weight: inherit;
43
+ line-height: inherit;
44
+ letter-spacing: inherit;
45
+ color: inherit;
46
+ }
47
+
48
+ *,
49
+ ::before,
50
+ ::after {
51
+ box-sizing: border-box;
52
+ border-width: 0;
53
+ border-style: solid;
54
+ border-color: hsl(var(--richtext-border));
55
+ }
56
+
57
+
58
+ hr {
59
+ height: 0;
60
+ color: inherit;
61
+ border-top-width: 1px;
62
+ }
63
+
64
+ a {
65
+ color: inherit;
66
+ text-decoration: inherit;
67
+ }
68
+
69
+ b,
70
+ strong {
71
+ font-weight: bolder;
72
+ }
73
+
74
+ code,
75
+ kbd,
76
+ samp,
77
+ pre {
78
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
79
+ font-feature-settings: normal;
80
+ font-variation-settings: normal;
81
+ font-size: 1em;
82
+ }
83
+
84
+ table {
85
+ text-indent: 0;
86
+ border-color: inherit;
87
+ border-collapse: collapse;
88
+ }
89
+
90
+ input {
91
+ border-width: 1px;
92
+ }
93
+
94
+
95
+ input::placeholder {
96
+ opacity: 1;
97
+ color: #9ca3af;
98
+ }
99
+
100
+ button, input {
101
+ cursor: pointer;
102
+ color: inherit;
103
+ }
104
+
105
+ img,
106
+ svg,
107
+ video,
108
+ canvas,
109
+ audio,
110
+ iframe,
111
+ embed,
112
+ object {
113
+ display: block;
114
+ vertical-align: middle;
115
+ }
116
+
117
+ img,
118
+ video {
119
+ max-width: 100%;
120
+ height: auto;
121
+ }
122
+ }
123
+
124
+ div[data-radix-popper-content-wrapper],
125
+ div[data-tippy-root] {
126
+ color: hsl(var(--richtext-foreground));
127
+
128
+ *,
129
+ ::before,
130
+ ::after {
131
+ box-sizing: border-box;
132
+ border-width: 0;
133
+ border-style: solid;
134
+ border-color: hsl(var(--richtext-border));
135
+ }
136
+
137
+ button, input {
138
+ cursor: pointer;
139
+ color: inherit;
140
+ }
141
+ }
142
+ `,$T=C.memo(({children:e,id:t})=>{const[,n]=jm(s=>s.value),[,r]=Mm(s=>s.value),i=s=>{n({value:s.detail})},o=s=>{r({value:s.detail})};return C.useEffect(()=>{const s=Io(pn.EDIT(t),i),a=Io(pn.UPDATE_THEME(t),o);return()=>{s(),a()}},[]),f.jsx(f.Fragment,{children:e})});function BT({children:e,id:t}){return f.jsx(lE,{children:f.jsx(cE,{children:f.jsx($T,{id:t,children:e})})})}function HT(){const[e]=Mm(t=>t.value);return e}const zT={setTheme:(e,t)=>{Xo(pn.UPDATE_THEME(e),t)}},Zf="data-rc-order",Qf="data-rc-priority",UT="rc-util-key",gc=new Map;function FT(e,t){if(!e)return!1;if(e.contains)return e.contains(t);let n=t;for(;n;){if(n===e)return!0;n=n.parentNode}return!1}function b0({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:UT}function Au(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function qT(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function w0(e){return[...(gc.get(e)||e).children].filter(t=>t.tagName==="STYLE")}function S0(e,t={}){const{csp:n,prepend:r,priority:i=0}=t,o=qT(r),s=o==="prependQueue",a=document.createElement("style");a.setAttribute(Zf,o),s&&i&&a.setAttribute(Qf,`${i}`),n!=null&&n.nonce&&(a.nonce=n==null?void 0:n.nonce),a.innerHTML=e;const l=Au(t),{firstChild:c}=l;if(r){if(s){const d=w0(l).filter(u=>{if(!["prepend","prependQueue"].includes(u.getAttribute(Zf)))return!1;const h=Number(u.getAttribute(Qf)||0);return i>=h});if(d.length>0)return l.insertBefore(a,d.at(-1).nextSibling),a}c.before(a)}else l.append(a);return a}function C0(e,t={}){const n=Au(t);return w0(n).find(r=>r.getAttribute(b0(t))===e)}function VT(e,t={}){const n=C0(e,t);n&&n.remove()}function WT(e,t){const n=gc.get(e);if(!n||!FT(document,n)){const r=S0("",t),{parentNode:i}=r;gc.set(e,i),r.remove()}}function GT(e,t,n={}){var s,a,l;const r=Au(n);WT(r,n);const i=C0(t,n);if(i)return(s=n.csp)!=null&&s.nonce&&i.nonce!==((a=n.csp)==null?void 0:a.nonce)&&(i.nonce=(l=n.csp)==null?void 0:l.nonce),i.innerHTML!==e&&(i.innerHTML=e),i;const o=S0(e,n);return o.setAttribute(b0(n),t),o}function KT(e,t){const{content:n,extensions:r,useEditorOptions:i={}}=e,o=C.useId(),s=C.useMemo(()=>{const u=Zv(r,r,"name");return[...r.map(p=>{const g=r.find(m=>m.name===p.name);return g?p.configure(g.options):p}),...u].map((p,g)=>p.configure({sort:g}))},[r]),a=Kn(u=>{var p;const h=c(u,e.output);(p=e==null?void 0:e.onChangeContent)==null||p.call(e,h)},z.EDITOR_UPDATE_WATCH_THROTTLE_WAIT_TIME),l=re.useEditor({shouldRerenderOnTransaction:(e==null?void 0:e.shouldRerenderOnTransaction)||!1,extensions:s,content:n,immediatelyRender:(e==null?void 0:e.immediatelyRender)||!1,onUpdate:({editor:u})=>{a&&a(u)},...i});C.useImperativeHandle(t,()=>({editor:l})),C.useEffect(()=>{document.documentElement.classList.toggle("dark",e.dark),zT.setTheme(o,e.dark?"dark":"light")},[e.dark]),C.useEffect(()=>{l==null||l.setEditable(!(e!=null&&e.disabled)),A3.setDisable(o,!(e!=null&&e.disabled))},[l,e==null?void 0:e.disabled]),C.useEffect(()=>((e==null?void 0:e.resetCSS)!==!1&&GT(DT,"react-tiptap-reset"),()=>{VT("react-tiptap-reset")}),[e==null?void 0:e.resetCSS]);function c(u,h){return e!=null&&e.removeDefaultWrapper?h==="html"?u.isEmpty?"":u.getHTML():h==="json"?u.isEmpty?{}:u.getJSON():h==="text"?u.isEmpty?"":u.getText():"":h==="html"?u.getHTML():h==="json"?u.getJSON():h==="text"?u.getText():""}C.useLayoutEffect(()=>{l&&(l.id=o)},[o,l]),C.useEffect(()=>()=>{var u;(u=l==null?void 0:l.destroy)==null||u.call(l)},[]);const d=Pm(l,"characterCount");return l?f.jsxs("div",{className:"reactjs-tiptap-editor",children:[f.jsx(BT,{id:o,children:f.jsx(e3,{delayDuration:0,disableHoverableContent:!0,children:f.jsx(re.EditorContext.Provider,{value:{editor:l},children:f.jsx("div",{className:"richtext-overflow-hidden richtext-rounded-[0.5rem] richtext-bg-background richtext-shadow richtext-outline richtext-outline-1",children:f.jsxs("div",{className:"richtext-flex richtext-max-h-full richtext-w-full richtext-flex-col",children:[!(e!=null&&e.hideToolbar)&&f.jsx(NT,{disabled:!!(e!=null&&e.disabled),editor:l,toolbar:e.toolbar}),f.jsx(re.EditorContent,{className:`richtext-relative ${(e==null?void 0:e.contentClass)||""}`,editor:l,role:"presentation"}),d&&f.jsx(PT,{editor:l,extensions:r}),!(e!=null&&e.hideBubble)&&f.jsx(jT,{bubbleMenu:e==null?void 0:e.bubbleMenu,disabled:e==null?void 0:e.disabled,editor:l})]})})})})}),f.jsx(LT,{})]}):f.jsx(f.Fragment,{})}const YT=C.forwardRef(KT);exports.ActionButton=V;exports.BubbleMenu=Vt;exports.Button=Oe;exports.CellSelection=fe;exports.ColorPicker=v0;exports.Column=iu;exports.ColumnActionButton=VE;exports.Dialog=ti;exports.DialogContent=or;exports.DialogFooter=Go;exports.DialogTitle=sr;exports.DialogTrigger=ni;exports.DropdownMenu=Dm;exports.DropdownMenuCheckboxItem=Bm;exports.DropdownMenuContent=su;exports.DropdownMenuSeparator=au;exports.DropdownMenuShortcut=Hm;exports.DropdownMenuTrigger=$m;exports.EVENTS=pn;exports.EXTENSION_PRIORITY_HIGHEST=Lm;exports.ExportPdf=pm;exports.ExportWord=gm;exports.HighlightActionButton=mm;exports.IconComponent=Ce;exports.Iframe=vn;exports.Image=Qn;exports.ImageGif=tu;exports.IndentProps=Qi;exports.Input=Ve;exports.Label=wt;exports.Link=Em;exports.MenuDown=fm;exports.MultiColumn=Gr;exports.Popover=ar;exports.PopoverContent=Mn;exports.PopoverTrigger=lr;exports.RichTextEditor_default=YT;exports.Separator=ut;exports.SizeSetter=Km;exports.Switch=lu;exports.Toggle=uu;exports.Tooltip=du;exports.TooltipContent=Jo;exports.TooltipTrigger=hu;exports.Video=nu;exports.actionDialogImage=Nm;exports.addColumnAfter=dA;exports.addColumnBefore=uA;exports.addRowAfter=mA;exports.addRowBefore=gA;exports.clamp=_E;exports.cn=ie;exports.columnResizing=$A;exports.commonjsGlobal=Or;exports.createIndentCommand=GC;exports.dataURLtoFile=Rm;exports.debounce=Mo;exports.deleteColumn=fA;exports.deleteNode=ou;exports.deleteRow=yA;exports.deleteTable=IA;exports.dispatchEvent=Xo;exports.ensureNameValueOptions=NE;exports.extractFileExtension=nE;exports.extractFilename=tE;exports.fixTables=sm;exports.getAugmentedNamespace=sp;exports.getBubbleDrawer=dw;exports.getBubbleMermaid=uw;exports.getDefaultExportFromCjs=op;exports.getShortcutKey=Vp;exports.getShortcutKeys=Wp;exports.goToNextCell=TA;exports.hasExtension=Pm;exports.icons=qc;exports.index_default=eu;exports.mergeCells=bA;exports.normalizeFileSize=rE;exports.normalizeFileType=iE;exports.setCellAttr=CA;exports.splitCell=wA;exports.tableEditing=KA;exports.throttle=Kn;exports.toggleHeader=Vo;exports.toggleHeaderCell=kA;exports.useAttributes=y0;exports.useEditableEditor=Xm;exports.useTheme=HT;exports.useToast=Zo;