syntaxic-react-editor 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -9
- package/dist/index.js +4 -4
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# syntaxic-react-editor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The ultimate rich-text editing framework for modern applications. Highly extensible, beautifully designed.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- Rich text editing experience similar to Microsoft Word.
|
|
8
|
-
- Easy integration with React applications.
|
|
9
|
-
- Modular architecture with support for plugins.
|
|
5
|
+
## Demo
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
Check out the live demo: [https://syntaxic.cloud/products/syntaxic-react-editor](https://syntaxic.cloud/products/syntaxic-react-editor)
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
## Features
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
- **Rich Text Editing**: Bold, italic, underline, strike-through, and more.
|
|
12
|
+
- **Advanced Tables**: Insert and manage tables with ease.
|
|
13
|
+
- **Pro Features**: Access advanced plugins and features via [syntaxic.cloud](https://syntaxic.cloud/products/syntaxic-react-editor).
|
|
14
|
+
- **Responsive Design**: Works great on various screen sizes.
|
|
15
|
+
- **Zero-Config CSS**: Automatically injects styling into your project.
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
@@ -32,6 +32,32 @@ function App() {
|
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
| Prop | Type | Default | Description |
|
|
38
|
+
| ---------------- | ------------------------ | ------------------------------- | ------------------------------------------------------ |
|
|
39
|
+
| `initialHTML` | `string` | `'<p>Start typing here...</p>'` | Initial content of the editor. |
|
|
40
|
+
| `onChange` | `(html: string) => void` | `undefined` | Callback fired on every content change. |
|
|
41
|
+
| `onSave` | `(html: string) => void` | `undefined` | Callback fired when manual save is triggered. |
|
|
42
|
+
| `height` | `string` | `'100vh'` | Height of the editor container. |
|
|
43
|
+
| `className` | `string` | `''` | Additional CSS class for the container. |
|
|
44
|
+
| `toolbarOptions` | `ToolbarOptions` | All enabled | Configuration to show/hide toolbar groups and buttons. |
|
|
45
|
+
| `plugins` | `WordEditorPlugin[]` | `[]` | Array of plugins to extend editor functionality. |
|
|
46
|
+
|
|
47
|
+
### ToolbarOptions Defaults
|
|
48
|
+
|
|
49
|
+
By default, all toolbar features are enabled (`true`). You can selectively disable them:
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
<WordEditor
|
|
53
|
+
toolbarOptions={{
|
|
54
|
+
font: { family: true, size: true, bold: true },
|
|
55
|
+
table: false, // Hide table insertion
|
|
56
|
+
media: true,
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
35
61
|
## License
|
|
36
62
|
|
|
37
63
|
MIT © Syntaxic Labs
|
package/dist/index.js
CHANGED
|
@@ -24657,13 +24657,13 @@ function Vl(e, t) {
|
|
|
24657
24657
|
return n;
|
|
24658
24658
|
}
|
|
24659
24659
|
var Hl = ({ initialHTML: t = "<p>Start typing here...</p>", onChange: n, onSave: a, toolbarOptions: f = {}, height: p = "100vh", className: m = "", initialPaddingLeft: h = 20, initialPaddingRight: g = 20, initialIndentLeft: _ = 0, initialIndentRight: v = 0, initialLineSpacing: y = "1.5", initialSpacingBefore: b = 0, initialSpacingAfter: x = 0, plugins: S = [] }) => {
|
|
24660
|
-
let C = o(null), w = o(null), T = o(null), E = o(null), D = o(null), O = o(null), k = o(null), A = o(null), j = o(null), M = t.trim(), N = o(M), [P, F] = s("Home"), I = Vl(f.clipboard, {
|
|
24660
|
+
let C = o(null), w = o(null), T = o(null), E = o(null), D = o(null), O = o(null), k = o(null), A = o(null), j = o(null), M = t.trim(), N = o(M), [P, F] = s("Home"), I = Vl(f.clipboard ?? !0, {
|
|
24661
24661
|
paste: !0,
|
|
24662
24662
|
cut: !0,
|
|
24663
24663
|
copy: !0,
|
|
24664
24664
|
undo: !0,
|
|
24665
24665
|
redo: !0
|
|
24666
|
-
}), L = Vl(f.font, {
|
|
24666
|
+
}), L = Vl(f.font ?? !0, {
|
|
24667
24667
|
family: !0,
|
|
24668
24668
|
size: !0,
|
|
24669
24669
|
bold: !0,
|
|
@@ -24675,7 +24675,7 @@ var Hl = ({ initialHTML: t = "<p>Start typing here...</p>", onChange: n, onSave:
|
|
|
24675
24675
|
highlight: !0,
|
|
24676
24676
|
color: !0,
|
|
24677
24677
|
clear: !0
|
|
24678
|
-
}), R = typeof f.font == "object" ? f.font : {}, z = Vl(f.paragraph, {
|
|
24678
|
+
}), R = typeof f.font == "object" ? f.font : {}, z = Vl(f.paragraph ?? !0, {
|
|
24679
24679
|
bullets: !0,
|
|
24680
24680
|
numbering: !0,
|
|
24681
24681
|
outdent: !0,
|
|
@@ -24686,7 +24686,7 @@ var Hl = ({ initialHTML: t = "<p>Start typing here...</p>", onChange: n, onSave:
|
|
|
24686
24686
|
alignJustify: !0,
|
|
24687
24687
|
lineSpacing: !0,
|
|
24688
24688
|
blockquote: !0
|
|
24689
|
-
}), B = Vl(f.editing, {
|
|
24689
|
+
}), B = Vl(f.editing ?? !0, {
|
|
24690
24690
|
find: !0,
|
|
24691
24691
|
replace: !0,
|
|
24692
24692
|
lock: !0
|
package/dist/index.umd.cjs
CHANGED
|
@@ -219,7 +219,7 @@ Character number: `+e.characterNumber},n.prototype.lineNumber=function(){return
|
|
|
219
219
|
`,r:`\r`,t:` `};function v(e){return e.replace(/\\(.)/g,function(e,t){return _[t]||t})}var y=n.rules.sequence(n.rules.tokenOfType(`open-square-bracket`),n.rules.sequence.cut(),n.rules.sequence.capture(p),n.rules.tokenOfType(`equals`),n.rules.sequence.capture(g),n.rules.tokenOfType(`close-square-bracket`)).map(function(e,t){return{name:e,value:t,append:!1}}),b=n.rules.sequence(n.rules.tokenOfType(`dot`),n.rules.sequence.cut(),n.rules.sequence.capture(p)).map(function(e){return{name:`class`,value:e,append:!0}}),x=n.rules.firstOf(`attribute or class`,y,b);function S(e,t){var r=a(t),i=n.Parser().parseTokens(e,r);return i.isSuccess()?o.success(i.value()):new o.Result(null,[o.warning(C(t,i))])}function C(e,t){return`Did not understand this style mapping, so ignored it: `+e+`
|
|
220
220
|
`+t.errors().map(w).join(`
|
|
221
221
|
`)}function w(e){return`Error was at character number `+e.characterNumber()+`: Expected `+e.expected+` but got `+e.actual}var T=c()})),gc=d((e=>{e.readOptions=i;var t=(so(),h(oo)),n=e._defaultStyleMap=`p.Heading1 => h1:fresh,p.Heading2 => h2:fresh,p.Heading3 => h3:fresh,p.Heading4 => h4:fresh,p.Heading5 => h5:fresh,p.Heading6 => h6:fresh,p[style-name='Heading 1'] => h1:fresh,p[style-name='Heading 2'] => h2:fresh,p[style-name='Heading 3'] => h3:fresh,p[style-name='Heading 4'] => h4:fresh,p[style-name='Heading 5'] => h5:fresh,p[style-name='Heading 6'] => h6:fresh,p[style-name='heading 1'] => h1:fresh,p[style-name='heading 2'] => h2:fresh,p[style-name='heading 3'] => h3:fresh,p[style-name='heading 4'] => h4:fresh,p[style-name='heading 5'] => h5:fresh,p[style-name='heading 6'] => h6:fresh,p.Heading => h1:fresh,p[style-name='Heading'] => h1:fresh,r[style-name='Strong'] => strong,p[style-name='footnote text'] => p:fresh,r[style-name='footnote reference'] =>,p[style-name='endnote text'] => p:fresh,r[style-name='endnote reference'] =>,p[style-name='annotation text'] => p:fresh,r[style-name='annotation reference'] =>,p[style-name='Footnote'] => p:fresh,r[style-name='Footnote anchor'] =>,p[style-name='Endnote'] => p:fresh,r[style-name='Endnote anchor'] =>,p:unordered-list(1) => ul > li:fresh,p:unordered-list(2) => ul|ol > li > ul > li:fresh,p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh,p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh,p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh,p:ordered-list(1) => ol > li:fresh,p:ordered-list(2) => ul|ol > li > ol > li:fresh,p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh,p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh,p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh,r[style-name='Hyperlink'] =>,p[style-name='Normal'] => p:fresh,p.Body => p:fresh,p[style-name='Body'] => p:fresh`.split(`,`),r=e._standardOptions={externalFileAccess:!1,transformDocument:o,includeDefaultStyleMap:!0,includeEmbeddedStyleMap:!0};function i(e){return e||={},t.extend({},r,e,{customStyleMap:a(e.styleMap),readStyleMap:function(){var e=this.customStyleMap;return this.includeEmbeddedStyleMap&&(e=e.concat(a(this.embeddedStyleMap))),this.includeDefaultStyleMap&&(e=e.concat(n)),e}})}function a(e){return e?t.isString(e)?e.split(`
|
|
222
|
-
`).map(function(e){return e.trim()}).filter(function(e){return e!==``&&e.charAt(0)!==`#`}):e:[]}function o(e){return e}})),_c=d((e=>{var t=Uo(),n=Jo();e.openZip=r;function r(e){return e.arrayBuffer?t.resolve(n.openArrayBuffer(e.arrayBuffer)):t.reject(Error(`Could not find file in options`))}})),vc=d((e=>{var t=Js(),n=qs();e.element=r;function r(e){return function(r){return n.elementWithTag(t.element(e),[r])}}})),yc=m(d((e=>{var t=(so(),h(oo)),n=Us(),r=Ws(),i=$s().DocumentConverter;ec().convertElementToRawText;var a=hc().readStyle,o=gc().readOptions,s=_c(),c=Go().Result;e.convertToHtml=l,e.images=Ys(),e.transforms=Ms(),e.underline=vc();function l(e,t){return u(e,t)}function u(e,t){return t=o(t),s.openZip(e).tap(function(e){return r.readStyleMap(e).then(function(e){t.embeddedStyleMap=e})}).then(function(r){return n.read(r,e,t).then(function(e){return e.map(t.transformDocument)}).then(function(e){return d(e,t)})})}function d(e,n){var r=f(n.readStyleMap()),a=new i(t.extend({},n,{styleMap:r.value}));return e.flatMapThen(function(e){return r.flatMapThen(function(t){return a.convertToHtml(e)})})}function f(e){return c.combine((e||[]).map(a)).map(function(e){return e.filter(function(e){return!!e})})}}))(),1);function bc(e,t,n,r){if(!t)return;let i=window.getSelection(),a=[],o=t.closest(`table`);if(o){let e=o.querySelectorAll(`td[data-selected="true"], th[data-selected="true"]`);e.length>0?e.forEach(e=>a.push(e)):i&&i.rangeCount>0&&o.querySelectorAll(`td, th`).forEach(e=>{i.containsNode(e,!0)&&a.push(e)})}a.length===0&&a.push(t);let s=t,c=s.closest(`tbody`)||s.closest(`table`)?.tBodies[0];if(!c)return;let l=c.closest(`table`),u=()=>{let e=[];return Array.from(c.rows).forEach((t,n)=>{e[n]||(e[n]=[]);let r=0;Array.from(t.cells).forEach(t=>{for(;e[n][r];)r++;let i=t.rowSpan||1,a=t.colSpan||1;for(let o=0;o<i;o++)for(let i=0;i<a;i++)e[n+o]||(e[n+o]=[]),e[n+o][r+i]=t;r+=a})}),e},d=()=>{r?.onContentChanged?.()};switch(e){case`insertRowAbove`:{let e=s.parentElement,t=Array.from(c.children).indexOf(e),n=c.insertRow(t);Array.from(e.children).forEach(()=>{let e=n.insertCell();e.style.cssText=s.style.cssText,e.innerHTML=`​`});break}case`insertRowBelow`:{let e=s.parentElement,t=Array.from(c.children).indexOf(e),n=c.insertRow(t+1);Array.from(e.children).forEach(()=>{let e=n.insertCell();e.style.cssText=s.style.cssText,e.innerHTML=`​`});break}case`insertColLeft`:{let e=s.parentElement,t=Array.from(e.children).indexOf(s);Array.from(c.children).forEach(e=>{let n=e.insertCell(t);n.style.cssText=s.style.cssText,n.innerHTML=`​`});break}case`insertColRight`:{let e=s.parentElement,t=Array.from(e.children).indexOf(s);Array.from(c.children).forEach(e=>{let n=e.insertCell(t+1);n.style.cssText=s.style.cssText,n.innerHTML=`​`});break}case`deleteRow`:{let e=s.parentElement,t=Array.from(c.children).indexOf(e);c.deleteRow(t),c.children.length===0&&(l.remove(),r?.onTableDeleted?.());break}case`deleteCol`:{let e=s.parentElement,t=Array.from(e.children).indexOf(s);Array.from(c.children).forEach(e=>{e.children[t]&&e.deleteCell(t)}),c.children[0]?.children.length===0&&(l.remove(),r?.onTableDeleted?.());break}case`deleteTable`:l.remove(),r?.onTableDeleted?.();break;case`mergeCells`:{if(a.length<2)return;let e=u(),t=999,n=-1,r=999,i=-1;a.forEach(a=>{for(let o=0;o<e.length;o++){let s=e[o].indexOf(a);s!==-1&&(t=Math.min(t,o),n=Math.max(n,o+(a.rowSpan||1)-1),r=Math.min(r,s),i=Math.max(i,s+(a.colSpan||1)-1))}});let o=e[t][r];if(!o)return;for(let a=t;a<=n;a++)for(let t=r;t<=i;t++){let n=e[a][t];if(n&&n!==o){n.innerHTML!==`​`&&(o.innerHTML+=n.innerHTML),n.remove();for(let r=0;r<(n.rowSpan||1);r++)for(let i=0;i<(n.colSpan||1);i++)e[a+r][t+i]=o}}o.rowSpan=n-t+1,o.colSpan=i-r+1;break}case`mergeRight`:{let e=u(),t=s.rowSpan||1,n=s.colSpan||1,r=-1,i=-1;for(let t=0;t<e.length;t++){let n=e[t].indexOf(s);if(n!==-1){i=t,r=n;break}}if(r!==-1){let a=r+n,o=new Set;for(let n=i;n<i+t;n++){let t=e[n]?.[a];t&&t!==s&&o.add(t)}o.size>0&&(s.colSpan=n+(Array.from(o)[0].colSpan||1),o.forEach(e=>{e.innerHTML!==`​`&&(s.innerHTML+=e.innerHTML),e.remove()}))}break}case`mergeDown`:{let e=u(),t=s.rowSpan||1,n=s.colSpan||1,r=-1,i=-1;for(let t=0;t<e.length;t++){let n=e[t].indexOf(s);if(n!==-1){i=t,r=n;break}}if(i!==-1){let a=i+t,o=new Set;for(let t=r;t<r+n;t++){let n=e[a]?.[t];n&&n!==s&&o.add(n)}o.size>0&&(s.rowSpan=t+(Array.from(o)[0].rowSpan||1),o.forEach(e=>{e.innerHTML!==`​`&&(s.innerHTML+=e.innerHTML),e.remove()}))}break}case`cellColor`:a.forEach(e=>{e.style.backgroundColor=n}),d();break;case`cellBorder`:a.forEach(e=>{e.style.border=n}),d();break;case`borderTop`:a.forEach(e=>{e.style.borderTop=n||`1px solid black`});break;case`borderBottom`:a.forEach(e=>{e.style.borderBottom=n||`1px solid black`});break;case`borderLeft`:a.forEach(e=>{e.style.borderLeft=n||`1px solid black`});break;case`borderRight`:a.forEach(e=>{e.style.borderRight=n||`1px solid black`});break;case`borderAll`:a.forEach(e=>{e.style.border=n||`1px solid black`});break;case`borderNone`:a.forEach(e=>{e.style.border=`none`});break;case`paddingTopPlus`:a.forEach(e=>{let t=parseInt(e.style.paddingTop)||0;e.style.paddingTop=`${t+1}px`}),d();break;case`paddingTopMinus`:a.forEach(e=>{let t=parseInt(e.style.paddingTop)||0;t>0&&(e.style.paddingTop=`${t-1}px`)}),d();break;case`paddingBottomPlus`:a.forEach(e=>{let t=parseInt(e.style.paddingBottom)||0;e.style.paddingBottom=`${t+1}px`}),d();break;case`paddingBottomMinus`:a.forEach(e=>{let t=parseInt(e.style.paddingBottom)||0;t>0&&(e.style.paddingBottom=`${t-1}px`)}),d();break;case`paddingLeftPlus`:a.forEach(e=>{let t=parseInt(e.style.paddingLeft)||0;e.style.paddingLeft=`${t+1}px`}),d();break;case`paddingLeftMinus`:a.forEach(e=>{let t=parseInt(e.style.paddingLeft)||0;t>0&&(e.style.paddingLeft=`${t-1}px`)}),d();break;case`paddingRightPlus`:a.forEach(e=>{let t=parseInt(e.style.paddingRight)||0;e.style.paddingRight=`${t+1}px`}),d();break;case`paddingRightMinus`:a.forEach(e=>{let t=parseInt(e.style.paddingRight)||0;t>0&&(e.style.paddingRight=`${t-1}px`)}),d();break;case`splitCell`:{let e=s.parentElement,t=Array.from(e.children).indexOf(s),n=Array.from(c.children).indexOf(e),r=s.colSpan||1,i=s.rowSpan||1;if(r>1||i>1){s.colSpan=1,s.rowSpan=1;for(let n=1;n<r;n++){let n=e.insertCell(t+1);n.style.cssText=s.style.cssText,n.style.backgroundColor=``,n.innerHTML=`​`}for(let e=1;e<i;e++){let i=c.rows[n+e];if(i)for(let e=0;e<r;e++){let e=i.insertCell(t);e.style.cssText=s.style.cssText,e.style.backgroundColor=``,e.innerHTML=`​`}}}break}case`alignTop`:a.forEach(e=>{e.style.verticalAlign=`top`});break;case`alignMiddle`:a.forEach(e=>{e.style.verticalAlign=`middle`});break;case`alignBottom`:a.forEach(e=>{e.style.verticalAlign=`bottom`});break;case`justifyLeft`:a.forEach(e=>{e.style.textAlign=`left`});break;case`justifyCenter`:a.forEach(e=>{e.style.textAlign=`center`});break;case`justifyRight`:a.forEach(e=>{e.style.textAlign=`right`});break;case`justifyFull`:a.forEach(e=>{e.style.textAlign=`justify`});break}r?.onFocusRequested?.()}var xc=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Sc=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Cc={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},wc=(0,t.forwardRef)(({color:e=`currentColor`,size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:a=``,children:o,iconNode:s,...c},l)=>(0,t.createElement)(`svg`,{ref:l,...Cc,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:Sc(`lucide`,a),...c},[...s.map(([e,n])=>(0,t.createElement)(e,n)),...Array.isArray(o)?o:[o]])),Q=(e,n)=>{let r=(0,t.forwardRef)(({className:r,...i},a)=>(0,t.createElement)(wc,{ref:a,iconNode:n,className:Sc(`lucide-${xc(e)}`,r),...i}));return r.displayName=`${e}`,r},Tc=Q(`AlignCenter`,[[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 18H5`,key:`18s9l3`}],[`path`,{d:`M21 6H3`,key:`1jwq7v`}]]),Ec=Q(`AlignJustify`,[[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 18h18`,key:`1h113x`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}]]),Dc=Q(`AlignLeft`,[[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 18H3`,key:`1amg6g`}],[`path`,{d:`M21 6H3`,key:`1jwq7v`}]]),Oc=Q(`AlignRight`,[[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 18H7`,key:`1ygte8`}],[`path`,{d:`M21 6H3`,key:`1jwq7v`}]]),kc=Q(`AlignVerticalJustifyCenter`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`16`,rx:`2`,key:`1i8z2d`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`2`,rx:`2`,key:`ypihtt`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Ac=Q(`AlignVerticalJustifyEnd`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`12`,rx:`2`,key:`4l4tp2`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`2`,rx:`2`,key:`ypihtt`}],[`path`,{d:`M2 22h20`,key:`272qi7`}]]),jc=Q(`AlignVerticalJustifyStart`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`16`,rx:`2`,key:`1i8z2d`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`6`,rx:`2`,key:`13squh`}],[`path`,{d:`M2 2h20`,key:`1ennik`}]]),Mc=Q(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Nc=Q(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Pc=Q(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Fc=Q(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Ic=Q(`Bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),Lc=Q(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Rc=Q(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),zc=Q(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Bc=Q(`CircleCheckBig`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Vc=Q(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Hc=Q(`ClipboardPaste`,[[`path`,{d:`M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z`,key:`1pp7kr`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10`,key:`2ik1ml`}],[`path`,{d:`m17 10 4 4-4 4`,key:`vp2hj1`}]]),Uc=Q(`Combine`,[[`path`,{d:`M10 18H5a3 3 0 0 1-3-3v-1`,key:`ru65g8`}],[`path`,{d:`M14 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2`,key:`e30een`}],[`path`,{d:`M20 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2`,key:`2ahx8o`}],[`path`,{d:`m7 21 3-3-3-3`,key:`127cv2`}],[`rect`,{x:`14`,y:`14`,width:`8`,height:`8`,rx:`2`,key:`1b0bso`}],[`rect`,{x:`2`,y:`2`,width:`8`,height:`8`,rx:`2`,key:`1x09vl`}]]),Wc=Q(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Gc=Q(`Eraser`,[[`path`,{d:`m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21`,key:`182aya`}],[`path`,{d:`M22 21H7`,key:`t4ddhn`}],[`path`,{d:`m5 11 9 9`,key:`1mo9qw`}]]),Kc=Q(`FileCode`,[[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}]]),qc=Q(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Jc=Q(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Yc=Q(`IndentDecrease`,[[`path`,{d:`M21 12H11`,key:`wd7e0v`}],[`path`,{d:`M21 18H11`,key:`4wu86t`}],[`path`,{d:`M21 6H11`,key:`6dy1d6`}],[`path`,{d:`m7 8-4 4 4 4`,key:`o5hrat`}]]),Xc=Q(`IndentIncrease`,[[`path`,{d:`M21 12H11`,key:`wd7e0v`}],[`path`,{d:`M21 18H11`,key:`4wu86t`}],[`path`,{d:`M21 6H11`,key:`6dy1d6`}],[`path`,{d:`m3 8 4 4-4 4`,key:`1a3j6y`}]]),Zc=Q(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Qc=Q(`Italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),$c=Q(`Link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),el=Q(`ListOrdered`,[[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 18h11`,key:`11hvi2`}],[`path`,{d:`M10 6h11`,key:`c7qv1k`}],[`path`,{d:`M4 10h2`,key:`16xx2s`}],[`path`,{d:`M4 6h1v4`,key:`cnovpq`}],[`path`,{d:`M6 18H4c0-1 2-2 2-3s-1-1.5-2-1`,key:`m9a95d`}]]),tl=Q(`List`,[[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 18h.01`,key:`1tta3j`}],[`path`,{d:`M3 6h.01`,key:`1rqtza`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 18h13`,key:`1lx6n3`}],[`path`,{d:`M8 6h13`,key:`ik3vkj`}]]),nl=Q(`Maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),rl=Q(`MoveVertical`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m8 18 4 4 4-4`,key:`bh5tu3`}],[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}]]),il=Q(`PaintBucket`,[[`path`,{d:`m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z`,key:`irua1i`}],[`path`,{d:`m5 2 5 5`,key:`1lls2c`}],[`path`,{d:`M2 13h15`,key:`1hkzvu`}],[`path`,{d:`M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z`,key:`xk76lq`}]]),al=Q(`Printer`,[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]),ol=Q(`Quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),sl=Q(`Redo`,[[`path`,{d:`M21 7v6h-6`,key:`3ptur4`}],[`path`,{d:`M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7`,key:`1kgawr`}]]),cl=Q(`Replace`,[[`path`,{d:`M14 4a2 2 0 0 1 2-2`,key:`1w2hp7`}],[`path`,{d:`M16 10a2 2 0 0 1-2-2`,key:`shjach`}],[`path`,{d:`M20 2a2 2 0 0 1 2 2`,key:`188mtx`}],[`path`,{d:`M22 8a2 2 0 0 1-2 2`,key:`ddf4tu`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a3 3 0 0 1 3-3h1`,key:`3y3t5z`}],[`rect`,{x:`2`,y:`14`,width:`8`,height:`8`,rx:`2`,key:`4rksxw`}]]),ll=Q(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ul=Q(`Save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),dl=Q(`Scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),fl=Q(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),pl=Q(`Split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),ml=Q(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),hl=Q(`Strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),gl=Q(`Table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),_l=Q(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),vl=Q(`Underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),yl=Q(`Undo`,[[`path`,{d:`M3 7v6h6`,key:`1v2h90`}],[`path`,{d:`M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13`,key:`1r6uu6`}]]),bl=Q(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),$=({onClick:e,icon:t,title:n,isActive:i=!1,className:a=``,label:o=``,disabled:s=!1,...c})=>(0,r.jsxs)(`button`,{onMouseDown:t=>{s||(t.preventDefault(),e&&e(t))},title:n,disabled:s,className:`p-1.5 border rounded-sm transition-all flex flex-col items-center justify-center ${s?`opacity-50 cursor-not-allowed border-transparent`:i?`bg-[#c1d3ee] border-[#2b579a] shadow-inner`:`hover:bg-[#d0d0d0] border-transparent hover:border-gray-400`} ${a}`,...c,children:[t,o&&(0,r.jsx)(`span`,{className:`text-[8px] mt-0.5`,children:o})]}),xl=({showHtml:e,execCommand:i,activeStyles:a,fontConf:o,paragraphConf:s,changeLineSpacing:c,changeListStyleType:l,clipboardConf:u,handlePaste:d,toggleHtmlView:f,onOpenFind:p,onOpenReplace:m,editingConf:h,pluginContributions:g=[],toggleSelectionLock:_,fonts:v,sizes:y,saveSelection:b,openTextColorPicker:x,openHighlightColorPicker:S})=>{let[C,w]=t.default.useState({type:`ul`,open:!1,x:0,y:0}),[T,E]=t.default.useState({open:!1,x:0,y:0}),D=t=>g.filter(e=>e.groupId===t).map((n,c)=>(0,r.jsx)(n.component,{execCommand:i,activeStyles:a,showHtml:e,toggleHtmlView:f,onOpenFind:p,onOpenReplace:m,toggleSelectionLock:_,fonts:v,sizes:y,saveSelection:b,openTextColorPicker:x,openHighlightColorPicker:S,fontConf:o,paragraphConf:s,clipboardConf:u,editingConf:h},`plugin-${t}-${c}`)),O=(e,t)=>{e.preventDefault();let n=e.currentTarget.getBoundingClientRect();w({type:t,open:!0,x:n.left,y:n.bottom})};return(0,r.jsxs)(r.Fragment,{children:[u&&(0,r.jsxs)(`div`,{className:`flex gap-2 pr-2 mr-2 relative h-[88px] pb-[18px] items-center border-r border-gray-300`,children:[(0,r.jsxs)(`div`,{className:`flex flex-row items-center gap-1`,children:[u.paste&&(0,r.jsxs)(`button`,{onClick:d,disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-gray-200 border border-transparent hover:border-gray-300 rounded-sm h-[60px] w-[50px] transition-all disabled:opacity-50 group`,title:`Paste (Ctrl+V)`,children:[(0,r.jsx)(Hc,{size:28,className:`text-[#2b579a] mb-0.5 group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[9px] font-medium uppercase text-gray-600`,children:`Paste`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u.cut&&(0,r.jsx)($,{onClick:()=>i(`cut`),icon:(0,r.jsx)(dl,{size:14}),disabled:e,title:`Cut (Ctrl+X)`}),u.undo&&(0,r.jsx)($,{onClick:()=>i(`undo`),icon:(0,r.jsx)(yl,{size:14}),disabled:e,title:`Undo (Ctrl+Z)`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u.copy&&(0,r.jsx)($,{onClick:()=>i(`copy`),icon:(0,r.jsx)(Wc,{size:14}),disabled:e,title:`Copy (Ctrl+C)`}),u.redo&&(0,r.jsx)($,{onClick:()=>i(`redo`),icon:(0,r.jsx)(sl,{size:14}),disabled:e,title:`Redo (Ctrl+Y)`})]})]})]}),(0,r.jsx)(`div`,{className:`pt-2`,children:D(`clipboard`)}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-bold tracking-tighter`,children:`Clipboard`})]}),o&&(0,r.jsxs)(`div`,{className:`flex flex-col border-r border-gray-300 pr-2 mr-2 relative h-[88px] pb-[18px] justify-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-1`,children:[(0,r.jsxs)(`div`,{className:`flex items-center`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col item-center gap-0 5`,children:[o.bold&&(0,r.jsx)($,{onClick:()=>i(`bold`),icon:(0,r.jsx)(Ic,{size:14}),isActive:a.bold,disabled:e,title:`Bold (Ctrl+B)`}),o.italic&&(0,r.jsx)($,{onClick:()=>i(`italic`),icon:(0,r.jsx)(Qc,{size:14}),isActive:a.italic,disabled:e,title:`Italic (Ctrl+I)`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col item-center gap-0 5`,children:[o.underline&&(0,r.jsx)($,{onClick:()=>i(`underline`),icon:(0,r.jsx)(vl,{size:14}),isActive:a.underline,disabled:e,title:`Underline (Ctrl+U)`}),o.strikeThrough&&(0,r.jsx)($,{onClick:()=>i(`strikeThrough`),icon:(0,r.jsx)(hl,{size:14}),isActive:a.strikeThrough,disabled:e,title:`Strikethrough`})]})]}),D(`font`)]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-bold tracking-tighter`,children:`Font`})]}),s&&(0,r.jsxs)(`div`,{className:`flex flex-col border-r border-gray-300 pr-2 mr-2 relative h-[88px] pb-[18px] justify-center`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[s.bullets&&(0,r.jsx)($,{onClick:e=>O(e,`ul`),icon:(0,r.jsx)(tl,{size:14}),isActive:a.insertUnorderedList,disabled:e,title:`Bullets`}),s.numbering&&(0,r.jsx)($,{onClick:e=>O(e,`ol`),icon:(0,r.jsx)(el,{size:14}),isActive:a.insertOrderedList,disabled:e,title:`Numbering`}),(s.bullets||s.numbering)&&(0,r.jsx)(`div`,{className:`w-px h-4 bg-gray-300 mx-1`}),s.outdent&&(0,r.jsx)($,{onClick:()=>i(`outdent`),icon:(0,r.jsx)(Yc,{size:14}),disabled:e,title:`Decrease Indent`}),s.indent&&(0,r.jsx)($,{onClick:()=>i(`indent`),icon:(0,r.jsx)(Xc,{size:14}),disabled:e,title:`Increase Indent`}),(s.outdent||s.indent)&&(0,r.jsx)(`div`,{className:`w-px h-4 bg-gray-300 mx-1`}),s.lineSpacing&&(0,r.jsx)(`div`,{className:`relative`,children:(0,r.jsx)($,{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();E({open:!0,x:t.left,y:t.bottom})},icon:(0,r.jsx)(rl,{size:14}),disabled:e,title:`Line Spacing`})}),s.blockquote&&(0,r.jsx)($,{onClick:()=>i(`formatBlock`,`blockquote`),icon:(0,r.jsx)(ol,{size:14}),disabled:e,title:`Quote`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[s.alignLeft&&(0,r.jsx)($,{onClick:()=>i(`justifyLeft`),icon:(0,r.jsx)(Dc,{size:14}),isActive:a.justifyLeft,disabled:e,title:`Align Left (Ctrl+L)`}),s.alignCenter&&(0,r.jsx)($,{onClick:()=>i(`justifyCenter`),icon:(0,r.jsx)(Tc,{size:14}),isActive:a.justifyCenter,disabled:e,title:`Align Center (Ctrl+E)`}),s.alignRight&&(0,r.jsx)($,{onClick:()=>i(`justifyRight`),icon:(0,r.jsx)(Oc,{size:14}),isActive:a.justifyRight,disabled:e,title:`Align Right (Ctrl+R)`}),s.alignJustify&&(0,r.jsx)($,{onClick:()=>i(`justifyFull`),icon:(0,r.jsx)(Ec,{size:14}),isActive:a.justifyFull,disabled:e,title:`Justify (Ctrl+J)`})]})]}),D(`paragraph`),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-bold tracking-tighter`,children:`Paragraph`})]}),h&&(0,r.jsxs)(`div`,{className:`flex flex-col border-r border-gray-300 pr-2 mr-2 relative h-[88px] pb-[18px] justify-center`,children:[(0,r.jsxs)(`div`,{className:`flex flex-row items-center gap-1 h-full`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[h.find&&(0,r.jsxs)(`button`,{onClick:p,disabled:e,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group`,children:[(0,r.jsx)(fl,{size:14,className:`text-[#2b579a] group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Find`})]}),h.replace&&(0,r.jsxs)(`button`,{onClick:m,disabled:e,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group`,children:[(0,r.jsx)(cl,{size:14,className:`text-[#2b579a] group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Replace`})]})]}),D(`editing`)]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-bold tracking-tighter`,children:`Editing`})]}),D(`custom`),C.open&&n.default.createPortal((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`fixed inset-0 z-[98]`,onClick:()=>w(e=>({...e,open:!1}))}),(0,r.jsx)(`div`,{className:`fixed bg-white border border-gray-200 shadow-xl z-[99] py-1 rounded-sm flex flex-col min-w-[120px]`,style:{left:C.x,top:C.y},children:C.type===`ul`?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`button`,{onClick:()=>{l(`disc`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100 flex items-center gap-2`,children:[(0,r.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-black`}),` Dot`]}),(0,r.jsxs)(`button`,{onClick:()=>{l(`circle`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100 flex items-center gap-2`,children:[(0,r.jsx)(`div`,{className:`w-2 h-2 rounded-full border border-black`}),` Circle`]}),(0,r.jsxs)(`button`,{onClick:()=>{l(`square`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100 flex items-center gap-2`,children:[(0,r.jsx)(`div`,{className:`w-2 h-2 bg-black`}),` Square`]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`button`,{onClick:()=>{l(`decimal`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`1. Number`}),(0,r.jsx)(`button`,{onClick:()=>{l(`lower-alpha`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`a. Lower Alpha`}),(0,r.jsx)(`button`,{onClick:()=>{l(`upper-alpha`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`A. Upper Alpha`}),(0,r.jsx)(`button`,{onClick:()=>{l(`lower-roman`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`i. Lower Roman`}),(0,r.jsx)(`button`,{onClick:()=>{l(`upper-roman`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`I. Upper Roman`})]})})]}),document.body),T.open&&n.default.createPortal((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`fixed inset-0 z-[98]`,onClick:()=>E(e=>({...e,open:!1}))}),(0,r.jsx)(`div`,{className:`fixed bg-white border border-gray-200 shadow-xl z-[99] py-1 rounded-sm flex flex-col min-w-[80px] animate-in fade-in slide-in-from-top-1 duration-100`,style:{left:T.x,top:T.y+4},children:[`1.0`,`1.15`,`1.5`,`2.0`,`2.5`,`3.0`].map(e=>(0,r.jsx)(`button`,{onClick:()=>{c(e),E(e=>({...e,open:!1}))},className:`w-full text-left px-4 py-2 text-xs hover:bg-gray-100 transition-colors font-medium text-gray-700`,children:e},e))})]}),document.body)]})},Sl=({showHtml:e,tableConf:i,tableMenuRef:a,isTableMenuOpen:o,setIsTableMenuOpen:s,tableGridSize:c,setTableGridSize:l,handleInsertTable:u,mediaConf:d,imageInputRef:f,linkConf:p,execCommand:m,saveSelection:h,isLinkMenuOpen:g,setIsLinkMenuOpen:_,linkUrl:v,setLinkUrl:y})=>{let[b,x]=(0,t.useState)({top:0,left:0}),S=t.default.useRef(null);(0,t.useLayoutEffect)(()=>{if(o&&a.current){let e=a.current.getBoundingClientRect();x({top:e.bottom+4,left:e.left})}},[o,a]),(0,t.useLayoutEffect)(()=>{if(g&&S.current){let e=S.current.getBoundingClientRect();x({top:e.bottom+4,left:e.left})}},[g]);let C=()=>{if(h(),y(`https://`),S.current){let e=S.current.getBoundingClientRect();x({top:e.bottom+4,left:e.left})}_(!0)},w=()=>{m(`createLink`,v),_(!1),y(`https://`)};return(0,r.jsxs)(r.Fragment,{children:[i&&(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,ref:a,children:[(0,r.jsxs)(`div`,{className:`relative`,children:[(0,r.jsxs)(`button`,{onClick:()=>s(e=>!e),disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all ${o?`bg-gray-300 border-gray-400`:``} disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,r.jsx)(gl,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsxs)(`span`,{className:`text-[9px] font-medium flex items-center gap-0.5`,children:[`Table `,(0,r.jsx)(Lc,{size:10})]})]}),o&&!e&&n.default.createPortal((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`fixed inset-0 z-[99]`,onClick:()=>s(!1)}),(0,r.jsxs)(`div`,{className:`fixed z-[100] bg-[#f6f8fb] border border-gray-400 shadow-2xl p-4 rounded-xl flex flex-col items-center pointer-events-auto`,style:{top:b.top,left:b.left},children:[(0,r.jsx)(`div`,{className:`text-sm text-gray-800 mb-3 text-center font-bold whitespace-nowrap`,children:c.r>0?`Insert Table ${c.c}×${c.r}`:`Choose Table Dimensions`}),(0,r.jsx)(`div`,{className:`flex flex-col gap-[2px] bg-white border border-gray-300 p-2 rounded-lg`,onMouseLeave:()=>l({r:0,c:0}),children:[...Array(8)].map((e,t)=>(0,r.jsx)(`div`,{className:`flex gap-[2px]`,children:[...Array(10)].map((e,n)=>{let i=t+1,a=n+1;return(0,r.jsx)(`div`,{className:`w-5 h-5 border rounded-sm cursor-pointer transition-colors ${i<=c.r&&a<=c.c?`bg-[#c1d3ee] border-[#2b579a]`:`bg-white border-gray-200 hover:border-blue-400`}`,onMouseEnter:()=>l({r:i,c:a}),onMouseDown:e=>{e.preventDefault(),u(i,a),s(!1)}},n)})},t))})]})]}),document.body)]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Table`})]}),d&&(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`button`,{onClick:()=>f.current?.click(),disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all disabled:opacity-50`,title:`Insert Picture`,children:[(0,r.jsx)(Jc,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsx)(`span`,{className:`text-[9px] font-medium`,children:`Picture`})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Media`})]}),p&&(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`relative`,ref:S,children:[(0,r.jsxs)(`button`,{onClick:C,disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all ${g?`bg-gray-300 border-gray-400`:``} disabled:opacity-50`,title:`Insert Link`,children:[(0,r.jsx)($c,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsx)(`span`,{className:`text-[9px] font-medium`,children:`Link`})]}),g&&!e&&n.default.createPortal((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`fixed inset-0 z-[99]`,onClick:()=>_(!1)}),(0,r.jsxs)(`div`,{className:`fixed z-[100] bg-white border border-gray-300 shadow-xl p-3 rounded-lg flex flex-col gap-2 min-w-[240px]`,style:{top:b.top,left:b.left},children:[(0,r.jsx)(`label`,{className:`text-xs font-semibold text-gray-700`,children:`Address:`}),(0,r.jsx)(`input`,{autoFocus:!0,type:`text`,value:v,onChange:e=>y(e.target.value),onKeyDown:e=>e.key===`Enter`&&w(),className:`border border-gray-300 rounded px-2 py-1 text-sm outline-none focus:border-blue-500`,placeholder:`https://example.com`}),(0,r.jsxs)(`div`,{className:`flex justify-end gap-2 mt-1`,children:[(0,r.jsx)(`button`,{onClick:()=>_(!1),className:`px-3 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded`,children:`Cancel`}),(0,r.jsx)(`button`,{onClick:w,className:`px-3 py-1 text-xs bg-[#2b579a] text-white rounded hover:bg-[#1a3a6a]`,children:`OK`})]})]})]}),document.body)]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Links`})]})]})},Cl=({showHtml:e,inputIndentLeft:t,setInputIndentLeft:n,inputIndentRight:i,setInputIndentRight:a,applyIndent:o,inputSpacingBefore:s,setInputSpacingBefore:c,inputSpacingAfter:l,setInputSpacingAfter:u,applySpacing:d,insertPageBreak:f,pagesConf:p})=>(0,r.jsxs)(r.Fragment,{children:[p&&!e&&(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`button`,{onClick:f,disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all disabled:opacity-50`,title:`Page Break (Ctrl+Enter)`,children:[(0,r.jsx)(dl,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsxs)(`span`,{className:`text-[9px] font-medium text-center leading-tight`,children:[`Page`,(0,r.jsx)(`br`,{}),`Break`]})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Page Setup`})]}),!e&&(0,r.jsxs)(`div`,{className:`flex gap-2 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col gap-1 justify-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5 h-6`,children:[(0,r.jsx)(`span`,{className:`text-[10px] text-gray-700 w-[60px] text-right`,children:`Indent Left`}),(0,r.jsx)(`input`,{type:`text`,"data-field":`indentLeft`,value:t,onChange:e=>{n(e.target.value);let t=parseFloat(e.target.value);isNaN(t)||o(`left`,t)},className:`w-14 h-6 border border-gray-300 rounded bg-white px-1.5 text-xs outline-none focus:border-[#2b579a] transition-colors tabular-nums`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5 h-6`,children:[(0,r.jsx)(`span`,{className:`text-[10px] text-gray-700 w-[60px] text-right`,children:`Indent Right`}),(0,r.jsx)(`input`,{type:`text`,"data-field":`indentRight`,value:i,onChange:e=>{a(e.target.value);let t=parseFloat(e.target.value);isNaN(t)||o(`right`,t)},className:`w-14 h-6 border border-gray-300 rounded bg-white px-1.5 text-xs outline-none focus:border-[#2b579a] transition-colors tabular-nums`})]})]}),(0,r.jsxs)(`div`,{className:`flex flex-col gap-1 justify-center pl-2 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5 h-6`,children:[(0,r.jsx)(`span`,{className:`text-[10px] text-gray-700 w-[70px] text-right`,children:`Spacing Before`}),(0,r.jsx)(`input`,{type:`text`,"data-field":`spacingBefore`,value:s,onChange:e=>{c(e.target.value);let t=parseFloat(e.target.value);isNaN(t)||d(`before`,t)},className:`w-14 h-6 border border-gray-300 rounded bg-white px-1.5 text-xs outline-none focus:border-[#2b579a] transition-colors tabular-nums`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5 h-6`,children:[(0,r.jsx)(`span`,{className:`text-[10px] text-gray-700 w-[70px] text-right`,children:`Spacing After`}),(0,r.jsx)(`input`,{type:`text`,"data-field":`spacingAfter`,value:l,onChange:e=>{u(e.target.value);let t=parseFloat(e.target.value);isNaN(t)||d(`after`,t)},className:`w-14 h-6 border border-gray-300 rounded bg-white px-1.5 text-xs outline-none focus:border-[#2b579a] transition-colors tabular-nums`})]})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Paragraph`})]})]}),wl=[`#ffffff`,`#000000`,`#eeece1`,`#1f497d`,`#4f81bd`,`#c0504d`,`#9bbb59`,`#8064a2`,`#4bacc6`,`#f79646`],Tl=[[`#f2f2f2`,`#7f7f7f`,`#ddd9c3`,`#c6d9f0`,`#dbe5f1`,`#f2dcdb`,`#ebf1de`,`#e5e0ec`,`#dbeef3`,`#fdeada`],[`#d8d8d8`,`#595959`,`#c4bd97`,`#8db3e2`,`#b8cce4`,`#e5b9b7`,`#d7e3bc`,`#ccc1d9`,`#b7dde8`,`#fbd5b5`],[`#bfbfbf`,`#3f3f3f`,`#938953`,`#548dd4`,`#95b3d7`,`#d99694`,`#c3d69b`,`#b2a2c7`,`#93cddd`,`#fac08f`],[`#a5a5a5`,`#262626`,`#494429`,`#17365d`,`#365f91`,`#953734`,`#76923c`,`#5f497a`,`#31859b`,`#e36c09`],[`#7f7f7f`,`#0c0c0c`,`#1d1b10`,`#0f243e`,`#243f60`,`#632423`,`#4f6128`,`#3f3151`,`#205867`,`#974806`]],El=[`#c00000`,`#ff0000`,`#ffc000`,`#ffff00`,`#92d050`,`#00b050`,`#00b0f0`,`#0070c0`,`#002060`,`#7030a0`],Dl=({label:e,icon:i,onSelect:a,disabled:o,onOpen:s,variant:c=`big`,activeColor:l})=>{let[u,d]=(0,t.useState)(!1),[f,p]=(0,t.useState)(null),m=(0,t.useRef)(null),h=(0,t.useRef)(null),[g,_]=(0,t.useState)(`#000000`),v=(0,t.useRef)(null),y=e=>{e.preventDefault(),!o&&(u?d(!1):(s?.(),d(!0)))};(0,t.useEffect)(()=>{if(!u)return;let e=()=>{let e=m.current?.getBoundingClientRect();e&&p({top:e.bottom,left:e.left})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[u]),(0,t.useEffect)(()=>{let e=e=>{if(u){let t=e.target,n=m.current?.contains(t),r=h.current?.contains(t),i=t===v.current;!n&&!r&&!i&&d(!1)}};return document.addEventListener(`mousedown`,e,!0),()=>document.removeEventListener(`mousedown`,e,!0)},[u]);let b=(e,t)=>{e.preventDefault(),a(t),d(!1)},x=()=>{v.current&&v.current.click()},S=e=>{let t=e.target.value;_(t),a(t)},C=c===`compact`;return(0,r.jsxs)(`div`,{className:`relative inline-block`,children:[(0,r.jsxs)(`button`,{ref:m,onMouseDown:y,disabled:o,title:e,className:`flex flex-col items-center justify-center border border-transparent transition-all disabled:opacity-50 ${C?`h-8 px-1 mt-0.5 hover:bg-white hover:border-gray-300 hover:shadow-sm`:`h-[52px] w-[36px] hover:bg-gray-50 hover:border-gray-300 hover:shadow-sm`} ${u?`bg-white border-gray-300 shadow-inner`:``}`,children:[(0,r.jsxs)(`div`,{className:`relative flex flex-col items-center ${C?`scale-90`:``}`,children:[i,l&&(0,r.jsx)(`div`,{className:`absolute -bottom-0.5 left-0 right-0 h-[3px] rounded-full shadow-[0_1px_1px_rgba(0,0,0,0.1)]`,style:{backgroundColor:l}})]}),(0,r.jsx)(Lc,{size:C?8:10,className:`text-gray-400 mt-0.5 transition-transform ${u?`rotate-180`:``}`})]}),u&&f&&n.default.createPortal((0,r.jsxs)(`div`,{ref:h,className:`fixed z-[9999] bg-white border border-gray-300 shadow-xl p-3 select-none flex flex-col gap-3`,style:{top:`${f.top+4}px`,left:`${f.left}px`,maxWidth:`100vw`},onMouseDown:e=>e.preventDefault(),children:[(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`div`,{className:`text-[10px] font-bold text-gray-500 mb-1.5 uppercase tracking-wider`,children:`Theme Colors`}),(0,r.jsxs)(`div`,{className:`flex flex-col`,children:[(0,r.jsx)(`div`,{className:`flex`,children:wl.map(e=>(0,r.jsx)(`div`,{onMouseDown:t=>b(t,e),className:`w-[18px] h-[18px] border border-gray-200 cursor-pointer hover:scale-125 transition-transform z-10`,style:{backgroundColor:e}},e))}),Tl.map((e,t)=>(0,r.jsx)(`div`,{className:`flex`,children:e.map(e=>(0,r.jsx)(`div`,{onMouseDown:t=>b(t,e),className:`w-[18px] h-[18px] border border-gray-100 cursor-pointer hover:scale-125 transition-transform z-10`,style:{backgroundColor:e}},e))},t))]})]}),(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`div`,{className:`text-[10px] font-bold text-gray-500 mb-1.5 uppercase tracking-wider`,children:`Standard Colors`}),(0,r.jsx)(`div`,{className:`flex`,children:El.map(e=>(0,r.jsx)(`div`,{onMouseDown:t=>b(t,e),className:`w-[18px] h-[18px] border border-gray-200 cursor-pointer hover:scale-125 transition-transform z-10`,style:{backgroundColor:e},title:e},e))})]}),(0,r.jsxs)(`div`,{className:`border-t border-gray-200 pt-2 flex flex-col gap-1`,children:[(0,r.jsxs)(`button`,{onMouseDown:e=>b(e,null),className:`flex items-center gap-2 px-2 py-1.5 hover:bg-gray-100 rounded text-xs text-gray-700 transition-colors w-full text-left`,children:[(0,r.jsx)(Gc,{size:14,className:`text-gray-500`}),(0,r.jsx)(`span`,{children:`No Color`})]}),(0,r.jsxs)(`button`,{onMouseDown:e=>{e.preventDefault(),x()},className:`flex items-center gap-2 px-2 py-1.5 hover:bg-blue-50 rounded text-xs text-blue-700 transition-colors w-full text-left font-medium`,children:[(0,r.jsx)(`div`,{className:`w-3.5 h-3.5 rounded-full border border-blue-200`,style:{background:`conic-gradient(red, yellow, lime, aqua, blue, magenta, red)`}}),(0,r.jsx)(`span`,{children:`More Colors...`})]}),(0,r.jsx)(`div`,{className:`mt-1 border-t border-gray-100 pt-1`,children:(0,r.jsx)(`button`,{onMouseDown:e=>{e.preventDefault(),d(!1)},className:`w-full py-1 text-[10px] font-bold text-gray-400 hover:text-gray-600 uppercase tracking-tighter`,children:`Close Picker`})}),(0,r.jsx)(`input`,{ref:v,type:`color`,value:g,onChange:S,style:{opacity:0,position:`absolute`,pointerEvents:`none`}})]})]}),document.body)]})},Ol=({showHtml:e,activeTableCell:t,handleTableAction:n,saveSelection:i})=>{if(!t||e)return null;let a=e=>{let n=`padding${e}`,r=t.style[n];return r?parseInt(r):8};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-2 items-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`insertRowAbove`),icon:(0,r.jsx)(Fc,{size:14,className:`text-[#2b579a]`}),title:`Insert Above`}),(0,r.jsx)($,{onClick:()=>n(`insertRowBelow`),icon:(0,r.jsx)(Mc,{size:14,className:`text-[#2b579a]`}),title:`Insert Below`})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Rows`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`insertColLeft`),icon:(0,r.jsx)(Nc,{size:14,className:`text-[#2b579a]`}),title:`Insert Left`}),(0,r.jsx)($,{onClick:()=>n(`insertColRight`),icon:(0,r.jsx)(Pc,{size:14,className:`text-[#2b579a]`}),title:`Insert Right`})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Cols`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col items-center justify-start h-full pt-1 border-l border-gray-200 pl-2`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`deleteRow`),icon:(0,r.jsx)(_l,{size:14,className:`text-red-500`}),title:`Delete Row`,label:`Row`}),(0,r.jsx)($,{onClick:()=>n(`deleteCol`),icon:(0,r.jsx)(_l,{size:14,className:`text-red-500`}),title:`Delete Col`,label:`Col`}),(0,r.jsx)($,{onClick:()=>n(`deleteTable`),icon:(0,r.jsx)(_l,{size:14,className:`text-red-700`}),title:`Delete All`,label:`All`})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Delete`})]})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Rows & Columns`})]}),(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5 items-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsx)(`div`,{className:`flex gap-0.5`,children:(0,r.jsx)($,{onClick:()=>n(`mergeCells`),icon:(0,r.jsx)(Uc,{size:14,className:`text-[#2b579a]`}),title:`Merge Selected Cells`,label:`Selection`})}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Merge`})]}),(0,r.jsx)(`div`,{className:`w-px h-6 bg-gray-200 mx-1`}),(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`mergeRight`),icon:(0,r.jsx)(Uc,{size:14,className:`text-[#2b579a]`}),title:`Merge Right`}),(0,r.jsx)($,{onClick:()=>n(`mergeDown`),icon:(0,r.jsx)(`div`,{className:`rotate-90`,children:(0,r.jsx)(Uc,{size:14,className:`text-[#2b579a]`})}),title:`Merge Down`}),(0,r.jsx)($,{onClick:()=>n(`splitCell`),icon:(0,r.jsx)(pl,{size:14,className:`text-[#2b579a]`}),title:`Split Cells`})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Individual`})]})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Merge`})]}),(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-2 items-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`alignTop`),icon:(0,r.jsx)(jc,{size:14,className:`text-[#2b579a]`}),title:`Align Top`}),(0,r.jsx)($,{onClick:()=>n(`alignMiddle`),icon:(0,r.jsx)(kc,{size:14,className:`text-[#2b579a]`}),title:`Align Middle`}),(0,r.jsx)($,{onClick:()=>n(`alignBottom`),icon:(0,r.jsx)(Ac,{size:14,className:`text-[#2b579a]`}),title:`Align Bottom`})]}),(0,r.jsx)(`div`,{className:`w-px h-6 bg-gray-200`}),(0,r.jsx)(`div`,{className:`flex gap-0.5`,children:(0,r.jsx)(Dl,{label:`Shading`,icon:(0,r.jsx)(il,{size:16,className:`text-[#2b579a]`}),disabled:e,onOpen:i,onSelect:e=>n(`cellColor`,e||`transparent`)})})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Alignment`})]}),(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsx)(`div`,{className:`flex gap-2 items-center pl-1 h-[52px]`,children:(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5 border border-gray-200 rounded p-0.5 items-center`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col`,children:[(0,r.jsx)(`span`,{className:`text-[7px] text-gray-400 text-center`,children:`T/B`}),(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)(`button`,{onClick:()=>n(`paddingTopPlus`),className:`p-0.5 hover:bg-gray-200 rounded text-[#2b579a]`,children:(0,r.jsx)(Fc,{size:10})}),(0,r.jsx)(`button`,{onClick:()=>n(`paddingBottomPlus`),className:`p-0.5 hover:bg-gray-200 rounded text-[#2b579a]`,children:(0,r.jsx)(Mc,{size:10})})]})]}),(0,r.jsxs)(`div`,{className:`flex flex-col`,children:[(0,r.jsx)(`span`,{className:`text-[7px] text-gray-400 text-center`,children:`L/R`}),(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)(`button`,{onClick:()=>n(`paddingLeftPlus`),className:`p-0.5 hover:bg-gray-200 rounded text-[#2b579a]`,children:(0,r.jsx)(Nc,{size:10})}),(0,r.jsx)(`button`,{onClick:()=>n(`paddingRightPlus`),className:`p-0.5 hover:bg-gray-200 rounded text-[#2b579a]`,children:(0,r.jsx)(Pc,{size:10})})]})]})]}),(0,r.jsxs)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:[`Padding (T:`,a(`Top`),` L:`,a(`Left`),`)`]})]})}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Cell Padding`})]}),(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-2 items-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`grid grid-cols-3 gap-0.5 border border-gray-200 p-0.5 rounded`,children:[(0,r.jsx)(`button`,{onClick:()=>n(`borderTop`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`Top Border`,children:(0,r.jsx)(`div`,{className:`w-3 h-0.5 bg-black mb-1.5 opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderBottom`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`Bottom Border`,children:(0,r.jsx)(`div`,{className:`w-3 h-0.5 bg-black mt-1.5 opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderLeft`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`Left Border`,children:(0,r.jsx)(`div`,{className:`w-0.5 h-3 bg-black mr-1.5 opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderRight`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`Right Border`,children:(0,r.jsx)(`div`,{className:`w-0.5 h-3 bg-black ml-1.5 opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderAll`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`All Borders`,children:(0,r.jsx)(ml,{size:12,className:`opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderNone`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`No Borders`,children:(0,r.jsx)(nl,{size:12,className:`text-gray-300`})})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5 self-center`,children:`Borders`})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Side Styling`})]})]})},kl=({showHtml:e,activeImage:t,imageWidth:n,handleImageWidthChange:i,handleImageAction:a})=>(0,r.jsx)(r.Fragment,{children:t&&!e&&(0,r.jsxs)(`div`,{className:`flex border-r border-green-200 pr-2 mr-1 bg-[#f5fff5] pl-2 py-0.5 rounded-sm h-[88px] pb-[22px] relative`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col gap-1 items-center justify-center px-4 border-r border-green-200 relative`,children:[(0,r.jsxs)(`span`,{className:`text-[10px] text-green-800 font-medium mb-1 w-full text-center`,children:[`Image Width: `,n,`%`]}),(0,r.jsx)(`input`,{type:`range`,min:`10`,max:`100`,value:n,onChange:i,className:`w-28 cursor-pointer accent-green-600`}),(0,r.jsx)(`div`,{className:`absolute bottom-[-18px] left-0 right-0 text-[9px] text-center text-green-700 uppercase font-semibold`,children:`Size`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col gap-1 items-center justify-center px-4 border-r border-green-200 relative`,children:[(0,r.jsxs)(`div`,{className:`flex gap-1`,children:[(0,r.jsx)($,{onClick:()=>a(`alignLeft`),icon:(0,r.jsx)(Dc,{size:14,className:`text-green-700`}),title:`Align Left`}),(0,r.jsx)($,{onClick:()=>a(`alignCenter`),icon:(0,r.jsx)(Tc,{size:14,className:`text-green-700`}),title:`Align Center`}),(0,r.jsx)($,{onClick:()=>a(`alignRight`),icon:(0,r.jsx)(Oc,{size:14,className:`text-green-700`}),title:`Align Right`}),(0,r.jsx)($,{onClick:()=>a(`alignNone`),icon:(0,r.jsx)(Ec,{size:14,className:`text-green-700`}),title:`Inline`})]}),(0,r.jsx)(`div`,{className:`absolute bottom-[-18px] left-0 right-0 text-[9px] text-center text-green-700 uppercase font-semibold`,children:`Arrange`})]}),(0,r.jsxs)(`div`,{className:`flex items-center justify-center px-2 py-1 relative`,children:[(0,r.jsx)($,{onClick:()=>a(`delete`),icon:(0,r.jsx)(_l,{size:18,className:`text-red-600`}),label:`Delete`,className:`h-[52px] w-[52px]`,title:`Delete Picture`}),(0,r.jsx)(`div`,{className:`absolute bottom-[-18px] left-0 right-0 text-[9px] text-center text-red-600 uppercase font-semibold`,children:`Actions`})]})]})}),Al=({onSave:e,onSaveAsDocs:t,onPrint:n,toggleHtmlView:i,activeStyles:a,showHtml:o,execCommand:s,onImportWord:c,pluginContributions:l=[],fonts:u,sizes:d})=>{let f=e=>l.filter(t=>t.groupId===e).map((t,n)=>(0,r.jsx)(t.component,{execCommand:s,activeStyles:a,showHtml:o,toggleHtmlView:i,onImportWord:c,fonts:u,sizes:d},`file-plugin-${e}-${n}`));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsx)(`div`,{className:`flex flex-row justify-start`,children:(0,r.jsxs)(`button`,{onClick:n,disabled:o,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all disabled:opacity-50`,children:[(0,r.jsx)(al,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsx)(`span`,{className:`text-[9px] font-medium uppercase`,children:`Print`})]})}),(0,r.jsxs)(`div`,{className:`flex flex-col gap-0.5 justify-center`,children:[(0,r.jsxs)(`button`,{onClick:e,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group`,children:[(0,r.jsx)(ul,{size:14,className:`text-blue-600 group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Save`})]}),(0,r.jsxs)(`button`,{onClick:t,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group`,children:[(0,r.jsx)(qc,{size:14,className:`text-blue-700 group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Save As Docx`})]}),(0,r.jsxs)(`button`,{onClick:i,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group ${o?`bg-blue-50 text-blue-700 pr-3`:``}`,children:[(0,r.jsx)(Kc,{size:14,className:`${o?`text-blue-700`:`text-gray-500`} group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:o?`Rich Text`:`View HTML`})]})]}),f(`insert`),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Document`})]}),f(`custom`)]})};function jl(){return(0,r.jsxs)(`div`,{className:`flex flex-nowrap items-center h-full gap-4 overflow-x-auto px-1 pr-6 custom-scrollbar`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col justify-center border-r border-gray-300 pr-4 shrink-0`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,r.jsx)(Vc,{size:16,className:`text-[#2b579a]`}),(0,r.jsx)(`span`,{className:`text-xs font-bold text-gray-700 uppercase tracking-tight`,children:`Shortcuts`})]}),(0,r.jsx)(`p`,{className:`text-[10px] text-gray-500 max-w-[120px] leading-tight`,children:`Keyboard guides for productivity.`})]}),(0,r.jsx)(`div`,{className:`flex flex-nowrap gap-6`,children:(0,r.jsx)(`div`,{className:`grid grid-rows-2 grid-flow-col gap-x-8 gap-y-2`,children:[{key:`Ctrl + B`,action:`Bold`},{key:`Ctrl + I`,action:`Italic`},{key:`Ctrl + U`,action:`Underline`},{key:`Ctrl + S`,action:`Save`},{key:`Ctrl + F`,action:`Find`},{key:`Ctrl + H`,action:`Replace`},{key:`Ctrl + K`,action:`Link`},{key:`Ctrl + P`,action:`Print`},{key:`Ctrl + L`,action:`Align Left`},{key:`Ctrl + E`,action:`Align Center`},{key:`Ctrl + R`,action:`Align Right`},{key:`Ctrl + J`,action:`Justify`},{key:`Ctrl + Z`,action:`Undo`},{key:`Ctrl + Y`,action:`Redo`},{key:`Tab`,action:`Indent`}].map((e,t)=>(0,r.jsxs)(`div`,{className:`flex items-center gap-2 min-w-[130px]`,children:[(0,r.jsx)(`div`,{className:`bg-gray-200 px-1.5 py-0.5 rounded text-[9px] font-mono font-bold text-gray-700 shadow-sm border border-gray-300 min-w-[70px] text-center`,children:e.key}),(0,r.jsx)(`span`,{className:`text-[10px] text-gray-600 font-medium whitespace-nowrap`,children:e.action})]},t))})})]})}function Ml(e,t){if(!e)return!1;if(e===!0)return{...t};let n={...t};for(let t in n)n[t]=!!e[t];return n}e.ColorPicker=Dl,e.default=({initialHTML:e=`<p>Start typing here...</p>`,onChange:i,onSave:a,toolbarOptions:o={},height:s=`100vh`,className:c=``,initialPaddingLeft:l=20,initialPaddingRight:u=20,initialIndentLeft:d=0,initialIndentRight:f=0,initialLineSpacing:p=`1.5`,initialSpacingBefore:m=0,initialSpacingAfter:h=0,plugins:g=[]})=>{let _=(0,t.useRef)(null),v=(0,t.useRef)(null),y=(0,t.useRef)(null),b=(0,t.useRef)(null),x=(0,t.useRef)(null),S=(0,t.useRef)(null),C=(0,t.useRef)(null),w=(0,t.useRef)(null),T=(0,t.useRef)(null),E=e.trim(),D=(0,t.useRef)(E),[O,k]=(0,t.useState)(`Home`),A=Ml(o.clipboard,{paste:!0,cut:!0,copy:!0,undo:!0,redo:!0}),j=Ml(o.font,{family:!0,size:!0,bold:!0,italic:!0,underline:!0,strikeThrough:!0,subscript:!0,superscript:!0,highlight:!0,color:!0,clear:!0}),M=typeof o.font==`object`?o.font:{},N=Ml(o.paragraph,{bullets:!0,numbering:!0,outdent:!0,indent:!0,alignLeft:!0,alignCenter:!0,alignRight:!0,alignJustify:!0,lineSpacing:!0,blockquote:!0}),P=Ml(o.editing,{find:!0,replace:!0,lock:!0}),F=!!(o.table??!0),I=!!(o.link??!0),L=!!(o.media??!0),R=!!(o.pages??!0),[z,B]=(0,t.useState)({bold:!1,italic:!1,underline:!1,strikeThrough:!1,insertUnorderedList:!1,insertOrderedList:!1,justifyLeft:!1,justifyCenter:!1,justifyRight:!1,justifyFull:!1,fontSize:(M.size,`3`),fontName:(M.family,`Arial`),subscript:!1,superscript:!1}),[ee,te]=(0,t.useState)(d),[V,ne]=(0,t.useState)(f),[re,ie]=(0,t.useState)(d.toString()),[ae,oe]=(0,t.useState)(f.toString()),[H,U]=(0,t.useState)(m.toString()),[se,ce]=(0,t.useState)(h.toString()),[le,ue]=(0,t.useState)(null),[de,fe]=(0,t.useState)(!1),[pe,W]=(0,t.useState)(!1),[me,he]=(0,t.useState)(`https://`),[ge,_e]=(0,t.useState)(null),[ve,ye]=(0,t.useState)({top:0,left:0}),[be,xe]=(0,t.useState)({r:0,c:0}),[G,Se]=(0,t.useState)(null),[Ce,we]=(0,t.useState)(null),[Te,Ee]=(0,t.useState)(100),[K,De]=(0,t.useState)(!1),[Oe,ke]=(0,t.useState)(E),[Ae,je]=(0,t.useState)(0),[Me,Ne]=(0,t.useState)(0),[Pe,Fe]=(0,t.useState)(!1),[q,Ie]=(0,t.useState)(``),[Le,Re]=(0,t.useState)(``),[ze,Be]=(0,t.useState)(`find`),[Ve,He]=(0,t.useState)(!1),[Ue,We]=(0,t.useState)({message:``,type:null}),[Ge,Ke]=(0,t.useState)([]),qe=(0,t.useCallback)(()=>{if(!q||!_.current){Ke([]);return}let e=_.current,t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n=[],r=Ve?q:q.toLowerCase(),i=t.nextNode();for(;i;){let e=i.textContent||``,a=Ve?e:e.toLowerCase(),o=a.indexOf(r);for(;o!==-1;){let t=Math.max(0,o-20),s=Math.min(e.length,o+q.length+20),c=e.substring(t,s);n.push({text:e.substring(o,o+q.length),context:c,node:i,start:o,end:o+q.length,fullContent:e}),o=a.indexOf(r,o+q.length)}i=t.nextNode()}return Ke(n),n},[q,Ve]);(0,t.useEffect)(()=>{We({message:``,type:null});let e=setTimeout(()=>{ze===`find`&&qe()},300);return()=>clearTimeout(e)},[q,qe,ze]);let[Je]=(0,t.useState)(E),Ye=e=>e*25.4/96,Xe=t.default.useCallback(()=>{if(!_.current)return;let e=_.current,t=!1;return Array.from(e.childNodes).forEach(n=>{let r=n.nodeType===3,i=n.nodeType===1&&n.tagName===`BR`;if(r&&n.textContent?.trim()||i){let r=document.createElement(`p`);e.insertBefore(r,n),r.appendChild(n),t=!0}}),t},[]),Ze=t.default.useCallback(()=>{let e=window.getSelection();e&&e.rangeCount>0&&(w.current=e.getRangeAt(0).cloneRange())},[]),Qe=t.default.useCallback(()=>{if(!_.current)return;let e=window.getSelection();if(!e||e.rangeCount===0)return;let t=e.getRangeAt(0),n=t.startContainer,r=t.startOffset,i=!1,a=document.createTreeWalker(_.current,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),o=a.nextNode(),s=!0;for(;o;){if(o.nodeType===1){let e=o.tagName;if([`P`,`LI`,`H1`,`H2`,`H3`,`BLOCKQUOTE`,`DIV`].includes(e))s=!0;else if(e===`A`){s=!1;let e=a.nextNode();for(;e&&o.contains(e);)e=a.nextNode();o=e;continue}}else if(o.nodeType===3){let e=o.textContent||``;if(e.length>0){let t=``,n=s;for(let r=0;r<e.length;r++){let a=e[r];/\s/.test(a)||a===`\xA0`?t+=a:n&&/[a-z]/.test(a)?(t+=a.toUpperCase(),n=!1,i=!0):(t+=a,a.trim().length>0&&(n=!1,/[.!?]/.test(a)&&(n=!0)))}o.textContent!==t&&(o.textContent=t),s=n}}o=a.nextNode()}if(i)try{let t=document.createRange();t.setStart(n,r),t.collapse(!0),e.removeAllRanges(),e.addRange(t)}catch{}},[]),$e=t.default.useCallback(()=>{if(!_.current)return;let e=(_.current.innerText||_.current.textContent||``).replace(/\u200B/g,``);Ne(e.length),je(e.trim().split(/\s+/).filter(e=>e.length>0).length)},[]);(0,t.useEffect)(()=>{$e()},[$e]);let J=t.default.useCallback(()=>{if(!_.current||K)return;let e=_.current.innerHTML;e!==D.current&&(D.current=e,i?.(e),$e())},[i,K,$e]),Y=t.default.useCallback(()=>{if(!document.queryCommandState||!_.current)return;let e=document.queryCommandState(`subscript`),t=document.queryCommandState(`superscript`),n=window.getSelection();if(n&&n.rangeCount>0){let r=n.anchorNode,i=r?.nodeType===3?r.parentElement:r;i&&_.current.contains(i)&&(i.closest(`sub`)&&(e=!0),i.closest(`sup`)&&(t=!0))}if(B({bold:document.queryCommandState(`bold`),italic:document.queryCommandState(`italic`),underline:document.queryCommandState(`underline`),strikeThrough:document.queryCommandState(`strikeThrough`),insertUnorderedList:document.queryCommandState(`insertUnorderedList`),insertOrderedList:document.queryCommandState(`insertOrderedList`),justifyLeft:document.queryCommandState(`justifyLeft`),justifyCenter:document.queryCommandState(`justifyCenter`),justifyRight:document.queryCommandState(`justifyRight`),justifyFull:document.queryCommandState(`justifyFull`),fontSize:document.queryCommandValue(`fontSize`)||`3`,fontName:document.queryCommandValue(`fontName`).replace(/"/g,``)||`Arial`,subscript:e,superscript:t,foreColor:document.queryCommandValue(`foreColor`)||`#000000`,hiliteColor:document.queryCommandValue(`hiliteColor`)||`transparent`}),n&&n.rangeCount>0){let e=n.anchorNode,t=e?.nodeType===3?e.parentElement:e;if(t&&_.current.contains(t)){let e=t.closest(`ul,ol,p,div,h1,h2,h3,h4,h5,h6`);if(e&&_.current.contains(e)){let t=window.getComputedStyle(e),n=t.marginLeft,r=t.marginRight,i=t.marginTop,a=t.marginBottom,o=e=>e.endsWith(`mm`)?parseFloat(e):e.endsWith(`px`)?Ye(parseFloat(e)):0,s=e=>e.endsWith(`pt`)?parseFloat(e):e.endsWith(`px`)?Math.round(parseFloat(e)*.75):0,c=o(n),l=o(r);te(c),ne(l),document.activeElement?.getAttribute(`data-field`)!==`indentLeft`&&ie(Math.round(c).toString()),document.activeElement?.getAttribute(`data-field`)!==`indentRight`&&oe(Math.round(l).toString());let u=s(i),d=s(a);document.activeElement?.getAttribute(`data-field`)!==`spacingBefore`&&U(u.toString()),document.activeElement?.getAttribute(`data-field`)!==`spacingAfter`&&ce(d.toString())}Se(t.closest(`td,th`))}else Se(null)}},[]);(0,t.useEffect)(()=>{_.current&&(_.current.innerHTML=Je,D.current=Je),document.execCommand(`defaultParagraphSeparator`,!1,`p`)},[Je]),(0,t.useEffect)(()=>{!K&&_.current&&(_.current.innerHTML=D.current)},[K]);let[et,tt]=(0,t.useState)(!1),[nt,rt]=(0,t.useState)(null);(0,t.useEffect)(()=>{let e=e=>{let t=e.target.closest(`td, th`);t&&_.current?.contains(t)?(tt(!0),rt(t),e.shiftKey||(_.current.querySelectorAll(`td[data-selected], th[data-selected]`).forEach(e=>e.removeAttribute(`data-selected`)),t.setAttribute(`data-selected`,`true`))):(tt(!1),rt(null))},t=e=>{if(!et||!nt||!_.current)return;let t=e.target.closest(`td, th`);if(!t||!_.current.contains(t))return;let n=nt.closest(`table`);if(!n||n!==t.closest(`table`))return;let r=n.tBodies[0],i=(()=>{let e=[];return Array.from(r.rows).forEach((t,n)=>{e[n]||(e[n]=[]);let r=0;Array.from(t.cells).forEach(t=>{for(;e[n][r];)r++;let i=t.rowSpan||1,a=t.colSpan||1;for(let o=0;o<i;o++)for(let i=0;i<a;i++)e[n+o]||(e[n+o]=[]),e[n+o][r+i]=t;r+=a})}),e})(),a=-1,o=-1,s=-1,c=-1;if(i.forEach((e,n)=>{e.forEach((e,r)=>{e===nt&&(a=n,o=r),e===t&&(s=n,c=r)})}),a!==-1&&s!==-1){let e=Math.min(a,s),t=Math.max(a,s),r=Math.min(o,c),l=Math.max(o,c);n.querySelectorAll(`td, th`).forEach(e=>e.removeAttribute(`data-selected`));for(let n=e;n<=t;n++)for(let e=r;e<=l;e++)i[n]?.[e]?.setAttribute(`data-selected`,`true`)}},n=()=>{tt(!1),rt(null)};return document.addEventListener(`mousedown`,e),document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)}},[et,nt]),(0,t.useEffect)(()=>{let e=()=>{setTimeout(()=>{Y();let e=window.getSelection();if(e&&e.rangeCount>0&&_.current?.contains(e.anchorNode)&&(w.current=e.getRangeAt(0).cloneRange(),!et)){let t=_.current;if(t)if(t.querySelectorAll(`td[data-selected], th[data-selected]`).forEach(e=>e.removeAttribute(`data-selected`)),!e.getRangeAt(0).collapsed)t.querySelectorAll(`table`).forEach(t=>{t.querySelectorAll(`td, th`).forEach(t=>{e.containsNode(t,!0)&&t.setAttribute(`data-selected`,`true`)})});else{let n=e.anchorNode,r=(n?.nodeType===3?n.parentElement:n)?.closest(`td, th`);r&&t.contains(r)&&r.setAttribute(`data-selected`,`true`)}}},10)};return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[et,Y]),(0,t.useEffect)(()=>{let e=e=>{T.current&&!T.current.contains(e.target)&&(fe(!1),xe({r:0,c:0}))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let it=t.default.useCallback((e,t)=>{let n=window.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;if((!r||!_.current?.contains(r.commonAncestorContainer))&&(r=w.current),!r)return;let i=r.startContainer,a=(i.nodeType===3?i.parentNode:i).closest(`ul,ol,p,div,h1,h2,h3,h4,h5,h6`);a&&_.current?.contains(a)&&(a.style[e===`left`?`marginLeft`:`marginRight`]=`${t}mm`,J())},[J]),at=t.default.useCallback((e,t)=>{let n=window.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;if((!r||!_.current?.contains(r.commonAncestorContainer))&&(r=w.current),!r)return;let i=r.startContainer,a=(i.nodeType===3?i.parentNode:i).closest(`ul,ol,p,div,h1,h2,h3,h4,h5,h6`);a&&_.current?.contains(a)&&(a.style[e===`before`?`marginTop`:`marginBottom`]=`${t}pt`,J())},[J]);(0,t.useEffect)(()=>{let e=e=>{if(!le||!v.current)return;let t=v.current.getBoundingClientRect(),n=210/t.width,r=(e.clientX-t.left)*n;if(le===`left`){let e=Math.max(-20,Math.min(r-20,170-V-5));te(e),it(`left`,e)}else{let e=Math.max(-20,Math.min(210-r-20,170-ee-5));ne(e),it(`right`,e)}},t=()=>ue(null);return le?(document.body.style.cursor=`ew-resize`,window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t)):document.body.style.cursor=`default`,()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[le,ee,V,it]);let ot=(e,t=null)=>{if(_.current){if(e===`removeFormat`){let e=window.getSelection(),t=null;if(e&&e.rangeCount>0){let n=e.getRangeAt(0);t=n.cloneRange();let r=n.commonAncestorContainer,i=r.nodeType===3?r.parentElement:r;if(i&&_.current.contains(i)){let e=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),t=e.currentNode;for(;t;){if(n.intersectsNode(t)){let e=t;e.style.backgroundColor=``,e.style.background=``,e.getAttribute(`style`)||e.removeAttribute(`style`)}t=e.nextNode()}}}document.execCommand(`removeFormat`,!1,``),document.execCommand(`foreColor`,!1,`#000000`),t&&(e?.removeAllRanges(),e?.addRange(t))}else if(e===`createLink`){let e=t;if(e){_.current.focus();let t=window.getSelection();if(t&&w.current){if(t.removeAllRanges(),t.addRange(w.current),w.current.collapsed)document.execCommand(`insertHTML`,!1,`<a href="${e}">${e}</a>`);else{let t=document.createElement(`div`);t.appendChild(w.current.cloneContents());let n=t.innerHTML;document.execCommand(`insertHTML`,!1,`<a href="${e}">${n}</a>`)}w.current=null}else document.execCommand(`insertHTML`,!1,`<a href="${e}">${e}</a>`)}}else if(e===`blockquote`){let e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).commonAncestorContainer;(t.nodeType===3?t.parentElement:t)?.closest(`blockquote`)?document.execCommand(`formatBlock`,!1,`p`):document.execCommand(`formatBlock`,!1,`blockquote`)}}else if(e===`fontSize`||e===`fontName`){document.execCommand(e,!1,t??``);let n=window.getSelection();if(n&&n.rangeCount>0){let r=n.getRangeAt(0),i=r.commonAncestorContainer,a=i.nodeType===3?i.parentNode:i;if(a&&_.current.contains(a)){let n=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT),i={1:`8pt`,2:`10pt`,3:`12pt`,4:`14pt`,5:`18pt`,6:`24pt`,7:`36pt`},o=n.currentNode;for(;o;){if(o.nodeName===`LI`&&r.intersectsNode(o)){let n=o;e===`fontSize`&&t&&i[t]?n.style.fontSize=i[t]:e===`fontName`&&t&&(n.style.fontFamily=t)}o=n.nextNode()}}}}else{let n=e;if(e===`backColor`&&(!t||t!==`transparent`)&&(n=`hiliteColor`),_.current){_.current.focus();let e=window.getSelection();if(e&&w.current)try{e.removeAllRanges(),e.addRange(w.current)}catch(e){console.warn(`Failed to restore range`,e)}}if(n===`subscript`||n===`superscript`){let e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer,r=t.nodeType===3?t.parentElement:t,i=n===`subscript`?`SUB`:`SUP`,a=r?.closest(i);if(a&&_.current?.contains(a)){let e=a.parentNode;if(e){let t=document.createDocumentFragment();for(;a.firstChild;)t.appendChild(a.firstChild);e.replaceChild(t,a),Y(),J();return}}}}document.execCommand(n,!1,t??``)}Y(),J()}},st=async()=>{try{let e=await navigator.clipboard.read();for(let t of e)if(t.types.includes(`text/html`)){let e=await(await t.getType(`text/html`)).text();document.execCommand(`insertHTML`,!1,e);return}else if(t.types.includes(`text/plain`)){let e=await(await t.getType(`text/plain`)).text();document.execCommand(`insertText`,!1,e);return}}catch{try{let e=await navigator.clipboard.readText();document.execCommand(`insertText`,!1,e)}catch{document.execCommand(`paste`)}}_.current?.focus(),Y(),J()},ct=e=>{if(!_.current)return;if(w.current){let t=w.current.commonAncestorContainer,n=(t.nodeType===3?t.parentNode:t)?.closest?.(`p,div,li,h1,h2,h3,h4,h5,h6`);n&&_.current.contains(n)?n.style.lineHeight=e:_.current.style.lineHeight=e}let t=window.getSelection();t&&(t.removeAllRanges(),w.current&&t.addRange(w.current)),_.current.focus(),J()},lt=e=>{if(!_.current)return;let t=window.getSelection();if(t&&t.rangeCount>0){let n=t.getRangeAt(0).commonAncestorContainer,r=(n.nodeType===3?n.parentElement:n)?.closest(`ol, ul`);r&&_.current.contains(r)&&(r.style.listStyleType=e)}_.current.focus(),J()},X=(e,t)=>{if(!e||!t)return;let n=!!G,r=`<table border="1" style="border-collapse:collapse;width:100%;${n?`margin:0`:`margin:10px 0`}"><tbody>`;for(let n=0;n<e;n++){r+=`<tr>`;for(let e=0;e<t;e++)r+=`<td style="border:1px solid black;padding:8px;min-width:50px;resize:both;overflow:hidden;">​</td>`;r+=`</tr>`}r+=`</tbody></table>${n?``:`<p>​</p>`}`,_.current?.focus();let i=window.getSelection();if(i&&(i.removeAllRanges(),w.current&&i.addRange(w.current)),n&&G&&(G.textContent||``).replace(/\u200B/g,``).trim()===``&&G.children.length===0){let e=document.createRange();e.selectNodeContents(G),i?.removeAllRanges(),i?.addRange(e)}document.execCommand(`insertHTML`,!1,r),fe(!1),xe({r:0,c:0}),J()},ut=e=>{let t=window.getSelection();if(!t)return;let n=document.createRange();n.setStart(e.node,e.start),n.setEnd(e.node,e.end),t.removeAllRanges(),t.addRange(n);let r=e.node.parentElement;r&&r.scrollIntoView({behavior:`smooth`,block:`center`}),_.current?.focus()},dt=()=>{if(!q||!_.current)return;let e=qe();if(!e||e.length===0){We({message:`No matches found for "${q}"`,type:`error`});return}let t=_.current,n=window.getSelection();if(!n)return;let r=t,i=0;if(n.rangeCount>0){let e=n.getRangeAt(0);r=e.endContainer,i=e.endOffset}let a=(e,t,n,r,i)=>{let a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),o=!1,s=a.nextNode();for(;s;){if(o||(s===r||r.contains(s)&&s!==e)&&(o=!0),o){let e=s.textContent||``,a=n?t:t.toLowerCase(),o=(n?e:e.toLowerCase()).indexOf(a,s===r?i:0);if(o!==-1)return{node:s,start:o,end:o+t.length}}s=a.nextNode()}return null},o=a(t,q,Ve,r,i)||a(t,q,Ve,t,0);if(o){let e=document.createRange();e.setStart(o.node,o.start),e.setEnd(o.node,o.end),n.removeAllRanges(),n.addRange(e);let t=o.node.parentElement;t&&t.scrollIntoView({behavior:`smooth`,block:`center`})}},ft=(e=!1)=>{if(!(!q||!_.current))if(e){let e=document.createTreeWalker(_.current,NodeFilter.SHOW_TEXT,null),t=0,n=[],r=Ve?q:q.toLowerCase(),i=e.nextNode();for(;i;){let t=i.textContent||``,a=Ve?t:t.toLowerCase(),o=a.indexOf(r);for(;o!==-1;)n.push({node:i,start:o,end:o+q.length}),o=a.indexOf(r,o+q.length);i=e.nextNode()}for(let e=n.length-1;e>=0;e--){let r=n[e],i=r.node.textContent||``;r.node.textContent=i.substring(0,r.start)+Le+i.substring(r.end),t++}t>0?(J(),We({message:`Successfully replaced ${t} occurrences.`,type:`success`})):We({message:`No matches found to replace.`,type:`error`})}else{let e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).toString();(Ve?t===q:t.toLowerCase()===q.toLowerCase())&&document.execCommand(`insertHTML`,!1,Le),dt()}else dt()}},pt=e=>{let t=e.target.files?.[0];if(t){let e=new FileReader;e.onload=e=>{let t=e.target?.result;if(_.current&&t){_.current.focus();let e=window.getSelection();e&&(e.removeAllRanges(),w.current&&e.addRange(w.current)),document.execCommand(`insertImage`,!1,t),Y(),J()}},e.readAsDataURL(t)}e.target.value=``},mt=async e=>{let t=e.target.files?.[0];if(t){We({message:`Importing document...`,type:`info`});try{let e=await t.arrayBuffer(),n=(await yc.convertToHtml({arrayBuffer:e})).value;_.current&&(_.current.innerHTML=n,J(),We({message:`Document imported successfully.`,type:`success`}))}catch(e){console.error(e),We({message:`Failed to import document.`,type:`error`})}e.target.value=``}},ht=()=>{let e=window.getSelection();if(!e||e.rangeCount===0||!_.current)return;let t=e.getRangeAt(0),n=_.current,r=Array.from(n.querySelectorAll(`.locked-region`));if(r.find(t=>e.containsNode(t,!0))){r.forEach(t=>{if(e.containsNode(t,!0))if(t.tagName===`SPAN`){let e=t.parentNode;for(;t.firstChild;)e?.insertBefore(t.firstChild,t);e?.removeChild(t)}else t.removeAttribute(`contenteditable`),t.classList.remove(`locked-region`)}),J();return}if(t.collapsed){let e=t.commonAncestorContainer;e.nodeType===3&&(e=e.parentElement);let r=e.closest(`p, div, li, h1, h2, h3, h4, h5, h6, blockquote`);r&&n.contains(r)&&(r.setAttribute(`contenteditable`,`false`),r.classList.add(`locked-region`))}else{let e=document.createElement(`span`);e.setAttribute(`contenteditable`,`false`),e.className=`locked-region`,e.title=`Locked Segment`,e.style.userSelect=`all`;try{t.surroundContents(e)}catch{let n=t.extractContents();e.appendChild(n),t.insertNode(e)}}J(),e.removeAllRanges()},gt=(e,t)=>{bc(e,G,t,{onTableDeleted:()=>Se(null),onContentChanged:J,onFocusRequested:()=>_.current?.focus()})},_t=e=>{if(!Ce)return;let t=Ce;switch(e){case`alignLeft`:t.style.display=`inline`,t.style.float=`left`,t.style.margin=`10px 10px 10px 0`;break;case`alignCenter`:t.style.display=`block`,t.style.float=`none`,t.style.margin=`10px auto`;break;case`alignRight`:t.style.display=`inline`,t.style.float=`right`,t.style.margin=`10px 0 10px 10px`;break;case`alignNone`:t.style.display=`inline`,t.style.float=`none`,t.style.margin=`10px 0`;break;case`delete`:t.remove(),we(null);break}_.current?.focus(),J()},vt=()=>{if(!_.current)return;let e=_.current.innerHTML,t=document.createElement(`iframe`);t.style.position=`fixed`,t.style.right=`0`,t.style.bottom=`0`,t.style.width=`0`,t.style.height=`0`,t.style.border=`none`,document.body.appendChild(t);let n=t.contentWindow?.document;if(!n){document.body.removeChild(t);return}n.open(),n.write(`<html><head><style>@page { size: A4 portrait; margin: 20mm; } body { font-family: Arial, sans-serif; font-size: 14px; background: white; color: black; margin: 0; padding: 0; word-break: break-word; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } .page-break-element { page-break-before: always; break-before: page; margin: 0; padding: 0; height: 0; border: none; } ul { list-style-type: disc; padding-left: 20px; margin: 1em 0; } ol { list-style-type: decimal; padding-left: 20px; margin: 1em 0; } li { display: list-item; } table { border-collapse: collapse; width: 100%; border: 1px solid #000; margin: 15px 0; table-layout: auto; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } td, th { border: 1px solid #000; padding: 8px; position: relative; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } img { max-width: 100%; height: auto; margin: 10px 0; border-radius: 2px; } p { margin: 0; min-height: 1.4em; }</style></head><body>${e}</body></html>`),n.close(),t.contentWindow?.focus(),setTimeout(()=>{t.contentWindow?.print(),setTimeout(()=>{t&&t.parentNode&&t.parentNode.removeChild(t)},500)},250)},yt=()=>{let e=_.current?.innerHTML||Oe;a?.(e)},bt=()=>{let e=`
|
|
222
|
+
`).map(function(e){return e.trim()}).filter(function(e){return e!==``&&e.charAt(0)!==`#`}):e:[]}function o(e){return e}})),_c=d((e=>{var t=Uo(),n=Jo();e.openZip=r;function r(e){return e.arrayBuffer?t.resolve(n.openArrayBuffer(e.arrayBuffer)):t.reject(Error(`Could not find file in options`))}})),vc=d((e=>{var t=Js(),n=qs();e.element=r;function r(e){return function(r){return n.elementWithTag(t.element(e),[r])}}})),yc=m(d((e=>{var t=(so(),h(oo)),n=Us(),r=Ws(),i=$s().DocumentConverter;ec().convertElementToRawText;var a=hc().readStyle,o=gc().readOptions,s=_c(),c=Go().Result;e.convertToHtml=l,e.images=Ys(),e.transforms=Ms(),e.underline=vc();function l(e,t){return u(e,t)}function u(e,t){return t=o(t),s.openZip(e).tap(function(e){return r.readStyleMap(e).then(function(e){t.embeddedStyleMap=e})}).then(function(r){return n.read(r,e,t).then(function(e){return e.map(t.transformDocument)}).then(function(e){return d(e,t)})})}function d(e,n){var r=f(n.readStyleMap()),a=new i(t.extend({},n,{styleMap:r.value}));return e.flatMapThen(function(e){return r.flatMapThen(function(t){return a.convertToHtml(e)})})}function f(e){return c.combine((e||[]).map(a)).map(function(e){return e.filter(function(e){return!!e})})}}))(),1);function bc(e,t,n,r){if(!t)return;let i=window.getSelection(),a=[],o=t.closest(`table`);if(o){let e=o.querySelectorAll(`td[data-selected="true"], th[data-selected="true"]`);e.length>0?e.forEach(e=>a.push(e)):i&&i.rangeCount>0&&o.querySelectorAll(`td, th`).forEach(e=>{i.containsNode(e,!0)&&a.push(e)})}a.length===0&&a.push(t);let s=t,c=s.closest(`tbody`)||s.closest(`table`)?.tBodies[0];if(!c)return;let l=c.closest(`table`),u=()=>{let e=[];return Array.from(c.rows).forEach((t,n)=>{e[n]||(e[n]=[]);let r=0;Array.from(t.cells).forEach(t=>{for(;e[n][r];)r++;let i=t.rowSpan||1,a=t.colSpan||1;for(let o=0;o<i;o++)for(let i=0;i<a;i++)e[n+o]||(e[n+o]=[]),e[n+o][r+i]=t;r+=a})}),e},d=()=>{r?.onContentChanged?.()};switch(e){case`insertRowAbove`:{let e=s.parentElement,t=Array.from(c.children).indexOf(e),n=c.insertRow(t);Array.from(e.children).forEach(()=>{let e=n.insertCell();e.style.cssText=s.style.cssText,e.innerHTML=`​`});break}case`insertRowBelow`:{let e=s.parentElement,t=Array.from(c.children).indexOf(e),n=c.insertRow(t+1);Array.from(e.children).forEach(()=>{let e=n.insertCell();e.style.cssText=s.style.cssText,e.innerHTML=`​`});break}case`insertColLeft`:{let e=s.parentElement,t=Array.from(e.children).indexOf(s);Array.from(c.children).forEach(e=>{let n=e.insertCell(t);n.style.cssText=s.style.cssText,n.innerHTML=`​`});break}case`insertColRight`:{let e=s.parentElement,t=Array.from(e.children).indexOf(s);Array.from(c.children).forEach(e=>{let n=e.insertCell(t+1);n.style.cssText=s.style.cssText,n.innerHTML=`​`});break}case`deleteRow`:{let e=s.parentElement,t=Array.from(c.children).indexOf(e);c.deleteRow(t),c.children.length===0&&(l.remove(),r?.onTableDeleted?.());break}case`deleteCol`:{let e=s.parentElement,t=Array.from(e.children).indexOf(s);Array.from(c.children).forEach(e=>{e.children[t]&&e.deleteCell(t)}),c.children[0]?.children.length===0&&(l.remove(),r?.onTableDeleted?.());break}case`deleteTable`:l.remove(),r?.onTableDeleted?.();break;case`mergeCells`:{if(a.length<2)return;let e=u(),t=999,n=-1,r=999,i=-1;a.forEach(a=>{for(let o=0;o<e.length;o++){let s=e[o].indexOf(a);s!==-1&&(t=Math.min(t,o),n=Math.max(n,o+(a.rowSpan||1)-1),r=Math.min(r,s),i=Math.max(i,s+(a.colSpan||1)-1))}});let o=e[t][r];if(!o)return;for(let a=t;a<=n;a++)for(let t=r;t<=i;t++){let n=e[a][t];if(n&&n!==o){n.innerHTML!==`​`&&(o.innerHTML+=n.innerHTML),n.remove();for(let r=0;r<(n.rowSpan||1);r++)for(let i=0;i<(n.colSpan||1);i++)e[a+r][t+i]=o}}o.rowSpan=n-t+1,o.colSpan=i-r+1;break}case`mergeRight`:{let e=u(),t=s.rowSpan||1,n=s.colSpan||1,r=-1,i=-1;for(let t=0;t<e.length;t++){let n=e[t].indexOf(s);if(n!==-1){i=t,r=n;break}}if(r!==-1){let a=r+n,o=new Set;for(let n=i;n<i+t;n++){let t=e[n]?.[a];t&&t!==s&&o.add(t)}o.size>0&&(s.colSpan=n+(Array.from(o)[0].colSpan||1),o.forEach(e=>{e.innerHTML!==`​`&&(s.innerHTML+=e.innerHTML),e.remove()}))}break}case`mergeDown`:{let e=u(),t=s.rowSpan||1,n=s.colSpan||1,r=-1,i=-1;for(let t=0;t<e.length;t++){let n=e[t].indexOf(s);if(n!==-1){i=t,r=n;break}}if(i!==-1){let a=i+t,o=new Set;for(let t=r;t<r+n;t++){let n=e[a]?.[t];n&&n!==s&&o.add(n)}o.size>0&&(s.rowSpan=t+(Array.from(o)[0].rowSpan||1),o.forEach(e=>{e.innerHTML!==`​`&&(s.innerHTML+=e.innerHTML),e.remove()}))}break}case`cellColor`:a.forEach(e=>{e.style.backgroundColor=n}),d();break;case`cellBorder`:a.forEach(e=>{e.style.border=n}),d();break;case`borderTop`:a.forEach(e=>{e.style.borderTop=n||`1px solid black`});break;case`borderBottom`:a.forEach(e=>{e.style.borderBottom=n||`1px solid black`});break;case`borderLeft`:a.forEach(e=>{e.style.borderLeft=n||`1px solid black`});break;case`borderRight`:a.forEach(e=>{e.style.borderRight=n||`1px solid black`});break;case`borderAll`:a.forEach(e=>{e.style.border=n||`1px solid black`});break;case`borderNone`:a.forEach(e=>{e.style.border=`none`});break;case`paddingTopPlus`:a.forEach(e=>{let t=parseInt(e.style.paddingTop)||0;e.style.paddingTop=`${t+1}px`}),d();break;case`paddingTopMinus`:a.forEach(e=>{let t=parseInt(e.style.paddingTop)||0;t>0&&(e.style.paddingTop=`${t-1}px`)}),d();break;case`paddingBottomPlus`:a.forEach(e=>{let t=parseInt(e.style.paddingBottom)||0;e.style.paddingBottom=`${t+1}px`}),d();break;case`paddingBottomMinus`:a.forEach(e=>{let t=parseInt(e.style.paddingBottom)||0;t>0&&(e.style.paddingBottom=`${t-1}px`)}),d();break;case`paddingLeftPlus`:a.forEach(e=>{let t=parseInt(e.style.paddingLeft)||0;e.style.paddingLeft=`${t+1}px`}),d();break;case`paddingLeftMinus`:a.forEach(e=>{let t=parseInt(e.style.paddingLeft)||0;t>0&&(e.style.paddingLeft=`${t-1}px`)}),d();break;case`paddingRightPlus`:a.forEach(e=>{let t=parseInt(e.style.paddingRight)||0;e.style.paddingRight=`${t+1}px`}),d();break;case`paddingRightMinus`:a.forEach(e=>{let t=parseInt(e.style.paddingRight)||0;t>0&&(e.style.paddingRight=`${t-1}px`)}),d();break;case`splitCell`:{let e=s.parentElement,t=Array.from(e.children).indexOf(s),n=Array.from(c.children).indexOf(e),r=s.colSpan||1,i=s.rowSpan||1;if(r>1||i>1){s.colSpan=1,s.rowSpan=1;for(let n=1;n<r;n++){let n=e.insertCell(t+1);n.style.cssText=s.style.cssText,n.style.backgroundColor=``,n.innerHTML=`​`}for(let e=1;e<i;e++){let i=c.rows[n+e];if(i)for(let e=0;e<r;e++){let e=i.insertCell(t);e.style.cssText=s.style.cssText,e.style.backgroundColor=``,e.innerHTML=`​`}}}break}case`alignTop`:a.forEach(e=>{e.style.verticalAlign=`top`});break;case`alignMiddle`:a.forEach(e=>{e.style.verticalAlign=`middle`});break;case`alignBottom`:a.forEach(e=>{e.style.verticalAlign=`bottom`});break;case`justifyLeft`:a.forEach(e=>{e.style.textAlign=`left`});break;case`justifyCenter`:a.forEach(e=>{e.style.textAlign=`center`});break;case`justifyRight`:a.forEach(e=>{e.style.textAlign=`right`});break;case`justifyFull`:a.forEach(e=>{e.style.textAlign=`justify`});break}r?.onFocusRequested?.()}var xc=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Sc=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Cc={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},wc=(0,t.forwardRef)(({color:e=`currentColor`,size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:a=``,children:o,iconNode:s,...c},l)=>(0,t.createElement)(`svg`,{ref:l,...Cc,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:Sc(`lucide`,a),...c},[...s.map(([e,n])=>(0,t.createElement)(e,n)),...Array.isArray(o)?o:[o]])),Q=(e,n)=>{let r=(0,t.forwardRef)(({className:r,...i},a)=>(0,t.createElement)(wc,{ref:a,iconNode:n,className:Sc(`lucide-${xc(e)}`,r),...i}));return r.displayName=`${e}`,r},Tc=Q(`AlignCenter`,[[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 18H5`,key:`18s9l3`}],[`path`,{d:`M21 6H3`,key:`1jwq7v`}]]),Ec=Q(`AlignJustify`,[[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 18h18`,key:`1h113x`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}]]),Dc=Q(`AlignLeft`,[[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 18H3`,key:`1amg6g`}],[`path`,{d:`M21 6H3`,key:`1jwq7v`}]]),Oc=Q(`AlignRight`,[[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 18H7`,key:`1ygte8`}],[`path`,{d:`M21 6H3`,key:`1jwq7v`}]]),kc=Q(`AlignVerticalJustifyCenter`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`16`,rx:`2`,key:`1i8z2d`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`2`,rx:`2`,key:`ypihtt`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Ac=Q(`AlignVerticalJustifyEnd`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`12`,rx:`2`,key:`4l4tp2`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`2`,rx:`2`,key:`ypihtt`}],[`path`,{d:`M2 22h20`,key:`272qi7`}]]),jc=Q(`AlignVerticalJustifyStart`,[[`rect`,{width:`14`,height:`6`,x:`5`,y:`16`,rx:`2`,key:`1i8z2d`}],[`rect`,{width:`10`,height:`6`,x:`7`,y:`6`,rx:`2`,key:`13squh`}],[`path`,{d:`M2 2h20`,key:`1ennik`}]]),Mc=Q(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Nc=Q(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Pc=Q(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Fc=Q(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Ic=Q(`Bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),Lc=Q(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Rc=Q(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),zc=Q(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Bc=Q(`CircleCheckBig`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Vc=Q(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Hc=Q(`ClipboardPaste`,[[`path`,{d:`M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z`,key:`1pp7kr`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10`,key:`2ik1ml`}],[`path`,{d:`m17 10 4 4-4 4`,key:`vp2hj1`}]]),Uc=Q(`Combine`,[[`path`,{d:`M10 18H5a3 3 0 0 1-3-3v-1`,key:`ru65g8`}],[`path`,{d:`M14 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2`,key:`e30een`}],[`path`,{d:`M20 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2`,key:`2ahx8o`}],[`path`,{d:`m7 21 3-3-3-3`,key:`127cv2`}],[`rect`,{x:`14`,y:`14`,width:`8`,height:`8`,rx:`2`,key:`1b0bso`}],[`rect`,{x:`2`,y:`2`,width:`8`,height:`8`,rx:`2`,key:`1x09vl`}]]),Wc=Q(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Gc=Q(`Eraser`,[[`path`,{d:`m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21`,key:`182aya`}],[`path`,{d:`M22 21H7`,key:`t4ddhn`}],[`path`,{d:`m5 11 9 9`,key:`1mo9qw`}]]),Kc=Q(`FileCode`,[[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}]]),qc=Q(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Jc=Q(`Image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Yc=Q(`IndentDecrease`,[[`path`,{d:`M21 12H11`,key:`wd7e0v`}],[`path`,{d:`M21 18H11`,key:`4wu86t`}],[`path`,{d:`M21 6H11`,key:`6dy1d6`}],[`path`,{d:`m7 8-4 4 4 4`,key:`o5hrat`}]]),Xc=Q(`IndentIncrease`,[[`path`,{d:`M21 12H11`,key:`wd7e0v`}],[`path`,{d:`M21 18H11`,key:`4wu86t`}],[`path`,{d:`M21 6H11`,key:`6dy1d6`}],[`path`,{d:`m3 8 4 4-4 4`,key:`1a3j6y`}]]),Zc=Q(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Qc=Q(`Italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),$c=Q(`Link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),el=Q(`ListOrdered`,[[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 18h11`,key:`11hvi2`}],[`path`,{d:`M10 6h11`,key:`c7qv1k`}],[`path`,{d:`M4 10h2`,key:`16xx2s`}],[`path`,{d:`M4 6h1v4`,key:`cnovpq`}],[`path`,{d:`M6 18H4c0-1 2-2 2-3s-1-1.5-2-1`,key:`m9a95d`}]]),tl=Q(`List`,[[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 18h.01`,key:`1tta3j`}],[`path`,{d:`M3 6h.01`,key:`1rqtza`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 18h13`,key:`1lx6n3`}],[`path`,{d:`M8 6h13`,key:`ik3vkj`}]]),nl=Q(`Maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),rl=Q(`MoveVertical`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m8 18 4 4 4-4`,key:`bh5tu3`}],[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}]]),il=Q(`PaintBucket`,[[`path`,{d:`m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z`,key:`irua1i`}],[`path`,{d:`m5 2 5 5`,key:`1lls2c`}],[`path`,{d:`M2 13h15`,key:`1hkzvu`}],[`path`,{d:`M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z`,key:`xk76lq`}]]),al=Q(`Printer`,[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]),ol=Q(`Quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),sl=Q(`Redo`,[[`path`,{d:`M21 7v6h-6`,key:`3ptur4`}],[`path`,{d:`M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7`,key:`1kgawr`}]]),cl=Q(`Replace`,[[`path`,{d:`M14 4a2 2 0 0 1 2-2`,key:`1w2hp7`}],[`path`,{d:`M16 10a2 2 0 0 1-2-2`,key:`shjach`}],[`path`,{d:`M20 2a2 2 0 0 1 2 2`,key:`188mtx`}],[`path`,{d:`M22 8a2 2 0 0 1-2 2`,key:`ddf4tu`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a3 3 0 0 1 3-3h1`,key:`3y3t5z`}],[`rect`,{x:`2`,y:`14`,width:`8`,height:`8`,rx:`2`,key:`4rksxw`}]]),ll=Q(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ul=Q(`Save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),dl=Q(`Scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),fl=Q(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),pl=Q(`Split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),ml=Q(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),hl=Q(`Strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),gl=Q(`Table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),_l=Q(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),vl=Q(`Underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),yl=Q(`Undo`,[[`path`,{d:`M3 7v6h6`,key:`1v2h90`}],[`path`,{d:`M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13`,key:`1r6uu6`}]]),bl=Q(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),$=({onClick:e,icon:t,title:n,isActive:i=!1,className:a=``,label:o=``,disabled:s=!1,...c})=>(0,r.jsxs)(`button`,{onMouseDown:t=>{s||(t.preventDefault(),e&&e(t))},title:n,disabled:s,className:`p-1.5 border rounded-sm transition-all flex flex-col items-center justify-center ${s?`opacity-50 cursor-not-allowed border-transparent`:i?`bg-[#c1d3ee] border-[#2b579a] shadow-inner`:`hover:bg-[#d0d0d0] border-transparent hover:border-gray-400`} ${a}`,...c,children:[t,o&&(0,r.jsx)(`span`,{className:`text-[8px] mt-0.5`,children:o})]}),xl=({showHtml:e,execCommand:i,activeStyles:a,fontConf:o,paragraphConf:s,changeLineSpacing:c,changeListStyleType:l,clipboardConf:u,handlePaste:d,toggleHtmlView:f,onOpenFind:p,onOpenReplace:m,editingConf:h,pluginContributions:g=[],toggleSelectionLock:_,fonts:v,sizes:y,saveSelection:b,openTextColorPicker:x,openHighlightColorPicker:S})=>{let[C,w]=t.default.useState({type:`ul`,open:!1,x:0,y:0}),[T,E]=t.default.useState({open:!1,x:0,y:0}),D=t=>g.filter(e=>e.groupId===t).map((n,c)=>(0,r.jsx)(n.component,{execCommand:i,activeStyles:a,showHtml:e,toggleHtmlView:f,onOpenFind:p,onOpenReplace:m,toggleSelectionLock:_,fonts:v,sizes:y,saveSelection:b,openTextColorPicker:x,openHighlightColorPicker:S,fontConf:o,paragraphConf:s,clipboardConf:u,editingConf:h},`plugin-${t}-${c}`)),O=(e,t)=>{e.preventDefault();let n=e.currentTarget.getBoundingClientRect();w({type:t,open:!0,x:n.left,y:n.bottom})};return(0,r.jsxs)(r.Fragment,{children:[u&&(0,r.jsxs)(`div`,{className:`flex gap-2 pr-2 mr-2 relative h-[88px] pb-[18px] items-center border-r border-gray-300`,children:[(0,r.jsxs)(`div`,{className:`flex flex-row items-center gap-1`,children:[u.paste&&(0,r.jsxs)(`button`,{onClick:d,disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-gray-200 border border-transparent hover:border-gray-300 rounded-sm h-[60px] w-[50px] transition-all disabled:opacity-50 group`,title:`Paste (Ctrl+V)`,children:[(0,r.jsx)(Hc,{size:28,className:`text-[#2b579a] mb-0.5 group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[9px] font-medium uppercase text-gray-600`,children:`Paste`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u.cut&&(0,r.jsx)($,{onClick:()=>i(`cut`),icon:(0,r.jsx)(dl,{size:14}),disabled:e,title:`Cut (Ctrl+X)`}),u.undo&&(0,r.jsx)($,{onClick:()=>i(`undo`),icon:(0,r.jsx)(yl,{size:14}),disabled:e,title:`Undo (Ctrl+Z)`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u.copy&&(0,r.jsx)($,{onClick:()=>i(`copy`),icon:(0,r.jsx)(Wc,{size:14}),disabled:e,title:`Copy (Ctrl+C)`}),u.redo&&(0,r.jsx)($,{onClick:()=>i(`redo`),icon:(0,r.jsx)(sl,{size:14}),disabled:e,title:`Redo (Ctrl+Y)`})]})]})]}),(0,r.jsx)(`div`,{className:`pt-2`,children:D(`clipboard`)}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-bold tracking-tighter`,children:`Clipboard`})]}),o&&(0,r.jsxs)(`div`,{className:`flex flex-col border-r border-gray-300 pr-2 mr-2 relative h-[88px] pb-[18px] justify-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-1`,children:[(0,r.jsxs)(`div`,{className:`flex items-center`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col item-center gap-0 5`,children:[o.bold&&(0,r.jsx)($,{onClick:()=>i(`bold`),icon:(0,r.jsx)(Ic,{size:14}),isActive:a.bold,disabled:e,title:`Bold (Ctrl+B)`}),o.italic&&(0,r.jsx)($,{onClick:()=>i(`italic`),icon:(0,r.jsx)(Qc,{size:14}),isActive:a.italic,disabled:e,title:`Italic (Ctrl+I)`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col item-center gap-0 5`,children:[o.underline&&(0,r.jsx)($,{onClick:()=>i(`underline`),icon:(0,r.jsx)(vl,{size:14}),isActive:a.underline,disabled:e,title:`Underline (Ctrl+U)`}),o.strikeThrough&&(0,r.jsx)($,{onClick:()=>i(`strikeThrough`),icon:(0,r.jsx)(hl,{size:14}),isActive:a.strikeThrough,disabled:e,title:`Strikethrough`})]})]}),D(`font`)]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-bold tracking-tighter`,children:`Font`})]}),s&&(0,r.jsxs)(`div`,{className:`flex flex-col border-r border-gray-300 pr-2 mr-2 relative h-[88px] pb-[18px] justify-center`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[s.bullets&&(0,r.jsx)($,{onClick:e=>O(e,`ul`),icon:(0,r.jsx)(tl,{size:14}),isActive:a.insertUnorderedList,disabled:e,title:`Bullets`}),s.numbering&&(0,r.jsx)($,{onClick:e=>O(e,`ol`),icon:(0,r.jsx)(el,{size:14}),isActive:a.insertOrderedList,disabled:e,title:`Numbering`}),(s.bullets||s.numbering)&&(0,r.jsx)(`div`,{className:`w-px h-4 bg-gray-300 mx-1`}),s.outdent&&(0,r.jsx)($,{onClick:()=>i(`outdent`),icon:(0,r.jsx)(Yc,{size:14}),disabled:e,title:`Decrease Indent`}),s.indent&&(0,r.jsx)($,{onClick:()=>i(`indent`),icon:(0,r.jsx)(Xc,{size:14}),disabled:e,title:`Increase Indent`}),(s.outdent||s.indent)&&(0,r.jsx)(`div`,{className:`w-px h-4 bg-gray-300 mx-1`}),s.lineSpacing&&(0,r.jsx)(`div`,{className:`relative`,children:(0,r.jsx)($,{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();E({open:!0,x:t.left,y:t.bottom})},icon:(0,r.jsx)(rl,{size:14}),disabled:e,title:`Line Spacing`})}),s.blockquote&&(0,r.jsx)($,{onClick:()=>i(`formatBlock`,`blockquote`),icon:(0,r.jsx)(ol,{size:14}),disabled:e,title:`Quote`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[s.alignLeft&&(0,r.jsx)($,{onClick:()=>i(`justifyLeft`),icon:(0,r.jsx)(Dc,{size:14}),isActive:a.justifyLeft,disabled:e,title:`Align Left (Ctrl+L)`}),s.alignCenter&&(0,r.jsx)($,{onClick:()=>i(`justifyCenter`),icon:(0,r.jsx)(Tc,{size:14}),isActive:a.justifyCenter,disabled:e,title:`Align Center (Ctrl+E)`}),s.alignRight&&(0,r.jsx)($,{onClick:()=>i(`justifyRight`),icon:(0,r.jsx)(Oc,{size:14}),isActive:a.justifyRight,disabled:e,title:`Align Right (Ctrl+R)`}),s.alignJustify&&(0,r.jsx)($,{onClick:()=>i(`justifyFull`),icon:(0,r.jsx)(Ec,{size:14}),isActive:a.justifyFull,disabled:e,title:`Justify (Ctrl+J)`})]})]}),D(`paragraph`),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-bold tracking-tighter`,children:`Paragraph`})]}),h&&(0,r.jsxs)(`div`,{className:`flex flex-col border-r border-gray-300 pr-2 mr-2 relative h-[88px] pb-[18px] justify-center`,children:[(0,r.jsxs)(`div`,{className:`flex flex-row items-center gap-1 h-full`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[h.find&&(0,r.jsxs)(`button`,{onClick:p,disabled:e,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group`,children:[(0,r.jsx)(fl,{size:14,className:`text-[#2b579a] group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Find`})]}),h.replace&&(0,r.jsxs)(`button`,{onClick:m,disabled:e,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group`,children:[(0,r.jsx)(cl,{size:14,className:`text-[#2b579a] group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Replace`})]})]}),D(`editing`)]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-bold tracking-tighter`,children:`Editing`})]}),D(`custom`),C.open&&n.default.createPortal((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`fixed inset-0 z-[98]`,onClick:()=>w(e=>({...e,open:!1}))}),(0,r.jsx)(`div`,{className:`fixed bg-white border border-gray-200 shadow-xl z-[99] py-1 rounded-sm flex flex-col min-w-[120px]`,style:{left:C.x,top:C.y},children:C.type===`ul`?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`button`,{onClick:()=>{l(`disc`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100 flex items-center gap-2`,children:[(0,r.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-black`}),` Dot`]}),(0,r.jsxs)(`button`,{onClick:()=>{l(`circle`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100 flex items-center gap-2`,children:[(0,r.jsx)(`div`,{className:`w-2 h-2 rounded-full border border-black`}),` Circle`]}),(0,r.jsxs)(`button`,{onClick:()=>{l(`square`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100 flex items-center gap-2`,children:[(0,r.jsx)(`div`,{className:`w-2 h-2 bg-black`}),` Square`]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`button`,{onClick:()=>{l(`decimal`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`1. Number`}),(0,r.jsx)(`button`,{onClick:()=>{l(`lower-alpha`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`a. Lower Alpha`}),(0,r.jsx)(`button`,{onClick:()=>{l(`upper-alpha`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`A. Upper Alpha`}),(0,r.jsx)(`button`,{onClick:()=>{l(`lower-roman`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`i. Lower Roman`}),(0,r.jsx)(`button`,{onClick:()=>{l(`upper-roman`),w(e=>({...e,open:!1}))},className:`px-4 py-2 text-xs text-left hover:bg-gray-100`,children:`I. Upper Roman`})]})})]}),document.body),T.open&&n.default.createPortal((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`fixed inset-0 z-[98]`,onClick:()=>E(e=>({...e,open:!1}))}),(0,r.jsx)(`div`,{className:`fixed bg-white border border-gray-200 shadow-xl z-[99] py-1 rounded-sm flex flex-col min-w-[80px] animate-in fade-in slide-in-from-top-1 duration-100`,style:{left:T.x,top:T.y+4},children:[`1.0`,`1.15`,`1.5`,`2.0`,`2.5`,`3.0`].map(e=>(0,r.jsx)(`button`,{onClick:()=>{c(e),E(e=>({...e,open:!1}))},className:`w-full text-left px-4 py-2 text-xs hover:bg-gray-100 transition-colors font-medium text-gray-700`,children:e},e))})]}),document.body)]})},Sl=({showHtml:e,tableConf:i,tableMenuRef:a,isTableMenuOpen:o,setIsTableMenuOpen:s,tableGridSize:c,setTableGridSize:l,handleInsertTable:u,mediaConf:d,imageInputRef:f,linkConf:p,execCommand:m,saveSelection:h,isLinkMenuOpen:g,setIsLinkMenuOpen:_,linkUrl:v,setLinkUrl:y})=>{let[b,x]=(0,t.useState)({top:0,left:0}),S=t.default.useRef(null);(0,t.useLayoutEffect)(()=>{if(o&&a.current){let e=a.current.getBoundingClientRect();x({top:e.bottom+4,left:e.left})}},[o,a]),(0,t.useLayoutEffect)(()=>{if(g&&S.current){let e=S.current.getBoundingClientRect();x({top:e.bottom+4,left:e.left})}},[g]);let C=()=>{if(h(),y(`https://`),S.current){let e=S.current.getBoundingClientRect();x({top:e.bottom+4,left:e.left})}_(!0)},w=()=>{m(`createLink`,v),_(!1),y(`https://`)};return(0,r.jsxs)(r.Fragment,{children:[i&&(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,ref:a,children:[(0,r.jsxs)(`div`,{className:`relative`,children:[(0,r.jsxs)(`button`,{onClick:()=>s(e=>!e),disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all ${o?`bg-gray-300 border-gray-400`:``} disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,r.jsx)(gl,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsxs)(`span`,{className:`text-[9px] font-medium flex items-center gap-0.5`,children:[`Table `,(0,r.jsx)(Lc,{size:10})]})]}),o&&!e&&n.default.createPortal((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`fixed inset-0 z-[99]`,onClick:()=>s(!1)}),(0,r.jsxs)(`div`,{className:`fixed z-[100] bg-[#f6f8fb] border border-gray-400 shadow-2xl p-4 rounded-xl flex flex-col items-center pointer-events-auto`,style:{top:b.top,left:b.left},children:[(0,r.jsx)(`div`,{className:`text-sm text-gray-800 mb-3 text-center font-bold whitespace-nowrap`,children:c.r>0?`Insert Table ${c.c}×${c.r}`:`Choose Table Dimensions`}),(0,r.jsx)(`div`,{className:`flex flex-col gap-[2px] bg-white border border-gray-300 p-2 rounded-lg`,onMouseLeave:()=>l({r:0,c:0}),children:[...Array(8)].map((e,t)=>(0,r.jsx)(`div`,{className:`flex gap-[2px]`,children:[...Array(10)].map((e,n)=>{let i=t+1,a=n+1;return(0,r.jsx)(`div`,{className:`w-5 h-5 border rounded-sm cursor-pointer transition-colors ${i<=c.r&&a<=c.c?`bg-[#c1d3ee] border-[#2b579a]`:`bg-white border-gray-200 hover:border-blue-400`}`,onMouseEnter:()=>l({r:i,c:a}),onMouseDown:e=>{e.preventDefault(),u(i,a),s(!1)}},n)})},t))})]})]}),document.body)]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Table`})]}),d&&(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`button`,{onClick:()=>f.current?.click(),disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all disabled:opacity-50`,title:`Insert Picture`,children:[(0,r.jsx)(Jc,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsx)(`span`,{className:`text-[9px] font-medium`,children:`Picture`})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Media`})]}),p&&(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`relative`,ref:S,children:[(0,r.jsxs)(`button`,{onClick:C,disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all ${g?`bg-gray-300 border-gray-400`:``} disabled:opacity-50`,title:`Insert Link`,children:[(0,r.jsx)($c,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsx)(`span`,{className:`text-[9px] font-medium`,children:`Link`})]}),g&&!e&&n.default.createPortal((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`fixed inset-0 z-[99]`,onClick:()=>_(!1)}),(0,r.jsxs)(`div`,{className:`fixed z-[100] bg-white border border-gray-300 shadow-xl p-3 rounded-lg flex flex-col gap-2 min-w-[240px]`,style:{top:b.top,left:b.left},children:[(0,r.jsx)(`label`,{className:`text-xs font-semibold text-gray-700`,children:`Address:`}),(0,r.jsx)(`input`,{autoFocus:!0,type:`text`,value:v,onChange:e=>y(e.target.value),onKeyDown:e=>e.key===`Enter`&&w(),className:`border border-gray-300 rounded px-2 py-1 text-sm outline-none focus:border-blue-500`,placeholder:`https://example.com`}),(0,r.jsxs)(`div`,{className:`flex justify-end gap-2 mt-1`,children:[(0,r.jsx)(`button`,{onClick:()=>_(!1),className:`px-3 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded`,children:`Cancel`}),(0,r.jsx)(`button`,{onClick:w,className:`px-3 py-1 text-xs bg-[#2b579a] text-white rounded hover:bg-[#1a3a6a]`,children:`OK`})]})]})]}),document.body)]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Links`})]})]})},Cl=({showHtml:e,inputIndentLeft:t,setInputIndentLeft:n,inputIndentRight:i,setInputIndentRight:a,applyIndent:o,inputSpacingBefore:s,setInputSpacingBefore:c,inputSpacingAfter:l,setInputSpacingAfter:u,applySpacing:d,insertPageBreak:f,pagesConf:p})=>(0,r.jsxs)(r.Fragment,{children:[p&&!e&&(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`button`,{onClick:f,disabled:e,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all disabled:opacity-50`,title:`Page Break (Ctrl+Enter)`,children:[(0,r.jsx)(dl,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsxs)(`span`,{className:`text-[9px] font-medium text-center leading-tight`,children:[`Page`,(0,r.jsx)(`br`,{}),`Break`]})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Page Setup`})]}),!e&&(0,r.jsxs)(`div`,{className:`flex gap-2 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col gap-1 justify-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5 h-6`,children:[(0,r.jsx)(`span`,{className:`text-[10px] text-gray-700 w-[60px] text-right`,children:`Indent Left`}),(0,r.jsx)(`input`,{type:`text`,"data-field":`indentLeft`,value:t,onChange:e=>{n(e.target.value);let t=parseFloat(e.target.value);isNaN(t)||o(`left`,t)},className:`w-14 h-6 border border-gray-300 rounded bg-white px-1.5 text-xs outline-none focus:border-[#2b579a] transition-colors tabular-nums`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5 h-6`,children:[(0,r.jsx)(`span`,{className:`text-[10px] text-gray-700 w-[60px] text-right`,children:`Indent Right`}),(0,r.jsx)(`input`,{type:`text`,"data-field":`indentRight`,value:i,onChange:e=>{a(e.target.value);let t=parseFloat(e.target.value);isNaN(t)||o(`right`,t)},className:`w-14 h-6 border border-gray-300 rounded bg-white px-1.5 text-xs outline-none focus:border-[#2b579a] transition-colors tabular-nums`})]})]}),(0,r.jsxs)(`div`,{className:`flex flex-col gap-1 justify-center pl-2 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5 h-6`,children:[(0,r.jsx)(`span`,{className:`text-[10px] text-gray-700 w-[70px] text-right`,children:`Spacing Before`}),(0,r.jsx)(`input`,{type:`text`,"data-field":`spacingBefore`,value:s,onChange:e=>{c(e.target.value);let t=parseFloat(e.target.value);isNaN(t)||d(`before`,t)},className:`w-14 h-6 border border-gray-300 rounded bg-white px-1.5 text-xs outline-none focus:border-[#2b579a] transition-colors tabular-nums`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5 h-6`,children:[(0,r.jsx)(`span`,{className:`text-[10px] text-gray-700 w-[70px] text-right`,children:`Spacing After`}),(0,r.jsx)(`input`,{type:`text`,"data-field":`spacingAfter`,value:l,onChange:e=>{u(e.target.value);let t=parseFloat(e.target.value);isNaN(t)||d(`after`,t)},className:`w-14 h-6 border border-gray-300 rounded bg-white px-1.5 text-xs outline-none focus:border-[#2b579a] transition-colors tabular-nums`})]})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Paragraph`})]})]}),wl=[`#ffffff`,`#000000`,`#eeece1`,`#1f497d`,`#4f81bd`,`#c0504d`,`#9bbb59`,`#8064a2`,`#4bacc6`,`#f79646`],Tl=[[`#f2f2f2`,`#7f7f7f`,`#ddd9c3`,`#c6d9f0`,`#dbe5f1`,`#f2dcdb`,`#ebf1de`,`#e5e0ec`,`#dbeef3`,`#fdeada`],[`#d8d8d8`,`#595959`,`#c4bd97`,`#8db3e2`,`#b8cce4`,`#e5b9b7`,`#d7e3bc`,`#ccc1d9`,`#b7dde8`,`#fbd5b5`],[`#bfbfbf`,`#3f3f3f`,`#938953`,`#548dd4`,`#95b3d7`,`#d99694`,`#c3d69b`,`#b2a2c7`,`#93cddd`,`#fac08f`],[`#a5a5a5`,`#262626`,`#494429`,`#17365d`,`#365f91`,`#953734`,`#76923c`,`#5f497a`,`#31859b`,`#e36c09`],[`#7f7f7f`,`#0c0c0c`,`#1d1b10`,`#0f243e`,`#243f60`,`#632423`,`#4f6128`,`#3f3151`,`#205867`,`#974806`]],El=[`#c00000`,`#ff0000`,`#ffc000`,`#ffff00`,`#92d050`,`#00b050`,`#00b0f0`,`#0070c0`,`#002060`,`#7030a0`],Dl=({label:e,icon:i,onSelect:a,disabled:o,onOpen:s,variant:c=`big`,activeColor:l})=>{let[u,d]=(0,t.useState)(!1),[f,p]=(0,t.useState)(null),m=(0,t.useRef)(null),h=(0,t.useRef)(null),[g,_]=(0,t.useState)(`#000000`),v=(0,t.useRef)(null),y=e=>{e.preventDefault(),!o&&(u?d(!1):(s?.(),d(!0)))};(0,t.useEffect)(()=>{if(!u)return;let e=()=>{let e=m.current?.getBoundingClientRect();e&&p({top:e.bottom,left:e.left})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[u]),(0,t.useEffect)(()=>{let e=e=>{if(u){let t=e.target,n=m.current?.contains(t),r=h.current?.contains(t),i=t===v.current;!n&&!r&&!i&&d(!1)}};return document.addEventListener(`mousedown`,e,!0),()=>document.removeEventListener(`mousedown`,e,!0)},[u]);let b=(e,t)=>{e.preventDefault(),a(t),d(!1)},x=()=>{v.current&&v.current.click()},S=e=>{let t=e.target.value;_(t),a(t)},C=c===`compact`;return(0,r.jsxs)(`div`,{className:`relative inline-block`,children:[(0,r.jsxs)(`button`,{ref:m,onMouseDown:y,disabled:o,title:e,className:`flex flex-col items-center justify-center border border-transparent transition-all disabled:opacity-50 ${C?`h-8 px-1 mt-0.5 hover:bg-white hover:border-gray-300 hover:shadow-sm`:`h-[52px] w-[36px] hover:bg-gray-50 hover:border-gray-300 hover:shadow-sm`} ${u?`bg-white border-gray-300 shadow-inner`:``}`,children:[(0,r.jsxs)(`div`,{className:`relative flex flex-col items-center ${C?`scale-90`:``}`,children:[i,l&&(0,r.jsx)(`div`,{className:`absolute -bottom-0.5 left-0 right-0 h-[3px] rounded-full shadow-[0_1px_1px_rgba(0,0,0,0.1)]`,style:{backgroundColor:l}})]}),(0,r.jsx)(Lc,{size:C?8:10,className:`text-gray-400 mt-0.5 transition-transform ${u?`rotate-180`:``}`})]}),u&&f&&n.default.createPortal((0,r.jsxs)(`div`,{ref:h,className:`fixed z-[9999] bg-white border border-gray-300 shadow-xl p-3 select-none flex flex-col gap-3`,style:{top:`${f.top+4}px`,left:`${f.left}px`,maxWidth:`100vw`},onMouseDown:e=>e.preventDefault(),children:[(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`div`,{className:`text-[10px] font-bold text-gray-500 mb-1.5 uppercase tracking-wider`,children:`Theme Colors`}),(0,r.jsxs)(`div`,{className:`flex flex-col`,children:[(0,r.jsx)(`div`,{className:`flex`,children:wl.map(e=>(0,r.jsx)(`div`,{onMouseDown:t=>b(t,e),className:`w-[18px] h-[18px] border border-gray-200 cursor-pointer hover:scale-125 transition-transform z-10`,style:{backgroundColor:e}},e))}),Tl.map((e,t)=>(0,r.jsx)(`div`,{className:`flex`,children:e.map(e=>(0,r.jsx)(`div`,{onMouseDown:t=>b(t,e),className:`w-[18px] h-[18px] border border-gray-100 cursor-pointer hover:scale-125 transition-transform z-10`,style:{backgroundColor:e}},e))},t))]})]}),(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`div`,{className:`text-[10px] font-bold text-gray-500 mb-1.5 uppercase tracking-wider`,children:`Standard Colors`}),(0,r.jsx)(`div`,{className:`flex`,children:El.map(e=>(0,r.jsx)(`div`,{onMouseDown:t=>b(t,e),className:`w-[18px] h-[18px] border border-gray-200 cursor-pointer hover:scale-125 transition-transform z-10`,style:{backgroundColor:e},title:e},e))})]}),(0,r.jsxs)(`div`,{className:`border-t border-gray-200 pt-2 flex flex-col gap-1`,children:[(0,r.jsxs)(`button`,{onMouseDown:e=>b(e,null),className:`flex items-center gap-2 px-2 py-1.5 hover:bg-gray-100 rounded text-xs text-gray-700 transition-colors w-full text-left`,children:[(0,r.jsx)(Gc,{size:14,className:`text-gray-500`}),(0,r.jsx)(`span`,{children:`No Color`})]}),(0,r.jsxs)(`button`,{onMouseDown:e=>{e.preventDefault(),x()},className:`flex items-center gap-2 px-2 py-1.5 hover:bg-blue-50 rounded text-xs text-blue-700 transition-colors w-full text-left font-medium`,children:[(0,r.jsx)(`div`,{className:`w-3.5 h-3.5 rounded-full border border-blue-200`,style:{background:`conic-gradient(red, yellow, lime, aqua, blue, magenta, red)`}}),(0,r.jsx)(`span`,{children:`More Colors...`})]}),(0,r.jsx)(`div`,{className:`mt-1 border-t border-gray-100 pt-1`,children:(0,r.jsx)(`button`,{onMouseDown:e=>{e.preventDefault(),d(!1)},className:`w-full py-1 text-[10px] font-bold text-gray-400 hover:text-gray-600 uppercase tracking-tighter`,children:`Close Picker`})}),(0,r.jsx)(`input`,{ref:v,type:`color`,value:g,onChange:S,style:{opacity:0,position:`absolute`,pointerEvents:`none`}})]})]}),document.body)]})},Ol=({showHtml:e,activeTableCell:t,handleTableAction:n,saveSelection:i})=>{if(!t||e)return null;let a=e=>{let n=`padding${e}`,r=t.style[n];return r?parseInt(r):8};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-2 items-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`insertRowAbove`),icon:(0,r.jsx)(Fc,{size:14,className:`text-[#2b579a]`}),title:`Insert Above`}),(0,r.jsx)($,{onClick:()=>n(`insertRowBelow`),icon:(0,r.jsx)(Mc,{size:14,className:`text-[#2b579a]`}),title:`Insert Below`})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Rows`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`insertColLeft`),icon:(0,r.jsx)(Nc,{size:14,className:`text-[#2b579a]`}),title:`Insert Left`}),(0,r.jsx)($,{onClick:()=>n(`insertColRight`),icon:(0,r.jsx)(Pc,{size:14,className:`text-[#2b579a]`}),title:`Insert Right`})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Cols`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col items-center justify-start h-full pt-1 border-l border-gray-200 pl-2`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`deleteRow`),icon:(0,r.jsx)(_l,{size:14,className:`text-red-500`}),title:`Delete Row`,label:`Row`}),(0,r.jsx)($,{onClick:()=>n(`deleteCol`),icon:(0,r.jsx)(_l,{size:14,className:`text-red-500`}),title:`Delete Col`,label:`Col`}),(0,r.jsx)($,{onClick:()=>n(`deleteTable`),icon:(0,r.jsx)(_l,{size:14,className:`text-red-700`}),title:`Delete All`,label:`All`})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Delete`})]})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Rows & Columns`})]}),(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5 items-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsx)(`div`,{className:`flex gap-0.5`,children:(0,r.jsx)($,{onClick:()=>n(`mergeCells`),icon:(0,r.jsx)(Uc,{size:14,className:`text-[#2b579a]`}),title:`Merge Selected Cells`,label:`Selection`})}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Merge`})]}),(0,r.jsx)(`div`,{className:`w-px h-6 bg-gray-200 mx-1`}),(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`mergeRight`),icon:(0,r.jsx)(Uc,{size:14,className:`text-[#2b579a]`}),title:`Merge Right`}),(0,r.jsx)($,{onClick:()=>n(`mergeDown`),icon:(0,r.jsx)(`div`,{className:`rotate-90`,children:(0,r.jsx)(Uc,{size:14,className:`text-[#2b579a]`})}),title:`Merge Down`}),(0,r.jsx)($,{onClick:()=>n(`splitCell`),icon:(0,r.jsx)(pl,{size:14,className:`text-[#2b579a]`}),title:`Split Cells`})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:`Individual`})]})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Merge`})]}),(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-2 items-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)($,{onClick:()=>n(`alignTop`),icon:(0,r.jsx)(jc,{size:14,className:`text-[#2b579a]`}),title:`Align Top`}),(0,r.jsx)($,{onClick:()=>n(`alignMiddle`),icon:(0,r.jsx)(kc,{size:14,className:`text-[#2b579a]`}),title:`Align Middle`}),(0,r.jsx)($,{onClick:()=>n(`alignBottom`),icon:(0,r.jsx)(Ac,{size:14,className:`text-[#2b579a]`}),title:`Align Bottom`})]}),(0,r.jsx)(`div`,{className:`w-px h-6 bg-gray-200`}),(0,r.jsx)(`div`,{className:`flex gap-0.5`,children:(0,r.jsx)(Dl,{label:`Shading`,icon:(0,r.jsx)(il,{size:16,className:`text-[#2b579a]`}),disabled:e,onOpen:i,onSelect:e=>n(`cellColor`,e||`transparent`)})})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Alignment`})]}),(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsx)(`div`,{className:`flex gap-2 items-center pl-1 h-[52px]`,children:(0,r.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,r.jsxs)(`div`,{className:`flex gap-0.5 border border-gray-200 rounded p-0.5 items-center`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col`,children:[(0,r.jsx)(`span`,{className:`text-[7px] text-gray-400 text-center`,children:`T/B`}),(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)(`button`,{onClick:()=>n(`paddingTopPlus`),className:`p-0.5 hover:bg-gray-200 rounded text-[#2b579a]`,children:(0,r.jsx)(Fc,{size:10})}),(0,r.jsx)(`button`,{onClick:()=>n(`paddingBottomPlus`),className:`p-0.5 hover:bg-gray-200 rounded text-[#2b579a]`,children:(0,r.jsx)(Mc,{size:10})})]})]}),(0,r.jsxs)(`div`,{className:`flex flex-col`,children:[(0,r.jsx)(`span`,{className:`text-[7px] text-gray-400 text-center`,children:`L/R`}),(0,r.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,r.jsx)(`button`,{onClick:()=>n(`paddingLeftPlus`),className:`p-0.5 hover:bg-gray-200 rounded text-[#2b579a]`,children:(0,r.jsx)(Nc,{size:10})}),(0,r.jsx)(`button`,{onClick:()=>n(`paddingRightPlus`),className:`p-0.5 hover:bg-gray-200 rounded text-[#2b579a]`,children:(0,r.jsx)(Pc,{size:10})})]})]})]}),(0,r.jsxs)(`span`,{className:`text-[8px] text-gray-400 mt-0.5`,children:[`Padding (T:`,a(`Top`),` L:`,a(`Left`),`)`]})]})}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Cell Padding`})]}),(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsxs)(`div`,{className:`flex gap-2 items-center pl-1 h-[52px]`,children:[(0,r.jsxs)(`div`,{className:`grid grid-cols-3 gap-0.5 border border-gray-200 p-0.5 rounded`,children:[(0,r.jsx)(`button`,{onClick:()=>n(`borderTop`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`Top Border`,children:(0,r.jsx)(`div`,{className:`w-3 h-0.5 bg-black mb-1.5 opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderBottom`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`Bottom Border`,children:(0,r.jsx)(`div`,{className:`w-3 h-0.5 bg-black mt-1.5 opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderLeft`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`Left Border`,children:(0,r.jsx)(`div`,{className:`w-0.5 h-3 bg-black mr-1.5 opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderRight`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`Right Border`,children:(0,r.jsx)(`div`,{className:`w-0.5 h-3 bg-black ml-1.5 opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderAll`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`All Borders`,children:(0,r.jsx)(ml,{size:12,className:`opacity-80`})}),(0,r.jsx)(`button`,{onClick:()=>n(`borderNone`),className:`p-1 hover:bg-gray-200 rounded border border-transparent hover:border-gray-300`,title:`No Borders`,children:(0,r.jsx)(nl,{size:12,className:`text-gray-300`})})]}),(0,r.jsx)(`span`,{className:`text-[8px] text-gray-400 mt-0.5 self-center`,children:`Borders`})]}),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Side Styling`})]})]})},kl=({showHtml:e,activeImage:t,imageWidth:n,handleImageWidthChange:i,handleImageAction:a})=>(0,r.jsx)(r.Fragment,{children:t&&!e&&(0,r.jsxs)(`div`,{className:`flex border-r border-green-200 pr-2 mr-1 bg-[#f5fff5] pl-2 py-0.5 rounded-sm h-[88px] pb-[22px] relative`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col gap-1 items-center justify-center px-4 border-r border-green-200 relative`,children:[(0,r.jsxs)(`span`,{className:`text-[10px] text-green-800 font-medium mb-1 w-full text-center`,children:[`Image Width: `,n,`%`]}),(0,r.jsx)(`input`,{type:`range`,min:`10`,max:`100`,value:n,onChange:i,className:`w-28 cursor-pointer accent-green-600`}),(0,r.jsx)(`div`,{className:`absolute bottom-[-18px] left-0 right-0 text-[9px] text-center text-green-700 uppercase font-semibold`,children:`Size`})]}),(0,r.jsxs)(`div`,{className:`flex flex-col gap-1 items-center justify-center px-4 border-r border-green-200 relative`,children:[(0,r.jsxs)(`div`,{className:`flex gap-1`,children:[(0,r.jsx)($,{onClick:()=>a(`alignLeft`),icon:(0,r.jsx)(Dc,{size:14,className:`text-green-700`}),title:`Align Left`}),(0,r.jsx)($,{onClick:()=>a(`alignCenter`),icon:(0,r.jsx)(Tc,{size:14,className:`text-green-700`}),title:`Align Center`}),(0,r.jsx)($,{onClick:()=>a(`alignRight`),icon:(0,r.jsx)(Oc,{size:14,className:`text-green-700`}),title:`Align Right`}),(0,r.jsx)($,{onClick:()=>a(`alignNone`),icon:(0,r.jsx)(Ec,{size:14,className:`text-green-700`}),title:`Inline`})]}),(0,r.jsx)(`div`,{className:`absolute bottom-[-18px] left-0 right-0 text-[9px] text-center text-green-700 uppercase font-semibold`,children:`Arrange`})]}),(0,r.jsxs)(`div`,{className:`flex items-center justify-center px-2 py-1 relative`,children:[(0,r.jsx)($,{onClick:()=>a(`delete`),icon:(0,r.jsx)(_l,{size:18,className:`text-red-600`}),label:`Delete`,className:`h-[52px] w-[52px]`,title:`Delete Picture`}),(0,r.jsx)(`div`,{className:`absolute bottom-[-18px] left-0 right-0 text-[9px] text-center text-red-600 uppercase font-semibold`,children:`Actions`})]})]})}),Al=({onSave:e,onSaveAsDocs:t,onPrint:n,toggleHtmlView:i,activeStyles:a,showHtml:o,execCommand:s,onImportWord:c,pluginContributions:l=[],fonts:u,sizes:d})=>{let f=e=>l.filter(t=>t.groupId===e).map((t,n)=>(0,r.jsx)(t.component,{execCommand:s,activeStyles:a,showHtml:o,toggleHtmlView:i,onImportWord:c,fonts:u,sizes:d},`file-plugin-${e}-${n}`));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`div`,{className:`flex gap-1 border-r border-gray-300 pr-2 mr-1 relative h-[88px] pb-[22px]`,children:[(0,r.jsx)(`div`,{className:`flex flex-row justify-start`,children:(0,r.jsxs)(`button`,{onClick:n,disabled:o,className:`flex flex-col items-center justify-center p-1.5 hover:bg-[#d0d0d0] border border-transparent hover:border-gray-400 rounded-sm h-[52px] w-[52px] transition-all disabled:opacity-50`,children:[(0,r.jsx)(al,{size:22,className:`text-[#2b579a] mb-1`}),(0,r.jsx)(`span`,{className:`text-[9px] font-medium uppercase`,children:`Print`})]})}),(0,r.jsxs)(`div`,{className:`flex flex-col gap-0.5 justify-center`,children:[(0,r.jsxs)(`button`,{onClick:e,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group`,children:[(0,r.jsx)(ul,{size:14,className:`text-blue-600 group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Save`})]}),(0,r.jsxs)(`button`,{onClick:t,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group`,children:[(0,r.jsx)(qc,{size:14,className:`text-blue-700 group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Save As Docx`})]}),(0,r.jsxs)(`button`,{onClick:i,className:`flex items-center gap-2 px-2 py-1 hover:bg-gray-200 rounded-sm text-gray-700 transition-all group ${o?`bg-blue-50 text-blue-700 pr-3`:``}`,children:[(0,r.jsx)(Kc,{size:14,className:`${o?`text-blue-700`:`text-gray-500`} group-hover:scale-110 transition-transform`}),(0,r.jsx)(`span`,{className:`text-[10px] font-medium`,children:o?`Rich Text`:`View HTML`})]})]}),f(`insert`),(0,r.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 text-[9px] text-center text-gray-400 pb-0.5 uppercase font-semibold`,children:`Document`})]}),f(`custom`)]})};function jl(){return(0,r.jsxs)(`div`,{className:`flex flex-nowrap items-center h-full gap-4 overflow-x-auto px-1 pr-6 custom-scrollbar`,children:[(0,r.jsxs)(`div`,{className:`flex flex-col justify-center border-r border-gray-300 pr-4 shrink-0`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,r.jsx)(Vc,{size:16,className:`text-[#2b579a]`}),(0,r.jsx)(`span`,{className:`text-xs font-bold text-gray-700 uppercase tracking-tight`,children:`Shortcuts`})]}),(0,r.jsx)(`p`,{className:`text-[10px] text-gray-500 max-w-[120px] leading-tight`,children:`Keyboard guides for productivity.`})]}),(0,r.jsx)(`div`,{className:`flex flex-nowrap gap-6`,children:(0,r.jsx)(`div`,{className:`grid grid-rows-2 grid-flow-col gap-x-8 gap-y-2`,children:[{key:`Ctrl + B`,action:`Bold`},{key:`Ctrl + I`,action:`Italic`},{key:`Ctrl + U`,action:`Underline`},{key:`Ctrl + S`,action:`Save`},{key:`Ctrl + F`,action:`Find`},{key:`Ctrl + H`,action:`Replace`},{key:`Ctrl + K`,action:`Link`},{key:`Ctrl + P`,action:`Print`},{key:`Ctrl + L`,action:`Align Left`},{key:`Ctrl + E`,action:`Align Center`},{key:`Ctrl + R`,action:`Align Right`},{key:`Ctrl + J`,action:`Justify`},{key:`Ctrl + Z`,action:`Undo`},{key:`Ctrl + Y`,action:`Redo`},{key:`Tab`,action:`Indent`}].map((e,t)=>(0,r.jsxs)(`div`,{className:`flex items-center gap-2 min-w-[130px]`,children:[(0,r.jsx)(`div`,{className:`bg-gray-200 px-1.5 py-0.5 rounded text-[9px] font-mono font-bold text-gray-700 shadow-sm border border-gray-300 min-w-[70px] text-center`,children:e.key}),(0,r.jsx)(`span`,{className:`text-[10px] text-gray-600 font-medium whitespace-nowrap`,children:e.action})]},t))})})]})}function Ml(e,t){if(!e)return!1;if(e===!0)return{...t};let n={...t};for(let t in n)n[t]=!!e[t];return n}e.ColorPicker=Dl,e.default=({initialHTML:e=`<p>Start typing here...</p>`,onChange:i,onSave:a,toolbarOptions:o={},height:s=`100vh`,className:c=``,initialPaddingLeft:l=20,initialPaddingRight:u=20,initialIndentLeft:d=0,initialIndentRight:f=0,initialLineSpacing:p=`1.5`,initialSpacingBefore:m=0,initialSpacingAfter:h=0,plugins:g=[]})=>{let _=(0,t.useRef)(null),v=(0,t.useRef)(null),y=(0,t.useRef)(null),b=(0,t.useRef)(null),x=(0,t.useRef)(null),S=(0,t.useRef)(null),C=(0,t.useRef)(null),w=(0,t.useRef)(null),T=(0,t.useRef)(null),E=e.trim(),D=(0,t.useRef)(E),[O,k]=(0,t.useState)(`Home`),A=Ml(o.clipboard??!0,{paste:!0,cut:!0,copy:!0,undo:!0,redo:!0}),j=Ml(o.font??!0,{family:!0,size:!0,bold:!0,italic:!0,underline:!0,strikeThrough:!0,subscript:!0,superscript:!0,highlight:!0,color:!0,clear:!0}),M=typeof o.font==`object`?o.font:{},N=Ml(o.paragraph??!0,{bullets:!0,numbering:!0,outdent:!0,indent:!0,alignLeft:!0,alignCenter:!0,alignRight:!0,alignJustify:!0,lineSpacing:!0,blockquote:!0}),P=Ml(o.editing??!0,{find:!0,replace:!0,lock:!0}),F=!!(o.table??!0),I=!!(o.link??!0),L=!!(o.media??!0),R=!!(o.pages??!0),[z,B]=(0,t.useState)({bold:!1,italic:!1,underline:!1,strikeThrough:!1,insertUnorderedList:!1,insertOrderedList:!1,justifyLeft:!1,justifyCenter:!1,justifyRight:!1,justifyFull:!1,fontSize:(M.size,`3`),fontName:(M.family,`Arial`),subscript:!1,superscript:!1}),[ee,te]=(0,t.useState)(d),[V,ne]=(0,t.useState)(f),[re,ie]=(0,t.useState)(d.toString()),[ae,oe]=(0,t.useState)(f.toString()),[H,U]=(0,t.useState)(m.toString()),[se,ce]=(0,t.useState)(h.toString()),[le,ue]=(0,t.useState)(null),[de,fe]=(0,t.useState)(!1),[pe,W]=(0,t.useState)(!1),[me,he]=(0,t.useState)(`https://`),[ge,_e]=(0,t.useState)(null),[ve,ye]=(0,t.useState)({top:0,left:0}),[be,xe]=(0,t.useState)({r:0,c:0}),[G,Se]=(0,t.useState)(null),[Ce,we]=(0,t.useState)(null),[Te,Ee]=(0,t.useState)(100),[K,De]=(0,t.useState)(!1),[Oe,ke]=(0,t.useState)(E),[Ae,je]=(0,t.useState)(0),[Me,Ne]=(0,t.useState)(0),[Pe,Fe]=(0,t.useState)(!1),[q,Ie]=(0,t.useState)(``),[Le,Re]=(0,t.useState)(``),[ze,Be]=(0,t.useState)(`find`),[Ve,He]=(0,t.useState)(!1),[Ue,We]=(0,t.useState)({message:``,type:null}),[Ge,Ke]=(0,t.useState)([]),qe=(0,t.useCallback)(()=>{if(!q||!_.current){Ke([]);return}let e=_.current,t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n=[],r=Ve?q:q.toLowerCase(),i=t.nextNode();for(;i;){let e=i.textContent||``,a=Ve?e:e.toLowerCase(),o=a.indexOf(r);for(;o!==-1;){let t=Math.max(0,o-20),s=Math.min(e.length,o+q.length+20),c=e.substring(t,s);n.push({text:e.substring(o,o+q.length),context:c,node:i,start:o,end:o+q.length,fullContent:e}),o=a.indexOf(r,o+q.length)}i=t.nextNode()}return Ke(n),n},[q,Ve]);(0,t.useEffect)(()=>{We({message:``,type:null});let e=setTimeout(()=>{ze===`find`&&qe()},300);return()=>clearTimeout(e)},[q,qe,ze]);let[Je]=(0,t.useState)(E),Ye=e=>e*25.4/96,Xe=t.default.useCallback(()=>{if(!_.current)return;let e=_.current,t=!1;return Array.from(e.childNodes).forEach(n=>{let r=n.nodeType===3,i=n.nodeType===1&&n.tagName===`BR`;if(r&&n.textContent?.trim()||i){let r=document.createElement(`p`);e.insertBefore(r,n),r.appendChild(n),t=!0}}),t},[]),Ze=t.default.useCallback(()=>{let e=window.getSelection();e&&e.rangeCount>0&&(w.current=e.getRangeAt(0).cloneRange())},[]),Qe=t.default.useCallback(()=>{if(!_.current)return;let e=window.getSelection();if(!e||e.rangeCount===0)return;let t=e.getRangeAt(0),n=t.startContainer,r=t.startOffset,i=!1,a=document.createTreeWalker(_.current,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),o=a.nextNode(),s=!0;for(;o;){if(o.nodeType===1){let e=o.tagName;if([`P`,`LI`,`H1`,`H2`,`H3`,`BLOCKQUOTE`,`DIV`].includes(e))s=!0;else if(e===`A`){s=!1;let e=a.nextNode();for(;e&&o.contains(e);)e=a.nextNode();o=e;continue}}else if(o.nodeType===3){let e=o.textContent||``;if(e.length>0){let t=``,n=s;for(let r=0;r<e.length;r++){let a=e[r];/\s/.test(a)||a===`\xA0`?t+=a:n&&/[a-z]/.test(a)?(t+=a.toUpperCase(),n=!1,i=!0):(t+=a,a.trim().length>0&&(n=!1,/[.!?]/.test(a)&&(n=!0)))}o.textContent!==t&&(o.textContent=t),s=n}}o=a.nextNode()}if(i)try{let t=document.createRange();t.setStart(n,r),t.collapse(!0),e.removeAllRanges(),e.addRange(t)}catch{}},[]),$e=t.default.useCallback(()=>{if(!_.current)return;let e=(_.current.innerText||_.current.textContent||``).replace(/\u200B/g,``);Ne(e.length),je(e.trim().split(/\s+/).filter(e=>e.length>0).length)},[]);(0,t.useEffect)(()=>{$e()},[$e]);let J=t.default.useCallback(()=>{if(!_.current||K)return;let e=_.current.innerHTML;e!==D.current&&(D.current=e,i?.(e),$e())},[i,K,$e]),Y=t.default.useCallback(()=>{if(!document.queryCommandState||!_.current)return;let e=document.queryCommandState(`subscript`),t=document.queryCommandState(`superscript`),n=window.getSelection();if(n&&n.rangeCount>0){let r=n.anchorNode,i=r?.nodeType===3?r.parentElement:r;i&&_.current.contains(i)&&(i.closest(`sub`)&&(e=!0),i.closest(`sup`)&&(t=!0))}if(B({bold:document.queryCommandState(`bold`),italic:document.queryCommandState(`italic`),underline:document.queryCommandState(`underline`),strikeThrough:document.queryCommandState(`strikeThrough`),insertUnorderedList:document.queryCommandState(`insertUnorderedList`),insertOrderedList:document.queryCommandState(`insertOrderedList`),justifyLeft:document.queryCommandState(`justifyLeft`),justifyCenter:document.queryCommandState(`justifyCenter`),justifyRight:document.queryCommandState(`justifyRight`),justifyFull:document.queryCommandState(`justifyFull`),fontSize:document.queryCommandValue(`fontSize`)||`3`,fontName:document.queryCommandValue(`fontName`).replace(/"/g,``)||`Arial`,subscript:e,superscript:t,foreColor:document.queryCommandValue(`foreColor`)||`#000000`,hiliteColor:document.queryCommandValue(`hiliteColor`)||`transparent`}),n&&n.rangeCount>0){let e=n.anchorNode,t=e?.nodeType===3?e.parentElement:e;if(t&&_.current.contains(t)){let e=t.closest(`ul,ol,p,div,h1,h2,h3,h4,h5,h6`);if(e&&_.current.contains(e)){let t=window.getComputedStyle(e),n=t.marginLeft,r=t.marginRight,i=t.marginTop,a=t.marginBottom,o=e=>e.endsWith(`mm`)?parseFloat(e):e.endsWith(`px`)?Ye(parseFloat(e)):0,s=e=>e.endsWith(`pt`)?parseFloat(e):e.endsWith(`px`)?Math.round(parseFloat(e)*.75):0,c=o(n),l=o(r);te(c),ne(l),document.activeElement?.getAttribute(`data-field`)!==`indentLeft`&&ie(Math.round(c).toString()),document.activeElement?.getAttribute(`data-field`)!==`indentRight`&&oe(Math.round(l).toString());let u=s(i),d=s(a);document.activeElement?.getAttribute(`data-field`)!==`spacingBefore`&&U(u.toString()),document.activeElement?.getAttribute(`data-field`)!==`spacingAfter`&&ce(d.toString())}Se(t.closest(`td,th`))}else Se(null)}},[]);(0,t.useEffect)(()=>{_.current&&(_.current.innerHTML=Je,D.current=Je),document.execCommand(`defaultParagraphSeparator`,!1,`p`)},[Je]),(0,t.useEffect)(()=>{!K&&_.current&&(_.current.innerHTML=D.current)},[K]);let[et,tt]=(0,t.useState)(!1),[nt,rt]=(0,t.useState)(null);(0,t.useEffect)(()=>{let e=e=>{let t=e.target.closest(`td, th`);t&&_.current?.contains(t)?(tt(!0),rt(t),e.shiftKey||(_.current.querySelectorAll(`td[data-selected], th[data-selected]`).forEach(e=>e.removeAttribute(`data-selected`)),t.setAttribute(`data-selected`,`true`))):(tt(!1),rt(null))},t=e=>{if(!et||!nt||!_.current)return;let t=e.target.closest(`td, th`);if(!t||!_.current.contains(t))return;let n=nt.closest(`table`);if(!n||n!==t.closest(`table`))return;let r=n.tBodies[0],i=(()=>{let e=[];return Array.from(r.rows).forEach((t,n)=>{e[n]||(e[n]=[]);let r=0;Array.from(t.cells).forEach(t=>{for(;e[n][r];)r++;let i=t.rowSpan||1,a=t.colSpan||1;for(let o=0;o<i;o++)for(let i=0;i<a;i++)e[n+o]||(e[n+o]=[]),e[n+o][r+i]=t;r+=a})}),e})(),a=-1,o=-1,s=-1,c=-1;if(i.forEach((e,n)=>{e.forEach((e,r)=>{e===nt&&(a=n,o=r),e===t&&(s=n,c=r)})}),a!==-1&&s!==-1){let e=Math.min(a,s),t=Math.max(a,s),r=Math.min(o,c),l=Math.max(o,c);n.querySelectorAll(`td, th`).forEach(e=>e.removeAttribute(`data-selected`));for(let n=e;n<=t;n++)for(let e=r;e<=l;e++)i[n]?.[e]?.setAttribute(`data-selected`,`true`)}},n=()=>{tt(!1),rt(null)};return document.addEventListener(`mousedown`,e),document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)}},[et,nt]),(0,t.useEffect)(()=>{let e=()=>{setTimeout(()=>{Y();let e=window.getSelection();if(e&&e.rangeCount>0&&_.current?.contains(e.anchorNode)&&(w.current=e.getRangeAt(0).cloneRange(),!et)){let t=_.current;if(t)if(t.querySelectorAll(`td[data-selected], th[data-selected]`).forEach(e=>e.removeAttribute(`data-selected`)),!e.getRangeAt(0).collapsed)t.querySelectorAll(`table`).forEach(t=>{t.querySelectorAll(`td, th`).forEach(t=>{e.containsNode(t,!0)&&t.setAttribute(`data-selected`,`true`)})});else{let n=e.anchorNode,r=(n?.nodeType===3?n.parentElement:n)?.closest(`td, th`);r&&t.contains(r)&&r.setAttribute(`data-selected`,`true`)}}},10)};return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[et,Y]),(0,t.useEffect)(()=>{let e=e=>{T.current&&!T.current.contains(e.target)&&(fe(!1),xe({r:0,c:0}))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let it=t.default.useCallback((e,t)=>{let n=window.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;if((!r||!_.current?.contains(r.commonAncestorContainer))&&(r=w.current),!r)return;let i=r.startContainer,a=(i.nodeType===3?i.parentNode:i).closest(`ul,ol,p,div,h1,h2,h3,h4,h5,h6`);a&&_.current?.contains(a)&&(a.style[e===`left`?`marginLeft`:`marginRight`]=`${t}mm`,J())},[J]),at=t.default.useCallback((e,t)=>{let n=window.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;if((!r||!_.current?.contains(r.commonAncestorContainer))&&(r=w.current),!r)return;let i=r.startContainer,a=(i.nodeType===3?i.parentNode:i).closest(`ul,ol,p,div,h1,h2,h3,h4,h5,h6`);a&&_.current?.contains(a)&&(a.style[e===`before`?`marginTop`:`marginBottom`]=`${t}pt`,J())},[J]);(0,t.useEffect)(()=>{let e=e=>{if(!le||!v.current)return;let t=v.current.getBoundingClientRect(),n=210/t.width,r=(e.clientX-t.left)*n;if(le===`left`){let e=Math.max(-20,Math.min(r-20,170-V-5));te(e),it(`left`,e)}else{let e=Math.max(-20,Math.min(210-r-20,170-ee-5));ne(e),it(`right`,e)}},t=()=>ue(null);return le?(document.body.style.cursor=`ew-resize`,window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t)):document.body.style.cursor=`default`,()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[le,ee,V,it]);let ot=(e,t=null)=>{if(_.current){if(e===`removeFormat`){let e=window.getSelection(),t=null;if(e&&e.rangeCount>0){let n=e.getRangeAt(0);t=n.cloneRange();let r=n.commonAncestorContainer,i=r.nodeType===3?r.parentElement:r;if(i&&_.current.contains(i)){let e=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),t=e.currentNode;for(;t;){if(n.intersectsNode(t)){let e=t;e.style.backgroundColor=``,e.style.background=``,e.getAttribute(`style`)||e.removeAttribute(`style`)}t=e.nextNode()}}}document.execCommand(`removeFormat`,!1,``),document.execCommand(`foreColor`,!1,`#000000`),t&&(e?.removeAllRanges(),e?.addRange(t))}else if(e===`createLink`){let e=t;if(e){_.current.focus();let t=window.getSelection();if(t&&w.current){if(t.removeAllRanges(),t.addRange(w.current),w.current.collapsed)document.execCommand(`insertHTML`,!1,`<a href="${e}">${e}</a>`);else{let t=document.createElement(`div`);t.appendChild(w.current.cloneContents());let n=t.innerHTML;document.execCommand(`insertHTML`,!1,`<a href="${e}">${n}</a>`)}w.current=null}else document.execCommand(`insertHTML`,!1,`<a href="${e}">${e}</a>`)}}else if(e===`blockquote`){let e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).commonAncestorContainer;(t.nodeType===3?t.parentElement:t)?.closest(`blockquote`)?document.execCommand(`formatBlock`,!1,`p`):document.execCommand(`formatBlock`,!1,`blockquote`)}}else if(e===`fontSize`||e===`fontName`){document.execCommand(e,!1,t??``);let n=window.getSelection();if(n&&n.rangeCount>0){let r=n.getRangeAt(0),i=r.commonAncestorContainer,a=i.nodeType===3?i.parentNode:i;if(a&&_.current.contains(a)){let n=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT),i={1:`8pt`,2:`10pt`,3:`12pt`,4:`14pt`,5:`18pt`,6:`24pt`,7:`36pt`},o=n.currentNode;for(;o;){if(o.nodeName===`LI`&&r.intersectsNode(o)){let n=o;e===`fontSize`&&t&&i[t]?n.style.fontSize=i[t]:e===`fontName`&&t&&(n.style.fontFamily=t)}o=n.nextNode()}}}}else{let n=e;if(e===`backColor`&&(!t||t!==`transparent`)&&(n=`hiliteColor`),_.current){_.current.focus();let e=window.getSelection();if(e&&w.current)try{e.removeAllRanges(),e.addRange(w.current)}catch(e){console.warn(`Failed to restore range`,e)}}if(n===`subscript`||n===`superscript`){let e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer,r=t.nodeType===3?t.parentElement:t,i=n===`subscript`?`SUB`:`SUP`,a=r?.closest(i);if(a&&_.current?.contains(a)){let e=a.parentNode;if(e){let t=document.createDocumentFragment();for(;a.firstChild;)t.appendChild(a.firstChild);e.replaceChild(t,a),Y(),J();return}}}}document.execCommand(n,!1,t??``)}Y(),J()}},st=async()=>{try{let e=await navigator.clipboard.read();for(let t of e)if(t.types.includes(`text/html`)){let e=await(await t.getType(`text/html`)).text();document.execCommand(`insertHTML`,!1,e);return}else if(t.types.includes(`text/plain`)){let e=await(await t.getType(`text/plain`)).text();document.execCommand(`insertText`,!1,e);return}}catch{try{let e=await navigator.clipboard.readText();document.execCommand(`insertText`,!1,e)}catch{document.execCommand(`paste`)}}_.current?.focus(),Y(),J()},ct=e=>{if(!_.current)return;if(w.current){let t=w.current.commonAncestorContainer,n=(t.nodeType===3?t.parentNode:t)?.closest?.(`p,div,li,h1,h2,h3,h4,h5,h6`);n&&_.current.contains(n)?n.style.lineHeight=e:_.current.style.lineHeight=e}let t=window.getSelection();t&&(t.removeAllRanges(),w.current&&t.addRange(w.current)),_.current.focus(),J()},lt=e=>{if(!_.current)return;let t=window.getSelection();if(t&&t.rangeCount>0){let n=t.getRangeAt(0).commonAncestorContainer,r=(n.nodeType===3?n.parentElement:n)?.closest(`ol, ul`);r&&_.current.contains(r)&&(r.style.listStyleType=e)}_.current.focus(),J()},X=(e,t)=>{if(!e||!t)return;let n=!!G,r=`<table border="1" style="border-collapse:collapse;width:100%;${n?`margin:0`:`margin:10px 0`}"><tbody>`;for(let n=0;n<e;n++){r+=`<tr>`;for(let e=0;e<t;e++)r+=`<td style="border:1px solid black;padding:8px;min-width:50px;resize:both;overflow:hidden;">​</td>`;r+=`</tr>`}r+=`</tbody></table>${n?``:`<p>​</p>`}`,_.current?.focus();let i=window.getSelection();if(i&&(i.removeAllRanges(),w.current&&i.addRange(w.current)),n&&G&&(G.textContent||``).replace(/\u200B/g,``).trim()===``&&G.children.length===0){let e=document.createRange();e.selectNodeContents(G),i?.removeAllRanges(),i?.addRange(e)}document.execCommand(`insertHTML`,!1,r),fe(!1),xe({r:0,c:0}),J()},ut=e=>{let t=window.getSelection();if(!t)return;let n=document.createRange();n.setStart(e.node,e.start),n.setEnd(e.node,e.end),t.removeAllRanges(),t.addRange(n);let r=e.node.parentElement;r&&r.scrollIntoView({behavior:`smooth`,block:`center`}),_.current?.focus()},dt=()=>{if(!q||!_.current)return;let e=qe();if(!e||e.length===0){We({message:`No matches found for "${q}"`,type:`error`});return}let t=_.current,n=window.getSelection();if(!n)return;let r=t,i=0;if(n.rangeCount>0){let e=n.getRangeAt(0);r=e.endContainer,i=e.endOffset}let a=(e,t,n,r,i)=>{let a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),o=!1,s=a.nextNode();for(;s;){if(o||(s===r||r.contains(s)&&s!==e)&&(o=!0),o){let e=s.textContent||``,a=n?t:t.toLowerCase(),o=(n?e:e.toLowerCase()).indexOf(a,s===r?i:0);if(o!==-1)return{node:s,start:o,end:o+t.length}}s=a.nextNode()}return null},o=a(t,q,Ve,r,i)||a(t,q,Ve,t,0);if(o){let e=document.createRange();e.setStart(o.node,o.start),e.setEnd(o.node,o.end),n.removeAllRanges(),n.addRange(e);let t=o.node.parentElement;t&&t.scrollIntoView({behavior:`smooth`,block:`center`})}},ft=(e=!1)=>{if(!(!q||!_.current))if(e){let e=document.createTreeWalker(_.current,NodeFilter.SHOW_TEXT,null),t=0,n=[],r=Ve?q:q.toLowerCase(),i=e.nextNode();for(;i;){let t=i.textContent||``,a=Ve?t:t.toLowerCase(),o=a.indexOf(r);for(;o!==-1;)n.push({node:i,start:o,end:o+q.length}),o=a.indexOf(r,o+q.length);i=e.nextNode()}for(let e=n.length-1;e>=0;e--){let r=n[e],i=r.node.textContent||``;r.node.textContent=i.substring(0,r.start)+Le+i.substring(r.end),t++}t>0?(J(),We({message:`Successfully replaced ${t} occurrences.`,type:`success`})):We({message:`No matches found to replace.`,type:`error`})}else{let e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).toString();(Ve?t===q:t.toLowerCase()===q.toLowerCase())&&document.execCommand(`insertHTML`,!1,Le),dt()}else dt()}},pt=e=>{let t=e.target.files?.[0];if(t){let e=new FileReader;e.onload=e=>{let t=e.target?.result;if(_.current&&t){_.current.focus();let e=window.getSelection();e&&(e.removeAllRanges(),w.current&&e.addRange(w.current)),document.execCommand(`insertImage`,!1,t),Y(),J()}},e.readAsDataURL(t)}e.target.value=``},mt=async e=>{let t=e.target.files?.[0];if(t){We({message:`Importing document...`,type:`info`});try{let e=await t.arrayBuffer(),n=(await yc.convertToHtml({arrayBuffer:e})).value;_.current&&(_.current.innerHTML=n,J(),We({message:`Document imported successfully.`,type:`success`}))}catch(e){console.error(e),We({message:`Failed to import document.`,type:`error`})}e.target.value=``}},ht=()=>{let e=window.getSelection();if(!e||e.rangeCount===0||!_.current)return;let t=e.getRangeAt(0),n=_.current,r=Array.from(n.querySelectorAll(`.locked-region`));if(r.find(t=>e.containsNode(t,!0))){r.forEach(t=>{if(e.containsNode(t,!0))if(t.tagName===`SPAN`){let e=t.parentNode;for(;t.firstChild;)e?.insertBefore(t.firstChild,t);e?.removeChild(t)}else t.removeAttribute(`contenteditable`),t.classList.remove(`locked-region`)}),J();return}if(t.collapsed){let e=t.commonAncestorContainer;e.nodeType===3&&(e=e.parentElement);let r=e.closest(`p, div, li, h1, h2, h3, h4, h5, h6, blockquote`);r&&n.contains(r)&&(r.setAttribute(`contenteditable`,`false`),r.classList.add(`locked-region`))}else{let e=document.createElement(`span`);e.setAttribute(`contenteditable`,`false`),e.className=`locked-region`,e.title=`Locked Segment`,e.style.userSelect=`all`;try{t.surroundContents(e)}catch{let n=t.extractContents();e.appendChild(n),t.insertNode(e)}}J(),e.removeAllRanges()},gt=(e,t)=>{bc(e,G,t,{onTableDeleted:()=>Se(null),onContentChanged:J,onFocusRequested:()=>_.current?.focus()})},_t=e=>{if(!Ce)return;let t=Ce;switch(e){case`alignLeft`:t.style.display=`inline`,t.style.float=`left`,t.style.margin=`10px 10px 10px 0`;break;case`alignCenter`:t.style.display=`block`,t.style.float=`none`,t.style.margin=`10px auto`;break;case`alignRight`:t.style.display=`inline`,t.style.float=`right`,t.style.margin=`10px 0 10px 10px`;break;case`alignNone`:t.style.display=`inline`,t.style.float=`none`,t.style.margin=`10px 0`;break;case`delete`:t.remove(),we(null);break}_.current?.focus(),J()},vt=()=>{if(!_.current)return;let e=_.current.innerHTML,t=document.createElement(`iframe`);t.style.position=`fixed`,t.style.right=`0`,t.style.bottom=`0`,t.style.width=`0`,t.style.height=`0`,t.style.border=`none`,document.body.appendChild(t);let n=t.contentWindow?.document;if(!n){document.body.removeChild(t);return}n.open(),n.write(`<html><head><style>@page { size: A4 portrait; margin: 20mm; } body { font-family: Arial, sans-serif; font-size: 14px; background: white; color: black; margin: 0; padding: 0; word-break: break-word; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } .page-break-element { page-break-before: always; break-before: page; margin: 0; padding: 0; height: 0; border: none; } ul { list-style-type: disc; padding-left: 20px; margin: 1em 0; } ol { list-style-type: decimal; padding-left: 20px; margin: 1em 0; } li { display: list-item; } table { border-collapse: collapse; width: 100%; border: 1px solid #000; margin: 15px 0; table-layout: auto; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } td, th { border: 1px solid #000; padding: 8px; position: relative; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } img { max-width: 100%; height: auto; margin: 10px 0; border-radius: 2px; } p { margin: 0; min-height: 1.4em; }</style></head><body>${e}</body></html>`),n.close(),t.contentWindow?.focus(),setTimeout(()=>{t.contentWindow?.print(),setTimeout(()=>{t&&t.parentNode&&t.parentNode.removeChild(t)},500)},250)},yt=()=>{let e=_.current?.innerHTML||Oe;a?.(e)},bt=()=>{let e=`
|
|
223
223
|
<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns='http://www.w3.org/TR/REC-html40'>
|
|
224
224
|
<head><meta charset='utf-8'><title>Export DOC</title>
|
|
225
225
|
<style>
|