reactjs-tiptap-editor 1.0.6 → 1.0.7

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 (165) hide show
  1. package/lib/{ActionMenuButton-htJNI0Fa.js → ActionMenuButton-fTe9ka2F.js} +10 -13
  2. package/lib/ActionMenuButton-wU6jxKJv.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +23 -25
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +5 -6
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +5 -6
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +11 -12
  11. package/lib/Clear.cjs +1 -1
  12. package/lib/Clear.js +3 -3
  13. package/lib/Code.cjs +1 -1
  14. package/lib/Code.js +9 -10
  15. package/lib/CodeBlock.cjs +39 -39
  16. package/lib/CodeBlock.js +837 -946
  17. package/lib/CodeView.cjs +1 -1
  18. package/lib/CodeView.js +8 -9
  19. package/lib/Color.cjs +1 -1
  20. package/lib/Color.js +20 -21
  21. package/lib/Column.cjs +1 -1
  22. package/lib/Column.js +5 -6
  23. package/lib/Drawer-BGSwHoka.cjs +1 -0
  24. package/lib/{Drawer-1211urKj.js → Drawer-DmtILKW4.js} +16 -17
  25. package/lib/Drawer.cjs +1 -1
  26. package/lib/Drawer.js +3 -3
  27. package/lib/Emoji.cjs +1 -1
  28. package/lib/Emoji.js +15 -16
  29. package/lib/Excalidraw-BG2U9i30.cjs +1 -0
  30. package/lib/{Excalidraw-Du3hBR8t.js → Excalidraw-CrG8fW-7.js} +31 -32
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +2 -2
  33. package/lib/ExportPdf.cjs +1 -1
  34. package/lib/ExportPdf.js +17 -18
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +5 -6
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +5 -5
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +5 -5
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +15 -15
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +10 -11
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +8 -10
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +5 -6
  49. package/lib/Icon-C3j4ls73.cjs +1 -0
  50. package/lib/{Icon-C-qYUAS1.js → Icon-CysGlJkv.js} +3 -4
  51. package/lib/{Iframe-DTYTLQE6.js → Iframe-BmqguWbj.js} +13 -14
  52. package/lib/Iframe-CXDghI6m.cjs +1 -0
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +2 -2
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +48 -49
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +22 -23
  59. package/lib/ImportWord.cjs +2 -2
  60. package/lib/ImportWord.js +10 -11
  61. package/lib/Indent-B1glTHHl.cjs +1 -0
  62. package/lib/{Indent-jOPn3eUM.js → Indent-BhnGkEaY.js} +24 -25
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +10 -11
  67. package/lib/Katex-BKL_6NWF.cjs +4 -0
  68. package/lib/{Katex-CERSrcTP.js → Katex-D4eBjS34.js} +21 -22
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +2 -2
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +15 -16
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/{LinkEditBlock-B5SdhOfa.js → LinkEditBlock-D1eSM0kn.js} +55 -56
  76. package/lib/{LinkEditBlock-DaxljgJC.cjs → LinkEditBlock-DW17TyCA.cjs} +2 -2
  77. package/lib/Mention.js +2 -2
  78. package/lib/Mermaid.cjs +2 -2
  79. package/lib/Mermaid.js +20 -20
  80. package/lib/MoreMark.cjs +1 -1
  81. package/lib/MoreMark.js +19 -21
  82. package/lib/OrderedList.cjs +1 -1
  83. package/lib/OrderedList.js +5 -6
  84. package/lib/SearchAndReplace.cjs +1 -1
  85. package/lib/SearchAndReplace.js +22 -23
  86. package/lib/SlashCommand.cjs +1 -1
  87. package/lib/SlashCommand.js +14 -14
  88. package/lib/Strike.cjs +1 -1
  89. package/lib/Strike.js +5 -6
  90. package/lib/{Table-39OkCQbu.js → Table-BIZppoiY.js} +7 -8
  91. package/lib/Table-CIzgfvr9.cjs +9 -0
  92. package/lib/Table.cjs +1 -1
  93. package/lib/Table.js +1 -1
  94. package/lib/TaskList.cjs +1 -1
  95. package/lib/TaskList.js +13 -14
  96. package/lib/TextAlign.cjs +1 -1
  97. package/lib/TextAlign.js +17 -19
  98. package/lib/TextDirection.cjs +1 -1
  99. package/lib/TextDirection.js +17 -19
  100. package/lib/TextUnderline.cjs +1 -1
  101. package/lib/TextUnderline.js +5 -6
  102. package/lib/{Twitter-D7PhLycr.js → Twitter-DhczYjbR.js} +21 -22
  103. package/lib/Twitter-DwWVNAV5.cjs +1 -0
  104. package/lib/Twitter.cjs +1 -1
  105. package/lib/Twitter.js +2 -2
  106. package/lib/Video.cjs +1 -1
  107. package/lib/Video.js +24 -25
  108. package/lib/bubble.cjs +4 -4
  109. package/lib/bubble.js +419 -421
  110. package/lib/button-B6ukqDUf.cjs +1 -0
  111. package/lib/{button-Crm67hfl.js → button-C81t4pb1.js} +3 -4
  112. package/lib/{checkbox-DViVmgJ6.js → checkbox-CUE9ex4D.js} +1 -1
  113. package/lib/{checkbox-NQC2MdGT.cjs → checkbox-ZdxysUFa.cjs} +1 -1
  114. package/lib/{dialog-DaHBd2zw.cjs → dialog-Cfx8yjkr.cjs} +1 -1
  115. package/lib/{dialog-Ce9Cjfft.js → dialog-DMJStzBb.js} +1 -1
  116. package/lib/{dropdown-menu-CQykJhBs.js → dropdown-menu-B8iyTZcP.js} +1 -1
  117. package/lib/{dropdown-menu-CSCDQtq0.cjs → dropdown-menu-Busg3FNn.cjs} +1 -1
  118. package/lib/{index-DuZCJJSp.js → index--knBGB61.js} +1118 -504
  119. package/lib/{index-nFjllrEl.js → index-BvYjBPF9.js} +7 -7
  120. package/lib/index-D42xFOzI.cjs +7 -0
  121. package/lib/{index-D-FhWysc.js → index-Dwt9--mS.js} +1 -1
  122. package/lib/{index-BeUrdBxf.js → index-RKufd2EL.js} +1 -1
  123. package/lib/{index-prphFVsp.js → index-ccgHvIfu.js} +1 -1
  124. package/lib/index.cjs +2 -2
  125. package/lib/index.js +8 -9
  126. package/lib/{input-tU3H__39.cjs → input-BxzQAIRv.cjs} +1 -1
  127. package/lib/{input-DfqFAyKo.js → input-DR_5pbuA.js} +1 -1
  128. package/lib/{isNumber-CTm1pIvN.js → isNumber-1y3eeW-y.js} +1 -1
  129. package/lib/label-BfWfLggp.cjs +1 -0
  130. package/lib/label-D-0oXKCn.js +18 -0
  131. package/lib/{popover-CoepUobG.js → popover-D3spkemr.js} +1 -1
  132. package/lib/{popover-CZWSQZ0q.cjs → popover-sP8CwbV-.cjs} +1 -1
  133. package/lib/{separator-6SnwzytZ.js → separator-rM48NeAo.js} +18 -18
  134. package/lib/{separator-DCQD8P6s.cjs → separator-yycaNdlI.cjs} +1 -1
  135. package/lib/{store-726Zjszt.cjs → store-BajRl43v.cjs} +1 -1
  136. package/lib/{store-ibARMQ3h.js → store-NKeQOve_.js} +1 -1
  137. package/lib/{tabs-DrkJL_C2.js → tabs-Cb6Bmpbb.js} +1 -1
  138. package/lib/{tabs-B_ArrG09.cjs → tabs-D2nCIOVL.cjs} +1 -1
  139. package/lib/{textarea-CIs52G8B.js → textarea-BYZu1lUC.js} +1 -1
  140. package/lib/{textarea-CmZVZKOo.cjs → textarea-Cbwi_h4h.cjs} +1 -1
  141. package/lib/{throttle-CGM5M2yG.js → throttle-CjwXmkIY.js} +1 -1
  142. package/lib/{updatePosition-DpMKxYdN.js → updatePosition-BAGpT34H.js} +1 -1
  143. package/lib/{useButtonProps-D0SrPzuG.js → useButtonProps-BIH_9bXT.js} +35 -47
  144. package/lib/useButtonProps-TfmRCM9r.cjs +1 -0
  145. package/package.json +5 -1
  146. package/lib/ActionMenuButton-DYT5chmX.cjs +0 -1
  147. package/lib/Drawer-DUFUd5BW.cjs +0 -1
  148. package/lib/Excalidraw-CajgZDjU.cjs +0 -1
  149. package/lib/Icon-BjR_or8V.cjs +0 -1
  150. package/lib/Iframe-CM6mRQmv.cjs +0 -1
  151. package/lib/Indent-BmhiEb0S.cjs +0 -1
  152. package/lib/Katex-CUd3LxLh.cjs +0 -4
  153. package/lib/Table-3VstSlg4.cjs +0 -9
  154. package/lib/Twitter-DuHPeVW1.cjs +0 -1
  155. package/lib/button-xNppt_aK.cjs +0 -1
  156. package/lib/index-BQ17A_37.js +0 -393
  157. package/lib/index-CNzHZDls.cjs +0 -7
  158. package/lib/index-DmOTQudI.cjs +0 -1
  159. package/lib/label-DC33TZy_.js +0 -19
  160. package/lib/label-DkDE77kc.cjs +0 -1
  161. package/lib/toggle-DVCNvcqp.cjs +0 -1
  162. package/lib/toggle-xchtz-Kf.js +0 -92
  163. package/lib/tooltip-BTFcHrd9.js +0 -24
  164. package/lib/tooltip-DFjcKu9a.cjs +0 -1
  165. package/lib/useButtonProps-bei1vI37.cjs +0 -1
@@ -0,0 +1,9 @@
1
+ "use strict";const g=require("./index-DLqogznp.cjs"),_e=require("@tiptap/pm/state"),D=require("./index-DCJheRBq.cjs"),A=require("react/jsx-runtime"),Ie=require("./index-D42xFOzI.cjs"),W=require("react"),X=require("./popover-sP8CwbV-.cjs"),v=require("./index-FSRjMsxW.cjs"),Z=require("./useButtonProps-TfmRCM9r.cjs");let J,Y;if(typeof WeakMap<"u"){let t=new WeakMap;J=e=>t.get(e),Y=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;J=o=>{for(let l=0;l<t.length;l+=2)if(t[l]==o)return t[l+1]},Y=(o,l)=>(n==10&&(n=0),t[n++]=o,t[n++]=l)}var y=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const o=e%this.width,l=e/this.width|0;let r=o+1,s=l+1;for(let i=1;r<this.width&&this.map[e+i]==n;i++)r++;for(let i=1;s<this.height&&this.map[e+this.width*i]==n;i++)s++;return{left:o,top:l,right:r,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:o,right:l,top:r,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?o==0:l==this.width)?null:this.map[r*this.width+(n<0?o-1:l)]:(n<0?r==0:s==this.height)?null:this.map[o+this.width*(n<0?r-1:s)]}rectBetween(t,e){const{left:n,right:o,top:l,bottom:r}=this.findCell(t),{left:s,right:i,top:c,bottom:a}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(l,c),right:Math.max(o,i),bottom:Math.max(r,a)}}cellsInRect(t){const e=[],n={};for(let o=t.top;o<t.bottom;o++)for(let l=t.left;l<t.right;l++){const r=o*this.width+l,s=this.map[r];n[s]||(n[s]=!0,!(l==t.left&&l&&this.map[r-1]==s||o==t.top&&o&&this.map[r-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let o=0,l=0;;o++){const r=l+n.child(o).nodeSize;if(o==t){let s=e+t*this.width;const i=(t+1)*this.width;for(;s<i&&this.map[s]<l;)s++;return s==i?r-1:this.map[s]}l=r}}static get(t){return J(t)||Y(t,Be(t))}};function Be(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=$e(t),n=t.childCount,o=[];let l=0,r=null;const s=[];for(let a=0,d=e*n;a<d;a++)o[a]=0;for(let a=0,d=0;a<n;a++){const u=t.child(a);d++;for(let p=0;;p++){for(;l<o.length&&o[l]!=0;)l++;if(p==u.childCount)break;const m=u.child(p),{colspan:b,rowspan:w,colwidth:x}=m.attrs;for(let R=0;R<w;R++){if(R+a>=n){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:w-R});break}const L=l+R*e;for(let M=0;M<b;M++){o[L+M]==0?o[L+M]=d:(r||(r=[])).push({type:"collision",row:a,pos:d,n:b-M});const $=x&&x[M];if($){const I=(L+M)%e*2,q=s[I];q==null||q!=$&&s[I+1]==1?(s[I]=$,s[I+1]=1):q==$&&s[I+1]++}}}l+=b,d+=m.nodeSize}const f=(a+1)*e;let h=0;for(;l<f;)o[l++]==0&&h++;h&&(r||(r=[])).push({type:"missing",row:a,n:h}),d++}(e===0||n===0)&&(r||(r=[])).push({type:"zero_sized"});const i=new y(e,n,o,r);let c=!1;for(let a=0;!c&&a<s.length;a+=2)s[a]!=null&&s[a+1]<n&&(c=!0);return c&&We(i,s,t),i}function $e(t){let e=-1,n=!1;for(let o=0;o<t.childCount;o++){const l=t.child(o);let r=0;if(n)for(let s=0;s<o;s++){const i=t.child(s);for(let c=0;c<i.childCount;c++){const a=i.child(c);s+a.attrs.rowspan>o&&(r+=a.attrs.colspan)}}for(let s=0;s<l.childCount;s++){const i=l.child(s);r+=i.attrs.colspan,i.attrs.rowspan>1&&(n=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function We(t,e,n){t.problems||(t.problems=[]);const o={};for(let l=0;l<t.map.length;l++){const r=t.map[l];if(o[r])continue;o[r]=!0;const s=n.nodeAt(r);if(!s)throw new RangeError(`No cell with offset ${r} found`);let i=null;const c=s.attrs;for(let a=0;a<c.colspan;a++){const d=e[(l+a)%t.width*2];d!=null&&(!c.colwidth||c.colwidth[a]!=d)&&((i||(i=Fe(c)))[a]=d)}i&&t.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:i})}}function Fe(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function S(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const o=t.nodes[n],l=o.spec.tableRole;l&&(e[l]=o)}}return e}const z=new g.PluginKey("selectingCells");function _(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Pe(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function E(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function K(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=_(e.$head)||je(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function je(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Q(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Oe(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function oe(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Se(t,e,n){const o=t.node(-1),l=y.get(o),r=t.start(-1),s=l.nextCell(t.pos-r,e,n);return s==null?null:t.node(0).resolve(r+s)}function H(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some(l=>l>0)||(o.colwidth=null)),o}function xe(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let l=0;l<n;l++)o.colwidth.splice(e,0,0)}return o}function Ge(t,e,n){const o=S(e.type.schema).header_cell;for(let l=0;l<t.height;l++)if(e.nodeAt(t.map[n+l*t.width]).type!=o)return!1;return!0}var C=class k extends g.Selection{constructor(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.rectBetween(e.pos-r,n.pos-r),i=e.node(0),c=l.cellsInRect(s).filter(d=>d!=n.pos-r);c.unshift(n.pos-r);const a=c.map(d=>{const u=o.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const f=r+d+1;return new g.SelectionRange(i.resolve(f),i.resolve(f+u.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=e,this.$headCell=n}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),l=e.resolve(n.map(this.$headCell.pos));if(Q(o)&&Q(l)&&oe(o,l)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?k.rowSelection(o,l):r&&this.isColSelection()?k.colSelection(o,l):new k(o,l)}return g.TextSelection.between(o,l)}content(){const e=this.$anchorCell.node(-1),n=y.get(e),o=this.$anchorCell.start(-1),l=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},s=[];for(let c=l.top;c<l.bottom;c++){const a=[];for(let d=c*n.width+l.left,u=l.left;u<l.right;u++,d++){const f=n.map[d];if(r[f])continue;r[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=l.left-h.left,b=h.right-l.right;if(m>0||b>0){let w=p.attrs;if(m>0&&(w=H(w,0,m)),b>0&&(w=H(w,w.colspan-b,b)),h.left<l.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<l.top||h.bottom>l.bottom){const w={...p.attrs,rowspan:Math.min(h.bottom,l.bottom)-Math.max(h.top,l.top)};h.top<l.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}a.push(p)}s.push(e.child(c).copy(g.Fragment.from(a)))}const i=this.isColSelection()&&this.isRowSelection()?e:s;return new g.Slice(g.Fragment.from(i),1,1)}replace(e,n=g.Slice.empty){const o=e.steps.length,l=this.ranges;for(let s=0;s<l.length;s++){const{$from:i,$to:c}=l[s],a=e.mapping.slice(o);e.replace(a.map(i.pos),a.map(c.pos),s?g.Slice.empty:n)}const r=g.Selection.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,n){this.replace(e,new g.Slice(g.Fragment.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),o=y.get(n),l=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-l,this.$headCell.pos-l));for(let s=0;s<r.length;s++)e(n.nodeAt(r[s]),l+r[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,l=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,l)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.findCell(e.pos-r),i=l.findCell(n.pos-r),c=e.node(0);return s.top<=i.top?(s.top>0&&(e=c.resolve(r+l.map[s.left])),i.bottom<l.height&&(n=c.resolve(r+l.map[l.width*(l.height-1)+i.right-1]))):(i.top>0&&(n=c.resolve(r+l.map[i.left])),s.bottom<l.height&&(e=c.resolve(r+l.map[l.width*(l.height-1)+s.right-1]))),new k(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=y.get(e),o=this.$anchorCell.start(-1),l=n.colCount(this.$anchorCell.pos-o),r=n.colCount(this.$headCell.pos-o);if(Math.min(l,r)>0)return!1;const s=l+this.$anchorCell.nodeAfter.attrs.colspan,i=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,i)==n.width}eq(e){return e instanceof k&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.findCell(e.pos-r),i=l.findCell(n.pos-r),c=e.node(0);return s.left<=i.left?(s.left>0&&(e=c.resolve(r+l.map[s.top*l.width])),i.right<l.width&&(n=c.resolve(r+l.map[l.width*(i.top+1)-1]))):(i.left>0&&(n=c.resolve(r+l.map[i.top*l.width])),s.right<l.width&&(e=c.resolve(r+l.map[l.width*(s.top+1)-1]))),new k(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new k(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new k(e.resolve(n),e.resolve(o))}getBookmark(){return new Ve(this.$anchorCell.pos,this.$headCell.pos)}};C.prototype.visible=!1;g.Selection.jsonID("cell",C);var Ve=class Ae{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ae(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),o=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&oe(n,o)?new C(n,o):g.Selection.near(o,1)}};function Ke(t){if(!(t.selection instanceof C))return null;const e=[];return t.selection.forEachCell((n,o)=>{e.push(D.Decoration.node(o,o+n.nodeSize,{class:"selectedCell"}))}),D.DecorationSet.create(t.doc,e)}function qe({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,o=e.pos,l=t.depth;for(;l>=0&&!(t.after(l+1)<t.end(l));l--,n++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,o--);return n==o&&/row|table/.test(t.node(l).type.spec.tableRole)}function Xe({$from:t,$to:e}){let n,o;for(let l=t.depth;l>0;l--){const r=t.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){n=r;break}}for(let l=e.depth;l>0;l--){const r=e.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){o=r;break}}return n!==o&&e.parentOffset===0}function Ze(t,e,n){const o=(e||t).selection,l=(e||t).doc;let r,s;if(o instanceof g.NodeSelection&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")r=C.create(l,o.from);else if(s=="row"){const i=l.resolve(o.from+1);r=C.rowSelection(i,i)}else if(!n){const i=y.get(o.node),c=o.from+1,a=c+i.map[i.width*i.height-1];r=C.create(l,c+1,a)}}else o instanceof g.TextSelection&&qe(o)?r=g.TextSelection.create(l,o.from):o instanceof g.TextSelection&&Xe(o)&&(r=g.TextSelection.create(l,o.$from.start(),o.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}const Ue=new g.PluginKey("fix-tables");function Te(t,e,n,o){const l=t.childCount,r=e.childCount;e:for(let s=0,i=0;s<r;s++){const c=e.child(s);for(let a=i,d=Math.min(l,s+3);a<d;a++)if(t.child(a)==c){i=a+1,n+=c.nodeSize;continue e}o(c,n),i<l&&t.child(i).sameMarkup(c)?Te(t.child(i),c,n+1,o):c.nodesBetween(0,c.content.size,o,n+1),n+=c.nodeSize}}function Re(t,e){let n;const o=(l,r)=>{l.type.spec.tableRole=="table"&&(n=Je(t,l,r,n))};return e?e.doc!=t.doc&&Te(e.doc,t.doc,0,o):t.doc.descendants(o),n}function Je(t,e,n,o){const l=y.get(e);if(!l.problems)return o;o||(o=t.tr);const r=[];for(let c=0;c<l.height;c++)r.push(0);for(let c=0;c<l.problems.length;c++){const a=l.problems[c];if(a.type=="collision"){const d=e.nodeAt(a.pos);if(!d)continue;const u=d.attrs;for(let f=0;f<u.rowspan;f++)r[a.row+f]+=a.n;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,H(u,u.colspan-a.n,a.n))}else if(a.type=="missing")r[a.row]+=a.n;else if(a.type=="overlong_rowspan"){const d=e.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-a.n})}else if(a.type=="colwidth mismatch"){const d=e.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,colwidth:a.colwidth})}else if(a.type=="zero_sized"){const d=o.mapping.map(n);o.delete(d,d+e.nodeSize)}}let s,i;for(let c=0;c<r.length;c++)r[c]&&(s==null&&(s=c),i=c);for(let c=0,a=n+1;c<l.height;c++){const d=e.child(c),u=a+d.nodeSize,f=r[c];if(f>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<f;b++){const w=S(t.schema)[h].createAndFill();w&&p.push(w)}const m=(c==0||s==c-1)&&i==c?a+1:u-1;o.insert(o.mapping.map(m),p)}a=u}return o.setMeta(Ue,{fixTables:!0})}function N(t){const e=t.selection,n=K(t),o=n.node(-1),l=n.start(-1),r=y.get(o);return{...e instanceof C?r.rectBetween(e.$anchorCell.pos-l,e.$headCell.pos-l):r.findCell(n.pos-l),tableStart:l,map:r,table:o}}function ve(t,{map:e,tableStart:n,table:o},l){let r=l>0?-1:0;Ge(e,o,l+r)&&(r=l==0||l==e.width?null:0);for(let s=0;s<e.height;s++){const i=s*e.width+l;if(l>0&&l<e.width&&e.map[i-1]==e.map[i]){const c=e.map[i],a=o.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,xe(a.attrs,l-e.colCount(c))),s+=a.attrs.rowspan-1}else{const c=r==null?S(o.type.schema).cell:o.nodeAt(e.map[i+r]).type,a=e.positionAt(s,l,o);t.insert(t.mapping.map(n+a),c.createAndFill())}}return t}function Ye(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.left))}return!0}function Qe(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.right))}return!0}function et(t,{map:e,table:n,tableStart:o},l){const r=t.mapping.maps.length;for(let s=0;s<e.height;){const i=s*e.width+l,c=e.map[i],a=n.nodeAt(c),d=a.attrs;if(l>0&&e.map[i-1]==c||l<e.width-1&&e.map[i+1]==c)t.setNodeMarkup(t.mapping.slice(r).map(o+c),null,H(d,l-e.colCount(c)));else{const u=t.mapping.slice(r).map(o+c);t.delete(u,u+a.nodeSize)}s+=d.rowspan}}function tt(t,e){if(!E(t))return!1;if(e){const n=N(t),o=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let l=n.right-1;et(o,n,l),l!=n.left;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=y.get(r)}e(o)}return!0}function nt(t,e,n){var o;const l=S(e.type.schema).header_cell;for(let r=0;r<t.width;r++)if(((o=e.nodeAt(t.map[r+n*t.width]))===null||o===void 0?void 0:o.type)!=l)return!1;return!0}function Me(t,{map:e,tableStart:n,table:o},l){let r=n;for(let a=0;a<l;a++)r+=o.child(a).nodeSize;const s=[];let i=l>0?-1:0;nt(e,o,l+i)&&(i=l==0||l==e.height?null:0);for(let a=0,d=e.width*l;a<e.width;a++,d++)if(l>0&&l<e.height&&e.map[d]==e.map[d-e.width]){const u=e.map[d],f=o.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),a+=f.colspan-1}else{var c;const u=i==null?S(o.type.schema).cell:(c=o.nodeAt(e.map[d+i*e.width]))===null||c===void 0?void 0:c.type,f=u==null?void 0:u.createAndFill();f&&s.push(f)}return t.insert(r,S(o.type.schema).row.create(null,s)),t}function ot(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.top))}return!0}function lt(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.bottom))}return!0}function rt(t,{map:e,table:n,tableStart:o},l){let r=0;for(let a=0;a<l;a++)r+=n.child(a).nodeSize;const s=r+n.child(l).nodeSize,i=t.mapping.maps.length;t.delete(r+o,s+o);const c=new Set;for(let a=0,d=l*e.width;a<e.width;a++,d++){const u=e.map[d];if(!c.has(u)){if(c.add(u),l>0&&u==e.map[d-e.width]){const f=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(i).map(u+o),null,{...f,rowspan:f.rowspan-1}),a+=f.colspan-1}else if(l<e.height&&u==e.map[d+e.width]){const f=n.nodeAt(u),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(l+1,a,n);t.insert(t.mapping.slice(i).map(o+m),p),a+=h.colspan-1}}}}function st(t,e){if(!E(t))return!1;if(e){const n=N(t),o=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let l=n.bottom-1;rt(o,n,l),l!=n.top;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=y.get(n.table)}e(o)}return!0}function le(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function it({width:t,height:e,map:n},o){let l=o.top*t+o.left,r=l,s=(o.bottom-1)*t+o.left,i=l+(o.right-o.left-1);for(let c=o.top;c<o.bottom;c++){if(o.left>0&&n[r]==n[r-1]||o.right<t&&n[i]==n[i+1])return!0;r+=t,i+=t}for(let c=o.left;c<o.right;c++){if(o.top>0&&n[l]==n[l-t]||o.bottom<e&&n[s]==n[s+t])return!0;l++,s++}return!1}function re(t,e){const n=t.selection;if(!(n instanceof C)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=N(t),{map:l}=o;if(it(l,o))return!1;if(e){const r=t.tr,s={};let i=g.Fragment.empty,c,a;for(let d=o.top;d<o.bottom;d++)for(let u=o.left;u<o.right;u++){const f=l.map[d*l.width+u],h=o.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,a=h;else{le(h)||(i=i.append(h.content));const p=r.mapping.map(f+o.tableStart);r.delete(p,p+h.nodeSize)}}if(c==null||a==null)return!0;if(r.setNodeMarkup(c+o.tableStart,null,{...xe(a.attrs,a.attrs.colspan,o.right-o.left-a.attrs.colspan),rowspan:o.bottom-o.top}),i.size>0){const d=c+1+a.content.size,u=le(a)?c+1:d;r.replaceWith(u+o.tableStart,d+o.tableStart,i)}r.setSelection(new C(r.doc.resolve(c+o.tableStart))),e(r)}return!0}function se(t,e){const n=S(t.schema);return ct(({node:o})=>n[o.type.spec.tableRole])(t,e)}function ct(t){return(e,n)=>{const o=e.selection;let l,r;if(o instanceof C){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;l=o.$anchorCell.nodeAfter,r=o.$anchorCell.pos}else{var s;if(l=Pe(o.$from),!l)return!1;r=(s=_(o.$from))===null||s===void 0?void 0:s.pos}if(l==null||r==null||l.attrs.colspan==1&&l.attrs.rowspan==1)return!1;if(n){let i=l.attrs;const c=[],a=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const d=N(e),u=e.tr;for(let h=0;h<d.right-d.left;h++)c.push(a?{...i,colwidth:a&&a[h]?[a[h]]:null}:i);let f;for(let h=d.top;h<d.bottom;h++){let p=d.map.positionAt(h,d.left,d.table);h==d.top&&(p+=l.nodeSize);for(let m=d.left,b=0;m<d.right;m++,b++)m==d.left&&h==d.top||u.insert(f=u.mapping.map(p+d.tableStart,1),t({node:l,row:h,col:m}).createAndFill(c[b]))}u.setNodeMarkup(r,t({node:l,row:d.top,col:d.left}),c[0]),o instanceof C&&u.setSelection(new C(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function at(t,e){return function(n,o){if(!E(n))return!1;const l=K(n);if(l.nodeAfter.attrs[t]===e)return!1;if(o){const r=n.tr;n.selection instanceof C?n.selection.forEachCell((s,i)=>{s.attrs[t]!==e&&r.setNodeMarkup(i,null,{...s.attrs,[t]:e})}):r.setNodeMarkup(l.pos,null,{...l.nodeAfter.attrs,[t]:e}),o(r)}return!0}}function dt(t){return function(e,n){if(!E(e))return!1;if(n){const o=S(e.schema),l=N(e),r=e.tr,s=l.map.cellsInRect(t=="column"?{left:l.left,top:0,right:l.right,bottom:l.map.height}:t=="row"?{left:0,top:l.top,right:l.map.width,bottom:l.bottom}:l),i=s.map(c=>l.table.nodeAt(c));for(let c=0;c<s.length;c++)i[c].type==o.header_cell&&r.setNodeMarkup(l.tableStart+s[c],o.cell,i[c].attrs);if(r.steps.length===0)for(let c=0;c<s.length;c++)r.setNodeMarkup(l.tableStart+s[c],o.header_cell,i[c].attrs);n(r)}return!0}}function ie(t,e,n){const o=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let l=0;l<o.length;l++){const r=e.table.nodeAt(o[l]);if(r&&r.type!==n.header_cell)return!1}return!0}function B(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?dt(t):function(n,o){if(!E(n))return!1;if(o){const l=S(n.schema),r=N(n),s=n.tr,i=ie("row",r,l),c=ie("column",r,l),a=(t==="column"?i:t==="row"&&c)?1:0,d=t=="column"?{left:0,top:a,right:1,bottom:r.map.height}:t=="row"?{left:a,top:0,right:r.map.width,bottom:1}:r,u=t=="column"?c?l.cell:l.header_cell:t=="row"?i?l.cell:l.header_cell:l.cell;r.map.cellsInRect(d).forEach(f=>{const h=f+r.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,u,p.attrs)}),o(s)}return!0}}B("row",{useDeprecatedLogic:!0});B("column",{useDeprecatedLogic:!0});const ut=B("cell",{useDeprecatedLogic:!0});function ft(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let o=t.index(-1)-1,l=t.before();o>=0;o--){const r=t.node(-1).child(o),s=r.lastChild;if(s)return l-1-s.nodeSize;l-=r.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let o=t.indexAfter(-1),l=t.after();o<n.childCount;o++){const r=n.child(o);if(r.childCount)return l+1;l+=r.nodeSize}}return null}function ce(t){return function(e,n){if(!E(e))return!1;const o=ft(K(e),t);if(o==null)return!1;if(n){const l=e.doc.resolve(o);n(e.tr.setSelection(g.TextSelection.between(l,Oe(l))).scrollIntoView())}return!0}}function ht(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function F(t,e){const n=t.selection;if(!(n instanceof C))return!1;if(e){const o=t.tr,l=S(t.schema).cell.createAndFill().content;n.forEachCell((r,s)=>{r.content.eq(l)||o.replace(o.mapping.map(s+1),o.mapping.map(s+r.nodeSize-1),new g.Slice(l,0,0))}),o.docChanged&&e(o)}return!0}function pt(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:o}=t;for(;e.childCount==1&&(n>0&&o>0||e.child(0).type.spec.tableRole=="table");)n--,o--,e=e.child(0).content;const l=e.child(0),r=l.type.spec.tableRole,s=l.type.schema,i=[];if(r=="row")for(let c=0;c<e.childCount;c++){let a=e.child(c).content;const d=c?0:Math.max(0,n-1),u=c<e.childCount-1?0:Math.max(0,o-1);(d||u)&&(a=ee(S(s).row,new g.Slice(a,d,u)).content),i.push(a)}else if(r=="cell"||r=="header_cell")i.push(n||o?ee(S(s).row,new g.Slice(e,n,o)).content:e);else return null;return mt(s,i)}function mt(t,e){const n=[];for(let l=0;l<e.length;l++){const r=e[l];for(let s=r.childCount-1;s>=0;s--){const{rowspan:i,colspan:c}=r.child(s).attrs;for(let a=l;a<l+i;a++)n[a]=(n[a]||0)+c}}let o=0;for(let l=0;l<n.length;l++)o=Math.max(o,n[l]);for(let l=0;l<n.length;l++)if(l>=e.length&&e.push(g.Fragment.empty),n[l]<o){const r=S(t).cell.createAndFill(),s=[];for(let i=n[l];i<o;i++)s.push(r);e[l]=e[l].append(g.Fragment.from(s))}return{height:e.length,width:o,rows:e}}function ee(t,e){const n=t.createAndFill();return new g.Transform(n).replace(0,n.content.size,e).doc}function gt({width:t,height:e,rows:n},o,l){if(t!=o){const r=[],s=[];for(let i=0;i<n.length;i++){const c=n[i],a=[];for(let d=r[i]||0,u=0;d<o;u++){let f=c.child(u%c.childCount);d+f.attrs.colspan>o&&(f=f.type.createChecked(H(f.attrs,f.attrs.colspan,d+f.attrs.colspan-o),f.content)),a.push(f),d+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)r[i+h]=(r[i+h]||0)+f.attrs.colspan}s.push(g.Fragment.from(a))}n=s,t=o}if(e!=l){const r=[];for(let s=0,i=0;s<l;s++,i++){const c=[],a=n[i%e];for(let d=0;d<a.childCount;d++){let u=a.child(d);s+u.attrs.rowspan>l&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,l-u.attrs.rowspan)},u.content)),c.push(u)}r.push(g.Fragment.from(c))}n=r,e=l}return{width:t,height:e,rows:n}}function bt(t,e,n,o,l,r,s){const i=t.doc.type.schema,c=S(i);let a,d;if(l>e.width)for(let u=0,f=0;u<e.height;u++){const h=n.child(u);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==c.cell?m=a||(a=c.cell.createAndFill()):m=d||(d=c.header_cell.createAndFill());for(let b=e.width;b<l;b++)p.push(m);t.insert(t.mapping.slice(s).map(f-1+o),p)}if(r>e.height){const u=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,l);p++){const b=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==c.header_cell;u.push(b?d||(d=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}const f=c.row.create(null,g.Fragment.from(u)),h=[];for(let p=e.height;p<r;p++)h.push(f);t.insert(t.mapping.slice(s).map(o+n.nodeSize-2),h)}return!!(a||d)}function ae(t,e,n,o,l,r,s,i){if(s==0||s==e.height)return!1;let c=!1;for(let a=l;a<r;a++){const d=s*e.width+a,u=e.map[d];if(e.map[d-e.width]==u){c=!0;const f=n.nodeAt(u),{top:h,left:p}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(i).map(u+o),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(i).map(e.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),a+=f.attrs.colspan-1}}return c}function de(t,e,n,o,l,r,s,i){if(s==0||s==e.width)return!1;let c=!1;for(let a=l;a<r;a++){const d=a*e.width+s,u=e.map[d];if(e.map[d-1]==u){c=!0;const f=n.nodeAt(u),h=e.colCount(u),p=t.mapping.slice(i).map(u+o);t.setNodeMarkup(p,null,H(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(p+f.nodeSize,f.type.createAndFill(H(f.attrs,0,s-h))),a+=f.attrs.rowspan-1}}return c}function ue(t,e,n,o,l){let r=n?t.doc.nodeAt(n-1):t.doc;if(!r)throw new Error("No table found");let s=y.get(r);const{top:i,left:c}=o,a=c+l.width,d=i+l.height,u=t.tr;let f=0;function h(){if(r=n?u.doc.nodeAt(n-1):u.doc,!r)throw new Error("No table found");s=y.get(r),f=u.mapping.maps.length}bt(u,s,r,n,a,d,f)&&h(),ae(u,s,r,n,c,a,i,f)&&h(),ae(u,s,r,n,c,a,d,f)&&h(),de(u,s,r,n,i,d,c,f)&&h(),de(u,s,r,n,i,d,a,f)&&h();for(let p=i;p<d;p++){const m=s.positionAt(p,c,r),b=s.positionAt(p,a,r);u.replace(u.mapping.slice(f).map(m+n),u.mapping.slice(f).map(b+n),new g.Slice(l.rows[p-i],0,0))}h(),u.setSelection(new C(u.doc.resolve(n+s.positionAt(i,c,r)),u.doc.resolve(n+s.positionAt(d-1,a-1,r)))),e(u)}const wt=D.keydownHandler({ArrowLeft:P("horiz",-1),ArrowRight:P("horiz",1),ArrowUp:P("vert",-1),ArrowDown:P("vert",1),"Shift-ArrowLeft":j("horiz",-1),"Shift-ArrowRight":j("horiz",1),"Shift-ArrowUp":j("vert",-1),"Shift-ArrowDown":j("vert",1),Backspace:F,"Mod-Backspace":F,Delete:F,"Mod-Delete":F});function G(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function P(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;if(r instanceof C)return G(n,o,g.Selection.near(r.$headCell,e));if(t!="horiz"&&!r.empty)return!1;const s=Ee(l,t,e);if(s==null)return!1;if(t=="horiz")return G(n,o,g.Selection.near(n.doc.resolve(r.head+e),e));{const i=n.doc.resolve(s),c=Se(i,t,e);let a;return c?a=g.Selection.near(c,1):e<0?a=g.Selection.near(n.doc.resolve(i.before(-1)),-1):a=g.Selection.near(n.doc.resolve(i.after(-1)),1),G(n,o,a)}}}function j(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;let s;if(r instanceof C)s=r;else{const c=Ee(l,t,e);if(c==null)return!1;s=new C(n.doc.resolve(c))}const i=Se(s.$headCell,t,e);return i?G(n,o,new C(s.$anchorCell,i)):!1}}function Ct(t,e){const n=t.state.doc,o=_(n.resolve(e));return o?(t.dispatch(t.state.tr.setSelection(new C(o))),!0):!1}function yt(t,e,n){if(!E(t.state))return!1;let o=pt(n);const l=t.state.selection;if(l instanceof C){o||(o={width:1,height:1,rows:[g.Fragment.from(ee(S(t.state.schema).cell,n))]});const r=l.$anchorCell.node(-1),s=l.$anchorCell.start(-1),i=y.get(r).rectBetween(l.$anchorCell.pos-s,l.$headCell.pos-s);return o=gt(o,i.right-i.left,i.bottom-i.top),ue(t.state,t.dispatch,s,i,o),!0}else if(o){const r=K(t.state),s=r.start(-1);return ue(t.state,t.dispatch,s,y.get(r.node(-1)).findCell(r.pos-s),o),!0}else return!1}function St(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=fe(t,e.target);let l;if(e.shiftKey&&t.state.selection instanceof C)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(l=_(t.state.selection.$anchor))!=null&&((n=U(t,e))===null||n===void 0?void 0:n.pos)!=l.pos)r(l,e),e.preventDefault();else if(!o)return;function r(c,a){let d=U(t,a);const u=z.getState(t.state)==null;if(!d||!oe(c,d))if(u)d=c;else return;const f=new C(c,d);if(u||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);u&&h.setMeta(z,c.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",i),z.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(z,-1))}function i(c){const a=c,d=z.getState(t.state);let u;if(d!=null)u=t.state.doc.resolve(d);else if(fe(t,a.target)!=o&&(u=U(t,e),!u))return s();u&&r(u,a)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",i)}function Ee(t,e,n){if(!(t.state.selection instanceof g.TextSelection))return null;const{$head:o}=t.state.selection;for(let l=o.depth-1;l>=0;l--){const r=o.node(l);if((n<0?o.index(l):o.indexAfter(l))!=(n<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const s=o.before(l),i=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(i)?s:null}}return null}function fe(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function U(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;const o=n.inside>=0?n.inside:n.pos;return _(t.state.doc.resolve(o))}var xt=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),te(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,te(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function te(t,e,n,o,l,r){let s=0,i=!0,c=e.firstChild;const a=t.firstChild;if(a){for(let u=0,f=0;u<a.childCount;u++){const{colspan:h,colwidth:p}=a.child(u).attrs;for(let m=0;m<h;m++,f++){const b=l==f?r:p&&p[m],w=b?b+"px":"";if(s+=b||o,b||(i=!1),c)c.style.width!=w&&(c.style.width=w),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=w,e.appendChild(x)}}}for(;c;){var d;const u=c.nextSibling;(d=c.parentNode)===null||d===void 0||d.removeChild(c),c=u}i?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const T=new g.PluginKey("tableColumnResizing");function At({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=xt,lastColumnResizable:l=!0}={}){const r=new g.Plugin({key:T,state:{init(s,i){var c;const a=(c=r.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,d=S(i.schema).table.name;return o&&a&&(a[d]=(u,f)=>new o(u,n,f)),new Tt(-1,!1)},apply(s,i){return i.apply(s)}},props:{attributes:s=>{const i=T.getState(s);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,i)=>{Rt(s,i,t,l)},mouseleave:s=>{vt(s)},mousedown:(s,i)=>{Mt(s,i,e,n)}},decorations:s=>{const i=T.getState(s);if(i&&i.activeHandle>-1)return zt(s,i.activeHandle)},nodeViews:{}}});return r}var Tt=class V{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,o=e.getMeta(T);if(o&&o.setHandle!=null)return new V(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new V(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&e.docChanged){let l=e.mapping.map(n.activeHandle,-1);return Q(e.doc.resolve(l))||(l=-1),new V(l,n.dragging)}return n}};function Rt(t,e,n,o){if(!t.editable)return;const l=T.getState(t.state);if(l&&!l.dragging){const r=Nt(e.target);let s=-1;if(r){const{left:i,right:c}=r.getBoundingClientRect();e.clientX-i<=n?s=he(t,e,"left",n):c-e.clientX<=n&&(s=he(t,e,"right",n))}if(s!=l.activeHandle){if(!o&&s!==-1){const i=t.state.doc.resolve(s),c=i.node(-1),a=y.get(c),d=i.start(-1);if(a.colCount(i.pos-d)+i.nodeAfter.attrs.colspan-1==a.width-1)return}Ne(t,s)}}}function vt(t){if(!t.editable)return;const e=T.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ne(t,-1)}function Mt(t,e,n,o){var l;if(!t.editable)return!1;const r=(l=t.dom.ownerDocument.defaultView)!==null&&l!==void 0?l:window,s=T.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const i=t.state.doc.nodeAt(s.activeHandle),c=Et(t,s.activeHandle,i.attrs);t.dispatch(t.state.tr.setMeta(T,{setDragging:{startX:e.clientX,startWidth:c}}));function a(u){r.removeEventListener("mouseup",a),r.removeEventListener("mousemove",d);const f=T.getState(t.state);f!=null&&f.dragging&&(kt(t,f.activeHandle,pe(f.dragging,u,n)),t.dispatch(t.state.tr.setMeta(T,{setDragging:null})))}function d(u){if(!u.which)return a(u);const f=T.getState(t.state);if(f&&f.dragging){const h=pe(f.dragging,u,n);me(t,f.activeHandle,h,o)}}return me(t,s.activeHandle,c,o),r.addEventListener("mouseup",a),r.addEventListener("mousemove",d),e.preventDefault(),!0}function Et(t,e,{colspan:n,colwidth:o}){const l=o&&o[o.length-1];if(l)return l;const r=t.domAtPos(e);let s=r.node.childNodes[r.offset].offsetWidth,i=n;if(o)for(let c=0;c<n;c++)o[c]&&(s-=o[c],i--);return s/i}function Nt(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function he(t,e,n,o){const l=n=="right"?-o:o,r=t.posAtCoords({left:e.clientX+l,top:e.clientY});if(!r)return-1;const{pos:s}=r,i=_(t.state.doc.resolve(s));if(!i)return-1;if(n=="right")return i.pos;const c=y.get(i.node(-1)),a=i.start(-1),d=c.map.indexOf(i.pos-a);return d%c.width==0?-1:a+c.map[d-1]}function pe(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Ne(t,e){t.dispatch(t.state.tr.setMeta(T,{setHandle:e}))}function kt(t,e,n){const o=t.state.doc.resolve(e),l=o.node(-1),r=y.get(l),s=o.start(-1),i=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let a=0;a<r.height;a++){const d=a*r.width+i;if(a&&r.map[d]==r.map[d-r.width])continue;const u=r.map[d],f=l.nodeAt(u).attrs,h=f.colspan==1?0:i-r.colCount(u);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():Lt(f.colspan);p[h]=n,c.setNodeMarkup(s+u,null,{...f,colwidth:p})}c.docChanged&&t.dispatch(c)}function me(t,e,n,o){const l=t.state.doc.resolve(e),r=l.node(-1),s=l.start(-1),i=y.get(r).colCount(l.pos-s)+l.nodeAfter.attrs.colspan-1;let c=t.domAtPos(l.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&te(r,c.firstChild,c,o,i,n)}function Lt(t){return Array(t).fill(0)}function zt(t,e){const n=[],o=t.doc.resolve(e),l=o.node(-1);if(!l)return D.DecorationSet.empty;const r=y.get(l),s=o.start(-1),i=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let a=0;a<r.height;a++){const d=i+a*r.width;if((i==r.width-1||r.map[d]!=r.map[d+1])&&(a==0||r.map[d]!=r.map[d-r.width])){var c;const u=r.map[d],f=s+u+l.nodeAt(u).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((c=T.getState(t))===null||c===void 0)&&c.dragging&&n.push(D.Decoration.node(s+u,s+u+l.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(D.Decoration.widget(f,h))}}return D.DecorationSet.create(t.doc,n)}function Dt({allowTableNodeSelection:t=!1}={}){return new g.Plugin({key:z,state:{init(){return null},apply(e,n){const o=e.getMeta(z);if(o!=null)return o==-1?null:o;if(n==null||!e.docChanged)return n;const{deleted:l,pos:r}=e.mapping.mapResult(n);return l?null:r}},props:{decorations:Ke,handleDOMEvents:{mousedown:St},createSelectionBetween(e){return z.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Ct,handleKeyDown:wt,handlePaste:yt},appendTransaction(e,n,o){return Ze(o,Re(o,n),t)}})}var ke=g.Node3.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const o=t.getAttribute("colwidth"),l=o?o.split(",").map(r=>parseInt(r,10)):null;if(!l){const r=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(s&&s>-1&&r&&r[s]){const i=r[s].getAttribute("width");return i?[parseInt(i,10)]:null}}return l}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",g.mergeAttributes(this.options.HTMLAttributes,t),0]}}),Le=g.Node3.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",g.mergeAttributes(this.options.HTMLAttributes,t),0]}}),ze=g.Node3.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",g.mergeAttributes(this.options.HTMLAttributes,t),0]}});function ne(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function ge(t,e,n,o,l,r){var s;let i=0,c=!0,a=e.firstChild;const d=t.firstChild;if(d!==null)for(let f=0,h=0;f<d.childCount;f+=1){const{colspan:p,colwidth:m}=d.child(f).attrs;for(let b=0;b<p;b+=1,h+=1){const w=l===h?r:m&&m[b],x=w?`${w}px`:"";if(i+=w||o,w||(c=!1),a){if(a.style.width!==x){const[R,L]=ne(o,w);a.style.setProperty(R,L)}a=a.nextSibling}else{const R=document.createElement("col"),[L,M]=ne(o,w);R.style.setProperty(L,M),e.appendChild(R)}}}for(;a;){const f=a.nextSibling;(s=a.parentNode)==null||s.removeChild(a),a=f}const u=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);c&&!u?(n.style.width=`${i}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${i}px`)}var Ht=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ge(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,ge(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(n&&!o&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function _t(t,e,n,o){let l=0,r=!0;const s=[],i=t.firstChild;if(!i)return{};for(let u=0,f=0;u<i.childCount;u+=1){const{colspan:h,colwidth:p}=i.child(u).attrs;for(let m=0;m<h;m+=1,f+=1){const b=n===f?o:p&&p[m];l+=b||e,b||(r=!1);const[w,x]=ne(e,b);s.push(["col",{style:`${w}: ${x}`}])}}const c=r?`${l}px`:"",a=r?"":`${l}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:a}}function be(t,e){return t.createAndFill()}function It(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),t.cached.tableNodeTypes=e,e}function Bt(t,e,n,o,l){const r=It(t),s=[],i=[];for(let a=0;a<n;a+=1){const d=be(r.cell);if(d&&i.push(d),o){const u=be(r.header_cell);u&&s.push(u)}}const c=[];for(let a=0;a<e;a+=1)c.push(r.row.createChecked(null,o&&a===0?s:i));return r.table.createChecked(null,c)}function $t(t){return t instanceof C}var O=({editor:t})=>{const{selection:e}=t.state;if(!$t(e))return!1;let n=0;const o=g.findParentNodeClosestToPos(e.ranges[0].$from,r=>r.type.name==="table");return o==null||o.node.descendants(r=>{if(r.type.name==="table")return!1;["tableCell","tableHeader"].includes(r.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Wt="";function Ft(t){return(t||"").replace(/\s+/g," ").trim()}function Pt(t,e,n={}){var o;const l=(o=n.cellLineSeparator)!=null?o:Wt;if(!t||!t.content||t.content.length===0)return"";const r=[];t.content.forEach(p=>{const m=[];p.content&&p.content.forEach(b=>{let w="";b.content&&Array.isArray(b.content)&&b.content.length>1?w=b.content.map(M=>e.renderChildren(M)).join(l):w=b.content?e.renderChildren(b.content):"";const x=Ft(w),R=b.type==="tableHeader";m.push({text:x,isHeader:R})}),r.push(m)});const s=r.reduce((p,m)=>Math.max(p,m.length),0);if(s===0)return"";const i=new Array(s).fill(0);r.forEach(p=>{var m;for(let b=0;b<s;b+=1){const x=(((m=p[b])==null?void 0:m.text)||"").length;x>i[b]&&(i[b]=x),i[b]<3&&(i[b]=3)}});const c=(p,m)=>p+" ".repeat(Math.max(0,m-p.length)),a=r[0],d=a.some(p=>p.isHeader);let u=`
2
+ `;const f=new Array(s).fill(0).map((p,m)=>d&&a[m]&&a[m].text||"");return u+=`| ${f.map((p,m)=>c(p,i[m])).join(" | ")} |
3
+ `,u+=`| ${i.map(p=>"-".repeat(Math.max(3,p))).join(" | ")} |
4
+ `,(d?r.slice(1):r).forEach(p=>{u+=`| ${new Array(s).fill(0).map((m,b)=>c(p[b]&&p[b].text||"",i[b])).join(" | ")} |
5
+ `}),u}var jt=Pt,De=g.Node3.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Ht,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:l}=_t(t,this.options.cellMinWidth),r=e.style;function s(){return r||(o?`width: ${o}`:`min-width: ${l}`)}const i=["table",g.mergeAttributes(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},i]:i},parseMarkdown:(t,e)=>{const n=[];if(t.header){const o=[];t.header.forEach(l=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(l.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}return t.rows&&t.rows.forEach(o=>{const l=[];o.forEach(r=>{l.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),n.push(e.createNode("tableRow",{},l))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>jt(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:l,editor:r})=>{const s=Bt(r.schema,t,e,n);if(l){const i=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(_e.TextSelection.near(o.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Ye(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Qe(t,e),deleteColumn:()=>({state:t,dispatch:e})=>tt(t,e),addRowBefore:()=>({state:t,dispatch:e})=>ot(t,e),addRowAfter:()=>({state:t,dispatch:e})=>lt(t,e),deleteRow:()=>({state:t,dispatch:e})=>st(t,e),deleteTable:()=>({state:t,dispatch:e})=>ht(t,e),mergeCells:()=>({state:t,dispatch:e})=>re(t,e),splitCell:()=>({state:t,dispatch:e})=>se(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>B("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>B("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>ut(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>re(t,e)?!0:se(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>at(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>ce(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ce(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Re(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const o=C.create(e.doc,t.anchorCell,t.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:O,"Mod-Backspace":O,Delete:O,"Mod-Delete":O}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[At({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Dt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:g.callOrReturn(g.getExtensionField(t,"tableRole",e))}}});g.Extension.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(De.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ke.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Le.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ze.configure(this.options.tableRow)),t}});function Ot(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o||n===o.attrs.backgroundColor)return t;const l={...o.attrs,backgroundColor:n};return t.setNodeMarkup(e,o.type,l,o.marks)}function Gt(t,e,n){const{doc:o,selection:l}=t;return!o||!l||!(l instanceof C)||l.forEachCell((r,s)=>{t=Ot(t,s,n)}),t}function we(t,e){return({tr:n,state:o,dispatch:l})=>{const{selection:r}=o;return n=n.setSelection(r),n=Gt(n,e,t),n.docChanged?(l==null||l(n),!0):!1}}const Vt=g.Extension.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>we(t,this.options),unsetTableCellBackground:()=>we("",this.options)}}}),Kt=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,qt=/CrOS/,Xt=/android|ipad|playbook|silk/i;function Ce(t={}){let e=t.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(Kt.test(e)&&!qt.test(e)||t.tablet&&Xt.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const ye=t=>Array.from({length:t}).map((e,n)=>n+1);function Zt(t){var f;const[e,n]=W.useState(!1),[o,l]=W.useState(!0),[r,s]=W.useState({rows:Ce()?v.TABLE_MAX_GRID_SIZE:v.TABLE_INIT_GRID_SIZE,cols:Ce()?v.TABLE_MAX_GRID_SIZE:v.TABLE_INIT_GRID_SIZE}),[i,c]=W.useState({rows:v.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:v.TABLE_DEFAULT_SELECTED_GRID_SIZE});function a(h,p){h===r.rows&&s(m=>({...m,rows:Math.min(h+1,v.TABLE_MAX_GRID_SIZE)})),p===r.cols&&s(m=>({...m,cols:Math.min(p+1,v.TABLE_MAX_GRID_SIZE)})),c({rows:h,cols:p})}function d(h,p){t==null||t.createTable({rows:h,cols:p,withHeaderRow:o}),u(),n(!1)}function u(){l(!1),s({rows:v.TABLE_INIT_GRID_SIZE,cols:v.TABLE_INIT_GRID_SIZE}),c({rows:v.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:v.TABLE_DEFAULT_SELECTED_GRID_SIZE})}return A.jsxs(X.Popover,{modal:!0,onOpenChange:n,open:e,children:[A.jsx(X.PopoverTrigger,{asChild:!0,"data-state":t!=null&&t.dataState?"on":"off",children:t==null?void 0:t.children}),A.jsx(X.PopoverContent,{align:"start",className:"richtext-w-full !richtext-p-2",side:"bottom",children:A.jsxs("div",{className:"table-grid-size-editor richtext-p-0",children:[A.jsx("div",{className:"richtext-flex richtext-flex-col richtext-flex-wrap richtext-justify-between richtext-gap-1",children:(f=ye(r==null?void 0:r.rows))==null?void 0:f.map(h=>{var p;return A.jsx("div",{className:"richtext-flex richtext-gap-1",children:(p=ye(r==null?void 0:r.cols))==null?void 0:p.map(m=>A.jsx("div",{onMouseDown:()=>d(h,m),onMouseOver:()=>a(h,m),className:`richtext-cursor-pointer richtext-border-border ${m<=i.cols&&h<=i.rows&&"tableCellActive !richtext-bg-foreground"}`,children:A.jsx("div",{className:"richtext-box-border richtext-size-4 richtext-rounded-[2px] !richtext-border richtext-border-solid !richtext-border-border richtext-p-1"})},`richtext-table-col-${m}`))},`richtext-table-row-${h}`)})}),A.jsxs("div",{className:"richtext-mt-2 richtext-text-center richtext-text-sm richtext-text-foreground",children:[i.rows,"x",i.cols]})]})})]})}function Ut(){const t=Z.useEditorInstance(),e=Z.useButtonProps(He.name),{icon:n=void 0,tooltip:o=void 0,action:l=void 0,isActive:r=void 0,color:s}=(e==null?void 0:e.componentProps)??{},{dataState:i,disabled:c}=Z.useToggleActive(r);if(!e)return A.jsx(A.Fragment,{});function a(d){t.chain().focus().insertTable({...d,withHeaderRow:!1}).run()}return A.jsx(Zt,{createTable:a,dataState:i,children:A.jsx(Ie.ActionButton,{action:l,color:s,dataState:i,icon:n,isActive:r,tooltip:o,disabled:c})})}const He=De.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{style:`
6
+ border: 1px solid #000;
7
+ border-collapse: collapse;
8
+ width: 100%;
9
+ `},resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({componentProps:{isActive:()=>e.isActive("table"),icon:"Table",tooltip:n("editor.table.tooltip")}})}},addExtensions(){return[ze.configure(this.options.tableRow),Le.configure(this.options.tableHeader),ke.configure(this.options.tableCell),Vt.configure(this.options.tableCellBackground)]}});exports.CellSelection=C;exports.RichTextTable=Ut;exports.Table=He;
package/lib/Table.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-3VstSlg4.cjs");exports.RichTextTable=e.RichTextTable;exports.Table=e.Table;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-CIzgfvr9.cjs");exports.RichTextTable=e.RichTextTable;exports.Table=e.Table;
package/lib/Table.js CHANGED
@@ -1,4 +1,4 @@
1
- import { R as T, T as b } from "./Table-39OkCQbu.js";
1
+ import { R as T, T as b } from "./Table-BIZppoiY.js";
2
2
  export {
3
3
  T as RichTextTable,
4
4
  b as Table
package/lib/TaskList.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-TMqmkmT6.cjs"),e=require("react/jsx-runtime"),m=require("./toggle-DVCNvcqp.cjs");require("react");require("./index-CNzHZDls.cjs");const a=require("./useButtonProps-bei1vI37.cjs");function g(){const t=a.useButtonProps(u.name),{icon:s=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:d={},action:n=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:r,update:T}=a.useToggleActive(l),k=()=>{r||n&&(n(),T())};return t?e.jsx(m.ActionButton,{action:k,dataState:p,disabled:r,icon:s,shortcutKeys:o,tooltip:i,tooltipOptions:d}):e.jsx(e.Fragment,{})}const u=c.TaskList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:s,t:i,extension:o})=>({componentProps:{action:()=>s.commands.toggleTaskList(),isActive:()=>s.isActive("taskList"),disabled:!1,icon:"ListTodo",shortcutKeys:o.options.shortcutKeys??["shift","mod","9"],tooltip:i("editor.tasklist.tooltip")}})}},addExtensions(){return[c.TaskItem.configure(this.options.taskItem)]}});exports.RichTextTaskList=g;exports.TaskList=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-TMqmkmT6.cjs"),e=require("react/jsx-runtime"),m=require("./index-D42xFOzI.cjs");require("react");const a=require("./useButtonProps-TfmRCM9r.cjs");function v(){const t=a.useButtonProps(u.name),{icon:s=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:d={},action:n=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:r,update:T}=a.useToggleActive(l),k=()=>{r||n&&(n(),T())};return t?e.jsx(m.ActionButton,{action:k,dataState:p,disabled:r,icon:s,shortcutKeys:o,tooltip:i,tooltipOptions:d}):e.jsx(e.Fragment,{})}const u=c.TaskList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:s,t:i,extension:o})=>({componentProps:{action:()=>s.commands.toggleTaskList(),isActive:()=>s.isActive("taskList"),disabled:!1,icon:"ListTodo",shortcutKeys:o.options.shortcutKeys??["shift","mod","9"],tooltip:i("editor.tasklist.tooltip")}})}},addExtensions(){return[c.TaskItem.configure(this.options.taskItem)]}});exports.RichTextTaskList=v;exports.TaskList=u;
package/lib/TaskList.js CHANGED
@@ -1,13 +1,12 @@
1
- import { T as u, a as l } from "./index-D-FhWysc.js";
1
+ import { T as u, a as l } from "./index-Dwt9--mS.js";
2
2
  import { jsx as a, Fragment as f } from "react/jsx-runtime";
3
- import { A as k } from "./toggle-xchtz-Kf.js";
3
+ import { A as k } from "./index--knBGB61.js";
4
4
  import "react";
5
- import "./index-DuZCJJSp.js";
6
- import { u as T, a as v } from "./useButtonProps-D0SrPzuG.js";
7
- function I() {
5
+ import { u as T, a as v } from "./useButtonProps-BIH_9bXT.js";
6
+ function y() {
8
7
  const t = T(A.name), {
9
- icon: o = void 0,
10
- tooltip: s = void 0,
8
+ icon: s = void 0,
9
+ tooltip: o = void 0,
11
10
  shortcutKeys: i = void 0,
12
11
  tooltipOptions: r = {},
13
12
  action: e = void 0,
@@ -21,9 +20,9 @@ function I() {
21
20
  action: d,
22
21
  dataState: m,
23
22
  disabled: n,
24
- icon: o,
23
+ icon: s,
25
24
  shortcutKeys: i,
26
- tooltip: s,
25
+ tooltip: o,
27
26
  tooltipOptions: r
28
27
  }
29
28
  ) : /* @__PURE__ */ a(f, {});
@@ -43,14 +42,14 @@ const A = /* @__PURE__ */ u.extend({
43
42
  class: "task-list-item"
44
43
  }
45
44
  },
46
- button: ({ editor: o, t: s, extension: i }) => ({
45
+ button: ({ editor: s, t: o, extension: i }) => ({
47
46
  componentProps: {
48
- action: () => o.commands.toggleTaskList(),
49
- isActive: () => o.isActive("taskList"),
47
+ action: () => s.commands.toggleTaskList(),
48
+ isActive: () => s.isActive("taskList"),
50
49
  disabled: !1,
51
50
  icon: "ListTodo",
52
51
  shortcutKeys: i.options.shortcutKeys ?? ["shift", "mod", "9"],
53
- tooltip: s("editor.tasklist.tooltip")
52
+ tooltip: o("editor.tasklist.tooltip")
54
53
  }
55
54
  })
56
55
  };
@@ -60,6 +59,6 @@ const A = /* @__PURE__ */ u.extend({
60
59
  }
61
60
  });
62
61
  export {
63
- I as RichTextTaskList,
62
+ y as RichTextTaskList,
64
63
  A as TaskList
65
64
  };
package/lib/TextAlign.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),m=require("react"),M=require("./toggle-DVCNvcqp.cjs");require("./index-CNzHZDls.cjs");const y=require("./useButtonProps-bei1vI37.cjs"),T=require("./popover-CZWSQZ0q.cjs"),S=require("./Icon-BjR_or8V.cjs"),j=require("./tooltip-DFjcKu9a.cjs");var q=K.Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),P=q;function R(){const[e,t]=m.useState(!1),n=y.useButtonProps(C.name),{icon:g=void 0,tooltip:f=void 0,items:r=[],isActive:A=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:l,dataState:c}=y.useActive(A),u=m.useMemo(()=>(c==null?void 0:c.title)||"",[c]),x=m.useMemo(()=>r==null?void 0:r.some(i=>i.title===u),[r,u]);return n?s.jsxs(T.Popover,{modal:!0,onOpenChange:t,open:e,children:[s.jsx(T.PopoverTrigger,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent","data-state":x?"on":"off",disabled:l,children:s.jsx(M.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:g,tooltip:f,children:s.jsx(S.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),s.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:r==null?void 0:r.map((i,p)=>{var o,a;return s.jsxs(j.Tooltip,{children:[s.jsx(j.TooltipTrigger,{asChild:!0,children:s.jsx(M.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":u===i.title?"on":"off",size:"sm",onClick:()=>{i==null||i.action(),t(!1)},children:(i==null?void 0:i.icon)&&s.jsx(S.IconComponent,{name:i.icon})})}),s.jsxs(j.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[s.jsx("span",{children:i.title}),!!((o=i.shortcutKeys)!=null&&o.length)&&s.jsx("span",{children:(a=i.shortcutKeys)==null?void 0:a.map(h=>y.getShortcutKey(h)).join(" ")})]})]},`text-align-${p}`)})})]}):s.jsx(s.Fragment,{})}const C=P.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["heading","paragraph","list_item","title"],button({editor:t,extension:n,t:g}){var c,u,x,i,p;const f=((c=n.options)==null?void 0:c.alignments)||[],r={left:((u=n.options.shortcutKeys)==null?void 0:u[0])??["mod","Shift","L"],center:((x=n.options.shortcutKeys)==null?void 0:x[1])??["mod","Shift","E"],right:((i=n.options.shortcutKeys)==null?void 0:i[2])??["mod","Shift","R"],justify:((p=n.options.shortcutKeys)==null?void 0:p[3])??["mod","Shift","J"]},A={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},l=f.map(o=>{var a,h,v;return{title:g(`editor.textalign.${o}.tooltip`),icon:A[o],shortcutKeys:r[o],isActive:()=>t.isActive({textAlign:o})||!1,action:()=>{var d,b;return(b=(d=t.commands)==null?void 0:d.setTextAlign)==null?void 0:b.call(d,o)},disabled:!((v=(h=(a=t==null?void 0:t.can)==null?void 0:a.call(t))==null?void 0:h.setTextAlign)!=null&&v.call(h,o))}});return{componentProps:{icon:"AlignJustify",tooltip:g("editor.textalign.tooltip"),items:l,isActive:()=>l==null?void 0:l.find(a=>a.isActive())}}}}}});exports.RichTextAlign=R;exports.TextAlign=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),y=require("react"),g=require("./index-D42xFOzI.cjs"),b=require("./Icon-C3j4ls73.cjs"),T=require("./popover-sP8CwbV-.cjs"),M=require("./useButtonProps-TfmRCM9r.cjs");var K=C.Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),q=K;function P(){const[e,t]=y.useState(!1),n=M.useButtonProps(S.name),{icon:x=void 0,tooltip:A=void 0,items:r=[],isActive:m=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:l,dataState:c}=M.useActive(m),u=y.useMemo(()=>(c==null?void 0:c.title)||"",[c]),d=y.useMemo(()=>r==null?void 0:r.some(i=>i.title===u),[r,u]);return n?s.jsxs(T.Popover,{modal:!0,onOpenChange:t,open:e,children:[s.jsx(T.PopoverTrigger,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent","data-state":d?"on":"off",disabled:l,children:s.jsx(g.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:x,tooltip:A,children:s.jsx(b.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),s.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:r==null?void 0:r.map((i,p)=>{var o,a;return s.jsxs(g.Tooltip,{children:[s.jsx(g.TooltipTrigger,{asChild:!0,children:s.jsx(g.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":u===i.title?"on":"off",size:"sm",onClick:()=>{i==null||i.action(),t(!1)},children:(i==null?void 0:i.icon)&&s.jsx(b.IconComponent,{name:i.icon})})}),s.jsxs(g.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[s.jsx("span",{children:i.title}),!!((o=i.shortcutKeys)!=null&&o.length)&&s.jsx("span",{children:(a=i.shortcutKeys)==null?void 0:a.map(h=>g.getShortcutKey(h)).join(" ")})]})]},`text-align-${p}`)})})]}):s.jsx(s.Fragment,{})}const S=q.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["heading","paragraph","list_item","title"],button({editor:t,extension:n,t:x}){var c,u,d,i,p;const A=((c=n.options)==null?void 0:c.alignments)||[],r={left:((u=n.options.shortcutKeys)==null?void 0:u[0])??["mod","Shift","L"],center:((d=n.options.shortcutKeys)==null?void 0:d[1])??["mod","Shift","E"],right:((i=n.options.shortcutKeys)==null?void 0:i[2])??["mod","Shift","R"],justify:((p=n.options.shortcutKeys)==null?void 0:p[3])??["mod","Shift","J"]},m={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},l=A.map(o=>{var a,h,j;return{title:x(`editor.textalign.${o}.tooltip`),icon:m[o],shortcutKeys:r[o],isActive:()=>t.isActive({textAlign:o})||!1,action:()=>{var f,v;return(v=(f=t.commands)==null?void 0:f.setTextAlign)==null?void 0:v.call(f,o)},disabled:!((j=(h=(a=t==null?void 0:t.can)==null?void 0:a.call(t))==null?void 0:h.setTextAlign)!=null&&j.call(h,o))}});return{componentProps:{icon:"AlignJustify",tooltip:x("editor.textalign.tooltip"),items:l,isActive:()=>l==null?void 0:l.find(a=>a.isActive())}}}}}});exports.RichTextAlign=P;exports.TextAlign=S;
package/lib/TextAlign.js CHANGED
@@ -1,12 +1,10 @@
1
- import { E as C } from "./index-nFjllrEl.js";
1
+ import { E as C } from "./index-BvYjBPF9.js";
2
2
  import { jsx as o, Fragment as K, jsxs as A } from "react/jsx-runtime";
3
3
  import M, { useMemo as v } from "react";
4
- import { A as S, T as j } from "./toggle-xchtz-Kf.js";
5
- import "./index-DuZCJJSp.js";
6
- import { u as P, b as w, h as N } from "./useButtonProps-D0SrPzuG.js";
7
- import { P as z, a as L, b as O } from "./popover-CoepUobG.js";
8
- import { I as b } from "./Icon-C-qYUAS1.js";
9
- import { T as R, a as _, b as $ } from "./tooltip-BTFcHrd9.js";
4
+ import { A as S, T as j, a as P, f as w, b as N, h as z } from "./index--knBGB61.js";
5
+ import { I as b } from "./Icon-CysGlJkv.js";
6
+ import { P as L, a as O, b as R } from "./popover-D3spkemr.js";
7
+ import { u as _, b as $ } from "./useButtonProps-BIH_9bXT.js";
10
8
  var E = C.create({
11
9
  name: "textAlign",
12
10
  addOptions() {
@@ -49,22 +47,22 @@ var E = C.create({
49
47
  };
50
48
  }
51
49
  }), J = E;
52
- function W() {
53
- const [e, t] = M.useState(!1), n = P(B.name), {
50
+ function U() {
51
+ const [e, t] = M.useState(!1), n = _(B.name), {
54
52
  icon: p = void 0,
55
53
  tooltip: x = void 0,
56
54
  items: r = [],
57
55
  isActive: m = void 0
58
- } = (n == null ? void 0 : n.componentProps) ?? {}, { disabled: l, dataState: a } = w(m), h = v(() => (a == null ? void 0 : a.title) || "", [a]), g = v(() => r == null ? void 0 : r.some((i) => i.title === h), [r, h]);
56
+ } = (n == null ? void 0 : n.componentProps) ?? {}, { disabled: l, dataState: a } = $(m), h = v(() => (a == null ? void 0 : a.title) || "", [a]), g = v(() => r == null ? void 0 : r.some((i) => i.title === h), [r, h]);
59
57
  return n ? /* @__PURE__ */ A(
60
- z,
58
+ L,
61
59
  {
62
60
  modal: !0,
63
61
  onOpenChange: t,
64
62
  open: e,
65
63
  children: [
66
64
  /* @__PURE__ */ o(
67
- L,
65
+ O,
68
66
  {
69
67
  asChild: !0,
70
68
  className: "hover:richtext-bg-accent data-[state=on]:richtext-bg-accent",
@@ -89,16 +87,16 @@ function W() {
89
87
  }
90
88
  ),
91
89
  /* @__PURE__ */ o(
92
- O,
90
+ R,
93
91
  {
94
92
  align: "start",
95
93
  className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
96
94
  side: "bottom",
97
95
  children: r == null ? void 0 : r.map((i, d) => {
98
96
  var s, c;
99
- return /* @__PURE__ */ A(R, { children: [
100
- /* @__PURE__ */ o(_, { asChild: !0, children: /* @__PURE__ */ o(
101
- j,
97
+ return /* @__PURE__ */ A(j, { children: [
98
+ /* @__PURE__ */ o(P, { asChild: !0, children: /* @__PURE__ */ o(
99
+ w,
102
100
  {
103
101
  className: "richtext-size-7 richtext-p-1",
104
102
  "data-state": h === i.title ? "on" : "off",
@@ -109,9 +107,9 @@ function W() {
109
107
  children: (i == null ? void 0 : i.icon) && /* @__PURE__ */ o(b, { name: i.icon })
110
108
  }
111
109
  ) }),
112
- /* @__PURE__ */ A($, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
110
+ /* @__PURE__ */ A(N, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
113
111
  /* @__PURE__ */ o("span", { children: i.title }),
114
- !!((s = i.shortcutKeys) != null && s.length) && /* @__PURE__ */ o("span", { children: (c = i.shortcutKeys) == null ? void 0 : c.map((u) => N(u)).join(" ") })
112
+ !!((s = i.shortcutKeys) != null && s.length) && /* @__PURE__ */ o("span", { children: (c = i.shortcutKeys) == null ? void 0 : c.map((u) => z(u)).join(" ") })
115
113
  ] })
116
114
  ] }, `text-align-${d}`);
117
115
  })
@@ -172,6 +170,6 @@ const B = /* @__PURE__ */ J.extend({
172
170
  }
173
171
  });
174
172
  export {
175
- W as RichTextAlign,
173
+ U as RichTextAlign,
176
174
  B as TextAlign
177
175
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./index-DLqogznp.cjs"),e=require("react/jsx-runtime"),j=require("react"),m=require("./toggle-DVCNvcqp.cjs");require("./index-CNzHZDls.cjs");const d=require("./useButtonProps-bei1vI37.cjs"),T=require("./popover-CZWSQZ0q.cjs"),D=require("./Icon-BjR_or8V.cjs"),g=require("./tooltip-DFjcKu9a.cjs");function b(){const i=d.useButtonProps(v.name),[c,x]=j.useState(!1),{icon:u=void 0,tooltip:h=void 0,items:s=[],isActive:p=void 0}=(i==null?void 0:i.componentProps)??{},{editorDisabled:l,dataState:o}=d.useActive(p),n=j.useMemo(()=>(o==null?void 0:o.dir)||"unset",[o]);return i?e.jsxs(T.Popover,{open:c,onOpenChange:x,modal:!0,children:[e.jsx(T.PopoverTrigger,{asChild:!0,disabled:l,children:e.jsx(m.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:u,tooltip:h,children:e.jsx(D.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),e.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",hideWhenDetached:!0,children:s==null?void 0:s.map((t,r)=>{var a,f;return e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{"data-state":n===t.value?"on":"off",asChild:!0,children:e.jsx(m.Toggle,{className:"richtext-size-7 richtext-p-1",onClick:()=>{t==null||t.action(),x(!1)},size:"sm",children:(t==null?void 0:t.icon)&&e.jsx(D.IconComponent,{name:t.icon})})}),e.jsxs(g.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[e.jsx("span",{children:t.title}),!!((a=t.shortcutKeys)!=null&&a.length)&&e.jsx("span",{children:(f=t.shortcutKeys)==null?void 0:f.map(q=>d.getShortcutKey(q)).join(" ")})]})]},`text-direction-${r}`)})})]}):e.jsx(e.Fragment,{})}const v=C.Extension.create({name:"richTextTextDirection",addOptions(){var i;return{...(i=this.parent)==null?void 0:i.call(this),directions:["auto","ltr","rtl","unset"],defaultDirection:"auto",button({editor:c,extension:x,t:u}){var l;const h=((l=x.options)==null?void 0:l.directions)||[],s={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft",unset:"X"},p=h.map(o=>({title:u(`editor.textDirection.${o}.tooltip`),value:o,icon:s[o],action:()=>{var n,t,r,a;if(o==="unset"){(t=(n=c.commands)==null?void 0:n.unsetTextDirection)==null||t.call(n);return}(a=(r=c.commands)==null?void 0:r.setTextDirection)==null||a.call(r,o)},disabled:!1}));return{componentProps:{icon:"TextDirection",tooltip:u("editor.textDirection.tooltip"),items:p,isActive:()=>c.getAttributes("paragraph")}}}}}});exports.RichTextTextDirection=b;exports.TextDirection=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./index-DLqogznp.cjs"),e=require("react/jsx-runtime"),f=require("react"),c=require("./index-D42xFOzI.cjs"),j=require("./Icon-C3j4ls73.cjs"),T=require("./popover-sP8CwbV-.cjs"),m=require("./useButtonProps-TfmRCM9r.cjs");function b(){const n=m.useButtonProps(D.name),[s,u]=f.useState(!1),{icon:h=void 0,tooltip:d=void 0,items:l=[],isActive:p=void 0}=(n==null?void 0:n.componentProps)??{},{editorDisabled:a,dataState:o}=m.useActive(p),i=f.useMemo(()=>(o==null?void 0:o.dir)||"unset",[o]);return n?e.jsxs(T.Popover,{open:s,onOpenChange:u,modal:!0,children:[e.jsx(T.PopoverTrigger,{asChild:!0,disabled:a,children:e.jsx(c.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:a,icon:h,tooltip:d,children:e.jsx(j.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),e.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",hideWhenDetached:!0,children:l==null?void 0:l.map((t,r)=>{var x,g;return e.jsxs(c.Tooltip,{children:[e.jsx(c.TooltipTrigger,{"data-state":i===t.value?"on":"off",asChild:!0,children:e.jsx(c.Toggle,{className:"richtext-size-7 richtext-p-1",onClick:()=>{t==null||t.action(),u(!1)},size:"sm",children:(t==null?void 0:t.icon)&&e.jsx(j.IconComponent,{name:t.icon})})}),e.jsxs(c.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[e.jsx("span",{children:t.title}),!!((x=t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:(g=t.shortcutKeys)==null?void 0:g.map(v=>c.getShortcutKey(v)).join(" ")})]})]},`text-direction-${r}`)})})]}):e.jsx(e.Fragment,{})}const D=C.Extension.create({name:"richTextTextDirection",addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),directions:["auto","ltr","rtl","unset"],defaultDirection:"auto",button({editor:s,extension:u,t:h}){var a;const d=((a=u.options)==null?void 0:a.directions)||[],l={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft",unset:"X"},p=d.map(o=>({title:h(`editor.textDirection.${o}.tooltip`),value:o,icon:l[o],action:()=>{var i,t,r,x;if(o==="unset"){(t=(i=s.commands)==null?void 0:i.unsetTextDirection)==null||t.call(i);return}(x=(r=s.commands)==null?void 0:r.setTextDirection)==null||x.call(r,o)},disabled:!1}));return{componentProps:{icon:"TextDirection",tooltip:h("editor.textDirection.tooltip"),items:p,isActive:()=>s.getAttributes("paragraph")}}}}}});exports.RichTextTextDirection=b;exports.TextDirection=D;
@@ -1,28 +1,26 @@
1
- import { E as g } from "./index-nFjllrEl.js";
1
+ import { E as g } from "./index-BvYjBPF9.js";
2
2
  import { jsx as o, Fragment as D, jsxs as x } from "react/jsx-runtime";
3
3
  import v, { useMemo as b } from "react";
4
- import { A as C, T as A } from "./toggle-xchtz-Kf.js";
5
- import "./index-DuZCJJSp.js";
6
- import { u as P, b as w, h as z } from "./useButtonProps-D0SrPzuG.js";
7
- import { P as N, a as R, b as j } from "./popover-CoepUobG.js";
8
- import { I as f } from "./Icon-C-qYUAS1.js";
9
- import { T as y, a as K, b as M } from "./tooltip-BTFcHrd9.js";
10
- function X() {
11
- const i = P(O.name), [c, h] = v.useState(!1), {
4
+ import { A as C, T as A, a as P, f as w, b as z, h as N } from "./index--knBGB61.js";
5
+ import { I as f } from "./Icon-CysGlJkv.js";
6
+ import { P as R, a as j, b as y } from "./popover-D3spkemr.js";
7
+ import { u as K, b as M } from "./useButtonProps-BIH_9bXT.js";
8
+ function S() {
9
+ const i = K(O.name), [c, h] = v.useState(!1), {
12
10
  icon: p = void 0,
13
11
  tooltip: u = void 0,
14
12
  items: s = [],
15
13
  isActive: d = void 0
16
- } = (i == null ? void 0 : i.componentProps) ?? {}, { editorDisabled: a, dataState: e } = w(d), r = b(() => (e == null ? void 0 : e.dir) || "unset", [e]);
14
+ } = (i == null ? void 0 : i.componentProps) ?? {}, { editorDisabled: a, dataState: e } = M(d), r = b(() => (e == null ? void 0 : e.dir) || "unset", [e]);
17
15
  return i ? /* @__PURE__ */ x(
18
- N,
16
+ R,
19
17
  {
20
18
  open: c,
21
19
  onOpenChange: h,
22
20
  modal: !0,
23
21
  children: [
24
22
  /* @__PURE__ */ o(
25
- R,
23
+ j,
26
24
  {
27
25
  asChild: !0,
28
26
  disabled: a,
@@ -45,7 +43,7 @@ function X() {
45
43
  }
46
44
  ),
47
45
  /* @__PURE__ */ o(
48
- j,
46
+ y,
49
47
  {
50
48
  align: "start",
51
49
  className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
@@ -53,14 +51,14 @@ function X() {
53
51
  hideWhenDetached: !0,
54
52
  children: s == null ? void 0 : s.map((t, n) => {
55
53
  var l, m;
56
- return /* @__PURE__ */ x(y, { children: [
54
+ return /* @__PURE__ */ x(A, { children: [
57
55
  /* @__PURE__ */ o(
58
- K,
56
+ P,
59
57
  {
60
58
  "data-state": r === t.value ? "on" : "off",
61
59
  asChild: !0,
62
60
  children: /* @__PURE__ */ o(
63
- A,
61
+ w,
64
62
  {
65
63
  className: "richtext-size-7 richtext-p-1",
66
64
  onClick: () => {
@@ -72,9 +70,9 @@ function X() {
72
70
  )
73
71
  }
74
72
  ),
75
- /* @__PURE__ */ x(M, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
73
+ /* @__PURE__ */ x(z, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
76
74
  /* @__PURE__ */ o("span", { children: t.title }),
77
- !!((l = t.shortcutKeys) != null && l.length) && /* @__PURE__ */ o("span", { children: (m = t.shortcutKeys) == null ? void 0 : m.map((T) => z(T)).join(" ") })
75
+ !!((l = t.shortcutKeys) != null && l.length) && /* @__PURE__ */ o("span", { children: (m = t.shortcutKeys) == null ? void 0 : m.map((T) => N(T)).join(" ") })
78
76
  ] })
79
77
  ] }, `text-direction-${n}`);
80
78
  })
@@ -130,6 +128,6 @@ const O = /* @__PURE__ */ g.create({
130
128
  }
131
129
  });
132
130
  export {
133
- X as RichTextTextDirection,
131
+ S as RichTextTextDirection,
134
132
  O as TextDirection
135
133
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),h=require("./toggle-DVCNvcqp.cjs");require("react");require("./index-CNzHZDls.cjs");const a=require("./useButtonProps-bei1vI37.cjs");var k=u.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",u.mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,n){return n.applyMark(this.name||"underline",n.parseInline(e.tokens||[]))},renderMarkdown(e,n){return`++${n.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,n,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),v=k;function x(){const e=a.useButtonProps(l.name),{icon:n=void 0,tooltip:t=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:i=void 0,isActive:c=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:m,disabled:d,update:p}=a.useToggleActive(c),g=()=>{d||i&&(i(),p())};return e?s.jsx(h.ActionButton,{action:g,dataState:m,disabled:d,icon:n,shortcutKeys:o,tooltip:t,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:n,t,extension:o}){return{componentProps:{action:()=>n.commands.toggleUnderline(),isActive:()=>n.isActive("underline")||!1,disabled:!1,icon:"Underline",shortcutKeys:o.options.shortcutKeys??["mod","U"],tooltip:t("editor.underline.tooltip")}}}}}});exports.RichTextUnderline=x;exports.TextUnderline=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-DLqogznp.cjs"),s=require("react/jsx-runtime"),h=require("./index-D42xFOzI.cjs");require("react");const a=require("./useButtonProps-TfmRCM9r.cjs");var x=u.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",u.mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,n){return n.applyMark(this.name||"underline",n.parseInline(e.tokens||[]))},renderMarkdown(e,n){return`++${n.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,n,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),k=x;function v(){const e=a.useButtonProps(l.name),{icon:n=void 0,tooltip:t=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:i=void 0,isActive:c=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:m,disabled:d,update:p}=a.useToggleActive(c),g=()=>{d||i&&(i(),p())};return e?s.jsx(h.ActionButton,{action:g,dataState:m,disabled:d,icon:n,shortcutKeys:o,tooltip:t,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=k.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:n,t,extension:o}){return{componentProps:{action:()=>n.commands.toggleUnderline(),isActive:()=>n.isActive("underline")||!1,disabled:!1,icon:"Underline",shortcutKeys:o.options.shortcutKeys??["mod","U"],tooltip:t("editor.underline.tooltip")}}}}}});exports.RichTextUnderline=v;exports.TextUnderline=l;
@@ -1,9 +1,8 @@
1
- import { M as m, m as p } from "./index-nFjllrEl.js";
1
+ import { M as m, m as p } from "./index-BvYjBPF9.js";
2
2
  import { jsx as d, Fragment as g } from "react/jsx-runtime";
3
- import { A as f } from "./toggle-xchtz-Kf.js";
3
+ import { A as f } from "./index--knBGB61.js";
4
4
  import "react";
5
- import "./index-DuZCJJSp.js";
6
- import { u as h, a as k } from "./useButtonProps-D0SrPzuG.js";
5
+ import { u as h, a as k } from "./useButtonProps-BIH_9bXT.js";
7
6
  var M = m.create({
8
7
  name: "underline",
9
8
  addOptions() {
@@ -65,7 +64,7 @@ var M = m.create({
65
64
  };
66
65
  }
67
66
  }), v = M;
68
- function H() {
67
+ function w() {
69
68
  const e = h(U.name), {
70
69
  icon: t = void 0,
71
70
  tooltip: n = void 0,
@@ -112,6 +111,6 @@ const U = /* @__PURE__ */ v.extend({
112
111
  }
113
112
  });
114
113
  export {
115
- H as RichTextUnderline,
114
+ w as RichTextUnderline,
116
115
  U as TextUnderline
117
116
  };
@@ -1,15 +1,14 @@
1
- import { C as U, aa as rt, s as At, N as Vt, m as Mt, ab as jt, R as Wt } from "./index-nFjllrEl.js";
1
+ import { C as U, aa as rt, s as At, N as Vt, m as Mt, ab as jt, R as Wt } from "./index-BvYjBPF9.js";
2
2
  import { jsx as r, jsxs as h, Fragment as Bt } from "react/jsx-runtime";
3
3
  import Be, { useState as se, Fragment as Ft, useEffect as Fe, useMemo as Pe, createContext as Pt, useLayoutEffect as Ut, useContext as zt, useRef as K, useCallback as be, useDebugValue as Ht } from "react";
4
- import { A as Gt } from "./toggle-xchtz-Kf.js";
5
- import "./index-DuZCJJSp.js";
6
- import { u as Xt } from "./index-0OnGZkVF.js";
7
- import { L as Kt } from "./label-DC33TZy_.js";
8
- import { I as Qt } from "./input-DfqFAyKo.js";
9
- import { B as Jt } from "./button-Crm67hfl.js";
10
- import { c as Yt, u as Zt, a as en } from "./useButtonProps-D0SrPzuG.js";
11
- import { P as tn, a as nn, b as rn } from "./popover-CoepUobG.js";
12
- import { I as on } from "./Icon-C-qYUAS1.js";
4
+ import { A as Gt } from "./index--knBGB61.js";
5
+ import { I as Xt } from "./Icon-CysGlJkv.js";
6
+ import { P as Kt, a as Qt, b as Jt } from "./popover-D3spkemr.js";
7
+ import { B as Yt } from "./button-C81t4pb1.js";
8
+ import { I as Zt } from "./input-DR_5pbuA.js";
9
+ import { L as en } from "./label-D-0oXKCn.js";
10
+ import { u as tn } from "./index-0OnGZkVF.js";
11
+ import { c as nn, u as rn, a as on } from "./useButtonProps-BIH_9bXT.js";
13
12
  const sn = "_verified_lvyh0_1", Ue = {
14
13
  verified: sn
15
14
  }, an = () => /* @__PURE__ */ r("svg", {
@@ -1495,7 +1494,7 @@ function Ko({ node: e }) {
1495
1494
  return n ? /* @__PURE__ */ r(At, { children: /* @__PURE__ */ r("div", { "data-twitter": "", children: /* @__PURE__ */ r(Xo, { id: n }) }) }) : null;
1496
1495
  }
1497
1496
  function Qo(e) {
1498
- const { t } = Xt(), [n, o] = se("");
1497
+ const { t } = tn(), [n, o] = se("");
1499
1498
  Fe(() => {
1500
1499
  var a;
1501
1500
  if (e != null && e.editor) {
@@ -1512,9 +1511,9 @@ function Qo(e) {
1512
1511
  className: "richtext-flex richtext-flex-col richtext-gap-2",
1513
1512
  onSubmit: i,
1514
1513
  children: [
1515
- /* @__PURE__ */ r(Kt, { className: "mb-[6px]", children: t("editor.link.dialog.text") }),
1514
+ /* @__PURE__ */ r(en, { className: "mb-[6px]", children: t("editor.link.dialog.text") }),
1516
1515
  /* @__PURE__ */ r("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ r("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ r(
1517
- Qt,
1516
+ Zt,
1518
1517
  {
1519
1518
  className: "richtext-w-80",
1520
1519
  onChange: (a) => o(a.target.value),
@@ -1525,7 +1524,7 @@ function Qo(e) {
1525
1524
  }
1526
1525
  ) }) }),
1527
1526
  /* @__PURE__ */ r(
1528
- Jt,
1527
+ Yt,
1529
1528
  {
1530
1529
  className: "richtext-mt-2 richtext-self-end",
1531
1530
  type: "submit",
@@ -1536,36 +1535,36 @@ function Qo(e) {
1536
1535
  }
1537
1536
  );
1538
1537
  }
1539
- function fi() {
1540
- const [e, t] = se(!1), n = Yt(), o = Zt(Ct.name), {
1538
+ function ui() {
1539
+ const [e, t] = se(!1), n = nn(), o = rn(Ct.name), {
1541
1540
  icon: i = void 0,
1542
1541
  tooltip: a = void 0,
1543
1542
  tooltipOptions: s = {},
1544
1543
  action: c = void 0,
1545
1544
  isActive: f = void 0
1546
- } = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: d } = en(f);
1545
+ } = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: d } = on(f);
1547
1546
  function g(m) {
1548
1547
  d || c && (c(m), t(!1));
1549
1548
  }
1550
1549
  return /* @__PURE__ */ h(
1551
- tn,
1550
+ Kt,
1552
1551
  {
1553
1552
  modal: !0,
1554
1553
  onOpenChange: t,
1555
1554
  open: e,
1556
1555
  children: [
1557
- /* @__PURE__ */ r(nn, { asChild: !0, children: /* @__PURE__ */ r(
1556
+ /* @__PURE__ */ r(Qt, { asChild: !0, children: /* @__PURE__ */ r(
1558
1557
  Gt,
1559
1558
  {
1560
1559
  disabled: d,
1561
1560
  isActive: f,
1562
1561
  tooltip: a,
1563
1562
  tooltipOptions: s,
1564
- children: /* @__PURE__ */ r(on, { name: i })
1563
+ children: /* @__PURE__ */ r(Xt, { name: i })
1565
1564
  }
1566
1565
  ) }),
1567
1566
  /* @__PURE__ */ r(
1568
- rn,
1567
+ Jt,
1569
1568
  {
1570
1569
  align: "start",
1571
1570
  className: "richtext-w-full",
@@ -1659,6 +1658,6 @@ const Ct = /* @__PURE__ */ Vt.create({
1659
1658
  });
1660
1659
  export {
1661
1660
  Qo as F,
1662
- fi as R,
1661
+ ui as R,
1663
1662
  Ct as T
1664
1663
  };