@remarkablejames/editor 0.0.6 → 0.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 (187) hide show
  1. package/README.md +1 -1
  2. package/lib/ActionMenuButton-D9o3Kwmv.cjs +1 -0
  3. package/lib/{ActionMenuButton-CpmEfz31.js → ActionMenuButton-nxV91Fqo.js} +10 -9
  4. package/lib/Attachment.cjs +19 -1
  5. package/lib/Attachment.js +270 -7
  6. package/lib/Blockquote.cjs +2 -2
  7. package/lib/Blockquote.js +12 -13
  8. package/lib/Bold.cjs +1 -1
  9. package/lib/Bold.js +10 -11
  10. package/lib/BulletList.cjs +1 -1
  11. package/lib/BulletList.js +8 -9
  12. package/lib/Callout.cjs +1 -1
  13. package/lib/Callout.js +45 -40
  14. package/lib/Clear.cjs +1 -1
  15. package/lib/Clear.js +14 -13
  16. package/lib/Code.cjs +1 -1
  17. package/lib/Code.js +5 -6
  18. package/lib/CodeBlock.cjs +1 -1
  19. package/lib/CodeBlock.js +33 -31
  20. package/lib/CodeView.cjs +1 -1
  21. package/lib/CodeView.js +8 -9
  22. package/lib/Color.cjs +1 -1
  23. package/lib/Color.js +19 -18
  24. package/lib/Column.cjs +1 -1
  25. package/lib/Column.js +8 -9
  26. package/lib/Drawer-Bh-y5bs8.cjs +2 -0
  27. package/lib/{Drawer-CayP4Ww4.js → Drawer-CF6Z_IA2.js} +36 -30
  28. package/lib/Drawer.cjs +1 -1
  29. package/lib/Drawer.js +3 -3
  30. package/lib/Emoji.cjs +1 -1
  31. package/lib/Emoji.js +18 -17
  32. package/lib/Excalidraw.cjs +1 -1
  33. package/lib/Excalidraw.js +37 -32
  34. package/lib/ExportPdf.cjs +3 -3
  35. package/lib/ExportPdf.js +13 -14
  36. package/lib/ExportWord.cjs +1 -1
  37. package/lib/ExportWord.js +6 -6
  38. package/lib/FontFamily.cjs +1 -1
  39. package/lib/FontFamily.js +6 -7
  40. package/lib/FontSize.cjs +1 -1
  41. package/lib/FontSize.js +14 -15
  42. package/lib/Heading.cjs +1 -1
  43. package/lib/Heading.js +28 -28
  44. package/lib/Highlight.cjs +1 -1
  45. package/lib/Highlight.js +23 -22
  46. package/lib/History.cjs +1 -1
  47. package/lib/History.js +11 -11
  48. package/lib/HorizontalRule.cjs +1 -1
  49. package/lib/HorizontalRule.js +9 -10
  50. package/lib/Icon-BvGyfX2j.js +15 -0
  51. package/lib/Icon-wjwoRc9F.cjs +1 -0
  52. package/lib/Iframe-BbfZKbPY.cjs +1 -0
  53. package/lib/{Iframe-C6Sb97KS.js → Iframe-Dfd3LI7b.js} +14 -11
  54. package/lib/Iframe.cjs +1 -1
  55. package/lib/Iframe.js +3 -3
  56. package/lib/Image.cjs +1 -1
  57. package/lib/Image.js +5 -4
  58. package/lib/ImageCropper-CY1ETEjC.cjs +10 -0
  59. package/lib/ImageCropper-DrSdjo9x.js +979 -0
  60. package/lib/ImageGif.cjs +1 -1
  61. package/lib/ImageGif.js +83 -80
  62. package/lib/ImportWord.cjs +1 -1
  63. package/lib/ImportWord.js +37 -35
  64. package/lib/{Indent-CcFe8py3.js → Indent-CDVF9DWN.js} +30 -31
  65. package/lib/Indent-Q1VuhSM2.cjs +1 -0
  66. package/lib/Indent.cjs +1 -1
  67. package/lib/Indent.js +2 -2
  68. package/lib/Italic.cjs +1 -1
  69. package/lib/Italic.js +11 -12
  70. package/lib/{Katex-Bp6AnIUF.js → Katex-DqhWWAA-.js} +22 -18
  71. package/lib/Katex-K1QU2SB2.cjs +4 -0
  72. package/lib/Katex.cjs +1 -1
  73. package/lib/Katex.js +2 -2
  74. package/lib/LineHeight.cjs +1 -1
  75. package/lib/LineHeight.js +20 -19
  76. package/lib/Link.cjs +1 -1
  77. package/lib/Link.js +2 -2
  78. package/lib/LinkEditBlock-CBYGLs3J.cjs +5 -0
  79. package/lib/{LinkEditBlock-BiHumIJR.js → LinkEditBlock-xP0pGVhB.js} +27 -22
  80. package/lib/Mention.js +3 -3
  81. package/lib/{Mermaid-Dlx0XTJj.js → Mermaid-BJ6ryVdY.js} +59 -55
  82. package/lib/Mermaid-D3_nLeOW.cjs +2 -0
  83. package/lib/Mermaid.cjs +1 -1
  84. package/lib/Mermaid.js +2 -2
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +28 -26
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +10 -11
  89. package/lib/PaywallSeparator.cjs +1 -1
  90. package/lib/PaywallSeparator.js +9 -9
  91. package/lib/SearchAndReplace.cjs +1 -1
  92. package/lib/SearchAndReplace.js +39 -34
  93. package/lib/SlashCommand.cjs +1 -1
  94. package/lib/SlashCommand.js +5 -5
  95. package/lib/SlashCommandNodeView-CUJrDQS7.cjs +1 -0
  96. package/lib/{SlashCommandNodeView-DzmsYaNc.js → SlashCommandNodeView-DS9FqMiY.js} +23 -21
  97. package/lib/Strike.cjs +1 -1
  98. package/lib/Strike.js +11 -12
  99. package/lib/Table-CV6pUoVf.cjs +5 -0
  100. package/lib/{Table-IH34r4jd.js → Table-CcG-JNtV.js} +46 -46
  101. package/lib/Table.cjs +1 -1
  102. package/lib/Table.js +1 -1
  103. package/lib/TaskList.cjs +1 -1
  104. package/lib/TaskList.js +11 -12
  105. package/lib/TextAlign.cjs +1 -1
  106. package/lib/TextAlign.js +27 -26
  107. package/lib/TextDirection.cjs +1 -1
  108. package/lib/TextDirection.js +19 -18
  109. package/lib/TextUnderline.cjs +1 -1
  110. package/lib/TextUnderline.js +8 -9
  111. package/lib/{Twitter-FVQKPaq6.js → Twitter-BIL3o833.js} +19 -15
  112. package/lib/Twitter-BfSTqPDh.cjs +1 -0
  113. package/lib/Twitter.cjs +1 -1
  114. package/lib/Twitter.js +2 -2
  115. package/lib/Video-DAKr90QL.js +231 -0
  116. package/lib/Video-HAinT0w6.cjs +1 -0
  117. package/lib/Video.cjs +1 -1
  118. package/lib/Video.js +5 -4
  119. package/lib/bubble.cjs +3 -3
  120. package/lib/bubble.js +112 -101
  121. package/lib/button-090-I3tp.js +35 -0
  122. package/lib/button-B4Sz2ZhW.cjs +1 -0
  123. package/lib/checkbox-BCPsu7yR.cjs +1 -0
  124. package/lib/checkbox-DiXWHAI0.js +29 -0
  125. package/lib/{clsx-BUPZHhq3.js → clsx-m_C5j3RU.js} +24 -24
  126. package/lib/components/RichTextProvider.d.ts +1 -1
  127. package/lib/dialog-C8J59d2J.cjs +1 -0
  128. package/lib/dialog-bDkDW-C_.js +95 -0
  129. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  130. package/lib/dom-dataset-CIEeltF6.js +47 -0
  131. package/lib/{dropdown-menu-Ce2TorkG.js → dropdown-menu-DWt_xj4h.js} +1 -1
  132. package/lib/{dropdown-menu-DirUyRAI.cjs → dropdown-menu-tUP872Zv.cjs} +1 -1
  133. package/lib/events.constant-Bke62qxm.cjs +1 -0
  134. package/lib/events.constant-CSWD3-ho.js +72 -0
  135. package/lib/file-i7e4nQY2.cjs +1 -0
  136. package/lib/file-jDdkhyj7.js +43 -0
  137. package/lib/{index-RkKGy5oa.js → index-B3Ijnbxs.js} +1 -1
  138. package/lib/index-BXh8X1ch.cjs +1 -0
  139. package/lib/{index-Dl3OjzmR.js → index-C1KQsOcg.js} +1 -1
  140. package/lib/{index-D4M4hrH4.js → index-C8FjP66D.js} +1 -1
  141. package/lib/index-jMN4V2hr.js +2763 -0
  142. package/lib/{index-DZj2z9_1.js → index-s3l5RdyW.js} +1 -1
  143. package/lib/index.cjs +4 -4
  144. package/lib/index.js +464 -149
  145. package/lib/input-C_J-pfTx.js +21 -0
  146. package/lib/input-DwLo4r7V.cjs +1 -0
  147. package/lib/isNumber-BTYSVlKo.cjs +1 -0
  148. package/lib/isNumber-WaBzl_0s.js +15 -0
  149. package/lib/label-BgIVynq3.cjs +1 -0
  150. package/lib/label-ClsOg9Hr.js +11 -0
  151. package/lib/{popover-BzJyaFvy.js → popover-BC7FRr8B.js} +1 -1
  152. package/lib/{popover-BdLwAlrM.cjs → popover-C3A6zzNV.cjs} +1 -1
  153. package/lib/{renderNodeView-dj6AaFSX.js → renderNodeView-C_hPIdEs.js} +2 -2
  154. package/lib/select-B8HIWDXf.cjs +1 -0
  155. package/lib/select-DSKqhVGR.js +120 -0
  156. package/lib/{separator-D-fyzbfx.js → separator-BJWSNjvr.js} +23 -22
  157. package/lib/separator-D6ruF682.cjs +1 -0
  158. package/lib/style.css +1 -1
  159. package/lib/tabs-D1J1iB7B.js +46 -0
  160. package/lib/tabs-IEbMQmNX.cjs +1 -0
  161. package/lib/textarea-Ch5w3PiI.js +20 -0
  162. package/lib/textarea-CtVdqwSM.cjs +1 -0
  163. package/lib/theme.cjs +1 -1
  164. package/lib/theme.js +18 -18
  165. package/lib/throttle-CRNq0z-O.js +249 -0
  166. package/lib/throttle-gTTvqDTW.cjs +1 -0
  167. package/lib/toggle-C9tcMm1r.cjs +1 -0
  168. package/lib/toggle-CaSwYCk4.js +89 -0
  169. package/lib/{updatePosition-C294Pixi.js → updatePosition-DvfTZHcH.js} +2 -2
  170. package/lib/use-toast-C6zPo25l.cjs +1 -0
  171. package/lib/use-toast-CEOqhXfx.js +97 -0
  172. package/lib/useButtonProps-D-ruygH7.js +165 -0
  173. package/lib/useButtonProps-D9ndBdmA.cjs +1 -0
  174. package/package.json +21 -32
  175. package/lib/ActionMenuButton-NfiUDE60.cjs +0 -1
  176. package/lib/Drawer-DlgdaO_B.cjs +0 -2
  177. package/lib/Iframe-CANdxSpV.cjs +0 -1
  178. package/lib/Indent-DuB2U6Cs.cjs +0 -1
  179. package/lib/Katex-DFU1unCm.cjs +0 -4
  180. package/lib/LinkEditBlock-C2zX0WVK.cjs +0 -5
  181. package/lib/Mermaid-B8lQSOGn.cjs +0 -2
  182. package/lib/SlashCommandNodeView-BfWNWGRr.cjs +0 -1
  183. package/lib/Table-BfM6ywrZ.cjs +0 -5
  184. package/lib/Twitter-axcoCgD7.cjs +0 -1
  185. package/lib/index-BynXHtjJ.cjs +0 -28
  186. package/lib/index-CnKgiZFQ.js +0 -5576
  187. package/lib/separator-CoQaQmFK.cjs +0 -1
@@ -1,5 +0,0 @@
1
- "use strict";const g=require("./clsx-CXbNJWDD.cjs"),_e=require("@tiptap/pm/state"),D=require("./index-neeeY2o7.cjs"),A=require("react/jsx-runtime"),W=require("./index-BynXHtjJ.cjs"),F=require("react");require("./theme.cjs");const Z=require("./popover-BdLwAlrM.cjs"),v=require("./index-DgOXAdKt.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,Ie(t))}};function Ie(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Be(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,X=s[I];X==null||X!=$&&s[I+1]==1?(s[I]=$,s[I+1]=1):X==$&&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&&$e(i,s,t),i}function Be(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 $e(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=We(c)))[a]=d)}i&&t.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:i})}}function We(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 Fe(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 q(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)||Pe(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Pe(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 je(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 Oe(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 Ge(this.$anchorCell.pos,this.$headCell.pos)}};C.prototype.visible=!1;g.Selection.jsonID("cell",C);var Ge=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 Ve(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 Ke({$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 qe({$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 Xe(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&&Ke(o)?r=g.TextSelection.create(l,o.from):o instanceof g.TextSelection&&qe(o)&&(r=g.TextSelection.create(l,o.$from.start(),o.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}const Ze=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=Ue(t,l,r,n))};return e?e.doc!=t.doc&&Te(e.doc,t.doc,0,o):t.doc.descendants(o),n}function Ue(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(Ze,{fixTables:!0})}function N(t){const e=t.selection,n=q(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;Oe(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 Je(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.left))}return!0}function Ye(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.right))}return!0}function Qe(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 et(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;Qe(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 tt(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;tt(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 nt(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.top))}return!0}function ot(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.bottom))}return!0}function lt(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 rt(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;lt(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 st({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(st(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 it(({node:o})=>n[o.type.spec.tableRole])(t,e)}function it(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=Fe(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 ct(t,e){return function(n,o){if(!E(n))return!1;const l=q(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 at(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?at(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 dt=B("cell",{useDeprecatedLogic:!0});function ut(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=ut(q(e),t);if(o==null)return!1;if(n){const l=e.doc.resolve(o);n(e.tr.setSelection(g.TextSelection.between(l,je(l))).scrollIntoView())}return!0}}function ft(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 P(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 ht(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 pt(s,i)}function pt(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 mt({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 gt(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}gt(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 bt=D.keydownHandler({ArrowLeft:j("horiz",-1),ArrowRight:j("horiz",1),ArrowUp:j("vert",-1),ArrowDown:j("vert",1),"Shift-ArrowLeft":O("horiz",-1),"Shift-ArrowRight":O("horiz",1),"Shift-ArrowUp":O("vert",-1),"Shift-ArrowDown":O("vert",1),Backspace:P,"Mod-Backspace":P,Delete:P,"Mod-Delete":P});function V(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function j(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;if(r instanceof C)return V(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 V(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),V(n,o,a)}}}function O(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?V(n,o,new C(s.$anchorCell,i)):!1}}function wt(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 Ct(t,e,n){if(!E(t.state))return!1;let o=ht(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=mt(o,i.right-i.left,i.bottom-i.top),ue(t.state,t.dispatch,s,i,o),!0}else if(o){const r=q(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 yt(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 St=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 xt({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=St,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 At(-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)=>{Tt(s,i,t,l)},mouseleave:s=>{Rt(s)},mousedown:(s,i)=>{vt(s,i,e,n)}},decorations:s=>{const i=T.getState(s);if(i&&i.activeHandle>-1)return Lt(s,i.activeHandle)},nodeViews:{}}});return r}var At=class K{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 K(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new K(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 K(l,n.dragging)}return n}};function Tt(t,e,n,o){if(!t.editable)return;const l=T.getState(t.state);if(l&&!l.dragging){const r=Et(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 Rt(t){if(!t.editable)return;const e=T.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ne(t,-1)}function vt(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=Mt(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&&(Nt(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 Mt(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 Et(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 Nt(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():kt(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 kt(t){return Array(t).fill(0)}function Lt(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 zt({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:Ve,handleDOMEvents:{mousedown:yt},createSelectionBetween(e){return z.getState(e.state)!=null?e.state.selection:null},handleTripleClick:wt,handleKeyDown:bt,handlePaste:Ct},appendTransaction(e,n,o){return Xe(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 Dt=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 Ht(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 _t(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 It(t,e,n,o,l){const r=_t(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 Bt(t){return t instanceof C}var G=({editor:t})=>{const{selection:e}=t.state;if(!Bt(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},$t="";function Wt(t){return(t||"").replace(/\s+/g," ").trim()}function Ft(t,e,n={}){var o;const l=(o=n.cellLineSeparator)!=null?o:$t;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=Wt(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 Pt=Ft,De=g.Node3.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Dt,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}=Ht(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)=>Pt(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:l,editor:r})=>{const s=It(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})=>Je(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Ye(t,e),deleteColumn:()=>({state:t,dispatch:e})=>et(t,e),addRowBefore:()=>({state:t,dispatch:e})=>nt(t,e),addRowAfter:()=>({state:t,dispatch:e})=>ot(t,e),deleteRow:()=>({state:t,dispatch:e})=>rt(t,e),deleteTable:()=>({state:t,dispatch:e})=>ft(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})=>dt(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>re(t,e)?!0:se(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>ct(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:G,"Mod-Backspace":G,Delete:G,"Mod-Delete":G}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[xt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],zt({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 jt(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 Ot(t,e,n){const{doc:o,selection:l}=t;return!o||!l||!(l instanceof C)||l.forEachCell((r,s)=>{t=jt(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=Ot(n,e,t),n.docChanged?(l==null||l(n),!0):!1}}const Gt=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)}}}),Vt=/(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,Kt=/CrOS/,qt=/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:!!(Vt.test(e)&&!Kt.test(e)||t.tablet&&qt.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 Xt(t){var f;const[e,n]=F.useState(!1),[o,l]=F.useState(!0),[r,s]=F.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]=F.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(Z.Popover,{modal:!0,onOpenChange:n,open:e,children:[A.jsx(Z.PopoverTrigger,{asChild:!0,"data-state":t!=null&&t.dataState?"on":"off",children:t==null?void 0:t.children}),A.jsx(Z.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 Zt(){const t=W.useEditorInstance(),e=W.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}=W.useToggleActive(r);if(!e)return A.jsx(A.Fragment,{});function a(d){t.chain().focus().insertTable({...d,withHeaderRow:!1}).run()}return A.jsx(Xt,{createTable:a,dataState:i,children:A.jsx(W.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:{},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),Gt.configure(this.options.tableCellBackground)]}});exports.CellSelection=C;exports.RichTextTable=Zt;exports.Table=He;
@@ -1 +0,0 @@
1
- "use strict";const S=require("./clsx-CXbNJWDD.cjs"),t=require("react/jsx-runtime"),h=require("react"),z=require("./index-BynXHtjJ.cjs");require("./theme.cjs");const we=require("./popover-BdLwAlrM.cjs"),qt=require("./index-DgOXAdKt.cjs"),$t="_verified_lvyh0_1",We={verified:$t},Dt=()=>t.jsx("svg",{viewBox:"0 0 24 24","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsx("g",{children:t.jsx("path",{d:"M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.33 2.19c-1.4-.46-2.91-.2-3.92.81s-1.26 2.52-.8 3.91c-1.31.67-2.2 1.91-2.2 3.34s.89 2.67 2.2 3.34c-.46 1.39-.21 2.9.8 3.91s2.52 1.26 3.91.81c.67 1.31 1.91 2.19 3.34 2.19s2.68-.88 3.34-2.19c1.39.45 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z"})})}),At=()=>t.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsxs("g",{children:[t.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-a",x1:"4.411",x2:"18.083",y1:"2.495",y2:"21.508",children:[t.jsx("stop",{offset:"0",stopColor:"#f4e72a"}),t.jsx("stop",{offset:".539",stopColor:"#cd8105"}),t.jsx("stop",{offset:".68",stopColor:"#cb7b00"}),t.jsx("stop",{offset:"1",stopColor:"#f4ec26"}),t.jsx("stop",{offset:"1",stopColor:"#f4e72a"})]}),t.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"0-b",x1:"5.355",x2:"16.361",y1:"3.395",y2:"19.133",children:[t.jsx("stop",{offset:"0",stopColor:"#f9e87f"}),t.jsx("stop",{offset:".406",stopColor:"#e2b719"}),t.jsx("stop",{offset:".989",stopColor:"#e2b719"})]}),t.jsxs("g",{clipRule:"evenodd",fillRule:"evenodd",children:[t.jsx("path",{d:"M13.324 3.848L11 1.6 8.676 3.848l-3.201-.453-.559 3.184L2.06 8.095 3.48 11l-1.42 2.904 2.856 1.516.559 3.184 3.201-.452L11 20.4l2.324-2.248 3.201.452.559-3.184 2.856-1.516L18.52 11l1.42-2.905-2.856-1.516-.559-3.184zm-7.09 7.575l3.428 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fill:"url(#0-a)"}),t.jsx("path",{d:"M13.101 4.533L11 2.5 8.899 4.533l-2.895-.41-.505 2.88-2.583 1.37L4.2 11l-1.284 2.627 2.583 1.37.505 2.88 2.895-.41L11 19.5l2.101-2.033 2.895.41.505-2.88 2.583-1.37L17.8 11l1.284-2.627-2.583-1.37-.505-2.88zm-6.868 6.89l3.429 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fill:"url(#0-b)"}),t.jsx("path",{d:"M6.233 11.423l3.429 3.428 5.65-6.17.038-.033-.005 1.398-5.683 6.206-3.429-3.429-.003-1.405.005.003z",fill:"#d18800"})]})]})}),Mt=()=>t.jsx("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img",className:We.verified,children:t.jsx("g",{children:t.jsx("path",{clipRule:"evenodd",d:"M12.05 2.056c-.568-.608-1.532-.608-2.1 0l-1.393 1.49c-.284.303-.685.47-1.1.455L5.42 3.932c-.832-.028-1.514.654-1.486 1.486l.069 2.039c.014.415-.152.816-.456 1.1l-1.49 1.392c-.608.568-.608 1.533 0 2.101l1.49 1.393c.304.284.47.684.456 1.1l-.07 2.038c-.027.832.655 1.514 1.487 1.486l2.038-.069c.415-.014.816.152 1.1.455l1.392 1.49c.569.609 1.533.609 2.102 0l1.393-1.49c.283-.303.684-.47 1.099-.455l2.038.069c.832.028 1.515-.654 1.486-1.486L18 14.542c-.015-.415.152-.815.455-1.099l1.49-1.393c.608-.568.608-1.533 0-2.101l-1.49-1.393c-.303-.283-.47-.684-.455-1.1l.068-2.038c.029-.832-.654-1.514-1.486-1.486l-2.038.07c-.415.013-.816-.153-1.1-.456zm-5.817 9.367l3.429 3.428 5.683-6.206-1.347-1.247-4.4 4.795-2.072-2.072z",fillRule:"evenodd"})})}),Vt="_root_98iqw_1",Wt="_article_98iqw_21",et={root:Vt,article:Wt},Be=({className:e,children:n})=>t.jsx("div",{className:S.clsx("react-tweet-theme",et.root,e),children:t.jsx("article",{className:et.article,children:n})}),ht=e=>t.jsx("img",{...e}),Bt="_verifiedOld_lcna5_1",Ft="_verifiedBlue_lcna5_4",Pt="_verifiedGovernment_lcna5_7",ye={verifiedOld:Bt,verifiedBlue:Ft,verifiedGovernment:Pt},_t=({user:e,className:n})=>{const r=e.verified||e.is_blue_verified||e.verified_type;let s=t.jsx(Dt,{}),o=ye.verifiedBlue;if(r)switch(e.is_blue_verified||(o=ye.verifiedOld),e.verified_type){case"Government":s=t.jsx(Mt,{}),o=ye.verifiedGovernment;break;case"Business":s=t.jsx(At,{}),o=null;break}return r?t.jsx("div",{className:S.clsx(n,o),children:s}):null},Ut="_label_36ucz_1",zt={label:Ut},mt=({user:e,className:n})=>{var r;const s=e.highlighted_label;if(!s)return null;const o=(r=s.badge)==null?void 0:r.url;return o?t.jsx("div",{className:S.clsx(zt.label,n),children:t.jsx("img",{src:o,alt:s.description})}):null},Ht="_header_nqq4j_1",Gt="_avatar_nqq4j_11",Xt="_avatarOverflow_nqq4j_16",Kt="_avatarSquare_nqq4j_23",Qt="_avatarShadow_nqq4j_26",Jt="_author_nqq4j_37",Yt="_authorLink_nqq4j_44",Zt="_authorVerified_nqq4j_53",en="_authorLinkText_nqq4j_56",tn="_authorMeta_nqq4j_63",nn="_authorFollow_nqq4j_66",rn="_username_nqq4j_69",sn="_follow_nqq4j_74",on="_separator_nqq4j_82",an="_brand_nqq4j_86",cn="_twitterIcon_nqq4j_90",T={header:Ht,avatar:Gt,avatarOverflow:Xt,avatarSquare:Kt,avatarShadow:Qt,author:Jt,authorLink:Yt,authorVerified:Zt,authorLinkText:en,authorMeta:tn,authorFollow:nn,username:rn,follow:sn,separator:on,brand:an,twitterIcon:cn},ln=({tweet:e,components:n})=>{var r;const s=(r=n==null?void 0:n.AvatarImg)!=null?r:ht,{user:o}=e;return t.jsxs("div",{className:T.header,children:[t.jsxs("a",{href:e.url,className:T.avatar,target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:S.clsx(T.avatarOverflow,o.profile_image_shape==="Square"&&T.avatarSquare),children:t.jsx(s,{src:o.profile_image_url_https,alt:o.name,width:48,height:48})}),t.jsx("div",{className:T.avatarOverflow,children:t.jsx("div",{className:T.avatarShadow})})]}),t.jsxs("div",{className:T.author,children:[t.jsxs("a",{href:e.url,className:T.authorLink,target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:T.authorLinkText,children:t.jsx("span",{title:o.name,children:o.name})}),t.jsx(_t,{user:o,className:T.authorVerified}),t.jsx(mt,{user:o})]}),t.jsxs("div",{className:T.authorMeta,children:[t.jsx("a",{href:e.url,className:T.username,target:"_blank",rel:"noopener noreferrer",children:t.jsxs("span",{title:`@${o.screen_name}`,children:["@",o.screen_name]})}),t.jsxs("div",{className:T.authorFollow,children:[t.jsx("span",{className:T.separator,children:"·"}),t.jsx("a",{href:o.follow_url,className:T.follow,target:"_blank",rel:"noopener noreferrer",children:"Follow"})]})]})]}),t.jsx("a",{href:e.url,className:T.brand,target:"_blank",rel:"noopener noreferrer","aria-label":"View on Twitter",children:t.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:T.twitterIcon,children:t.jsx("g",{children:t.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})})})]})},dn="_root_1ec15_1",un={root:dn},fn=({tweet:e})=>t.jsxs("a",{href:e.in_reply_to_url,className:un.root,target:"_blank",rel:"noopener noreferrer",children:["Replying to @",e.in_reply_to_screen_name]}),hn="_root_eihfa_1",_n={root:hn},pt=({href:e,children:n})=>t.jsx("a",{href:e,className:_n.root,target:"_blank",rel:"noopener noreferrer nofollow",children:n}),mn="_root_1xq52_1",pn={root:mn},xn=({tweet:e})=>t.jsxs("p",{className:pn.root,lang:e.lang,dir:"auto",children:[e.entities.map((n,r)=>{switch(n.type){case"hashtag":case"mention":case"url":case"symbol":return t.jsx(pt,{href:n.href,children:n.text},r);case"media":return;default:return t.jsx("span",{dangerouslySetInnerHTML:{__html:n.text}},r)}}),e.note_tweet?t.jsx(vn,{tweet:e}):null]});function vn({tweet:e}){return t.jsxs(pt,{href:e.url,children:[t.jsx("span",{children:" "}),"Show more"]})}const gn={hour:"numeric",minute:"2-digit",hour12:!0,weekday:"short",month:"short",day:"numeric",year:"numeric"},jn=new Intl.DateTimeFormat("en-US",gn),wn=e=>{const n={};for(const r of e)n[r.type]=r.value;return n},yn=e=>{const n=wn(jn.formatToParts(e)),r=`${n.hour}:${n.minute} ${n.dayPeriod}`,s=`${n.month} ${n.day}, ${n.year}`;return`${r} · ${s}`},tt=e=>`https://x.com/${e.user.screen_name}/status/${e.id_str}`,xt=e=>`https://x.com/${typeof e=="string"?e:e.user.screen_name}`,bn=e=>`https://x.com/intent/like?tweet_id=${e.id_str}`,Tn=e=>`https://x.com/intent/tweet?in_reply_to=${e.id_str}`,Nn=e=>`https://x.com/intent/follow?screen_name=${e.user.screen_name}`,Rn=e=>`https://x.com/hashtag/${e.text}`,Sn=e=>`https://x.com/search?q=%24${e.text}`,In=e=>`https://x.com/${e.in_reply_to_screen_name}/status/${e.in_reply_to_status_id_str}`,vt=(e,n)=>{const r=new URL(e.media_url_https),s=r.pathname.split(".").pop();return s?(r.pathname=r.pathname.replace(`.${s}`,""),r.searchParams.set("format",s),r.searchParams.set("name",n),r.toString()):e.media_url_https},kn=e=>{const{variants:n}=e.video_info;return n.filter(s=>s.content_type==="video/mp4").sort((s,o)=>{var a,i;return((a=o.bitrate)!=null?a:0)-((i=s.bitrate)!=null?i:0)})},En=e=>{const n=kn(e);return n.length>1?n[1]:n[0]},Ce=e=>e>999999?`${(e/1e6).toFixed(1)}M`:e>999?`${(e/1e3).toFixed(1)}K`:e.toString();function nt(e){const n=Array.from(e.text),r=[{indices:e.display_text_range,type:"text"}];return le(r,"hashtag",e.entities.hashtags),le(r,"mention",e.entities.user_mentions),le(r,"url",e.entities.urls),le(r,"symbol",e.entities.symbols),e.entities.media&&le(r,"media",e.entities.media),Cn(e,r),r.map(s=>{const o=n.slice(s.indices[0],s.indices[1]).join("");switch(s.type){case"hashtag":return Object.assign(s,{href:Rn(s),text:o});case"mention":return Object.assign(s,{href:xt(s.screen_name),text:o});case"url":case"media":return Object.assign(s,{href:s.expanded_url,text:s.display_url});case"symbol":return Object.assign(s,{href:Sn(s),text:o});default:return Object.assign(s,{text:o})}})}function le(e,n,r){for(const s of r)for(const[o,a]of e.entries()){if(a.indices[0]>s.indices[0]||a.indices[1]<s.indices[1])continue;const i=[{...s,type:n}];a.indices[0]<s.indices[0]&&i.unshift({indices:[a.indices[0],s.indices[0]],type:"text"}),a.indices[1]>s.indices[1]&&i.push({indices:[s.indices[1],a.indices[1]],type:"text"}),e.splice(o,1,...i);break}}function Cn(e,n){e.entities.media&&e.entities.media[0].indices[0]<e.display_text_range[1]&&(e.display_text_range[1]=e.entities.media[0].indices[0]);const r=n.at(-1);r&&r.indices[1]>e.display_text_range[1]&&(r.indices[1]=e.display_text_range[1])}const On=e=>({...e,url:tt(e),user:{...e.user,url:xt(e),follow_url:Nn(e)},like_url:bn(e),reply_url:Tn(e),in_reply_to_url:e.in_reply_to_screen_name?In(e):void 0,entities:nt(e),quoted_tweet:e.quoted_tweet?{...e.quoted_tweet,url:tt(e.quoted_tweet),entities:nt(e.quoted_tweet)}:void 0}),Ln="_root_g9tkv_1",qn="_rounded_g9tkv_6",$n="_mediaWrapper_g9tkv_10",Dn="_grid2Columns_g9tkv_17",An="_grid3_g9tkv_20",Mn="_grid2x2_g9tkv_23",Vn="_mediaContainer_g9tkv_26",Wn="_mediaLink_g9tkv_34",Bn="_skeleton_g9tkv_38",Fn="_image_g9tkv_43",C={root:Ln,rounded:qn,mediaWrapper:$n,grid2Columns:Dn,grid3:An,grid2x2:Mn,mediaContainer:Vn,mediaLink:Wn,skeleton:Bn,image:Fn},Pn="_anchor_fp31d_1",Un="_videoButton_fp31d_17",zn="_videoButtonIcon_fp31d_35",Hn="_watchOnTwitter_fp31d_44",Gn="_viewReplies_fp31d_60",oe={anchor:Pn,videoButton:Un,videoButtonIcon:zn,watchOnTwitter:Hn,viewReplies:Gn},Xn=({tweet:e,media:n})=>{const[r,s]=h.useState(!0),[o,a]=h.useState(!1),[i,c]=h.useState(!1),f=En(n);let d=0;return t.jsxs(t.Fragment,{children:[t.jsx("video",{className:C.image,poster:vt(n,"small"),controls:!r,playsInline:!0,preload:"none",tabIndex:r?-1:0,onPlay:()=>{d&&window.clearTimeout(d),o||a(!0),i&&c(!1)},onPause:()=>{d&&window.clearTimeout(d),d=window.setTimeout(()=>{o&&a(!1),d=0},100)},onEnded:()=>{c(!0)},children:t.jsx("source",{src:f.url,type:f.content_type})}),r&&t.jsx("button",{type:"button",className:oe.videoButton,"aria-label":"View video on X",onClick:v=>{const m=v.currentTarget.previousSibling;v.preventDefault(),s(!1),m.load(),m.play().then(()=>{a(!0),m.focus()}).catch(w=>{console.error("Error playing video:",w),s(!0),a(!1)})},children:t.jsx("svg",{viewBox:"0 0 24 24",className:oe.videoButtonIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M21 12L4 2v20l17-10z"})})})}),!o&&!i&&t.jsx("div",{className:oe.watchOnTwitter,children:t.jsx("a",{href:e.url,className:oe.anchor,target:"_blank",rel:"noopener noreferrer",children:r?"Watch on X":"Continue watching on X"})}),i&&t.jsx("a",{href:e.url,className:S.clsx(oe.anchor,oe.viewReplies),target:"_blank",rel:"noopener noreferrer",children:"View replies"})]})},Kn=e=>t.jsx("img",{...e}),rt=(e,n)=>{let r=56.25;return n===1&&(r=100/e.original_info.width*e.original_info.height),n===2&&(r=r*2),{width:e.type==="photo"?void 0:"unset",paddingBottom:`${r}%`}},gt=({tweet:e,components:n,quoted:r})=>{var s,o,a;const i=(a=(s=e.mediaDetails)==null?void 0:s.length)!=null?a:0;var c;const f=(c=n==null?void 0:n.MediaImg)!=null?c:Kn;return t.jsx("div",{className:S.clsx(C.root,!r&&C.rounded),children:t.jsx("div",{className:S.clsx(C.mediaWrapper,i>1&&C.grid2Columns,i===3&&C.grid3,i>4&&C.grid2x2),children:(o=e.mediaDetails)==null?void 0:o.map(d=>t.jsx(h.Fragment,{children:d.type==="photo"?t.jsxs("a",{href:e.url,className:S.clsx(C.mediaContainer,C.mediaLink),target:"_blank",rel:"noopener noreferrer",children:[t.jsx("div",{className:C.skeleton,style:rt(d,i)}),t.jsx(f,{src:vt(d,"small"),alt:d.ext_alt_text||"Image",className:C.image,draggable:!0})]},d.media_url_https):t.jsxs("div",{className:C.mediaContainer,children:[t.jsx("div",{className:C.skeleton,style:rt(d,i)}),t.jsx(Xn,{tweet:e,media:d})]},d.media_url_https)},d.media_url_https))})})},Qn="_root_i24yn_1",Jn={root:Qn},Yn=({tweet:e})=>{const n=new Date(e.created_at),r=yn(n);return t.jsx("a",{className:Jn.root,href:e.url,target:"_blank",rel:"noopener noreferrer","aria-label":r,children:t.jsx("time",{dateTime:n.toISOString(),children:r})})},Zn="_info_19qcj_1",er="_infoLink_19qcj_10",tr="_infoIcon_19qcj_30",be={info:Zn,infoLink:er,infoIcon:tr},nr=({tweet:e})=>t.jsxs("div",{className:be.info,children:[t.jsx(Yn,{tweet:e}),t.jsx("a",{className:be.infoLink,href:"https://help.x.com/en/x-for-websites-ads-info-and-privacy",target:"_blank",rel:"noopener noreferrer","aria-label":"Twitter for Websites, Ads Information and Privacy",children:t.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",className:be.infoIcon,children:t.jsx("g",{children:t.jsx("path",{d:"M13.5 8.5c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5S11.17 7 12 7s1.5.67 1.5 1.5zM13 17v-5h-2v5h2zm-1 5.25c5.66 0 10.25-4.59 10.25-10.25S17.66 1.75 12 1.75 1.75 6.34 1.75 12 6.34 22.25 12 22.25zM20.25 12c0 4.56-3.69 8.25-8.25 8.25S3.75 16.56 3.75 12 7.44 3.75 12 3.75s8.25 3.69 8.25 8.25z"})})})})]}),rr="_actions_n2anf_1",sr="_like_n2anf_13",or="_reply_n2anf_14",ir="_copy_n2anf_15",ar="_likeIconWrapper_n2anf_27",cr="_likeCount_n2anf_30",lr="_replyIconWrapper_n2anf_35",dr="_copyIconWrapper_n2anf_36",ur="_likeIcon_n2anf_27",fr="_replyIcon_n2anf_35",hr="_copyIcon_n2anf_36",_r="_replyText_n2anf_56",mr="_copyText_n2anf_57",k={actions:rr,like:sr,reply:or,copy:ir,likeIconWrapper:ar,likeCount:cr,replyIconWrapper:lr,copyIconWrapper:dr,likeIcon:ur,replyIcon:fr,copyIcon:hr,replyText:_r,copyText:mr},pr=({tweet:e})=>{const[n,r]=h.useState(!1),s=()=>{navigator.clipboard.writeText(e.url),r(!0)};return h.useEffect(()=>{if(n){const o=setTimeout(()=>{r(!1)},6e3);return()=>clearTimeout(o)}},[n]),t.jsxs("button",{type:"button",className:k.copy,"aria-label":"Copy link",onClick:s,children:[t.jsx("div",{className:k.copyIconWrapper,children:n?t.jsx("svg",{viewBox:"0 0 24 24",className:k.copyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M9.64 18.952l-5.55-4.861 1.317-1.504 3.951 3.459 8.459-10.948L19.4 6.32 9.64 18.952z"})})}):t.jsx("svg",{viewBox:"0 0 24 24",className:k.copyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M18.36 5.64c-1.95-1.96-5.11-1.96-7.07 0L9.88 7.05 8.46 5.64l1.42-1.42c2.73-2.73 7.16-2.73 9.9 0 2.73 2.74 2.73 7.17 0 9.9l-1.42 1.42-1.41-1.42 1.41-1.41c1.96-1.96 1.96-5.12 0-7.07zm-2.12 3.53l-7.07 7.07-1.41-1.41 7.07-7.07 1.41 1.41zm-12.02.71l1.42-1.42 1.41 1.42-1.41 1.41c-1.96 1.96-1.96 5.12 0 7.07 1.95 1.96 5.11 1.96 7.07 0l1.41-1.41 1.42 1.41-1.42 1.42c-2.73 2.73-7.16 2.73-9.9 0-2.73-2.74-2.73-7.17 0-9.9z"})})})}),t.jsx("span",{className:k.copyText,children:n?"Copied!":"Copy link"})]})},xr=({tweet:e})=>{const n=Ce(e.favorite_count);return t.jsxs("div",{className:k.actions,children:[t.jsxs("a",{className:k.like,href:e.like_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Like. This Tweet has ${n} likes`,children:[t.jsx("div",{className:k.likeIconWrapper,children:t.jsx("svg",{viewBox:"0 0 24 24",className:k.likeIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})})})}),t.jsx("span",{className:k.likeCount,children:n})]}),t.jsxs("a",{className:k.reply,href:e.reply_url,target:"_blank",rel:"noopener noreferrer","aria-label":"Reply to this Tweet on Twitter",children:[t.jsx("div",{className:k.replyIconWrapper,children:t.jsx("svg",{viewBox:"0 0 24 24",className:k.replyIcon,"aria-hidden":"true",children:t.jsx("g",{children:t.jsx("path",{d:"M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01z"})})})}),t.jsx("span",{className:k.replyText,children:"Reply"})]}),t.jsx(pr,{tweet:e})]})},vr="_replies_1cutb_1",gr="_link_1cutb_4",jr="_text_1cutb_23",Te={replies:vr,link:gr,text:jr},wr=({tweet:e})=>t.jsx("div",{className:Te.replies,children:t.jsx("a",{className:Te.link,href:e.url,target:"_blank",rel:"noopener noreferrer",children:t.jsx("span",{className:Te.text,children:e.conversation_count===0?"Read more on X":e.conversation_count===1?`Read ${Ce(e.conversation_count)} reply`:`Read ${Ce(e.conversation_count)} replies`})})}),yr="_root_q5799_1",br="_article_q5799_16",st={root:yr,article:br},Tr=({tweet:e,children:n})=>t.jsx("div",{className:st.root,onClick:r=>{r.preventDefault(),window.open(e.url,"_blank")},children:t.jsx("article",{className:st.article,children:n})}),Nr="_header_f00ab_1",Rr="_avatar_f00ab_11",Sr="_avatarOverflow_f00ab_16",Ir="_avatarSquare_f00ab_23",kr="_author_f00ab_27",Er="_authorText_f00ab_33",Cr="_username_f00ab_40",Q={header:Nr,avatar:Rr,avatarOverflow:Sr,avatarSquare:Ir,author:kr,authorText:Er,username:Cr},Or=({tweet:e,components:n})=>{const{user:r}=e;var s;const o=(s=n==null?void 0:n.AvatarImg)!=null?s:ht;return t.jsxs("div",{className:Q.header,children:[t.jsx("a",{href:e.url,className:Q.avatar,target:"_blank",rel:"noopener noreferrer",children:t.jsx("div",{className:S.clsx(Q.avatarOverflow,r.profile_image_shape==="Square"&&Q.avatarSquare),children:t.jsx(o,{src:r.profile_image_url_https,alt:r.name,width:20,height:20})})}),t.jsxs("div",{className:Q.author,children:[t.jsx("div",{className:Q.authorText,children:t.jsx("span",{title:r.name,children:r.name})}),t.jsx(_t,{user:r}),t.jsx(mt,{user:r}),t.jsx("div",{className:Q.username,children:t.jsxs("span",{title:`@${r.screen_name}`,children:["@",r.screen_name]})})]})]})},Lr="_root_175ot_1",qr={root:Lr},$r=({tweet:e})=>t.jsx("p",{className:qr.root,lang:e.lang,dir:"auto",children:e.entities.map((n,r)=>t.jsx("span",{dangerouslySetInnerHTML:{__html:n.text}},r))}),Dr=({tweet:e,components:n})=>{var r;return t.jsxs(Tr,{tweet:e,children:[t.jsx(Or,{tweet:e,components:n}),t.jsx($r,{tweet:e}),(r=e.mediaDetails)!=null&&r.length?t.jsx(gt,{quoted:!0,tweet:e}):null]})},Ar=({tweet:e,components:n})=>{var r;const s=h.useMemo(()=>On(e),[e]);return t.jsxs(Be,{children:[t.jsx(ln,{tweet:s,components:n}),s.in_reply_to_status_id_str&&t.jsx(fn,{tweet:s}),t.jsx(xn,{tweet:s}),(r=s.mediaDetails)!=null&&r.length?t.jsx(gt,{tweet:s,components:n}):null,s.quoted_tweet&&t.jsx(Dr,{tweet:s.quoted_tweet,components:n}),t.jsx(nr,{tweet:s}),t.jsx(xr,{tweet:s}),t.jsx(wr,{tweet:s})]})},Mr="_root_16yxa_1",Vr={root:Mr},Wr=e=>t.jsx(Be,{children:t.jsxs("div",{className:Vr.root,children:[t.jsx("h3",{children:"Tweet not found"}),t.jsx("p",{children:"The embedded tweet could not be found…"})]})}),Br="_skeleton_oi7hr_1",Fr={skeleton:Br},me=({style:e})=>t.jsx("span",{className:Fr.skeleton,style:e}),Pr="_root_17qqv_1",Ur={root:Pr},zr=()=>t.jsxs(Be,{className:Ur.root,children:[t.jsx(me,{style:{height:"3rem",marginBottom:"0.75rem"}}),t.jsx(me,{style:{height:"6rem",margin:"0.5rem 0"}}),t.jsx("div",{style:{borderTop:"var(--tweet-border)",margin:"0.5rem 0"}}),t.jsx(me,{style:{height:"2rem"}}),t.jsx(me,{style:{height:"2rem",borderRadius:"9999px",marginTop:"0.5rem"}})]}),jt=0,wt=1,yt=2,ot=3;var it=Object.prototype.hasOwnProperty;function Oe(e,n){var r,s;if(e===n)return!0;if(e&&n&&(r=e.constructor)===n.constructor){if(r===Date)return e.getTime()===n.getTime();if(r===RegExp)return e.toString()===n.toString();if(r===Array){if((s=e.length)===n.length)for(;s--&&Oe(e[s],n[s]););return s===-1}if(!r||typeof e=="object"){s=0;for(r in e)if(it.call(e,r)&&++s&&!it.call(n,r)||!(r in n)||!Oe(e[r],n[r]))return!1;return Object.keys(n).length===s}}return e!==e&&n!==n}const P=new WeakMap,U=()=>{},R=U(),Le=Object,u=e=>e===R,W=e=>typeof e=="function",H=(e,n)=>({...e,...n}),bt=e=>W(e.then),Ne={},pe={},Fe="undefined",de=typeof window!=Fe,qe=typeof document!=Fe,Hr=de&&"Deno"in window,Gr=()=>de&&typeof window.requestAnimationFrame!=Fe,Tt=(e,n)=>{const r=P.get(e);return[()=>!u(n)&&e.get(n)||Ne,s=>{if(!u(n)){const o=e.get(n);n in pe||(pe[n]=o),r[5](n,H(o,s),o||Ne)}},r[6],()=>!u(n)&&n in pe?pe[n]:!u(n)&&e.get(n)||Ne]};let $e=!0;const Xr=()=>$e,[De,Ae]=de&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[U,U],Kr=()=>{const e=qe&&document.visibilityState;return u(e)||e!=="hidden"},Qr=e=>(qe&&document.addEventListener("visibilitychange",e),De("focus",e),()=>{qe&&document.removeEventListener("visibilitychange",e),Ae("focus",e)}),Jr=e=>{const n=()=>{$e=!0,e()},r=()=>{$e=!1};return De("online",n),De("offline",r),()=>{Ae("online",n),Ae("offline",r)}},Yr={isOnline:Xr,isVisible:Kr},Zr={initFocus:Qr,initReconnect:Jr},at=!h.useId,ie=!de||Hr,es=e=>Gr()?window.requestAnimationFrame(e):setTimeout(e,1),Re=ie?h.useEffect:h.useLayoutEffect,Se=typeof navigator<"u"&&navigator.connection,ct=!ie&&Se&&(["slow-2g","2g"].includes(Se.effectiveType)||Se.saveData),xe=new WeakMap,ts=e=>Le.prototype.toString.call(e),Ie=(e,n)=>e===`[object ${n}]`;let ns=0;const Me=e=>{const n=typeof e,r=ts(e),s=Ie(r,"Date"),o=Ie(r,"RegExp"),a=Ie(r,"Object");let i,c;if(Le(e)===e&&!s&&!o){if(i=xe.get(e),i)return i;if(i=++ns+"~",xe.set(e,i),Array.isArray(e)){for(i="@",c=0;c<e.length;c++)i+=Me(e[c])+",";xe.set(e,i)}if(a){i="#";const f=Le.keys(e).sort();for(;!u(c=f.pop());)u(e[c])||(i+=c+":"+Me(e[c])+",");xe.set(e,i)}}else i=s?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return i},Pe=e=>{if(W(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Me(e):"",[e,n]};let rs=0;const Ve=()=>++rs;async function Nt(...e){const[n,r,s,o]=e,a=H({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let i=a.populateCache;const c=a.rollbackOnError;let f=a.optimisticData;const d=w=>typeof c=="function"?c(w):c!==!1,v=a.throwOnError;if(W(r)){const w=r,N=[],E=n.keys();for(const L of E)!/^\$(inf|sub)\$/.test(L)&&w(n.get(L)._k)&&N.push(L);return Promise.all(N.map(m))}return m(r);async function m(w){const[N]=Pe(w);if(!N)return;const[E,L]=Tt(n,N),[D,ae,l,ue]=P.get(n),J=()=>{const q=D[N];return(W(a.revalidate)?a.revalidate(E().data,w):a.revalidate!==!1)&&(delete l[N],delete ue[N],q&&q[0])?q[0](yt).then(()=>E().data):E().data};if(e.length<3)return J();let y=s,A,M=!1;const Y=Ve();ae[N]=[Y,0];const p=!u(f),Z=E(),V=Z.data,ee=Z._c,G=u(ee)?V:ee;if(p&&(f=W(f)?f(G,V):f,L({data:f,_c:G})),W(y))try{y=y(G)}catch(q){A=q,M=!0}if(y&&bt(y))if(y=await y.catch(q=>{A=q,M=!0}),Y!==ae[N][0]){if(M)throw A;return y}else M&&p&&d(A)&&(i=!0,L({data:G,_c:R}));if(i&&!M)if(W(i)){const q=i(y,G);L({data:q,error:R,_c:R})}else L({data:y,error:R,_c:R});if(ae[N][1]=Ve(),Promise.resolve(J()).then(()=>{L({_c:R})}),M){if(v)throw A;return}return y}}const lt=(e,n)=>{for(const r in e)e[r][0]&&e[r][0](n)},ss=(e,n)=>{if(!P.has(e)){const r=H(Zr,n),s=Object.create(null),o=Nt.bind(R,e);let a=U;const i=Object.create(null),c=(v,m)=>{const w=i[v]||[];return i[v]=w,w.push(m),()=>w.splice(w.indexOf(m),1)},f=(v,m,w)=>{e.set(v,m);const N=i[v];if(N)for(const E of N)E(m,w)},d=()=>{if(!P.has(e)&&(P.set(e,[s,Object.create(null),Object.create(null),Object.create(null),o,f,c]),!ie)){const v=r.initFocus(setTimeout.bind(R,lt.bind(R,s,jt))),m=r.initReconnect(setTimeout.bind(R,lt.bind(R,s,wt)));a=()=>{v&&v(),m&&m(),P.delete(e)}}};return d(),[e,o,d,a]}return[e,P.get(e)[4]]},os=(e,n,r,s,o)=>{const a=r.errorRetryCount,i=o.retryCount,c=~~((Math.random()+.5)*(1<<(i<8?i:8)))*r.errorRetryInterval;!u(a)&&i>a||setTimeout(s,c,o)},is=Oe,[Rt,as]=ss(new Map),cs=H({onLoadingSlow:U,onSuccess:U,onError:U,onErrorRetry:os,onDiscarded:U,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:ct?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:ct?5e3:3e3,compare:is,isPaused:()=>!1,cache:Rt,mutate:as,fallback:{}},Yr),ls=(e,n)=>{const r=H(e,n);if(n){const{use:s,fallback:o}=e,{use:a,fallback:i}=n;s&&a&&(r.use=s.concat(a)),o&&i&&(r.fallback=H(o,i))}return r},ds=h.createContext({}),us="$inf$",St=de&&window.__SWR_DEVTOOLS_USE__,fs=St?window.__SWR_DEVTOOLS_USE__:[],hs=()=>{St&&(window.__SWR_DEVTOOLS_REACT__=h)},_s=e=>W(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],ms=()=>{const e=h.useContext(ds);return h.useMemo(()=>H(cs,e),[e])},ps=e=>(n,r,s)=>e(n,r&&((...a)=>{const[i]=Pe(n),[,,,c]=P.get(Rt);if(i.startsWith(us))return r(...a);const f=c[i];return u(f)?r(...a):(delete c[i],f)}),s),xs=fs.concat(ps),vs=e=>function(...r){const s=ms(),[o,a,i]=_s(r),c=ls(s,i);let f=e;const{use:d}=c,v=(d||[]).concat(xs);for(let m=v.length;m--;)f=v[m](f);return f(o,a||c.fetcher||null,c)},gs=(e,n,r)=>{const s=n[e]||(n[e]=[]);return s.push(r),()=>{const o=s.indexOf(r);o>=0&&(s[o]=s[s.length-1],s.pop())}};hs();const ke=h.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Ee={dedupe:!0},dt=Promise.resolve(R),js=(e,n,r)=>{const{cache:s,compare:o,suspense:a,fallbackData:i,revalidateOnMount:c,revalidateIfStale:f,refreshInterval:d,refreshWhenHidden:v,refreshWhenOffline:m,keepPreviousData:w,strictServerPrefetchWarning:N}=r,[E,L,D,ae]=P.get(s),[l,ue]=Pe(e),J=h.useRef(!1),y=h.useRef(!1),A=h.useRef(l),M=h.useRef(n),Y=h.useRef(r),p=()=>Y.current,Z=()=>p().isVisible()&&p().isOnline(),[V,ee,G,q]=Tt(s,l),te=h.useRef({}).current,fe=u(i)?u(r.fallback)?R:r.fallback[l]:i,ze=(_,x)=>{for(const j in te){const g=j;if(g==="data"){if(!o(_[g],x[g])&&(!u(_[g])||!o(_e,x[g])))return!1}else if(x[g]!==_[g])return!1}return!0},He=h.useMemo(()=>{const _=!l||!n?!1:u(c)?p().isPaused()||a?!1:f!==!1:c,x=I=>{const B=H(I);return delete B._k,_?{isValidating:!0,isLoading:!0,...B}:B},j=V(),g=q(),$=x(j),se=j===g?$:x(g);let b=$;return[()=>{const I=x(V());return ze(I,b)?(b.data=I.data,b.isLoading=I.isLoading,b.isValidating=I.isValidating,b.error=I.error,b):(b=I,I)},()=>se]},[s,l]),ne=S.shimExports.useSyncExternalStore(h.useCallback(_=>G(l,(x,j)=>{ze(j,x)||_()}),[s,l]),He[0],He[1]),Ge=!J.current,kt=E[l]&&E[l].length>0,re=ne.data,X=u(re)?fe&&bt(fe)?ke(fe):fe:re,he=ne.error,ve=h.useRef(X),_e=w?u(re)?u(ve.current)?X:ve.current:re:X,K=l&&u(X),Et=!ie&&S.shimExports.useSyncExternalStore(()=>U,()=>!1,()=>!0);N&&Et&&!a&&K&&console.warn(`Missing pre-initiated data for serialized key "${l}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Xe=kt&&!u(he)?!1:Ge&&!u(c)?c:p().isPaused()?!1:a?u(X)?!1:f:u(X)||f,Ke=!!(l&&n&&Ge&&Xe),Ct=u(ne.isValidating)?Ke:ne.isValidating,Ot=u(ne.isLoading)?Ke:ne.isLoading,ce=h.useCallback(async _=>{const x=M.current;if(!l||!x||y.current||p().isPaused())return!1;let j,g,$=!0;const se=_||{},b=!D[l]||!se.dedupe,I=()=>at?!y.current&&l===A.current&&J.current:l===A.current,B={isValidating:!1,isLoading:!1},Je=()=>{ee(B)},Ye=()=>{const O=D[l];O&&O[1]===g&&delete D[l]},Ze={isValidating:!0};u(V().data)&&(Ze.isLoading=!0);try{if(b&&(ee(Ze),r.loadingTimeout&&u(V().data)&&setTimeout(()=>{$&&I()&&p().onLoadingSlow(l,r)},r.loadingTimeout),D[l]=[x(ue),Ve()]),[j,g]=D[l],j=await j,b&&setTimeout(Ye,r.dedupingInterval),!D[l]||D[l][1]!==g)return b&&I()&&p().onDiscarded(l),!1;B.error=R;const O=L[l];if(!u(O)&&(g<=O[0]||g<=O[1]||O[1]===0))return Je(),b&&I()&&p().onDiscarded(l),!1;const F=V().data;B.data=o(F,j)?F:j,b&&I()&&p().onSuccess(j,l,r)}catch(O){Ye();const F=p(),{shouldRetryOnError:ge}=F;F.isPaused()||(B.error=O,b&&I()&&(F.onError(O,l,F),(ge===!0||W(ge)&&ge(O))&&(!p().revalidateOnFocus||!p().revalidateOnReconnect||Z())&&F.onErrorRetry(O,l,F,Lt=>{const je=E[l];je&&je[0]&&je[0](ot,Lt)},{retryCount:(se.retryCount||0)+1,dedupe:!0})))}return $=!1,Je(),!0},[l,s]),Qe=h.useCallback((..._)=>Nt(s,A.current,..._),[]);if(Re(()=>{M.current=n,Y.current=r,u(re)||(ve.current=re)}),Re(()=>{if(!l)return;const _=ce.bind(R,Ee);let x=0;p().revalidateOnFocus&&(x=Date.now()+p().focusThrottleInterval);const g=gs(l,E,($,se={})=>{if($==jt){const b=Date.now();p().revalidateOnFocus&&b>x&&Z()&&(x=b+p().focusThrottleInterval,_())}else if($==wt)p().revalidateOnReconnect&&Z()&&_();else{if($==yt)return ce();if($==ot)return ce(se)}});return y.current=!1,A.current=l,J.current=!0,ee({_k:ue}),Xe&&(D[l]||(u(X)||ie?_():es(_))),()=>{y.current=!0,g()}},[l]),Re(()=>{let _;function x(){const g=W(d)?d(V().data):d;g&&_!==-1&&(_=setTimeout(j,g))}function j(){!V().error&&(v||p().isVisible())&&(m||p().isOnline())?ce(Ee).then(x):x()}return x(),()=>{_&&(clearTimeout(_),_=-1)}},[d,v,m,l]),h.useDebugValue(_e),a){if(!at&&ie&&K)throw new Error("Fallback data is required when using Suspense in SSR.");K&&(M.current=n,Y.current=r,y.current=!1);const _=ae[l],x=!u(_)&&K?Qe(_):dt;if(ke(x),!u(he)&&K)throw he;const j=K?ce(Ee):dt;!u(_e)&&K&&(j.status="fulfilled",j.value=!0),ke(j)}return{mutate:Qe,get data(){return te.data=!0,_e},get error(){return te.error=!0,he},get isValidating(){return te.isValidating=!0,Ct},get isLoading(){return te.isLoading=!0,Ot}}},ut=vs(js);class ws extends Error{constructor({message:n,status:r,data:s}){super(n),this.name="TwitterApiError",this.status=r,this.data=s}}const ys=ut.default||ut,bs="https://react-tweet.vercel.app";async function Ts([e,n]){const r=await fetch(e,n),s=await r.json();if(r.ok)return s.data||null;throw new ws({message:`Failed to fetch tweet at "${e}" with "${r.status}".`,data:s,status:r.status})}const Ns=(e,n,r)=>{const{isLoading:s,data:o,error:a}=ys(()=>n||e?[n||e&&`${bs}/api/tweet/${e}`,r]:null,Ts,{revalidateIfStale:!1,revalidateOnFocus:!1,shouldRetryOnError:!1});return{isLoading:!!(s||o===void 0&&!a),data:o,error:a}},Rs=({id:e,apiUrl:n,fallback:r=t.jsx(zr,{}),components:s,fetchOptions:o,onError:a})=>{const{data:i,error:c,isLoading:f}=Ns(e,n,o);if(f)return r;if(c||!i){const d=(s==null?void 0:s.TweetNotFound)||Wr;return t.jsx(d,{error:a?a(c):c})}return t.jsx(Ar,{tweet:i,components:s})};function Ss({node:e}){var s;const n=((s=e==null?void 0:e.attrs)==null?void 0:s.src)||"",r=n==null?void 0:n.split("/").pop();return r?t.jsx(S.NodeViewWrapper,{children:t.jsx("div",{"data-twitter":"",children:t.jsx(Rs,{id:r})})}):null}function It(e){const{t:n}=qt.useLocale(),[r,s]=h.useState("");h.useEffect(()=>{var a;if(e!=null&&e.editor){const{src:i}=(a=e.editor)==null?void 0:a.getAttributes(Ue.name);i&&s(i)}},[e==null?void 0:e.editor]);function o(a){a.preventDefault(),a.stopPropagation(),e==null||e.onSetLink(r)}return t.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:o,children:[t.jsx(z.Label,{className:"mb-[6px]",children:n("editor.link.dialog.text")}),t.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:t.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:t.jsx(z.Input,{className:"richtext-w-80",onChange:a=>s(a.target.value),placeholder:"Text",required:!0,type:"text",value:r})})}),t.jsx(z.Button,{className:"richtext-mt-2 richtext-self-end",type:"submit",children:n("editor.link.dialog.button.apply")})]})}function Is(){const[e,n]=h.useState(!1),r=z.useEditorInstance(),s=z.useButtonProps(Ue.name),{icon:o=void 0,tooltip:a=void 0,tooltipOptions:i={},action:c=void 0,isActive:f=void 0}=(s==null?void 0:s.componentProps)??{},{editorDisabled:d}=z.useToggleActive(f);function v(m){d||c&&(c(m),n(!1))}return t.jsxs(we.Popover,{modal:!0,onOpenChange:n,open:e,children:[t.jsx(we.PopoverTrigger,{asChild:!0,children:t.jsx(z.ActionButton,{disabled:d,isActive:f,tooltip:a,tooltipOptions:i,children:t.jsx(z.IconComponent,{name:o})})}),t.jsx(we.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:t.jsx(It,{editor:r,onSetLink:v})})]})}const ks=/(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g,Es=/^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;function ft(e){return e.match(Es)}const Ue=S.Node3.create({name:"twitter",draggable:!0,selectable:!0,addOptions(){return{addPasteHandler:!0,HTMLAttributes:{},inline:!1,origin:"",button:({editor:e,t:n})=>({componentProps:{action:r=>{e.commands.setTweet({src:r})},isActive:()=>!1,disabled:!1,icon:"Twitter",tooltip:n("editor.twitter.tooltip"),editor:e}})}},addNodeView(){return S.ReactNodeViewRenderer(Ss,{attrs:this.options.HTMLAttributes})},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{src:{default:null}}},parseHTML(){return[{tag:"div[data-twitter]"}]},addCommands(){return{setTweet:e=>({commands:n})=>ft(e.src)?n.insertContent({type:this.name,attrs:e}):!1,updateTweet:e=>({commands:n})=>ft(e.src)?n.updateAttributes(this.name,{src:e.src}):!1}},addPasteRules(){return this.options.addPasteHandler?[S.nodePasteRule({find:ks,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML({HTMLAttributes:e}){return["div",S.mergeAttributes({"data-twitter":""},e)]}});exports.FormEditLinkTwitter=It;exports.RichTextTwitter=Is;exports.Twitter=Ue;
@@ -1,28 +0,0 @@
1
- "use strict";const i=require("react/jsx-runtime"),b=require("react"),mt=require("@radix-ui/react-slot"),Ye=require("./index-NsYff_Ni.cjs");require("./theme.cjs");const P=require("./clsx-CXbNJWDD.cjs"),rr=require("@radix-ui/react-label"),ir=require("@radix-ui/react-tabs"),nr=require("@radix-ui/react-tooltip"),or=require("@radix-ui/react-select"),u=require("lucide-react"),sr=require("@radix-ui/react-checkbox"),ar=require("@radix-ui/react-dialog"),lr=require("react-image-crop"),W=require("./index-DgOXAdKt.cjs"),Se=require("@radix-ui/react-icons"),cr=require("@radix-ui/react-toggle");function ne(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const _=ne(b),xt=ne(rr),de=ne(ir),je=ne(nr),D=ne(or),Ge=ne(sr),Y=ne(ar),gt=ne(cr),Ke="-",dr=e=>{const t=hr(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{const a=l.split(Ke);return a[0]===""&&a.length!==1&&a.shift(),pt(a,t)||ur(l)},getConflictingClassGroupIds:(l,a)=>{const c=r[l]||[];return a&&n[l]?[...c,...n[l]]:c}}},pt=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?pt(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Ke);return(l=t.validators.find(({validator:a})=>a(s)))==null?void 0:l.classGroupId},at=/^\[(.+)\]$/,ur=e=>{if(at.test(e)){const t=at.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},hr=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return mr(Object.entries(e.classGroups),r).forEach(([s,l])=>{Xe(l,n,s,t)}),n},Xe=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:lt(t,o);s.classGroupId=r;return}if(typeof o=="function"){if(fr(o)){Xe(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([s,l])=>{Xe(l,lt(t,s),r,n)})})},lt=(e,t)=>{let r=e;return t.split(Ke).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},fr=e=>e.isThemeGetter,mr=(e,t)=>t?e.map(([r,n])=>{const o=n.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([l,a])=>[t+l,a])):s);return[r,o]}):e,xr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const o=(s,l)=>{r.set(s,l),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let l=r.get(s);if(l!==void 0)return l;if((l=n.get(s))!==void 0)return o(s,l),l},set(s,l){r.has(s)?r.set(s,l):o(s,l)}}},bt="!",gr=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,o=t[0],s=t.length,l=a=>{const c=[];let d=0,m=0,p;for(let f=0;f<a.length;f++){let v=a[f];if(d===0){if(v===o&&(n||a.slice(f,f+s)===t)){c.push(a.slice(m,f)),m=f+s;continue}if(v==="/"){p=f;continue}}v==="["?d++:v==="]"&&d--}const h=c.length===0?a:a.substring(m),y=h.startsWith(bt),g=y?h.substring(1):h,k=p&&p>m?p-m:void 0;return{modifiers:c,hasImportantModifier:y,baseClassName:g,maybePostfixModifierPosition:k}};return r?a=>r({className:a,parseClassName:l}):l},pr=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},br=e=>({cache:xr(e.cacheSize),parseClassName:gr(e),...dr(e)}),vr=/\s+/,wr=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=t,s=[],l=e.trim().split(vr);let a="";for(let c=l.length-1;c>=0;c-=1){const d=l[c],{modifiers:m,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:y}=r(d);let g=!!y,k=n(g?h.substring(0,y):h);if(!k){if(!g){a=d+(a.length>0?" "+a:a);continue}if(k=n(h),!k){a=d+(a.length>0?" "+a:a);continue}g=!1}const f=pr(m).join(":"),v=p?f+bt:f,x=v+k;if(s.includes(x))continue;s.push(x);const M=o(k,g);for(let w=0;w<M.length;++w){const A=M[w];s.push(v+A)}a=d+(a.length>0?" "+a:a)}return a};function yr(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=vt(t))&&(n&&(n+=" "),n+=r);return n}const vt=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=vt(e[n]))&&(r&&(r+=" "),r+=t);return r};function jr(e,...t){let r,n,o,s=l;function l(c){const d=t.reduce((m,p)=>p(m),e());return r=br(d),n=r.cache.get,o=r.cache.set,s=a,a(c)}function a(c){const d=n(c);if(d)return d;const m=wr(c,r);return o(c,m),m}return function(){return s(yr.apply(null,arguments))}}const E=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},wt=/^\[(?:([a-z-]+):)?(.+)\]$/i,Cr=/^\d+\/\d+$/,kr=new Set(["px","full","screen"]),Sr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Tr=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Mr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Nr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ir=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,J=e=>fe(e)||kr.has(e)||Cr.test(e),te=e=>xe(e,"length",Dr),fe=e=>!!e&&!Number.isNaN(Number(e)),Oe=e=>xe(e,"number",fe),ge=e=>!!e&&Number.isInteger(Number(e)),Ar=e=>e.endsWith("%")&&fe(e.slice(0,-1)),S=e=>wt.test(e),re=e=>Sr.test(e),Lr=new Set(["length","size","percentage"]),zr=e=>xe(e,Lr,yt),Er=e=>xe(e,"position",yt),Rr=new Set(["image","url"]),_r=e=>xe(e,Rr,Pr),Vr=e=>xe(e,"",Hr),pe=()=>!0,xe=(e,t,r)=>{const n=wt.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},Dr=e=>Tr.test(e)&&!Mr.test(e),yt=()=>!1,Hr=e=>Nr.test(e),Pr=e=>Ir.test(e),Or=()=>{const e=E("colors"),t=E("spacing"),r=E("blur"),n=E("brightness"),o=E("borderColor"),s=E("borderRadius"),l=E("borderSpacing"),a=E("borderWidth"),c=E("contrast"),d=E("grayscale"),m=E("hueRotate"),p=E("invert"),h=E("gap"),y=E("gradientColorStops"),g=E("gradientColorStopPositions"),k=E("inset"),f=E("margin"),v=E("opacity"),x=E("padding"),M=E("saturate"),w=E("scale"),A=E("sepia"),C=E("skew"),z=E("space"),V=E("translate"),O=()=>["auto","contain","none"],B=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",S,t],N=()=>[S,t],j=()=>["",J,te],T=()=>["auto",fe,S],R=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",S],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[fe,S];return{cacheSize:500,separator:":",theme:{colors:[pe],spacing:[J,te],blur:["none","",re,S],brightness:q(),borderColor:[e],borderRadius:["none","","full",re,S],borderSpacing:N(),borderWidth:j(),contrast:q(),grayscale:$(),hueRotate:q(),invert:$(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[Ar,te],inset:F(),margin:F(),opacity:q(),padding:N(),saturate:q(),scale:q(),sepia:$(),skew:q(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",S]}],container:["container"],columns:[{columns:[re]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...R(),S]}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ge,S]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",S]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",ge,S]}],"grid-cols":[{"grid-cols":[pe]}],"col-start-end":[{col:["auto",{span:["full",ge,S]},S]}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":[pe]}],"row-start-end":[{row:["auto",{span:[ge,S]},S]}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",S]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",S]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...I()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...I(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...I(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[f]}],mx:[{mx:[f]}],my:[{my:[f]}],ms:[{ms:[f]}],me:[{me:[f]}],mt:[{mt:[f]}],mr:[{mr:[f]}],mb:[{mb:[f]}],ml:[{ml:[f]}],"space-x":[{"space-x":[z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",S,t]}],"min-w":[{"min-w":[S,t,"min","max","fit"]}],"max-w":[{"max-w":[S,t,"none","full","min","max","fit","prose",{screen:[re]},re]}],h:[{h:[S,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[S,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[S,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[S,t,"auto","min","max","fit"]}],"font-size":[{text:["base",re,te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Oe]}],"font-family":[{font:[pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",S]}],"line-clamp":[{"line-clamp":["none",fe,Oe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",J,S]}],"list-image":[{"list-image":["none",S]}],"list-style-type":[{list:["none","disc","decimal",S]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",J,te]}],"underline-offset":[{"underline-offset":["auto",J,S]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",S]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",S]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...R(),Er]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",zr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},_r]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:H()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[J,S]}],"outline-w":[{outline:[J,te]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[J,te]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",re,Vr]}],"shadow-color":[{shadow:[pe]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",re,S]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[M]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[M]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",S]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",S]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",S]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[ge,S]}],"translate-x":[{"translate-x":[V]}],"translate-y":[{"translate-y":[V]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",S]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",S]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",S]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[J,te,Oe]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Br=jr(Or);function L(...e){return Br(P.clsx(e))}let Be;function Ue(){return Be===void 0&&(Be=navigator.platform.includes("Mac")),Be}function jt(e){return`${e}`.toLowerCase()==="mod"?Ue()?"⌘":"Ctrl":`${e}`.toLowerCase()==="alt"?Ue()?"⌥":"Alt":`${e}`.toLowerCase()==="shift"?Ue()?"⇧":"Shift":e}function Ct(e){return e.map(jt).join(" ")}const ce=b.forwardRef((e,t)=>{const{icon:r=void 0,tooltip:n=void 0,disabled:o=!1,customClass:s="",loading:l=void 0,shortcutKeys:a=void 0,tooltipOptions:c={},action:d=void 0,isActive:m=void 0,children:p,asChild:h=!1,upload:y=!1,initialDisplayedColor:g=void 0,dataState:k=!1,...f}=e,v=Je[r],x=h?mt.Slot:Qe,M=w=>{if(o){w.preventDefault();return}d==null||d(w)};return i.jsxs(Nt,{children:[i.jsx(It,{asChild:!0,children:i.jsxs(x,{className:L("richtext-h-[32px] richtext-w-[32px]",s),"data-state":k?"on":"off",disabled:o,onClick:M,ref:t,size:"sm",...f,children:[v&&i.jsx(v,{className:"richtext-size-4"}),p]})}),n&&i.jsx(et,{...c,className:"richtext-tooltip",children:i.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[i.jsx("div",{children:n}),!!(a!=null&&a.length)&&i.jsx("span",{children:Ct(a)})]})})]})});function Ur(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H3V5h18z"})})}function Fr(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 15h15m0 4H6m9-8h6m0-4h-6M9 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2M3 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2"})})}function $r(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"richtext-h-4 richtext-w-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5.5 3c1.404 0 2.107 0 2.611.38c.219.164.406.375.552.62C9 4.568 9 5.358 9 6.938v10.125c0 1.58 0 2.37-.337 2.937a2.1 2.1 0 0 1-.552.621c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C2 19.432 2 18.642 2 17.062V6.938c0-1.58 0-2.37.337-2.938a2.1 2.1 0 0 1 .552-.62C3.393 3 4.096 3 5.5 3M20 11.938v5.124c0 1.58 0 2.37-.337 2.938a2.1 2.1 0 0 1-.552.62c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C13 19.433 13 18.642 13 17.063V6.938c0-1.58 0-2.37.337-2.938M22 9l-6-6m6 0l-6 6",color:"currentColor"})})}function Wr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"richtext-h-4 richtext-w-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M21 18.5c0 1.404 0 2.107-.38 2.611a2.1 2.1 0 0 1-.62.552c-.567.337-1.358.337-2.937.337H6.938c-1.58 0-2.37 0-2.938-.337a2.1 2.1 0 0 1-.62-.552C3 20.607 3 19.904 3 18.5s0-2.107.38-2.611c.163-.218.374-.406.62-.552C4.567 15 5.357 15 6.938 15h10.125c1.58 0 2.37 0 2.937.337c.246.146.457.334.62.552c.38.504.38 1.207.38 2.611M12.063 4H6.937C5.358 4 4.568 4 4 4.337a2.1 2.1 0 0 0-.62.552C3 5.393 3 6.096 3 7.5s0 2.107.38 2.611c.163.218.374.406.62.552C4.567 11 5.357 11 6.938 11h10.125c1.58 0 2.37 0 2.937-.337M21 8l-6-6m6 0l-6 6",color:"currentColor"})})}function Gr(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}function Me(e){const t=Je[e.name];return t?i.jsx(t,{onClick:e==null?void 0:e.onClick,className:`richtext-h-4 richtext-w-4 ${(e==null?void 0:e.className)||""}`}):null}function Xr(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M21 22H3v-2h18zm0-18H3V2h18zm-11 9.7h4l-2-5.4zM11.2 6h1.7l4.7 12h-2l-.9-2.6H9.4L8.5 18h-2z"})})}function kt(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 48 48",...e,children:i.jsx("path",{fill:"currentColor",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:4,d:"M36 19L24 31L12 19z"})})}function qr(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M9 7v10h6v-2h-4V7z"})})}function Zr(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M9 7c-1.1 0-2 .9-2 2v8h2V9h2v7h2V9h2v8h2V9a2 2 0 0 0-2-2z"})})}function Yr(e){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M11 7c-1.1 0-2 .9-2 2v2a2 2 0 0 0 2 2h2v2H9v2h4c1.11 0 2-.89 2-2v-2a2 2 0 0 0-2-2h-2V9h4V7z"})})}function Kr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"currentColor",d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6l1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6l-1.4-1.4z"})})}function Jr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M14 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m-9 8h4m-2-2v4"})})}function Qr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m9 8h4m-2-2v4"})})}function ei(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 21v-4m0-4V9m0-4V3m-2 18h4M8 5v4h11l2-2l-2-2zm6 8v4H6l-2-2l2-2z"})})}function ti(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"currentColor",d:"M23.943 19.806a.2.2 0 0 0-.168-.034c-1.26-1.855-2.873-3.61-4.419-5.315l-.252-.284c-.001-.073-.067-.12-.134-.15l-.084-.084c-.05-.1-.169-.167-.286-.1c-.47.234-.907.585-1.327.919c-.554.434-1.109.87-1.63 1.354a5 5 0 0 0-.588.618c-.084.117-.017.217.084.267c-.37.368-.74.736-1.109 1.12a.2.2 0 0 0-.05.134c0 .05.033.1.067.117l.655.502v.016c.924.92 2.554 2.173 4.285 3.527c.251.201.52.402.773.602c.117.134.234.285.335.418c.05.066.169.084.236.033c.033.034.084.067.118.1a.24.24 0 0 0 .1.034a.15.15 0 0 0 .135-.066a.24.24 0 0 0 .033-.1c.017 0 .017.016.034.016a.2.2 0 0 0 .134-.05l3.058-3.327c.12-.116.014-.267 0-.267m-7.628-.134l-1.546-1.17l-.15-.1c-.035-.017-.068-.05-.102-.067l-.117-.1c.66-.66 1.33-1.308 2-1.956c-.488.484-1.463 1.906-1.261 2.373c.002 0 .018.042.067.084zm4.1 3.126l-1.277-.97a27 27 0 0 0-1.58-1.504c.69.518 1.277.97 1.361 1.053c.673.585.638.485 1.093.87l.554.4c-.074.103-.151.148-.151.151m.336.25l-.034-.016a1 1 0 0 0 .152-.117zM.588 3.476c.033.217.084.435.117.636c.201 1.103.403 2.106.772 2.858l.152.568c.05.217.134.485.219.552a67 67 0 0 0 3.578 2.942a.18.18 0 0 0 .219 0s0 .016.016.016a.15.15 0 0 0 .118.05a.2.2 0 0 0 .134-.05c1.798-1.989 3.142-3.627 4.1-4.998c.068-.066.084-.167.084-.25c.067-.067.118-.151.185-.201c.067-.067.067-.184 0-.235l-.017-.016c0-.033-.017-.084-.05-.1c-.42-.401-.722-.685-1.042-.986a94 94 0 0 1-2.352-2.273c-.017-.017-.034-.034-.067-.034c-.336-.117-1.025-.234-1.882-.385c-1.277-.216-3.008-.517-4.57-.986c0 0-.101 0-.118.017l-.05.05C.05.714.022.707 0 .718c.017.1.017.167.05.284c0 .033.068.301.068.334zm7.19 4.78l-.033.034a.036.036 0 0 1 .033-.034M6.553 2.238c.101.1.521.502.622.585c-.437-.2-1.529-.702-2.034-.869c.505.1 1.194.201 1.412.284M.79 1.403c.252.434.454 1.939.655 3.41c-.118-.469-.201-.936-.302-1.372C.992 2.673.84 1.988.638 1.386c.124 0 .152.021.152.017m-.286-.369c0-.016 0-.033-.017-.033c.085 0 .135.017.202.05c0 .006-.145-.017-.185-.017m23.17-.217c.017-.066-.336-.367-.219-.384c.253-.017.253-.401 0-.401c-.335.017-.688.1-1.008.15c-.587.117-1.192.234-1.78.367a80 80 0 0 0-3.949.937c-.403.117-.857.2-1.243.401c-.135.067-.118.2-.05.284c-.034.017-.051.017-.085.034c-.117.017-.218.034-.335.05c-.102.017-.152.1-.135.2c0 .017.017.05.017.067c-.706.936-1.496 1.923-2.353 2.976c-.84.969-1.73 1.989-2.62 3.042c-2.84 3.31-6.05 7.07-9.594 10.38a.16.16 0 0 0 0 .234c.016.016.033.033.05.033c-.05.05-.101.085-.152.134q-.05.05-.05.1a.4.4 0 0 0-.067.084c-.067.067-.067.184.017.234c.067.066.185.066.235-.017c.017-.017.017-.033.033-.033a.265.265 0 0 1 .37 0c.202.217.404.435.588.618l-.42-.35c-.067-.067-.184-.05-.234.016c-.068.066-.051.184.016.234l4.469 3.727c.034.034.067.034.118.034a.15.15 0 0 0 .117-.05l.101-.1c.017.016.05.016.067.016c.05 0 .084-.016.118-.05c6.049-6.05 10.922-10.614 16.5-14.693c.05-.033.067-.1.067-.15c.067 0 .118-.05.15-.117c1.026-3.125 1.228-5.9 1.295-7.27c0-.059.016-.038.016-.068c.017-.033.017-.05.017-.05a.98.98 0 0 0-.067-.619m-10.82 4.915c.268-.301.537-.619.806-.903c-1.73 2.273-4.603 5.767-8.67 9.929c2.773-3.059 5.562-6.218 7.864-9.026M5.14 23.466c-.016-.017-.016-.017 0-.017zm2.504-2.156c.135-.15.27-.284.42-.434c0 0 0 .016.017.016c-.224.198-.433.418-.437.418m.69-.668c.099-.1.14-.173.284-.318c.992-1.02 2.017-2.04 3.059-3.076l.016-.016c.252-.2.555-.418.824-.619a228 228 0 0 0-4.184 4.029M14.852 3.91c-.554.719-1.176 1.671-1.697 2.423c-1.646 2.374-6.94 8.174-7.057 8.274a1190 1190 0 0 1-4.839 4.597l-.1.1c-.085-.1-.085-.25.016-.334C8.652 11.966 13.19 6.133 15.021 3.576c-.05.116-.084.216-.168.334zm2.906 3.427c-.671-.386-.99-.987-.806-1.572l.05-.2a.8.8 0 0 1 .085-.167a1.9 1.9 0 0 1 .756-.703c.016 0 .033 0 .05-.016c-.017-.034-.017-.084-.017-.134c.017-.1.085-.167.202-.167c.202 0 .824.184 1.059.384c.067.05.134.117.202.184c.084.1.218.268.285.401c.034.017.067.184.118.268c.033.134.067.284.05.418c-.017.016 0 .116-.017.116a1.6 1.6 0 0 1-.218.619c-.03.03.006.012-.05.067a1.2 1.2 0 0 1-.32.334a1.49 1.49 0 0 1-1.26.234a2 2 0 0 0-.169-.066m4.37 1.403c0 .017-.017.05 0 .067c-.034 0-.05.017-.085.034a110 110 0 0 0-3.915 3.025c1.11-.986 2.218-1.989 3.378-2.975c.336-.301.571-.686.638-1.12l.168-1.003v-.033c.085-.201.404-.118.353.1c-.004-.001-.173.795-.537 1.905"})})}function St(){return i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 32 32",children:[i.jsx("path",{fill:"currentColor",d:"M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"}),i.jsx("path",{fill:"currentColor",d:"M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"})]})}function Tt(){return i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",className:"icon",viewBox:"0 0 1024 1024",children:[i.jsx("path",{fill:"currentColor",d:"M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"}),i.jsx("path",{fill:"currentColor",d:"m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"})]})}function ri(){return i.jsx("svg",{height:"1em",viewBox:"0 0 15 15",width:"1em",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M2.5 10.5H2v.5h.5zm2 0v.5H5v-.5zm9-7h.5v-.207l-.146-.147zm-3-3l.354-.354L10.707 0H10.5zM2 6v4.5h1V6zm.5 5h2v-1h-2zm2.5-.5v-2H4v2zM3 7h2V6H3zM2 5V1.5H1V5zm11-1.5V5h1V3.5zM2.5 1h8V0h-8zm7.646-.146l3 3l.708-.708l-3-3zM2 1.5a.5.5 0 0 1 .5-.5V0A1.5 1.5 0 0 0 1 1.5zM1 12v1.5h1V12zm1.5 3h10v-1h-10zM14 13.5V12h-1v1.5zM12.5 15a1.5 1.5 0 0 0 1.5-1.5h-1a.5.5 0 0 1-.5.5zM1 13.5A1.5 1.5 0 0 0 2.5 15v-1a.5.5 0 0 1-.5-.5zM6 7h3V6H6zm0 4h3v-1H6zm1-4.5v4h1v-4zm3.5.5H13V6h-2.5zM10 6v5h1V6zm.5 3H12V8h-1.5z",fill:"currentColor"})})}function ii(){return i.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",children:i.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[i.jsx("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),i.jsx("path",{d:"M5 12V5a2 2 0 0 1 2-2h7l5 5v4M2 21v-6m3 0v6m-3-3h3m15-3v6h2m-9 0v-6l2 3l2-3v6m-9.5-6h3M9 15v6"})]})})}function ni(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:i.jsx("path",{fill:"currentColor",d:"M6.5 3a.75.75 0 0 1 .697.471l3 7.5a.75.75 0 0 1-1.393.557L7.992 9.5H5.008l-.811 2.028a.75.75 0 0 1-1.393-.556l3-7.5A.75.75 0 0 1 6.5 3m0 2.77L5.608 8h1.784zm8.28-1.55a.75.75 0 1 0-1.06 1.06l.72.72h-3.69a.75.75 0 0 0 0 1.5h3.69l-.72.72a.75.75 0 0 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06zm0 7.5a.75.75 0 1 0-1.06 1.06l.72.72H3.75a.75.75 0 0 0 0 1.5h10.69l-.72.72a.75.75 0 1 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06z"})})}function oi(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",children:i.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"4",children:[i.jsx("circle",{cx:"10",cy:"24",r:"4"}),i.jsx("circle",{cx:"38",cy:"10",r:"4"}),i.jsx("circle",{cx:"38",cy:"24",r:"4"}),i.jsx("circle",{cx:"38",cy:"38",r:"4"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M34 38H22V10h12M14 24h20"})]})})}function si(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:i.jsx("path",{fill:"currentColor",d:"M13.5 3a.75.75 0 0 0-.697.471l-3 7.5a.75.75 0 0 0 1.393.557l.812-2.028h2.984l.811 2.028a.75.75 0 0 0 1.393-.556l-3-7.5A.75.75 0 0 0 13.5 3m0 2.77L14.392 8h-1.784zM5.22 4.22a.75.75 0 0 1 1.06 1.06L5.56 6h3.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 0 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06zm0 7.5a.75.75 0 0 1 1.06 1.06l-.72.72h10.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06z"})})}function ai(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"m3 21l7.548-7.548M21 3l-7.548 7.548m0 0L8 3H3l7.548 10.452m2.904-2.904L21 21h-5l-5.452-7.548",color:"currentColor"})})}function li(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",children:i.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}function ci(e){return i.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",strokeWidth:3,stroke:"currentColor",fill:"none",...e,children:[i.jsx("circle",{cx:32,cy:"31.48",r:"25.29"}),i.jsx("path",{d:"M40.12,24.41a8.36,8.36,0,0,0-7.84-5.06c-7.07,0-7.33,5.06-7.33,5.06s-1.06,6.24,7.58,6.9c9,.69,7.59,6.9,7.59,6.9s-.92,5.4-7.59,5.75-8.73-6.67-8.73-6.67"}),i.jsx("line",{x1:"32.28",y1:"14.87",x2:"32.28",y2:"49.13"})]})}const Je={Bold:u.Bold,LoaderCircle:u.LoaderCircle,Italic:u.Italic,Underline:u.Underline,Quote:u.Quote,TextQuote:Fr,Strikethrough:u.Strikethrough,Minus:u.Minus,Eraser:u.Eraser,PaintRoller:u.PaintRoller,Redo2:u.Redo2,Undo2:u.Undo2,AlignCenter:Se.TextAlignCenterIcon,AlignJustify:Se.TextAlignJustifyIcon,AlignLeft:Se.TextAlignLeftIcon,AlignRight:Se.TextAlignRightIcon,ChevronDown:u.ChevronDown,Subscript:u.Subscript,Superscript:u.Superscript,Code:u.Code,Code2:u.CodeXml,Type:u.Type,IndentIncrease:u.IndentIncrease,IndentDecrease:u.IndentDecrease,List:u.List,ListOrdered:u.ListOrdered,ListTodo:u.ListTodo,Link:u.Link,ImageUp:u.ImageUp,Video:u.Video,Maximize:u.Maximize,Minimize:u.Minimize,Table:u.Table,Sparkles:u.Sparkles,Pencil:u.Pencil,Unlink:u.Unlink,BetweenHorizonalEnd:u.BetweenHorizonalEnd,BetweenHorizonalStart:u.BetweenHorizonalStart,BetweenVerticalStart:u.BetweenVerticalStart,BetweenVerticalEnd:u.BetweenVerticalEnd,TableCellsMerge:u.TableCellsMerge,TableCellsSplit:u.TableCellsSplit,Trash2:u.Trash2,Trash:u.Trash,Replace:u.Replace,ChevronsUpDown:u.ChevronsUpDown,LineHeight:Xr,Word:Gr,HeadingParagraph:u.Pilcrow,Heading1:u.Heading1,Heading2:u.Heading2,Heading3:u.Heading3,Heading4:u.Heading4,Heading5:u.Heading5,Heading6:u.Heading6,Columns2:u.Columns2,Columns3:u.Columns3,Columns4:u.Columns4,Plus:u.Plus,Grip:u.GripVertical,Copy:u.Copy,Clipboard:u.Clipboard,PanelLeft:u.PanelLeft,PanelRight:u.PanelRight,Columns:u.Columns2,Iframe:u.Frame,MenuDown:kt,SizeS:Yr,SizeM:Zr,SizeL:qr,AspectRatio:Ur,Emoji:u.SmilePlus,DeleteColumn:$r,DeleteRow:Wr,SearchAndReplace:u.Replace,EmojiIcon:u.SmilePlusIcon,KatexIcon:u.Sigma,ExportPdf:St,ExportWord:Tt,ImportWord:li,ColumnAddLeft:Jr,ColumnAddRight:Qr,BookMarked:u.BookMarked,Excalidraw:ti,ZoomIn:u.ZoomIn,ZoomOut:u.ZoomOut,Settings:u.Settings,Eye:u.Eye,TextDirection:ei,LeftToRight:ni,RightToLeft:si,Attachment:u.Paperclip,AttachmentDownload:u.Download,GifIcon:ri,ChevronUp:u.ChevronUp,Crop:u.CropIcon,Mermaid:oi,Twitter:ai,CodeView:Kr,FlipX:u.FlipVertical,FlipY:u.FlipHorizontal,PencilRuler:u.PencilRuler,WrapText:u.WrapText,Loader:u.Loader2,X:u.X,Html:ii,ExternalLink:u.ExternalLink,Callout:u.NotebookPen,PaywallIcon:ci},ct=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,dt=P.clsx,Ee=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return dt(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:o,defaultVariants:s}=t,l=Object.keys(o).map(d=>{const m=r==null?void 0:r[d],p=s==null?void 0:s[d];if(m===null)return null;const h=ct(m)||ct(p);return o[d][h]}),a=r&&Object.entries(r).reduce((d,m)=>{let[p,h]=m;return h===void 0||(d[p]=h),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,m)=>{let{class:p,className:h,...y}=m;return Object.entries(y).every(g=>{let[k,f]=g;return Array.isArray(f)?f.includes({...s,...a}[k]):{...s,...a}[k]===f})?[...d,p,h]:d},[]);return dt(e,l,c,r==null?void 0:r.class,r==null?void 0:r.className)},di=Ee("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-pointer-events-none disabled:richtext-opacity-50",{variants:{variant:{default:"!richtext-bg-primary !richtext-text-primary-foreground hover:!richtext-bg-primary/90",destructive:"richtext-bg-destructive richtext-text-destructive-foreground hover:richtext-bg-destructive/90",outline:"richtext-border richtext-border-input richtext-bg-background richtext-text-foreground hover:richtext-bg-accent hover:richtext-text-accent-foreground",secondary:"richtext-bg-secondary richtext-text-secondary-foreground hover:richtext-bg-secondary/80",ghost:"hover:richtext-bg-accent hover:richtext-text-accent-foreground",link:"richtext-text-primary richtext-underline-offset-4 hover:richtext-underline"},size:{default:"richtext-h-10 richtext-px-4 richtext-py-2",sm:"richtext-h-9 richtext-rounded-md richtext-px-3",lg:"richtext-h-11 richtext-rounded-md richtext-px-8",icon:"richtext-size-10"}},defaultVariants:{variant:"default",size:"default"}}),G=_.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},s)=>{const l=n?mt.Slot:"button";return i.jsx(l,{className:L(di({variant:t,size:r,className:e})),ref:s,...o})});G.displayName="Button";const ie=_.forwardRef(({className:e,type:t,...r},n)=>i.jsx("input",{ref:n,type:t,className:L("richtext-flex richtext-h-10 richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-transparent richtext-px-3 richtext-py-2 richtext-text-sm richtext-text-foreground richtext-ring-offset-background file:richtext-border-0 file:richtext-bg-transparent file:richtext-text-sm file:richtext-font-medium placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-1 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),...r}));ie.displayName="Input";const ui=Ee("richtext-text-sm richtext-font-medium richtext-leading-none richtext-text-foreground peer-disabled:richtext-cursor-not-allowed peer-disabled:richtext-opacity-70"),me=_.forwardRef(({className:e,...t},r)=>i.jsx(xt.Root,{className:L(ui(),e),ref:r,...t}));me.displayName=xt.Root.displayName;const Re=de.Root,Ce=_.forwardRef(({className:e,...t},r)=>i.jsx(de.List,{ref:r,className:L("richtext-inline-flex richtext-h-10 richtext-items-center richtext-justify-center richtext-rounded-md richtext-bg-muted richtext-p-1 richtext-text-muted-foreground",e),...t}));Ce.displayName=de.List.displayName;const Q=_.forwardRef(({className:e,...t},r)=>i.jsx(de.Trigger,{ref:r,className:L("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-sm richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-all focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=active]:richtext-bg-background data-[state=active]:richtext-text-foreground data-[state=active]:richtext-shadow-sm",e),...t}));Q.displayName=de.Trigger.displayName;const ee=_.forwardRef(({className:e,...t},r)=>i.jsx(de.Content,{ref:r,className:L("richtext-mt-2 richtext-ring-offset-background focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1",e),...t}));ee.displayName=de.Content.displayName;const Mt=_.forwardRef(({className:e,...t},r)=>i.jsx("textarea",{ref:r,className:L("richtext-flex richtext-min-h-[80px] richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-transparent richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),...t}));Mt.displayName="Textarea";const hi=Ee("richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",{variants:{variant:{default:"richtext-bg-transparent",outline:"richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"},size:{default:"richtext-h-10 richtext-px-3",sm:"richtext-h-9 richtext-px-2",lg:"richtext-h-11 richtext-px-5"}},defaultVariants:{variant:"default",size:"default"}}),Qe=_.forwardRef(({className:e,variant:t,size:r,...n},o)=>i.jsx(gt.Root,{ref:o,className:L(hi({variant:t,size:r,className:e})),...n}));Qe.displayName=gt.Root.displayName;const fi=je.Provider,Nt=je.Root,It=je.Trigger,et=_.forwardRef(({className:e,sideOffset:t=4,...r},n)=>i.jsx(je.Content,{"data-richtext-portal":!0,ref:n,sideOffset:t,className:L("richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border-none richtext-bg-primary richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-primary-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",e),...r}));et.displayName=je.Content.displayName;const mi=D.Root,xi=D.Value,At=_.forwardRef(({className:e,children:t,...r},n)=>i.jsxs(D.Trigger,{ref:n,className:L("richtext-flex richtext-h-10 richtext-w-full richtext-items-center richtext-justify-between richtext-rounded-md richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-text-foreground richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-1 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 [&>span]:richtext-line-clamp-1",e),...r,children:[t,i.jsx(D.Icon,{asChild:!0,children:i.jsx(u.ChevronDown,{className:"richtext-size-4 richtext-opacity-50"})})]}));At.displayName=D.Trigger.displayName;const Lt=_.forwardRef(({className:e,...t},r)=>i.jsx(D.ScrollUpButton,{ref:r,className:L("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...t,children:i.jsx(u.ChevronUp,{className:"richtext-size-4"})}));Lt.displayName=D.ScrollUpButton.displayName;const zt=_.forwardRef(({className:e,...t},r)=>i.jsx(D.ScrollDownButton,{ref:r,className:L("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...t,children:i.jsx(u.ChevronDown,{className:"richtext-size-4"})}));zt.displayName=D.ScrollDownButton.displayName;const Et=_.forwardRef(({className:e,children:t,position:r="popper",...n},o)=>i.jsx(D.Portal,{children:i.jsxs(D.Content,{"data-richtext-portal":!0,position:r,ref:o,className:L("richtext-relative richtext-z-50 richtext-max-h-60 richtext-min-w-[8rem] richtext-overflow-hidden richtext-overflow-y-auto richtext-rounded-md richtext-border !richtext-border-border richtext-bg-popover richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:richtext-translate-y-1 data-[side=left]:richtext--translate-x-1 data-[side=right]:richtext-translate-x-1 data-[side=top]:richtext--translate-y-1",e),...n,children:[i.jsx(Lt,{}),i.jsx(D.Viewport,{className:L("richtext-p-1",r==="popper"&&"richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]"),children:t}),i.jsx(zt,{})]})}));Et.displayName=D.Content.displayName;const gi=_.forwardRef(({className:e,...t},r)=>i.jsx(D.Label,{className:L("richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold",e),ref:r,...t}));gi.displayName=D.Label.displayName;const Rt=_.forwardRef(({className:e,children:t,...r},n)=>i.jsxs(D.Item,{ref:n,className:L("richtext-relative richtext-flex richtext-w-full richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),...r,children:[i.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center",children:i.jsx(D.ItemIndicator,{children:i.jsx(u.Check,{className:"richtext-size-4"})})}),i.jsx(D.ItemText,{children:t})]}));Rt.displayName=D.Item.displayName;const pi=_.forwardRef(({className:e,...t},r)=>i.jsx(D.Separator,{className:L("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),ref:r,...t}));pi.displayName=D.Separator.displayName;const bi=1,vi=1e6;let Fe=0;function wi(){return Fe=(Fe+1)%Number.MAX_SAFE_INTEGER,Fe.toString()}const $e=new Map;function ut(e){if($e.has(e))return;const t=setTimeout(()=>{$e.delete(e),ve({type:"REMOVE_TOAST",toastId:e})},vi);$e.set(e,t)}function yi(e,t){switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,bi)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?ut(r):e.toasts.forEach(n=>{ut(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}}const Ne=[];let Ie={toasts:[]};function ve(e){Ie=yi(Ie,e),Ne.forEach(t=>{t(Ie)})}function _t({...e}){const t=wi(),r=o=>ve({type:"UPDATE_TOAST",toast:{...o,id:t}}),n=()=>ve({type:"DISMISS_TOAST",toastId:t});return ve({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||n()}}}),{id:t,dismiss:n,update:r}}function _e(){const[e,t]=_.useState(Ie);return _.useEffect(()=>(Ne.push(t),()=>{const r=Ne.indexOf(t);r>-1&&Ne.splice(r,1)}),[e]),{...e,toast:_t,dismiss:r=>ve({type:"DISMISS_TOAST",toastId:r})}}const Ve=_.forwardRef(({className:e,...t},r)=>i.jsx(Ge.Root,{ref:r,className:L("!richtext-peer !richtext-h-4 !richtext-w-4 !richtext-shrink-0 !richtext-rounded-sm !richtext-border !richtext-border-primary !richtext-p-0 !richtext-ring-offset-background focus-visible:!richtext-outline-none focus-visible:!richtext-ring-2 focus-visible:!richtext-ring-ring focus-visible:!richtext-ring-offset-1 disabled:!richtext-cursor-not-allowed disabled:!richtext-opacity-50 data-[state=checked]:!richtext-bg-primary data-[state=checked]:!richtext-text-primary-foreground",e),...t,children:i.jsx(Ge.Indicator,{className:L("!richtext-flex !richtext-items-center !richtext-justify-center !richtext-p-0 !richtext-text-current"),children:i.jsx(u.Check,{className:"!richtext-h-4 !richtext-w-4"})})}));Ve.displayName=Ge.Root.displayName;function ji(e){return e=e||new Map,{all:e,on(t,r){const n=e.get(t);n?n.push(r):e.set(t,[r])},off(t,r){const n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit(t,r){let n=e.get(t);n&&n.slice().map(o=>{o(r)}),n=e.get("*"),n&&n.slice().map(o=>{o(t,r)})}}}const tt=ji(),Vt=b.createContext(tt),Ci=()=>b.useContext(Vt);function De(e,t){const r=Ci();b.useEffect(()=>(t.map(n=>r.on(n,e)),()=>{t.map(n=>r.off(n,e))}),[r,t,e])}const Dt=tt.emit;function ki({children:e}){return i.jsx(Vt.Provider,{value:tt,children:e})}const ue=Y.Root,He=Y.Trigger,Si=Y.Portal,Ht=_.forwardRef(({className:e,...t},r)=>i.jsx(Y.Overlay,{ref:r,className:L("richtext-fixed richtext-inset-0 richtext-z-50 richtext-bg-black/80 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0",e),...t}));Ht.displayName=Y.Overlay.displayName;const oe=_.forwardRef(({className:e,children:t,...r},n)=>i.jsxs(Si,{"data-richtext-portal":!0,children:[i.jsx(Ht,{}),i.jsxs(Y.Content,{"data-richtext-portal":!0,ref:n,className:L("richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border !richtext-border-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg",e),...r,children:[t,i.jsxs(Y.Close,{className:"richtext-absolute richtext-right-4 richtext-top-4 richtext-rounded-sm richtext-opacity-70 richtext-ring-offset-background richtext-transition-opacity hover:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-1 disabled:richtext-pointer-events-none data-[state=open]:richtext-bg-accent data-[state=open]:richtext-text-muted-foreground",children:[i.jsx(u.X,{className:"richtext-size-4 richtext-text-accent-foreground"}),i.jsx("span",{className:"richtext-sr-only richtext-text-accent-foreground",children:"Close"})]})]})]}));oe.displayName=Y.Content.displayName;function Pt({className:e,...t}){return i.jsx("div",{className:L("richtext-flex richtext-flex-col richtext-space-y-1.5 richtext-text-center sm:richtext-text-left",e),...t})}Pt.displayName="DialogHeader";function rt({className:e,...t}){return i.jsx("div",{className:L("richtext-flex richtext-flex-col-reverse sm:richtext-flex-row sm:richtext-justify-end sm:richtext-space-x-2",e),...t})}rt.displayName="DialogFooter";const se=_.forwardRef(({className:e,...t},r)=>i.jsx(Y.Title,{ref:r,className:L("richtext-text-lg richtext-font-semibold richtext-leading-none richtext-tracking-tight richtext-text-foreground",e),...t}));se.displayName=Y.Title.displayName;const Ti=_.forwardRef(({className:e,...t},r)=>i.jsx(Y.Description,{className:L("richtext-text-sm richtext-text-muted-foreground",e),ref:r,...t}));Ti.displayName=Y.Description.displayName;const Mi={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
2
- <path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
3
- <path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
4
- </svg>`,word:`<svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- width="1em"
7
- height="1em"
8
- className="icon"
9
- viewBox="0 0 1024 1024"
10
- >
11
- <path
12
- fill="currentColor"
13
- d="M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"
14
- />
15
- <path
16
- fill="currentColor"
17
- d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"
18
- />
19
- </svg>`,excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};function Ni(e){return e.replace(/^.*\/|\..+$/g,"")}function Ii(e){return e.split(".").pop()}function Ot(e){return e<1024?`${e} Byte`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function Ai(e){return e?e==="application/pdf"?"pdf":e.startsWith("application/")&&[".document","word"].some(t=>e.includes(t))?"word":e.startsWith("application/")&&["presentation"].some(t=>e.includes(t))?"excel":e.startsWith("application/")&&["sheet"].some(t=>e.includes(t))?"ppt":e.startsWith("image")?"image":e.startsWith("audio")?"audio":e.startsWith("video")?"video":"file":"file"}function Li(e){return new Promise(t=>{const r=new FileReader;r.addEventListener("load",()=>{t({alt:e.name,src:r.result})},!1),r.readAsDataURL(e)})}function Bt(e,t){const r=e.split(","),n=r[0].match(/:(.*?);/)[1],o=atob(r[r.length-1]);let s=o.length;const l=new Uint8Array(s);for(;s--;)l[s]=o.charCodeAt(s);return new File([l],t,{type:n})}function zi(e){const t=Mi[e],o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement,s=["svg",{...Array.from(o.attributes).reduce((l,a)=>(l[a.name]=a.value,l),{})}];return Array.from(o.childNodes).forEach(l=>{if(l.nodeType===1){const a=[l.tagName.toLowerCase(),Array.from(l.attributes).reduce((c,d)=>(c[d.name]=d.value,c),{})];l.textContent&&a.push(l.textContent),s.push(a)}}),s}const Ei={audio:i.jsx(u.LucideAudioLines,{}),video:i.jsx(u.LucideVideo,{}),file:i.jsx(u.LucideFile,{}),image:i.jsx(u.LucideImage,{}),pdf:i.jsx(St,{}),word:i.jsx(Tt,{}),excel:i.jsx(u.LucideSheet,{}),ppt:i.jsx(u.LucideTableProperties,{})};function Ut(e,t=!1){const r=Ai(e),n=Ei[r]||i.jsx(i.Fragment,{});return t?zi(r):n}const Ri="_card_1is0r_64",_i="_downloadBtn_1is0r_82",Vi="_cardLeft_1is0r_88",Di="_iconWrap_1is0r_97",Hi="_fileInfo_1is0r_116",Pi="_fileName_1is0r_123",Oi="_fileSize_1is0r_133",Bi="_cardPreview_1is0r_145",Ui="_actions_1is0r_221",Fi="_cardError_1is0r_236",$i="_errorText_1is0r_240",Z={card:Ri,downloadBtn:_i,cardLeft:Vi,iconWrap:Di,fileInfo:Hi,fileName:Pi,fileSize:Oi,cardPreview:Bi,actions:Ui,cardError:Fi,errorText:$i};function Wi({editor:e,node:t,deleteNode:r,extension:n}){var k;const o=(e==null?void 0:e.isEditable)??!1,{fileName:s,fileSize:l,fileExt:a,fileType:c,id:d,error:m}=t.attrs,{t:p}=W.useLocale(),h=(k=n==null?void 0:n.options)==null?void 0:k.onDownload,y=b.useCallback(()=>r(),[r]),g=b.useCallback(()=>{!d||!h||h({id:d,fileName:s,fileExt:a,fileType:c,fileSize:l})},[d,s,a,c,l,h]);return m&&m!=="null"?i.jsx(P.NodeViewWrapper,{children:i.jsx("div",{className:P.clsx(Z.card,Z.cardError,"render-wrapper"),children:i.jsx("p",{className:Z.errorText,children:m})})}):d?i.jsx(P.NodeViewWrapper,{children:i.jsxs("div",{className:P.clsx(Z.card,"render-wrapper",{[Z.cardPreview]:!o}),children:[i.jsxs("div",{className:Z.cardLeft,children:[i.jsx("div",{className:Z.iconWrap,children:Ut(c)}),i.jsxs("div",{className:Z.fileInfo,children:[i.jsxs("span",{className:Z.fileName,children:[s,".",a]}),i.jsx("span",{className:Z.fileSize,children:Ot(l)})]})]}),i.jsxs("div",{className:Z.actions,children:[h&&i.jsx(ce,{action:g,icon:"AttachmentDownload",tooltip:p("editor.attachment.download"),customClass:o?void 0:Z.downloadBtn}),o&&i.jsx(ce,{action:y,icon:"Trash2",tooltip:p("editor.delete")})]})]})}):i.jsx(i.Fragment,{})}function Gi(e){try{return JSON.stringify(e)}catch{return JSON.stringify({})}}function le(e,t=!1){return r=>{const n=e.startsWith("data-")?e:`data-${e}`;let o=decodeURIComponent(r.getAttribute(n));if(o==null||typeof o=="string"&&o==="null")try{const a=r.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);a&&a.length>0&&(o=(a.map(d=>d.trim()).reduce((d,m)=>{const p=m.indexOf("="),h=[m.slice(0,p),m.slice(p+1).slice(1,-1)];return d[h[0]]=h[1],d},{})[e.toLowerCase()]||"").replaceAll("&quot;",'"'))}catch(l){console.error("Error getDatasetAttribute ",l.message,r)}if(t)try{return JSON.parse(o)}catch{return{}}if(o.includes("%")||o.includes("auto"))return o;const s=Number.parseInt(o);return s!==s?o:s}}function Xi(e){const{attrs:t}=e;return Object.keys(t).reduce((r,n)=>{const o=t[n];if(o==null)return r;let s="";return typeof o=="object"?s=Gi(o):s=o,r[n]=s,r},Object.create(null))}const ke={UPLOAD_IMAGE:e=>`UPLOAD_IMAGE-${e}`,UPLOAD_VIDEO:e=>`UPLOAD_VIDEO-${e}`,UPLOAD_ATTACHMENT:e=>`UPLOAD_ATTACHMENT-${e}`,EXCALIDRAW:e=>`EXCALIDRAW-${e}`};function qi(e){const{editor:t}=P.useCurrentEditor(),r=_.useMemo(()=>t,[e,t]);return P.useEditorState({editor:r,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}function K(){return qi().editor}const Ft=Ye.y(!1);function it(){return Ye.b(Ft)}function Zi(){return Ye.S(Ft)}const $t=()=>!1;function Yi(e=$t){const t=it(),[r,n]=b.useState(()=>{const a=e();return typeof a=="boolean"?!a:a}),o=K();b.useEffect(()=>{if(!o||!e)return;const a=()=>{const c=e();n(typeof c=="boolean"?!c:c)};return a(),o.on("selectionUpdate",a),o.on("transaction",a),()=>{o.off("selectionUpdate",a),o.off("transaction",a)}},[o,e]);const s=b.useMemo(()=>!t||!o?!0:typeof r=="boolean"?r:!1,[t,o,r]),l=b.useMemo(()=>!t||!o,[t,o]);return{disabled:s,dataState:r,editorDisabled:l}}function he(e=$t){const t=it(),[r,n]=b.useState({}),[o,s]=b.useState(e()),l=K();b.useEffect(()=>{if(!l||!e)return;const d=()=>{s(e())};return d(),l.on("selectionUpdate",d),()=>{l.off("selectionUpdate",d)}},[r,l,e]);const a=b.useMemo(()=>!t||!l,[t,l]),c=b.useMemo(()=>!t||!l,[t,l]);return{disabled:a,dataState:o,editorDisabled:c,update:()=>n({})}}function ae(e){const t=K();return b.useMemo(()=>t?t.extensionManager.extensions.find(n=>n.name===e):null,[t,e])}function Ki(e,t,r){return e<t?t:e>r?r:e}const Ji=e=>typeof e=="number",Qi=e=>typeof e=="string",en=e=>typeof e=="function";function tn(e,t="px"){if(!e)return e;const r=Ji(e)?String(e):e,n=Number.parseFloat(r),o=r.match(/[%a-z]+$/i),s=o?o[0]:t;return Number.isNaN(n)?e:n+s}function rn(e,t){if(!e)return!1;const{extensions:r=[]}=(e==null?void 0:e.extensionManager)??{};return!!r.find(o=>o.name===t)}function nn(e){return e.map(t=>Qi(t)?{value:t,name:t}:t)}function Pe(e){const t=K(),r=ae(e),{t:n}=W.useLocale();return b.useMemo(()=>{if(!t||!r||!n)return null;const{button:o}=r.options;return!o||!en(o)?null:o({editor:t,extension:r,t:n})},[t,r,n])}function on(){const e=Pe(nt.name),{icon:t=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:o={},action:s=void 0,isActive:l=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:c}=he(l),d=()=>{a||s&&(s(),c())};return e?i.jsx(ce,{action:d,disabled:a,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:o}):i.jsx(i.Fragment,{})}const nt=P.Node3.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"attachment"},button:({editor:t,t:r})=>({component:ce,componentProps:{action:()=>{const n=ke.UPLOAD_ATTACHMENT(t.id);Dt(n,!0)},isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:r("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:e}){const{id:t="",fileName:r="",fileSize:n="",fileType:o="",fileExt:s=""}=e||{};return["div",P.mergeAttributes(this.options.HTMLAttributes||{},e||{}),t?["span",{class:"attachment__body"},["span",{class:"attachment__icon"},Ut(o,!0)],["span",{class:"attachment__text"},`${r}.${s} (${Ot(n)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{id:{default:null,parseHTML:le("id")},fileName:{default:null,parseHTML:le("filename")},fileSize:{default:null,parseHTML:le("filesize")},fileType:{default:null,parseHTML:le("filetype")},fileExt:{default:null,parseHTML:le("fileext")},error:{default:null,parseHTML:le("error")}}},addCommands(){return{setAttachment:e=>({chain:t})=>t().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return P.ReactNodeViewRenderer(Wi)}});function sn(){var f;const{t:e}=W.useLocale(),t=K(),{editorDisabled:r}=he(),[n,o]=b.useState(!1),[s,l]=b.useState(!1),[a,c]=b.useState(null),d=b.useRef(null),m=ae(nt.name),p=ke.UPLOAD_ATTACHMENT(t.id);De(v=>{v&&(c(null),l(!1),o(!0))},[p]);const h=(f=m==null?void 0:m.options)==null?void 0:f.upload;function y(v){var x;v.preventDefault(),(x=d.current)==null||x.click()}async function g(v){var M;const x=(M=v.target.files)==null?void 0:M[0];if(!x||!t||t.isDestroyed){v.target.value="";return}if(!h){c(e("editor.attachment.error.no_upload_fn")),v.target.value="";return}c(null),l(!0);try{const w=await h(x);t.chain().focus().setAttachment({id:w,fileName:Ni(x.name),fileSize:x.size,fileType:x.type,fileExt:Ii(x.name)}).run(),o(!1)}catch(w){c(w!=null&&w.message?`${e("editor.attachment.error.upload_failed")}: ${w.message}`:e("editor.attachment.error.upload_failed"))}finally{l(!1),v.target.value=""}}function k(v){s||(o(v),v||c(null))}return r?i.jsx(i.Fragment,{}):i.jsx(ue,{onOpenChange:k,open:n,children:i.jsxs(oe,{children:[i.jsx(se,{children:e("editor.attachment.dialog.title")}),i.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-gap-3",children:[i.jsx("p",{className:"richtext-text-sm richtext-text-muted-foreground",children:e("editor.attachment.dialog.description")}),i.jsx(G,{className:"richtext-w-full",disabled:s,onClick:y,size:"sm",children:e(s?"editor.attachment.uploading":"editor.attachment.dialog.button.choose")}),a&&i.jsx("p",{className:"richtext-text-sm richtext-text-destructive",children:a})]}),i.jsx("input",{hidden:!0,onChange:g,ref:d,type:"file"})]})})}var an=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,ln=P.Node3.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",P.mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,r,n,o,s,l;const a=(r=(t=e.attrs)==null?void 0:t.src)!=null?r:"",c=(o=(n=e.attrs)==null?void 0:n.alt)!=null?o:"",d=(l=(s=e.attrs)==null?void 0:s.title)!=null?l:"";return d?`![${c}](${a} "${d}")`:`![${c}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:r,alwaysPreserveAspectRatio:n}=this.options.resize;return({node:o,getPos:s,HTMLAttributes:l,editor:a})=>{const c=document.createElement("img");Object.entries(l).forEach(([p,h])=>{if(h!=null)switch(p){case"width":case"height":break;default:c.setAttribute(p,h);break}}),c.src=l.src;const d=new P.ResizableNodeView({element:c,editor:a,node:o,getPos:s,onResize:(p,h)=>{c.style.width=`${p}px`,c.style.height=`${h}px`},onCommit:(p,h)=>{const y=s();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:p,height:h}).run()},onUpdate:(p,h,y)=>p.type===o.type,options:{directions:e,min:{width:t,height:r},preserveAspectRatio:n===!0}}),m=d.dom;return m.style.visibility="hidden",m.style.pointerEvents="none",c.onload=()=>{m.style.visibility="",m.style.pointerEvents=""},d}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[P.nodeInputRule({find:an,type:this.type,getAttributes:e=>{const[,,t,r,n]=e;return{src:r,alt:t,title:n}}})]}}),Wt=ln,cn=typeof global=="object"&&global&&global.Object===Object&&global,dn=typeof self=="object"&&self&&self.Object===Object&&self,Gt=cn||dn||Function("return this")(),Ae=Gt.Symbol,Xt=Object.prototype,un=Xt.hasOwnProperty,hn=Xt.toString,be=Ae?Ae.toStringTag:void 0;function fn(e){var t=un.call(e,be),r=e[be];try{e[be]=void 0;var n=!0}catch{}var o=hn.call(e);return n&&(t?e[be]=r:delete e[be]),o}var mn=Object.prototype,xn=mn.toString;function gn(e){return xn.call(e)}var pn="[object Null]",bn="[object Undefined]",ht=Ae?Ae.toStringTag:void 0;function qt(e){return e==null?e===void 0?bn:pn:ht&&ht in Object(e)?fn(e):gn(e)}function Zt(e){return e!=null&&typeof e=="object"}var vn="[object Symbol]";function wn(e){return typeof e=="symbol"||Zt(e)&&qt(e)==vn}var yn=/\s/;function jn(e){for(var t=e.length;t--&&yn.test(e.charAt(t)););return t}var Cn=/^\s+/;function kn(e){return e&&e.slice(0,jn(e)+1).replace(Cn,"")}function Le(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ft=NaN,Sn=/^[-+]0x[0-9a-f]+$/i,Tn=/^0b[01]+$/i,Mn=/^0o[0-7]+$/i,Nn=parseInt;function we(e){if(typeof e=="number")return e;if(wn(e))return ft;if(Le(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Le(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=kn(e);var r=Tn.test(e);return r||Mn.test(e)?Nn(e.slice(2),r?2:8):Sn.test(e)?ft:+e}function In(e,t,r){return e===e&&(r!==void 0&&(e=e<=r?e:r),t!==void 0&&(e=e>=t?e:t)),e}function Yt(e,t,r){return r===void 0&&(r=t,t=void 0),r!==void 0&&(r=we(r),r=r===r?r:0),t!==void 0&&(t=we(t),t=t===t?t:0),In(we(e),t,r)}var We=function(){return Gt.Date.now()},An="Expected a function",Ln=Math.max,zn=Math.min;function Kt(e,t,r){var n,o,s,l,a,c,d=0,m=!1,p=!1,h=!0;if(typeof e!="function")throw new TypeError(An);t=we(t)||0,Le(r)&&(m=!!r.leading,p="maxWait"in r,s=p?Ln(we(r.maxWait)||0,t):s,h="trailing"in r?!!r.trailing:h);function y(C){var z=n,V=o;return n=o=void 0,d=C,l=e.apply(V,z),l}function g(C){return d=C,a=setTimeout(v,t),m?y(C):l}function k(C){var z=C-c,V=C-d,O=t-z;return p?zn(O,s-V):O}function f(C){var z=C-c,V=C-d;return c===void 0||z>=t||z<0||p&&V>=s}function v(){var C=We();if(f(C))return x(C);a=setTimeout(v,k(C))}function x(C){return a=void 0,h&&n?y(C):(n=o=void 0,l)}function M(){a!==void 0&&clearTimeout(a),d=0,n=c=o=a=void 0}function w(){return a===void 0?l:x(We())}function A(){var C=We(),z=f(C);if(n=arguments,o=this,c=C,z){if(a===void 0)return g(c);if(p)return clearTimeout(a),a=setTimeout(v,t),y(c)}return a===void 0&&(a=setTimeout(v,t)),l}return A.cancel=M,A.flush=w,A}var En="[object Number]";function qe(e){return typeof e=="number"||Zt(e)&&qt(e)==En}var Rn="Expected a function";function Ze(e,t,r){var n=!0,o=!0;if(typeof e!="function")throw new TypeError(Rn);return Le(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),Kt(e,t,{leading:n,maxWait:t,trailing:o})}const Te={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function _n({src:e,style:t}){return i.jsxs("div",{style:{position:"relative",display:"inline-block",overflow:"hidden",borderRadius:8,background:"hsl(var(--muted, 220 14% 96%))",minHeight:120,minWidth:180,...t},children:[e&&i.jsx("img",{src:e,alt:"","aria-hidden":!0,style:{display:"block",width:"100%",height:"100%",objectFit:"cover",filter:"blur(20px) saturate(0.5)",transform:"scale(1.1)",opacity:.5}}),i.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(110deg, transparent 30%, hsl(var(--muted-foreground, 220 9% 46%) / 0.08) 50%, transparent 70%)",animation:"richtext-skeleton-shimmer 1.8s ease-in-out infinite"}}),i.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,pointerEvents:"none"},children:[i.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"hsl(var(--muted-foreground, 220 9% 46%))",animation:"richtext-skeleton-spin 1s linear infinite"},children:i.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),i.jsx("span",{style:{fontSize:12,fontWeight:500,color:"hsl(var(--muted-foreground, 220 9% 46%))",userSelect:"none"},children:"Uploading…"})]}),i.jsx("style",{children:`
20
- @keyframes richtext-skeleton-shimmer {
21
- 0% { transform: translateX(-100%); }
22
- 100% { transform: translateX(100%); }
23
- }
24
- @keyframes richtext-skeleton-spin {
25
- from { transform: rotate(0deg); }
26
- to { transform: rotate(360deg); }
27
- }
28
- `})]})}function Vn(e){var O,B,F,N;const[t,r]=b.useState({width:W.IMAGE_MAX_SIZE,height:W.IMAGE_MAX_SIZE}),[n,o]=b.useState({width:0,height:0}),[s]=b.useState([Te.TOP_LEFT,Te.TOP_RIGHT,Te.BOTTOM_LEFT,Te.BOTTOM_RIGHT]),[l,a]=b.useState(!1),[c,d]=b.useState({x:0,y:0,w:0,h:0,dir:""}),{align:m,inline:p,uploading:h}=(O=e==null?void 0:e.node)==null?void 0:O.attrs,y=p&&(m==="left"||m==="right"),g=b.useMemo(()=>{var st;const{src:j,alt:T,width:R,height:H,flipX:U,flipY:I}=(st=e==null?void 0:e.node)==null?void 0:st.attrs,$=qe(R)?`${R}px`:R,X=qe(H)?`${H}px`:H,q=[];U&&q.push("rotateX(180deg)"),I&&q.push("rotateY(180deg)");const tr=q.join(" ");return{src:j||void 0,alt:T||void 0,style:{width:$||void 0,height:X||void 0,transform:tr||"none",...y?{float:m}:{}}}},[(B=e==null?void 0:e.node)==null?void 0:B.attrs]),k=b.useMemo(()=>{const{style:{width:j}}=g;return{width:j==="100%"?j:void 0}},[g]);function f(j){o({width:j.target.width,height:j.target.height})}function v(){const{editor:j,getPos:T}=e;j.commands.setNodeSelection(T())}const x=b.useCallback(Ze(()=>{const{editor:j}=e,{width:T}=getComputedStyle(j.view.dom);r(R=>({...R,width:Number.parseInt(T,10)}))},W.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function M(j,T){j.preventDefault(),j.stopPropagation();const R=n.width,H=n.height,U=R/H;let I=Number(e.node.attrs.width),$=Number(e.node.attrs.height);const X=t.width;I&&!$?(I=I>X?X:I,$=Math.round(I/U)):$&&!I?(I=Math.round($*U),I=I>X?X:I):!I&&!$?(I=R>X?X:R,$=Math.round(I/U)):I=I>X?X:I,a(!0),d({x:j.clientX,y:j.clientY,w:I,h:$,dir:T})}const w=b.useCallback(Ze(j=>{if(j.preventDefault(),j.stopPropagation(),!l)return;const{x:T,w:R,dir:H}=c,U=(j.clientX-T)*(/l/.test(H)?-1:1),I=Yt(R+U,W.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:I,height:null})},W.IMAGE_THROTTLE_WAIT_TIME),[l,c,t,e.updateAttributes]),A=b.useCallback(j=>{j.preventDefault(),j.stopPropagation(),l&&(d({x:0,y:0,w:0,h:0,dir:""}),a(!1),v())},[l,v]),C=b.useCallback(()=>{document==null||document.addEventListener("mousemove",w,!0),document==null||document.addEventListener("mouseup",A,!0)},[w,A]),z=b.useCallback(()=>{document==null||document.removeEventListener("mousemove",w,!0),document==null||document.removeEventListener("mouseup",A,!0)},[w,A]);b.useEffect(()=>(l?C():z(),()=>{z()}),[l,C,z]);const V=b.useMemo(()=>new ResizeObserver(()=>x()),[x]);return b.useEffect(()=>(V.observe(e.editor.view.dom),()=>{V.disconnect()}),[e.editor.view.dom,V]),h?i.jsx(P.NodeViewWrapper,{as:p?"span":"div",className:"image-view",style:{float:y?m:void 0,margin:y?m==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:p?"inline":"block",textAlign:y?void 0:m,width:((F=g.style)==null?void 0:F.width)??"auto",...y?{}:k},children:i.jsx("div",{style:k,className:"image-view__body",children:i.jsx(_n,{src:g.src,style:g.style})})}):i.jsx(P.NodeViewWrapper,{as:p?"span":"div",className:"image-view",style:{float:y?m:void 0,margin:y?m==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:p?"inline":"block",textAlign:y?void 0:m,width:((N=g.style)==null?void 0:N.width)??"auto",...y?{}:k},children:i.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:k,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${l?"image-view__body--resizing":""}`,children:[i.jsx("img",{alt:g.alt,className:"image-view__body__image block",height:"auto",onClick:v,onLoad:f,src:g.src,style:g.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||l)&&i.jsx("div",{className:"image-resizer",children:s==null?void 0:s.map(j=>i.jsx("span",{className:`image-resizer__handler image-resizer__handler--${j}`,onMouseDown:T=>M(T,j)},`image-dir-${j}`))})]})})}function Dn(e,t){const r=e.type,n=e.name.toLowerCase(),o=n.split(".").pop();if(!o)return!1;const l=r||{heif:"image/heif",heic:"image/heic",dng:"image/x-adobe-dng",cr2:"image/x-canon-cr2",nef:"image/x-nikon-nef",arw:"image/x-sony-arw",raf:"image/x-fuji-raf",orf:"image/x-olympus-orf"}[o];return t.some(a=>{if(a.startsWith("."))return n.endsWith(a);if(a.endsWith("/*")){const c=a.split("/")[0];return l==null?void 0:l.startsWith(c+"/")}return l===a})}function ot(e,t){const{acceptMimes:r,maxSize:n,t:o,toast:s}=t,l=[];return(Array.isArray(e)?e:Object.values(e)).forEach(c=>{if(!Dn(c,r)){t.onError?t.onError({type:"type",message:o("editor.upload.fileTypeNotSupported",{fileName:c.name}),file:c}):s({variant:"destructive",title:o("editor.upload.fileTypeNotSupported",{fileName:c.name})});return}if(c.size>n){const d=(n/1024/1024).toFixed(2);t.onError?t.onError({type:"size",message:o("editor.upload.fileSizeTooBig",{fileName:c.name,size:d}),file:c}):s({variant:"destructive",title:o("editor.upload.fileSizeTooBig",{fileName:c.name,size:d})});return}l.push(c)}),l}function Hn(){const{t:e}=W.useLocale(),{toast:t}=_e(),r=K(),n=Pe(ye.name),{icon:o,tooltip:s}=(n==null?void 0:n.componentProps)??{},{editorDisabled:l}=he(),[a,c]=b.useState(!1),d=ae(ye.name),[m,p]=b.useState(""),[h,y]=b.useState(""),g=b.useRef(null),k=(d==null?void 0:d.options.defaultInline)||!1,[f,v]=b.useState(k),x=b.useMemo(()=>d==null?void 0:d.options,[d]);function M(C){var F;const z=(F=C==null?void 0:C.target)==null?void 0:F.files;if(!r||r.isDestroyed||z.length===0){C.target.value="";return}const V=ot(z,{acceptMimes:x==null?void 0:x.acceptMimes,maxSize:x==null?void 0:x.maxSize,t:e,toast:t,onError:x.onError});if(V.length<=0){C.target.value="";return}c(!1);const O=h,B=f;if(y(""),v(k),x.upload){const N=x!=null&&x.multiple?V:[V[0]];for(const j of N)r.chain().focus().insertImagePlaceholder({file:j,inline:B,alt:O}).run()}else{const N=x!=null&&x.multiple?V:[V[0]];for(const j of N){const T=URL.createObjectURL(j);r.chain().focus().setImageInline({src:T,inline:B,alt:O}).run()}}C.target.value=""}function w(C){C.preventDefault(),C.stopPropagation(),r.chain().focus().setImageInline({src:m,inline:f,alt:h}).run(),c(!1),v(k),p(""),y("")}function A(C){var z;C.preventDefault(),(z=g.current)==null||z.click()}return n?i.jsxs(ue,{onOpenChange:c,open:a,children:[i.jsx(He,{asChild:!0,children:i.jsx(ce,{disabled:l,icon:o,tooltip:s,action:()=>{l||c(!0)}})}),i.jsxs(oe,{children:[i.jsx(se,{children:e("editor.image.dialog.title")}),i.jsxs(Re,{activationMode:"manual",defaultValue:x.resourceImage==="both"||x.resourceImage==="upload"?"upload":"link",children:[x.resourceImage==="both"&&i.jsxs(Ce,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[i.jsx(Q,{value:"upload",children:e("editor.image.dialog.tab.upload")}),i.jsx(Q,{value:"link",children:e("editor.image.dialog.tab.url")})]}),i.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]",children:[i.jsx(Ve,{checked:f,onCheckedChange:C=>{v(C)}}),i.jsx(me,{children:e("editor.link.dialog.inline")})]}),x.enableAlt&&i.jsxs("div",{className:"richtext-my-[10px]",children:[i.jsx(me,{className:"mb-[6px]",children:e("editor.imageUpload.alt")}),i.jsx(ie,{onChange:C=>y(C.target.value),required:!0,type:"text",value:h})]}),i.jsxs(ee,{value:"upload",children:[i.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[i.jsx(G,{className:"richtext-mt-1 richtext-w-full",onClick:A,size:"sm",children:e("editor.image.dialog.tab.upload")}),i.jsx(Jt,{alt:h,disabled:!1,editor:r,imageInline:f,onClose:()=>{y("")}})]}),i.jsx("input",{accept:x.acceptMimes.join(",")||"image/*",multiple:x.multiple,onChange:M,ref:g,style:{display:"none"},type:"file"})]}),i.jsx(ee,{value:"link",children:i.jsx("form",{onSubmit:w,children:i.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[i.jsx(ie,{autoFocus:!0,onChange:C=>p(C.target.value),placeholder:e("editor.image.dialog.placeholder"),required:!0,type:"url",value:m}),i.jsx(G,{type:"submit",children:e("editor.image.dialog.button.apply")})]})})})]})]})]}):i.jsx(i.Fragment,{})}const Pn={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,multiple:!0,resourceImage:"both",defaultInline:!1,enableAlt:!0},ye=Wt.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var e;return{...Pn,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:r,t:n})=>{var o,s;return{componentProps:{action:()=>!0,upload:r.options.upload,disabled:!((s=(o=t.can()).setImage)!=null&&s.call(o,{})),icon:"ImageUp",tooltip:n("editor.image.tooltip")}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),uploading:{default:!1,parseHTML:()=>!1,renderHTML:()=>({})},imageId:{default:null,parseHTML:t=>t.getAttribute("data-image-id"),renderHTML:t=>t.imageId?{"data-image-id":t.imageId}:{}},flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||null;return r?Number.parseInt(r,10):null},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})},inline:{default:!1,parseHTML:t=>!!t.getAttribute("inline"),renderHTML:t=>({inline:t.inline})},alt:{default:"",parseHTML:t=>t.getAttribute("alt"),renderHTML:t=>({alt:t.alt})}}},addNodeView(){return P.ReactNodeViewRenderer(Vn)},addCommands(){var r;const e=this.name,t=this.options;return{...(r=this.parent)==null?void 0:r.call(this),setImageInline:n=>({commands:o})=>o.insertContent({type:e,attrs:{...n,imageId:n.imageId??null,inline:n.inline??t.defaultInline}}),insertImagePlaceholder:({file:n,inline:o,alt:s})=>({editor:l,commands:a})=>{const c=URL.createObjectURL(n);if(!a.insertContent({type:e,attrs:{src:c,alt:s??"",inline:o??t.defaultInline,uploading:!0,imageId:null}}))return!1;const m=t.upload;return m&&m(n).then(p=>{const{doc:h}=l.state;let y=null;h.descendants((g,k)=>{if(g.type.name===e&&g.attrs.uploading===!0&&g.attrs.src===c)return y=k,!1}),y!==null&&l.view.dispatch(l.state.tr.setNodeMarkup(y,void 0,{...l.state.doc.nodeAt(y).attrs,src:p.cdnUrl,imageId:p.imageId,uploading:!1})),URL.revokeObjectURL(c)}).catch(p=>{console.error("Image upload failed",p);const{doc:h}=l.state;let y=null;if(h.descendants((g,k)=>{if(g.type.name===e&&g.attrs.uploading===!0&&g.attrs.src===c)return y=k,!1}),y!==null){const g=l.state.doc.nodeAt(y);g&&l.view.dispatch(l.state.tr.delete(y,y+g.nodeSize))}URL.revokeObjectURL(c)}),!0},updateImage:n=>({commands:o})=>o.updateAttributes(this.name,n),setAlignImage:n=>({commands:o})=>o.updateAttributes(this.name,{align:n})}},renderHTML({HTMLAttributes:e}){const{flipX:t,flipY:r,align:n,inline:o}=e,s=o&&(n==="left"||n==="right"),l=t||r?`transform: rotateX(${t?"180":"0"}deg) rotateY(${r?"180":"0"}deg);`:"",a=s?"":`text-align: ${n};`,m=`${s?`float: ${n};`:""}${s?n==="left"?"margin: 1em 1em 1em 0;":"margin: 1em 0 1em 1em;":""}${l}`;return[o?"span":"div",{style:a,class:"image"},["img",P.mergeAttributes({height:"auto",style:m},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"span.image img",getAttrs:e=>{var s;const t=e==null?void 0:e.parentElement,r=e==null?void 0:e.getAttribute("width"),n=(e==null?void 0:e.getAttribute("flipx"))||!1,o=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:r?Number.parseInt(r,10):null,align:(e==null?void 0:e.getAttribute("align"))||((s=t==null?void 0:t.style)==null?void 0:s.textAlign)||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:n==="true",flipY:o==="true"}}},{tag:"div[class=image]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width"),n=(t==null?void 0:t.getAttribute("flipx"))||!1,o=(t==null?void 0:t.getAttribute("flipy"))||!1;return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),caption:t==null?void 0:t.getAttribute("caption"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null,inline:(t==null?void 0:t.getAttribute("inline"))||!1,flipX:n==="true",flipY:o==="true"}}},{tag:'img[src]:not([src^="data:"])'}]}});function Jt({editor:e,imageInline:t,onClose:r,disabled:n,alt:o}){var F,N;const{t:s}=W.useLocale(),{toast:l}=_e(),[a,c]=b.useState(!1),[d,m]=b.useState(!1),p=b.useRef(null),[h,y]=b.useState(),[g,k]=b.useState(""),f=b.useRef(null),[v,x]=b.useState({src:"",file:null}),M=ae(ye.name),w=b.useMemo(()=>(M==null?void 0:M.options)??{},[M]);function A(j){if(p.current&&j.width&&j.height){const T=C(p.current,j);k(T)}}function C(j,T){const R=document.createElement("canvas"),H=j.naturalWidth/j.width,U=j.naturalHeight/j.height;R.width=T.width*H,R.height=T.height*U;const I=R.getContext("2d");return I&&(I.imageSmoothingEnabled=!1,I.drawImage(j,T.x*H,T.y*U,T.width*H,T.height*U,0,0,T.width*H,T.height*U)),R.toDataURL("image/png",1)}const z=b.useCallback(()=>{var T;if(d)return;const j=Bt(g,((T=v==null?void 0:v.file)==null?void 0:T.name)||"image.png");if(c(!1),x({src:"",file:null}),B(),r(),w.upload)e.chain().focus().insertImagePlaceholder({file:j,inline:t,alt:o}).run();else{const R=URL.createObjectURL(j);e.chain().focus().setImageInline({src:R,inline:t,alt:o}).run()}},[g,e,t,d,r,(F=v==null?void 0:v.file)==null?void 0:F.name,w,o]);function V(j){var T;j.preventDefault(),(T=f.current)==null||T.click()}const O=async j=>{var I;const T=(I=j==null?void 0:j.target)==null?void 0:I.files;if(!e||e.isDestroyed||T.length===0){j.target.value="";return}const R=ot(T,{acceptMimes:w==null?void 0:w.acceptMimes,maxSize:w==null?void 0:w.maxSize,t:s,toast:l,onError:w.onError});if(R.length<=0){j.target.value="";return}const H=R[0],U=await Li(H);c(!0),x({src:U.src,file:H})},B=()=>{f.current&&(f.current.value="")};return i.jsxs(i.Fragment,{children:[i.jsx(G,{className:"richtext-mt-1 richtext-w-full",disabled:n,onClick:V,size:"sm",children:s("editor.image.dialog.tab.uploadCrop")}),i.jsxs(ue,{open:a,onOpenChange:j=>{c(j),j||(x({src:"",file:null}),B())},children:[i.jsx(He,{}),i.jsxs(oe,{children:[i.jsx(se,{children:s("editor.image.dialog.tab.uploadCrop")}),i.jsx("div",{children:v.src&&i.jsx(lr,{className:"richtext-w-full",crop:h,onChange:j=>y(j),onComplete:j=>A(j),children:i.jsx("img",{alt:"Crop me",ref:p,src:v.src})})}),i.jsxs(rt,{children:[i.jsxs(G,{disabled:d,onClick:()=>{c(!1),x({src:"",file:null}),B()},children:[s("editor.imageUpload.cancel"),i.jsx(Me,{className:"richtext-ml-1",name:"Trash2"})]}),i.jsx(G,{className:"richtext-w-fit",disabled:d||!h,onClick:z,children:d?i.jsxs(i.Fragment,{children:[s("editor.imageUpload.uploading"),i.jsx(Me,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):i.jsxs(i.Fragment,{children:[s("editor.imageUpload.crop"),i.jsx(Me,{className:"richtext-ml-1",name:"Crop"})]})})]})]})]}),i.jsx("input",{accept:((N=w==null?void 0:w.acceptMimes)==null?void 0:N.join(","))||"image/*",multiple:!1,onChange:O,ref:f,style:{display:"none"},type:"file"})]})}function On(){const{t:e}=W.useLocale(),{toast:t}=_e(),r=K(),{editorDisabled:n}=he(),[o,s]=b.useState(!1),l=ke.UPLOAD_IMAGE(r.id);De(s,[l]);const a=ae(ye.name),[c,d]=b.useState(""),[m,p]=b.useState(""),h=b.useRef(null),y=(a==null?void 0:a.options.defaultInline)||!1,[g,k]=b.useState(y),f=b.useMemo(()=>a==null?void 0:a.options,[a]);function v(w){var O;const A=(O=w==null?void 0:w.target)==null?void 0:O.files;if(!r||r.isDestroyed||A.length===0){w.target.value="";return}const C=ot(A,{acceptMimes:f==null?void 0:f.acceptMimes,maxSize:f==null?void 0:f.maxSize,t:e,toast:t,onError:f.onError});if(C.length<=0){w.target.value="";return}s(!1);const z=m,V=g;if(p(""),k(y),f.upload){const B=f!=null&&f.multiple?C:[C[0]];for(const F of B)r.chain().focus().insertImagePlaceholder({file:F,inline:V,alt:z}).run()}else{const B=f!=null&&f.multiple?C:[C[0]];for(const F of B){const N=URL.createObjectURL(F);r.chain().focus().setImageInline({src:N,inline:V,alt:z}).run()}}w.target.value=""}function x(w){w.preventDefault(),w.stopPropagation(),r.chain().focus().setImageInline({src:c,inline:g,alt:m}).run(),s(!1),k(y),d(""),p("")}function M(w){var A;w.preventDefault(),(A=h.current)==null||A.click()}return n?i.jsx(i.Fragment,{}):i.jsx(ue,{onOpenChange:s,open:o,children:i.jsxs(oe,{children:[i.jsx(se,{children:e("editor.image.dialog.title")}),i.jsxs(Re,{activationMode:"manual",defaultValue:f.resourceImage==="both"||f.resourceImage==="upload"?"upload":"link",children:[f.resourceImage==="both"&&i.jsxs(Ce,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[i.jsx(Q,{value:"upload",children:e("editor.image.dialog.tab.upload")}),i.jsx(Q,{value:"link",children:e("editor.image.dialog.tab.url")})]}),i.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]",children:[i.jsx(Ve,{checked:g,onCheckedChange:w=>{k(w)}}),i.jsx(me,{children:e("editor.link.dialog.inline")})]}),f.enableAlt&&i.jsxs("div",{className:"richtext-my-[10px]",children:[i.jsx(me,{className:"mb-[6px]",children:e("editor.imageUpload.alt")}),i.jsx(ie,{onChange:w=>p(w.target.value),required:!0,type:"text",value:m})]}),i.jsxs(ee,{value:"upload",children:[i.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[i.jsx(G,{className:"richtext-mt-1 richtext-w-full",onClick:M,size:"sm",children:e("editor.image.dialog.tab.upload")}),i.jsx(Jt,{alt:m,disabled:!1,editor:r,imageInline:g,onClose:()=>{p("")}})]}),i.jsx("input",{accept:f.acceptMimes.join(",")||"image/*",multiple:f.multiple,onChange:v,ref:h,style:{display:"none"},type:"file"})]}),i.jsx(ee,{value:"link",children:i.jsx("form",{onSubmit:x,children:i.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[i.jsx(ie,{autoFocus:!0,onChange:w=>d(w.target.value),placeholder:e("editor.image.dialog.placeholder"),required:!0,type:"url",value:c}),i.jsx(G,{type:"submit",children:e("editor.image.dialog.button.apply")})]})})})]})]})})}function Qt(e,t){let r;try{r=new URL(e)}catch{return!1}return!(t!=null&&t.length)||t.length===1&&t[0]==="."?!0:t.some(n=>{if(n.includes("*")){const o=n.replace(/\./g,String.raw`\.`).replace(/\*/g,".*");return new RegExp(`^${o}$`).test(r.hostname)}return r.hostname.includes(n)})}function Bn(){const{t:e}=W.useLocale(),t=K(),r=Pe(ze.name),{icon:n,tooltip:o}=(r==null?void 0:r.componentProps)??{},{editorDisabled:s}=he(),[l,a]=b.useState(""),c=b.useRef(null),[d,m]=b.useState(""),[p,h]=b.useState(!1),y=ae(ze.name),g=b.useMemo(()=>(y==null?void 0:y.options)??{},[y]);async function k(x){var C;const M=(C=x==null?void 0:x.target)==null?void 0:C.files;if(!t||t.isDestroyed||M.length===0)return;const w=M[0];let A="";g.upload?A=await g.upload(w):A=URL.createObjectURL(w),t.chain().focus().setVideo({src:A,width:"100%"}).run(),h(!1)}function f(x){x.preventDefault(),x.stopPropagation(),l&&(t.chain().focus().setVideo({src:l,width:"100%"}).run(),h(!1),a(""))}function v(x){var M;x.preventDefault(),(M=c.current)==null||M.click()}return i.jsxs(ue,{onOpenChange:h,open:p,children:[i.jsx(He,{asChild:!0,children:i.jsx(ce,{disabled:s,icon:n,tooltip:o,action:()=>{s||h(!0)}})}),i.jsxs(oe,{children:[i.jsx(se,{children:e("editor.video.dialog.title")}),i.jsxs(Re,{activationMode:"manual",defaultValue:(g==null?void 0:g.resourceVideo)==="both"||(g==null?void 0:g.resourceVideo)==="upload"?"upload":"link",children:[i.jsxs(Ce,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((g==null?void 0:g.resourceVideo)==="both"||(g==null?void 0:g.resourceVideo)==="upload")&&i.jsx(Q,{value:"upload",children:e("editor.video.dialog.tab.upload")}),((g==null?void 0:g.resourceVideo)==="both"||(g==null?void 0:g.resourceVideo)==="link")&&i.jsx(Q,{value:"link",children:e("editor.video.dialog.link")})]}),i.jsxs(ee,{value:"upload",children:[i.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:i.jsx(G,{className:"richtext-mt-1 richtext-w-full",onClick:v,size:"sm",children:e("editor.video.dialog.tab.upload")})}),i.jsx("input",{accept:"video/*",multiple:!0,onChange:k,ref:c,type:"file",style:{display:"none"}})]}),i.jsxs(ee,{value:"link",children:[i.jsx("div",{children:i.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[i.jsx(ie,{autoFocus:!0,placeholder:e("editor.video.dialog.placeholder"),required:!0,type:"url",value:l,onBlur:x=>{const M=x.target.value,w=g.videoProviders||["."];M&&!Qt(M,w)?m("Invalid video URL"):m("")},onChange:x=>{a(x.target.value)}}),i.jsx(G,{onClick:f,type:"button",children:e("editor.video.dialog.button.apply")})]})}),d&&i.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:d})]})]})]})]})}function Un(e){e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/");const t=e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);t&&(e=`https://www.youtube.com/embed/${t[1]}`);const r=e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);if(r){const o=r[1],s=r[2];s?e=`https://player.vimeo.com/video/${o}?h=${s}`:e=`https://player.vimeo.com/video/${o}`}return/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const ze=P.Node3.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:W.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper"},button:({editor:e,t})=>{var r,n;return{componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((n=(r=e.can()).setVideo)!=null&&n.call(r,{})),icon:"Video",tooltip:t("editor.video.tooltip"),videoProviders:["."],editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?Un(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:tn(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},align:{default:"center",renderHTML:({align:e})=>({align:e})}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%",align:r="center"}=e??{},n={...e,width:"100%",height:"100%"},o=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,s=`flex: 1;padding-bottom: ${9/16*100}%;`,m=["div",{style:`display: flex; justify-content: ${r};`},["div",{style:o},["div",{style:s}],["iframe",n]]];return["div",{...this.options.HTMLAttributes,class:"iframe-wrapper","data-video":""},m]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}});function Fn(){const{t:e}=W.useLocale(),t=K(),{editorDisabled:r}=he(),[n,o]=b.useState(""),s=b.useRef(null),[l,a]=b.useState(""),[c,d]=b.useState(!1),m=ae(ze.name),p=ke.UPLOAD_VIDEO(t.id);De(d,[p]);const h=b.useMemo(()=>(m==null?void 0:m.options)??{},[m]);async function y(f){var w;const v=(w=f==null?void 0:f.target)==null?void 0:w.files;if(!t||t.isDestroyed||v.length===0)return;const x=v[0];let M="";h.upload?M=await h.upload(x):M=URL.createObjectURL(x),t.chain().focus().setVideo({src:M,width:"100%"}).run(),d(!1)}function g(f){f.preventDefault(),f.stopPropagation(),n&&(t.chain().focus().setVideo({src:n,width:"100%"}).run(),d(!1),o(""))}function k(f){var v;f.preventDefault(),(v=s.current)==null||v.click()}return r?i.jsx(i.Fragment,{}):i.jsx(ue,{onOpenChange:d,open:c,children:i.jsxs(oe,{children:[i.jsx(se,{children:e("editor.video.dialog.title")}),i.jsxs(Re,{activationMode:"manual",defaultValue:(h==null?void 0:h.resourceVideo)==="both"||(h==null?void 0:h.resourceVideo)==="upload"?"upload":"link",children:[i.jsxs(Ce,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((h==null?void 0:h.resourceVideo)==="both"||(h==null?void 0:h.resourceVideo)==="upload")&&i.jsx(Q,{value:"upload",children:e("editor.video.dialog.tab.upload")}),((h==null?void 0:h.resourceVideo)==="both"||(h==null?void 0:h.resourceVideo)==="link")&&i.jsx(Q,{value:"link",children:e("editor.video.dialog.link")})]}),i.jsxs(ee,{value:"upload",children:[i.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:i.jsx(G,{className:"richtext-mt-1 richtext-w-full",onClick:k,size:"sm",children:e("editor.video.dialog.tab.upload")})}),i.jsx("input",{accept:"video/*",multiple:!0,onChange:y,ref:s,type:"file",style:{display:"none"}})]}),i.jsxs(ee,{value:"link",children:[i.jsx("div",{children:i.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[i.jsx(ie,{autoFocus:!0,placeholder:e("editor.video.dialog.placeholder"),required:!0,type:"url",value:n,onBlur:f=>{const v=f.target.value,x=h.videoProviders||["."];v&&!Qt(v,x)?a("Invalid video URL"):a("")},onChange:f=>{o(f.target.value)}}),i.jsx(G,{onClick:g,type:"button",children:e("editor.video.dialog.button.apply")})]})}),l&&i.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:l})]})]})]})})}function er(){return i.jsxs(i.Fragment,{children:[i.jsx(On,{}),i.jsx(Fn,{}),i.jsx(sn,{})]})}process.env.NODE_ENV!=="production"&&(er.displayName="SlashDialogTrigger");exports.ActionButton=ce;exports.Attachment=nt;exports.Button=G;exports.Checkbox=Ve;exports.Dialog=ue;exports.DialogContent=oe;exports.DialogFooter=rt;exports.DialogHeader=Pt;exports.DialogTitle=se;exports.DialogTrigger=He;exports.EVENTS=ke;exports.IconComponent=Me;exports.Image=ye;exports.Input=ie;exports.Label=me;exports.MenuDown=kt;exports.ReactBusProvider=ki;exports.RichTextAttachment=on;exports.RichTextImage=Hn;exports.RichTextVideo=Bn;exports.Select=mi;exports.SelectContent=Et;exports.SelectItem=Rt;exports.SelectTrigger=At;exports.SelectValue=xi;exports.SlashDialogTrigger=er;exports.Textarea=Mt;exports.Toggle=Qe;exports.Tooltip=Nt;exports.TooltipContent=et;exports.TooltipProvider=fi;exports.TooltipTrigger=It;exports.Video=ze;exports.clamp=Ki;exports.clamp$1=Yt;exports.cn=L;exports.cva=Ee;exports.dataURLtoFile=Bt;exports.debounce=Kt;exports.emit=Dt;exports.ensureNameValueOptions=nn;exports.getDatasetAttribute=le;exports.getShortcutKey=jt;exports.getShortcutKeys=Ct;exports.hasExtension=rn;exports.icons=Je;exports.index_default=Wt;exports.isNumber=qe;exports.nodeAttrsToDataset=Xi;exports.throttle=Ze;exports.toast=_t;exports.useActive=Yi;exports.useButtonProps=Pe;exports.useEditableEditor=it;exports.useEditorInstance=K;exports.useExtension=ae;exports.useListener=De;exports.useStoreEditableEditor=Zi;exports.useToast=_e;exports.useToggleActive=he;