reactjs-tiptap-editor 0.3.12 → 0.3.13

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 (126) hide show
  1. package/lib/{ActionMenuButton-BQ2ojtpo.js → ActionMenuButton-BfH5nAGi.js} +1 -1
  2. package/lib/{ActionMenuButton-OfnmanTP.cjs → ActionMenuButton-Cbbnqd-L.cjs} +1 -1
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +5 -5
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +2 -2
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +2 -2
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/Clear.cjs +1 -1
  12. package/lib/Clear.js +2 -2
  13. package/lib/Code.cjs +1 -1
  14. package/lib/Code.js +2 -2
  15. package/lib/CodeBlock.cjs +1 -1
  16. package/lib/CodeBlock.js +3 -3
  17. package/lib/CodeView.cjs +1 -1
  18. package/lib/CodeView.js +2 -2
  19. package/lib/Color.cjs +1 -1
  20. package/lib/Color.js +3 -3
  21. package/lib/Document.js +1 -1
  22. package/lib/{Drawer-9QMJnenp.js → Drawer-DUXFBfgE.js} +3 -3
  23. package/lib/{Drawer-BN8H4Zb2.cjs → Drawer-jPHImfyr.cjs} +1 -1
  24. package/lib/Drawer.cjs +1 -1
  25. package/lib/Drawer.js +4 -4
  26. package/lib/Emoji.cjs +1 -1
  27. package/lib/Emoji.js +4 -4
  28. package/lib/{Excalidraw-B95hkXm5.js → Excalidraw-BBOIIhij.js} +3 -3
  29. package/lib/{Excalidraw-iG1WleD5.cjs → Excalidraw-CwZ3g3p-.cjs} +1 -1
  30. package/lib/Excalidraw.cjs +1 -1
  31. package/lib/Excalidraw.js +3 -3
  32. package/lib/ExportPdf.cjs +1 -1
  33. package/lib/ExportPdf.js +2 -2
  34. package/lib/ExportWord.cjs +1 -1
  35. package/lib/ExportWord.js +2 -2
  36. package/lib/FontFamily.cjs +1 -1
  37. package/lib/FontFamily.js +4 -4
  38. package/lib/FontSize.cjs +1 -1
  39. package/lib/FontSize.js +3 -3
  40. package/lib/FormatPainter.cjs +1 -1
  41. package/lib/FormatPainter.js +2 -2
  42. package/lib/Heading.cjs +1 -1
  43. package/lib/Heading.js +3 -3
  44. package/lib/Highlight.cjs +1 -1
  45. package/lib/Highlight.js +2 -2
  46. package/lib/History.cjs +1 -1
  47. package/lib/History.js +2 -2
  48. package/lib/HorizontalRule.cjs +1 -1
  49. package/lib/HorizontalRule.js +2 -2
  50. package/lib/Iframe.cjs +1 -1
  51. package/lib/Iframe.js +3 -3
  52. package/lib/Image.cjs +1 -1
  53. package/lib/Image.js +3 -3
  54. package/lib/ImageGif.cjs +1 -1
  55. package/lib/ImageGif.js +3 -3
  56. package/lib/ImportWord.cjs +1 -1
  57. package/lib/ImportWord.js +2 -2
  58. package/lib/Indent.cjs +1 -1
  59. package/lib/Indent.js +2 -2
  60. package/lib/Italic.cjs +1 -1
  61. package/lib/Italic.js +2 -2
  62. package/lib/Katex.cjs +1 -1
  63. package/lib/Katex.js +4 -4
  64. package/lib/LineHeight.cjs +1 -1
  65. package/lib/LineHeight.js +2 -2
  66. package/lib/Link.cjs +1 -5
  67. package/lib/Link.d.cts +3 -1
  68. package/lib/Link.d.ts +3 -1
  69. package/lib/Link.js +4 -1048
  70. package/lib/ListItem.js +1 -1
  71. package/lib/Mention.js +3 -3
  72. package/lib/Mermaid.cjs +2 -2
  73. package/lib/Mermaid.js +4 -4
  74. package/lib/MoreMark.cjs +1 -1
  75. package/lib/MoreMark.js +3 -3
  76. package/lib/MultiColumn.cjs +1 -1
  77. package/lib/MultiColumn.js +2 -2
  78. package/lib/OrderedList.cjs +1 -1
  79. package/lib/OrderedList.js +2 -2
  80. package/lib/RichTextEditor-C3sK_Ys3.cjs +141 -0
  81. package/lib/{RichTextEditor-CFwUKN9i.js → RichTextEditor-OW4s40FH.js} +4817 -3766
  82. package/lib/SearchAndReplace.cjs +1 -1
  83. package/lib/SearchAndReplace.js +2 -2
  84. package/lib/Selection.js +1 -1
  85. package/lib/SlashCommand.cjs +1 -1
  86. package/lib/SlashCommand.js +18 -18
  87. package/lib/Strike.cjs +1 -1
  88. package/lib/Strike.js +2 -2
  89. package/lib/SubAndSuperScript.cjs +1 -1
  90. package/lib/SubAndSuperScript.js +3 -3
  91. package/lib/Table.cjs +2 -2
  92. package/lib/Table.js +16 -16
  93. package/lib/TableOfContent.cjs +1 -1
  94. package/lib/TableOfContent.js +5 -5
  95. package/lib/TaskList.cjs +1 -1
  96. package/lib/TaskList.js +2 -2
  97. package/lib/TextAlign.cjs +1 -1
  98. package/lib/TextAlign.js +2 -2
  99. package/lib/TextBubble.cjs +1 -1
  100. package/lib/TextBubble.js +2 -2
  101. package/lib/TextDirection.cjs +1 -1
  102. package/lib/TextDirection.js +2 -2
  103. package/lib/TextUnderline.cjs +1 -1
  104. package/lib/TextUnderline.js +2 -2
  105. package/lib/TrailingNode.js +1 -1
  106. package/lib/{Twitter-ChRmdJB0.js → Twitter-2LOf4hFb.js} +44 -44
  107. package/lib/{Twitter-DbokWMq-.cjs → Twitter-Cg58uzB-.cjs} +3 -3
  108. package/lib/Twitter.cjs +1 -1
  109. package/lib/Twitter.js +3 -3
  110. package/lib/Video.cjs +1 -1
  111. package/lib/Video.js +2 -2
  112. package/lib/bubble-extra.cjs +2 -2
  113. package/lib/bubble-extra.js +6 -6
  114. package/lib/{dom-dataset-2RXYq9wp.js → dom-dataset-CHDbKz5J.js} +1 -1
  115. package/lib/{index-CXIIg9Sq.js → index-BWx1Mchx.js} +21 -21
  116. package/lib/{index-BGwJ0NfQ.js → index-DEFQHExY.js} +1 -1
  117. package/lib/{index-BkoojfPK.js → index-DIPntess.js} +1 -1
  118. package/lib/{index-fKx6CYUM.js → index-oQutU45z.js} +1 -1
  119. package/lib/index.cjs +1 -1
  120. package/lib/index.d.cts +2 -0
  121. package/lib/index.d.ts +2 -0
  122. package/lib/index.js +43 -43
  123. package/lib/{textarea-D5VHsW3K.js → textarea-DM-_io94.js} +1 -1
  124. package/lib/{textarea-BfhvC1nW.cjs → textarea-DNz8Tnud.cjs} +1 -1
  125. package/package.json +1 -1
  126. package/lib/RichTextEditor-COwI-b24.cjs +0 -137
@@ -1,7 +1,7 @@
1
1
  import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import n from "react";
3
3
  import { Slot as a } from "@radix-ui/react-slot";
4
- import { i as r, T as d, a as m, B as f, b as u, g } from "./RichTextEditor-CFwUKN9i.js";
4
+ import { i as r, T as d, a as m, B as f, b as u, g } from "./RichTextEditor-OW4s40FH.js";
5
5
  const T = n.forwardRef(
6
6
  ({ asChild: l, ...t }, x) => {
7
7
  var h;
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),r=require("react"),a=require("@radix-ui/react-slot"),i=require("./RichTextEditor-COwI-b24.cjs"),d=r.forwardRef(({asChild:n,...t},h)=>{var x;const c=i.icons[t.icon],l=n?a.Slot:i.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(l,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",disabled:t==null?void 0:t.disabled,ref:h,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),c&&e.jsx(c,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),e.jsx(i.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[(t==null?void 0:t.tooltip)&&e.jsx("div",{children:t==null?void 0:t.tooltip}),e.jsx("div",{className:"richtext-flex",children:!!((x=t==null?void 0:t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=d;
1
+ "use strict";const e=require("react/jsx-runtime"),r=require("react"),a=require("@radix-ui/react-slot"),i=require("./RichTextEditor-C3sK_Ys3.cjs"),d=r.forwardRef(({asChild:n,...t},h)=>{var x;const c=i.icons[t.icon],l=n?a.Slot:i.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(l,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",disabled:t==null?void 0:t.disabled,ref:h,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),c&&e.jsx(c,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),e.jsx(i.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[(t==null?void 0:t.tooltip)&&e.jsx("div",{children:t==null?void 0:t.tooltip}),e.jsx("div",{className:"richtext-flex",children:!!((x=t==null?void 0:t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=d;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-CSvnpArE.cjs"),i=require("./dom-dataset-Cuy-pIfj.cjs"),a=require("./RichTextEditor-COwI-b24.cjs"),e=require("react/jsx-runtime"),p=require("lucide-react"),g=require("react"),V=require("./index-Dz3YxLE7.cjs"),S={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">
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-CSvnpArE.cjs"),i=require("./dom-dataset-Cuy-pIfj.cjs"),a=require("./RichTextEditor-C3sK_Ys3.cjs"),e=require("react/jsx-runtime"),p=require("lucide-react"),g=require("react"),V=require("./index-Dz3YxLE7.cjs"),S={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
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
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
4
  </svg>`,word:`<svg
@@ -16,4 +16,4 @@
16
16
  fill="currentColor"
17
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
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 D(t){const n=S[t],l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,o=["svg",{...Array.from(l.attributes).reduce((r,c)=>(r[c.name]=c.value,r),{})}];return Array.from(l.childNodes).forEach(r=>{if(r.nodeType===1){const c=[r.tagName.toLowerCase(),Array.from(r.attributes).reduce((v,x)=>(v[x.name]=x.value,v),{})];r.textContent&&c.push(r.textContent),o.push(c)}}),o}const B={audio:e.jsx(p.LucideAudioLines,{}),video:e.jsx(p.LucideVideo,{}),file:e.jsx(p.LucideFile,{}),image:e.jsx(p.LucideImage,{}),pdf:e.jsx(a.ExportPdf,{}),word:e.jsx(a.ExportWord,{}),excel:e.jsx(p.LucideSheet,{}),ppt:e.jsx(p.LucideTableProperties,{})};function A(t,n=!1){const s=a.normalizeFileType(t),d=B[s]||e.jsx(e.Fragment,{});return n?D(s):d}const _="_wrap_1x1ms_2",j={wrap:_};function q({editor:t,node:n,updateAttributes:s,deleteNode:d,extension:l}){var M;const o=g.useRef(null),r=a.useEditableEditor(),{hasTrigger:c,fileName:v,fileSize:x,fileExt:L,fileType:C,url:u,error:k}=n.attrs,[H,f]=g.useState(!1),{t:y}=V.useLocale(),N=(M=l==null?void 0:l.options)==null?void 0:M.upload,m=g.useCallback(()=>{!r||u||r&&o.current.click()},[r,u]),z=g.useCallback(async T=>{const h=T.target.files&&T.target.files[0];if(!h)return;const F={fileName:a.extractFilename(h.name),fileSize:h.size,fileType:h.type,fileExt:a.extractFileExtension(h.name)};f(!0);try{const w=await N(h);s({...F,url:w}),f(!1)}catch(w){s({error:`File upload fail: ${w&&w.message}`||"Unknown error"}),f(!1),o.current.value=""}},[f,s]);g.useEffect(()=>{!u&&!c&&(m(),s({hasTrigger:!0}))},[u,c,m,s]);const E=g.useCallback(()=>d(),[t]);return r&&!u?e.jsx(i.NodeViewWrapper,{children:e.jsxs("div",{className:i.clsx(j.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:m,style:{cursor:"pointer"},children:H?e.jsx("span",{children:y("editor.attachment.uploading")}):e.jsx("span",{children:y("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:z,ref:o,type:"file"})]})}):u?e.jsx(i.NodeViewWrapper,{children:e.jsxs("div",{className:i.clsx(j.wrap,"render-wrapper"),onClick:m,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:A(C)}),e.jsxs("span",{children:[v,".",L]}),e.jsxs("span",{children:["(",a.normalizeFileSize(x),")"]})]}),e.jsx(a.ActionButton,{action:E,icon:"Trash2",tooltip:y("editor.delete")})]})}):k!=="null"?e.jsx(i.NodeViewWrapper,{children:e.jsx("div",{className:i.clsx(j.wrap,"render-wrapper"),onClick:m,children:e.jsx("p",{children:k})})}):e.jsx(e.Fragment,{})}const R=b.Node.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"attachment"},button:({editor:n,t:s})=>({component:a.ActionButton,componentProps:{action:()=>n.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:s("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:t}){const{url:n="",fileName:s="",fileSize:d="",fileType:l="",fileExt:o=""}=t||{};return["div",b.mergeAttributes(this.options.HTMLAttributes||{},t||{}),n?["a",{href:n||"#"},["span",{class:"attachment__icon"},A(l,!0)],["span",{class:"attachment__text"},`${s}.${o} (${a.normalizeFileSize(d)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{fileName:{default:null,parseHTML:i.getDatasetAttribute("filename")},fileSize:{default:null,parseHTML:i.getDatasetAttribute("filesize")},fileType:{default:null,parseHTML:i.getDatasetAttribute("filetype")},fileExt:{default:null,parseHTML:i.getDatasetAttribute("fileext")},url:{default:null,parseHTML:i.getDatasetAttribute("url")},hasTrigger:{default:!1,parseHTML:t=>i.getDatasetAttribute("hastrigger")(t)==="true"},error:{default:null,parseHTML:i.getDatasetAttribute("error")}}},addCommands(){return{setAttachment:(t={})=>({chain:n})=>n().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return i.ReactNodeViewRenderer(q)}});exports.Attachment=R;
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 D(t){const s=S[t],l=new DOMParser().parseFromString(s,"image/svg+xml").documentElement,o=["svg",{...Array.from(l.attributes).reduce((r,c)=>(r[c.name]=c.value,r),{})}];return Array.from(l.childNodes).forEach(r=>{if(r.nodeType===1){const c=[r.tagName.toLowerCase(),Array.from(r.attributes).reduce((v,x)=>(v[x.name]=x.value,v),{})];r.textContent&&c.push(r.textContent),o.push(c)}}),o}const B={audio:e.jsx(p.LucideAudioLines,{}),video:e.jsx(p.LucideVideo,{}),file:e.jsx(p.LucideFile,{}),image:e.jsx(p.LucideImage,{}),pdf:e.jsx(a.ExportPdf,{}),word:e.jsx(a.ExportWord,{}),excel:e.jsx(p.LucideSheet,{}),ppt:e.jsx(p.LucideTableProperties,{})};function L(t,s=!1){const n=a.normalizeFileType(t),d=B[n]||e.jsx(e.Fragment,{});return s?D(n):d}const _="_wrap_1x1ms_2",k={wrap:_};function q({editor:t,node:s,updateAttributes:n,deleteNode:d,extension:l}){var M;const o=g.useRef(null),r=a.useEditableEditor(),{hasTrigger:c,fileName:v,fileSize:x,fileExt:A,fileType:C,url:u,error:j}=s.attrs,[H,f]=g.useState(!1),{t:y}=V.useLocale(),N=(M=l==null?void 0:l.options)==null?void 0:M.upload,m=g.useCallback(()=>{!r||u||r&&o.current.click()},[r,u]),z=g.useCallback(async T=>{const h=T.target.files&&T.target.files[0];if(!h)return;const F={fileName:a.extractFilename(h.name),fileSize:h.size,fileType:h.type,fileExt:a.extractFileExtension(h.name)};f(!0);try{const w=await N(h);n({...F,url:w}),f(!1)}catch(w){n({error:`File upload fail: ${w&&w.message}`||"Unknown error"}),f(!1),o.current.value=""}},[f,n]);g.useEffect(()=>{!u&&!c&&(m(),n({hasTrigger:!0}))},[u,c,m,n]);const E=g.useCallback(()=>d(),[t]);return r&&!u?e.jsx(i.NodeViewWrapper,{children:e.jsxs("div",{className:i.clsx(k.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:m,style:{cursor:"pointer"},children:H?e.jsx("span",{children:y("editor.attachment.uploading")}):e.jsx("span",{children:y("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:z,ref:o,type:"file"})]})}):u?e.jsx(i.NodeViewWrapper,{children:e.jsxs("div",{className:i.clsx(k.wrap,"render-wrapper"),onClick:m,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:L(C)}),e.jsxs("span",{children:[v,".",A]}),e.jsxs("span",{children:["(",a.normalizeFileSize(x),")"]})]}),e.jsx(a.ActionButton,{action:E,icon:"Trash2",tooltip:y("editor.delete")})]})}):j!=="null"?e.jsx(i.NodeViewWrapper,{children:e.jsx("div",{className:i.clsx(k.wrap,"render-wrapper"),onClick:m,children:e.jsx("p",{children:j})})}):e.jsx(e.Fragment,{})}const R=b.Node.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"attachment"},button:({editor:s,t:n})=>({component:a.ActionButton,componentProps:{action:()=>s.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:n("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:t}){const{url:s="",fileName:n="",fileSize:d="",fileType:l="",fileExt:o=""}=t||{};return["div",b.mergeAttributes(this.options.HTMLAttributes||{},t||{}),s?["a",{href:s||"#"},["span",{class:"attachment__icon"},L(l,!0)],["span",{class:"attachment__text"},`${n}.${o} (${a.normalizeFileSize(d)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{fileName:{default:null,parseHTML:i.getDatasetAttribute("filename")},fileSize:{default:null,parseHTML:i.getDatasetAttribute("filesize")},fileType:{default:null,parseHTML:i.getDatasetAttribute("filetype")},fileExt:{default:null,parseHTML:i.getDatasetAttribute("fileext")},url:{default:null,parseHTML:i.getDatasetAttribute("url")},hasTrigger:{default:!1,parseHTML:t=>i.getDatasetAttribute("hastrigger")(t)==="true"},error:{default:null,parseHTML:i.getDatasetAttribute("error")}}},addCommands(){return{setAttachment:(t={})=>({chain:s})=>s().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return i.ReactNodeViewRenderer(q)}});exports.Attachment=R;
package/lib/Attachment.js CHANGED
@@ -1,6 +1,6 @@
1
- import { N as j, m as $ } from "./index-CXIIg9Sq.js";
2
- import { N as x, c as y, R as D, g as s } from "./dom-dataset-2RXYq9wp.js";
3
- import { X as P, Y as R, Z as I, _ as Z, $ as O, a0 as W, a1 as C, A as N } from "./RichTextEditor-CFwUKN9i.js";
1
+ import { N as j, m as $ } from "./index-BWx1Mchx.js";
2
+ import { N as x, c as y, R as D, g as s } from "./dom-dataset-CHDbKz5J.js";
3
+ import { W as P, X as R, Y as I, Z, _ as W, $ as O, a0 as C, A as N } from "./RichTextEditor-OW4s40FH.js";
4
4
  import { jsx as e, Fragment as A, jsxs as p } from "react/jsx-runtime";
5
5
  import { LucideTableProperties as U, LucideSheet as X, LucideImage as Y, LucideFile as q, LucideVideo as G, LucideAudioLines as J } from "lucide-react";
6
6
  import { useRef as K, useState as Q, useCallback as k, useEffect as ee } from "react";
@@ -77,10 +77,10 @@ function oe({ editor: t, node: n, updateAttributes: i, deleteNode: c, extension:
77
77
  if (!h)
78
78
  return;
79
79
  const B = {
80
- fileName: W(h.name),
80
+ fileName: O(h.name),
81
81
  fileSize: h.size,
82
82
  fileType: h.type,
83
- fileExt: O(h.name)
83
+ fileExt: W(h.name)
84
84
  };
85
85
  g(!0);
86
86
  try {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CSvnpArE.cjs"),r=require("./RichTextEditor-COwI-b24.cjs"),u=/^\s*>\s$/,s=o.Node.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",o.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[o.wrappingInputRule({find:u,type:this.type})]}}),c=s.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:n})=>({component:r.ActionButton,componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote")||!1,disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:["shift","mod","B"],tooltip:n("editor.blockquote.tooltip")}})}}});exports.Blockquote=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CSvnpArE.cjs"),r=require("./RichTextEditor-C3sK_Ys3.cjs"),u=/^\s*>\s$/,s=o.Node.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",o.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[o.wrappingInputRule({find:u,type:this.type})]}}),c=s.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:n})=>({component:r.ActionButton,componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote")||!1,disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:["shift","mod","B"],tooltip:n("editor.blockquote.tooltip")}})}}});exports.Blockquote=c;
package/lib/Blockquote.js CHANGED
@@ -1,5 +1,5 @@
1
- import { N as n, w as r, m as s } from "./index-CXIIg9Sq.js";
2
- import { A as u } from "./RichTextEditor-CFwUKN9i.js";
1
+ import { N as n, w as r, m as s } from "./index-BWx1Mchx.js";
2
+ import { A as u } from "./RichTextEditor-OW4s40FH.js";
3
3
  const c = /^\s*>\s$/, i = n.create({
4
4
  name: "blockquote",
5
5
  addOptions() {
package/lib/Bold.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CSvnpArE.cjs"),n=require("./RichTextEditor-COwI-b24.cjs"),r=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,d=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,a=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,i=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,l=e.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",e.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[e.markInputRule({find:r,type:this.type}),e.markInputRule({find:a,type:this.type})]},addPasteRules(){return[e.markPasteRule({find:d,type:this.type}),e.markPasteRule({find:i,type:this.type})]}}),u=l.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:s,t:o})=>({component:n.ActionButton,componentProps:{action:()=>s.commands.toggleBold(),isActive:()=>s.isActive("bold")||!1,disabled:!1,icon:"Bold",shortcutKeys:["mod","B"],tooltip:o("editor.bold.tooltip")}})}}});exports.Bold=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CSvnpArE.cjs"),o=require("./RichTextEditor-C3sK_Ys3.cjs"),r=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,d=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,a=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,i=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,l=e.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",e.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[e.markInputRule({find:r,type:this.type}),e.markInputRule({find:a,type:this.type})]},addPasteRules(){return[e.markPasteRule({find:d,type:this.type}),e.markPasteRule({find:i,type:this.type})]}}),u=l.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:s,t:n})=>({component:o.ActionButton,componentProps:{action:()=>s.commands.toggleBold(),isActive:()=>s.isActive("bold")||!1,disabled:!1,icon:"Bold",shortcutKeys:["mod","B"],tooltip:n("editor.bold.tooltip")}})}}});exports.Bold=u;
package/lib/Bold.js CHANGED
@@ -1,5 +1,5 @@
1
- import { M as r, c as s, d as o, m as d } from "./index-CXIIg9Sq.js";
2
- import { A as a } from "./RichTextEditor-CFwUKN9i.js";
1
+ import { M as r, c as s, d as o, m as d } from "./index-BWx1Mchx.js";
2
+ import { A as a } from "./RichTextEditor-OW4s40FH.js";
3
3
  const i = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, l = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, u = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, g = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, m = r.create({
4
4
  name: "bold",
5
5
  addOptions() {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CSvnpArE.cjs"),n=require("./RichTextEditor-COwI-b24.cjs"),u="listItem",s="textStyle",o=/^\s*([-+*])\s$/,p=i.Node.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",i.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(u,this.editor.getAttributes(s)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=i.wrappingInputRule({find:o,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=i.wrappingInputRule({find:o,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(s),editor:this.editor})),[t]}}),l=p.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:r})=>({component:n.ActionButton,componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList")||!1,disabled:!1,shortcutKeys:["shift","mod","8"],icon:"List",tooltip:r("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CSvnpArE.cjs"),n=require("./RichTextEditor-C3sK_Ys3.cjs"),u="listItem",s="textStyle",o=/^\s*([-+*])\s$/,p=i.Node.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",i.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(u,this.editor.getAttributes(s)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=i.wrappingInputRule({find:o,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=i.wrappingInputRule({find:o,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(s),editor:this.editor})),[t]}}),l=p.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:r})=>({component:n.ActionButton,componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList")||!1,disabled:!1,shortcutKeys:["shift","mod","8"],icon:"List",tooltip:r("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;
package/lib/BulletList.js CHANGED
@@ -1,5 +1,5 @@
1
- import { N as n, w as s, m as p } from "./index-CXIIg9Sq.js";
2
- import { A as u } from "./RichTextEditor-CFwUKN9i.js";
1
+ import { N as n, w as s, m as p } from "./index-BWx1Mchx.js";
2
+ import { A as u } from "./RichTextEditor-OW4s40FH.js";
3
3
  const l = "listItem", i = "textStyle", o = /^\s*([-+*])\s$/, a = n.create({
4
4
  name: "bulletList",
5
5
  addOptions() {
package/lib/Clear.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-CSvnpArE.cjs"),r=require("./RichTextEditor-COwI-b24.cjs"),a=n.Node.create({name:"clear",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:o})=>({component:r.ActionButton,componentProps:{action:()=>t.chain().focus().clearNodes().unsetAllMarks().run(),disabled:!t.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:o("editor.clear.tooltip")}})}}});exports.Clear=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CSvnpArE.cjs"),r=require("./RichTextEditor-C3sK_Ys3.cjs"),a=o.Node.create({name:"clear",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:n})=>({component:r.ActionButton,componentProps:{action:()=>t.chain().focus().clearNodes().unsetAllMarks().run(),disabled:!t.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:n("editor.clear.tooltip")}})}}});exports.Clear=a;
package/lib/Clear.js CHANGED
@@ -1,5 +1,5 @@
1
- import { N as r } from "./index-CXIIg9Sq.js";
2
- import { A as e } from "./RichTextEditor-CFwUKN9i.js";
1
+ import { N as r } from "./index-BWx1Mchx.js";
2
+ import { A as e } from "./RichTextEditor-OW4s40FH.js";
3
3
  const s = /* @__PURE__ */ r.create({
4
4
  name: "clear",
5
5
  addOptions() {
package/lib/Code.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CSvnpArE.cjs"),n=require("./RichTextEditor-COwI-b24.cjs"),d=/(^|[^`])`([^`]+)`(?!`)/,s=/(^|[^`])`([^`]+)`(?!`)/g,a=t.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",t.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[t.markInputRule({find:d,type:this.type})]},addPasteRules(){return[t.markPasteRule({find:s,type:this.type})]}}),u=a.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:o,t:r})=>({component:n.ActionButton,componentProps:{action:()=>o.commands.toggleCode(),isActive:()=>o.isActive("code")||!1,disabled:!o.can().toggleCode(),icon:"Code",shortcutKeys:["mod","E"],tooltip:r("editor.code.tooltip")}})}}});exports.Code=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CSvnpArE.cjs"),r=require("./RichTextEditor-C3sK_Ys3.cjs"),d=/(^|[^`])`([^`]+)`(?!`)/,s=/(^|[^`])`([^`]+)`(?!`)/g,i=t.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",t.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[t.markInputRule({find:d,type:this.type})]},addPasteRules(){return[t.markPasteRule({find:s,type:this.type})]}}),u=i.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:o,t:n})=>({component:r.ActionButton,componentProps:{action:()=>o.commands.toggleCode(),isActive:()=>o.isActive("code")||!1,disabled:!o.can().toggleCode(),icon:"Code",shortcutKeys:["mod","E"],tooltip:n("editor.code.tooltip")}})}}});exports.Code=u;
package/lib/Code.js CHANGED
@@ -1,5 +1,5 @@
1
- import { M as r, c as n, d as s, m as d } from "./index-CXIIg9Sq.js";
2
- import { A as a } from "./RichTextEditor-CFwUKN9i.js";
1
+ import { M as r, c as n, d as s, m as d } from "./index-BWx1Mchx.js";
2
+ import { A as a } from "./RichTextEditor-OW4s40FH.js";
3
3
  const i = /(^|[^`])`([^`]+)`(?!`)/, u = /(^|[^`])`([^`]+)`(?!`)/g, c = r.create({
4
4
  name: "code",
5
5
  addOptions() {
package/lib/CodeBlock.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Le=require("./index-CSvnpArE.cjs"),fe=require("./dom-dataset-Cuy-pIfj.cjs"),S=require("react/jsx-runtime"),G=require("./RichTextEditor-COwI-b24.cjs"),ge=require("react"),sa=require("@radix-ui/react-select"),et=require("lucide-react");function Sn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ue=Sn(ge),F=Sn(sa),Gt=F.Root,oa=F.Value,gt=ue.forwardRef(({className:e,children:t,...n},i)=>S.jsxs(F.Trigger,{ref:i,className:G.cn("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-ring-offset-background placeholder:richtext-text-muted-foreground focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 [&>span]:richtext-line-clamp-1",e),...n,children:[t,S.jsx(F.Icon,{asChild:!0,children:S.jsx(et.ChevronDown,{className:"richtext-h-4 richtext-w-4 richtext-opacity-50"})})]}));gt.displayName=F.Trigger.displayName;const kn=ue.forwardRef(({className:e,...t},n)=>S.jsx(F.ScrollUpButton,{ref:n,className:G.cn("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...t,children:S.jsx(et.ChevronUp,{className:"richtext-h-4 richtext-w-4"})}));kn.displayName=F.ScrollUpButton.displayName;const Tn=ue.forwardRef(({className:e,...t},n)=>S.jsx(F.ScrollDownButton,{ref:n,className:G.cn("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...t,children:S.jsx(et.ChevronDown,{className:"richtext-h-4 richtext-w-4"})}));Tn.displayName=F.ScrollDownButton.displayName;const mt=ue.forwardRef(({className:e,children:t,position:n="popper",...i},d)=>S.jsx(F.Portal,{children:S.jsxs(F.Content,{ref:d,className:G.cn("richtext-relative richtext-z-50 richtext-max-h-60 richtext-overflow-y-auto richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md richtext-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",n==="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),position:n,...i,children:[S.jsx(kn,{}),S.jsx(F.Viewport,{className:G.cn("richtext-p-1",n==="popper"&&"richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]"),children:t}),S.jsx(Tn,{})]})}));mt.displayName=F.Content.displayName;const la=ue.forwardRef(({className:e,...t},n)=>S.jsx(F.Label,{ref:n,className:G.cn("richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold",e),...t}));la.displayName=F.Label.displayName;const ht=ue.forwardRef(({className:e,children:t,...n},i)=>S.jsxs(F.Item,{ref:i,className:G.cn("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),...n,children:[S.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:S.jsx(F.ItemIndicator,{children:S.jsx(et.Check,{className:"richtext-h-4 richtext-w-4"})})}),S.jsx(F.ItemText,{children:t})]}));ht.displayName=F.Item.displayName;const ca=ue.forwardRef(({className:e,...t},n)=>S.jsx(F.Separator,{ref:n,className:G.cn("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),...t}));ca.displayName=F.Separator.displayName;function da({action:e,...t}){return S.jsx(G.ActionButton,{action:e,disabled:t==null?void 0:t.disabled,icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip})}var Ce={},X=Symbol(),te=Symbol(),Ct=e=>typeof e=="string"?f[e]:e,f={plain:Ce,plaintext:Ce,text:Ce,txt:Ce},Ne=(e,t)=>(t[te]||Oe)(e,t),Oe=(e,t)=>{for(var n=[e],i,d=[],p=0;i=Ct(t[X]);)delete t[X],Object.assign(t,i);for(Ln(e,t,n,0);d[p++]=n[0],n=n[1];);return d},zt="</span>",Me="",Ae="",Nn=e=>{for(var t="",n=e.length,i=0;i<n;)t+=On(e[i++]);return t},On=e=>{if(e instanceof me){var{type:t,alias:n,content:i}=e,d=Me,p=Ae,g=`<span class="token ${t+(n?" "+n:"")+(t=="keyword"&&typeof i=="string"?" keyword-"+i:"")}">`;Ae+=zt,Me+=g;var h=On(i);return Me=d,Ae=p,g+h+zt}return typeof e!="string"?Nn(e):(e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;"),Ae&&e.includes(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Le=require("./index-CSvnpArE.cjs"),fe=require("./dom-dataset-Cuy-pIfj.cjs"),S=require("react/jsx-runtime"),G=require("./RichTextEditor-C3sK_Ys3.cjs"),ge=require("react"),sa=require("@radix-ui/react-select"),et=require("lucide-react");function Sn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const ue=Sn(ge),F=Sn(sa),Gt=F.Root,oa=F.Value,gt=ue.forwardRef(({className:e,children:t,...n},i)=>S.jsxs(F.Trigger,{ref:i,className:G.cn("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-ring-offset-background placeholder:richtext-text-muted-foreground focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 [&>span]:richtext-line-clamp-1",e),...n,children:[t,S.jsx(F.Icon,{asChild:!0,children:S.jsx(et.ChevronDown,{className:"richtext-h-4 richtext-w-4 richtext-opacity-50"})})]}));gt.displayName=F.Trigger.displayName;const kn=ue.forwardRef(({className:e,...t},n)=>S.jsx(F.ScrollUpButton,{ref:n,className:G.cn("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...t,children:S.jsx(et.ChevronUp,{className:"richtext-h-4 richtext-w-4"})}));kn.displayName=F.ScrollUpButton.displayName;const Tn=ue.forwardRef(({className:e,...t},n)=>S.jsx(F.ScrollDownButton,{ref:n,className:G.cn("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...t,children:S.jsx(et.ChevronDown,{className:"richtext-h-4 richtext-w-4"})}));Tn.displayName=F.ScrollDownButton.displayName;const mt=ue.forwardRef(({className:e,children:t,position:n="popper",...i},d)=>S.jsx(F.Portal,{children:S.jsxs(F.Content,{ref:d,className:G.cn("richtext-relative richtext-z-50 richtext-max-h-60 richtext-overflow-y-auto richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md richtext-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",n==="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),position:n,...i,children:[S.jsx(kn,{}),S.jsx(F.Viewport,{className:G.cn("richtext-p-1",n==="popper"&&"richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]"),children:t}),S.jsx(Tn,{})]})}));mt.displayName=F.Content.displayName;const la=ue.forwardRef(({className:e,...t},n)=>S.jsx(F.Label,{ref:n,className:G.cn("richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold",e),...t}));la.displayName=F.Label.displayName;const ht=ue.forwardRef(({className:e,children:t,...n},i)=>S.jsxs(F.Item,{ref:i,className:G.cn("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),...n,children:[S.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:S.jsx(F.ItemIndicator,{children:S.jsx(et.Check,{className:"richtext-h-4 richtext-w-4"})})}),S.jsx(F.ItemText,{children:t})]}));ht.displayName=F.Item.displayName;const ca=ue.forwardRef(({className:e,...t},n)=>S.jsx(F.Separator,{ref:n,className:G.cn("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),...t}));ca.displayName=F.Separator.displayName;function da({action:e,...t}){return S.jsx(G.ActionButton,{action:e,disabled:t==null?void 0:t.disabled,icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip})}var Ce={},X=Symbol(),te=Symbol(),Ct=e=>typeof e=="string"?f[e]:e,f={plain:Ce,plaintext:Ce,text:Ce,txt:Ce},Ne=(e,t)=>(t[te]||Oe)(e,t),Oe=(e,t)=>{for(var n=[e],i,d=[],p=0;i=Ct(t[X]);)delete t[X],Object.assign(t,i);for(Ln(e,t,n,0);d[p++]=n[0],n=n[1];);return d},zt="</span>",Me="",Ae="",Nn=e=>{for(var t="",n=e.length,i=0;i<n;)t+=On(e[i++]);return t},On=e=>{if(e instanceof me){var{type:t,alias:n,content:i}=e,d=Me,p=Ae,g=`<span class="token ${t+(n?" "+n:"")+(t=="keyword"&&typeof i=="string"?" keyword-"+i:"")}">`;Ae+=zt,Me+=g;var h=On(i);return Me=d,Ae=p,g+h+zt}return typeof e!="string"?Nn(e):(e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;"),Ae&&e.includes(`
2
2
  `)?e.replace(/\n/g,Ae+`
3
3
  `+Me):e)},Ln=(e,t,n,i,d)=>{for(var p in t)if(t[p])for(var g=0,h=t[p],E=Array.isArray(h)?h:[h];g<E.length;++g){if(d&&d[0]==p&&d[1]==g)return;for(var y=E[g],l=y.pattern||y,c=Ct(y.inside),w=y.lookbehind,m=y.greedy&&l.global,_=y.alias,a=n,r=i;a&&(!d||r<d[2]);r+=a[0].length,a=a[1]){var u=a[0],o=0,s,b;if(!(u instanceof me)){if(l.lastIndex=m?r:0,s=l.exec(m?e:u),s&&w&&s[1]&&(b=s[1].length,s.index+=b,s[0]=s[0].slice(b)),m){if(!s)break;if(s[0]){for(var k=s.index,R=k+s[0].length,A;k>=r+(A=a[0].length);a=a[1],r+=A);if(a[0]instanceof me)continue;for(var v=a,h=r;(h+=v[0].length)<R;v=v[1],o++);u=e.slice(r,h),s.index-=r}}if(s&&s[0]){for(var k=s.index,N=s[0],T=u.slice(k+N.length),L=r+u.length,P=new me(p,c?Ne(N,c):N,N,_),M=a,Z=0,H;M=M[1],Z++<o;);T&&(!M||M[0]instanceof me?M=[T,M]:M[0]=T+M[0]),r+=k,a[0]=k?u.slice(0,k):P,k?a=a[1]=[P,M]:a[1]=M,o&&(Ln(e,t,a,r,H=[p,g,L]),L=H[2]),d&&L>d[2]&&(d[2]=L)}}}}};function me(e,t,n,i){this.type=e,this.content=t,this.alias=i,this.length=n.length}var Ve="\\b(?:BASH(?:OPTS|_ALIASES|_ARG[CV]|_CMDS|_COMPLETION_COMPAT_DIR|_LINENO|_REMATCH|_SOURCE|_VERSINFO|_VERSION)?|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|E?UID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_(?:ADDRESS|ALL|IDENTIFICATION|MEASUREMENT|MONETARY|NAME|NUMERIC|PAPER|TELEPHONE|TIME)|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS[1-4]|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_(?:CONFIG_DIRS|CURRENT_DESKTOP|DATA_DIRS|GREETER_DATA_DIR|MENU_PREFIX|RUNTIME_DIR|SEAT|SEAT_PATH|SESSION_DESKTOP|SESSION_ID|SESSION_PATH|SESSION_TYPE|VTNR)|XMODIFIERS)\\b",_t={pattern:/(^(["']?)\w+\2)[ ]+\S.*/,lookbehind:!0,alias:"punctuation"},Cn={variable:/^\$\(|^`|\)$|`$/},Pe={bash:_t,environment:{pattern:RegExp("\\$"+Ve),alias:"constant"},variable:[{pattern:/\$?\(\([^]*?\)\)/g,greedy:!0,inside:{variable:[{pattern:/(^\$[^]+)../,lookbehind:!0},/^\$\(\(/],number:/\b0x[a-fA-F\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|&&|\|\||(?:\*\*|<<|>>|[%&|^!=<>/*+-])=?|[?:~]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:[^()]|\([^)]*\))*\)|`[^`]+`/g,greedy:!0,inside:Cn},{pattern:/\$\{[^}]*\}/g,greedy:!0,inside:{operator:/:[?=+-]?|[!/]|##?|%%?|\^\^?|,,?/,punctuation:/[[\]]/,environment:{pattern:RegExp("(\\{)"+Ve),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[a-fA-F\d]{8}|u[a-fA-F\d]{4}|x[a-fA-F\d]{1,2})/},ua=_t.inside=f.sh=f.shell=f.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,lookbehind:!0,alias:"variable"},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,lookbehind:!0,alias:"variable",inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+Ve),lookbehind:!0,alias:"constant"}}},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?![^\s=])/,lookbehind:!0,alias:"variable"},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[^]*?\n\2/g,lookbehind:!0,greedy:!0,inside:Pe},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[^]*?\n\3/g,lookbehind:!0,greedy:!0,inside:{bash:_t}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[^]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^\\"`$])*"/g,lookbehind:!0,greedy:!0,inside:Pe},{pattern:/(^|[^$\\])'[^']*'/g,lookbehind:!0,greedy:!0},{pattern:/\$'(?:\\[^]|[^\\'])*'/g,greedy:!0,inside:{entity:Pe.entity}}],environment:{pattern:RegExp("\\$?"+Ve),alias:"constant"},variable:Pe.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|c?fdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cron|crontab|c?split|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff3?|dig|dircolors|dirname|dirs?|dmesg|docker|docker-compose|du|[ef]?grep|eject|env|ethtool|expand|expect|expr|fdformat|fg|file|find|fmt|fold|format|free|fsck|fuser|g?awk|git|g?parted|groupadd|groupdel|groupmod|groups|grub-mkconfig|halt|head|hg|history|host|hostname|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|killall|less|link|ln|logname|logrotate|look|lpc|lprint[dq]?|lprm?|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mm?v|more|most|mtools|m?tr|mutt|nano|nc|netstat|nice|nl|node|nohup|notify-send|nslookup|op|open|passwd|paste|pathchk|ping|p?kill|p?npm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ra[mr]|reboot|remsync|rename|renice|rev|rmdir|rp?m|r?sync|[sr]?cp|screen|sdiff|se[dq]|sendmail|service|s?ftp|shellcheck|shuf|shutdown|sleep|s?locate|[sz]?sh|stat|strace|sudo|sum?|suspend|swapon|sysctl|tac|tail|tar|tee|time|timeout|h?top|touch|traceroute|t?sort|tty|u?mount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vim?|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|g?zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|[ls]et|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[[\]{};\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}};["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"].forEach(e=>Cn[e]=ua[e]);var Mn=/(?:"(?:\\[^]|[^\\\n"])*"|'(?:\\[^]|[^\\\n'])*')/g,$e=Mn.source,jt={rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^)]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}};jt[X]=f.css={comment:/\/\*[^]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|${$e})*?(?:;|(?=\\s*\\{))`),inside:jt},url:{pattern:RegExp(`\\burl\\((?:${$e}|(?:[^\\\\
4
4
  "')=]|\\\\[^])*)\\)`,"gi"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+$e+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|${$e})*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:Mn,greedy:!0},property:{pattern:/(^|[^-\w\xa0-\uffff])(?!\d)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z\d])[-a-z\d]+(?=\()/i,lookbehind:!0},punctuation:/[(){},:;]/};var Be=(e,t)=>{if(t.has(e))return t.get(e);var n=e,i=pa.call(e).slice(8,-1);if(i=="Object"){t.set(e,n={});for(var d in e)n[d]=Be(e[d],t);e[X]&&(n[X]=Be(e[X],t)),e[te]&&(n[te]=e[te])}else if(i=="Array"){t.set(e,n=[]);for(var p=0,g=e.length;p<g;p++)n[p]=Be(e[p],t)}return n},tt=e=>Be(e,new Map),ie=(e,t)=>Object.assign(tt(f[e]),t),$=(e,t,n)=>{var i={};for(var d in e)i[d]=e[d],delete e[d];for(var d in i)d==t&&Object.assign(e,n),n.hasOwnProperty(d)||(e[d]=i[d])},pa={}.toString,Ze=f.css,Ht={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},Vt={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};Ze.selector.inside=Ze.atrule.inside["selector-function-argument"].inside={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:/\[(?:[^[\]"']|(["'])(?:\\[^]|(?!\1)[^\\\n])*\1)*\]/g,greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xa0-\uffff])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xa0-\uffff])+/,lookbehind:!0},"attr-value":{pattern:/(=\s*)(?:(?!\s)[-\w\xa0-\uffff])+(?=\s*$)|(["'])(?:\\[^]|(?!\2)[^\\\n])*\2/,lookbehind:!0},operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/};$(Ze,"property",{variable:{pattern:/(^|[^-\w\xa0-\uffff])--(?!\d)(?:(?!\s)[-\w\xa0-\uffff])*/i,lookbehind:!0}});$(Ze,"function",{operator:{pattern:/(\s)[/*+-](?!\S)/,lookbehind:!0},hexcode:{pattern:/\B#[a-f\d]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:(?:alice|cadet|cornflower|deepsky|dodger|midnight|powder|royal|sky|steel)blue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blueviolet|brown|burlywood|chartreuse|chocolate|coral|cornsilk|crimson|(?:dark)?(?:blue|cyan|goldenrod|gr[ae]y|green|khaki|magenta|olivegreen|orange|orchid|red|salmon|seagreen|slateblue|slategr[ae]y|turquoise|violet)|deeppink|dimgr[ae]y|firebrick|floralwhite|(?:forest|lawn|lime|pale|spring)green|fuchsia|gainsboro|ghostwhite|gold|greenyellow|honeydew|hotpink|indianred|indigo|ivory|lavender|lavenderblush|lemonchiffon|light(?:blue|coral|cyan|goldenrodyellow|gr[ae]y|green|pink|salmon|seagreen|skyblue|slategr[ae]y|steelblue|yellow)|lime|linen|maroon|medium(?:aquamarine|blue|orchid|purple|seagreen|slateblue|springgreen|turquoise|violetred)|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orangered|palegoldenrod|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|purple|rebeccapurple|rosybrown|saddlebrown|sandybrown|seashell|sienna|silver|snow|tan|teal|thistle|tomato|transparent|wheat|white|whitesmoke|yellow|yellowgreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{function:/^[^(]+/,unit:Ht,number:Vt,punctuation:/[(),]/}}],entity:/\\[a-f\d]{1,8}/i,unit:Ht,number:Vt});f.ini={comment:{pattern:/(^[ \f \v]*)[#;].*/m,lookbehind:!0},section:{pattern:/(^[ \f \v]*)\[[^\n\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f \v]*)[^ \f \v\]]+(?:[ \f \v]+[^ \f \v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/[[\]]/}},key:{pattern:/(^[ \f \v]*)[^ \f\n \v=]+(?:[ \f \v]+[^ \f\n \v=]+)*(?=[ \f \v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f \v]*)[^ \f\n \v]+(?:[ \f \v]+[^ \f\n \v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^(["']).+(?=\1$)/,lookbehind:!0}}},punctuation:/=/};var se=()=>({pattern:/\/\/.*|\/\*[^]*?(?:\*\/|$)/g,greedy:!0}),Mt=()=>({pattern:/(["'])(?:\\[^]|(?!\1)[^\\\n])*\1/g,greedy:!0}),Pn=/\b0x[a-f\d]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,ae=/[()[\]{}.,:;]/,K=/\b(?:false|true)\b/,st={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[^]+/}};st.expression.inside=f.kts=f.kt=f.kotlin={"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:st},string:/[^]+/}},{pattern:/"(?:\\.|[^\\\n"$]|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\\\)*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:st},string:/[^]+/}}],char:{pattern:/'(?:[^\\\n']|\\(?:.|u[a-fA-F\d]{0,4}))'/g,greedy:!0},comment:se(),annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"},keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},boolean:K,label:{pattern:/\b\w+@|@\w+/,alias:"symbol"},function:{pattern:/(?:`[^\n`]+`|\b\w+)(?=\s*\()|(\.)(?:`[^\n`]+`|\w+)(?=\s*\{)/g,lookbehind:!0,greedy:!0},number:/\b(?:0[xX][a-fA-F\d]+(?:_[a-fA-F\d]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/--|\+\+|&&|\|\||->|[!=]==|!!|[%!=<>/*+-]=?|[?:]:?|\.\.|\b(?:and|inv|shl|u?shr|x?or)\b/,punctuation:ae};var $n=[{pattern:/&[a-z\d]{1,8};/i,alias:"named-entity"},/&#x?[a-f\d]{1,8};/i],ba={pattern:/<\/?(?!\d)[^\s/=>$<%]+(?:\s(?:\s*[^\s/=>]+(?:\s*=\s*(?!\s)(?:"[^"]*"|'[^']*'|[^\s"'=>]+(?=[\s>]))?|(?=[\s/>])))+)?\s*\/?>/g,greedy:!0,inside:{punctuation:/^<\/?|\/?>$/,tag:{pattern:/^\S+/,inside:{namespace:/^[^:]+:/}},"attr-value":[{pattern:/(=\s*)(?:"[^"]*"|'[^']*'|[^\s"'=>]+)/g,lookbehind:!0,greedy:!0,inside:{punctuation:/^["']|["']$/,entity:$n}}],"attr-equals":/=/,"attr-name":{pattern:/\S+/,inside:{namespace:/^[^:]+:/}}}};f.rss=f.atom=f.ssml=f.xml={comment:{pattern:/<!--(?:(?!<!--)[^])*?-->/g,greedy:!0},prolog:{pattern:/<\?[^]+?\?>/g,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/gi,greedy:!0,inside:{"internal-subset":{pattern:/(\[)[^]+(?=\]\s*>$)/,lookbehind:!0,inside:"xml"},string:/"[^"]*"|'[^']*'/,punctuation:/^<!|[>[\]]/,"doctype-tag":/^DOCTYPE/i,name:/\S+/}},cdata:{pattern:/<!\[CDATA\[[^]*?\]\]>/gi,greedy:!0},tag:ba,entity:$n,"markup-bracket":{pattern:/[()[\]{}]/,alias:"punctuation"}};var Et=(e,t)=>(e["language-"+t]={pattern:/[^]+/,inside:t},e),Zt=(e,t)=>({pattern:RegExp(`(<${e}[^>]*>)(?!</${e}>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])+?(?=</${e}>)`,"gi"),lookbehind:!0,greedy:!0,inside:Et({"included-cdata":{pattern:/<!\[CDATA\[[^]*?\]\]>/i,inside:Et({cdata:/^<!\[CDATA\[|\]\]>$/i},t)}},t)}),qt=(e,t)=>({pattern:RegExp(`((?:^|["'\\s])(?:${e})\\s*=\\s*)(?:"[^"]*"|'[^']*'|[^\\s"'=>]+)`,"gi"),lookbehind:!0,greedy:!0,inside:Et({punctuation:/^["']|["']$/},t)}),Dn=f.svg=f.mathml=f.html=f.markup=tt(f.xml);Dn.tag.inside["attr-value"].unshift(qt("style","css"),qt("on[a-z]+","javascript"));$(Dn,"cdata",{style:Zt("style","css"),script:Zt("script","javascript")});f.r={comment:/#.*/,string:{pattern:/(["'])(?:\\.|(?!\1)[^\\\n])*\1/g,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[a-fA-F\d]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->>?|<=|<<?-|[!=<>]=?|::?|&&?|\|\|?|[~^$@/*+-]/,punctuation:/[()[\]{},;]/};f.basic={comment:{pattern:/(?:!|rem\b).+/i,inside:{keyword:/^rem/i}},string:{pattern:/"(?:""|[#$%&'().,:;\w ?^!=<>/*+-])*"/g,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,keyword:/\b(?:as|beep|bload|bsave|call absolute|call|case|chain|chdir|clear|close|cls|com|common|const|data|declare|def(?: fn| seg|dbl|int|[ls]ng|str)|dim|do|double|else|elseif|environ|erase|error|exit|field|files|for|function|get|gosub|goto|if|input|integer|ioctl|key|kill|line input|locate|lock|long|loop|[lr]set|mkdir|name|next|off|on(?: com| error| key| timer)?|open|option base|[op]ut|poke|read|redim|rem|restore|resume|return|rmdir|run|select case|shared|shell|single|sleep|static|step|stop|string|sub|swap|system|then|timer|to|troff|tron|type|unlock|until|using|view print|wait|w?end|while|write)(?:\$|\b)/i,function:/\b(?:abs|access|a?cos|angle|area|arithmetic|array|a?sin|ask|atn?|base|begin|break|cause|ceil|chr|clip|collate|color|co[nst]|cosh|csc|date|datum|debug|decimal|de[fgt]|degrees|delete|device|display|dot|elapsed|eps|erasable|exline|exp|external|extype|filetype|fixed|fp|go|graph|handler|idn|image|int?|internal|ip|is|keyed|[lu]bound|[lu]case|left|le[nt]|length|lines?|log2?|log10|[lr]trim|margin|ma[tx]|maxnum|mi[dn]|missing|mod|native|nul|numeric|of|option|ord|organization|outin|output|pi|pointer|points?|pos|print|program|prompt|rad|radians|randomize|record|recsize|rectype|relative|remainder|repeat|rest|retry|rewrite|right|rnd|round|same|se[ct]|select|sequential|setter|sgn|sinh|size|skip|s[qt]r|standard|status|stream|style|tab|tanh?|template|text|there|time|timeout|trace|transform|truncate|use|val|variable|viewport|when|window|with|zer|zonewidth)(?:\$|\b)/i,operator:/<=|<>|>=|[&^=<>/*+-]|\b(?:and|eqv|imp|not|x?or)\b/i,punctuation:/[(),:;]/};f.vbnet=ie("basic",{comment:{pattern:/(?:!|'|rem\b).*/i,inside:{keyword:/^rem/i}},string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/g,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:addhandler|addressof|alias|and|andalso|as|beep|bload|boolean|bsave|byref|byval|call absolute|call|case|catch|cbool|c?byte|cc?har|c?date|cdbl|cdec|chain|chdir|cu?int|class|clear|close|cls|cobj|com|common|const|continue|c?sbyte|c?u?short|c?sng|cstr|c?type|cu?lng|data|decimal|declare|def(?: fn| seg|dbl|int|lng|sng|str)|default|delegate|dim|directcast|do|double|else|elseif|enum|environ|erase|error|event|exit|false|true|field|files|finally|for each|for|friend|function|[gls]et|gettype|getxmlnamespace|global|gosub|goto|handles|i[fns]|implements|imports|inherits|input|interface|ioctl|isnot|key|kill|lib|like|line input|locate|lock|loop|[lr]set|me|mkdir|mod|module|mustinherit|mustoverride|mybase|myclass|name|namespace|narrowing|new|next|not|nothing|notinheritable|notoverridable|object|off?|on (?:com|error|key|timer)|on|open|operator|option base|option|optional|orelse|out|overloads|overridable|overrides|paramarray|partial|poke|private|property|protected|public|put|raiseevent|read|readonly|redim|removehandler|restore|resume|return|rmdir|run|select case|select|shadows|shared|shell|single|sleep|static|step|stop|string|structure|sub|swap|synclock|system|[tw]hen|throw|timer|to|troff|tron|try|trycast|typeof|u?integer|u?long|unlock|until|using|view print|wait|w?end|while|widening|with|withevents|write|writeonly|x?or)|\B#(?:const|else|elseif|end|if))(?:\$|\b)/i,punctuation:/[(){},:;]/});var Kt={pattern:/'(?:\\[^]|[^\\\n']){0,32}'/g,greedy:!0},Wt={pattern:/\/\/(?:[^\\\n]|\\\n?)*|\/\*[^]*?(?:\*\/|$)/g,greedy:!0},Yt={pattern:/"(?:\\[^]|[^\\\n"])*"/g,greedy:!0},Xt={pattern:/\S[^]*/};Xt.inside=f.c={comment:Wt,char:Kt,macro:{pattern:/(^[ ]*)#\s*[a-z](?:[^\\\n/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\[^])*/img,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Yt],char:Kt,comment:Wt,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=\n)/,expression:Xt}},string:Yt,"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([^]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/->|([&|:+-])\1|[?:~]|>>=?|<<=?|[%&|^!=<>/*+-]=?/,punctuation:ae};$(f.opencl=ie("c",{keyword:/\b(?:(?:__)?(?:constant|global|kernel|local|private|read_only|read_write|write_only)|__attribute__|auto|(?:bool|u?(?:char|int|long|short)|half|quad)(?:2|3|4|8|16)?|break|case|complex|const|continue|(?:double|float)(?:16(?:x(?:1|2|4|8|16))?|1x(?:1|2|4|8|16)|2(?:x(?:1|2|4|8|16))?|3|4(?:x(?:1|2|4|8|16))?|8(?:x(?:1|2|4|8|16))?)?|default|do|else|enum|extern|for|goto|if|imaginary|inline|packed|pipe|register|restrict|return|signed|sizeof|static|struct|switch|typedef|uniform|union|unsigned|void|volatile|while)\b/,number:/(?:\b0x(?:[a-f\d]+(?:\.[a-f\d]*)?|\.[a-f\d]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[fuhl]{0,4}/i,boolean:K,"constant-opencl-kernel":{pattern:/\b(?:CHAR_(?:BIT|MAX|MIN)|CLK_(?:ADDRESS_(?:CLAMP(?:_TO_EDGE)?|NONE|REPEAT)|FILTER_(?:LINEAR|NEAREST)|(?:GLOBAL|LOCAL)_MEM_FENCE|NORMALIZED_COORDS_(?:FALSE|TRUE))|CL_(?:BGRA|(?:HALF_)?FLOAT|INTENSITY|LUMINANCE|A?R?G?B?[Ax]?|(?:(?:UN)?SIGNED|[US]NORM)_(?:INT(?:8|16|32))|UNORM_(?:INT_101010|SHORT_(?:555|565)))|(?:DBL|FLT|HALF)_(?:DIG|EPSILON|(?:MAX|MIN)(?:(?:_10)?_EXP)?|MANT_DIG)|FLT_RADIX|HUGE_VALF?|(?:INT|LONG|SCHAR|SHRT)_(?:MAX|MIN)|INFINITY|MAXFLOAT|M_(?:[12]_PI|2_SQRTPI|E|LN2|LN10|LOG2E?|LOG10E?|PI(?:_[24])?|SQRT(?:1_2|2))(?:_F|_H)?|NAN|(?:UCHAR|UINT|ULONG|USHRT)_MAX)\b/,alias:"constant"}}),"class-name",{"builtin-type":{pattern:/\b(?:_cl_(?:command_queue|context|device_id|event|kernel|mem|platform_id|program|sampler)|cl_(?:image_format|mem_fence_flags)|clk_event_t|event_t|image(?:1d_(?:array_|buffer_)?t|2d_(?:array_(?:depth_|msaa_depth_|msaa_)?|depth_|msaa_depth_|msaa_)?t|3d_t)|ndrange_t|ptrdiff_t|queue_t|reserve_id_t|sampler_t|size_t|u?intptr_t)\b/,alias:"keyword"}});var yt={"type-opencl-host":{pattern:/\b(?:cl_(?:GLenum|GLint|GLuin|addressing_mode|bitfield|bool|buffer_create_type|build_status|channel_(?:order|type)|(?:u?(?:char|int|long|short)|double|float)(?:[2348]|16)?|command_(?:queue(?:_info|_properties)?|type)|context(?:_info|_properties)?|device_(?:exec_capabilities|fp_config|id|info|local_mem_type|mem_cache_type|type)|(?:event|sampler)(?:_info)?|filter_mode|half|image_info|kernel(?:_info|_work_group_info)?|map_flags|mem(?:_flags|_info|_object_type)?|platform_(?:id|info)|profiling_info|program(?:_build_info|_info)?))\b/,alias:"keyword"},"boolean-opencl-host":{pattern:/\bCL_(?:FALSE|TRUE)\b/,alias:"boolean"},"constant-opencl-host":{pattern:/\bCL_(?:A|ABGR|ADDRESS_(?:CLAMP(?:_TO_EDGE)?|MIRRORED_REPEAT|NONE|REPEAT)|ARGB|BLOCKING|BUFFER_CREATE_TYPE_REGION|BUILD_(?:ERROR|IN_PROGRESS|NONE|PROGRAM_FAILURE|SUCCESS)|COMMAND_(?:ACQUIRE_GL_OBJECTS|BARRIER|COPY_(?:BUFFER(?:_RECT|_TO_IMAGE)?|IMAGE(?:_TO_BUFFER)?)|FILL_(?:BUFFER|IMAGE)|MAP(?:_BUFFER|_IMAGE)|MARKER|MIGRATE(?:_SVM)?_MEM_OBJECTS|NATIVE_KERNEL|NDRANGE_KERNEL|READ_(?:BUFFER(?:_RECT)?|IMAGE)|RELEASE_GL_OBJECTS|SVM_(?:FREE|MAP|MEMCPY|MEMFILL|UNMAP)|TASK|UNMAP_MEM_OBJECT|USER|WRITE_(?:BUFFER(?:_RECT)?|IMAGE))|COMPILER_NOT_AVAILABLE|COMPILE_PROGRAM_FAILURE|COMPLETE|CONTEXT_(?:DEVICES|INTEROP_USER_SYNC|NUM_DEVICES|PLATFORM|PROPERTIES|REFERENCE_COUNT)|DEPTH(?:_STENCIL)?|DEVICE_(?:ADDRESS_BITS|AFFINITY_DOMAIN_(?:L[1-4]_CACHE|NEXT_PARTITIONABLE|NUMA)|AVAILABLE|BUILT_IN_KERNELS|COMPILER_AVAILABLE|DOUBLE_FP_CONFIG|ENDIAN_LITTLE|ERROR_CORRECTION_SUPPORT|EXECUTION_CAPABILITIES|EXTENSIONS|GLOBAL_(?:MEM_(?:CACHELINE_SIZE|CACHE_SIZE|CACHE_TYPE|SIZE)|VARIABLE_PREFERRED_TOTAL_SIZE)|HOST_UNIFIED_MEMORY|IL_VERSION|IMAGE(?:2D_MAX_(?:HEIGHT|WIDTH)|3D_MAX_(?:DEPTH|HEIGHT|WIDTH)|_BASE_ADDRESS_ALIGNMENT|_MAX_ARRAY_SIZE|_MAX_BUFFER_SIZE|_PITCH_ALIGNMENT|_SUPPORT)|LINKER_AVAILABLE|LOCAL_MEM_SIZE|LOCAL_MEM_TYPE|MAX_(?:CLOCK_FREQUENCY|COMPUTE_UNITS|CONSTANT_ARGS|CONSTANT_BUFFER_SIZE|GLOBAL_VARIABLE_SIZE|MEM_ALLOC_SIZE|NUM_SUB_GROUPS|ON_DEVICE_(?:EVENTS|QUEUES)|PARAMETER_SIZE|PIPE_ARGS|READ_IMAGE_ARGS|READ_WRITE_IMAGE_ARGS|SAMPLERS|WORK_GROUP_SIZE|WORK_ITEM_DIMENSIONS|WORK_ITEM_SIZES|WRITE_IMAGE_ARGS)|MEM_BASE_ADDR_ALIGN|MIN_DATA_TYPE_ALIGN_SIZE|NAME|NATIVE_VECTOR_WIDTH_(?:CHAR|DOUBLE|FLOAT|HALF|INT|LONG|SHORT)|NOT_(?:AVAILABLE|FOUND)|OPENCL_C_VERSION|PARENT_DEVICE|PARTITION_(?:AFFINITY_DOMAIN|BY_AFFINITY_DOMAIN|BY_COUNTS|BY_COUNTS_LIST_END|EQUALLY|FAILED|MAX_SUB_DEVICES|PROPERTIES|TYPE)|PIPE_MAX_(?:ACTIVE_RESERVATIONS|PACKET_SIZE)|PLATFORM|PREFERRED_(?:GLOBAL_ATOMIC_ALIGNMENT|INTEROP_USER_SYNC|LOCAL_ATOMIC_ALIGNMENT|PLATFORM_ATOMIC_ALIGNMENT|VECTOR_WIDTH_(?:CHAR|DOUBLE|FLOAT|HALF|INT|LONG|SHORT))|PRINTF_BUFFER_SIZE|PROFILE|PROFILING_TIMER_RESOLUTION|QUEUE_(?:ON_(?:DEVICE_(?:MAX_SIZE|PREFERRED_SIZE|PROPERTIES)|HOST_PROPERTIES)|PROPERTIES)|REFERENCE_COUNT|SINGLE_FP_CONFIG|SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS|SVM_(?:ATOMICS|CAPABILITIES|COARSE_GRAIN_BUFFER|FINE_GRAIN_BUFFER|FINE_GRAIN_SYSTEM)|TYPE(?:_ACCELERATOR|_ALL|_CPU|_CUSTOM|_DEFAULT|_GPU)?|VENDOR(?:_ID)?|VERSION)|DRIVER_VERSION|EVENT_(?:COMMAND_(?:EXECUTION_STATUS|QUEUE|TYPE)|CONTEXT|REFERENCE_COUNT)|EXEC_(?:KERNEL|NATIVE_KERNEL|STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST)|FILTER_(?:LINEAR|NEAREST)|FLOAT|FP_(?:CORRECTLY_ROUNDED_DIVIDE_SQRT|DENORM|FMA|INF_NAN|ROUND_TO_INF|ROUND_TO_NEAREST|ROUND_TO_ZERO|SOFT_FLOAT)|GLOBAL|HALF_FLOAT|IMAGE_(?:ARRAY_SIZE|BUFFER|DEPTH|ELEMENT_SIZE|FORMAT|FORMAT_MISMATCH|FORMAT_NOT_SUPPORTED|HEIGHT|NUM_MIP_LEVELS|NUM_SAMPLES|ROW_PITCH|SLICE_PITCH|WIDTH)|INTENSITY|INVALID_(?:ARG_INDEX|ARG_SIZE|ARG_VALUE|BINARY|BUFFER_SIZE|BUILD_OPTIONS|COMMAND_QUEUE|COMPILER_OPTIONS|CONTEXT|DEVICE|DEVICE_PARTITION_COUNT|DEVICE_QUEUE|DEVICE_TYPE|EVENT|EVENT_WAIT_LIST|GLOBAL_OFFSET|GLOBAL_WORK_SIZE|GL_OBJECT|HOST_PTR|IMAGE_DESCRIPTOR|IMAGE_FORMAT_DESCRIPTOR|IMAGE_SIZE|KERNEL|KERNEL_ARGS|KERNEL_DEFINITION|KERNEL_NAME|LINKER_OPTIONS|MEM_OBJECT|MIP_LEVEL|OPERATION|PIPE_SIZE|PLATFORM|PROGRAM|PROGRAM_EXECUTABLE|PROPERTY|QUEUE_PROPERTIES|SAMPLER|VALUE|WORK_DIMENSION|WORK_GROUP_SIZE|WORK_ITEM_SIZE)|KERNEL_(?:ARG_(?:ACCESS_(?:NONE|QUALIFIER|READ_ONLY|READ_WRITE|WRITE_ONLY)|ADDRESS_(?:CONSTANT|GLOBAL|LOCAL|PRIVATE|QUALIFIER)|INFO_NOT_AVAILABLE|NAME|TYPE_(?:CONST|NAME|NONE|PIPE|QUALIFIER|RESTRICT|VOLATILE))|ATTRIBUTES|COMPILE_NUM_SUB_GROUPS|COMPILE_WORK_GROUP_SIZE|CONTEXT|EXEC_INFO_SVM_FINE_GRAIN_SYSTEM|EXEC_INFO_SVM_PTRS|FUNCTION_NAME|GLOBAL_WORK_SIZE|LOCAL_MEM_SIZE|LOCAL_SIZE_FOR_SUB_GROUP_COUNT|MAX_NUM_SUB_GROUPS|MAX_SUB_GROUP_SIZE_FOR_NDRANGE|NUM_ARGS|PREFERRED_WORK_GROUP_SIZE_MULTIPLE|PRIVATE_MEM_SIZE|PROGRAM|REFERENCE_COUNT|SUB_GROUP_COUNT_FOR_NDRANGE|WORK_GROUP_SIZE)|LINKER_NOT_AVAILABLE|LINK_PROGRAM_FAILURE|LOCAL|LUMINANCE|MAP_(?:FAILURE|READ|WRITE|WRITE_INVALIDATE_REGION)|MEM_(?:ALLOC_HOST_PTR|ASSOCIATED_MEMOBJECT|CONTEXT|COPY_HOST_PTR|COPY_OVERLAP|FLAGS|HOST_NO_ACCESS|HOST_PTR|HOST_READ_ONLY|HOST_WRITE_ONLY|KERNEL_READ_AND_WRITE|MAP_COUNT|OBJECT_(?:ALLOCATION_FAILURE|BUFFER|IMAGE1D|IMAGE1D_ARRAY|IMAGE1D_BUFFER|IMAGE2D|IMAGE2D_ARRAY|IMAGE3D|PIPE)|OFFSET|READ_ONLY|READ_WRITE|REFERENCE_COUNT|SIZE|SVM_ATOMICS|SVM_FINE_GRAIN_BUFFER|TYPE|USES_SVM_POINTER|USE_HOST_PTR|WRITE_ONLY)|MIGRATE_MEM_OBJECT_(?:CONTENT_UNDEFINED|HOST)|MISALIGNED_SUB_BUFFER_OFFSET|NONE|NON_BLOCKING|OUT_OF_(?:HOST_MEMORY|RESOURCES)|PIPE_(?:MAX_PACKETS|PACKET_SIZE)|PLATFORM_(?:EXTENSIONS|HOST_TIMER_RESOLUTION|NAME|PROFILE|VENDOR|VERSION)|PROFILING_(?:COMMAND_(?:COMPLETE|END|QUEUED|START|SUBMIT)|INFO_NOT_AVAILABLE)|PROGRAM_(?:BINARIES|BINARY_SIZES|BINARY_TYPE(?:_COMPILED_OBJECT|_EXECUTABLE|_LIBRARY|_NONE)?|BUILD_(?:GLOBAL_VARIABLE_TOTAL_SIZE|LOG|OPTIONS|STATUS)|CONTEXT|DEVICES|IL|KERNEL_NAMES|NUM_DEVICES|NUM_KERNELS|REFERENCE_COUNT|SOURCE)|QUEUED|QUEUE_(?:CONTEXT|DEVICE|DEVICE_DEFAULT|ON_DEVICE|ON_DEVICE_DEFAULT|OUT_OF_ORDER_EXEC_MODE_ENABLE|PROFILING_ENABLE|PROPERTIES|REFERENCE_COUNT|SIZE)|RA?|READ_(?:ONLY|WRITE)_CACHE|RG|RGB[Ax]?|RG?x|RUNNING|SAMPLER_(?:ADDRESSING_MODE|CONTEXT|FILTER_MODE|LOD_MAX|LOD_MIN|MIP_FILTER_MODE|NORMALIZED_COORDS|REFERENCE_COUNT)|(?:UN)?SIGNED_INT(?:8|16|32)|SNORM_INT(?:8|16)|SUBMITTED|SUCCESS|UNORM_INT(?:8|16|24|_101010|_101010_2)|UNORM_SHORT_5[56]5|VERSION_(?:1_[012]|2_[01])|s?BGRA|sRGB[Ax]?)\b/,alias:"constant"},"function-opencl-host":{pattern:/\bcl(?:BuildProgram|CloneKernel|CompileProgram|Create(?:Buffer|CommandQueue(?:WithProperties)?|Context|ContextFromType|Image|Image[23]D|Kernel|KernelsInProgram|Pipe|ProgramWith(?:Binary|BuiltInKernels|IL|Source)|Sampler|SamplerWithProperties|SubBuffer|SubDevices|UserEvent)|Enqueue(?:(?:Barrier|Marker)(?:WithWaitList)?|Copy(?:Buffer(?:Rect|ToImage)?|Image(?:ToBuffer)?)|(?:Fill|Map)(?:Buffer|Image)|MigrateMemObjects|NDRangeKernel|NativeKernel|(?:Read|Write)(?:Buffer(?:Rect)?|Image)|SVM(?:Free|Map|MemFill|Memcpy|MigrateMem|Unmap)|Task|UnmapMemObject|WaitForEvents)|Finish|Flush|Get(?:CommandQueueInfo|ContextInfo|Device(?:AndHostTimer|IDs|Info)|Event(?:Profiling)?Info|ExtensionFunctionAddress(?:ForPlatform)?|HostTimer|ImageInfo|Kernel(?:ArgInfo|Info|SubGroupInfo|WorkGroupInfo)|MemObjectInfo|PipeInfo|Platform(?:IDs|Info)|Program(?:Build)?Info|SamplerInfo|SupportedImageFormats)|LinkProgram|(?:Release|Retain)(?:CommandQueue|Context|Device|Event|Kernel|MemObject|Program|Sampler)|SVM(?:Alloc|Free)|Set(?:CommandQueueProperty|DefaultDeviceCommandQueue|EventCallback|Kernel|Kernel(?:Arg(?:SVMPointer)?|ExecInfo)|MemObjectDestructorCallback|UserEventStatus)|Unload(?:Platform)?Compiler|WaitForEvents)\b/,alias:"function"}};$(f.c,"keyword",yt);f.cpp&&(yt["type-opencl-host-cpp"]={pattern:/\b(?:Buffer|BufferGL|BufferRenderGL|CommandQueue|Context|Device|DeviceCommandQueue|EnqueueArgs|Event|Image(?:[123]D|[12]DArray|1DBuffer|[23]DGL|Format|GL)?|Kernel|KernelFunctor|LocalSpaceArg|Memory|NDRange|Pipe|Platform|Program|SVMAllocator|SVMTrait(?:Atomic|Coarse|Fine|ReadOnly|ReadWrite|WriteOnly)|Sampler|UserEvent)\b/,alias:"keyword"},$(f.cpp,"keyword",yt));var fa=f.diff={coord:/^(?:\*{3}|-{3}|\+{3}|\d).*$|^@@.*@@$/m},ot={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};for(var pe in ot){var lt=pe.split("-")[0];fa[pe]={pattern:RegExp("^(?:["+ot[pe]+`].*$
package/lib/CodeBlock.js CHANGED
@@ -1,7 +1,7 @@
1
- import { N as ia, t as Bt, m as sa } from "./index-CXIIg9Sq.js";
2
- import { N as oa, c as Le, R as la } from "./dom-dataset-2RXYq9wp.js";
1
+ import { N as ia, t as Bt, m as sa } from "./index-BWx1Mchx.js";
2
+ import { N as oa, c as Le, R as la } from "./dom-dataset-CHDbKz5J.js";
3
3
  import { jsxs as _e, jsx as k } from "react/jsx-runtime";
4
- import { d as ne, A as ca, _ as da, a4 as ua, k as xe } from "./RichTextEditor-CFwUKN9i.js";
4
+ import { d as ne, A as ca, Z as da, a3 as ua, k as xe } from "./RichTextEditor-OW4s40FH.js";
5
5
  import * as ue from "react";
6
6
  import { useRef as Gt, useCallback as pa, useEffect as zt } from "react";
7
7
  import * as F from "@radix-ui/react-select";
package/lib/CodeView.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CSvnpArE.cjs"),c=require("./RichTextEditor-COwI-b24.cjs"),s=i.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{component:c.ActionButton,componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive||!1,disabled:!1,icon:"CodeView",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const n=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${n}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CSvnpArE.cjs"),c=require("./RichTextEditor-C3sK_Ys3.cjs"),s=i.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{component:c.ActionButton,componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive||!1,disabled:!1,icon:"CodeView",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const n=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${n}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=s;
package/lib/CodeView.js CHANGED
@@ -1,5 +1,5 @@
1
- import { E as i } from "./index-CXIIg9Sq.js";
2
- import { A as s } from "./RichTextEditor-CFwUKN9i.js";
1
+ import { E as i } from "./index-BWx1Mchx.js";
2
+ import { A as s } from "./RichTextEditor-OW4s40FH.js";
3
3
  const r = /* @__PURE__ */ i.create({
4
4
  name: "codeView",
5
5
  addOptions() {
package/lib/Color.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CrxasX7b.cjs");const u=require("./index-CSvnpArE.cjs"),l=require("react/jsx-runtime"),d=require("react"),i=require("./RichTextEditor-COwI-b24.cjs"),x=u.Extension.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function C({fill:e}){return l.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:l.jsx("g",{transform:"translate(0.000000, 0.500000)",children:l.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[l.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",id:"矩形",fill:e||"#DF2A3F",fillRule:"evenodd"}),l.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",id:"路径-21",fill:"currentColor",fillRule:"nonzero"}),l.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",id:"路径-22",fill:"currentColor",fillRule:"nonzero"})]})})})})}function h(e){const[t,c]=d.useState(void 0);function r(o){var a;(a=e.action)==null||a.call(e,o)}function n(){var o;(o=e.action)==null||o.call(e,t)}const s=d.useCallback(i.debounce(o=>{c(o)},350),[]);return l.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-[32px]",children:[l.jsx(i.ActionButton,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:n,children:l.jsx("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-text-sm",children:l.jsx(C,{fill:t||e.initialDisplayedColor})})}),l.jsx(i.ColorPicker,{selectedColor:t,setSelectedColor:s,onChange:r,disabled:e==null?void 0:e.disabled,colors:e==null?void 0:e.colors,defaultColor:e==null?void 0:e.defaultColor,children:l.jsx(i.Button,{variant:"ghost",size:"icon",className:"r!ichtext-h-[32px] !richtext-w-3",disabled:e==null?void 0:e.disabled,children:l.jsx(i.IconComponent,{className:"!richtext-w-3 !richtext-h-3 richtext-text-zinc-500",name:"MenuDown"})})})]})}const f=x.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:c,extension:r}){return{component:h,componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{n===void 0&&t.chain().focus().unsetColor().run(),typeof n=="string"&&t.chain().focus().setColor(n).run()},isActive:()=>{const{color:n}=t.getAttributes("textStyle");return n&&t.isActive({color:n})||!1},editor:t,disabled:!1,tooltip:c("editor.color.tooltip")}}}}}});exports.Color=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CrxasX7b.cjs");const u=require("./index-CSvnpArE.cjs"),l=require("react/jsx-runtime"),d=require("react"),i=require("./RichTextEditor-C3sK_Ys3.cjs"),x=u.Extension.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function C({fill:e}){return l.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:l.jsx("g",{transform:"translate(0.000000, 0.500000)",children:l.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[l.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",id:"矩形",fill:e||"#DF2A3F",fillRule:"evenodd"}),l.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",id:"路径-21",fill:"currentColor",fillRule:"nonzero"}),l.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",id:"路径-22",fill:"currentColor",fillRule:"nonzero"})]})})})})}function h(e){const[t,c]=d.useState(void 0);function r(o){var a;(a=e.action)==null||a.call(e,o)}function n(){var o;(o=e.action)==null||o.call(e,t)}const s=d.useCallback(i.debounce(o=>{c(o)},350),[]);return l.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-[32px]",children:[l.jsx(i.ActionButton,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:n,children:l.jsx("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-text-sm",children:l.jsx(C,{fill:t||e.initialDisplayedColor})})}),l.jsx(i.ColorPicker,{selectedColor:t,setSelectedColor:s,onChange:r,disabled:e==null?void 0:e.disabled,colors:e==null?void 0:e.colors,defaultColor:e==null?void 0:e.defaultColor,children:l.jsx(i.Button,{variant:"ghost",size:"icon",className:"r!ichtext-h-[32px] !richtext-w-3",disabled:e==null?void 0:e.disabled,children:l.jsx(i.IconComponent,{className:"!richtext-w-3 !richtext-h-3 richtext-text-zinc-500",name:"MenuDown"})})})]})}const f=x.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:c,extension:r}){return{component:h,componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{n===void 0&&t.chain().focus().unsetColor().run(),typeof n=="string"&&t.chain().focus().setColor(n).run()},isActive:()=>{const{color:n}=t.getAttributes("textStyle");return n&&t.isActive({color:n})||!1},editor:t,disabled:!1,tooltip:c("editor.color.tooltip")}}}}}});exports.Color=f;
package/lib/Color.js CHANGED
@@ -1,8 +1,8 @@
1
- import "./index-BkoojfPK.js";
2
- import { E as u } from "./index-CXIIg9Sq.js";
1
+ import "./index-DIPntess.js";
2
+ import { E as u } from "./index-BWx1Mchx.js";
3
3
  import { jsxs as a, jsx as l } from "react/jsx-runtime";
4
4
  import { useState as s, useCallback as C } from "react";
5
- import { t as h, A as f, C as x, B as m, k as v } from "./RichTextEditor-CFwUKN9i.js";
5
+ import { t as h, A as f, C as x, B as m, k as v } from "./RichTextEditor-OW4s40FH.js";
6
6
  const L = u.create({
7
7
  name: "color",
8
8
  addOptions() {
package/lib/Document.js CHANGED
@@ -1,4 +1,4 @@
1
- import { N as o } from "./index-CXIIg9Sq.js";
1
+ import { N as o } from "./index-BWx1Mchx.js";
2
2
  const t = o.create({
3
3
  name: "doc",
4
4
  topNode: !0,
@@ -1,6 +1,6 @@
1
- import { h as Z, m as te } from "./index-CXIIg9Sq.js";
2
- import { d, w as re, x as oe, A as le, y as ne, z as ie, F as se, B as ae, G as ce, J as j, K as he, N as ue } from "./RichTextEditor-CFwUKN9i.js";
3
- import { N as de, R as ge } from "./dom-dataset-2RXYq9wp.js";
1
+ import { h as Z, m as te } from "./index-BWx1Mchx.js";
2
+ import { d, w as re, x as oe, A as le, y as ne, z as ie, F as se, B as ae, G as ce, J as j, K as he, N as ue } from "./RichTextEditor-OW4s40FH.js";
3
+ import { N as de, R as ge } from "./dom-dataset-CHDbKz5J.js";
4
4
  import { jsx as e, jsxs as x, Fragment as Y } from "react/jsx-runtime";
5
5
  import { useState as y, useRef as X, useEffect as O, useMemo as D, useCallback as q } from "react";
6
6
  import { Color4 as g, Editor as me, makeDropdownToolbar as pe } from "easydrawer";
@@ -1 +1 @@
1
- "use strict";const D=require("./index-CSvnpArE.cjs"),a=require("./RichTextEditor-COwI-b24.cjs"),U=require("./dom-dataset-Cuy-pIfj.cjs"),e=require("react/jsx-runtime"),m=require("react"),g=require("easydrawer"),G=require("./shortId-Bfj8TyNr.cjs"),q=require("./index-Dz3YxLE7.cjs"),K="_wrapper_rraz2_1",Q="_tool_rraz2_17",Y="_active_rraz2_37",J="_pen_rraz2_41",ee="_line_rraz2_48",te="_options_rraz2_56",oe="_colorWrap_rraz2_66",re="_color_rraz2_66",le="_colorActive_rraz2_83",l={wrapper:K,tool:Q,active:Y,pen:J,line:ee,options:te,colorWrap:oe,color:re,colorActive:le};function ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function ie(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function ae(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function ce(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function he(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function ue(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function pe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function ve(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function Ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function fe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function Te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function je(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function be(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function Me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const ye=[g.Color4.blackHighlight,g.Color4.ofRGBA(166/255,81/255,167/255,.3),g.Color4.ofRGBA(247/255,78/255,158/255,.3),g.Color4.ofRGBA(166/255,83/255,88/255,.3),g.Color4.ofRGBA(246/255,130/255,28/255,.3),g.Color4.ofRGBA(166/255,198/255,0,.3),g.Color4.ofRGBA(98/255,186/255,70/255,.3)],$=[g.Color4.black,g.Color4.fromHex("#007AFF"),g.Color4.fromHex("#A651A7"),g.Color4.fromHex("#F74E9E"),g.Color4.fromHex("#FF5358"),g.Color4.fromHex("#F6821C"),g.Color4.fromHex("#FFC600"),g.Color4.fromHex("#62BA46"),g.Color4.fromHex("#E6BFE8"),g.Color4.fromHex("#FEA3D2"),g.Color4.fromHex("#FFA0A3"),g.Color4.fromHex("#FBC276"),g.Color4.fromHex("#FFFB85"),g.Color4.fromHex("#AADC99")];function Se({onChange:t}){const[o,r]=m.useState(g.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:ye.map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))})}function F({onChange:t}){const[o,r]=m.useState(g.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:$.slice(0,7).map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))}),e.jsx("div",{className:l.colorWrap,children:$.slice(7).map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))})]})}function Ee({setColorPen:t,setThicknessPen:o}){const[r,s]=m.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(F,{onChange:i=>t(i)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:r,onChange:i=>{o(Number.parseFloat(i.target.value)),s(Number.parseFloat(i.target.value))}})})]})}function He({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(Se,{onChange:o=>t(o)})})}function Le({changeColorShape:t,changeBorderColorShape:o,onThicknessChange:r}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(F,{onChange:s=>t(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx(F,{onChange:s=>o(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:s=>{r(Number.parseFloat(s.target.value))}})})]})}function Z(t){const{setColorPen:o,refEditor:r,setThicknessPen:s,setColorHighlight:i,changeBorderColorShape:T,onUndo:A,changeColorShape:N,changeShape:C,onThicknessChange:H,onRedo:j,onClear:z}=t,[c,u]=m.useState(null),[f,x]=m.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="select"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="select"){u(null),n[0].setEnabled(!1);return}u("select"),n[0].setEnabled(!0)},children:e.jsx(ne,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="text"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(r.current.toolController.setToolEnabled(n[1]),c==="text"){n[1].setEnabled(!1),u(null);return}u("text"),n[1].setEnabled(!0)},children:e.jsx(se,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="pencil"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="pencil"){u(null),n[2].setEnabled(!1);return}u("pencil"),n[2].setEnabled(!0)},children:e.jsx(ie,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="highlighter"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="highlighter"){u(null),n[3].setEnabled(!1);return}u("highlighter"),n[3].setEnabled(!0)},children:e.jsx(ae,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="eraser"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="eraser"){u(null),n[4].setEnabled(!1);return}u("eraser"),n[4].setEnabled(!0)},children:e.jsx(ce,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===0}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(0),x(0)},children:e.jsx(he,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===1}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(1),x(1)},children:e.jsx(ue,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===2}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(2),x(2)},children:e.jsx(de,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===3}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(3),x(3)},children:e.jsx(ge,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===4}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(4),x(4)},children:e.jsx(me,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===5}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(5),x(5)},children:e.jsx(xe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===6}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(6),x(6)},children:e.jsx(pe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===7}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(7),x(7)},children:e.jsx(fe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===8}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(8),x(8)},children:e.jsx(Te,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===9}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(9),x(9)},children:e.jsx(je,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===10}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(10),x(10)},children:e.jsx(be,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===11}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(11),x(11)},children:e.jsx(Me,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool),onClick:A,children:e.jsx(we,{})}),e.jsx("button",{className:a.cn(l.tool),onClick:j,children:e.jsx(ve,{})}),e.jsx("button",{className:a.cn(l.tool),onClick:z,children:e.jsx(Ce,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[c==="pencil"&&e.jsx(Ee,{setColorPen:o,setThicknessPen:s}),c==="highlighter"&&e.jsx(He,{setColorHighlight:i}),c==="shapes"&&e.jsx(Le,{changeBorderColorShape:T,changeColorShape:N,changeShape:C,onThicknessChange:H})]})]})})}let B=!1;const ke=({editor:t,upload:o})=>{const[r,s]=m.useState(!1),i=m.useRef(null),T=m.useRef(null),A=()=>{(async()=>{const h=document.querySelector("#easydrawer");h&&(i.current=new g.Editor(h,{wheelEventsEnabled:!1,disableZoom:!0}),T.current=g.makeDropdownToolbar(i.current),T.current.addDefaultToolWidgets())})()};m.useEffect(()=>{r&&setTimeout(()=>{A()},200)},[r]);const N=async()=>{if(i.current){const p=i.current.toSVG(),h=p.outerHTML,w=`drawer-${G.shortId()}.svg`;let E=G.i(p.outerHTML);if(o){const _=a.dataURLtoFile(E,w);E=await o(_)}t==null||t.chain().focus().setDrawer({type:"drawer",src:E,alt:encodeURIComponent(h),width:426,height:212},!!h).run()}s(!1)},C=p=>{const h=i.current.toolController.getPrimaryTools()[2],w=T.current.getWidgetById("pen-1");h&&w&&(h.setColor(p),w.serializeState())},H=p=>{const h=i.current.toolController.getPrimaryTools()[2],w=T.current.getWidgetById("pen-1");h&&w&&(h.setThickness(p),w.serializeState())},j=p=>{const h=i.current.toolController.getPrimaryTools()[3],w=T.current.getWidgetById("pen-2");h&&w&&(h.setColor(p),w.serializeState())},z=p=>{const h=T.current.getWidgetById("shape");h&&h.setShapeType(p)},c=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setColor(p),w.serializeState())},u=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setThickness(p),w.serializeState())},f=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setBorderColor(p),w.serializeState())},x=()=>{if(B){for(;i.current.history.redoStackSize>0;)i.current.history.redo();B=!1;return}i.current.history.undo()},n=()=>{B||i.current.history.redo()},P=()=>{if(!B){for(;i.current.history.undoStackSize>0;)x();B=!0}};return e.jsxs(a.Dialog,{onOpenChange:s,open:r,children:[e.jsx(a.DialogTrigger,{asChild:!0,children:e.jsx(a.ActionButton,{action:()=>s(!0),icon:"PencilRuler",tooltip:"Drawer"})}),e.jsxs(a.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(a.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(Z,{changeBorderColorShape:f,changeColorShape:c,changeShape:z,onClear:P,onRedo:n,onThicknessChange:u,onUndo:x,refEditor:i,setColorHighlight:j,setColorPen:C,setThicknessPen:H})]}),e.jsx(a.DialogFooter,{children:e.jsx(a.Button,{onClick:N,type:"button",children:"Save changes"})})]})]})},I={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Ne({editor:t,node:o,updateAttributes:r,getPos:s,selected:i}){const[T,A]=m.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[N,C]=m.useState({width:0,height:0}),[H]=m.useState([I.TOP_LEFT,I.TOP_RIGHT,I.BOTTOM_LEFT,I.BOTTOM_RIGHT]),[j,z]=m.useState(!1),[c,u]=m.useState({x:0,y:0,w:0,h:0,dir:""}),{align:f}=o==null?void 0:o.attrs,x=m.useMemo(()=>{const{src:d,alt:M,width:y,height:L}=o==null?void 0:o.attrs,k=D.isNumber(y)?`${y}px`:y,v=D.isNumber(L)?`${L}px`:L;return{src:d||void 0,alt:M||void 0,style:{width:k||void 0,height:v||void 0}}},[o==null?void 0:o.attrs]),n=m.useMemo(()=>{const{style:{width:d}}=x;return{width:d==="100%"?d:void 0}},[x]);function P(d){C({width:d.target.width,height:d.target.height})}function p(){t.commands.setNodeSelection(s())}const h=m.useCallback(a.throttle(()=>{const{width:d}=getComputedStyle(t.view.dom);A(M=>({...M,width:Number.parseInt(d,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[t]);function w(d,M){d.preventDefault(),d.stopPropagation();const y=N.width,L=N.height,k=y/L;let v=Number(o.attrs.width),S=Number(o.attrs.height);const b=T.width;v&&!S?(v=v>b?b:v,S=Math.round(v/k)):S&&!v?(v=Math.round(S*k),v=v>b?b:v):!v&&!S?(v=y>b?b:y,S=Math.round(v/k)):v=v>b?b:v,z(!0),u({x:d.clientX,y:d.clientY,w:v,h:S,dir:M})}const E=m.useCallback(a.throttle(d=>{if(d.preventDefault(),d.stopPropagation(),!j)return;const{x:M,w:y,dir:L}=c,k=(d.clientX-M)*(/l/.test(L)?-1:1),{width:v,height:S}=o==null?void 0:o.attrs,b=v/S,V=a.clamp(y+k,q.IMAGE_MIN_SIZE,T.width),X=Math.round(V/b);r({width:V,height:X})},q.IMAGE_THROTTLE_WAIT_TIME),[j,c,T,r,o==null?void 0:o.attrs]),_=m.useCallback(d=>{d.preventDefault(),d.stopPropagation(),j&&(u({x:0,y:0,w:0,h:0,dir:""}),z(!1),p())},[j,p]),O=m.useCallback(()=>{document==null||document.addEventListener("mousemove",E,!0),document==null||document.addEventListener("mouseup",_,!0)},[E,_]),R=m.useCallback(()=>{document==null||document.removeEventListener("mousemove",E,!0),document==null||document.removeEventListener("mouseup",_,!0)},[E,_]);m.useEffect(()=>(j?O():R(),()=>{R()}),[j,O,R]);const W=m.useMemo(()=>new ResizeObserver(()=>h()),[h]);return m.useEffect(()=>(W.observe(t.view.dom),()=>{W.disconnect()}),[t.view.dom,W]),e.jsx(U.NodeViewWrapper,{className:"image-view",style:{...n,width:"100%",textAlign:f},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...n,background:"#fff"},className:`image-view__body ${i?"image-view__body--focused":""} ${j?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:x.alt,className:"image-view__body__image block",height:"auto",onClick:p,onLoad:P,src:x.src,style:x.style}),t.view.editable&&(i||j)&&e.jsx("div",{className:"image-resizer",children:H==null?void 0:H.map(d=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${d}`,onMouseDown:M=>w(M,d)},`image-dir-${d}`))})]})})}const ze=a.Image.extend({name:"drawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({editor:o,t:r,extension:s})=>{var i;return{component:ke,componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,editor:o,icon:"PencilRuler",tooltip:r("editor.drawer.tooltip"),upload:(i=s==null?void 0:s.options)==null?void 0:i.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("width");return s?Number.parseInt(s,10):320},renderHTML:o=>({width:o.width})},height:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("height");return s?Number.parseInt(s,10):212},renderHTML:o=>({height:o.height})},align:{default:"center",parseHTML:o=>o.getAttribute("align"),renderHTML:o=>({align:o.align})}}},addNodeView(){return U.ReactNodeViewRenderer(Ne)},addCommands(){return{setDrawer:(t,o)=>({commands:r,editor:s})=>o?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(s.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:o})=>o.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:o}=t;return["div",{style:o?`text-align: ${o};`:"",class:"imageDrawer"},["img",D.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const o=t.querySelector("img"),r=o==null?void 0:o.getAttribute("width"),s=o==null?void 0:o.getAttribute("height");return{src:o==null?void 0:o.getAttribute("src"),alt:o==null?void 0:o.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:s?Number.parseInt(s,10):null,align:(o==null?void 0:o.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=Z;exports.Drawer=ze;
1
+ "use strict";const D=require("./index-CSvnpArE.cjs"),a=require("./RichTextEditor-C3sK_Ys3.cjs"),U=require("./dom-dataset-Cuy-pIfj.cjs"),e=require("react/jsx-runtime"),m=require("react"),g=require("easydrawer"),G=require("./shortId-Bfj8TyNr.cjs"),q=require("./index-Dz3YxLE7.cjs"),K="_wrapper_rraz2_1",Q="_tool_rraz2_17",Y="_active_rraz2_37",J="_pen_rraz2_41",ee="_line_rraz2_48",te="_options_rraz2_56",oe="_colorWrap_rraz2_66",re="_color_rraz2_66",le="_colorActive_rraz2_83",l={wrapper:K,tool:Q,active:Y,pen:J,line:ee,options:te,colorWrap:oe,color:re,colorActive:le};function ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function ie(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function ae(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function ce(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function he(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function ue(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function pe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function ve(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function Ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function fe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function Te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function je(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function be(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function Me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const ye=[g.Color4.blackHighlight,g.Color4.ofRGBA(166/255,81/255,167/255,.3),g.Color4.ofRGBA(247/255,78/255,158/255,.3),g.Color4.ofRGBA(166/255,83/255,88/255,.3),g.Color4.ofRGBA(246/255,130/255,28/255,.3),g.Color4.ofRGBA(166/255,198/255,0,.3),g.Color4.ofRGBA(98/255,186/255,70/255,.3)],$=[g.Color4.black,g.Color4.fromHex("#007AFF"),g.Color4.fromHex("#A651A7"),g.Color4.fromHex("#F74E9E"),g.Color4.fromHex("#FF5358"),g.Color4.fromHex("#F6821C"),g.Color4.fromHex("#FFC600"),g.Color4.fromHex("#62BA46"),g.Color4.fromHex("#E6BFE8"),g.Color4.fromHex("#FEA3D2"),g.Color4.fromHex("#FFA0A3"),g.Color4.fromHex("#FBC276"),g.Color4.fromHex("#FFFB85"),g.Color4.fromHex("#AADC99")];function Se({onChange:t}){const[o,r]=m.useState(g.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:ye.map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))})}function F({onChange:t}){const[o,r]=m.useState(g.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:$.slice(0,7).map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))}),e.jsx("div",{className:l.colorWrap,children:$.slice(7).map((s,i)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:a.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},i))})]})}function Ee({setColorPen:t,setThicknessPen:o}){const[r,s]=m.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(F,{onChange:i=>t(i)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:r,onChange:i=>{o(Number.parseFloat(i.target.value)),s(Number.parseFloat(i.target.value))}})})]})}function He({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(Se,{onChange:o=>t(o)})})}function Le({changeColorShape:t,changeBorderColorShape:o,onThicknessChange:r}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(F,{onChange:s=>t(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx(F,{onChange:s=>o(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:s=>{r(Number.parseFloat(s.target.value))}})})]})}function Z(t){const{setColorPen:o,refEditor:r,setThicknessPen:s,setColorHighlight:i,changeBorderColorShape:T,onUndo:A,changeColorShape:N,changeShape:C,onThicknessChange:H,onRedo:j,onClear:z}=t,[c,u]=m.useState(null),[f,x]=m.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="select"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="select"){u(null),n[0].setEnabled(!1);return}u("select"),n[0].setEnabled(!0)},children:e.jsx(ne,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="text"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(r.current.toolController.setToolEnabled(n[1]),c==="text"){n[1].setEnabled(!1),u(null);return}u("text"),n[1].setEnabled(!0)},children:e.jsx(se,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="pencil"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="pencil"){u(null),n[2].setEnabled(!1);return}u("pencil"),n[2].setEnabled(!0)},children:e.jsx(ie,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="highlighter"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="highlighter"){u(null),n[3].setEnabled(!1);return}u("highlighter"),n[3].setEnabled(!0)},children:e.jsx(ae,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="eraser"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="eraser"){u(null),n[4].setEnabled(!1);return}u("eraser"),n[4].setEnabled(!0)},children:e.jsx(ce,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===0}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(0),x(0)},children:e.jsx(he,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===1}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(1),x(1)},children:e.jsx(ue,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===2}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(2),x(2)},children:e.jsx(de,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===3}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(3),x(3)},children:e.jsx(ge,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===4}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(4),x(4)},children:e.jsx(me,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===5}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(5),x(5)},children:e.jsx(xe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===6}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(6),x(6)},children:e.jsx(pe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===7}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(7),x(7)},children:e.jsx(fe,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===8}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(8),x(8)},children:e.jsx(Te,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===9}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(9),x(9)},children:e.jsx(je,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===10}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(10),x(10)},children:e.jsx(be,{})}),e.jsx("button",{className:a.cn(l.tool,{[l.active]:c==="shapes"&&f===11}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),u("shapes"),n[5].setEnabled(!0),C(11),x(11)},children:e.jsx(Me,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:a.cn(l.tool),onClick:A,children:e.jsx(we,{})}),e.jsx("button",{className:a.cn(l.tool),onClick:j,children:e.jsx(ve,{})}),e.jsx("button",{className:a.cn(l.tool),onClick:z,children:e.jsx(Ce,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[c==="pencil"&&e.jsx(Ee,{setColorPen:o,setThicknessPen:s}),c==="highlighter"&&e.jsx(He,{setColorHighlight:i}),c==="shapes"&&e.jsx(Le,{changeBorderColorShape:T,changeColorShape:N,changeShape:C,onThicknessChange:H})]})]})})}let B=!1;const ke=({editor:t,upload:o})=>{const[r,s]=m.useState(!1),i=m.useRef(null),T=m.useRef(null),A=()=>{(async()=>{const h=document.querySelector("#easydrawer");h&&(i.current=new g.Editor(h,{wheelEventsEnabled:!1,disableZoom:!0}),T.current=g.makeDropdownToolbar(i.current),T.current.addDefaultToolWidgets())})()};m.useEffect(()=>{r&&setTimeout(()=>{A()},200)},[r]);const N=async()=>{if(i.current){const p=i.current.toSVG(),h=p.outerHTML,w=`drawer-${G.shortId()}.svg`;let E=G.i(p.outerHTML);if(o){const _=a.dataURLtoFile(E,w);E=await o(_)}t==null||t.chain().focus().setDrawer({type:"drawer",src:E,alt:encodeURIComponent(h),width:426,height:212},!!h).run()}s(!1)},C=p=>{const h=i.current.toolController.getPrimaryTools()[2],w=T.current.getWidgetById("pen-1");h&&w&&(h.setColor(p),w.serializeState())},H=p=>{const h=i.current.toolController.getPrimaryTools()[2],w=T.current.getWidgetById("pen-1");h&&w&&(h.setThickness(p),w.serializeState())},j=p=>{const h=i.current.toolController.getPrimaryTools()[3],w=T.current.getWidgetById("pen-2");h&&w&&(h.setColor(p),w.serializeState())},z=p=>{const h=T.current.getWidgetById("shape");h&&h.setShapeType(p)},c=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setColor(p),w.serializeState())},u=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setThickness(p),w.serializeState())},f=p=>{const h=i.current.toolController.getPrimaryTools()[5],w=T.current.getWidgetById("shape");h&&w&&(h.setBorderColor(p),w.serializeState())},x=()=>{if(B){for(;i.current.history.redoStackSize>0;)i.current.history.redo();B=!1;return}i.current.history.undo()},n=()=>{B||i.current.history.redo()},I=()=>{if(!B){for(;i.current.history.undoStackSize>0;)x();B=!0}};return e.jsxs(a.Dialog,{onOpenChange:s,open:r,children:[e.jsx(a.DialogTrigger,{asChild:!0,children:e.jsx(a.ActionButton,{action:()=>s(!0),icon:"PencilRuler",tooltip:"Drawer"})}),e.jsxs(a.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(a.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(Z,{changeBorderColorShape:f,changeColorShape:c,changeShape:z,onClear:I,onRedo:n,onThicknessChange:u,onUndo:x,refEditor:i,setColorHighlight:j,setColorPen:C,setThicknessPen:H})]}),e.jsx(a.DialogFooter,{children:e.jsx(a.Button,{onClick:N,type:"button",children:"Save changes"})})]})]})},P={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Ne({editor:t,node:o,updateAttributes:r,getPos:s,selected:i}){const[T,A]=m.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[N,C]=m.useState({width:0,height:0}),[H]=m.useState([P.TOP_LEFT,P.TOP_RIGHT,P.BOTTOM_LEFT,P.BOTTOM_RIGHT]),[j,z]=m.useState(!1),[c,u]=m.useState({x:0,y:0,w:0,h:0,dir:""}),{align:f}=o==null?void 0:o.attrs,x=m.useMemo(()=>{const{src:d,alt:M,width:y,height:L}=o==null?void 0:o.attrs,k=D.isNumber(y)?`${y}px`:y,v=D.isNumber(L)?`${L}px`:L;return{src:d||void 0,alt:M||void 0,style:{width:k||void 0,height:v||void 0}}},[o==null?void 0:o.attrs]),n=m.useMemo(()=>{const{style:{width:d}}=x;return{width:d==="100%"?d:void 0}},[x]);function I(d){C({width:d.target.width,height:d.target.height})}function p(){t.commands.setNodeSelection(s())}const h=m.useCallback(a.throttle(()=>{const{width:d}=getComputedStyle(t.view.dom);A(M=>({...M,width:Number.parseInt(d,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[t]);function w(d,M){d.preventDefault(),d.stopPropagation();const y=N.width,L=N.height,k=y/L;let v=Number(o.attrs.width),S=Number(o.attrs.height);const b=T.width;v&&!S?(v=v>b?b:v,S=Math.round(v/k)):S&&!v?(v=Math.round(S*k),v=v>b?b:v):!v&&!S?(v=y>b?b:y,S=Math.round(v/k)):v=v>b?b:v,z(!0),u({x:d.clientX,y:d.clientY,w:v,h:S,dir:M})}const E=m.useCallback(a.throttle(d=>{if(d.preventDefault(),d.stopPropagation(),!j)return;const{x:M,w:y,dir:L}=c,k=(d.clientX-M)*(/l/.test(L)?-1:1),{width:v,height:S}=o==null?void 0:o.attrs,b=v/S,V=a.clamp(y+k,q.IMAGE_MIN_SIZE,T.width),X=Math.round(V/b);r({width:V,height:X})},q.IMAGE_THROTTLE_WAIT_TIME),[j,c,T,r,o==null?void 0:o.attrs]),_=m.useCallback(d=>{d.preventDefault(),d.stopPropagation(),j&&(u({x:0,y:0,w:0,h:0,dir:""}),z(!1),p())},[j,p]),O=m.useCallback(()=>{document==null||document.addEventListener("mousemove",E,!0),document==null||document.addEventListener("mouseup",_,!0)},[E,_]),R=m.useCallback(()=>{document==null||document.removeEventListener("mousemove",E,!0),document==null||document.removeEventListener("mouseup",_,!0)},[E,_]);m.useEffect(()=>(j?O():R(),()=>{R()}),[j,O,R]);const W=m.useMemo(()=>new ResizeObserver(()=>h()),[h]);return m.useEffect(()=>(W.observe(t.view.dom),()=>{W.disconnect()}),[t.view.dom,W]),e.jsx(U.NodeViewWrapper,{className:"image-view",style:{...n,width:"100%",textAlign:f},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...n,background:"#fff"},className:`image-view__body ${i?"image-view__body--focused":""} ${j?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:x.alt,className:"image-view__body__image block",height:"auto",onClick:p,onLoad:I,src:x.src,style:x.style}),t.view.editable&&(i||j)&&e.jsx("div",{className:"image-resizer",children:H==null?void 0:H.map(d=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${d}`,onMouseDown:M=>w(M,d)},`image-dir-${d}`))})]})})}const ze=a.Image.extend({name:"drawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({editor:o,t:r,extension:s})=>{var i;return{component:ke,componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,editor:o,icon:"PencilRuler",tooltip:r("editor.drawer.tooltip"),upload:(i=s==null?void 0:s.options)==null?void 0:i.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("width");return s?Number.parseInt(s,10):320},renderHTML:o=>({width:o.width})},height:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("height");return s?Number.parseInt(s,10):212},renderHTML:o=>({height:o.height})},align:{default:"center",parseHTML:o=>o.getAttribute("align"),renderHTML:o=>({align:o.align})}}},addNodeView(){return U.ReactNodeViewRenderer(Ne)},addCommands(){return{setDrawer:(t,o)=>({commands:r,editor:s})=>o?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(s.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:o})=>o.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:o}=t;return["div",{style:o?`text-align: ${o};`:"",class:"imageDrawer"},["img",D.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const o=t.querySelector("img"),r=o==null?void 0:o.getAttribute("width"),s=o==null?void 0:o.getAttribute("height");return{src:o==null?void 0:o.getAttribute("src"),alt:o==null?void 0:o.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:s?Number.parseInt(s,10):null,align:(o==null?void 0:o.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=Z;exports.Drawer=ze;
package/lib/Drawer.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CSvnpArE.cjs");require("./RichTextEditor-COwI-b24.cjs");require("./dom-dataset-Cuy-pIfj.cjs");const e=require("./Drawer-BN8H4Zb2.cjs");exports.Drawer=e.Drawer;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CSvnpArE.cjs");require("./RichTextEditor-C3sK_Ys3.cjs");require("./dom-dataset-Cuy-pIfj.cjs");const e=require("./Drawer-jPHImfyr.cjs");exports.Drawer=e.Drawer;
package/lib/Drawer.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./index-CXIIg9Sq.js";
2
- import "./RichTextEditor-CFwUKN9i.js";
3
- import "./dom-dataset-2RXYq9wp.js";
4
- import { D as i } from "./Drawer-9QMJnenp.js";
1
+ import "./index-BWx1Mchx.js";
2
+ import "./RichTextEditor-OW4s40FH.js";
3
+ import "./dom-dataset-CHDbKz5J.js";
4
+ import { D as i } from "./Drawer-DUXFBfgE.js";
5
5
  export {
6
6
  i as Drawer
7
7
  };