react-text-forge 1.2.8 → 1.2.9
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/dist/react-text-forge.js +3290 -2255
- package/dist/react-text-forge.umd.cjs +161 -248
- package/dist/src/components/utils/CustomEditor.d.ts +477 -0
- package/dist/{components → src/components}/utils/dropdown/BlockTypeDropdown.d.ts +1 -1
- package/dist/{components → src/components}/utils/dropdown/LanguageDropdown.d.ts +1 -1
- package/dist/{components → src/components}/utils/dropdown/TableDropdown.d.ts +1 -1
- package/dist/{components → src/components}/utils/form/ImageForm.d.ts +1 -1
- package/dist/src/index.d.ts +5 -0
- package/package.json +10 -5
- package/dist/components/decorators/withHightlight.d.ts +0 -1
- package/dist/components/utils/CustomEditor.d.ts +0 -241
- package/dist/components/utils/form/HistoryForm.d.ts +0 -6
- package/dist/index.d.ts +0 -5
- package/dist/main.d.ts +0 -2
- package/dist/react-text-forge.js.map +0 -1
- package/dist/react-text-forge.umd.cjs.map +0 -1
- /package/dist/{components → src/components}/FormatButton.d.ts +0 -0
- /package/dist/{components → src/components}/ReactTextForge.d.ts +0 -0
- /package/dist/{components → src/components}/ReactTextForgeContext.d.ts +0 -0
- /package/dist/{components → src/components}/ThemeToggleButton.d.ts +0 -0
- /package/dist/{components → src/components}/Toolbar.d.ts +0 -0
- /package/dist/{components → src/components}/contexts/FullscreenContext.d.ts +0 -0
- /package/dist/{components → src/components}/contexts/ThemeContext.d.ts +0 -0
- /package/dist/{components → src/components}/functions/deserialize.d.ts +0 -0
- /package/dist/{components → src/components}/functions/deserializeDocx.d.ts +0 -0
- /package/dist/{components → src/components}/functions/serialize.d.ts +0 -0
- /package/dist/{components → src/components}/useToolbar.d.ts +0 -0
- /package/dist/{components → src/components}/utils/FullscreenButton.d.ts +0 -0
- /package/dist/{components → src/components}/utils/FullscreenWrapper.d.ts +0 -0
- /package/dist/{components → src/components}/utils/Images.d.ts +0 -0
- /package/dist/{components → src/components}/utils/Leaf.d.ts +0 -0
- /package/dist/{components → src/components}/utils/Tooltip.d.ts +0 -0
- /package/dist/{components → src/components}/utils/color.d.ts +0 -0
- /package/dist/{components → src/components}/utils/dropdown/BlockListDropdown.d.ts +0 -0
- /package/dist/{components → src/components}/utils/dropdown/BlockquoteButton.d.ts +0 -0
- /package/dist/{components → src/components}/utils/dropdown/ContainerDropdown.d.ts +0 -0
- /package/dist/{components → src/components}/utils/dropdown/FontFamilyDropdown.d.ts +0 -0
- /package/dist/{components → src/components}/utils/dropdown/FontSizeDropdown.d.ts +0 -0
- /package/dist/{components → src/components}/utils/elements/BlockquoteElement.d.ts +0 -0
- /package/dist/{components → src/components}/utils/elements/CodeElement.d.ts +0 -0
- /package/dist/{components → src/components}/utils/elements/DefaultElement.d.ts +0 -0
- /package/dist/{components → src/components}/utils/elements/ListElement.d.ts +0 -0
- /package/dist/{components → src/components}/utils/elements/TableElement.d.ts +0 -0
- /package/dist/{components → src/components}/utils/form/BulletTypeSelector.d.ts +0 -0
- /package/dist/{components → src/components}/utils/form/ColorPickerPopup.d.ts +0 -0
- /package/dist/{components → src/components}/utils/form/LinkForm.d.ts +0 -0
- /package/dist/{components → src/components}/utils/form/NumeredTypeSelector.d.ts +0 -0
- /package/dist/{components → src/components}/utils/form/TableForm.d.ts +0 -0
|
@@ -1,248 +1,161 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
* You should have received a copy of the MIT License
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
* @license
|
|
163
|
-
* Copyright (c) 2025 Jahylis
|
|
164
|
-
*
|
|
165
|
-
* This file is part of ReactTextForge.
|
|
166
|
-
*
|
|
167
|
-
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
168
|
-
* it under the terms of the MIT License as published by
|
|
169
|
-
* the Open Source Initiative.
|
|
170
|
-
*
|
|
171
|
-
* ReactTextForge is distributed in the hope that it will be useful,
|
|
172
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
173
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
174
|
-
* MIT License for more details.
|
|
175
|
-
*
|
|
176
|
-
* You should have received a copy of the MIT License
|
|
177
|
-
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
178
|
-
*
|
|
179
|
-
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
180
|
-
*/function V({format:t,imageColor:e}){return(()=>{switch(t){case"addColumn":return o.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("g",{id:"Edit / Add_Column",children:o.jsx("path",{id:"Vector",d:"M5 17H8M8 17H11M8 17V14M8 17V20M14 21H15C16.1046 21 17 20.1046 17 19V5C17 3.89543 16.1046 3 15 3H13C11.8954 3 11 3.89543 11 5V11",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"addRow":return o.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("g",{id:"Edit / Add_Row",children:o.jsx("path",{id:"Vector",d:"M3 14V15C3 16.1046 3.89543 17 5 17L19 17C20.1046 17 21 16.1046 21 15L21 13C21 11.8954 20.1046 11 19 11H13M10 8H7M7 8H4M7 8V5M7 8V11",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"bgColor":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M86.6 9.4C74.1-3.1 53.9-3.1 41.4 9.4s-12.5 32.8 0 45.3L122.7 136 30.6 228.1c-37.5 37.5-37.5 98.3 0 135.8L148.1 481.4c37.5 37.5 98.3 37.5 135.8 0L474.3 290.9c28.1-28.1 28.1-73.7 0-101.8L322.9 37.7c-28.1-28.1-73.7-28.1-101.8 0L168 90.7 86.6 9.4zM168 181.3l49.4 49.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L213.3 136l53.1-53.1c3.1-3.1 8.2-3.1 11.3 0L429.1 234.3c3.1 3.1 3.1 8.2 0 11.3L386.7 288 67.5 288c1.4-5.4 4.2-10.4 8.4-14.6L168 181.3z"})});case"blockCode":return o.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none",children:o.jsx("path",{fill:e,fillRule:"evenodd",d:"M2 6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V6zm5 1a1 1 0 0 0 0 2h5a1 1 0 1 0 0-2H7zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2zm-8 4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2H7zm4 0a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6zm-4 4a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2H7zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2z",clipRule:"evenodd"})});case"blockquote":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:o.jsx("path",{fill:e,d:"M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"})});case"bold":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:o.jsx("path",{fill:e,d:"M0 64C0 46.3 14.3 32 32 32l48 0 16 0 128 0c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128L96 480l-16 0-48 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-160L48 96 32 96C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64L112 96l0 128 112 0zM112 288l0 128 144 0c35.3 0 64-28.7 64-64s-28.7-64-64-64l-32 0-112 0z"})});case"bulletList":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"})});case"center":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:o.jsx("path",{fill:e,d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"})});case"color":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M512 256c0 .9 0 1.8 0 2.7c-.4 36.5-33.6 61.3-70.1 61.3L344 320c-26.5 0-48 21.5-48 48c0 3.4 .4 6.7 1 9.9c2.1 10.2 6.5 20 10.8 29.9c6.1 13.8 12.1 27.5 12.1 42c0 31.8-21.6 60.7-53.4 62c-3.5 .1-7 .2-10.6 .2C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM128 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm0-96a32 32 0 1 0 0-64 32 32 0 1 0 0 64zM288 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm96 96a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"})});case"deleteColumn":return o.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("g",{id:"Edit / Delete_Column",children:o.jsx("path",{id:"Vector",d:"M10 21H9C7.89543 21 7 20.1046 7 19V5C7 3.89543 7.89543 3 9 3H11C12.1046 3 13 3.89543 13 5V11M19 16H13",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"deleteRow":return o.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("g",{id:"Edit / Delete_Row",children:o.jsx("path",{id:"Vector",d:"M14 16H20M21 10V9C21 7.89543 20.1046 7 19 7H5C3.89543 7 3 7.89543 3 9V11C3 12.1046 3.89543 13 5 13H11",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"deleteTable":return o.jsx("svg",{className:"rtf",fill:e,width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("path",{d:"M1800 1740c0 33-26.88 60-60 60H180c-33.12 0-60-27-60-60V180c0-33.12 26.88-60 60-60h1560c33.12 0 60 26.88 60 60v1560ZM1740 0H180C80.76 0 0 80.76 0 180v1560c0 99.24 80.76 180 180 180h1560c99.24 0 180-80.76 180-180V180c0-99.24-80.76-180-180-180Zm-235.08 245.388L960 790.308l-544.92-544.92-169.68 169.68 544.92 544.92-544.92 544.92 169.68 169.68L960 1129.668l544.92 544.92 169.68-169.68-544.92-544.92 544.92-544.92-169.68-169.68Z",fillRule:"evenodd"})});case"enter":return o.jsx("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:o.jsx("path",{stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M20 7V8.2C20 9.88016 20 10.7202 19.673 11.362C19.3854 11.9265 18.9265 12.3854 18.362 12.673C17.7202 13 16.8802 13 15.2 13H4M4 13L8 9M4 13L8 17"})});case"fullscreen":return o.jsxs("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("path",{fill:e,d:"M4 2C2.89543 2 2 2.89543 2 4V8C2 8.55228 2.44772 9 3 9C3.55228 9 4 8.55228 4 8V4H8C8.55228 4 9 3.55228 9 3C9 2.44772 8.55228 2 8 2H4Z"}),o.jsx("path",{fill:e,d:"M20 2C21.1046 2 22 2.89543 22 4V8C22 8.55228 21.5523 9 21 9C20.4477 9 20 8.55228 20 8V4H16C15.4477 4 15 3.55228 15 3C15 2.44772 15.4477 2 16 2H20Z"}),o.jsx("path",{fill:e,d:"M20 22C21.1046 22 22 21.1046 22 20V16C22 15.4477 21.5523 15 21 15C20.4477 15 20 15.4477 20 16V20H16C15.4477 20 15 20.4477 15 21C15 21.5523 15.4477 22 16 22H20Z"}),o.jsx("path",{fill:e,d:"M2 20C2 21.1046 2.89543 22 4 22H8C8.55228 22 9 21.5523 9 21C9 20.4477 8.55228 20 8 20H4V16C4 15.4477 3.55228 15 3 15C2.44772 15 2 15.4477 2 16V20Z"})]});case"fullscreenExit":return o.jsxs("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("path",{fill:e,d:"M7 9C8.10457 9 9 8.10457 9 7V3C9 2.44772 8.55228 2 8 2C7.44772 2 7 2.44772 7 3V7H3C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9H7Z"}),o.jsx("path",{fill:e,d:"M17 9C15.8954 9 15 8.10457 15 7V3C15 2.44772 15.4477 2 16 2C16.5523 2 17 2.44772 17 3V7H21C21.5523 7 22 7.44772 22 8C22 8.55228 21.5523 9 21 9H17Z"}),o.jsx("path",{fill:e,d:"M17 15C15.8954 15 15 15.8954 15 17V21C15 21.5523 15.4477 22 16 22C16.5523 22 17 21.5523 17 21V17H21C21.5523 17 22 16.5523 22 16C22 15.4477 21.5523 15 21 15H17Z"}),o.jsx("path",{fill:e,d:"M9 17C9 15.8954 8.10457 15 7 15H3C2.44772 15 2 15.4477 2 16C2 16.5523 2.44772 17 3 17H7V21C7 21.5523 7.44772 22 8 22C8.55228 22 9 21.5523 9 21V17Z"})]});case"fontFamily":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:o.jsx("path",{fill:e,d:"M254 52.8C249.3 40.3 237.3 32 224 32s-25.3 8.3-30 20.8L57.8 416 32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-1.8 0 18-48 159.6 0 18 48-1.8 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-25.8 0L254 52.8zM279.8 304l-111.6 0L224 155.1 279.8 304z"})});case"href":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:o.jsx("path",{fill:e,d:"M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"})});case"image":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"})});case"indent":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:o.jsx("path",{fill:e,d:"M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3L0 176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"})});case"italic":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:o.jsx("path",{fill:e,d:"M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0L160 416l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0L224 96l-64 0c-17.7 0-32-14.3-32-32z"})});case"left":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:o.jsx("path",{fill:e,d:"M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"})});case"more":return o.jsx("svg",{className:"rtf",viewBox:"0 0 20 20",fill:"none",children:o.jsx("path",{fill:e,fillRule:"evenodd",d:"M12 3a2 2 0 10-4 0 2 2 0 004 0zm-2 5a2 2 0 110 4 2 2 0 010-4zm0 7a2 2 0 110 4 2 2 0 010-4z"})});case"numberedList":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"})});case"outdent":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:o.jsx("path",{fill:e,d:"M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM.2 268.6c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6l0 158.6c0 13.3-15.3 20.8-25.8 12.6L.2 268.6z"})});case"redo":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"})});case"right":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:o.jsx("path",{fill:e,d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"})});case"size":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:o.jsx("path",{fill:e,d:"M64 128l0-32 64 0 0 320-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320 64 0 0 32c0 17.7 14.3 32 32 32s32-14.3 32-32l0-48c0-26.5-21.5-48-48-48L160 32 48 32C21.5 32 0 53.5 0 80l0 48c0 17.7 14.3 32 32 32s32-14.3 32-32zM502.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l32 0 0 192-32 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8l-32 0 0-192 32 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-64-64z"})});case"strikethrough":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"})});case"subscript":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64zM480 320c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 361.5 404.3 368 416 368l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128z"})});case"superscript":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M480 32c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 73.5 404.3 80 416 80l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128zM32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64z"})});case"table":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M64 256l0-96 160 0 0 96L64 256zm0 64l160 0 0 96L64 416l0-96zm224 96l0-96 160 0 0 96-160 0zM448 256l-160 0 0-96 160 0 0 96zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"})});case"underline":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:o.jsx("path",{fill:e,d:"M16 64c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 53 43 96 96 96s96-43 96-96l0-128-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 88.4-71.6 160-160 160s-160-71.6-160-160L64 96 48 96C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32z"})});case"undo":return o.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:o.jsx("path",{fill:e,d:"M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"})});default:return null}})()}const Et=({format:t,isActive:e,onMouseDown:r})=>{const{backgroundColor:n,editor:s,imageColor:l}=q(),[c,a]=C.useState(!1),p={backgroundColor:n,color:l},j=h=>{k.toggleBlock(s,t==="bulletList"?"bullet-list":"numbered-list",h),a(!1)};return o.jsxs(o.Fragment,{children:[o.jsxs("button",{className:"rtf tool",children:[o.jsx("div",{onMouseDown:h=>{h.preventDefault(),r(t)},children:o.jsx(V,{format:t,imageColor:l})}),e&&o.jsx("div",{className:"rtf tool tool--arrow",style:{color:p.color},onClick:()=>a(!c),children:c?"↑":"↓"})]}),c&&(t==="bulletList"?o.jsx(jt,{selectStyle:p,onChange:j,toggleForm:a}):o.jsx(Ft,{selectStyle:p,onChange:j,toggleForm:a}))]})};function _e({disabled:t=!1,elements:e,elementSelected:r,format:n,isOpen:s,setIsOpen:l,onClick:c}){const{backgroundColor:a,imageColor:p}=q(),j=()=>{l(!s)},h=w=>{c(w),l(!1)};return o.jsxs("div",{className:"rtf dropdown tool",children:[o.jsx("button",{onClick:j,className:"rtf dropdown-toggle",disabled:t,children:o.jsx(V,{format:n,imageColor:p})}),s&&o.jsx("ul",{style:{backgroundColor:a,color:p},className:"rtf dropdown-menu",onMouseLeave:j,children:e.map((w,g)=>o.jsx("li",{style:{backgroundColor:`${r&&w===r?`color-mix(in srgb, ${a} 80%, ${R(a)?"white":"black"})`:a}`},onClick:()=>h(w),children:w},g))})]})}const Tt=({disabled:t,sizeSelected:e,onSelectSize:r})=>{const[n,s]=C.useState(!1),l=["10px","12px","14px","16px","18px","20px","24px","28px","36px"];return o.jsx(_e,{disabled:t,elements:l,elementSelected:e,format:"size",isOpen:n,setIsOpen:s,onClick:r})},St=({fontFamilySelected:t,onSelectFontFamily:e})=>{const[r,n]=C.useState(!1),s=["Arial","Arial Black","Bookman","Comic Sans MS","Courier","Courier New","Garamond","Georgia","Helvetica","Impact","Palatino","Times","Times New Roman","Trebuchet MS","Verdana"];return o.jsx(_e,{elements:s,elementSelected:t,format:"fontFamily",isOpen:r,setIsOpen:n,onClick:e})},Nt=({onClose:t,initialUrl:e="",isOpenInNewTab:r})=>{const[n,s]=C.useState(""),{editor:l,backgroundColor:c,imageColor:a}=q(),[p,j]=C.useState(!1),[h,w]=C.useState(l.selection),g={backgroundColor:c,color:a},F={color:R(c)?"#FFF":"#000"},_={backgroundColor:`color-mix(in srgb, ${c} 80%, ${R(c)?"white":"black"})`,color:F.color},N={backgroundColor:c!=="#800020"?"#800020":"color-mix(in srgb, #800020 80%, black)",color:F.color},S={backgroundColor:c!=="#6c757d"?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:F.color},L=()=>{n&&(k.updateLink(l,n,p),t())},i=()=>{h&&se.ReactEditor.focus(l)},u=()=>{k.removeLink(l),t()};return C.useEffect(()=>{l.selection&&w(l.selection)},[]),C.useEffect(()=>{s(e),j(r)},[e,r]),o.jsxs("div",{onMouseLeave:t,style:g,className:"rtf link-form",children:[o.jsx("input",{className:"rtf",type:"text",placeholder:"Enter URL",value:n,onBlur:i,onChange:b=>s(b.target.value)}),o.jsxs("label",{className:"rtf",children:[o.jsx("input",{className:"rtf",type:"checkbox",checked:p,onBlur:i,onChange:()=>j(!p)}),"Ouvrir dans un nouvel onglet"]}),o.jsxs("div",{className:"rtf link-form-actions",children:[e?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"rtf",style:_,onClick:L,children:"Modifier"}),o.jsx("button",{className:"rtf",style:N,onClick:u,children:"Supprimer"})]}):o.jsx("button",{className:"rtf",style:_,onClick:L,children:"Valider"}),o.jsx("button",{className:"rtf",style:S,onClick:t,children:"Annuler"})]})]})};/**
|
|
181
|
-
* @license
|
|
182
|
-
* Copyright (c) 2025 Jahylis
|
|
183
|
-
*
|
|
184
|
-
* This file is part of ReactTextForge.
|
|
185
|
-
*
|
|
186
|
-
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
187
|
-
* it under the terms of the MIT License as published by
|
|
188
|
-
* the Open Source Initiative.
|
|
189
|
-
*
|
|
190
|
-
* ReactTextForge is distributed in the hope that it will be useful,
|
|
191
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
192
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
193
|
-
* MIT License for more details.
|
|
194
|
-
*
|
|
195
|
-
* You should have received a copy of the MIT License
|
|
196
|
-
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
197
|
-
*
|
|
198
|
-
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
199
|
-
*/function ve(t){const[e,r]=C.useState(""),[n,s]=C.useState(""),[l,c]=C.useState(!1),[a,p]=C.useState(""),[j,h]=C.useState(""),[w,g]=C.useState("paragraph"),[F,_]=C.useState(!1),[N,S]=C.useState(""),[L,i]=C.useState(!1),u=()=>{i(!L)},b=()=>{_(!F)};return{activeBlock:w,colorMode:n,setColorMode:s,openInNewTab:l,setOpenInNewTab:c,selectedBackgroundColor:j,setSelectedBackgroundColor:h,selectedColor:a,setSelectedColor:p,selectedLanguage:N,setSelectedLanguage:S,selectedLink:e,setSelectedLink:r,showColorPicker:F,showLinkForm:L,setShowLinkForm:i,detectCurrentLanguage:()=>{const{selection:x}=t;if(x){const[T]=d.Editor.nodes(t,{match:A=>A.type==="code"});S(T?T[0].language:null)}},toggleLinkForm:u,toggleColorPicker:b,handleColorChange:x=>{k.applyTextColor(t,x),b()},handleBackgroundColorChange:x=>{k.applyBackgroundTextColor(t,x),b()},handleBlockTypeChange:x=>{k.toggleBlock(t,x),g(x)}}}function At({selectedColor:t,onSelectColor:e,onClose:r}){const[n,s]=C.useState("#ffffff"),{editor:l,backgroundColor:c,borderColor:a,imageColor:p}=q(),j={backgroundColor:c,color:p},h={backgroundColor:`color-mix(in srgb, ${c} 80%, ${R(c)?"white":"black"})`,color:R(c)?"#FFF":"#000"},w={backgroundColor:c!=="#6c757d"?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:R(c)?"#FFF":"#000"},g={default:{picker:{background:c,color:p,border:a}}},F=S=>{se.ReactEditor.focus(l),s(S.hex)},_=()=>{n&&(e(n),r())},N=()=>{e(""),r()};return C.useEffect(()=>{t&&s(t)},[t]),o.jsxs("div",{onMouseLeave:r,className:"rtf color-picker-popup",children:[o.jsx(Ue.SketchPicker,{styles:g,color:n,onChangeComplete:F}),o.jsxs("div",{style:j,className:"rtf link-form-actions",children:[o.jsx("button",{className:"rtf",style:h,onClick:_,disabled:!n,children:"Appliquer"}),o.jsx("button",{className:"rtf",style:w,onClick:N,children:"Annuler"})]})]})}const Lt=()=>{const{editor:t,backgroundColor:e,imageColor:r}=q(),n=k.isBlockquoteActive(t);return o.jsx("button",{onMouseDown:s=>{s.preventDefault(),k.toggleBlockquote(t)},style:{backgroundColor:n?`color-mix(in srgb, ${e} 80%, ${R(e)?"white":"black"})`:""},className:"rtf tool",children:o.jsx(V,{format:"blockquote",imageColor:r})})},Q=({text:t,children:e,position:r="top"})=>{var h;const[n,s]=C.useState(!1),{isDarkTheme:l,backgroundDarkColor:c,imageDarkColor:a}=xe(),p=C.Children.count(e),j=C.Children.map(e,w=>w);return o.jsxs("div",{className:"tooltip-container",style:{display:p===1&&((h=j[0].props.style)==null?void 0:h.display)==="none"?"none":"inline-block"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[e,n&&o.jsx("div",{style:{backgroundColor:l?"black":c,color:a,borderColor:a},className:`tooltip tooltip--${r} tooltip--visible`,role:"tooltip","aria-label":t,children:t})]})},ze=({activeMarks:t,format:e,isActive:r,tooltip:n})=>{const[s,l]=C.useState(""),{backgroundColor:c,editor:a,imageColor:p}=q(),{activeBlock:j,colorMode:h,setColorMode:w,openInNewTab:g,detectCurrentLanguage:F,handleColorChange:_,handleBackgroundColorChange:N,setOpenInNewTab:S,selectedBackgroundColor:L,setSelectedBackgroundColor:i,selectedColor:u,setSelectedColor:b,selectedLink:v,setSelectedLink:y,showColorPicker:E,showLinkForm:f,setShowLinkForm:x,toggleColorPicker:T,toggleLinkForm:A}=ve(a),M=j==="h1"||j==="h2",U=["left","center","right"],Z=D=>{k.applyFontSize(a,D)},X=D=>{k.applyFontFamily(a,D),l(D)},I=()=>{setTimeout(()=>se.ReactEditor.focus(a),0)};return C.useEffect(()=>{F();const{selection:D}=a;if(D){const[O]=d.Editor.nodes(a,{match:Y=>Y.type==="link"});O?(S(O[0].target==="_blank"),y(O[0].href)):(S(!1),y(""))}},[a.selection]),o.jsx(Q,{text:n,position:"bottom",children:e==="indent"||e==="outdent"?o.jsx("div",{children:o.jsx("button",{title:n,className:"rtf tool",onClick:()=>e==="indent"?k.handleIndent(a):k.handleOutdent(a),disabled:!r,children:o.jsx(V,{format:e,imageColor:r?p:`color-mix(in srgb, ${p} 40%, black)`})})}):e==="fontSize"?o.jsx(Tt,{disabled:M,onSelectSize:Z,sizeSelected:r}):e==="fontFamily"?o.jsx(St,{fontFamilySelected:s,onSelectFontFamily:X}):e==="bulletList"||e==="numberedList"?o.jsx("div",{className:"rtf dropdown",children:o.jsx(Et,{format:e,isActive:r,onMouseDown:()=>{e=e==="bulletList"?"bullet-list":"numbered-list",k.toggleBlock(a,e)}})}):e==="href"?o.jsxs("div",{className:"rtf dropdown",children:[o.jsx("button",{onMouseDown:D=>{D.preventDefault(),I(),A()},title:n,className:`rtf tool tool--${r?"active":"inactive"}`,children:o.jsx(V,{format:e,imageColor:p})}),f&&o.jsx(Nt,{onClose:()=>x(!1),initialUrl:v,isOpenInNewTab:g})]}):e==="color"||e==="bgColor"?o.jsxs("div",{className:"rtf dropdown",children:[o.jsx("button",{title:n,onMouseDown:D=>{D.preventDefault(),I(),e==="color"?(b(t[e]),w("color"),T()):(i(t[e]),w("bgColor"),T())},className:`rtf tool tool--${r?"active":"inactive"}`,children:o.jsx(V,{format:e,imageColor:p})}),E&&o.jsx(At,{selectedColor:h==="color"?u:L,onSelectColor:h==="color"?_:N,onClose:T})]}):e==="blockquote"?o.jsx(Lt,{tooltip:n}):o.jsx("button",{onMouseDown:D=>{D.preventDefault(),U.includes(e)?k.toggleAlign(a,e):k.toggleMark(a,e)},title:n,style:{backgroundColor:r?`color-mix(in srgb, ${c} 80%, ${R(c)?"white":"black"})`:""},className:"rtf tool",children:o.jsx(V,{format:e,imageColor:p})})})},$t=C.forwardRef(({tooltip:t},e)=>{const{backgroundColor:r,imageColor:n}=q(),{editor:s}=q(),{activeBlock:l,handleBlockTypeChange:c}=ve(s),a=[{type:"paragraph",name:"Paragraphe"},{type:"h1",name:"Titre"},{type:"h2",name:"Sous-titre"}],p={backgroundColor:r,color:n},j=h=>{const w=h.target.value;c(w)};return o.jsx(Q,{text:t,position:"bottom",children:o.jsx("select",{ref:e,className:"rtf",value:l,onChange:j,style:p,children:a.map(h=>o.jsx("option",{className:"rtf",value:h.type,children:h.name},h.type))})})}),Pe=C.forwardRef((t,e)=>{const[r,n]=C.useState(!1),{backgroundColor:s,editor:l,imageColor:c}=q(),{selectedLanguage:a,setSelectedLanguage:p}=ve(l),j={backgroundColor:s,color:c},h={cs:"C#",cpp:"C++",css:"CSS",diff:"Diff",html:"HTML",java:"Java",javascript:"JavaScript",php:"PHP",python:"Python",ruby:"Ruby",typescript:"TypeScript",xml:"XML"},w=()=>{n(!r)},g=F=>{p(F),k.handleCode(l,F),n(!1)};return o.jsxs("div",{ref:e,className:`rtf dropdown tool ${a&&a!=="init"&&a!==""?"tool--active":""}`,children:[o.jsx("button",{className:"rtf dropdown-toggle",onClick:w,children:o.jsx(V,{format:"blockCode",imageColor:c})}),r&&o.jsxs("ul",{style:j,onMouseLeave:w,className:"rtf dropdown-menu",children:[a&&o.jsx("li",{onClick:()=>g("init"),children:"Réinitialiser"}),Object.keys(h).map(F=>o.jsx("li",{onClick:()=>g(F),style:{cursor:"pointer",padding:"5px 10px",backgroundColor:a&&F===a?`color-mix(in srgb, ${s} 80%, ${R(s)?"white":"black"})`:s},children:h[F]},F))]})]})}),Oe=C.forwardRef((t,e)=>{const{editor:r,imageColor:n}=q();return o.jsxs("div",{className:"rtf tool image-upload-container",ref:e,children:[o.jsx("input",{id:"file-input",type:"file",accept:"image/*",onChange:s=>k.handleFileChange(s,r),className:"rtf hidden-file-input"}),o.jsx("label",{htmlFor:"file-input",className:"rtf image-upload-label",children:o.jsx(V,{format:"image",imageColor:n})})]})}),Mt=({onClose:t})=>{const{editor:e,backgroundColor:r}=q(),[n,s]=C.useState(0),[l,c]=C.useState(0),a={backgroundColor:r,color:R(r)?"#FFF":"#000"},p=(w,g)=>{s(w),c(g)},j=(w,g)=>{k.insertTable(e,w+1,g+1),t()},h=()=>{const w=[];for(let g=0;g<5;g++)for(let F=0;F<5;F++){const _=g<=n&&F<=l;w.push(o.jsx("div",{className:`rtf grid-cell ${_?"hovered":""}`,onMouseEnter:()=>p(g,F),onClick:()=>j(g,F)},`${g}-${F}`))}return w};return o.jsxs("div",{style:a,className:"rtf dropdown-menu table-grid-form",children:[o.jsx("div",{className:"rtf grid-container",children:h()}),o.jsxs("div",{style:a,className:"rtf table-size-indicator",children:["Tableau de ",n+1," lignes x ",l+1," colonnes"]})]})},De=C.forwardRef(({allButtons:t,hiddenButtons:e},r)=>{const{editor:n,imageColor:s}=q(),l=k.isSelectionInTable(n),c=[{name:"deleteTable",alt:"Supprimer le tableau",onClick:k.deleteTable},{name:"addRow",alt:"Ajouter une ligne",onClick:k.addRow},{name:"addColumn",alt:"Ajouter une colonne",onClick:k.addColumn},{name:"deleteRow",alt:"Supprimer une ligne",onClick:k.deleteRow},{name:"deleteColumn",alt:"Supprimer une colonne",onClick:k.deleteColumn}];return o.jsx(o.Fragment,{children:c.map((a,p)=>{var j,h;return o.jsx(Q,{text:t.find(w=>w.format===a.name).tooltip,position:"bottom",children:o.jsx("button",{ref:w=>r.current[a.name]=w,className:"rtf tool",style:{display:e.includes(a.name)?"none":"inline-block"},onClick:()=>a.onClick(n),disabled:!l,children:o.jsx(V,{format:a.name,imageColor:l?k.getTableFromSelection(n)?a.name==="addRow"?k.getTableFromSelection(n).children.length>=5?`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`:s:a.name==="addColumn"?((j=k.getTableFromSelection(n).children[0])==null?void 0:j.children.length)>=5?`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`:s:a.name==="deleteColumn"?((h=k.getTableFromSelection(n).children[0])==null?void 0:h.children.length)===1?`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`:s:a.name==="deleteRow"&&k.getTableFromSelection(n).children.length===1?`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`:s:s:`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`})})},p)})})}),_t=({activeMarks:t})=>{const[e,r]=C.useState(!1),[n,s]=C.useState([]),l=C.useRef(null),c=C.useRef({}),{editor:a,imageColor:p,backgroundColor:j}=q(),h=[{format:"blockType",tooltip:"Insérer un bloc de texte"},{format:"bold",tooltip:"Gras (Ctrl+B)"},{format:"underline",tooltip:"Souligné (Ctrl+U)"},{format:"italic",tooltip:"Italique (Ctrl+I)"},{format:"strikethrough",tooltip:"Barré"},{format:"subscript",tooltip:"Indice"},{format:"superscript",tooltip:"Exposant"},{format:"blockquote",tooltip:"Citation"},{format:"color",tooltip:"Couleur du texte"},{format:"bgColor",tooltip:"Couleur de fond"},{format:"fontSize",tooltip:"Taille de texte"},{format:"fontFamily",tooltip:"Police d'écriture"},{format:"href",tooltip:"Insérer un lien (Ctrl+K)"},{format:"bulletList",tooltip:"Liste à puces (Ctrl+L)"},{format:"numberedList",tooltip:"Liste à puces (Ctrl+N)"},{format:"left",tooltip:"Gauche"},{format:"center",tooltip:"Centré"},{format:"right",tooltip:"Droite"},{format:"indent",tooltip:"Indenté"},{format:"outdent",tooltip:"Retrait"},{format:"table",tooltip:"Insérer un tableau"},{format:"deleteTable",tooltip:"Supprimer un tableau"},{format:"addRow",tooltip:"Insérer une ligne"},{format:"addColumn",tooltip:"Insérer une colonne"},{format:"deleteRow",tooltip:"Supprimer une ligne"},{format:"deleteColumn",tooltip:"Supprimer une colonne"},{format:"image",tooltip:"Insérer une image"},{format:"code",tooltip:"Bloc de code (Ctrl+E)"},{format:"undo",tooltip:"Annuler (Ctrl+Z)"},{format:"redo",tooltip:"Rétablir (Ctrl+Y)"}],[w,g]=C.useState(!1),F=["deleteTable","addRow","addColumn","deleteRow","deleteColumn"],_=()=>{g(!w)},N=()=>{document.querySelector(".rtf.toolbar").blur()},S=()=>r(i=>!i),L=()=>{if(l.current){const u=l.current.clientWidth-15;if(978>u){let v=0;const y=[];h.forEach(f=>{const x=c.current[f.format];x&&(v+=(f.format==="blockType"?x.clientWidth:25)+5,v<=u&&y.push(f.format))});const E=h.map(f=>f.format).filter(f=>!y.includes(f));s(E)}else s([])}};return C.useEffect(()=>{if(!l.current)return;const i=new ResizeObserver(()=>{L()});return i.observe(l.current),()=>{i.disconnect()}},[]),o.jsxs("div",{className:"rtf toolbar-container",children:[o.jsxs("div",{className:"rtf toolbar",onClick:N,ref:l,children:[o.jsx($t,{ref:i=>c.current.blockType=i,tooltip:h.find(i=>i.format==="blockType").tooltip}),Object.keys(t).map((i,u)=>o.jsx("div",{className:"rtf",ref:b=>c.current[i]=b,style:{display:n.includes(i)?"none":"inline-block"},children:o.jsx(ze,{activeMarks:t,format:i,isActive:t[i],tooltip:h.find(b=>b.format===i).tooltip})},u)),o.jsxs("div",{className:"rtf dropdown tool",style:{display:n.includes("table")?"none":"flex",padding:n.includes("table")?0:5},children:[o.jsx(Q,{text:h.find(i=>i.format==="table").tooltip,position:"bottom",children:o.jsx("button",{ref:i=>c.current.table=i,onClick:_,className:"rtf dropdown-toggle",children:o.jsx(V,{format:"table",imageColor:p})})}),w&&!n.includes("table")&&o.jsx(Mt,{onClose:_})]}),o.jsx(De,{allButtons:h,hiddenButtons:n,ref:c}),!n.includes("image")&&o.jsx(Q,{text:h.find(i=>i.format==="image").tooltip,position:"bottom",children:o.jsx(Oe,{ref:i=>c.current.image=i})}),!n.includes("code")&&o.jsx(Q,{text:h.find(i=>i.format==="code").tooltip,position:"bottom",children:o.jsx(Pe,{ref:i=>c.current.code=i})}),["undo","redo"].map(i=>!n.includes(i)&&o.jsx(Q,{text:h.find(u=>u.format===i).tooltip,position:"bottom",children:o.jsx("button",{ref:u=>c.current[i]=u,className:"rtf tool",style:{display:n.includes(i)?"none":"inline-block"},onMouseDown:u=>{u.preventDefault(),i==="undo"?a.undo():i==="redo"?a.redo():console.error("Type d'action inconnu !")},children:o.jsx(V,{format:i,imageColor:a.history[i+"s"].length===0?`color-mix(in srgb, ${p} 40%, ${R(p)?"white":"black"})`:p})},i)},i)),n.length>0&&o.jsx(Q,{text:"Voir plus",position:"bottom",children:o.jsx("button",{className:"rtf tool toolbar-more-button",onClick:S,children:o.jsx(V,{format:"more",imageColor:p})})})]}),e&&o.jsx("div",{className:"rtf toolbar-modal",style:{backgroundColor:j},onMouseLeave:()=>r(!1),children:n.map(i=>i==="image"||i==="code"||i==="table"||i==="deleteTable"||i==="addRow"||i==="addColumn"||i==="deleteRow"||i==="deleteColumn"?i==="image"?o.jsx(Oe,{ref:u=>c.current.image=u},i):i==="code"?o.jsx(Pe,{ref:u=>c.current.code=u},i):i==="table"?o.jsx("div",{className:"rtf dropdown tool",children:o.jsx(Q,{text:h.find(u=>u.format===i).tooltip,position:"bottom",children:o.jsx("button",{className:"rtf dropdown-toggle",ref:u=>c.current[i]=u,onClick:_,children:o.jsx(V,{format:i,imageColor:p})})},i)}):F.includes(i)?o.jsx(De,{allButtons:h,hiddenButtons:F.filter(u=>u!==i),ref:c},i):null:o.jsx(ze,{activeMarks:t,format:i,isActive:t[i],tooltip:h.find(u=>u.format===i).tooltip},i))})]})};/**
|
|
200
|
-
* @license
|
|
201
|
-
* Copyright (c) 2025 Jahylis
|
|
202
|
-
*
|
|
203
|
-
* This file is part of ReactTextForge.
|
|
204
|
-
*
|
|
205
|
-
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
206
|
-
* it under the terms of the MIT License as published by
|
|
207
|
-
* the Open Source Initiative.
|
|
208
|
-
*
|
|
209
|
-
* ReactTextForge is distributed in the hope that it will be useful,
|
|
210
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
211
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
212
|
-
* MIT License for more details.
|
|
213
|
-
*
|
|
214
|
-
* You should have received a copy of the MIT License
|
|
215
|
-
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
216
|
-
*
|
|
217
|
-
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
218
|
-
*/const zt=t=>{const e=n=>{if(n.nodeType===Node.TEXT_NODE){const a=n.textContent.trim();return a===""?null:a}if(n.nodeType!==Node.ELEMENT_NODE)return null;const s=Array.from(n.childNodes).map(e).flat().filter(Boolean),l={bold:n.nodeName==="B"||n.nodeName==="STRONG"||n.style.fontWeight==="bold"||n.style.fontWeight==="700",italic:n.nodeName==="I"||n.nodeName==="EM"||n.style.fontStyle==="italic",underline:n.nodeName==="U"||n.style.textDecoration&&n.style.textDecoration.includes("underline"),fontSize:n.style.fontSize||n.nodeName==="FONT"&&n.getAttribute("size"),fontFamily:n.style.fontFamily||n.nodeName==="FONT"&&n.getAttribute("face"),color:n.style.color||n.nodeName==="FONT"&&n.getAttribute("color"),align:n.getAttribute("align")};let c;switch(n.nodeName){case"P":c=P("element",{type:"paragraph",align:l.align,size:l.fontSize},s.length?s:[{text:""}]);break;case"PRE":c=P("element",{type:"code"},s.length?s:[{text:""}]);break;case"UL":c=P("element",{type:"bullet-list"},s);break;case"OL":c=P("element",{type:"numbered-list"},s);break;case"LI":c=P("element",{type:"list-item"},s.length?s:[{text:""}]);break;case"H1":c=P("element",{type:"h1"},s.length?s:[{text:""}]);break;case"H2":case"H3":case"H4":case"H5":case"H6":c=P("element",{type:"h2",align:l.align},s.length?s:[{text:""}]);break;case"BLOCKQUOTE":c=P("element",{type:"blockquote",align:l.align},s.length?s:[{text:""}]);break;case"IMG":c=P("element",{type:"image",url:n.getAttribute("src")});break;case"TABLE":c=P("element",{type:"table"},s);break;case"TR":c=P("element",{type:"table-row"},s);break;case"TD":c=P("element",{type:"table-cell"},s);break;case"A":c=P("element",{type:"link",url:n.getAttribute("href")},s.length?s:[{text:""}]);break;default:c=s.map(a=>typeof a=="string"?P("text",l,a):a).filter(Boolean)}return c};return Array.from(t.childNodes).map(e).flat().filter(Boolean)},Pt=({toggleColor:t,fullScreen:e})=>{const{isDarkTheme:r,toggleTheme:n}=xe();return o.jsxs("label",{className:"rtf toggle-switch",style:{right:e?55:20},children:[o.jsx("input",{className:"rtf",type:"checkbox",checked:r,onChange:n}),o.jsx("span",{className:"rtf slider round",style:{borderColor:t},children:o.jsx("span",{className:"rtf icon",style:{backgroundColor:t},children:o.jsx("span",{children:r?"🌙":"🌞"})})})]})};function Ot({children:t}){const{editor:e,imageColor:r}=q(),n=C.useId(),s=c=>{k.insertParagraphBeforeTable(e,c)},l=()=>{k.insertParagraphAfterTable(e,n)};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"rtf tool table__tool",onClick:()=>s(n),children:o.jsx(V,{format:"enter",imageColor:r})}),o.jsx("table",{className:"rtf","data-table-id":n,children:o.jsx("tbody",{children:t})}),o.jsx("div",{className:"rtf tool table__tool",onClick:l,children:o.jsx(V,{format:"enter",imageColor:r})})]})}const Be=C.createContext({isFullscreen:!1,toggleFullscreen:()=>{}}),Dt=({children:t})=>{const[e,r]=C.useState(!1),n=()=>{r(!e)};return C.useEffect(()=>{const s=()=>{e&&window.innerWidth<768&&r(!1)};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[e]),o.jsx(Be.Provider,{value:{isFullscreen:e,toggleFullscreen:n},children:t})},Re=()=>C.useContext(Be),Bt=({children:t})=>{const{isFullscreen:e}=Re(),r=C.useRef(null);return C.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),o.jsx("div",{ref:r,className:`rtf fullscreen-wrapper ${e?"fullscreen-wrapper--active":""}`,children:t})},Rt=()=>{const{isFullscreen:t,toggleFullscreen:e}=Re(),{backgroundColor:r,imageColor:n}=q();return o.jsx("div",{className:"rtf fullscreen-button",children:o.jsx(Q,{position:"bottom",text:t?"Quitter le mode plein écran (Esc)":"Passer en mode plein écran",children:o.jsx("button",{onClick:e,className:`rtf tool ${t?"tool--active":""}`,style:{backgroundColor:t?`color-mix(in srgb, ${r} 80%, ${R(r)?"white":"black"})`:""},children:o.jsx(V,{format:`fullscreen${t?"Exit":""}`,imageColor:n})})})})};var ye={exports:{}},Ie;function It(){return Ie||(Ie=1,function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
|
219
|
-
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
220
|
-
*
|
|
221
|
-
* @license MIT <https://opensource.org/licenses/MIT>
|
|
222
|
-
* @author Lea Verou <https://lea.verou.me>
|
|
223
|
-
* @namespace
|
|
224
|
-
* @public
|
|
225
|
-
*/var r=function(n){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,c={},a={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function i(u){return u instanceof p?new p(u.type,i(u.content),u.alias):Array.isArray(u)?u.map(i):u.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(i){return Object.prototype.toString.call(i).slice(8,-1)},objId:function(i){return i.__id||Object.defineProperty(i,"__id",{value:++l}),i.__id},clone:function i(u,b){b=b||{};var v,y;switch(a.util.type(u)){case"Object":if(y=a.util.objId(u),b[y])return b[y];v={},b[y]=v;for(var E in u)u.hasOwnProperty(E)&&(v[E]=i(u[E],b));return v;case"Array":return y=a.util.objId(u),b[y]?b[y]:(v=[],b[y]=v,u.forEach(function(f,x){v[x]=i(f,b)}),v);default:return u}},getLanguage:function(i){for(;i;){var u=s.exec(i.className);if(u)return u[1].toLowerCase();i=i.parentElement}return"none"},setLanguage:function(i,u){i.className=i.className.replace(RegExp(s,"gi"),""),i.classList.add("language-"+u)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(v){var i=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(v.stack)||[])[1];if(i){var u=document.getElementsByTagName("script");for(var b in u)if(u[b].src==i)return u[b]}return null}},isActive:function(i,u,b){for(var v="no-"+u;i;){var y=i.classList;if(y.contains(u))return!0;if(y.contains(v))return!1;i=i.parentElement}return!!b}},languages:{plain:c,plaintext:c,text:c,txt:c,extend:function(i,u){var b=a.util.clone(a.languages[i]);for(var v in u)b[v]=u[v];return b},insertBefore:function(i,u,b,v){v=v||a.languages;var y=v[i],E={};for(var f in y)if(y.hasOwnProperty(f)){if(f==u)for(var x in b)b.hasOwnProperty(x)&&(E[x]=b[x]);b.hasOwnProperty(f)||(E[f]=y[f])}var T=v[i];return v[i]=E,a.languages.DFS(a.languages,function(A,M){M===T&&A!=i&&(this[A]=E)}),E},DFS:function i(u,b,v,y){y=y||{};var E=a.util.objId;for(var f in u)if(u.hasOwnProperty(f)){b.call(u,f,u[f],v||f);var x=u[f],T=a.util.type(x);T==="Object"&&!y[E(x)]?(y[E(x)]=!0,i(x,b,null,y)):T==="Array"&&!y[E(x)]&&(y[E(x)]=!0,i(x,b,f,y))}}},plugins:{},highlightAll:function(i,u){a.highlightAllUnder(document,i,u)},highlightAllUnder:function(i,u,b){var v={callback:b,container:i,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",v),v.elements=Array.prototype.slice.apply(v.container.querySelectorAll(v.selector)),a.hooks.run("before-all-elements-highlight",v);for(var y=0,E;E=v.elements[y++];)a.highlightElement(E,u===!0,v.callback)},highlightElement:function(i,u,b){var v=a.util.getLanguage(i),y=a.languages[v];a.util.setLanguage(i,v);var E=i.parentElement;E&&E.nodeName.toLowerCase()==="pre"&&a.util.setLanguage(E,v);var f=i.textContent,x={element:i,language:v,grammar:y,code:f};function T(M){x.highlightedCode=M,a.hooks.run("before-insert",x),x.element.innerHTML=x.highlightedCode,a.hooks.run("after-highlight",x),a.hooks.run("complete",x),b&&b.call(x.element)}if(a.hooks.run("before-sanity-check",x),E=x.element.parentElement,E&&E.nodeName.toLowerCase()==="pre"&&!E.hasAttribute("tabindex")&&E.setAttribute("tabindex","0"),!x.code){a.hooks.run("complete",x),b&&b.call(x.element);return}if(a.hooks.run("before-highlight",x),!x.grammar){T(a.util.encode(x.code));return}if(u&&n.Worker){var A=new Worker(a.filename);A.onmessage=function(M){T(M.data)},A.postMessage(JSON.stringify({language:x.language,code:x.code,immediateClose:!0}))}else T(a.highlight(x.code,x.grammar,x.language))},highlight:function(i,u,b){var v={code:i,grammar:u,language:b};if(a.hooks.run("before-tokenize",v),!v.grammar)throw new Error('The language "'+v.language+'" has no grammar.');return v.tokens=a.tokenize(v.code,v.grammar),a.hooks.run("after-tokenize",v),p.stringify(a.util.encode(v.tokens),v.language)},tokenize:function(i,u){var b=u.rest;if(b){for(var v in b)u[v]=b[v];delete u.rest}var y=new w;return g(y,y.head,i),h(i,y,u,y.head,0),_(y)},hooks:{all:{},add:function(i,u){var b=a.hooks.all;b[i]=b[i]||[],b[i].push(u)},run:function(i,u){var b=a.hooks.all[i];if(!(!b||!b.length))for(var v=0,y;y=b[v++];)y(u)}},Token:p};n.Prism=a;function p(i,u,b,v){this.type=i,this.content=u,this.alias=b,this.length=(v||"").length|0}p.stringify=function i(u,b){if(typeof u=="string")return u;if(Array.isArray(u)){var v="";return u.forEach(function(T){v+=i(T,b)}),v}var y={type:u.type,content:i(u.content,b),tag:"span",classes:["token",u.type],attributes:{},language:b},E=u.alias;E&&(Array.isArray(E)?Array.prototype.push.apply(y.classes,E):y.classes.push(E)),a.hooks.run("wrap",y);var f="";for(var x in y.attributes)f+=" "+x+'="'+(y.attributes[x]||"").replace(/"/g,""")+'"';return"<"+y.tag+' class="'+y.classes.join(" ")+'"'+f+">"+y.content+"</"+y.tag+">"};function j(i,u,b,v){i.lastIndex=u;var y=i.exec(b);if(y&&v&&y[1]){var E=y[1].length;y.index+=E,y[0]=y[0].slice(E)}return y}function h(i,u,b,v,y,E){for(var f in b)if(!(!b.hasOwnProperty(f)||!b[f])){var x=b[f];x=Array.isArray(x)?x:[x];for(var T=0;T<x.length;++T){if(E&&E.cause==f+","+T)return;var A=x[T],M=A.inside,U=!!A.lookbehind,Z=!!A.greedy,X=A.alias;if(Z&&!A.pattern.global){var I=A.pattern.toString().match(/[imsuy]*$/)[0];A.pattern=RegExp(A.pattern.source,I+"g")}for(var D=A.pattern||A,O=v.next,Y=y;O!==u.tail&&!(E&&Y>=E.reach);Y+=O.value.length,O=O.next){var m=O.value;if(u.length>i.length)return;if(!(m instanceof p)){var $=1,z;if(Z){if(z=j(D,Y,i,U),!z||z.index>=i.length)break;var te=z.index,H=z.index+z[0].length,W=Y;for(W+=O.value.length;te>=W;)O=O.next,W+=O.value.length;if(W-=O.value.length,Y=W,O.value instanceof p)continue;for(var G=O;G!==u.tail&&(W<H||typeof G.value=="string");G=G.next)$++,W+=G.value.length;$--,m=i.slice(Y,W),z.index-=Y}else if(z=j(D,0,m,U),!z)continue;var te=z.index,re=z[0],B=m.slice(0,te),ee=m.slice(te+re.length),ne=Y+m.length;E&&ne>E.reach&&(E.reach=ne);var ae=O.prev;B&&(ae=g(u,ae,B),Y+=B.length),F(u,ae,$);var Wt=new p(f,M?a.tokenize(re,M):re,X,re);if(O=g(u,ae,Wt),ee&&g(u,O,ee),$>1){var we={cause:f+","+T,reach:ne};h(i,u,b,O.prev,Y,we),E&&we.reach>E.reach&&(E.reach=we.reach)}}}}}}function w(){var i={value:null,prev:null,next:null},u={value:null,prev:i,next:null};i.next=u,this.head=i,this.tail=u,this.length=0}function g(i,u,b){var v=u.next,y={value:b,prev:u,next:v};return u.next=y,v.prev=y,i.length++,y}function F(i,u,b){for(var v=u.next,y=0;y<b&&v!==i.tail;y++)v=v.next;u.next=v,v.prev=u,i.length-=y}function _(i){for(var u=[],b=i.head.next;b!==i.tail;)u.push(b.value),b=b.next;return u}if(!n.document)return n.addEventListener&&(a.disableWorkerMessageHandler||n.addEventListener("message",function(i){var u=JSON.parse(i.data),b=u.language,v=u.code,y=u.immediateClose;n.postMessage(a.highlight(v,a.languages[b],b)),y&&n.close()},!1)),a;var N=a.util.currentScript();N&&(a.filename=N.src,N.hasAttribute("data-manual")&&(a.manual=!0));function S(){a.manual||a.highlightAll()}if(!a.manual){var L=document.readyState;L==="loading"||L==="interactive"&&N&&N.defer?document.addEventListener("DOMContentLoaded",S):window.requestAnimationFrame?window.requestAnimationFrame(S):window.setTimeout(S,16)}return a}(e);t.exports&&(t.exports=r),typeof Se<"u"&&(Se.Prism=r),r.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))}),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(s,l){var c={};c["language-"+l]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[l]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var a={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};a["language-"+l]={pattern:/[\s\S]+/,inside:r.languages[l]};var p={};p[s]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:a},r.languages.insertBefore("markup","cdata",p)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(n,s){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:r.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,function(n){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var l=n.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))}(r),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,function(){if(typeof r>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",s=function(N,S){return"✖ Error "+N+" while fetching file: "+S},l="✖ Error: File does not exist or is empty",c={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},a="data-src-status",p="loading",j="loaded",h="failed",w="pre[data-src]:not(["+a+'="'+j+'"]):not(['+a+'="'+p+'"])';function g(N,S,L){var i=new XMLHttpRequest;i.open("GET",N,!0),i.onreadystatechange=function(){i.readyState==4&&(i.status<400&&i.responseText?S(i.responseText):i.status>=400?L(s(i.status,i.statusText)):L(l))},i.send(null)}function F(N){var S=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(N||"");if(S){var L=Number(S[1]),i=S[2],u=S[3];return i?u?[L,Number(u)]:[L,void 0]:[L,L]}}r.hooks.add("before-highlightall",function(N){N.selector+=", "+w}),r.hooks.add("before-sanity-check",function(N){var S=N.element;if(S.matches(w)){N.code="",S.setAttribute(a,p);var L=S.appendChild(document.createElement("CODE"));L.textContent=n;var i=S.getAttribute("data-src"),u=N.language;if(u==="none"){var b=(/\.(\w+)$/.exec(i)||[,"none"])[1];u=c[b]||b}r.util.setLanguage(L,u),r.util.setLanguage(S,u);var v=r.plugins.autoloader;v&&v.loadLanguages(u),g(i,function(y){S.setAttribute(a,j);var E=F(S.getAttribute("data-range"));if(E){var f=y.split(/\r\n?|\n/g),x=E[0],T=E[1]==null?f.length:E[1];x<0&&(x+=f.length),x=Math.max(0,Math.min(x-1,f.length)),T<0&&(T+=f.length),T=Math.max(0,Math.min(T,f.length)),y=f.slice(x,T).join(`
|
|
226
|
-
`),S.hasAttribute("data-start")||S.setAttribute("data-start",String(x+1))}L.textContent=y,r.highlightElement(L)},function(y){S.setAttribute(a,h),L.textContent=y})}}),r.plugins.fileHighlight={highlight:function(S){for(var L=(S||document).querySelectorAll(w),i=0,u;u=L[i++];)r.highlightElement(u)}};var _=!1;r.fileHighlight=function(){_||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),_=!0),r.plugins.fileHighlight.highlight.apply(this,arguments)}}()}(ye)),ye.exports}var Ht=It();const He=pt(Ht);Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript;var qe={},Ve;function qt(){return Ve||(Ve=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),qe}qt(),function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(h){return h=h.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,s=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return n}),l=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+s+l+"(?:"+s+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+s+l+")(?:"+s+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+s+")"+l+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+s+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(w){h!==w&&(t.languages.markdown[h].inside.content.inside[w]=t.languages.markdown[w])})}),t.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function w(g){if(!(!g||typeof g=="string"))for(var F=0,_=g.length;F<_;F++){var N=g[F];if(N.type!=="code"){w(N.content);continue}var S=N.content[1],L=N.content[3];if(S&&L&&S.type==="code-language"&&L.type==="code-block"&&typeof S.content=="string"){var i=S.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");i=(/[a-z][\w-]*/i.exec(i)||[""])[0].toLowerCase();var u="language-"+i;L.alias?typeof L.alias=="string"?L.alias=[L.alias,u]:L.alias.push(u):L.alias=[u]}}}w(h.tokens)}),t.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var w="",g=0,F=h.classes.length;g<F;g++){var _=h.classes[g],N=/language-(.+)/.exec(_);if(N){w=N[1];break}}var S=t.languages[w];if(S)h.content=t.highlight(j(h.content),S,w);else if(w&&w!=="none"&&t.plugins.autoloader){var L="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=L,t.plugins.autoloader.loadLanguages(w,function(){var i=document.getElementById(L);i&&(i.innerHTML=t.highlight(i.textContent,t.languages[w],w))})}}});var c=RegExp(t.languages.markup.tag.pattern.source,"gi"),a={amp:"&",lt:"<",gt:">",quot:'"'},p=String.fromCodePoint||String.fromCharCode;function j(h){var w=h.replace(c,"");return w=w.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(g,F){if(F=F.toLowerCase(),F[0]==="#"){var _;return F[1]==="x"?_=parseInt(F.slice(2),16):_=Number(F.slice(1)),p(_)}else{var N=a[F];return N||g}}),w}t.languages.md=t.languages.markdown}(Prism),function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(Prism);const Vt=({value:t,setValue:e,fullScreen:r=!0,showTheme:n=!0,borderColor:s="#ccc",backgroundColor:l="#FFF",imageColor:c="#000",borderDarkColor:a="#1A1A1A",backgroundDarkColor:p="#444444",imageDarkColor:j="#ffffff",toggleColor:h="#2584aa",raccourcis:w=null})=>{const[g]=C.useState(()=>Ze.withDocxDeserializer(We.withHistory(se.withReact(d.createEditor())))),[F,_]=C.useState({bold:!1,underline:!1,italic:!1,strikethrough:!1,subscript:!1,superscript:!1,blockquote:!1,color:"",bgColor:"",fontSize:"",fontFamily:"",href:"",bulletList:!1,numberedList:!1,left:!1,center:!1,right:!1,indent:!1,outdent:!1}),N=C.useMemo(()=>t||[{type:"paragraph",children:[{text:""}]}],[]),S=C.useRef([]),L=([f,x])=>{const T=[];if(!d.Element.isElement(f))return T;const A=d.Node.string(f),M=x[0],U=S.current[M];if(U&&U.text==A)return U.ranges;const Z=He.tokenize(A,He.languages.javascript);let X=0;for(const I of Z){const D=I.length,O=X+D;typeof I!="string"&&T.push({anchor:{path:x,offset:X},focus:{path:x,offset:O},className:`token ${I.type}`}),X=O}return S.current[M]={text:A,ranges:T},T},i=C.useCallback(f=>{switch(f.element.type){case"code":return o.jsx(bt,{...f});case"bullet-list":case"numbered-list":case"list-item":return o.jsx(yt,{...f});case"h1":return o.jsx("h1",{className:"rtf",...f.attributes,children:f.children});case"h2":return o.jsx("h2",{className:"rtf",...f.attributes,children:f.children});case"blockquote":return o.jsx(wt,{...f});case"image":return o.jsx("img",{className:"rtf",src:f.element.url,alt:"",...f.attributes});case"table":return o.jsx(Ot,{...f});case"table-row":return o.jsx("tr",{className:"rtf",children:f.children});case"table-cell":return o.jsx("td",{className:"rtf",children:f.children});default:return o.jsx(xt,{...f})}},[]),u=C.useCallback(f=>o.jsx(vt,{...f}),[]),b=C.useCallback(()=>{const f=d.Editor.marks(g),x=k.isSelectionInList(g);_(T=>{const A={};for(const M in T)if(M==="bulletList"||M==="numberedList"){const U=M==="bulletList"?"bullet-list":M==="numberedList"?"numbered-list":"";A[M]=x&&k.isBlockActive(g,U)}else if(M==="left"||M==="center"||M==="right")A[M]=k.isAlignActive(g,M);else if(M==="indent"||M==="outdent")A[M]=k.canIndent(g,M);else if(M==="href"){const U=k.isLinkActive(g);let Z="";if(U){const X=d.Editor.nodes(g,{match:I=>I.type==="link",mode:"highest"});for(const[I]of X)if(I&&I.href){Z=I.href;break}Z||console.error("No link node with URL property found")}A[M]=Z}else M==="color"?A[M]=(f==null?void 0:f.color)||null:M==="fontSize"?A[M]=(f==null?void 0:f.fontSize)||null:A[M]=(f==null?void 0:f[M])===!0;return A})},[g]),v=async f=>{if(k.isSelectionInCode(g)){const T=f.clipboardData.getData("text/plain");T&&(T.includes(`
|
|
227
|
-
`)||T.match(/^\s{2,}/gm))&&(f.preventDefault(),k.insertCodeBlock(g,T));return}const x=f.clipboardData.getData("text/html");if(x){f.preventDefault();const T=new DOMParser().parseFromString(x,"text/html"),A=zt(T.body);g.insertFragment(A)}},y=()=>{d.Transforms.delete(g,{at:{anchor:d.Editor.start(g,[]),focus:d.Editor.end(g,[])}})},E=f=>{f.shiftKey&&k.canIndent(g,"outdent")?(f.preventDefault(),k.handleOutdent(g)):k.canIndent(g,"indent")&&(f.preventDefault(),k.handleIndent(g))};return C.useEffect(()=>{if(w!==null){const f=x=>{Object.keys(w).forEach(T=>{const A=T.split("+"),M=A.pop().toLowerCase(),U=A.map(D=>D.toLowerCase()),Z={ctrl:x.ctrlKey,shift:x.shiftKey,alt:x.altKey,meta:x.metaKey},X=U.every(D=>Z[D]),I=x.key.toLowerCase()===M;X&&I&&w[T](x)})};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}}},[w]),C.useEffect(()=>{t==null&&y()},[t]),o.jsx(kt,{showTheme:n,borderDarkColor:a,backgroundDarkColor:p,imageDarkColor:j,children:o.jsx(Dt,{children:o.jsx(Bt,{children:o.jsx(Ct,{backgroundColor:l,borderColor:s,editor:g,imageColor:c,children:o.jsxs(se.Slate,{editor:g,initialValue:N,value:t,onChange:f=>{if(b(),g.operations.some(T=>T.type!=="set_selection")){const T=JSON.stringify(f);e(f),localStorage.setItem("content",T)}},children:[o.jsx(_t,{activeMarks:F}),o.jsx(se.Editable,{className:"rtf rtf__editor",decorate:L,renderElement:i,renderLeaf:u,style:{borderColor:s,paddingBottom:n||r?35:10},onPaste:v,onKeyDown:f=>{if(f.key==="Tab"){E(f);return}if(f.key==="Enter"&&!f.ctrlKey&&(k.isSelectionInTable(g)||k.isSelectionInCode(g)||k.isBlockquoteActive(g))&&(f.preventDefault(),g.insertText(`
|
|
228
|
-
`)),!!f.ctrlKey)switch(f.key){case"=":{f.preventDefault(),k.toggleBlock(g,"code");break}case"b":{f.preventDefault(),k.toggleMark(g,"bold");break}case"i":{f.preventDefault(),k.toggleMark(g,"italic");break}case"u":{f.preventDefault(),k.toggleMark(g,"underline");break}case"s":{f.preventDefault(),k.toggleMark(g,"strikethrough");break}case"sub":{f.preventDefault(),k.toggleMark(g,"subscript");break}case"sup":{f.preventDefault(),k.toggleMark(g,"superscript");break}case"l":{f.preventDefault(),k.toggleBlock(g,"bulletList");break}case"n":{f.preventDefault(),k.toggleBlock(g,"numberedList");break}case"left":{f.preventDefault(),k.toggleMark(g,"left");break}case"center":{f.preventDefault(),k.toggleMark(g,"center");break}case"right":{f.preventDefault(),k.toggleMark(g,"right");break}case"Enter":{f.preventDefault();const{selection:x}=g;if(x){const[T]=d.Editor.nodes(g,{match:A=>d.Element.isElement(A)&&A.type!=="paragraph"});T&&d.Transforms.insertNodes(g,d.Transforms.insertNodes(g,{type:"paragraph",children:[{text:""}]}))}break}}}}),n&&o.jsx(Pt,{toggleColor:h,fullScreen:r}),r&&o.jsx(Rt,{})]})})})})})};/**
|
|
229
|
-
* @license
|
|
230
|
-
* Copyright (c) 2025 Jahylis
|
|
231
|
-
*
|
|
232
|
-
* This file is part of ReactTextForge.
|
|
233
|
-
*
|
|
234
|
-
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
235
|
-
* it under the terms of the MIT License as published by
|
|
236
|
-
* the Open Source Initiative.
|
|
237
|
-
*
|
|
238
|
-
* ReactTextForge is distributed in the hope that it will be useful,
|
|
239
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
240
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
241
|
-
* MIT License for more details.
|
|
242
|
-
*
|
|
243
|
-
* You should have received a copy of the MIT License
|
|
244
|
-
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
245
|
-
*
|
|
246
|
-
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
247
|
-
*/K.default=Vt,K.deserialize=ft,K.serialize=J,Object.defineProperties(K,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
248
|
-
//# sourceMappingURL=react-text-forge.umd.cjs.map
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("slate"),require("react"),require("slate-react"),require("slate-history"),require("react-color"),require("slate-docx-deserializer")):"function"==typeof define&&define.amd?define(["exports","slate","react","slate-react","slate-history","react-color","slate-docx-deserializer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactTextForge={},e.Slate,e.React,e.SlateReact,e.SlateHistory,e.ReactColor,e.SlateDocxDeserializer)}(this,function(e,t,r,n,o,a,s){"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
|
+
* Released under the MIT License.
|
|
7
|
+
*/function l(e){return"[object Object]"===Object.prototype.toString.call(e)}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e){var t=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===i(t)?t:String(t)}function u(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var d=new WeakMap,p=new WeakMap;class g{}class f extends g{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),u(this,"offset",void 0),u(this,"path",void 0);var{offset:t,path:r}=e;this.offset=t,this.path=r}}class m extends g{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),u(this,"offset",void 0),u(this,"path",void 0);var{offset:t,path:r}=e;this.offset=t,this.path=r}}var h=e=>d.get(e),b=e=>p.get(e);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach(function(t){u(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var v=new WeakSet,k=e=>{var r=[],n=e=>{if(null!=e){var o=r[r.length-1];if("string"==typeof e){var a={text:e};v.add(a),e=a}if(t.Text.isText(e)){var s=e;t.Text.isText(o)&&v.has(o)&&v.has(s)&&t.Text.equals(o,s,{loose:!0})?o.text+=s.text:r.push(s)}else if(t.Element.isElement(e))r.push(e);else{if(!(e instanceof g))throw new Error("Unexpected hyperscript child object: ".concat(e));var l=r[r.length-1];t.Text.isText(l)||(n(""),l=r[r.length-1]),e instanceof f?((e,t)=>{var r=e.text.length;d.set(e,[r,t])})(l,e):e instanceof m&&((e,t)=>{var r=e.text.length;p.set(e,[r,t])})(l,e)}}};for(var o of e.flat(1/0))n(o);return r};function w(e,t,r){return x(x({},t),{},{children:k(r)})}function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach(function(t){u(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var F,S={anchor:function(e,t,r){return new f(t)},cursor:function(e,t,r){return[new f(t),new m(t)]},editor:(F=t.createEditor,(e,r,n)=>{var o,a=[];for(var s of n)t.Range.isRange(s)?o=s:a.push(s);var l=k(a),i={},c=F();for(var[u,d]of(Object.assign(c,r),c.children=l,t.Node.texts(c))){var p=h(u),g=b(u);if(null!=p){var[f]=p;i.anchor={path:d,offset:f}}if(null!=g){var[m]=g;i.focus={path:d,offset:m}}}if(i.anchor&&!i.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!i.anchor&&i.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=o?c.selection=o:t.Range.isRange(i)&&(c.selection=i),c}),element:w,focus:function(e,t,r){return new m(t)},fragment:function(e,t,r){return k(r)},selection:function(e,t,r){var n=r.find(e=>e instanceof f),o=r.find(e=>e instanceof m);if(!n||null==n.offset||null==n.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return x({anchor:{offset:n.offset,path:n.path},focus:{offset:o.offset,path:o.path}},t)},text:function(e,r,n){var o=k(n);if(o.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[a]=o;if(null==a&&(a={text:""}),!t.Text.isText(a))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return v.delete(a),Object.assign(a,r),a}},N=e=>function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),a=2;a<n;a++)o[a-2]=arguments[a];var s,i,c,u=e[t];if(!u)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==r&&(r={}),(!1===l(s=r)||void 0!==(i=s.constructor)&&(!1===l(c=i.prototype)||!1===c.hasOwnProperty("isPrototypeOf")))&&(o=[r].concat(o),r={}),u(t,r,o=o.filter(e=>Boolean(e)).flat())},E=e=>{var t={},r=function(){var r=e[n];if("object"!=typeof r)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(r));t[n]=(e,t,n)=>w(0,j(j({},r),t),n)};for(var n in e)r();return t},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,r=E(t),n=j(j(j({},S),r),e.creators);return N(n)}();
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright (c) 2025 Jahylis
|
|
11
|
+
*
|
|
12
|
+
* This file is part of ReactTextForge.
|
|
13
|
+
*
|
|
14
|
+
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
15
|
+
* it under the terms of the MIT License as published by
|
|
16
|
+
* the Open Source Initiative.
|
|
17
|
+
*
|
|
18
|
+
* ReactTextForge is distributed in the hope that it will be useful,
|
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
* MIT License for more details.
|
|
22
|
+
*
|
|
23
|
+
* You should have received a copy of the MIT License
|
|
24
|
+
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
25
|
+
*
|
|
26
|
+
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
27
|
+
*/
|
|
28
|
+
const T=e=>e.map(e=>{if(t.Text.isText(e)){let t=e.text;const r=[];if(e.bold&&r.push(`<strong>${t}</strong>`),e.italic&&r.push(`<em>${t}</em>`),e.underline&&r.push(`<u>${t}</u>`),e.strikethrough&&r.push(`<del>${t}</del>`),e.subscript&&!e.superscript&&r.push(`<sub>${t}</sub>`),!e.subscript&&e.superscript&&r.push(`<sup>${t}</sup>`),e.bgColor&&r.push(`<mark style="background-color: ${e.bgColor}">${t}</mark>`),e.href){const n=e.color?` style="color: ${e.color}"`:"",o=e.target?` target="${e.target}"`:"",a=e.rel?` rel="${e.rel}"`:"";return`<a class="rtf" href="${e.href}"${o}${a}${n}>${r.length?r.join(""):t}</a>`}return`<span${` style="color: ${e.color}; font-size: ${e.fontSize}; font-family: ${e.fontFamily}"`}>${r.length>0?r.join(""):t}</span>`}return"paragraph"===e.type?`<p class="rtf">${T(e.children)}</p>`:"code"===e.type?`<pre class="rtf"><code>${T(e.children)}</code></pre>`:"bullet-list"===e.type?`<ul class="rtf">${T(e.children)}</ul>`:"numbered-list"===e.type?`<ol class="rtf">${T(e.children)}</ol>`:"list-item"===e.type?`<li class="rtf">${T(e.children)}</li>`:"h1"===e.type?`<h1 class="rtf">${T(e.children)}</h1>`:"h2"===e.type?`<h2 class="rtf">${T(e.children)}</h2>`:"blockquote"===e.type?`<blockquote class="rtf">${T(e.children)}</blockquote>`:"image"===e.type?`<img class="rtf" src="${e.url}" alt="" />`:"table"===e.type?`<table class="rtf"><tbody>${T(e.children)}</tbody></table>`:"table-row"===e.type?`<tr class="rtf">${T(e.children)}</tr>`:"table-cell"===e.type?`<td class="rtf">${T(e.children)}</td>`:"link"===e.type?`<a class="rtf" href="${e.url}">${T(e.children)}</a>`:""}).join("");
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright (c) 2025 Jahylis
|
|
32
|
+
*
|
|
33
|
+
* This file is part of ReactTextForge.
|
|
34
|
+
*
|
|
35
|
+
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
36
|
+
* it under the terms of the MIT License as published by
|
|
37
|
+
* the Open Source Initiative.
|
|
38
|
+
*
|
|
39
|
+
* ReactTextForge is distributed in the hope that it will be useful,
|
|
40
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
41
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
42
|
+
* MIT License for more details.
|
|
43
|
+
*
|
|
44
|
+
* You should have received a copy of the MIT License
|
|
45
|
+
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
46
|
+
*
|
|
47
|
+
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
48
|
+
*/var A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,z={exports:{}},_={};var O,P,D={};
|
|
49
|
+
/**
|
|
50
|
+
* @license React
|
|
51
|
+
* react-jsx-runtime.development.js
|
|
52
|
+
*
|
|
53
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the MIT license found in the
|
|
56
|
+
* LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/function B(){return O||(O=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===j?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case g:return"Fragment";case m:return"Profiler";case f:return"StrictMode";case x:return"Suspense";case v:return"SuspenseList";case C:return"Activity"}if("object"==typeof t)switch(t.tag,t.$$typeof){case p:return"Portal";case b:return(t.displayName||"Context")+".Provider";case h:return(t._context.displayName||"Context")+".Consumer";case y:var r=t.render;return(t=t.displayName)||(t=""!==(t=r.displayName||r.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case k:return null!==(r=t.displayName||null)?r:e(t.type)||"Memo";case w:r=t._payload,t=t._init;try{return e(t(r))}catch(n){}}return null}function t(e){return""+e}function n(e){try{t(e);var r=!1}catch(a){r=!0}if(r){var n=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),t(e)}}function o(t){if(t===g)return"<>";if("object"==typeof t&&null!==t&&t.$$typeof===w)return"<...>";try{var r=e(t);return r?"<"+r+">":"<...>"}catch(n){return"<...>"}}function a(){return Error("react-stack-top-frame")}function s(){var t=e(this.type);return L[t]||(L[t]=!0),void 0!==(t=this.props.ref)?t:null}function l(t,r,o,a,l,u,p,g){var f,m=r.children;if(void 0!==m)if(a){if(N(m)){for(a=0;a<m.length;a++)i(m[a]);Object.freeze&&Object.freeze(m)}}else i(m);if(S.call(r,"key")){m=e(t);var h=Object.keys(r).filter(function(e){return"key"!==e});a=0<h.length?"{key: someKey, "+h.join(": ..., ")+": ...}":"{key: someKey}",$[m+a]||(h=0<h.length?"{"+h.join(": ..., ")+": ...}":"{}",$[m+a]=!0)}if(m=null,void 0!==o&&(n(o),m=""+o),function(e){if(S.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(r)&&(n(r.key),m=""+r.key),"key"in r)for(var b in o={},r)"key"!==b&&(o[b]=r[b]);else o=r;return m&&function(e){function t(){c||(c=!0)}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}(o,"function"==typeof t&&(t.displayName||t.name)),function(e,t,r,n,o,a,l,i){return r=a.ref,e={$$typeof:d,type:e,key:t,props:a,_owner:o},null!==(void 0!==r?r:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:s}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:l}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,m,u,0,null===(f=F.A)?null:f.getOwner(),o,p,g)}function i(e){"object"==typeof e&&null!==e&&e.$$typeof===d&&e._store&&(e._store.validated=1)}var c,u=r,d=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),b=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),j=Symbol.for("react.client.reference"),F=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=Object.prototype.hasOwnProperty,N=Array.isArray,E=console.createTask?console.createTask:function(){return null},L={},T=(u={"react-stack-bottom-frame":function(e){return e()}})["react-stack-bottom-frame"].bind(u,a)(),A=E(o(a)),$={};D.Fragment=g,D.jsx=function(e,t,r,n,a){var s=1e4>F.recentlyCreatedOwnerStacks++;return l(e,t,r,!1,0,a,s?Error("react-stack-top-frame"):T,s?E(o(e)):A)},D.jsxs=function(e,t,r,n,a){var s=1e4>F.recentlyCreatedOwnerStacks++;return l(e,t,r,!0,0,a,s?Error("react-stack-top-frame"):T,s?E(o(e)):A)}}()),D}var R=(P||(P=1,"production"===process.env.NODE_ENV?z.exports=function(){if(M)return _;M=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(t,r,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==r.key&&(o=""+r.key),"key"in r)for(var a in n={},r)"key"!==a&&(n[a]=r[a]);else n=r;return r=n.ref,{$$typeof:e,type:t,key:o,ref:void 0!==r?r:null,props:n}}return _.Fragment=t,_.jsx=r,_.jsxs=r,_}():z.exports=B()),z.exports);const I=({attributes:e,children:t,element:n})=>{const o=r.useRef(null),a=n.language||"plaintext";return R.jsxs("pre",{className:"rtf",...e,children:[R.jsx("div",{spellCheck:"false",className:"rtf code-language",children:a.toUpperCase()}),R.jsx("code",{ref:o,className:`language-${a}`,children:t})]})},H={isMarkActive(e,r){const n=t.Editor.marks(e);return!!n&&!0===n[r]},toggleMark(e,r){H.isMarkActive(e,r)?t.Editor.removeMark(e,r):(t.Editor.addMark(e,r,!0),"subscript"===r?t.Editor.removeMark(e,"superscript"):"superscript"===r&&t.Editor.removeMark(e,"subscript"))},isBlockActive(e,r){const[n]=t.Editor.nodes(e,{match:e=>e.type===r});return!!n},isSelectionInList(e){const[r]=t.Editor.nodes(e,{match:e=>"bullet-list"===e.type||"numbered-list"===e.type});return!!r},getListStyleType(e){const[r]=t.Editor.nodes(e,{match:e=>"list-item"===e.type});return r[0].listStyleType},toggleBlock(e,r,n=null){const o=H.isBlockActive(e,r),a="bullet-list"===r||"numbered-list"===r;if(("h1"===r||"h2"===r)&&t.Editor.removeMark(e,"fontSize"),a&&H.isSelectionInList(e)&&!n)return t.Transforms.unwrapNodes(e,{match:e=>a&&!t.Editor.isEditor(e)&&t.Element.isElement(e)&&("bullet-list"===e.type||"numbered-list"===e.type),split:!0}),void t.Transforms.setNodes(e,{type:"paragraph"});if(n){t.Transforms.setNodes(e,{listStyleType:n});const o=t.Editor.range(e,e.selection).anchor.path;let a=o;3===o.length?a=a.slice(0,1):4===o.length&&(a=a.slice(0,2)),t.Transforms.setNodes(e,{type:r},{at:a})}else{t.Transforms.unwrapNodes(e,{match:e=>a&&!t.Editor.isEditor(e)&&t.Element.isElement(e)&&e.type===r,split:!0});const n={type:o?"paragraph":a?"list-item":r};if(t.Transforms.setNodes(e,n),!o&&a){const n={type:r,children:[]};t.Transforms.wrapNodes(e,n)}}},isAlignActive(e,r){const[n]=t.Editor.nodes(e,{match:e=>e.align===r});return!!n},toggleAlign(e,r){const n=H.isAlignActive(e,r);["alignLeft","center","right"].forEach(r=>{t.Transforms.unsetNodes(e,{align:r})}),n||t.Transforms.setNodes(e,{align:r})},canIndent(e,r){const[n]=t.Editor.nodes(e,{match:e=>"list-item"===e.type});if(n){const[,e]=n;if("indent"===r)return!(e.length>2);if(e.length>2)return!0}return!1},handleIndent(e){const[r]=t.Editor.nodes(e,{match:e=>"list-item"===e.type});if(r){const[,o]=r,a=t.Editor.above(e,{match:e=>["bullet-list","numbered-list"].includes(e.type)})[0].type;try{const r=t.Path.parent(t.Path.parent(o)),n=t.Editor.node(e,r);if(t.Element.isElement(n[0])&&n[0].type===a)return;const s={type:a,children:[]},l=[o[0],o[1]+1];t.Transforms.insertNodes(e,s,{at:l});const i={...t.Editor.node(e,o)[0]},c=[o[0],o[1]+1,0];t.Transforms.insertNodes(e,i,{at:c}),t.Transforms.removeNodes(e,{at:o}),t.Transforms.setNodes(e,{type:"list-item"},{at:[o[0],o[1],0]})}catch(n){}}},handleOutdent(e){const[r]=t.Editor.nodes(e,{match:e=>"list-item"===e.type});if(r){const[,o]=r,a=t.Editor.above(e,{match:e=>["bullet-list","numbered-list"].includes(e.type)})[0].type;try{const r=t.Path.parent(o),n=t.Editor.node(e,r);t.Element.isElement(n)&&n.type===a?t.Transforms.liftNodes(e,{at:o}):t.Transforms.unwrapNodes(e,{at:r,match:e=>t.Element.isElement(e)&&e.type===a,split:!0}),t.Transforms.setNodes(e,{type:"list-item"},{at:o})}catch(n){}}},isLinkActive(e){const{selection:r}=e;if(!r)return!1;const[n]=t.Editor.nodes(e,{match:e=>!t.Editor.isEditor(e)&&t.Node.isNode(e)&&"link"===e.type});return!!n},updateLink(e,r,n){const o=n?"_blank":"_self",a=n?"noopener noreferrer":"";if(H.isLinkActive(e))t.Transforms.setNodes(e,{href:r,target:o,rel:a},{match:e=>"link"===e.type});else{const{selection:n}=e;if(!n||t.Range.isCollapsed(n))return;const s={text:r};t.Range.isCollapsed(n)?t.Transforms.insertNodes(e,{type:"link",href:r,target:o,rel:a,children:[s]}):t.Transforms.setNodes(e,{type:"link",href:r,target:o,rel:a},{match:e=>t.Text.isText(e),split:!0}),t.Transforms.removeNodes(e,{match:e=>"paragraph"===e.type&&0===e.children.length})}},removeLink(e){if(e.selection){const{selection:r}=e,[n,o]=t.Editor.node(e,r);if(n&&"link"===n.type){const r=n.text,a=t.Path.parent(o),s=t.Node.get(e,a);t.Transforms.insertNodes(e,{type:"list-item"!==s.type?s.type:"paragraph",text:r},{at:o,match:e=>t.Text.isText(e)}),t.Transforms.removeNodes(e,{at:o})}}},applyTextColor(e,r){const{selection:n}=e;n&&t.Editor.addMark(e,"color",r)},applyBackgroundTextColor(e,r){const{selection:n}=e;n&&t.Editor.addMark(e,"bgColor",r)},applyFontSize(e,r){const{selection:n}=e;n&&t.Editor.addMark(e,"fontSize",r)},applyFontFamily(e,r){const{selection:n}=e;n&&t.Editor.addMark(e,"fontFamily",r)},isSelectionInCode(e){const[r]=t.Editor.nodes(e,{match:e=>t.Element.isElement(e)&&"code"===e.type});return!!r},getCurrentCodeLanguage(e){const[r]=t.Editor.nodes(e,{match:e=>t.Element.isElement(e)&&"code"===e.type});return r?r[0].language:"plaintext"},handleCode(e,r){const{selection:n}=e;if(n){const[n]=t.Editor.nodes(e,{match:e=>"paragraph"===e.type});if(n){const[,o]=n,a={type:"code",language:r,children:[{text:n[0].children.map(e=>e.text).join("")}]};t.Transforms.setNodes(e,a,{at:o}),t.Transforms.select(e,o)}else{const[n]=t.Editor.nodes(e,{match:e=>"code"===e.type});if(n){const[,o]=n;if("init"===r){const r={type:"paragraph",children:[{text:n[0].children.map(e=>e.text).join("")}]};t.Transforms.setNodes(e,r,{at:o}),t.Transforms.unsetNodes(e,"language",{at:o}),t.Transforms.select(e,o)}else t.Transforms.setNodes(e,{language:r},{at:o}),t.Transforms.select(e,o)}}}},toggleBlockquote(e){const r=this.isBlockquoteActive(e);t.Transforms.setNodes(e,{type:r?"paragraph":"blockquote"},{match:r=>t.Element.isElement(r)&&t.Editor.isBlock(e,r)})},isBlockquoteActive(e){const[r]=t.Editor.nodes(e,{match:e=>t.Element.isElement(e)&&"blockquote"===e.type});return!!r},insertCodeBlock(e,r){const n={type:"code",language:this.getCurrentCodeLanguage(e),children:[{text:r}]},{selection:o}=e;if(!o)return;const[a,s]=t.Editor.parent(e,o);!t.Element.isElement(a)||"paragraph"!==a.type&&"code"!==a.type||""!==t.Node.string(a)||t.Transforms.removeNodes(e,{at:s}),t.Transforms.insertNodes(e,n);const l=t.Editor.end(e,[]);t.Transforms.select(e,l)},insertImage(e,r){const n={type:"image",url:r,children:[{text:""}]};t.Transforms.insertNodes(e,n),t.Transforms.insertNodes(e,{type:"paragraph",children:[{text:""}]})},handleFileChange(e,t){if(e.target.files[0]){const r=e.target.files[0];if(r){const e=new Image,n=new FileReader;n.onload=n=>{"image/svg+xml"===r.type?this.insertImage(t,n.target.result):(e.src=n.target.result,e.onload=()=>{const r=document.createElement("canvas"),n=r.getContext("2d");let o=e.width,a=e.height;o>a?o>800&&(a*=800/o,o=800):a>600&&(o*=600/a,a=600),r.width=o,r.height=a,n.drawImage(e,0,0,o,a);const s=r.toDataURL("image/jpeg");this.insertImage(t,s)},e.onerror=()=>{})},n.onerror=()=>{},n.readAsDataURL(r)}}},insertTable(e,r,n){const o={type:"table",children:Array.from({length:r},()=>({type:"table-row",children:Array.from({length:n},()=>({type:"table-cell",children:[{text:""}]}))}))};t.Transforms.insertNodes(e,o)},isSelectionInTable(e){const[r]=t.Editor.nodes(e,{match:e=>"table"===e.type});return!!r},getTableFromSelection(e){const[r]=t.Editor.nodes(e,{match:e=>"table"===e.type});return r?r[0]:null},addRow(e){var r;const n=H.getTableFromSelection(e);if(n){if(n.children.length>=5)return;const o=null==(r=e.selection)?void 0:r.anchor.path,a=o[1],s={type:"table-row",children:n.children[a].children.map(e=>({...e,children:[{text:""}]}))},l=[o.slice(0,1),a+1];t.Transforms.insertNodes(e,s,{at:l})}},addColumn(e){var r,n;const o=H.getTableFromSelection(e);if(o){if((null==(r=o.children[0])?void 0:r.children.length)>=5)return;const a=null==(n=e.selection)?void 0:n.anchor.path;if(t.Node.get(e,a)){const r=a[a.length-2];void 0!==r&&o.children.forEach((n,o)=>{const s={type:"table-cell",children:[{text:""}]},l=[...a.slice(0,1),o,r+1];l[l.length-1]<=n.children.length&&t.Transforms.insertNodes(e,s,{at:l})})}}},deleteRow(e){var r;const n=H.getTableFromSelection(e);if(n){if(1===n.children.length)return;const o=null==(r=e.selection)?void 0:r.anchor.path,a=o[1];if(void 0!==a){const r=[o[0],a];t.Transforms.removeNodes(e,{at:r})}}},deleteColumn(e){var r,n;const o=H.getTableFromSelection(e);if(o){if(1===(null==(r=o.children[0])?void 0:r.children.length))return;const a=null==(n=e.selection)?void 0:n.anchor.path,s=t.Node.get(e,a),l=a[a.length-1];let i=-1;o.children[l].children.forEach((e,t)=>{e.children[0]===s&&(i=t)}),-1!==i&&o.children.forEach((r,n)=>{if(r.children.length>i){const r=[a[0],n,i];t.Node.get(e,r)&&t.Transforms.removeNodes(e,{at:r})}})}},deleteTable(e){var r;if(H.getTableFromSelection(e)){const n=null==(r=e.selection)?void 0:r.anchor.path.slice(0,1);n.length>0&&t.Transforms.removeNodes(e,{at:n})}},findNearestTable(e){const{selection:r}=e;if(!r)return null;const n=[],o=t.Editor.nodes(e,{match:e=>t.Element.isElement(e)&&"table"===e.type,at:[],mode:"all"});for(const t of o)n.push(t);if(0===n.length)return null;let a=null,s=1/0;for(const[l,i]of n){const e=t.Path.compare(r.anchor.path,i);Math.abs(e)<s&&(s=Math.abs(e),a=[l,i])}return a},insertParagraphBeforeTable(e){const r=this.findNearestTable(e);if(!r)return;const[,n]=r;t.Transforms.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:n})},insertParagraphAfterTable(e){const r=this.findNearestTable(e);if(!r)return;const[,n]=r,o=[n[0]+1];t.Transforms.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o})}},q=({attributes:e,children:t,element:r})=>{const n={textAlign:r.align||"left"};return R.jsx("p",{className:"rtf",style:n,...e,children:t})},V=({attributes:e,children:t,leaf:n})=>{let o=[];n.bold&&o.push("strong"),n.italic&&o.push("em"),n.underline&&o.push("u"),n.strikethrough&&o.push("del"),n.subscript&&!n.superscript&&o.push("sub"),!n.subscript&&n.superscript&&o.push("sup"),n.bgColor&&o.push("mark");const a={color:n.color||void 0,fontSize:n.fontSize||void 0,backgroundColor:n.bgColor||void 0,fontFamily:n.fontFamily||void 0},s=e=>{e.stopPropagation(),"_blank"===n.target?(window.open(n.href,n.target,n.rel?{rel:n.rel}:void 0),e.preventDefault()):window.location.href=n.href};return n.href?R.jsx("a",{...e,href:n.href,target:n.target||"_self",rel:n.rel||"noopener noreferrer",style:a,onClick:s,children:0===o.length?t:o.reduceRight((t,n)=>r.createElement(n,{...e},t),t)}):0===o.length?R.jsx("span",{...e,style:a,className:n.className??"",children:t}):o.reduceRight((t,n)=>r.createElement(n,{...e,style:a},t),t)},Z=({attributes:e,children:t,element:r})=>{const n={textAlign:r.align||"left",listStyleType:r.listStyleType||"disc"};switch(r.type){case"bullet-list":return R.jsx("ul",{className:"rtf",style:n,...e,children:t});case"numbered-list":return R.jsx("ol",{className:"rtf",style:n,...e,children:t});case"list-item":return R.jsx("li",{className:"rtf",style:n,...e,children:t});default:return R.jsx("p",{className:"rtf",style:n,...e,children:t})}},W=({attributes:e,children:t})=>R.jsx("blockquote",{className:"rtf",...e,style:{borderLeft:"4px solid #ccc",paddingLeft:"10px",color:"#666",margin:"20px 0"},children:t});
|
|
58
|
+
/**
|
|
59
|
+
* @license
|
|
60
|
+
* Copyright (c) 2025 Jahylis
|
|
61
|
+
*
|
|
62
|
+
* This file is part of ReactTextForge.
|
|
63
|
+
*
|
|
64
|
+
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
65
|
+
* it under the terms of the MIT License as published by
|
|
66
|
+
* the Open Source Initiative.
|
|
67
|
+
*
|
|
68
|
+
* ReactTextForge is distributed in the hope that it will be useful,
|
|
69
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
70
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
71
|
+
* MIT License for more details.
|
|
72
|
+
*
|
|
73
|
+
* You should have received a copy of the MIT License
|
|
74
|
+
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
75
|
+
*
|
|
76
|
+
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* @license
|
|
80
|
+
* Copyright (c) 2025 Jahylis
|
|
81
|
+
*
|
|
82
|
+
* This file is part of ReactTextForge.
|
|
83
|
+
*
|
|
84
|
+
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
85
|
+
* it under the terms of the MIT License as published by
|
|
86
|
+
* the Open Source Initiative.
|
|
87
|
+
*
|
|
88
|
+
* ReactTextForge is distributed in the hope that it will be useful,
|
|
89
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
90
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
91
|
+
* MIT License for more details.
|
|
92
|
+
*
|
|
93
|
+
* You should have received a copy of the MIT License
|
|
94
|
+
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
95
|
+
*
|
|
96
|
+
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
97
|
+
*/
|
|
98
|
+
function U(e){let t,r,n;if(e.startsWith("#"))e=e.replace(/^#/,""),t=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,n=parseInt(e.substring(4,6),16)/255;else{if(!e.startsWith("rgb"))throw new Error("Format de couleur non pris en charge");{const o=e.match(/\d+/g).map(Number);t=o[0]/255,r=o[1]/255,n=o[2]/255}}return.2126*(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4))<.5}const G=r.createContext({theme:"light",toggleTheme:()=>{},isDarkTheme:!1}),K=({showTheme:e,backgroundDarkColor:t,borderDarkColor:n,imageDarkColor:o,children:a})=>{const[s,l]=r.useState("light");r.useEffect(()=>{if(e){const e=window.matchMedia("(prefers-color-scheme: dark)");l(e.matches?"dark":"light");const t=e=>{l(e.matches?"dark":"light")};return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}}},[]),r.useEffect(()=>{document.documentElement.setAttribute("data-theme",s)},[s]);return R.jsx(G.Provider,{value:{theme:s,toggleTheme:()=>{l(e=>"light"===e?"dark":"light")},showTheme:e,isDarkTheme:"dark"===s,backgroundDarkColor:t,borderDarkColor:n,imageDarkColor:o},children:a})},X=()=>r.useContext(G),J=r.createContext(),Y=({backgroundColor:e,borderColor:t,imageColor:n,editor:o,children:a})=>{const{showTheme:s,isDarkTheme:l,backgroundDarkColor:i,borderDarkColor:c,imageDarkColor:u}=X(),d=s&&l?i:e,p=s&&l?c:t,g=s&&l?u:n;return r.useEffect(()=>{document.documentElement.style.setProperty("--background-color",d),document.documentElement.style.setProperty("--border-color",p),document.documentElement.style.setProperty("--image-color",g)},[d,p,g]),R.jsx(J.Provider,{value:{backgroundColor:d,borderColor:p,editor:o,imageColor:g},children:R.jsx("div",{className:"rtf react-text-forge",style:{backgroundColor:d,borderColor:p},children:a})})},Q=()=>r.useContext(J),ee=({onChange:e,selectStyle:t,toggleForm:r})=>{const{editor:n}=Q();return R.jsx("ul",{onMouseLeave:()=>r(!1),style:t,className:"rtf dropdown-menu",children:[{value:"disc",label:"Disque"},{value:"circle",label:"Cercle"},{value:"square",label:"Carré"},{value:"'✔'",label:"Check"},{value:"'✘'",label:"Croix"},{value:"'➢'",label:"Petite flèche"},{value:"'➔'",label:"Flèche épaisse"}].map(r=>R.jsx("li",{value:r.value,onClick:()=>e(r.value),style:{backgroundColor:`${r.value===H.getListStyleType(n)?`color-mix(in srgb, ${t.backgroundColor} 80%, ${U(t.backgroundColor)?"white":"black"})`:t.backgroundColor}`},children:r.label},r.value))})},te=({onChange:e,selectStyle:t,toggleForm:r})=>{const{editor:n}=Q();return R.jsx("ul",{onMouseLeave:()=>r(!1),style:t,className:"rtf dropdown-menu",children:[{value:"decimal",label:"Décimal"},{value:"upper-roman",label:"Lettres Romaines majuscules"},{value:"lower-roman",label:"Lettres Romaines minuscules"},{value:"upper-greek",label:"Lettres Grecques majuscules"},{value:"lower-greek",label:"Lettres Grecques minuscules"}].map(r=>R.jsx("li",{value:r.value,onClick:()=>e(r.value),style:{backgroundColor:`${r.value===H.getListStyleType(n)?`color-mix(in srgb, ${t.backgroundColor} 80%, ${U(t.backgroundColor)?"white":"black"})`:t.backgroundColor}`},children:r.label},r.value))})};
|
|
99
|
+
/**
|
|
100
|
+
* @license
|
|
101
|
+
* Copyright (c) 2025 Jahylis
|
|
102
|
+
*
|
|
103
|
+
* This file is part of ReactTextForge.
|
|
104
|
+
*
|
|
105
|
+
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
106
|
+
* it under the terms of the MIT License as published by
|
|
107
|
+
* the Open Source Initiative.
|
|
108
|
+
*
|
|
109
|
+
* ReactTextForge is distributed in the hope that it will be useful,
|
|
110
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
111
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
112
|
+
* MIT License for more details.
|
|
113
|
+
*
|
|
114
|
+
* You should have received a copy of the MIT License
|
|
115
|
+
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
116
|
+
*
|
|
117
|
+
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
118
|
+
*/
|
|
119
|
+
function re({format:e,imageColor:t}){return(()=>{switch(e){case"addColumn":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("g",{id:"Edit / Add_Column",children:R.jsx("path",{id:"Vector",d:"M5 17H8M8 17H11M8 17V14M8 17V20M14 21H15C16.1046 21 17 20.1046 17 19V5C17 3.89543 16.1046 3 15 3H13C11.8954 3 11 3.89543 11 5V11",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"addRow":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("g",{id:"Edit / Add_Row",children:R.jsx("path",{id:"Vector",d:"M3 14V15C3 16.1046 3.89543 17 5 17L19 17C20.1046 17 21 16.1046 21 15L21 13C21 11.8954 20.1046 11 19 11H13M10 8H7M7 8H4M7 8V5M7 8V11",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"bgColor":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M86.6 9.4C74.1-3.1 53.9-3.1 41.4 9.4s-12.5 32.8 0 45.3L122.7 136 30.6 228.1c-37.5 37.5-37.5 98.3 0 135.8L148.1 481.4c37.5 37.5 98.3 37.5 135.8 0L474.3 290.9c28.1-28.1 28.1-73.7 0-101.8L322.9 37.7c-28.1-28.1-73.7-28.1-101.8 0L168 90.7 86.6 9.4zM168 181.3l49.4 49.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L213.3 136l53.1-53.1c3.1-3.1 8.2-3.1 11.3 0L429.1 234.3c3.1 3.1 3.1 8.2 0 11.3L386.7 288 67.5 288c1.4-5.4 4.2-10.4 8.4-14.6L168 181.3z"})});case"blockCode":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none",children:R.jsx("path",{fill:t,fillRule:"evenodd",d:"M2 6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V6zm5 1a1 1 0 0 0 0 2h5a1 1 0 1 0 0-2H7zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2zm-8 4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2H7zm4 0a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6zm-4 4a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2H7zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2z",clipRule:"evenodd"})});case"blockquote":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"})});case"bold":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:R.jsx("path",{fill:t,d:"M0 64C0 46.3 14.3 32 32 32l48 0 16 0 128 0c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128L96 480l-16 0-48 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-160L48 96 32 96C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64L112 96l0 128 112 0zM112 288l0 128 144 0c35.3 0 64-28.7 64-64s-28.7-64-64-64l-32 0-112 0z"})});case"bulletList":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"})});case"center":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"})});case"color":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M512 256c0 .9 0 1.8 0 2.7c-.4 36.5-33.6 61.3-70.1 61.3L344 320c-26.5 0-48 21.5-48 48c0 3.4 .4 6.7 1 9.9c2.1 10.2 6.5 20 10.8 29.9c6.1 13.8 12.1 27.5 12.1 42c0 31.8-21.6 60.7-53.4 62c-3.5 .1-7 .2-10.6 .2C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM128 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm0-96a32 32 0 1 0 0-64 32 32 0 1 0 0 64zM288 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm96 96a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"})});case"deleteColumn":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("g",{id:"Edit / Delete_Column",children:R.jsx("path",{id:"Vector",d:"M10 21H9C7.89543 21 7 20.1046 7 19V5C7 3.89543 7.89543 3 9 3H11C12.1046 3 13 3.89543 13 5V11M19 16H13",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"deleteRow":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("g",{id:"Edit / Delete_Row",children:R.jsx("path",{id:"Vector",d:"M14 16H20M21 10V9C21 7.89543 20.1046 7 19 7H5C3.89543 7 3 7.89543 3 9V11C3 12.1046 3.89543 13 5 13H11",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"deleteTable":return R.jsx("svg",{className:"rtf",fill:t,width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("path",{d:"M1800 1740c0 33-26.88 60-60 60H180c-33.12 0-60-27-60-60V180c0-33.12 26.88-60 60-60h1560c33.12 0 60 26.88 60 60v1560ZM1740 0H180C80.76 0 0 80.76 0 180v1560c0 99.24 80.76 180 180 180h1560c99.24 0 180-80.76 180-180V180c0-99.24-80.76-180-180-180Zm-235.08 245.388L960 790.308l-544.92-544.92-169.68 169.68 544.92 544.92-544.92 544.92 169.68 169.68L960 1129.668l544.92 544.92 169.68-169.68-544.92-544.92 544.92-544.92-169.68-169.68Z",fillRule:"evenodd"})});case"enter":return R.jsx("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:R.jsx("path",{stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M20 7V8.2C20 9.88016 20 10.7202 19.673 11.362C19.3854 11.9265 18.9265 12.3854 18.362 12.673C17.7202 13 16.8802 13 15.2 13H4M4 13L8 9M4 13L8 17"})});case"fullscreen":return R.jsxs("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:[R.jsx("path",{fill:t,d:"M4 2C2.89543 2 2 2.89543 2 4V8C2 8.55228 2.44772 9 3 9C3.55228 9 4 8.55228 4 8V4H8C8.55228 4 9 3.55228 9 3C9 2.44772 8.55228 2 8 2H4Z"}),R.jsx("path",{fill:t,d:"M20 2C21.1046 2 22 2.89543 22 4V8C22 8.55228 21.5523 9 21 9C20.4477 9 20 8.55228 20 8V4H16C15.4477 4 15 3.55228 15 3C15 2.44772 15.4477 2 16 2H20Z"}),R.jsx("path",{fill:t,d:"M20 22C21.1046 22 22 21.1046 22 20V16C22 15.4477 21.5523 15 21 15C20.4477 15 20 15.4477 20 16V20H16C15.4477 20 15 20.4477 15 21C15 21.5523 15.4477 22 16 22H20Z"}),R.jsx("path",{fill:t,d:"M2 20C2 21.1046 2.89543 22 4 22H8C8.55228 22 9 21.5523 9 21C9 20.4477 8.55228 20 8 20H4V16C4 15.4477 3.55228 15 3 15C2.44772 15 2 15.4477 2 16V20Z"})]});case"fullscreenExit":return R.jsxs("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:[R.jsx("path",{fill:t,d:"M7 9C8.10457 9 9 8.10457 9 7V3C9 2.44772 8.55228 2 8 2C7.44772 2 7 2.44772 7 3V7H3C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9H7Z"}),R.jsx("path",{fill:t,d:"M17 9C15.8954 9 15 8.10457 15 7V3C15 2.44772 15.4477 2 16 2C16.5523 2 17 2.44772 17 3V7H21C21.5523 7 22 7.44772 22 8C22 8.55228 21.5523 9 21 9H17Z"}),R.jsx("path",{fill:t,d:"M17 15C15.8954 15 15 15.8954 15 17V21C15 21.5523 15.4477 22 16 22C16.5523 22 17 21.5523 17 21V17H21C21.5523 17 22 16.5523 22 16C22 15.4477 21.5523 15 21 15H17Z"}),R.jsx("path",{fill:t,d:"M9 17C9 15.8954 8.10457 15 7 15H3C2.44772 15 2 15.4477 2 16C2 16.5523 2.44772 17 3 17H7V21C7 21.5523 7.44772 22 8 22C8.55228 22 9 21.5523 9 21V17Z"})]});case"fontFamily":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M254 52.8C249.3 40.3 237.3 32 224 32s-25.3 8.3-30 20.8L57.8 416 32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-1.8 0 18-48 159.6 0 18 48-1.8 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-25.8 0L254 52.8zM279.8 304l-111.6 0L224 155.1 279.8 304z"})});case"href":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:R.jsx("path",{fill:t,d:"M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"})});case"image":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"})});case"indent":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3L0 176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"})});case"italic":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:R.jsx("path",{fill:t,d:"M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0L160 416l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0L224 96l-64 0c-17.7 0-32-14.3-32-32z"})});case"left":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"})});case"more":return R.jsx("svg",{className:"rtf",viewBox:"0 0 20 20",fill:"none",children:R.jsx("path",{fill:t,fillRule:"evenodd",d:"M12 3a2 2 0 10-4 0 2 2 0 004 0zm-2 5a2 2 0 110 4 2 2 0 010-4zm0 7a2 2 0 110 4 2 2 0 010-4z"})});case"numberedList":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"})});case"outdent":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM.2 268.6c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6l0 158.6c0 13.3-15.3 20.8-25.8 12.6L.2 268.6z"})});case"redo":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"})});case"right":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"})});case"size":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:R.jsx("path",{fill:t,d:"M64 128l0-32 64 0 0 320-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320 64 0 0 32c0 17.7 14.3 32 32 32s32-14.3 32-32l0-48c0-26.5-21.5-48-48-48L160 32 48 32C21.5 32 0 53.5 0 80l0 48c0 17.7 14.3 32 32 32s32-14.3 32-32zM502.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l32 0 0 192-32 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8l-32 0 0-192 32 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-64-64z"})});case"strikethrough":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"})});case"subscript":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64zM480 320c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 361.5 404.3 368 416 368l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128z"})});case"superscript":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M480 32c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 73.5 404.3 80 416 80l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128zM32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64z"})});case"table":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M64 256l0-96 160 0 0 96L64 256zm0 64l160 0 0 96L64 416l0-96zm224 96l0-96 160 0 0 96-160 0zM448 256l-160 0 0-96 160 0 0 96zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"})});case"underline":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M16 64c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 53 43 96 96 96s96-43 96-96l0-128-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 88.4-71.6 160-160 160s-160-71.6-160-160L64 96 48 96C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32z"})});case"undo":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"})});default:return null}})()}const ne=({format:e,isActive:t,onMouseDown:n})=>{const{backgroundColor:o,editor:a,imageColor:s}=Q(),[l,i]=r.useState(!1),c={backgroundColor:o,color:s},u=t=>{H.toggleBlock(a,"bulletList"===e?"bullet-list":"numbered-list",t),i(!1)};return R.jsxs(R.Fragment,{children:[R.jsxs("button",{className:"rtf tool",children:[R.jsx("div",{onMouseDown:t=>{t.preventDefault(),n(e)},children:R.jsx(re,{format:e,imageColor:s})}),t&&R.jsx("div",{className:"rtf tool tool--arrow",style:{color:c.color},onClick:()=>i(!l),children:l?"↑":"↓"})]}),l&&("bulletList"===e?R.jsx(ee,{selectStyle:c,onChange:u,toggleForm:i}):R.jsx(te,{selectStyle:c,onChange:u,toggleForm:i}))]})};function oe({disabled:e=!1,elements:t,elementSelected:r,format:n,isOpen:o,setIsOpen:a,onClick:s}){const{backgroundColor:l,imageColor:i}=Q(),c=()=>{a(!o)};return R.jsxs("div",{className:"rtf dropdown tool",children:[R.jsx("button",{onClick:c,className:"rtf dropdown-toggle",disabled:e,children:R.jsx(re,{format:n,imageColor:i})}),o&&R.jsx("ul",{style:{backgroundColor:l,color:i},className:"rtf dropdown-menu",onMouseLeave:c,children:t.map((e,t)=>R.jsx("li",{style:{backgroundColor:`${r&&e===r?`color-mix(in srgb, ${l} 80%, ${U(l)?"white":"black"})`:l}`},onClick:()=>(e=>{s(e),a(!1)})(e),children:e},t))})]})}const ae=({disabled:e,sizeSelected:t,onSelectSize:n})=>{const[o,a]=r.useState(!1);return R.jsx(oe,{disabled:e,elements:["10px","12px","14px","16px","18px","20px","24px","28px","36px"],elementSelected:t,format:"size",isOpen:o,setIsOpen:a,onClick:n})},se=({fontFamilySelected:e,onSelectFontFamily:t})=>{const[n,o]=r.useState(!1);return R.jsx(oe,{elements:["Arial","Arial Black","Bookman","Comic Sans MS","Courier","Courier New","Garamond","Georgia","Helvetica","Impact","Palatino","Times","Times New Roman","Trebuchet MS","Verdana"],elementSelected:e,format:"fontFamily",isOpen:n,setIsOpen:o,onClick:t})},le=({onClose:e,initialUrl:t="",isOpenInNewTab:o})=>{const[a,s]=r.useState(""),{editor:l,backgroundColor:i,imageColor:c}=Q(),[u,d]=r.useState(!1),[p,g]=r.useState(l.selection),f={backgroundColor:i,color:c},m={color:U(i)?"#FFF":"#000"},h={backgroundColor:`color-mix(in srgb, ${i} 80%, ${U(i)?"white":"black"})`,color:m.color},b={backgroundColor:"#800020"!==i?"#800020":"color-mix(in srgb, #800020 80%, black)",color:m.color},y={backgroundColor:"#6c757d"!==i?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:m.color},x=()=>{a&&(H.updateLink(l,a,u),e())},v=()=>{p&&n.ReactEditor.focus(l)};return r.useEffect(()=>{l.selection&&g(l.selection)},[]),r.useEffect(()=>{s(t),d(o)},[t,o]),R.jsxs("div",{onMouseLeave:e,style:f,className:"rtf link-form",children:[R.jsx("input",{className:"rtf",type:"text",placeholder:"Enter URL",value:a,onBlur:v,onChange:e=>s(e.target.value)}),R.jsxs("label",{className:"rtf",children:[R.jsx("input",{className:"rtf",type:"checkbox",checked:u,onBlur:v,onChange:()=>d(!u)}),"Ouvrir dans un nouvel onglet"]}),R.jsxs("div",{className:"rtf link-form-actions",children:[t?R.jsxs(R.Fragment,{children:[R.jsx("button",{className:"rtf",style:h,onClick:x,children:"Modifier"}),R.jsx("button",{className:"rtf",style:b,onClick:()=>{H.removeLink(l),e()},children:"Supprimer"})]}):R.jsx("button",{className:"rtf",style:h,onClick:x,children:"Valider"}),R.jsx("button",{className:"rtf",style:y,onClick:e,children:"Annuler"})]})]})};
|
|
120
|
+
/**
|
|
121
|
+
* @license
|
|
122
|
+
* Copyright (c) 2025 Jahylis
|
|
123
|
+
*
|
|
124
|
+
* This file is part of ReactTextForge.
|
|
125
|
+
*
|
|
126
|
+
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
127
|
+
* it under the terms of the MIT License as published by
|
|
128
|
+
* the Open Source Initiative.
|
|
129
|
+
*
|
|
130
|
+
* ReactTextForge is distributed in the hope that it will be useful,
|
|
131
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
132
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
133
|
+
* MIT License for more details.
|
|
134
|
+
*
|
|
135
|
+
* You should have received a copy of the MIT License
|
|
136
|
+
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
137
|
+
*
|
|
138
|
+
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
139
|
+
*/
|
|
140
|
+
function ie(e){const[n,o]=r.useState(""),[a,s]=r.useState(""),[l,i]=r.useState(!1),[c,u]=r.useState(""),[d,p]=r.useState(""),[g,f]=r.useState("paragraph"),[m,h]=r.useState(!1),[b,y]=r.useState(""),[x,v]=r.useState(!1),k=()=>{h(!m)};return{activeBlock:g,colorMode:a,setColorMode:s,openInNewTab:l,setOpenInNewTab:i,selectedBackgroundColor:d,setSelectedBackgroundColor:p,selectedColor:c,setSelectedColor:u,selectedLanguage:b,setSelectedLanguage:y,selectedLink:n,setSelectedLink:o,showColorPicker:m,showLinkForm:x,setShowLinkForm:v,detectCurrentLanguage:()=>{const{selection:r}=e;if(r){const[r]=t.Editor.nodes(e,{match:e=>"code"===e.type});y(r?r[0].language:null)}},toggleLinkForm:()=>{v(!x)},toggleColorPicker:k,handleColorChange:t=>{H.applyTextColor(e,t),k()},handleBackgroundColorChange:t=>{H.applyBackgroundTextColor(e,t),k()},handleBlockTypeChange:t=>{H.toggleBlock(e,t),f(t)}}}function ce({selectedColor:e,onSelectColor:t,onClose:o}){const[s,l]=r.useState("#ffffff"),{editor:i,backgroundColor:c,borderColor:u,imageColor:d}=Q(),p={backgroundColor:c,color:d},g={backgroundColor:`color-mix(in srgb, ${c} 80%, ${U(c)?"white":"black"})`,color:U(c)?"#FFF":"#000"},f={backgroundColor:"#6c757d"!==c?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:U(c)?"#FFF":"#000"},m={default:{picker:{background:c,color:d,border:u}}};return r.useEffect(()=>{e&&l(e)},[e]),R.jsxs("div",{onMouseLeave:o,className:"rtf color-picker-popup",children:[R.jsx(a.SketchPicker,{styles:m,color:s,onChangeComplete:e=>{n.ReactEditor.focus(i),l(e.hex)}}),R.jsxs("div",{style:p,className:"rtf link-form-actions",children:[R.jsx("button",{className:"rtf",style:g,onClick:()=>{s&&(t(s),o())},disabled:!s,children:"Appliquer"}),R.jsx("button",{className:"rtf",style:f,onClick:()=>{t(""),o()},children:"Annuler"})]})]})}const ue=()=>{const{editor:e,backgroundColor:t,imageColor:r}=Q(),n=H.isBlockquoteActive(e);return R.jsx("button",{onMouseDown:t=>{t.preventDefault(),H.toggleBlockquote(e)},style:{backgroundColor:n?`color-mix(in srgb, ${t} 80%, ${U(t)?"white":"black"})`:""},className:"rtf tool",children:R.jsx(re,{format:"blockquote",imageColor:r})})},de=({text:e,children:t,position:n="top"})=>{var o;const[a,s]=r.useState(!1),{isDarkTheme:l,backgroundDarkColor:i,imageDarkColor:c}=X(),u=r.Children.count(t),d=r.Children.map(t,e=>e);return R.jsxs("div",{className:"tooltip-container",style:{display:1===u&&"none"===(null==(o=d[0].props.style)?void 0:o.display)?"none":"inline-block"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[t,a&&R.jsx("div",{style:{backgroundColor:l?"black":i,color:c,borderColor:c},className:`tooltip tooltip--${n} tooltip--visible`,role:"tooltip","aria-label":e,children:e})]})},pe=({activeMarks:e,format:o,isActive:a,tooltip:s})=>{const[l,i]=r.useState(""),{backgroundColor:c,editor:u,imageColor:d}=Q(),{activeBlock:p,colorMode:g,setColorMode:f,openInNewTab:m,detectCurrentLanguage:h,handleColorChange:b,handleBackgroundColorChange:y,setOpenInNewTab:x,selectedBackgroundColor:v,setSelectedBackgroundColor:k,selectedColor:w,setSelectedColor:C,selectedLink:j,setSelectedLink:F,showColorPicker:S,showLinkForm:N,setShowLinkForm:E,toggleColorPicker:L,toggleLinkForm:T}=ie(u),A="h1"===p||"h2"===p,$=["left","center","right"],M=()=>{setTimeout(()=>n.ReactEditor.focus(u),0)};return r.useEffect(()=>{h();const{selection:e}=u;if(e){const[e]=t.Editor.nodes(u,{match:e=>"link"===e.type});e?(x("_blank"===e[0].target),F(e[0].href)):(x(!1),F(""))}},[u.selection]),R.jsx(de,{text:s,position:"bottom",children:"indent"===o||"outdent"===o?R.jsx("div",{children:R.jsx("button",{title:s,className:"rtf tool",onClick:()=>"indent"===o?H.handleIndent(u):H.handleOutdent(u),disabled:!a,children:R.jsx(re,{format:o,imageColor:a?d:`color-mix(in srgb, ${d} 40%, black)`})})}):"fontSize"===o?R.jsx(ae,{disabled:A,onSelectSize:e=>{H.applyFontSize(u,e)},sizeSelected:a}):"fontFamily"===o?R.jsx(se,{fontFamilySelected:l,onSelectFontFamily:e=>{H.applyFontFamily(u,e),i(e)}}):"bulletList"===o||"numberedList"===o?R.jsx("div",{className:"rtf dropdown",children:R.jsx(ne,{format:o,isActive:a,onMouseDown:()=>{o="bulletList"===o?"bullet-list":"numbered-list",H.toggleBlock(u,o)}})}):"href"===o?R.jsxs("div",{className:"rtf dropdown",children:[R.jsx("button",{onMouseDown:e=>{e.preventDefault(),M(),T()},title:s,className:"rtf tool tool--"+(a?"active":"inactive"),children:R.jsx(re,{format:o,imageColor:d})}),N&&R.jsx(le,{onClose:()=>E(!1),initialUrl:j,isOpenInNewTab:m})]}):"color"===o||"bgColor"===o?R.jsxs("div",{className:"rtf dropdown",children:[R.jsx("button",{title:s,onMouseDown:t=>{t.preventDefault(),M(),"color"===o?(C(e[o]),f("color"),L()):(k(e[o]),f("bgColor"),L())},className:"rtf tool tool--"+(a?"active":"inactive"),children:R.jsx(re,{format:o,imageColor:d})}),S&&R.jsx(ce,{selectedColor:"color"===g?w:v,onSelectColor:"color"===g?b:y,onClose:L})]}):"blockquote"===o?R.jsx(ue,{tooltip:s}):R.jsx("button",{onMouseDown:e=>{e.preventDefault(),$.includes(o)?H.toggleAlign(u,o):H.toggleMark(u,o)},title:s,style:{backgroundColor:a?`color-mix(in srgb, ${c} 80%, ${U(c)?"white":"black"})`:""},className:"rtf tool",children:R.jsx(re,{format:o,imageColor:d})})})},ge=r.forwardRef(({tooltip:e},t)=>{const{backgroundColor:r,imageColor:n}=Q(),{editor:o}=Q(),{activeBlock:a,handleBlockTypeChange:s}=ie(o),l={backgroundColor:r,color:n};return R.jsx(de,{text:e,position:"bottom",children:R.jsx("select",{ref:t,className:"rtf",value:a,onChange:e=>{const t=e.target.value;s(t)},style:l,children:[{type:"paragraph",name:"Paragraphe"},{type:"h1",name:"Titre"},{type:"h2",name:"Sous-titre"}].map(e=>R.jsx("option",{className:"rtf",value:e.type,children:e.name},e.type))})})}),fe=r.forwardRef((e,t)=>{const[n,o]=r.useState(!1),{backgroundColor:a,editor:s,imageColor:l}=Q(),{selectedLanguage:i,setSelectedLanguage:c}=ie(s),u={backgroundColor:a,color:l},d={cs:"C#",cpp:"C++",css:"CSS",diff:"Diff",html:"HTML",java:"Java",javascript:"JavaScript",php:"PHP",python:"Python",ruby:"Ruby",typescript:"TypeScript",xml:"XML"},p=()=>{o(!n)},g=e=>{c(e),H.handleCode(s,e),o(!1)};return R.jsxs("div",{ref:t,className:"rtf dropdown tool "+(i&&"init"!==i&&""!==i?"tool--active":""),children:[R.jsx("button",{className:"rtf dropdown-toggle",onClick:p,children:R.jsx(re,{format:"blockCode",imageColor:l})}),n&&R.jsxs("ul",{style:u,onMouseLeave:p,className:"rtf dropdown-menu",children:[i&&R.jsx("li",{onClick:()=>g("init"),children:"Réinitialiser"}),Object.keys(d).map(e=>R.jsx("li",{onClick:()=>g(e),style:{cursor:"pointer",padding:"5px 10px",backgroundColor:i&&e===i?`color-mix(in srgb, ${a} 80%, ${U(a)?"white":"black"})`:a},children:d[e]},e))]})]})}),me=r.forwardRef((e,t)=>{const{editor:r,imageColor:n}=Q();return R.jsxs("div",{className:"rtf tool image-upload-container",ref:t,children:[R.jsx("input",{id:"file-input",type:"file",accept:"image/*",onChange:e=>H.handleFileChange(e,r),className:"rtf hidden-file-input"}),R.jsx("label",{htmlFor:"file-input",className:"rtf image-upload-label",children:R.jsx(re,{format:"image",imageColor:n})})]})}),he=({onClose:e})=>{const{editor:t,backgroundColor:n}=Q(),[o,a]=r.useState(0),[s,l]=r.useState(0),i={backgroundColor:n,color:U(n)?"#FFF":"#000"},c=(e,t)=>{a(e),l(t)},u=(r,n)=>{H.insertTable(t,r+1,n+1),e()};return R.jsxs("div",{style:i,className:"rtf dropdown-menu table-grid-form",children:[R.jsx("div",{className:"rtf grid-container",children:(()=>{const e=[];for(let t=0;t<5;t++)for(let r=0;r<5;r++){const n=t<=o&&r<=s;e.push(R.jsx("div",{className:"rtf grid-cell "+(n?"hovered":""),onMouseEnter:()=>c(t,r),onClick:()=>u(t,r)},`${t}-${r}`))}return e})()}),R.jsxs("div",{style:i,className:"rtf table-size-indicator",children:["Tableau de ",o+1," lignes x ",s+1," colonnes"]})]})},be=r.forwardRef(({allButtons:e,hiddenButtons:t},r)=>{const{editor:n,imageColor:o}=Q(),a=H.isSelectionInTable(n),s=[{name:"deleteTable",alt:"Supprimer le tableau",onClick:H.deleteTable},{name:"addRow",alt:"Ajouter une ligne",onClick:H.addRow},{name:"addColumn",alt:"Ajouter une colonne",onClick:H.addColumn},{name:"deleteRow",alt:"Supprimer une ligne",onClick:H.deleteRow},{name:"deleteColumn",alt:"Supprimer une colonne",onClick:H.deleteColumn}];return R.jsx(R.Fragment,{children:s.map((s,l)=>{var i,c;return R.jsx(de,{text:e.find(e=>e.format===s.name).tooltip,position:"bottom",children:R.jsx("button",{ref:e=>r.current[s.name]=e,className:"rtf tool",style:{display:t.includes(s.name)?"none":"inline-block"},onClick:()=>s.onClick(n),disabled:!a,children:R.jsx(re,{format:s.name,imageColor:a?H.getTableFromSelection(n)?"addRow"===s.name?H.getTableFromSelection(n).children.length>=5?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:"addColumn"===s.name?(null==(i=H.getTableFromSelection(n).children[0])?void 0:i.children.length)>=5?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:"deleteColumn"===s.name?1===(null==(c=H.getTableFromSelection(n).children[0])?void 0:c.children.length)?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:"deleteRow"===s.name&&1===H.getTableFromSelection(n).children.length?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:o:`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`})})},l)})})}),ye=({activeMarks:e})=>{const[t,n]=r.useState(!1),[o,a]=r.useState([]),s=r.useRef(null),l=r.useRef({}),{editor:i,imageColor:c,backgroundColor:u}=Q(),d=[{format:"blockType",tooltip:"Insérer un bloc de texte"},{format:"bold",tooltip:"Gras (Ctrl+B)"},{format:"underline",tooltip:"Souligné (Ctrl+U)"},{format:"italic",tooltip:"Italique (Ctrl+I)"},{format:"strikethrough",tooltip:"Barré"},{format:"subscript",tooltip:"Indice"},{format:"superscript",tooltip:"Exposant"},{format:"blockquote",tooltip:"Citation"},{format:"color",tooltip:"Couleur du texte"},{format:"bgColor",tooltip:"Couleur de fond"},{format:"fontSize",tooltip:"Taille de texte"},{format:"fontFamily",tooltip:"Police d'écriture"},{format:"href",tooltip:"Insérer un lien (Ctrl+K)"},{format:"bulletList",tooltip:"Liste à puces (Ctrl+L)"},{format:"numberedList",tooltip:"Liste à puces (Ctrl+N)"},{format:"left",tooltip:"Gauche"},{format:"center",tooltip:"Centré"},{format:"right",tooltip:"Droite"},{format:"indent",tooltip:"Indenté"},{format:"outdent",tooltip:"Retrait"},{format:"table",tooltip:"Insérer un tableau"},{format:"deleteTable",tooltip:"Supprimer un tableau"},{format:"addRow",tooltip:"Insérer une ligne"},{format:"addColumn",tooltip:"Insérer une colonne"},{format:"deleteRow",tooltip:"Supprimer une ligne"},{format:"deleteColumn",tooltip:"Supprimer une colonne"},{format:"image",tooltip:"Insérer une image"},{format:"code",tooltip:"Bloc de code (Ctrl+E)"},{format:"undo",tooltip:"Annuler (Ctrl+Z)"},{format:"redo",tooltip:"Rétablir (Ctrl+Y)"}],[p,g]=r.useState(!1),f=["deleteTable","addRow","addColumn","deleteRow","deleteColumn"],m=()=>{g(!p)};return r.useEffect(()=>{if(!s.current)return;const e=new ResizeObserver(()=>{(()=>{if(s.current){const e=s.current.clientWidth-15;if(978>e){let t=0;const r=[];d.forEach(n=>{const o=l.current[n.format];o&&(t+=("blockType"===n.format?o.clientWidth:25)+5,t<=e&&r.push(n.format))});const n=d.map(e=>e.format).filter(e=>!r.includes(e));a(n)}else a([])}})()});return e.observe(s.current),()=>{e.disconnect()}},[]),R.jsxs("div",{className:"rtf toolbar-container",children:[R.jsxs("div",{className:"rtf toolbar",onClick:()=>{document.querySelector(".rtf.toolbar").blur()},ref:s,children:[R.jsx(ge,{ref:e=>l.current.blockType=e,tooltip:d.find(e=>"blockType"===e.format).tooltip}),Object.keys(e).map((t,r)=>R.jsx("div",{className:"rtf",ref:e=>l.current[t]=e,style:{display:o.includes(t)?"none":"inline-block"},children:R.jsx(pe,{activeMarks:e,format:t,isActive:e[t],tooltip:d.find(e=>e.format===t).tooltip})},r)),R.jsxs("div",{className:"rtf dropdown tool",style:{display:o.includes("table")?"none":"flex",padding:o.includes("table")?0:5},children:[R.jsx(de,{text:d.find(e=>"table"===e.format).tooltip,position:"bottom",children:R.jsx("button",{ref:e=>l.current.table=e,onClick:m,className:"rtf dropdown-toggle",children:R.jsx(re,{format:"table",imageColor:c})})}),p&&!o.includes("table")&&R.jsx(he,{onClose:m})]}),R.jsx(be,{allButtons:d,hiddenButtons:o,ref:l}),!o.includes("image")&&R.jsx(de,{text:d.find(e=>"image"===e.format).tooltip,position:"bottom",children:R.jsx(me,{ref:e=>l.current.image=e})}),!o.includes("code")&&R.jsx(de,{text:d.find(e=>"code"===e.format).tooltip,position:"bottom",children:R.jsx(fe,{ref:e=>l.current.code=e})}),["undo","redo"].map(e=>!o.includes(e)&&R.jsx(de,{text:d.find(t=>t.format===e).tooltip,position:"bottom",children:R.jsx("button",{ref:t=>l.current[e]=t,className:"rtf tool",style:{display:o.includes(e)?"none":"inline-block"},onMouseDown:t=>{t.preventDefault(),"undo"===e?i.undo():"redo"===e&&i.redo()},children:R.jsx(re,{format:e,imageColor:0===i.history[e+"s"].length?`color-mix(in srgb, ${c} 40%, ${U(c)?"white":"black"})`:c})},e)},e)),o.length>0&&R.jsx(de,{text:"Voir plus",position:"bottom",children:R.jsx("button",{className:"rtf tool toolbar-more-button",onClick:()=>n(e=>!e),children:R.jsx(re,{format:"more",imageColor:c})})})]}),t&&R.jsx("div",{className:"rtf toolbar-modal",style:{backgroundColor:u},onMouseLeave:()=>n(!1),children:o.map(t=>"image"===t||"code"===t||"table"===t||"deleteTable"===t||"addRow"===t||"addColumn"===t||"deleteRow"===t||"deleteColumn"===t?"image"===t?R.jsx(me,{ref:e=>l.current.image=e},t):"code"===t?R.jsx(fe,{ref:e=>l.current.code=e},t):"table"===t?R.jsx("div",{className:"rtf dropdown tool",children:R.jsx(de,{text:d.find(e=>e.format===t).tooltip,position:"bottom",children:R.jsx("button",{className:"rtf dropdown-toggle",ref:e=>l.current[t]=e,onClick:m,children:R.jsx(re,{format:t,imageColor:c})})},t)}):f.includes(t)?R.jsx(be,{allButtons:d,hiddenButtons:f.filter(e=>e!==t),ref:l},t):null:R.jsx(pe,{activeMarks:e,format:t,isActive:e[t],tooltip:d.find(e=>e.format===t).tooltip},t))})]})},xe=({toggleColor:e,fullScreen:t})=>{const{isDarkTheme:r,toggleTheme:n}=X();return R.jsxs("label",{className:"rtf toggle-switch",style:{right:t?55:20},children:[R.jsx("input",{className:"rtf",type:"checkbox",checked:r,onChange:n}),R.jsx("span",{className:"rtf slider round",style:{borderColor:e},children:R.jsx("span",{className:"rtf icon",style:{backgroundColor:e},children:R.jsx("span",{children:r?"🌙":"🌞"})})})]})};function ve({children:e}){const{editor:t,imageColor:n}=Q(),o=r.useId();return R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"rtf tool table__tool",onClick:()=>{return e=o,void H.insertParagraphBeforeTable(t,e);var e},children:R.jsx(re,{format:"enter",imageColor:n})}),R.jsx("table",{className:"rtf","data-table-id":o,children:R.jsx("tbody",{children:e})}),R.jsx("div",{className:"rtf tool table__tool",onClick:()=>{H.insertParagraphAfterTable(t,o)},children:R.jsx(re,{format:"enter",imageColor:n})})]})}const ke=r.createContext({isFullscreen:!1,toggleFullscreen:()=>{}}),we=({children:e})=>{const[t,n]=r.useState(!1);return r.useEffect(()=>{const e=()=>{t&&window.innerWidth<768&&n(!1)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t]),R.jsx(ke.Provider,{value:{isFullscreen:t,toggleFullscreen:()=>{n(!t)}},children:e})},Ce=()=>r.useContext(ke),je=({children:e})=>{const{isFullscreen:t}=Ce(),n=r.useRef(null);return r.useEffect(()=>(document.body.style.overflow=t?"hidden":"",()=>{document.body.style.overflow=""}),[t]),R.jsx("div",{ref:n,className:"rtf fullscreen-wrapper "+(t?"fullscreen-wrapper--active":""),children:e})},Fe=()=>{const{isFullscreen:e,toggleFullscreen:t}=Ce(),{backgroundColor:r,imageColor:n}=Q();return R.jsx("div",{className:"rtf fullscreen-button",children:R.jsx(de,{position:"bottom",text:e?"Quitter le mode plein écran (Esc)":"Passer en mode plein écran",children:R.jsx("button",{onClick:t,className:"rtf tool "+(e?"tool--active":""),style:{backgroundColor:e?`color-mix(in srgb, ${r} 80%, ${U(r)?"white":"black"})`:""},children:R.jsx(re,{format:"fullscreen"+(e?"Exit":""),imageColor:n})})})})};var Se,Ne={exports:{}};var Ee,Le,Te=(Se||(Se=1,Ee=Ne,Le=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,n={},o={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++r}),e.__id},clone:function e(t,r){var n,a;switch(r=r||{},o.util.type(t)){case"Object":if(a=o.util.objId(t),r[a])return r[a];for(var s in n={},r[a]=n,t)t.hasOwnProperty(s)&&(n[s]=e(t[s],r));return n;case"Array":return a=o.util.objId(t),r[a]?r[a]:(n=[],r[a]=n,t.forEach(function(t,o){n[o]=e(t,r)}),n);default:return t}},getLanguage:function(e){for(;e;){var r=t.exec(e.className);if(r)return r[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,r){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+r)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(n){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(n.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var r in t)if(t[r].src==e)return t[r]}return null}},isActive:function(e,t,r){for(var n="no-"+t;e;){var o=e.classList;if(o.contains(t))return!0;if(o.contains(n))return!1;e=e.parentElement}return!!r}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var r=o.util.clone(o.languages[e]);for(var n in t)r[n]=t[n];return r},insertBefore:function(e,t,r,n){var a=(n=n||o.languages)[e],s={};for(var l in a)if(a.hasOwnProperty(l)){if(l==t)for(var i in r)r.hasOwnProperty(i)&&(s[i]=r[i]);r.hasOwnProperty(l)||(s[l]=a[l])}var c=n[e];return n[e]=s,o.languages.DFS(o.languages,function(t,r){r===c&&t!=e&&(this[t]=s)}),s},DFS:function e(t,r,n,a){a=a||{};var s=o.util.objId;for(var l in t)if(t.hasOwnProperty(l)){r.call(t,l,t[l],n||l);var i=t[l],c=o.util.type(i);"Object"!==c||a[s(i)]?"Array"!==c||a[s(i)]||(a[s(i)]=!0,e(i,r,l,a)):(a[s(i)]=!0,e(i,r,null,a))}}},plugins:{},highlightAll:function(e,t){o.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,r){var n={callback:r,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};o.hooks.run("before-highlightall",n),n.elements=Array.prototype.slice.apply(n.container.querySelectorAll(n.selector)),o.hooks.run("before-all-elements-highlight",n);for(var a,s=0;a=n.elements[s++];)o.highlightElement(a,!0===t,n.callback)},highlightElement:function(t,r,n){var a=o.util.getLanguage(t),s=o.languages[a];o.util.setLanguage(t,a);var l=t.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&o.util.setLanguage(l,a);var i={element:t,language:a,grammar:s,code:t.textContent};function c(e){i.highlightedCode=e,o.hooks.run("before-insert",i),i.element.innerHTML=i.highlightedCode,o.hooks.run("after-highlight",i),o.hooks.run("complete",i),n&&n.call(i.element)}if(o.hooks.run("before-sanity-check",i),(l=i.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!i.code)return o.hooks.run("complete",i),void(n&&n.call(i.element));if(o.hooks.run("before-highlight",i),i.grammar)if(r&&e.Worker){var u=new Worker(o.filename);u.onmessage=function(e){c(e.data)},u.postMessage(JSON.stringify({language:i.language,code:i.code,immediateClose:!0}))}else c(o.highlight(i.code,i.grammar,i.language));else c(o.util.encode(i.code))},highlight:function(e,t,r){var n={code:e,grammar:t,language:r};if(o.hooks.run("before-tokenize",n),!n.grammar)throw new Error('The language "'+n.language+'" has no grammar.');return n.tokens=o.tokenize(n.code,n.grammar),o.hooks.run("after-tokenize",n),a.stringify(o.util.encode(n.tokens),n.language)},tokenize:function(e,t){var r=t.rest;if(r){for(var n in r)t[n]=r[n];delete t.rest}var o=new i;return c(o,o.head,e),l(e,o,t,o.head,0),function(e){for(var t=[],r=e.head.next;r!==e.tail;)t.push(r.value),r=r.next;return t}(o)},hooks:{all:{},add:function(e,t){var r=o.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){var r=o.hooks.all[e];if(r&&r.length)for(var n,a=0;n=r[a++];)n(t)}},Token:a};function a(e,t,r,n){this.type=e,this.content=t,this.alias=r,this.length=0|(n||"").length}function s(e,t,r,n){e.lastIndex=t;var o=e.exec(r);if(o&&n&&o[1]){var a=o[1].length;o.index+=a,o[0]=o[0].slice(a)}return o}function l(e,t,r,n,i,d){for(var p in r)if(r.hasOwnProperty(p)&&r[p]){var g=r[p];g=Array.isArray(g)?g:[g];for(var f=0;f<g.length;++f){if(d&&d.cause==p+","+f)return;var m=g[f],h=m.inside,b=!!m.lookbehind,y=!!m.greedy,x=m.alias;if(y&&!m.pattern.global){var v=m.pattern.toString().match(/[imsuy]*$/)[0];m.pattern=RegExp(m.pattern.source,v+"g")}for(var k=m.pattern||m,w=n.next,C=i;w!==t.tail&&!(d&&C>=d.reach);C+=w.value.length,w=w.next){var j=w.value;if(t.length>e.length)return;if(!(j instanceof a)){var F,S=1;if(y){if(!(F=s(k,C,e,b))||F.index>=e.length)break;var N=F.index,E=F.index+F[0].length,L=C;for(L+=w.value.length;N>=L;)L+=(w=w.next).value.length;if(C=L-=w.value.length,w.value instanceof a)continue;for(var T=w;T!==t.tail&&(L<E||"string"==typeof T.value);T=T.next)S++,L+=T.value.length;S--,j=e.slice(C,L),F.index-=C}else if(!(F=s(k,0,j,b)))continue;N=F.index;var A=F[0],$=j.slice(0,N),M=j.slice(N+A.length),z=C+j.length;d&&z>d.reach&&(d.reach=z);var _=w.prev;if($&&(_=c(t,_,$),C+=$.length),u(t,_,S),w=c(t,_,new a(p,h?o.tokenize(A,h):A,x,A)),M&&c(t,w,M),S>1){var O={cause:p+","+f,reach:z};l(e,t,r,w.prev,C,O),d&&O.reach>d.reach&&(d.reach=O.reach)}}}}}}function i(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,r){var n=t.next,o={value:r,prev:t,next:n};return t.next=o,n.prev=o,e.length++,o}function u(e,t,r){for(var n=t.next,o=0;o<r&&n!==e.tail;o++)n=n.next;t.next=n,n.prev=t,e.length-=o}if(e.Prism=o,a.stringify=function e(t,r){if("string"==typeof t)return t;if(Array.isArray(t)){var n="";return t.forEach(function(t){n+=e(t,r)}),n}var a={type:t.type,content:e(t.content,r),tag:"span",classes:["token",t.type],attributes:{},language:r},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(a.classes,s):a.classes.push(s)),o.hooks.run("wrap",a);var l="";for(var i in a.attributes)l+=" "+i+'="'+(a.attributes[i]||"").replace(/"/g,""")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+l+">"+a.content+"</"+a.tag+">"},!e.document)return e.addEventListener?(o.disableWorkerMessageHandler||e.addEventListener("message",function(t){var r=JSON.parse(t.data),n=r.language,a=r.code,s=r.immediateClose;e.postMessage(o.highlight(a,o.languages[n],n)),s&&e.close()},!1),o):o;var d=o.util.currentScript();function p(){o.manual||o.highlightAll()}if(d&&(o.filename=d.src,d.hasAttribute("data-manual")&&(o.manual=!0)),!o.manual){var g=document.readyState;"loading"===g||"interactive"===g&&d&&d.defer?document.addEventListener("DOMContentLoaded",p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return o}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{}),Ee.exports&&(Ee.exports=Le),void 0!==A&&(A.Prism=Le),Le.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Le.languages.markup.tag.inside["attr-value"].inside.entity=Le.languages.markup.entity,Le.languages.markup.doctype.inside["internal-subset"].inside=Le.languages.markup,Le.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(Le.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Le.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};n["language-"+t]={pattern:/[\s\S]+/,inside:Le.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},Le.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(Le.languages.markup.tag,"addAttribute",{value:function(e,t){Le.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Le.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Le.languages.html=Le.languages.markup,Le.languages.mathml=Le.languages.markup,Le.languages.svg=Le.languages.markup,Le.languages.xml=Le.languages.extend("markup",{}),Le.languages.ssml=Le.languages.xml,Le.languages.atom=Le.languages.xml,Le.languages.rss=Le.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(Le),Le.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Le.languages.javascript=Le.languages.extend("clike",{"class-name":[Le.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Le.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Le.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Le.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Le.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Le.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Le.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Le.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Le.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Le.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Le.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Le.languages.markup&&(Le.languages.markup.tag.addInlined("script","javascript"),Le.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Le.languages.js=Le.languages.javascript,function(){if(void 0!==Le&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",r="loading",n="loaded",o="pre[data-src]:not(["+t+'="'+n+'"]):not(['+t+'="'+r+'"])';Le.hooks.add("before-highlightall",function(e){e.selector+=", "+o}),Le.hooks.add("before-sanity-check",function(a){var s=a.element;if(s.matches(o)){a.code="",s.setAttribute(t,r);var l=s.appendChild(document.createElement("CODE"));l.textContent="Loading…";var i=s.getAttribute("data-src"),c=a.language;if("none"===c){var u=(/\.(\w+)$/.exec(i)||[,"none"])[1];c=e[u]||u}Le.util.setLanguage(l,c),Le.util.setLanguage(s,c);var d=Le.plugins.autoloader;d&&d.loadLanguages(c),function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){4==n.readyState&&(n.status<400&&n.responseText?t(n.responseText):n.status>=400?r("✖ Error "+n.status+" while fetching file: "+n.statusText):r("✖ Error: File does not exist or is empty"))},n.send(null)}(i,function(e){s.setAttribute(t,n);var r=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var r=Number(t[1]),n=t[2],o=t[3];return n?o?[r,Number(o)]:[r,void 0]:[r,r]}}(s.getAttribute("data-range"));if(r){var o=e.split(/\r\n?|\n/g),a=r[0],i=null==r[1]?o.length:r[1];a<0&&(a+=o.length),a=Math.max(0,Math.min(a-1,o.length)),i<0&&(i+=o.length),i=Math.max(0,Math.min(i,o.length)),e=o.slice(a,i).join("\n"),s.hasAttribute("data-start")||s.setAttribute("data-start",String(a+1))}l.textContent=e,Le.highlightElement(l)},function(e){s.setAttribute(t,"failed"),l.textContent=e})}}),Le.plugins.fileHighlight={highlight:function(e){for(var t,r=(e||document).querySelectorAll(o),n=0;t=r[n++];)Le.highlightElement(t)}};var a=!1;Le.fileHighlight=function(){a||(a=!0),Le.plugins.fileHighlight.highlight.apply(this,arguments)}}}()),Ne.exports);const Ae=$(Te);Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript;var $e;$e||($e=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(e){return e=e.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return n}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+a+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+a+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(t){["url","bold","italic","strike","code-snippet"].forEach(function(r){t!==r&&(e.languages.markdown[t].inside.content.inside[r]=e.languages.markdown[r])})}),e.hooks.add("after-tokenize",function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var r=0,n=t.length;r<n;r++){var o=t[r];if("code"===o.type){var a=o.content[1],s=o.content[3];if(a&&s&&"code-language"===a.type&&"code-block"===s.type&&"string"==typeof a.content){var l=a.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),i="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());s.alias?"string"==typeof s.alias?s.alias=[s.alias,i]:s.alias.push(i):s.alias=[i]}}else e(o.content)}}(e.tokens)}),e.hooks.add("wrap",function(t){if("code-block"===t.type){for(var r="",n=0,o=t.classes.length;n<o;n++){var a=t.classes[n],c=/language-(.+)/.exec(a);if(c){r=c[1];break}}var u,d=e.languages[r];if(d)t.content=e.highlight((u=t.content,u.replace(s,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){var r;if("#"===(t=t.toLowerCase())[0])return r="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),i(r);var n=l[t];return n||e})),d,r);else if(r&&"none"!==r&&e.plugins.autoloader){var p="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=p,e.plugins.autoloader.loadLanguages(r,function(){var t=document.getElementById(p);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[r],r))})}}});var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},i=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(Prism);
|
|
141
|
+
/**
|
|
142
|
+
* @license
|
|
143
|
+
* Copyright (c) 2025 Jahylis
|
|
144
|
+
*
|
|
145
|
+
* This file is part of ReactTextForge.
|
|
146
|
+
*
|
|
147
|
+
* ReactTextForge is free software: you can redistribute it and/or modify
|
|
148
|
+
* it under the terms of the MIT License as published by
|
|
149
|
+
* the Open Source Initiative.
|
|
150
|
+
*
|
|
151
|
+
* ReactTextForge is distributed in the hope that it will be useful,
|
|
152
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
153
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
154
|
+
* MIT License for more details.
|
|
155
|
+
*
|
|
156
|
+
* You should have received a copy of the MIT License
|
|
157
|
+
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
158
|
+
*
|
|
159
|
+
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
160
|
+
*/
|
|
161
|
+
e.default=({value:e,setValue:a,fullScreen:l=!0,showTheme:i=!0,borderColor:c="#ccc",backgroundColor:u="#FFF",imageColor:d="#000",borderDarkColor:p="#1A1A1A",backgroundDarkColor:g="#444444",imageDarkColor:f="#ffffff",toggleColor:m="#2584aa",raccourcis:h=null})=>{const[b]=r.useState(()=>s.withDocxDeserializer(o.withHistory(n.withReact(t.createEditor())))),[y,x]=r.useState({bold:!1,underline:!1,italic:!1,strikethrough:!1,subscript:!1,superscript:!1,blockquote:!1,color:"",bgColor:"",fontSize:"",fontFamily:"",href:"",bulletList:!1,numberedList:!1,left:!1,center:!1,right:!1,indent:!1,outdent:!1}),v=r.useMemo(()=>e||[{type:"paragraph",children:[{text:""}]}],[]),k=r.useRef([]),w=r.useCallback(e=>{switch(e.element.type){case"code":return R.jsx(I,{...e});case"bullet-list":case"numbered-list":case"list-item":return R.jsx(Z,{...e});case"h1":return R.jsx("h1",{className:"rtf",...e.attributes,children:e.children});case"h2":return R.jsx("h2",{className:"rtf",...e.attributes,children:e.children});case"blockquote":return R.jsx(W,{...e});case"image":return R.jsx("img",{className:"rtf",src:e.element.url,alt:"",...e.attributes});case"table":return R.jsx(ve,{...e});case"table-row":return R.jsx("tr",{className:"rtf",children:e.children});case"table-cell":return R.jsx("td",{className:"rtf",children:e.children});default:return R.jsx(q,{...e})}},[]),C=r.useCallback(e=>R.jsx(V,{...e}),[]),j=r.useCallback(()=>{const e=t.Editor.marks(b),r=H.isSelectionInList(b);x(n=>{const o={};for(const a in n)if("bulletList"===a||"numberedList"===a){const e="bulletList"===a?"bullet-list":"numberedList"===a?"numbered-list":"";o[a]=r&&H.isBlockActive(b,e)}else if("left"===a||"center"===a||"right"===a)o[a]=H.isAlignActive(b,a);else if("indent"===a||"outdent"===a)o[a]=H.canIndent(b,a);else if("href"===a){let e="";if(H.isLinkActive(b)){const r=t.Editor.nodes(b,{match:e=>"link"===e.type,mode:"highest"});for(const[t]of r)if(t&&t.href){e=t.href;break}}o[a]=e}else o[a]="color"===a?(null==e?void 0:e.color)||null:"fontSize"===a?(null==e?void 0:e.fontSize)||null:!0===(null==e?void 0:e[a]);return o})},[b]);return r.useEffect(()=>{if(null!==h){const e=e=>{Object.keys(h).forEach(t=>{const r=t.split("+"),n=r.pop().toLowerCase(),o=r.map(e=>e.toLowerCase()),a={ctrl:e.ctrlKey,shift:e.shiftKey,alt:e.altKey,meta:e.metaKey},s=o.every(e=>a[e]),l=e.key.toLowerCase()===n;s&&l&&h[t](e)})};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}},[h]),r.useEffect(()=>{null==e&&t.Transforms.delete(b,{at:{anchor:t.Editor.start(b,[]),focus:t.Editor.end(b,[])}})},[e]),R.jsx(K,{showTheme:i,borderDarkColor:p,backgroundDarkColor:g,imageDarkColor:f,children:R.jsx(we,{children:R.jsx(je,{children:R.jsx(Y,{backgroundColor:u,borderColor:c,editor:b,imageColor:d,children:R.jsxs(n.Slate,{editor:b,initialValue:v,value:e,onChange:e=>{j();if(b.operations.some(e=>"set_selection"!==e.type)){const t=JSON.stringify(e);a(e),localStorage.setItem("content",t)}},children:[R.jsx(ye,{activeMarks:y}),R.jsx(n.Editable,{className:"rtf rtf__editor",decorate:([e,r])=>{const n=[];if(!t.Element.isElement(e))return n;const o=t.Node.string(e),a=r[0],s=k.current[a];if(s&&s.text==o)return s.ranges;const l=Ae.tokenize(o,Ae.languages.javascript);let i=0;for(const t of l){const e=i+t.length;"string"!=typeof t&&n.push({anchor:{path:r,offset:i},focus:{path:r,offset:e},className:`token ${t.type}`}),i=e}return k.current[a]={text:o,ranges:n},n},renderElement:w,renderLeaf:C,style:{borderColor:c,paddingBottom:i||l?35:10},onPaste:async e=>{if(H.isSelectionInCode(b)){const t=e.clipboardData.getData("text/plain");if(t){(t.includes("\n")||t.match(/^\s{2,}/gm))&&(e.preventDefault(),H.insertCodeBlock(b,t))}return}const t=e.clipboardData.getData("text/html");if(t){e.preventDefault();const r=(e=>{const t=e=>{if(e.nodeType===Node.TEXT_NODE){const t=e.textContent.trim();return""===t?null:t}if(e.nodeType!==Node.ELEMENT_NODE)return null;const r=Array.from(e.childNodes).map(t).flat().filter(Boolean),n={bold:"B"===e.nodeName||"STRONG"===e.nodeName||"bold"===e.style.fontWeight||"700"===e.style.fontWeight,italic:"I"===e.nodeName||"EM"===e.nodeName||"italic"===e.style.fontStyle,underline:"U"===e.nodeName||e.style.textDecoration&&e.style.textDecoration.includes("underline"),fontSize:e.style.fontSize||"FONT"===e.nodeName&&e.getAttribute("size"),fontFamily:e.style.fontFamily||"FONT"===e.nodeName&&e.getAttribute("face"),color:e.style.color||"FONT"===e.nodeName&&e.getAttribute("color"),align:e.getAttribute("align")};let o;switch(e.nodeName){case"P":o=L("element",{type:"paragraph",align:n.align,size:n.fontSize},r.length?r:[{text:""}]);break;case"PRE":o=L("element",{type:"code"},r.length?r:[{text:""}]);break;case"UL":o=L("element",{type:"bullet-list"},r);break;case"OL":o=L("element",{type:"numbered-list"},r);break;case"LI":o=L("element",{type:"list-item"},r.length?r:[{text:""}]);break;case"H1":o=L("element",{type:"h1"},r.length?r:[{text:""}]);break;case"H2":case"H3":case"H4":case"H5":case"H6":o=L("element",{type:"h2",align:n.align},r.length?r:[{text:""}]);break;case"BLOCKQUOTE":o=L("element",{type:"blockquote",align:n.align},r.length?r:[{text:""}]);break;case"IMG":o=L("element",{type:"image",url:e.getAttribute("src")});break;case"TABLE":o=L("element",{type:"table"},r);break;case"TR":o=L("element",{type:"table-row"},r);break;case"TD":o=L("element",{type:"table-cell"},r);break;case"A":o=L("element",{type:"link",url:e.getAttribute("href")},r.length?r:[{text:""}]);break;default:o=r.map(e=>"string"==typeof e?L("text",n,e):e).filter(Boolean)}return o};return Array.from(e.childNodes).map(t).flat().filter(Boolean)})((new DOMParser).parseFromString(t,"text/html").body);b.insertFragment(r)}},onKeyDown:e=>{if("Tab"!==e.key){if("Enter"!==e.key||e.ctrlKey||(H.isSelectionInTable(b)||H.isSelectionInCode(b)||H.isBlockquoteActive(b))&&(e.preventDefault(),b.insertText("\n")),e.ctrlKey)switch(e.key){case"=":e.preventDefault(),H.toggleBlock(b,"code");break;case"b":e.preventDefault(),H.toggleMark(b,"bold");break;case"i":e.preventDefault(),H.toggleMark(b,"italic");break;case"u":e.preventDefault(),H.toggleMark(b,"underline");break;case"s":e.preventDefault(),H.toggleMark(b,"strikethrough");break;case"sub":e.preventDefault(),H.toggleMark(b,"subscript");break;case"sup":e.preventDefault(),H.toggleMark(b,"superscript");break;case"l":e.preventDefault(),H.toggleBlock(b,"bulletList");break;case"n":e.preventDefault(),H.toggleBlock(b,"numberedList");break;case"left":e.preventDefault(),H.toggleMark(b,"left");break;case"center":e.preventDefault(),H.toggleMark(b,"center");break;case"right":e.preventDefault(),H.toggleMark(b,"right");break;case"Enter":{e.preventDefault();const{selection:r}=b;if(r){const[e]=t.Editor.nodes(b,{match:e=>t.Element.isElement(e)&&"paragraph"!==e.type});e&&t.Transforms.insertNodes(b,t.Transforms.insertNodes(b,{type:"paragraph",children:[{text:""}]}))}break}}}else(e=>{e.shiftKey&&H.canIndent(b,"outdent")?(e.preventDefault(),H.handleOutdent(b)):H.canIndent(b,"indent")&&(e.preventDefault(),H.handleIndent(b))})(e)}}),i&&R.jsx(xe,{toggleColor:m,fullScreen:l}),l&&R.jsx(Fe,{})]})})})})})},e.deserialize=e=>{const t=(new DOMParser).parseFromString(e,"text/html"),r=e=>{if(e.nodeType===Node.TEXT_NODE)return e.textContent;if(e.nodeType!==Node.ELEMENT_NODE)return null;const t=Array.from(e.childNodes).map(r).flat().filter(Boolean),n={bold:null!==e.querySelector("strong"),italic:null!==e.querySelector("em"),underline:null!==e.querySelector("u"),strikethrough:null!==e.querySelector("del"),subscript:null!==e.querySelector("sub"),superscript:null!==e.querySelector("sup"),bgColor:e.style.backgroundColor||e.querySelector("mark")&&e.querySelector("mark").style.backgroundColor,color:e.style.color,fontSize:e.style.fontSize,fontFamily:e.style.fontFamily,href:"A"===e.nodeName?e.getAttribute("href"):null,target:"A"===e.nodeName?e.getAttribute("target"):null,rel:"A"===e.nodeName?e.getAttribute("rel"):null};switch(e.nodeName){case"P":return L("element",{type:"paragraph"},t);case"PRE":return L("element",{type:"code"},t);case"UL":return L("element",{type:"bullet-list"},t);case"OL":return L("element",{type:"numbered-list"},t);case"LI":return L("element",{type:"list-item"},t);case"H1":return L("element",{type:"h1"},t);case"H2":return L("element",{type:"h2"},t);case"BLOCKQUOTE":return L("element",{type:"blockquote"},t);case"IMG":return L("element",{type:"image",url:e.getAttribute("src")});case"TABLE":return L("element",{type:"table"},t);case"TR":return L("element",{type:"table-row"},t);case"TD":return L("element",{type:"table-cell"},t);case"A":return L("element",{type:"link",url:e.getAttribute("href")},t);default:return t.map(e=>"string"==typeof e?L("text",n,e):e)}};return Array.from(t.body.childNodes).map(r).flat().filter(Boolean)},e.serialize=T,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|