react-text-forge 1.2.12 → 1.3.1
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.css +1 -1
- package/dist/react-text-forge.js +215 -135
- package/dist/react-text-forge.umd.cjs +9 -9
- package/dist/src/components/useToolbar.d.ts +2 -1
- package/dist/src/components/utils/CustomEditor.d.ts +140 -128
- package/dist/src/components/utils/dropdown/ContainerDropdown.d.ts +1 -5
- package/dist/src/components/utils/dropdown/{TableDropdown.d.ts → TableButtons.d.ts} +2 -2
- package/dist/src/components/utils/form/BulletTypeSelector.d.ts +3 -3
- package/dist/src/components/utils/form/NumeredTypeSelector.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
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,
|
|
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,l){"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
|
-
*/function
|
|
7
|
+
*/function s(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 l=e;t.Text.isText(o)&&v.has(o)&&v.has(l)&&t.Text.equals(o,l,{loose:!0})?o.text+=l.text:r.push(l)}else if(t.Element.isElement(e))r.push(e);else{if(!(e instanceof g))throw new Error("Unexpected hyperscript child object: ".concat(e));var s=r[r.length-1];t.Text.isText(s)||(n(""),s=r[r.length-1]),e instanceof f?((e,t)=>{var r=e.text.length;d.set(e,[r,t])})(s,e):e instanceof m&&((e,t)=>{var r=e.text.length;p.set(e,[r,t])})(s,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 l of n)t.Range.isRange(l)?o=l:a.push(l);var s=k(a),i={},c=F();for(var[u,d]of(Object.assign(c,r),c.children=s,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 l,i,c,u=e[t];if(!u)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==r&&(r={}),(!1===s(l=r)||void 0!==(i=l.constructor)&&(!1===s(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},A=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
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright (c) 2025 Jahylis
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
28
|
+
const L=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">${L(e.children)}</p>`:"code"===e.type?`<pre class="rtf"><code>${L(e.children)}</code></pre>`:"bullet-list"===e.type?`<ul class="rtf">${L(e.children)}</ul>`:"numbered-list"===e.type?`<ol class="rtf">${L(e.children)}</ol>`:"list-item"===e.type?`<li class="rtf">${L(e.children)}</li>`:"h1"===e.type?`<h1 class="rtf">${L(e.children)}</h1>`:"h2"===e.type?`<h2 class="rtf">${L(e.children)}</h2>`:"blockquote"===e.type?`<blockquote class="rtf">${L(e.children)}</blockquote>`:"image"===e.type?`<img class="rtf" src="${e.url}" alt="" />`:"table"===e.type?`<table class="rtf"><tbody>${L(e.children)}</tbody></table>`:"table-row"===e.type?`<tr class="rtf">${L(e.children)}</tr>`:"table-cell"===e.type?`<td class="rtf">${L(e.children)}</td>`:"link"===e.type?`<a class="rtf" href="${e.url}">${L(e.children)}</a>`:""}).join("");
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright (c) 2025 Jahylis
|
|
@@ -45,7 +45,7 @@ const T=e=>e.map(e=>{if(t.Text.isText(e)){let t=e.text;const r=[];if(e.bold&&r.p
|
|
|
45
45
|
* along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
|
|
46
46
|
*
|
|
47
47
|
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
48
|
-
*/var
|
|
48
|
+
*/var T="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,D,P={};
|
|
49
49
|
/**
|
|
50
50
|
* @license React
|
|
51
51
|
* react-jsx-runtime.development.js
|
|
@@ -54,7 +54,7 @@ const T=e=>e.map(e=>{if(t.Text.isText(e)){let t=e.text;const r=[];if(e.bold&&r.p
|
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the MIT license found in the
|
|
56
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});
|
|
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 l(){var t=e(this.type);return A[t]||(A[t]=!0),void 0!==(t=this.props.ref)?t:null}function s(t,r,o,a,s,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,s,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:l}):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:s}),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},A={},L=(u={"react-stack-bottom-frame":function(e){return e()}})["react-stack-bottom-frame"].bind(u,a)(),T=E(o(a)),$={};P.Fragment=g,P.jsx=function(e,t,r,n,a){var l=1e4>F.recentlyCreatedOwnerStacks++;return s(e,t,r,!1,0,a,l?Error("react-stack-top-frame"):L,l?E(o(e)):T)},P.jsxs=function(e,t,r,n,a){var l=1e4>F.recentlyCreatedOwnerStacks++;return s(e,t,r,!0,0,a,l?Error("react-stack-top-frame"):L,l?E(o(e)):T)}}()),P}var R=(D||(D=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},getCurrentBlock(e,r){if(!r)return null;const[n]=t.Editor.nodes(e,{match:e=>t.Element.isElement(e),at:r});if(n){const[e]=n;return e.type}return null},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 l={type:a,children:[]},s=[o[0],o[1]+1];t.Transforms.insertNodes(e,l,{at:s});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 l={text:r};t.Range.isCollapsed(n)?t.Transforms.insertNodes(e,{type:"link",href:r,target:o,rel:a,children:[l]}):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),l=t.Node.get(e,a);t.Transforms.insertNodes(e,{type:"list-item"!==l.type?l.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,l]=t.Editor.parent(e,o);!t.Element.isElement(a)||"paragraph"!==a.type&&"code"!==a.type||""!==t.Node.string(a)||t.Transforms.removeNodes(e,{at:l}),t.Transforms.insertNodes(e,n);const s=t.Editor.end(e,[]);t.Transforms.select(e,s)},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 l=r.toDataURL("image/jpeg");this.insertImage(t,l)},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],l={type:"table-row",children:n.children[a].children.map(e=>({...e,children:[{text:""}]}))},s=[o.slice(0,1),a+1];t.Transforms.insertNodes(e,l,{at:s})}},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 l={type:"table-cell",children:[{text:""}]},s=[...a.slice(0,1),o,r+1];s[s.length-1]<=n.children.length&&t.Transforms.insertNodes(e,l,{at:s})})}}},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,l=t.Node.get(e,a),s=a[a.length-1];let i=-1;o.children[s].children.forEach((e,t)=>{e.children[0]===l&&(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,l=1/0;for(const[s,i]of n){const e=t.Path.compare(r.anchor.path,i);Math.abs(e)<l&&(l=Math.abs(e),a=[s,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},l=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:l,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
58
|
/**
|
|
59
59
|
* @license
|
|
60
60
|
* Copyright (c) 2025 Jahylis
|
|
@@ -95,7 +95,7 @@ const T=e=>e.map(e=>{if(t.Text.isText(e)){let t=e.text;const r=[];if(e.bold&&r.p
|
|
|
95
95
|
*
|
|
96
96
|
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
97
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
|
|
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[l,s]=r.useState("light");r.useEffect(()=>{if(e){const e=window.matchMedia("(prefers-color-scheme: dark)");s(e.matches?"dark":"light");const t=e=>{s(e.matches?"dark":"light")};return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}}},[]),r.useEffect(()=>{document.documentElement.setAttribute("data-theme",l)},[l]);return R.jsx(G.Provider,{value:{theme:l,toggleTheme:()=>{s(e=>"light"===e?"dark":"light")},showTheme:e,isDarkTheme:"dark"===l,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[l,s]=r.useState(null),{showTheme:i,isDarkTheme:c,backgroundDarkColor:u,borderDarkColor:d,imageDarkColor:p}=X(),g=i&&c?u:e,f=i&&c?d:t,m=i&&c?p:n;r.useEffect(()=>{document.documentElement.style.setProperty("--background-color",g),document.documentElement.style.setProperty("--border-color",f),document.documentElement.style.setProperty("--image-color",m)},[g,f,m]);const h={backgroundColor:g,borderColor:f,editor:o,imageColor:m,dropdownActive:l,setDropdownActive:s};return R.jsx(J.Provider,{value:h,children:R.jsx("div",{className:"rtf react-text-forge",style:{backgroundColor:g,borderColor:f},children:a})})},Q=()=>r.useContext(J),ee=({onChange:e,selectStyle:t,onClose:r})=>{const{editor:n}=Q();return R.jsx("ul",{onMouseLeave:r,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,onClose:r})=>{const{editor:n}=Q();return R.jsx("ul",{onMouseLeave:r,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
99
|
/**
|
|
100
100
|
* @license
|
|
101
101
|
* Copyright (c) 2025 Jahylis
|
|
@@ -116,7 +116,7 @@ function U(e){let t,r,n;if(e.startsWith("#"))e=e.replace(/^#/,""),t=parseInt(e.s
|
|
|
116
116
|
*
|
|
117
117
|
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
118
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"})]})]})};
|
|
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:r})=>{const{backgroundColor:n,editor:o,imageColor:a,dropdownActive:l,setDropdownActive:s}=Q(),i={backgroundColor:n,color:a},c=t=>{H.toggleBlock(o,"bulletList"===e?"bullet-list":"numbered-list",t),s(null)};return R.jsxs(R.Fragment,{children:[R.jsxs("button",{className:"rtf tool",children:[R.jsx("div",{onMouseDown:t=>{t.preventDefault(),r(e)},children:R.jsx(re,{format:e,imageColor:a})}),t&&R.jsx("div",{className:"rtf tool tool--arrow",style:{color:i.color},onClick:()=>{s(l!==e?e:null)},children:l===e?"↑":"↓"})]}),"bulletList"===l&&"bulletList"===e&&R.jsx(ee,{selectStyle:i,onChange:c,onClose:()=>s(null)}),"numberedList"===l&&"numberedList"===e&&R.jsx(te,{selectStyle:i,onChange:c,onClose:()=>s(null)})]})};function oe({disabled:e=!1,elements:t,elementSelected:r,format:n,onClick:o}){const{backgroundColor:a,imageColor:l,dropdownActive:s,setDropdownActive:i}=Q(),c=()=>{i(null!==s&&s===n?null:n)};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:l})}),s===n&&R.jsx("ul",{style:{backgroundColor:a,color:l},className:"rtf dropdown-menu",onMouseLeave:c,children:t.map((e,t)=>R.jsx("li",{style:{backgroundColor:`${r&&e===r?`color-mix(in srgb, ${a} 80%, ${U(a)?"white":"black"})`:a}`},onClick:()=>(e=>{o(e),i(null)})(e),children:e},t))})]})}const ae=({disabled:e,sizeSelected:t,onSelectSize:r})=>R.jsx(oe,{disabled:e,elements:["10px","12px","14px","16px","18px","20px","24px","28px","36px"],elementSelected:t,format:"size",onClick:r}),le=({fontFamilySelected:e,onSelectFontFamily:t})=>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",onClick:t}),se=({onClose:e,initialUrl:t="",isOpenInNewTab:o})=>{const[a,l]=r.useState(""),{editor:s,backgroundColor:i,imageColor:c}=Q(),[u,d]=r.useState(!1),[p,g]=r.useState(s.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(s,a,u),e())},v=()=>{p&&n.ReactEditor.focus(s)};return r.useEffect(()=>{s.selection&&g(s.selection)},[]),r.useEffect(()=>{l(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=>l(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(s),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
120
|
/**
|
|
121
121
|
* @license
|
|
122
122
|
* Copyright (c) 2025 Jahylis
|
|
@@ -137,7 +137,7 @@ function re({format:e,imageColor:t}){return(()=>{switch(e){case"addColumn":retur
|
|
|
137
137
|
*
|
|
138
138
|
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
139
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);
|
|
140
|
+
function ie(e,n){const[o,a]=r.useState(""),[l,s]=r.useState(""),[i,c]=r.useState(!1),[u,d]=r.useState(""),[p,g]=r.useState(""),[f,m]=r.useState("paragraph"),[h,b]=r.useState("");return{activeBlock:f,setActiveBlock:m,colorMode:l,setColorMode:s,openInNewTab:i,setOpenInNewTab:c,selectedBackgroundColor:p,setSelectedBackgroundColor:g,selectedColor:u,setSelectedColor:d,selectedLanguage:h,setSelectedLanguage:b,selectedLink:o,setSelectedLink:a,detectCurrentLanguage:()=>{const{selection:r}=e;if(r){const[r]=t.Editor.nodes(e,{match:e=>"code"===e.type});b(r?r[0].language:null)}},handleColorChange:t=>{H.applyTextColor(e,t),n(null)},handleBackgroundColorChange:t=>{H.applyBackgroundTextColor(e,t),n(null)},handleBlockTypeChange:t=>{H.toggleBlock(e,t),m(t)}}}function ce({selectedColor:e,onSelectColor:t,onClose:o}){const[l,s]=r.useState("#ffffff"),{theme:i}=X(),{editor:c,backgroundColor:u,borderColor:d,imageColor:p}=Q(),g={backgroundColor:u,color:p},f={backgroundColor:`color-mix(in srgb, ${u} 80%, ${U(u)?"white":"black"})`,color:U(u)?"#FFF":"#000"},m={backgroundColor:"#6c757d"!==u?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:U(u)?"#FFF":"#000"},h={default:{picker:{background:u,color:p,border:d}}};return r.useEffect(()=>{e&&s(e)},[e]),r.useEffect(()=>{const e=document.querySelectorAll(".sketch-picker input"),t=document.querySelectorAll(".sketch-picker label");e.forEach((e,r)=>{e.style.border="2px solid "+d,e.style.background=u,e.style.color=p,t[r].style.color=p})},[i]),R.jsxs("div",{onMouseLeave:o,className:"rtf color-picker-popup",children:[R.jsx(a.SketchPicker,{className:"rtf sketch-picker",styles:h,color:l,onChangeComplete:e=>{n.ReactEditor.focus(c),s(e.hex)}}),R.jsxs("div",{style:g,className:"rtf link-form-actions",children:[R.jsx("button",{className:"rtf",style:f,onClick:()=>{l&&(t(l),o())},disabled:!l,children:"Appliquer"}),R.jsx("button",{className:"rtf",style:m,onClick:()=>{t(""),o()},children:"Annuler"})]})]})}const ue=()=>{const{editor:e,backgroundColor:t,imageColor:r,setDropdownActive:n}=Q(),o=H.isBlockquoteActive(e);return R.jsx("button",{onMouseDown:t=>{t.preventDefault(),n(null),H.toggleBlockquote(e)},style:{backgroundColor:o?`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,l]=r.useState(!1),{isDarkTheme:s,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:()=>l(!0),onMouseLeave:()=>l(!1),children:[t,a&&R.jsx("div",{style:{backgroundColor:s?"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:l})=>{const[s,i]=r.useState(""),{backgroundColor:c,editor:u,imageColor:d,dropdownActive:p,setDropdownActive:g}=Q(),{activeBlock:f,colorMode:m,setColorMode:h,openInNewTab:b,detectCurrentLanguage:y,handleColorChange:x,handleBackgroundColorChange:v,setOpenInNewTab:k,selectedBackgroundColor:w,setSelectedBackgroundColor:C,selectedColor:j,setSelectedColor:F,selectedLink:S,setSelectedLink:N}=ie(u,g),E="h1"===f||"h2"===f,A=["left","center","right"],L=()=>{setTimeout(()=>n.ReactEditor.focus(u),0)};return r.useEffect(()=>{y();const{selection:e}=u;if(e){const[e]=t.Editor.nodes(u,{match:e=>"link"===e.type});e?(k("_blank"===e[0].target),N(e[0].href)):(k(!1),N(""))}},[u.selection]),R.jsx(de,{text:l,position:"bottom",children:"indent"===o||"outdent"===o?R.jsx("div",{children:R.jsx("button",{title:l,className:"rtf tool",onClick:()=>{g(null),"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:E,onSelectSize:e=>{H.applyFontSize(u,e)},sizeSelected:a}):"fontFamily"===o?R.jsx(le,{fontFamilySelected:s,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(),g("href"),L()},title:l,className:"rtf tool tool--"+(a?"active":"inactive"),children:R.jsx(re,{format:o,imageColor:d})}),"href"===p&&R.jsx(se,{onClose:()=>g(null),initialUrl:S,isOpenInNewTab:b})]}):"color"===o||"bgColor"===o?R.jsxs("div",{className:"rtf dropdown",children:[R.jsx("button",{title:l,onMouseDown:t=>{t.preventDefault(),L(),"color"===o?(g("color"),F(e[o]),h("color")):(g("bgColor"),C(e[o]),h("bgColor"))},className:"rtf tool tool--"+(a?"active":"inactive"),children:R.jsx(re,{format:o,imageColor:d})}),p===o&&R.jsx(ce,{selectedColor:"color"===m?j:w,onSelectColor:"color"===m?x:v,onClose:()=>g(null)})]}):"blockquote"===o?R.jsx(ue,{tooltip:l}):R.jsx("button",{onMouseDown:e=>{e.preventDefault(),g(null),A.includes(o)?H.toggleAlign(u,o):H.toggleMark(u,o)},title:l,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:n,imageColor:o}=Q(),{editor:a}=Q(),{activeBlock:l,setActiveBlock:s,handleBlockTypeChange:i}=ie(a);r.useEffect(()=>{s(H.getCurrentBlock(a,a.selection))},[a.selection]);const c={backgroundColor:n,color:o};return R.jsx(de,{text:e,position:"bottom",children:R.jsx("select",{ref:t,className:"rtf",value:l,onChange:e=>{const t=e.target.value;i(t)},style:c,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:l,imageColor:s,dropdownActive:i,setDropdownActive:c}=Q(),{selectedLanguage:u,setSelectedLanguage:d}=ie(l),p={backgroundColor:a,color:s},g={cs:"C#",cpp:"C++",css:"CSS",diff:"Diff",html:"HTML",java:"Java",javascript:"JavaScript",php:"PHP",python:"Python",ruby:"Ruby",typescript:"TypeScript",xml:"XML"},f=()=>{o(!n),c(!0!=!n?null:"code")},m=e=>{d(e),H.handleCode(l,e),o(!1)};return R.jsxs("div",{ref:t,className:"rtf dropdown tool "+(u&&"init"!==u&&""!==u?"tool--active":""),children:[R.jsx("button",{className:"rtf dropdown-toggle",onClick:f,children:R.jsx(re,{format:"blockCode",imageColor:s})}),n&&"code"===i&&R.jsxs("ul",{style:p,onMouseLeave:f,className:"rtf dropdown-menu",children:[u&&R.jsx("li",{onClick:()=>m("init"),children:"Réinitialiser"}),Object.keys(g).map(e=>R.jsx("li",{onClick:()=>m(e),style:{cursor:"pointer",padding:"5px 10px",backgroundColor:u&&e===u?`color-mix(in srgb, ${a} 80%, ${U(a)?"white":"black"})`:a},children:g[e]},e))]})]})}),me=r.forwardRef((e,t)=>{const{editor:r,imageColor:n,setDropdownActive:o}=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",onClick:()=>o(null),children:R.jsx(re,{format:"image",imageColor:n})})]})}),he=({onClose:e})=>{const{editor:t,backgroundColor:n}=Q(),[o,a]=r.useState(0),[l,s]=r.useState(0),i={backgroundColor:n,color:U(n)?"#FFF":"#000"},c=(e,t)=>{a(e),s(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<=l;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 ",l+1," colonnes"]})]})},be=r.forwardRef(({allButtons:e,hiddenButtons:t},r)=>{const{editor:n,imageColor:o,setDropdownActive:a}=Q(),l=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,i)=>{var c,u;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:()=>(e=>{a(null),e.onClick(n)})(s),disabled:!l,children:R.jsx(re,{format:s.name,imageColor:l?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==(c=H.getTableFromSelection(n).children[0])?void 0:c.children.length)>=5?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:"deleteColumn"===s.name?1===(null==(u=H.getTableFromSelection(n).children[0])?void 0:u.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"})`})})},i)})})}),ye=({activeMarks:e})=>{const[t,n]=r.useState(!1),[o,a]=r.useState([]),l=r.useRef(null),s=r.useRef({}),i=r.useRef(null),{editor:c,imageColor:u,backgroundColor:d,dropdownActive:p,setDropdownActive:g}=Q(),f=[{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)"}],[m,h]=r.useState(!1),[b,y]=r.useState(0),x=["deleteTable","addRow","addColumn","deleteRow","deleteColumn"],v=()=>{h(!m),g(!0!=!m?null:"table")};return r.useEffect(()=>{if(!l.current)return;const e=new ResizeObserver(()=>{(()=>{if(l.current){const e=l.current.clientWidth-15;let t=0;if(f.forEach((e,r)=>{const n=s.current[e.format];n&&(t+=(0===r?n.clientWidth:s.current[f[1].format].clientWidth)+5)}),t>e){let t=0;const r=[];f.forEach((n,o)=>{const a=s.current[n.format];a&&(t+=(0===o?a.clientWidth:s.current[f[1].format].clientWidth)+5,t<=e&&r.push(n.format))});const n=f.map(e=>e.format).filter(e=>!r.includes(e));a(n)}else a([])}})()});return e.observe(l.current),()=>{e.disconnect()}},[]),r.useEffect(()=>{i.current?y(i.current.clientHeight):y(0)},[t]),R.jsxs("div",{className:"rtf toolbar-container",style:{marginBottom:b},children:[R.jsxs("div",{className:"rtf toolbar",onClick:()=>{document.querySelector(".rtf.toolbar").blur()},ref:l,children:[R.jsx(ge,{ref:e=>s.current.blockType=e,tooltip:f.find(e=>"blockType"===e.format).tooltip}),Object.keys(e).map((t,r)=>R.jsx("div",{className:"rtf",ref:e=>s.current[t]=e,style:{display:o.includes(t)?"none":"inline-block"},children:R.jsx(pe,{activeMarks:e,format:t,isActive:e[t],tooltip:f.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:f.find(e=>"table"===e.format).tooltip,position:"bottom",children:R.jsx("button",{ref:e=>s.current.table=e,onClick:v,className:"rtf dropdown-toggle",children:R.jsx(re,{format:"table",imageColor:u})})}),m&&!o.includes("table")&&"table"===p&&R.jsx(he,{onClose:v})]}),R.jsx(be,{allButtons:f,hiddenButtons:o,ref:s}),R.jsx("div",{className:"rtf dropdown tool",style:{display:o.includes("image")?"none":"flex",padding:0},children:R.jsx(de,{text:f.find(e=>"image"===e.format).tooltip,position:"bottom",children:R.jsx(me,{ref:e=>s.current.image=e})})}),R.jsx("div",{className:"rtf dropdown tool",style:{display:o.includes("code")?"none":"flex",padding:0},children:R.jsx(de,{text:f.find(e=>"code"===e.format).tooltip,position:"bottom",children:R.jsx(fe,{ref:e=>s.current.code=e})})}),["undo","redo"].map(e=>R.jsx("div",{className:"rtf dropdown tool",style:{display:o.includes(e)?"none":"flex",padding:0},children:R.jsx(de,{text:f.find(t=>t.format===e).tooltip,position:"bottom",children:R.jsx("button",{ref:t=>s.current[e]=t,className:"rtf tool",style:{display:o.includes(e)?"none":"inline-block"},onMouseDown:t=>{t.preventDefault(),"undo"===e?c.undo():"redo"===e&&c.redo()},children:R.jsx(re,{format:e,imageColor:0===c.history[e+"s"].length?`color-mix(in srgb, ${u} 40%, ${U(u)?"white":"black"})`:u})},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:u})})})]}),t&&R.jsx("div",{className:"rtf toolbar-modal",ref:i,style:{backgroundColor:d},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=>s.current.image=e},t):"code"===t?R.jsx(fe,{ref:e=>s.current.code=e},t):"table"===t?R.jsxs("div",{className:"rtf dropdown tool",children:[R.jsx(de,{text:f.find(e=>e.format===t).tooltip,position:"bottom",children:R.jsx("button",{className:"rtf dropdown-toggle",ref:e=>s.current[t]=e,onClick:v,children:R.jsx(re,{format:t,imageColor:u})})}),m&&"table"===p&&R.jsx(he,{onClose:v})]},t):x.includes(t)?R.jsx(be,{allButtons:f,hiddenButtons:x.filter(e=>e!==t),ref:s},t):null:R.jsx(pe,{activeMarks:e,format:t,isActive:e[t],tooltip:f.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,Ae,Le=(Se||(Se=1,Ee=Ne,Ae=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 l in n={},r[a]=n,t)t.hasOwnProperty(l)&&(n[l]=e(t[l],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],l={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var i in r)r.hasOwnProperty(i)&&(l[i]=r[i]);r.hasOwnProperty(s)||(l[s]=a[s])}var c=n[e];return n[e]=l,o.languages.DFS(o.languages,function(t,r){r===c&&t!=e&&(this[t]=l)}),l},DFS:function e(t,r,n,a){a=a||{};var l=o.util.objId;for(var s in t)if(t.hasOwnProperty(s)){r.call(t,s,t[s],n||s);var i=t[s],c=o.util.type(i);"Object"!==c||a[l(i)]?"Array"!==c||a[l(i)]||(a[l(i)]=!0,e(i,r,s,a)):(a[l(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,l=0;a=n.elements[l++];)o.highlightElement(a,!0===t,n.callback)},highlightElement:function(t,r,n){var a=o.util.getLanguage(t),l=o.languages[a];o.util.setLanguage(t,a);var s=t.parentElement;s&&"pre"===s.nodeName.toLowerCase()&&o.util.setLanguage(s,a);var i={element:t,language:a,grammar:l,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),(s=i.element.parentElement)&&"pre"===s.nodeName.toLowerCase()&&!s.hasAttribute("tabindex")&&s.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),s(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 l(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 s(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=l(k,C,e,b))||F.index>=e.length)break;var N=F.index,E=F.index+F[0].length,A=C;for(A+=w.value.length;N>=A;)A+=(w=w.next).value.length;if(C=A-=w.value.length,w.value instanceof a)continue;for(var L=w;L!==t.tail&&(A<E||"string"==typeof L.value);L=L.next)S++,A+=L.value.length;S--,j=e.slice(C,A),F.index-=C}else if(!(F=l(k,0,j,b)))continue;N=F.index;var T=F[0],$=j.slice(0,N),M=j.slice(N+T.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(T,h):T,x,T)),M&&c(t,w,M),S>1){var O={cause:p+","+f,reach:z};s(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},l=t.alias;l&&(Array.isArray(l)?Array.prototype.push.apply(a.classes,l):a.classes.push(l)),o.hooks.run("wrap",a);var s="";for(var i in a.attributes)s+=" "+i+'="'+(a.attributes[i]||"").replace(/"/g,""")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+s+">"+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,l=r.immediateClose;e.postMessage(o.highlight(a,o.languages[n],n)),l&&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=Ae),void 0!==T&&(T.Prism=Ae),Ae.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]},Ae.languages.markup.tag.inside["attr-value"].inside.entity=Ae.languages.markup.entity,Ae.languages.markup.doctype.inside["internal-subset"].inside=Ae.languages.markup,Ae.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(Ae.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Ae.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};n["language-"+t]={pattern:/[\s\S]+/,inside:Ae.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},Ae.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(Ae.languages.markup.tag,"addAttribute",{value:function(e,t){Ae.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:Ae.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Ae.languages.html=Ae.languages.markup,Ae.languages.mathml=Ae.languages.markup,Ae.languages.svg=Ae.languages.markup,Ae.languages.xml=Ae.languages.extend("markup",{}),Ae.languages.ssml=Ae.languages.xml,Ae.languages.atom=Ae.languages.xml,Ae.languages.rss=Ae.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"))}(Ae),Ae.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:/[{}[\];(),.:]/},Ae.languages.javascript=Ae.languages.extend("clike",{"class-name":[Ae.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}|\?\?=?|\?\.?|[~:]/}),Ae.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Ae.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:Ae.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:Ae.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Ae.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Ae.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:Ae.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Ae.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:Ae.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"}}),Ae.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Ae.languages.markup&&(Ae.languages.markup.tag.addInlined("script","javascript"),Ae.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")),Ae.languages.js=Ae.languages.javascript,function(){if(void 0!==Ae&&"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+'"])';Ae.hooks.add("before-highlightall",function(e){e.selector+=", "+o}),Ae.hooks.add("before-sanity-check",function(a){var l=a.element;if(l.matches(o)){a.code="",l.setAttribute(t,r);var s=l.appendChild(document.createElement("CODE"));s.textContent="Loading…";var i=l.getAttribute("data-src"),c=a.language;if("none"===c){var u=(/\.(\w+)$/.exec(i)||[,"none"])[1];c=e[u]||u}Ae.util.setLanguage(s,c),Ae.util.setLanguage(l,c);var d=Ae.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){l.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]}}(l.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"),l.hasAttribute("data-start")||l.setAttribute("data-start",String(a+1))}s.textContent=e,Ae.highlightElement(s)},function(e){l.setAttribute(t,"failed"),s.textContent=e})}}),Ae.plugins.fileHighlight={highlight:function(e){for(var t,r=(e||document).querySelectorAll(o),n=0;t=r[n++];)Ae.highlightElement(t)}};var a=!1;Ae.fileHighlight=function(){a||(a=!0),Ae.plugins.fileHighlight.highlight.apply(this,arguments)}}}()),Ne.exports);const Te=$(Le);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],l=o.content[3];if(a&&l&&"code-language"===a.type&&"code-block"===l.type&&"string"==typeof a.content){var s=a.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),i="language-"+(s=(/[a-z][\w-]*/i.exec(s)||[""])[0].toLowerCase());l.alias?"string"==typeof l.alias?l.alias=[l.alias,i]:l.alias.push(i):l.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(l,"").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=s[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 l=RegExp(e.languages.markup.tag.pattern.source,"gi"),s={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
141
|
/**
|
|
142
142
|
* @license
|
|
143
143
|
* Copyright (c) 2025 Jahylis
|
|
@@ -158,4 +158,4 @@ function ie(e){const[n,o]=r.useState(""),[a,s]=r.useState(""),[l,i]=r.useState(!
|
|
|
158
158
|
*
|
|
159
159
|
* For any questions or suggestions, please contact: administrateur@nhumeria.fr
|
|
160
160
|
*/
|
|
161
|
-
e.default=({value:e,setValue:a,fullScreen:
|
|
161
|
+
e.default=({value:e,setValue:a,fullScreen:s=!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(()=>l.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},l=o.every(e=>a[e]),s=e.key.toLowerCase()===n;l&&s&&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],l=k.current[a];if(l&&l.text==o)return l.ranges;const s=Te.tokenize(o,Te.languages.javascript);let i=0;for(const t of s){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||s?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=A("element",{type:"paragraph",align:n.align,size:n.fontSize},r.length?r:[{text:""}]);break;case"PRE":o=A("element",{type:"code"},r.length?r:[{text:""}]);break;case"UL":o=A("element",{type:"bullet-list"},r);break;case"OL":o=A("element",{type:"numbered-list"},r);break;case"LI":o=A("element",{type:"list-item"},r.length?r:[{text:""}]);break;case"H1":o=A("element",{type:"h1"},r.length?r:[{text:""}]);break;case"H2":case"H3":case"H4":case"H5":case"H6":o=A("element",{type:"h2",align:n.align},r.length?r:[{text:""}]);break;case"BLOCKQUOTE":o=A("element",{type:"blockquote",align:n.align},r.length?r:[{text:""}]);break;case"IMG":o=A("element",{type:"image",url:e.getAttribute("src")});break;case"TABLE":o=A("element",{type:"table"},r);break;case"TR":o=A("element",{type:"table-row"},r);break;case"TD":o=A("element",{type:"table-cell"},r);break;case"A":o=A("element",{type:"link",url:e.getAttribute("href")},r.length?r:[{text:""}]);break;default:o=r.map(e=>"string"==typeof e?A("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:s}),s&&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=t.length>0?t:[{text:""}],o={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 A("element",{type:"paragraph"},n);case"PRE":return A("element",{type:"code"},n);case"UL":return A("element",{type:"bullet-list"},n);case"OL":return A("element",{type:"numbered-list"},n);case"LI":return A("element",{type:"list-item"},n);case"H1":return A("element",{type:"h1"},n);case"H2":return A("element",{type:"h2"},n);case"BLOCKQUOTE":return A("element",{type:"blockquote"},n);case"IMG":return A("element",{type:"image",url:e.getAttribute("src")});case"TABLE":return A("element",{type:"table"},n);case"TR":return A("element",{type:"table-row"},n);case"TD":return A("element",{type:"table-cell"},n);case"A":return A("element",{type:"link",url:e.getAttribute("href")},n);default:return n.map(e=>"string"==typeof e?A("text",o,e):e)}};return Array.from(t.body.childNodes).map(r).flat().filter(Boolean)},e.serialize=L,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|