reactjs-tiptap-editor 1.0.16 → 1.0.17

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 (193) hide show
  1. package/lib/ActionMenuButton-B_E2mbAW.cjs +1 -0
  2. package/lib/{ActionMenuButton-a8LhmHXe.js → ActionMenuButton-lsIBc9sU.js} +12 -16
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +28 -32
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +11 -13
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +13 -15
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +15 -17
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +56 -62
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +12 -13
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +8 -10
  17. package/lib/CodeBlock.cjs +29 -29
  18. package/lib/CodeBlock.js +11 -14
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +9 -11
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +26 -29
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +7 -9
  25. package/lib/{Drawer-CbOJ1Igo.js → Drawer-DQ4CxBwG.js} +23 -29
  26. package/lib/Drawer-FUeUKshi.cjs +1 -0
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +3 -3
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +13 -15
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +276 -5
  33. package/lib/ExportPdf.cjs +2 -2
  34. package/lib/ExportPdf.js +19 -21
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +8 -10
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +9 -10
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +19 -20
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +27 -28
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +24 -27
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +25 -28
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +8 -10
  49. package/lib/{Iframe-CmjbQQcz.js → Iframe-CTajPyzs.js} +34 -38
  50. package/lib/Iframe-EVWXCqe4.cjs +1 -0
  51. package/lib/Iframe.cjs +1 -1
  52. package/lib/Iframe.js +2 -2
  53. package/lib/Image.cjs +1 -1
  54. package/lib/Image.js +4 -5
  55. package/lib/ImageGif.cjs +1 -1
  56. package/lib/ImageGif.js +109 -114
  57. package/lib/ImportWord.cjs +1 -1
  58. package/lib/ImportWord.js +15 -18
  59. package/lib/{Indent-BoG-vpIE.js → Indent-BGEHlRx_.js} +24 -26
  60. package/lib/Indent-q9cEWAa_.cjs +1 -0
  61. package/lib/Indent.cjs +1 -1
  62. package/lib/Indent.js +2 -2
  63. package/lib/Italic.cjs +1 -1
  64. package/lib/Italic.js +11 -13
  65. package/lib/Katex-ClqcEnN_.cjs +4 -0
  66. package/lib/{Katex-ByL9snce.js → Katex-tMh4bfBb.js} +19 -24
  67. package/lib/Katex.cjs +1 -1
  68. package/lib/Katex.js +2 -2
  69. package/lib/LineHeight.cjs +1 -1
  70. package/lib/LineHeight.js +17 -20
  71. package/lib/Link.cjs +1 -1
  72. package/lib/Link.js +2 -2
  73. package/lib/{LinkEditBlock-Ckih17pU.js → LinkEditBlock-CA5NhP-m.js} +19 -26
  74. package/lib/LinkEditBlock-DZXk4ln_.cjs +5 -0
  75. package/lib/Mention.js +3 -3
  76. package/lib/Mermaid.cjs +2 -2
  77. package/lib/Mermaid.js +31 -36
  78. package/lib/MoreMark.cjs +1 -1
  79. package/lib/MoreMark.js +25 -29
  80. package/lib/OrderedList.cjs +1 -1
  81. package/lib/OrderedList.js +13 -15
  82. package/lib/SearchAndReplace.cjs +1 -1
  83. package/lib/SearchAndReplace.js +62 -69
  84. package/lib/SlashCommand.cjs +1 -1
  85. package/lib/SlashCommand.js +5 -5
  86. package/lib/SlashCommandNodeView-CZoM3ZlS.cjs +1 -0
  87. package/lib/{SlashCommandNodeView-B2g1MbgN.js → SlashCommandNodeView-DLuqbX2o.js} +64 -69
  88. package/lib/Strike.cjs +1 -1
  89. package/lib/Strike.js +12 -14
  90. package/lib/{Table-BEwrZVup.js → Table-BC4Lbqzn.js} +27 -29
  91. package/lib/Table-BmDopO43.cjs +9 -0
  92. package/lib/Table.cjs +1 -1
  93. package/lib/Table.js +1 -1
  94. package/lib/TaskList.cjs +1 -1
  95. package/lib/TaskList.js +18 -20
  96. package/lib/TextAlign.cjs +1 -1
  97. package/lib/TextAlign.js +29 -33
  98. package/lib/TextDirection.cjs +1 -1
  99. package/lib/TextDirection.js +16 -20
  100. package/lib/TextUnderline.cjs +1 -1
  101. package/lib/TextUnderline.js +7 -9
  102. package/lib/Twitter-BbMD3Ybp.cjs +1 -0
  103. package/lib/{Twitter-4U_ZBhpv.js → Twitter-D8Cbgl7g.js} +17 -23
  104. package/lib/Twitter.cjs +1 -1
  105. package/lib/Twitter.js +2 -2
  106. package/lib/Video.cjs +1 -1
  107. package/lib/Video.js +5 -270
  108. package/lib/bubble.cjs +4 -4
  109. package/lib/bubble.js +543 -552
  110. package/lib/{clsx-DSzxBzvL.js → clsx-DaPvp9ji.js} +23 -23
  111. package/lib/components/ReactBus.d.ts +11 -0
  112. package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -0
  113. package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -0
  114. package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +5 -0
  115. package/lib/{dropdown-menu-eUeBXQeA.cjs → dropdown-menu-C_F7LEy5.cjs} +1 -1
  116. package/lib/{dropdown-menu-CW3Kthwy.js → dropdown-menu-q6RL_fkA.js} +1 -1
  117. package/lib/{index-4bHF5ovf.js → index-BDYJ8Ph2.js} +1 -1
  118. package/lib/index-BnVcq33n.cjs +1 -0
  119. package/lib/{index-DR5tIdL7.js → index-Do_dsOGB.js} +1 -1
  120. package/lib/{index-CpTykZBR.js → index-DqruLhsu.js} +1 -1
  121. package/lib/{index-D8li6EQ4.js → index-Qcl3BG94.js} +1 -1
  122. package/lib/index-RcSPeQHn.js +4941 -0
  123. package/lib/index.cjs +3 -3
  124. package/lib/index.js +45 -49
  125. package/lib/{popover-CeY3RbI5.js → popover-CtinPbiy.js} +1 -1
  126. package/lib/{popover-C6Cya3Cz.cjs → popover-DIMT3pae.cjs} +1 -1
  127. package/lib/{renderNodeView-CSazLrKF.js → renderNodeView-BEkECnnY.js} +2 -2
  128. package/lib/{select-Doa_-jkZ.cjs → select-CYyIeImH.cjs} +1 -1
  129. package/lib/{select-F0ZZ3VZB.js → select-CmV5uTXr.js} +1 -1
  130. package/lib/separator-BLp6xpSY.cjs +1 -0
  131. package/lib/{separator-Cjn4YH8a.js → separator-C7luvaG8.js} +13 -15
  132. package/lib/store/store.d.ts +2 -22
  133. package/lib/style.css +1 -1
  134. package/lib/{textarea-tOsPnxHf.js → textarea-CkVKMPqK.js} +1 -1
  135. package/lib/{textarea-BAolHF_W.cjs → textarea-Cn75Cm2n.cjs} +1 -1
  136. package/lib/{updatePosition-CDK7OR0i.js → updatePosition-DRmKQBGm.js} +2 -2
  137. package/lib/utils/checkIsVideoUrl.d.ts +1 -0
  138. package/lib/utils/customEvents/events.constant.d.ts +1 -0
  139. package/lib/utils/mitt.d.ts +6 -3
  140. package/package.json +1 -1
  141. package/lib/ActionMenuButton-BYu0NyVo.cjs +0 -1
  142. package/lib/Drawer-DNaDMoAk.cjs +0 -1
  143. package/lib/Excalidraw-DnHTVOj8.js +0 -355
  144. package/lib/Excalidraw-DxfO1lQ_.cjs +0 -1
  145. package/lib/Icon-C0TJMAOm.js +0 -12
  146. package/lib/Icon-DzK0_ztP.cjs +0 -1
  147. package/lib/Iframe-BSNCsofW.cjs +0 -1
  148. package/lib/Image-BZEFuS0P.js +0 -925
  149. package/lib/Image-iKsGKjvg.cjs +0 -1
  150. package/lib/Indent-Bou16OcB.cjs +0 -1
  151. package/lib/Katex-BqDocr3a.cjs +0 -4
  152. package/lib/LinkEditBlock-B0I0EUrt.cjs +0 -5
  153. package/lib/SlashCommandNodeView-BEJhEzba.cjs +0 -1
  154. package/lib/Table-BclWwp6P.cjs +0 -9
  155. package/lib/Twitter-Dtq6PEMC.cjs +0 -1
  156. package/lib/button-Bwn6gUuS.js +0 -43
  157. package/lib/button-CqJztfH2.cjs +0 -1
  158. package/lib/checkbox-BAzbZY2Y.cjs +0 -1
  159. package/lib/checkbox-B_rpz5Xq.js +0 -27
  160. package/lib/dialog-CJvpoeMm.js +0 -101
  161. package/lib/dialog-CWYTvz5J.cjs +0 -1
  162. package/lib/events.constant-Dq21NPdV.cjs +0 -1
  163. package/lib/events.constant-do95b767.js +0 -21
  164. package/lib/extensions/Image/store.d.ts +0 -4
  165. package/lib/extensions/Video/store.d.ts +0 -4
  166. package/lib/file-BLas99n7.js +0 -43
  167. package/lib/file-i7e4nQY2.cjs +0 -1
  168. package/lib/index-CL7JP-Xz.js +0 -426
  169. package/lib/index-Cn-t3Zxw.cjs +0 -1
  170. package/lib/index-DoiuU6VA.js +0 -2315
  171. package/lib/index-VhKd73hZ.cjs +0 -1
  172. package/lib/input-B1egKb-t.js +0 -21
  173. package/lib/input-ZGRt7lWR.cjs +0 -1
  174. package/lib/isNumber-BTYSVlKo.cjs +0 -1
  175. package/lib/isNumber-ClwLypY2.js +0 -15
  176. package/lib/label-Cjrzc5H2.js +0 -19
  177. package/lib/label-tzSPdqui.cjs +0 -1
  178. package/lib/separator-CUh5Y7Rh.cjs +0 -1
  179. package/lib/store/fast-context.d.ts +0 -7
  180. package/lib/store-BsJz5QRC.js +0 -10
  181. package/lib/store-DjkMIIEN.cjs +0 -1
  182. package/lib/tabs-BP8ypR_m.cjs +0 -1
  183. package/lib/tabs-CBDjOLl_.js +0 -46
  184. package/lib/throttle-D040PfWL.js +0 -249
  185. package/lib/throttle-gTTvqDTW.cjs +0 -1
  186. package/lib/toggle-C_SSvDRy.cjs +0 -1
  187. package/lib/toggle-DEerYRil.js +0 -99
  188. package/lib/tooltip-BJIvosho.js +0 -24
  189. package/lib/tooltip-FS1rsvd3.cjs +0 -1
  190. package/lib/useButtonProps-CtZCbMQu.js +0 -136
  191. package/lib/useButtonProps-Cz4W5dC8.cjs +0 -1
  192. package/lib/utils/_event.d.ts +0 -13
  193. package/lib/utils/customEvents/customEvents.d.ts +0 -3
package/lib/TaskList.js CHANGED
@@ -1,33 +1,31 @@
1
- import { T as u, a as l } from "./index-DR5tIdL7.js";
2
- import { jsx as a, Fragment as f } from "react/jsx-runtime";
3
- import { A as k } from "./toggle-DEerYRil.js";
1
+ import { T as u, a as l } from "./index-Do_dsOGB.js";
2
+ import { jsx as a, Fragment as k } from "react/jsx-runtime";
3
+ import { u as T, d as f, A as v } from "./index-RcSPeQHn.js";
4
4
  import "react";
5
- import "./index-DoiuU6VA.js";
6
5
  import "./theme.js";
7
- import { u as T, a as v } from "./useButtonProps-CtZCbMQu.js";
8
- function K() {
6
+ function y() {
9
7
  const t = T(A.name), {
10
- icon: o = void 0,
11
- tooltip: s = void 0,
8
+ icon: s = void 0,
9
+ tooltip: o = void 0,
12
10
  shortcutKeys: i = void 0,
13
11
  tooltipOptions: r = {},
14
12
  action: e = void 0,
15
13
  isActive: c = void 0
16
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: m, disabled: n, update: p } = v(c), d = () => {
14
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: n, update: p } = f(c), m = () => {
17
15
  n || e && (e(), p());
18
16
  };
19
17
  return t ? /* @__PURE__ */ a(
20
- k,
18
+ v,
21
19
  {
22
- action: d,
23
- dataState: m,
20
+ action: m,
21
+ dataState: d,
24
22
  disabled: n,
25
- icon: o,
23
+ icon: s,
26
24
  shortcutKeys: i,
27
- tooltip: s,
25
+ tooltip: o,
28
26
  tooltipOptions: r
29
27
  }
30
- ) : /* @__PURE__ */ a(f, {});
28
+ ) : /* @__PURE__ */ a(k, {});
31
29
  }
32
30
  const A = /* @__PURE__ */ u.extend({
33
31
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -44,14 +42,14 @@ const A = /* @__PURE__ */ u.extend({
44
42
  class: "task-list-item"
45
43
  }
46
44
  },
47
- button: ({ editor: o, t: s, extension: i }) => ({
45
+ button: ({ editor: s, t: o, extension: i }) => ({
48
46
  componentProps: {
49
- action: () => o.commands.toggleTaskList(),
50
- isActive: () => o.isActive("taskList"),
47
+ action: () => s.commands.toggleTaskList(),
48
+ isActive: () => s.isActive("taskList"),
51
49
  disabled: !1,
52
50
  icon: "ListTodo",
53
51
  shortcutKeys: i.options.shortcutKeys ?? ["shift", "mod", "9"],
54
- tooltip: s("editor.tasklist.tooltip")
52
+ tooltip: o("editor.tasklist.tooltip")
55
53
  }
56
54
  })
57
55
  };
@@ -61,6 +59,6 @@ const A = /* @__PURE__ */ u.extend({
61
59
  }
62
60
  });
63
61
  export {
64
- K as RichTextTaskList,
62
+ y as RichTextTaskList,
65
63
  A as TaskList
66
64
  };
package/lib/TextAlign.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),m=require("react"),M=require("./toggle-C_SSvDRy.cjs");require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const y=require("./useButtonProps-Cz4W5dC8.cjs"),T=require("./popover-C6Cya3Cz.cjs"),S=require("./Icon-DzK0_ztP.cjs"),j=require("./tooltip-FS1rsvd3.cjs");var K=q.Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),P=K;function R(){const[e,t]=m.useState(!1),n=y.useButtonProps(C.name),{icon:g=void 0,tooltip:f=void 0,items:r=[],isActive:A=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:l,dataState:c}=y.useActive(A),u=m.useMemo(()=>(c==null?void 0:c.title)||"",[c]),x=m.useMemo(()=>r==null?void 0:r.some(i=>i.title===u),[r,u]);return n?s.jsxs(T.Popover,{modal:!0,onOpenChange:t,open:e,children:[s.jsx(T.PopoverTrigger,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent","data-state":x?"on":"off",disabled:l,children:s.jsx(M.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:g,tooltip:f,children:s.jsx(S.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),s.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:r==null?void 0:r.map((i,p)=>{var o,a;return s.jsxs(j.Tooltip,{children:[s.jsx(j.TooltipTrigger,{asChild:!0,children:s.jsx(M.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":u===i.title?"on":"off",size:"sm",onClick:()=>{i==null||i.action(),t(!1)},children:(i==null?void 0:i.icon)&&s.jsx(S.IconComponent,{name:i.icon})})}),s.jsxs(j.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[s.jsx("span",{children:i.title}),!!((o=i.shortcutKeys)!=null&&o.length)&&s.jsx("span",{children:(a=i.shortcutKeys)==null?void 0:a.map(h=>y.getShortcutKey(h)).join(" ")})]})]},`text-align-${p}`)})})]}):s.jsx(s.Fragment,{})}const C=P.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["heading","paragraph","list_item","title"],button({editor:t,extension:n,t:g}){var c,u,x,i,p;const f=((c=n.options)==null?void 0:c.alignments)||[],r={left:((u=n.options.shortcutKeys)==null?void 0:u[0])??["mod","Shift","L"],center:((x=n.options.shortcutKeys)==null?void 0:x[1])??["mod","Shift","E"],right:((i=n.options.shortcutKeys)==null?void 0:i[2])??["mod","Shift","R"],justify:((p=n.options.shortcutKeys)==null?void 0:p[3])??["mod","Shift","J"]},A={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},l=f.map(o=>{var a,h,v;return{title:g(`editor.textalign.${o}.tooltip`),icon:A[o],shortcutKeys:r[o],isActive:()=>t.isActive({textAlign:o})||!1,action:()=>{var d,b;return(b=(d=t.commands)==null?void 0:d.setTextAlign)==null?void 0:b.call(d,o)},disabled:!((v=(h=(a=t==null?void 0:t.can)==null?void 0:a.call(t))==null?void 0:h.setTextAlign)!=null&&v.call(h,o))}});return{componentProps:{icon:"AlignJustify",tooltip:g("editor.textalign.tooltip"),items:l,isActive:()=>l==null?void 0:l.find(a=>a.isActive())}}}}}});exports.RichTextAlign=R;exports.TextAlign=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),y=require("react"),r=require("./index-BnVcq33n.cjs");require("./theme.cjs");const T=require("./popover-DIMT3pae.cjs");var S=M.Extension.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),C=S;function K(){const[e,t]=y.useState(!1),n=r.useButtonProps(b.name),{icon:x=void 0,tooltip:A=void 0,items:l=[],isActive:m=void 0}=(n==null?void 0:n.componentProps)??{},{disabled:c,dataState:a}=r.useActive(m),h=y.useMemo(()=>(a==null?void 0:a.title)||"",[a]),d=y.useMemo(()=>l==null?void 0:l.some(i=>i.title===h),[l,h]);return n?s.jsxs(T.Popover,{modal:!0,onOpenChange:t,open:e,children:[s.jsx(T.PopoverTrigger,{asChild:!0,className:"hover:richtext-bg-accent data-[state=on]:richtext-bg-accent","data-state":d?"on":"off",disabled:c,children:s.jsx(r.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:c,icon:x,tooltip:A,children:s.jsx(r.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),s.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",children:l==null?void 0:l.map((i,p)=>{var o,u;return s.jsxs(r.Tooltip,{children:[s.jsx(r.TooltipTrigger,{asChild:!0,children:s.jsx(r.Toggle,{className:"richtext-size-7 richtext-p-1","data-state":h===i.title?"on":"off",size:"sm",onClick:()=>{i==null||i.action(),t(!1)},children:(i==null?void 0:i.icon)&&s.jsx(r.IconComponent,{name:i.icon})})}),s.jsxs(r.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[s.jsx("span",{children:i.title}),!!((o=i.shortcutKeys)!=null&&o.length)&&s.jsx("span",{children:(u=i.shortcutKeys)==null?void 0:u.map(g=>r.getShortcutKey(g)).join(" ")})]})]},`text-align-${p}`)})})]}):s.jsx(s.Fragment,{})}const b=C.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["heading","paragraph","list_item","title"],button({editor:t,extension:n,t:x}){var a,h,d,i,p;const A=((a=n.options)==null?void 0:a.alignments)||[],l={left:((h=n.options.shortcutKeys)==null?void 0:h[0])??["mod","Shift","L"],center:((d=n.options.shortcutKeys)==null?void 0:d[1])??["mod","Shift","E"],right:((i=n.options.shortcutKeys)==null?void 0:i[2])??["mod","Shift","R"],justify:((p=n.options.shortcutKeys)==null?void 0:p[3])??["mod","Shift","J"]},m={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},c=A.map(o=>{var u,g,j;return{title:x(`editor.textalign.${o}.tooltip`),icon:m[o],shortcutKeys:l[o],isActive:()=>t.isActive({textAlign:o})||!1,action:()=>{var f,v;return(v=(f=t.commands)==null?void 0:f.setTextAlign)==null?void 0:v.call(f,o)},disabled:!((j=(g=(u=t==null?void 0:t.can)==null?void 0:u.call(t))==null?void 0:g.setTextAlign)!=null&&j.call(g,o))}});return{componentProps:{icon:"AlignJustify",tooltip:x("editor.textalign.tooltip"),items:c,isActive:()=>c==null?void 0:c.find(u=>u.isActive())}}}}}});exports.RichTextAlign=K;exports.TextAlign=b;
package/lib/TextAlign.js CHANGED
@@ -1,13 +1,9 @@
1
- import { E as C } from "./clsx-DSzxBzvL.js";
2
- import { jsx as o, Fragment as K, jsxs as A } from "react/jsx-runtime";
1
+ import { E as C } from "./clsx-DaPvp9ji.js";
2
+ import { jsx as o, Fragment as K, jsxs as m } from "react/jsx-runtime";
3
3
  import M, { useMemo as v } from "react";
4
- import { A as S, T as j } from "./toggle-DEerYRil.js";
5
- import "./index-DoiuU6VA.js";
4
+ import { u as S, e as j, A as P, I as b, T as w, a as N, k as z, b as L, l as O } from "./index-RcSPeQHn.js";
6
5
  import "./theme.js";
7
- import { u as P, b as w, h as N } from "./useButtonProps-CtZCbMQu.js";
8
- import { P as z, a as L, b as O } from "./popover-CeY3RbI5.js";
9
- import { I as b } from "./Icon-C0TJMAOm.js";
10
- import { T as R, a as _, b as $ } from "./tooltip-BJIvosho.js";
6
+ import { P as R, a as _, b as $ } from "./popover-CtinPbiy.js";
11
7
  var E = C.create({
12
8
  name: "textAlign",
13
9
  addOptions() {
@@ -50,33 +46,33 @@ var E = C.create({
50
46
  };
51
47
  }
52
48
  }), J = E;
53
- function X() {
54
- const [e, t] = M.useState(!1), n = P(B.name), {
55
- icon: p = void 0,
49
+ function Q() {
50
+ const [e, t] = M.useState(!1), n = S(B.name), {
51
+ icon: g = void 0,
56
52
  tooltip: x = void 0,
57
53
  items: r = [],
58
- isActive: m = void 0
59
- } = (n == null ? void 0 : n.componentProps) ?? {}, { disabled: l, dataState: a } = w(m), h = v(() => (a == null ? void 0 : a.title) || "", [a]), g = v(() => r == null ? void 0 : r.some((i) => i.title === h), [r, h]);
60
- return n ? /* @__PURE__ */ A(
61
- z,
54
+ isActive: A = void 0
55
+ } = (n == null ? void 0 : n.componentProps) ?? {}, { disabled: l, dataState: a } = j(A), h = v(() => (a == null ? void 0 : a.title) || "", [a]), p = v(() => r == null ? void 0 : r.some((i) => i.title === h), [r, h]);
56
+ return n ? /* @__PURE__ */ m(
57
+ R,
62
58
  {
63
59
  modal: !0,
64
60
  onOpenChange: t,
65
61
  open: e,
66
62
  children: [
67
63
  /* @__PURE__ */ o(
68
- L,
64
+ _,
69
65
  {
70
66
  asChild: !0,
71
67
  className: "hover:richtext-bg-accent data-[state=on]:richtext-bg-accent",
72
- "data-state": g ? "on" : "off",
68
+ "data-state": p ? "on" : "off",
73
69
  disabled: l,
74
70
  children: /* @__PURE__ */ o(
75
- S,
71
+ P,
76
72
  {
77
73
  customClass: "!richtext-w-12 richtext-h-12",
78
74
  disabled: l,
79
- icon: p,
75
+ icon: g,
80
76
  tooltip: x,
81
77
  children: /* @__PURE__ */ o(
82
78
  b,
@@ -90,16 +86,16 @@ function X() {
90
86
  }
91
87
  ),
92
88
  /* @__PURE__ */ o(
93
- O,
89
+ $,
94
90
  {
95
91
  align: "start",
96
92
  className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
97
93
  side: "bottom",
98
94
  children: r == null ? void 0 : r.map((i, d) => {
99
95
  var s, c;
100
- return /* @__PURE__ */ A(R, { children: [
101
- /* @__PURE__ */ o(_, { asChild: !0, children: /* @__PURE__ */ o(
102
- j,
96
+ return /* @__PURE__ */ m(w, { children: [
97
+ /* @__PURE__ */ o(N, { asChild: !0, children: /* @__PURE__ */ o(
98
+ z,
103
99
  {
104
100
  className: "richtext-size-7 richtext-p-1",
105
101
  "data-state": h === i.title ? "on" : "off",
@@ -110,9 +106,9 @@ function X() {
110
106
  children: (i == null ? void 0 : i.icon) && /* @__PURE__ */ o(b, { name: i.icon })
111
107
  }
112
108
  ) }),
113
- /* @__PURE__ */ A($, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
109
+ /* @__PURE__ */ m(L, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
114
110
  /* @__PURE__ */ o("span", { children: i.title }),
115
- !!((s = i.shortcutKeys) != null && s.length) && /* @__PURE__ */ o("span", { children: (c = i.shortcutKeys) == null ? void 0 : c.map((u) => N(u)).join(" ") })
111
+ !!((s = i.shortcutKeys) != null && s.length) && /* @__PURE__ */ o("span", { children: (c = i.shortcutKeys) == null ? void 0 : c.map((u) => O(u)).join(" ") })
116
112
  ] })
117
113
  ] }, `text-align-${d}`);
118
114
  })
@@ -133,15 +129,15 @@ const B = /* @__PURE__ */ J.extend({
133
129
  button({
134
130
  editor: t,
135
131
  extension: n,
136
- t: p
132
+ t: g
137
133
  }) {
138
- var a, h, g, i, d;
134
+ var a, h, p, i, d;
139
135
  const x = ((a = n.options) == null ? void 0 : a.alignments) || [], r = {
140
136
  left: ((h = n.options.shortcutKeys) == null ? void 0 : h[0]) ?? ["mod", "Shift", "L"],
141
- center: ((g = n.options.shortcutKeys) == null ? void 0 : g[1]) ?? ["mod", "Shift", "E"],
137
+ center: ((p = n.options.shortcutKeys) == null ? void 0 : p[1]) ?? ["mod", "Shift", "E"],
142
138
  right: ((i = n.options.shortcutKeys) == null ? void 0 : i[2]) ?? ["mod", "Shift", "R"],
143
139
  justify: ((d = n.options.shortcutKeys) == null ? void 0 : d[3]) ?? ["mod", "Shift", "J"]
144
- }, m = {
140
+ }, A = {
145
141
  left: "AlignLeft",
146
142
  center: "AlignCenter",
147
143
  right: "AlignRight",
@@ -149,8 +145,8 @@ const B = /* @__PURE__ */ J.extend({
149
145
  }, l = x.map((s) => {
150
146
  var c, u, y;
151
147
  return {
152
- title: p(`editor.textalign.${s}.tooltip`),
153
- icon: m[s],
148
+ title: g(`editor.textalign.${s}.tooltip`),
149
+ icon: A[s],
154
150
  shortcutKeys: r[s],
155
151
  isActive: () => t.isActive({ textAlign: s }) || !1,
156
152
  action: () => {
@@ -163,7 +159,7 @@ const B = /* @__PURE__ */ J.extend({
163
159
  return {
164
160
  componentProps: {
165
161
  icon: "AlignJustify",
166
- tooltip: p("editor.textalign.tooltip"),
162
+ tooltip: g("editor.textalign.tooltip"),
167
163
  items: l,
168
164
  isActive: () => l == null ? void 0 : l.find((c) => c.isActive())
169
165
  }
@@ -173,6 +169,6 @@ const B = /* @__PURE__ */ J.extend({
173
169
  }
174
170
  });
175
171
  export {
176
- X as RichTextAlign,
172
+ Q as RichTextAlign,
177
173
  B as TextAlign
178
174
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./clsx-CXbNJWDD.cjs"),e=require("react/jsx-runtime"),j=require("react"),m=require("./toggle-C_SSvDRy.cjs");require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const d=require("./useButtonProps-Cz4W5dC8.cjs"),T=require("./popover-C6Cya3Cz.cjs"),D=require("./Icon-DzK0_ztP.cjs"),g=require("./tooltip-FS1rsvd3.cjs");function b(){const i=d.useButtonProps(v.name),[c,u]=j.useState(!1),{icon:x=void 0,tooltip:h=void 0,items:s=[],isActive:p=void 0}=(i==null?void 0:i.componentProps)??{},{editorDisabled:l,dataState:o}=d.useActive(p),n=j.useMemo(()=>(o==null?void 0:o.dir)||"unset",[o]);return i?e.jsxs(T.Popover,{open:c,onOpenChange:u,modal:!0,children:[e.jsx(T.PopoverTrigger,{asChild:!0,disabled:l,children:e.jsx(m.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:l,icon:x,tooltip:h,children:e.jsx(D.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),e.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",hideWhenDetached:!0,children:s==null?void 0:s.map((t,r)=>{var a,f;return e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{"data-state":n===t.value?"on":"off",asChild:!0,children:e.jsx(m.Toggle,{className:"richtext-size-7 richtext-p-1",onClick:()=>{t==null||t.action(),u(!1)},size:"sm",children:(t==null?void 0:t.icon)&&e.jsx(D.IconComponent,{name:t.icon})})}),e.jsxs(g.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[e.jsx("span",{children:t.title}),!!((a=t.shortcutKeys)!=null&&a.length)&&e.jsx("span",{children:(f=t.shortcutKeys)==null?void 0:f.map(q=>d.getShortcutKey(q)).join(" ")})]})]},`text-direction-${r}`)})})]}):e.jsx(e.Fragment,{})}const v=C.Extension.create({name:"richTextTextDirection",addOptions(){var i;return{...(i=this.parent)==null?void 0:i.call(this),directions:["auto","ltr","rtl","unset"],defaultDirection:"auto",button({editor:c,extension:u,t:x}){var l;const h=((l=u.options)==null?void 0:l.directions)||[],s={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft",unset:"X"},p=h.map(o=>({title:x(`editor.textDirection.${o}.tooltip`),value:o,icon:s[o],action:()=>{var n,t,r,a;if(o==="unset"){(t=(n=c.commands)==null?void 0:n.unsetTextDirection)==null||t.call(n);return}(a=(r=c.commands)==null?void 0:r.setTextDirection)==null||a.call(r,o)},disabled:!1}));return{componentProps:{icon:"TextDirection",tooltip:x("editor.textDirection.tooltip"),items:p,isActive:()=>c.getAttributes("paragraph")}}}}}});exports.RichTextTextDirection=b;exports.TextDirection=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./clsx-CXbNJWDD.cjs"),e=require("react/jsx-runtime"),f=require("react"),o=require("./index-BnVcq33n.cjs");require("./theme.cjs");const T=require("./popover-DIMT3pae.cjs");function v(){const n=o.useButtonProps(m.name),[s,u]=f.useState(!1),{icon:h=void 0,tooltip:d=void 0,items:l=[],isActive:p=void 0}=(n==null?void 0:n.componentProps)??{},{editorDisabled:a,dataState:i}=o.useActive(p),r=f.useMemo(()=>(i==null?void 0:i.dir)||"unset",[i]);return n?e.jsxs(T.Popover,{open:s,onOpenChange:u,modal:!0,children:[e.jsx(T.PopoverTrigger,{asChild:!0,disabled:a,children:e.jsx(o.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:a,icon:h,tooltip:d,children:e.jsx(o.IconComponent,{className:"richtext-ml-1 richtext-size-3 richtext-text-zinc-500",name:"MenuDown"})})}),e.jsx(T.PopoverContent,{align:"start",className:"richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",side:"bottom",hideWhenDetached:!0,children:l==null?void 0:l.map((t,c)=>{var x,g;return e.jsxs(o.Tooltip,{children:[e.jsx(o.TooltipTrigger,{"data-state":r===t.value?"on":"off",asChild:!0,children:e.jsx(o.Toggle,{className:"richtext-size-7 richtext-p-1",onClick:()=>{t==null||t.action(),u(!1)},size:"sm",children:(t==null?void 0:t.icon)&&e.jsx(o.IconComponent,{name:t.icon})})}),e.jsxs(o.TooltipContent,{className:"richtext-flex richtext-flex-col richtext-items-center",children:[e.jsx("span",{children:t.title}),!!((x=t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:(g=t.shortcutKeys)==null?void 0:g.map(j=>o.getShortcutKey(j)).join(" ")})]})]},`text-direction-${c}`)})})]}):e.jsx(e.Fragment,{})}const m=D.Extension.create({name:"richTextTextDirection",addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),directions:["auto","ltr","rtl","unset"],defaultDirection:"auto",button({editor:s,extension:u,t:h}){var a;const d=((a=u.options)==null?void 0:a.directions)||[],l={auto:"TextDirection",ltr:"LeftToRight",rtl:"RightToLeft",unset:"X"},p=d.map(i=>({title:h(`editor.textDirection.${i}.tooltip`),value:i,icon:l[i],action:()=>{var r,t,c,x;if(i==="unset"){(t=(r=s.commands)==null?void 0:r.unsetTextDirection)==null||t.call(r);return}(x=(c=s.commands)==null?void 0:c.setTextDirection)==null||x.call(c,i)},disabled:!1}));return{componentProps:{icon:"TextDirection",tooltip:h("editor.textDirection.tooltip"),items:p,isActive:()=>s.getAttributes("paragraph")}}}}}});exports.RichTextTextDirection=v;exports.TextDirection=m;
@@ -1,34 +1,30 @@
1
- import { E as g } from "./clsx-DSzxBzvL.js";
1
+ import { E as g } from "./clsx-DaPvp9ji.js";
2
2
  import { jsx as o, Fragment as D, jsxs as x } from "react/jsx-runtime";
3
3
  import v, { useMemo as b } from "react";
4
- import { A as C, T as A } from "./toggle-DEerYRil.js";
5
- import "./index-DoiuU6VA.js";
4
+ import { u as C, e as A, A as P, I as f, T as w, a as z, k as N, b as R, l as j } from "./index-RcSPeQHn.js";
6
5
  import "./theme.js";
7
- import { u as P, b as w, h as z } from "./useButtonProps-CtZCbMQu.js";
8
- import { P as N, a as R, b as j } from "./popover-CeY3RbI5.js";
9
- import { I as f } from "./Icon-C0TJMAOm.js";
10
- import { T as y, a as K, b as M } from "./tooltip-BJIvosho.js";
11
- function q() {
12
- const i = P(O.name), [c, h] = v.useState(!1), {
6
+ import { P as y, a as K, b as M } from "./popover-CtinPbiy.js";
7
+ function F() {
8
+ const i = C(O.name), [c, h] = v.useState(!1), {
13
9
  icon: p = void 0,
14
10
  tooltip: u = void 0,
15
11
  items: s = [],
16
12
  isActive: d = void 0
17
- } = (i == null ? void 0 : i.componentProps) ?? {}, { editorDisabled: a, dataState: e } = w(d), r = b(() => (e == null ? void 0 : e.dir) || "unset", [e]);
13
+ } = (i == null ? void 0 : i.componentProps) ?? {}, { editorDisabled: a, dataState: e } = A(d), r = b(() => (e == null ? void 0 : e.dir) || "unset", [e]);
18
14
  return i ? /* @__PURE__ */ x(
19
- N,
15
+ y,
20
16
  {
21
17
  open: c,
22
18
  onOpenChange: h,
23
19
  modal: !0,
24
20
  children: [
25
21
  /* @__PURE__ */ o(
26
- R,
22
+ K,
27
23
  {
28
24
  asChild: !0,
29
25
  disabled: a,
30
26
  children: /* @__PURE__ */ o(
31
- C,
27
+ P,
32
28
  {
33
29
  customClass: "!richtext-w-12 richtext-h-12",
34
30
  disabled: a,
@@ -46,7 +42,7 @@ function q() {
46
42
  }
47
43
  ),
48
44
  /* @__PURE__ */ o(
49
- j,
45
+ M,
50
46
  {
51
47
  align: "start",
52
48
  className: "richtext-flex richtext-w-full richtext-min-w-4 richtext-flex-row richtext-gap-1 !richtext-p-[4px]",
@@ -54,14 +50,14 @@ function q() {
54
50
  hideWhenDetached: !0,
55
51
  children: s == null ? void 0 : s.map((t, n) => {
56
52
  var l, m;
57
- return /* @__PURE__ */ x(y, { children: [
53
+ return /* @__PURE__ */ x(w, { children: [
58
54
  /* @__PURE__ */ o(
59
- K,
55
+ z,
60
56
  {
61
57
  "data-state": r === t.value ? "on" : "off",
62
58
  asChild: !0,
63
59
  children: /* @__PURE__ */ o(
64
- A,
60
+ N,
65
61
  {
66
62
  className: "richtext-size-7 richtext-p-1",
67
63
  onClick: () => {
@@ -73,9 +69,9 @@ function q() {
73
69
  )
74
70
  }
75
71
  ),
76
- /* @__PURE__ */ x(M, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
72
+ /* @__PURE__ */ x(R, { className: "richtext-flex richtext-flex-col richtext-items-center", children: [
77
73
  /* @__PURE__ */ o("span", { children: t.title }),
78
- !!((l = t.shortcutKeys) != null && l.length) && /* @__PURE__ */ o("span", { children: (m = t.shortcutKeys) == null ? void 0 : m.map((T) => z(T)).join(" ") })
74
+ !!((l = t.shortcutKeys) != null && l.length) && /* @__PURE__ */ o("span", { children: (m = t.shortcutKeys) == null ? void 0 : m.map((T) => j(T)).join(" ") })
79
75
  ] })
80
76
  ] }, `text-direction-${n}`);
81
77
  })
@@ -131,6 +127,6 @@ const O = /* @__PURE__ */ g.create({
131
127
  }
132
128
  });
133
129
  export {
134
- q as RichTextTextDirection,
130
+ F as RichTextTextDirection,
135
131
  O as TextDirection
136
132
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),h=require("./toggle-C_SSvDRy.cjs");require("react");require("./index-Cn-t3Zxw.cjs");require("./theme.cjs");const a=require("./useButtonProps-Cz4W5dC8.cjs");var k=u.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",u.mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),v=k;function x(){const e=a.useButtonProps(l.name),{icon:t=void 0,tooltip:n=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:i=void 0,isActive:c=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:m,disabled:d,update:p}=a.useToggleActive(c),g=()=>{d||i&&(i(),p())};return e?s.jsx(h.ActionButton,{action:g,dataState:m,disabled:d,icon:t,shortcutKeys:o,tooltip:n,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:n,extension:o}){return{componentProps:{action:()=>t.commands.toggleUnderline(),isActive:()=>t.isActive("underline")||!1,disabled:!1,icon:"Underline",shortcutKeys:o.options.shortcutKeys??["mod","U"],tooltip:n("editor.underline.tooltip")}}}}}});exports.RichTextUnderline=x;exports.TextUnderline=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),d=require("./index-BnVcq33n.cjs");require("react");require("./theme.cjs");var h=a.Mark.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",a.mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,n){return n.applyMark(this.name||"underline",n.parseInline(e.tokens||[]))},renderMarkdown(e,n){return`++${n.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,n,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),k=h;function v(){const e=d.useButtonProps(l.name),{icon:n=void 0,tooltip:t=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:i=void 0,isActive:c=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:m,disabled:u,update:p}=d.useToggleActive(c),g=()=>{u||i&&(i(),p())};return e?s.jsx(d.ActionButton,{action:g,dataState:m,disabled:u,icon:n,shortcutKeys:o,tooltip:t,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=k.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:n,t,extension:o}){return{componentProps:{action:()=>n.commands.toggleUnderline(),isActive:()=>n.isActive("underline")||!1,disabled:!1,icon:"Underline",shortcutKeys:o.options.shortcutKeys??["mod","U"],tooltip:t("editor.underline.tooltip")}}}}}});exports.RichTextUnderline=v;exports.TextUnderline=l;
@@ -1,10 +1,8 @@
1
- import { M as m, m as p } from "./clsx-DSzxBzvL.js";
1
+ import { M as m, m as p } from "./clsx-DaPvp9ji.js";
2
2
  import { jsx as d, Fragment as g } from "react/jsx-runtime";
3
- import { A as f } from "./toggle-DEerYRil.js";
3
+ import { u as f, d as h, A as k } from "./index-RcSPeQHn.js";
4
4
  import "react";
5
- import "./index-DoiuU6VA.js";
6
5
  import "./theme.js";
7
- import { u as h, a as k } from "./useButtonProps-CtZCbMQu.js";
8
6
  var M = m.create({
9
7
  name: "underline",
10
8
  addOptions() {
@@ -66,19 +64,19 @@ var M = m.create({
66
64
  };
67
65
  }
68
66
  }), v = M;
69
- function K() {
70
- const e = h(U.name), {
67
+ function w() {
68
+ const e = f(U.name), {
71
69
  icon: t = void 0,
72
70
  tooltip: n = void 0,
73
71
  shortcutKeys: i = void 0,
74
72
  tooltipOptions: r = {},
75
73
  action: o = void 0,
76
74
  isActive: a = void 0
77
- } = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: u, disabled: s, update: l } = k(a), c = () => {
75
+ } = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: u, disabled: s, update: l } = h(a), c = () => {
78
76
  s || o && (o(), l());
79
77
  };
80
78
  return e ? /* @__PURE__ */ d(
81
- f,
79
+ k,
82
80
  {
83
81
  action: c,
84
82
  dataState: u,
@@ -113,6 +111,6 @@ const U = /* @__PURE__ */ v.extend({
113
111
  }
114
112
  });
115
113
  export {
116
- K as RichTextUnderline,
114
+ w as RichTextUnderline,
117
115
  U as TextUnderline
118
116
  };
@@ -0,0 +1 @@
1
+ "use strict";const S=require("./clsx-CXbNJWDD.cjs"),t=require("react/jsx-runtime"),h=require("react"),z=require("./index-BnVcq33n.cjs");require("./theme.cjs");const qt=require("./index-BsFvo9PG.cjs"),we=require("./popover-DIMT3pae.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,16 +1,10 @@
1
- import { j as U, aa as rt, h as Mt, N as jt, m as Wt, ab as Bt, k as Ft } from "./clsx-DSzxBzvL.js";
1
+ import { j as U, a8 as rt, h as Mt, N as jt, m as Wt, a9 as Bt, k as Ft } from "./clsx-DaPvp9ji.js";
2
2
  import { jsx as r, jsxs as h, Fragment as Pt } from "react/jsx-runtime";
3
3
  import Be, { useState as se, Fragment as Ut, useEffect as Fe, useMemo as Pe, createContext as zt, useLayoutEffect as Ht, useContext as Gt, useRef as K, useCallback as Te, useDebugValue as Xt } from "react";
4
- import { A as Kt } from "./toggle-DEerYRil.js";
5
- import "./index-DoiuU6VA.js";
4
+ import { L as Kt, j as Qt, B as Jt, h as Yt, u as Zt, d as en, A as tn, I as nn } from "./index-RcSPeQHn.js";
6
5
  import "./theme.js";
7
- import { u as Qt } from "./index-C07N8gA1.js";
8
- import { L as Jt } from "./label-Cjrzc5H2.js";
9
- import { I as Yt } from "./input-B1egKb-t.js";
10
- import { B as Zt } from "./button-Bwn6gUuS.js";
11
- import { c as en, u as tn, a as nn } from "./useButtonProps-CtZCbMQu.js";
12
- import { P as rn, a as on, b as an } from "./popover-CeY3RbI5.js";
13
- import { I as sn } from "./Icon-C0TJMAOm.js";
6
+ import { u as rn } from "./index-C07N8gA1.js";
7
+ import { P as on, a as an, b as sn } from "./popover-CtinPbiy.js";
14
8
  const cn = "_verified_lvyh0_1", Ue = {
15
9
  verified: cn
16
10
  }, ln = () => /* @__PURE__ */ r("svg", {
@@ -1538,7 +1532,7 @@ function ea({ node: e }) {
1538
1532
  return n ? /* @__PURE__ */ r(Mt, { children: /* @__PURE__ */ r("div", { "data-twitter": "", children: /* @__PURE__ */ r(Zo, { id: n }) }) }) : null;
1539
1533
  }
1540
1534
  function ta(e) {
1541
- const { t } = Qt(), [n, o] = se("");
1535
+ const { t } = rn(), [n, o] = se("");
1542
1536
  Fe(() => {
1543
1537
  var i;
1544
1538
  if (e != null && e.editor) {
@@ -1555,9 +1549,9 @@ function ta(e) {
1555
1549
  className: "richtext-flex richtext-flex-col richtext-gap-2",
1556
1550
  onSubmit: a,
1557
1551
  children: [
1558
- /* @__PURE__ */ r(Jt, { className: "mb-[6px]", children: t("editor.link.dialog.text") }),
1552
+ /* @__PURE__ */ r(Kt, { className: "mb-[6px]", children: t("editor.link.dialog.text") }),
1559
1553
  /* @__PURE__ */ r("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ r("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ r(
1560
- Yt,
1554
+ Qt,
1561
1555
  {
1562
1556
  className: "richtext-w-80",
1563
1557
  onChange: (i) => o(i.target.value),
@@ -1568,7 +1562,7 @@ function ta(e) {
1568
1562
  }
1569
1563
  ) }) }),
1570
1564
  /* @__PURE__ */ r(
1571
- Zt,
1565
+ Jt,
1572
1566
  {
1573
1567
  className: "richtext-mt-2 richtext-self-end",
1574
1568
  type: "submit",
@@ -1579,36 +1573,36 @@ function ta(e) {
1579
1573
  }
1580
1574
  );
1581
1575
  }
1582
- function ga() {
1583
- const [e, t] = se(!1), n = en(), o = tn(Lt.name), {
1576
+ function fa() {
1577
+ const [e, t] = se(!1), n = Yt(), o = Zt(Lt.name), {
1584
1578
  icon: a = void 0,
1585
1579
  tooltip: i = void 0,
1586
1580
  tooltipOptions: s = {},
1587
1581
  action: c = void 0,
1588
1582
  isActive: f = void 0
1589
- } = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: d } = nn(f);
1583
+ } = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: d } = en(f);
1590
1584
  function g(m) {
1591
1585
  d || c && (c(m), t(!1));
1592
1586
  }
1593
1587
  return /* @__PURE__ */ h(
1594
- rn,
1588
+ on,
1595
1589
  {
1596
1590
  modal: !0,
1597
1591
  onOpenChange: t,
1598
1592
  open: e,
1599
1593
  children: [
1600
- /* @__PURE__ */ r(on, { asChild: !0, children: /* @__PURE__ */ r(
1601
- Kt,
1594
+ /* @__PURE__ */ r(an, { asChild: !0, children: /* @__PURE__ */ r(
1595
+ tn,
1602
1596
  {
1603
1597
  disabled: d,
1604
1598
  isActive: f,
1605
1599
  tooltip: i,
1606
1600
  tooltipOptions: s,
1607
- children: /* @__PURE__ */ r(sn, { name: a })
1601
+ children: /* @__PURE__ */ r(nn, { name: a })
1608
1602
  }
1609
1603
  ) }),
1610
1604
  /* @__PURE__ */ r(
1611
- an,
1605
+ sn,
1612
1606
  {
1613
1607
  align: "start",
1614
1608
  className: "richtext-w-full",
@@ -1702,6 +1696,6 @@ const Lt = /* @__PURE__ */ jt.create({
1702
1696
  });
1703
1697
  export {
1704
1698
  ta as F,
1705
- ga as R,
1699
+ fa as R,
1706
1700
  Lt as T
1707
1701
  };
package/lib/Twitter.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const t=require("./Twitter-Dtq6PEMC.cjs");exports.RichTextTwitter=t.RichTextTwitter;exports.Twitter=t.Twitter;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const t=require("./Twitter-BbMD3Ybp.cjs");exports.RichTextTwitter=t.RichTextTwitter;exports.Twitter=t.Twitter;
package/lib/Twitter.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./clsx-DSzxBzvL.js";
2
- import { R as i, T } from "./Twitter-4U_ZBhpv.js";
1
+ import "./clsx-DaPvp9ji.js";
2
+ import { R as i, T } from "./Twitter-D8Cbgl7g.js";
3
3
  export {
4
4
  i as RichTextTwitter,
5
5
  T as Twitter