@lesjoursfr/edith 4.0.3 → 4.0.4
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/build/edith.js +1 -1
- package/package.json +5 -5
package/build/edith.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("CodeMirror"),require("Popper")):"function"==typeof define&&define.amd?define(["CodeMirror","Popper"],t):"object"==typeof exports?exports.Edith=t(require("CodeMirror"),require("Popper")):e.Edith=t(e.CodeMirror,e.Popper)}(self,function(e,t){return function(){"use strict";var n={690:function(t){t.exports=e},74:function(e){e.exports=t}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,o),r.exports}o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};function a(e,t){return l(e)&&e.tagName===t.toUpperCase()}function s(e){return e.nodeType===Node.TEXT_NODE}function l(e){return e.nodeType===Node.ELEMENT_NODE}function c(e,t){return e.hasAttribute(t)}function d(e,t){return e.getAttribute(t)}function u(e,t){return"string"==typeof t?e.tagName===t.toUpperCase():t.some(t=>e.tagName===t.toUpperCase())}function p(e,t){return e.classList.contains(t)}function f(e,{innerHTML:t,textContent:n,attributes:i}={}){const o=document.createElement(e);if(i)for(const e in i)Object.hasOwnProperty.call(i,e)&&o.setAttribute(e,i[e]);return"string"==typeof t?o.innerHTML=t:"string"==typeof n&&(o.textContent=n),o}function h(e,t){return e.replaceWith(t),t}function m(e){const t=[...e.childNodes];return e.replaceWith(...t),t}function g(e){const t=document.createTextNode(e.textContent??"");return e.replaceWith(t),t}function b(e){return["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e)}function y(e,t){for(const n of[...e.childNodes])t(n)&&n.remove()}function E(e,t){if(t(e))e.remove();else for(const n of[...e.childNodes])E(n,t)}function T(e){y(e,e=>function(e){return e.nodeType===Node.COMMENT_NODE}(e))}function v(e,t){for(const n of e.getAttributeNames())void 0===t[n]&&e.removeAttribute(n);for(const n of Object.keys(t))e.setAttribute(n,t[n])}function A(e){const t=e.getAttribute("style")||"";return(u(e,"b")&&t.match(/font-weight\s*:\s*(normal|400);/)||u(e,"i")&&t.match(/font-style\s*:\s*normal;/)||u(e,["u","s"])&&t.match(/text-decoration\s*:\s*none;/))&&(e=h(e,f("span",{attributes:{style:t},innerHTML:e.innerHTML}))),t.match(/font-weight\s*:\s*(bold|700|800|900);/)?e=h(e,f("b",{innerHTML:`<span style="${t.replace(/font-weight\s*:\s*(bold|700|800|900);/,"")}">${e.innerHTML}</span>`})):t.match(/font-style\s*:\s*italic;/)?e=h(e,f("i",{innerHTML:`<span style="${t.replace(/font-style\s*:\s*italic;/,"")}">${e.innerHTML}</span>`})):t.match(/text-decoration\s*:\s*underline;/)?e=h(e,f("u",{innerHTML:`<span style="${t.replace(/text-decoration\s*:\s*underline;/,"")}">${e.innerHTML}</span>`})):t.match(/text-decoration\s*:\s*line-through;/)&&(e=h(e,f("s",{innerHTML:`<span style="${t.replace(/text-decoration\s*:\s*line-through;/,"")}">${e.innerHTML}</span>`}))),e}function N(e,t){const n=e.childNodes;for(;n.length>0&&a(n[0],t);)n[0].remove();for(;n.length>0&&a(n[n.length-1],t);)n[n.length-1].remove()}o.d(r,{default:function(){return ct}});let w=0;function C(e){const[t,...n]=e.split(".");return{type:t,ns:n??null}}function S(e,t,n){void 0===e.ljbtEvents&&(e.ljbtEvents={});for(const i of t.split(" ")){const{type:t,ns:o}=C(i),r=(++w).toString(10);e.addEventListener(t,n),e.ljbtEvents[r]={type:t,ns:o,handler:n}}}function x(e,t,n){void 0===e.ljbtEvents&&(e.ljbtEvents={});for(const i of t.split(" ")){const{type:t,ns:o}=C(i);for(const[i,r]of Object.entries(e.ljbtEvents))r.type!==t&&"*"!==t||null!==o&&!r.ns?.includes(o[0])||void 0!==n&&("function"!=typeof n||n!==r.handler)||(delete e.ljbtEvents[i],e.removeEventListener(r.type,r.handler))}}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var _;(function e(t,n){function i(e,i,o){if("undefined"!=typeof document){"number"==typeof(o=k({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var a in o)o[a]&&(r+="; "+a,!0!==o[a]&&(r+="="+o[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+r}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},o=0;o<n.length;o++){var r=n[o].split("="),a=r.slice(1).join("=");try{var s=decodeURIComponent(r[0]);if(i[s]=t.read(a,s),e===s)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",k({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,k({},this.attributes,t))},withConverter:function(t){return e(k({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})})({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});!function(e){e[e.localStorage=1]="localStorage",e[e.cookies=2]="cookies"}(_||(_={}));function L(e,t,n={}){let i,o,r,a,s,l=0;const c=!!n.leading,d="maxWait"in n,u=d?Math.max(n.maxWait||0,t):void 0,p=!("trailing"in n)||!!n.trailing;function f(t){const n=i,a=o;return i=o=void 0,l=t,r=e.apply(a,n),r}function h(e,t){return setTimeout(e,t)}function m(e){const n=e-s;return void 0===s||n>=t||n<0||d&&e-l>=u}function g(){const e=Date.now();if(m(e))return function(e){if(a=void 0,p&&i)return f(e);return i=o=void 0,r}(e);a=h(g,function(e){const n=e-l,i=t-(e-s);return d?Math.min(i,u-n):i}(e))}return function(...e){const n=Date.now(),u=m(n);if(i=e,o=this,s=n,u){if(void 0===a)return function(e){return l=e,a=h(g,t),c?f(e):r}(s);if(d)return a=h(g,t),f(s)}return void 0===a&&(a=h(g,t)),r}}const R=/[&<>"']/g;RegExp(R.source),Object.freeze({"&":"&","<":"<",">":">",'"':""","'":"'"});const{entries:M,setPrototypeOf:D,isFrozen:O,getPrototypeOf:I,getOwnPropertyDescriptor:H}=Object;let{freeze:z,seal:U,create:P}=Object,{apply:F,construct:B}="undefined"!=typeof Reflect&&Reflect;z||(z=function(e){return e}),U||(U=function(e){return e}),F||(F=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return e.apply(t,i)}),B||(B=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const j=ie(Array.prototype.forEach),W=ie(Array.prototype.lastIndexOf),G=ie(Array.prototype.pop),V=ie(Array.prototype.push),q=ie(Array.prototype.splice),Y=ie(String.prototype.toLowerCase),$=ie(String.prototype.toString),K=ie(String.prototype.match),X=ie(String.prototype.replace),J=ie(String.prototype.indexOf),Q=ie(String.prototype.trim),Z=ie(Object.prototype.hasOwnProperty),ee=ie(RegExp.prototype.test),te=(ne=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return B(ne,t)});var ne;function ie(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return F(e,t,i)}}function oe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Y;D&&D(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(O(t)||(t[i]=e),o=e)}e[o]=!0}return e}function re(e){for(let t=0;t<e.length;t++){Z(e,t)||(e[t]=null)}return e}function ae(e){const t=P(null);for(const[n,i]of M(e)){Z(e,n)&&(Array.isArray(i)?t[n]=re(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=ae(i):t[n]=i)}return t}function se(e,t){for(;null!==e;){const n=H(e,t);if(n){if(n.get)return ie(n.get);if("function"==typeof n.value)return ie(n.value)}e=I(e)}return function(){return null}}const le=z(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ce=z(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),de=z(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ue=z(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),pe=z(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),fe=z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),he=z(["#text"]),me=z(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ge=z(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),be=z(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ye=z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ee=U(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Te=U(/<%[\w\W]*|[\w\W]*%>/gm),ve=U(/\$\{[\w\W]*/gm),Ae=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ne=U(/^aria-[\-\w]+$/),we=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ce=U(/^(?:\w+script|data):/i),Se=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xe=U(/^html$/i),ke=U(/^[a-z][.\w]*(-[.\w]+)+$/i);var _e=Object.freeze({__proto__:null,ARIA_ATTR:Ne,ATTR_WHITESPACE:Se,CUSTOM_ELEMENT:ke,DATA_ATTR:Ae,DOCTYPE_NAME:xe,ERB_EXPR:Te,IS_ALLOWED_URI:we,IS_SCRIPT_OR_DATA:Ce,MUSTACHE_EXPR:Ee,TMPLIT_EXPR:ve});const Le=1,Re=3,Me=7,De=8,Oe=9,Ie=function(){return"undefined"==typeof window?null:window};var He,ze,Ue=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ie();const n=t=>e(t);if(n.version="3.3.1",n.removed=[],!t||!t.document||t.document.nodeType!==Oe||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:h}=t,m=c.prototype,g=se(m,"cloneNode"),b=se(m,"remove"),y=se(m,"nextSibling"),E=se(m,"childNodes"),T=se(m,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let v,A="";const{implementation:N,createNodeIterator:w,createDocumentFragment:C,getElementsByTagName:S}=i,{importNode:x}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof M&&"function"==typeof T&&N&&void 0!==N.createHTMLDocument;const{MUSTACHE_EXPR:_,ERB_EXPR:L,TMPLIT_EXPR:R,DATA_ATTR:D,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:H,CUSTOM_ELEMENT:U}=_e;let{IS_ALLOWED_URI:F}=_e,B=null;const ne=oe({},[...le,...ce,...de,...pe,...he]);let ie=null;const re=oe({},[...me,...ge,...be,...ye]);let Ee=Object.seal(P(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,ve=null;const Ae=Object.seal(P(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ne=!0,Ce=!0,Se=!1,ke=!0,He=!1,ze=!0,Ue=!1,Pe=!1,Fe=!1,Be=!1,je=!1,We=!1,Ge=!0,Ve=!1,qe=!0,Ye=!1,$e={},Ke=null;const Xe=oe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Je=null;const Qe=oe({},["audio","video","img","source","image","track"]);let Ze=null;const et=oe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml";let ot=it,rt=!1,at=null;const st=oe({},[tt,nt,it],$);let lt=oe({},["mi","mo","mn","ms","mtext"]),ct=oe({},["annotation-xml"]);const dt=oe({},["title","style","font","a","script"]);let ut=null;const pt=["application/xhtml+xml","text/html"];let ft=null,ht=null;const mt=i.createElement("form"),gt=function(e){return e instanceof RegExp||e instanceof Function},bt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ht||ht!==e){if(e&&"object"==typeof e||(e={}),e=ae(e),ut=-1===pt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ft="application/xhtml+xml"===ut?$:Y,B=Z(e,"ALLOWED_TAGS")?oe({},e.ALLOWED_TAGS,ft):ne,ie=Z(e,"ALLOWED_ATTR")?oe({},e.ALLOWED_ATTR,ft):re,at=Z(e,"ALLOWED_NAMESPACES")?oe({},e.ALLOWED_NAMESPACES,$):st,Ze=Z(e,"ADD_URI_SAFE_ATTR")?oe(ae(et),e.ADD_URI_SAFE_ATTR,ft):et,Je=Z(e,"ADD_DATA_URI_TAGS")?oe(ae(Qe),e.ADD_DATA_URI_TAGS,ft):Qe,Ke=Z(e,"FORBID_CONTENTS")?oe({},e.FORBID_CONTENTS,ft):Xe,Te=Z(e,"FORBID_TAGS")?oe({},e.FORBID_TAGS,ft):ae({}),ve=Z(e,"FORBID_ATTR")?oe({},e.FORBID_ATTR,ft):ae({}),$e=!!Z(e,"USE_PROFILES")&&e.USE_PROFILES,Ne=!1!==e.ALLOW_ARIA_ATTR,Ce=!1!==e.ALLOW_DATA_ATTR,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ke=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,He=e.SAFE_FOR_TEMPLATES||!1,ze=!1!==e.SAFE_FOR_XML,Ue=e.WHOLE_DOCUMENT||!1,Be=e.RETURN_DOM||!1,je=e.RETURN_DOM_FRAGMENT||!1,We=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,Ge=!1!==e.SANITIZE_DOM,Ve=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,Ye=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||we,ot=e.NAMESPACE||it,lt=e.MATHML_TEXT_INTEGRATION_POINTS||lt,ct=e.HTML_INTEGRATION_POINTS||ct,Ee=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&>(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ee.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&>(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ee.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ee.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),He&&(Ce=!1),je&&(Be=!0),$e&&(B=oe({},he),ie=[],!0===$e.html&&(oe(B,le),oe(ie,me)),!0===$e.svg&&(oe(B,ce),oe(ie,ge),oe(ie,ye)),!0===$e.svgFilters&&(oe(B,de),oe(ie,ge),oe(ie,ye)),!0===$e.mathMl&&(oe(B,pe),oe(ie,be),oe(ie,ye))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Ae.tagCheck=e.ADD_TAGS:(B===ne&&(B=ae(B)),oe(B,e.ADD_TAGS,ft))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Ae.attributeCheck=e.ADD_ATTR:(ie===re&&(ie=ae(ie)),oe(ie,e.ADD_ATTR,ft))),e.ADD_URI_SAFE_ATTR&&oe(Ze,e.ADD_URI_SAFE_ATTR,ft),e.FORBID_CONTENTS&&(Ke===Xe&&(Ke=ae(Ke)),oe(Ke,e.FORBID_CONTENTS,ft)),e.ADD_FORBID_CONTENTS&&(Ke===Xe&&(Ke=ae(Ke)),oe(Ke,e.ADD_FORBID_CONTENTS,ft)),qe&&(B["#text"]=!0),Ue&&oe(B,["html","head","body"]),B.table&&(oe(B,["tbody"]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw te('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw te('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(h,r)),null!==v&&"string"==typeof A&&(A=v.createHTML(""));z&&z(e),ht=e}},yt=oe({},[...ce,...de,...ue]),Et=oe({},[...pe,...fe]),Tt=function(e){V(n.removed,{element:e});try{T(e).removeChild(e)}catch(t){b(e)}},vt=function(e,t){try{V(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){V(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Be||je)try{Tt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},At=function(e){let t=null,n=null;if(Fe)e="<remove></remove>"+e;else{const t=K(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&ot===it&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(ot===it)try{t=(new f).parseFromString(o,ut)}catch(e){}if(!t||!t.documentElement){t=N.createDocument(ot,"template",null);try{t.documentElement.innerHTML=rt?A:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),ot===it?S.call(t,Ue?"html":"body")[0]:Ue?t.documentElement:r},Nt=function(e){return w.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ct=function(e){return"function"==typeof l&&e instanceof l};function St(e,t,i){j(e,e=>{e.call(n,t,i,ht)})}const xt=function(e){let t=null;if(St(k.beforeSanitizeElements,e,null),wt(e))return Tt(e),!0;const i=ft(e.nodeName);if(St(k.uponSanitizeElement,e,{tagName:i,allowedTags:B}),ze&&e.hasChildNodes()&&!Ct(e.firstElementChild)&&ee(/<[/\w!]/g,e.innerHTML)&&ee(/<[/\w!]/g,e.textContent))return Tt(e),!0;if(e.nodeType===Me)return Tt(e),!0;if(ze&&e.nodeType===De&&ee(/<[/\w]/g,e.data))return Tt(e),!0;if(!(Ae.tagCheck instanceof Function&&Ae.tagCheck(i))&&(!B[i]||Te[i])){if(!Te[i]&&_t(i)){if(Ee.tagNameCheck instanceof RegExp&&ee(Ee.tagNameCheck,i))return!1;if(Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(i))return!1}if(qe&&!Ke[i]){const t=T(e)||e.parentNode,n=E(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=g(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return Tt(e),!0}return e instanceof c&&!function(e){let t=T(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});const n=Y(e.tagName),i=Y(t.tagName);return!!at[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===it?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===i||lt[i]):Boolean(yt[n]):e.namespaceURI===tt?t.namespaceURI===it?"math"===n:t.namespaceURI===nt?"math"===n&&ct[i]:Boolean(Et[n]):e.namespaceURI===it?!(t.namespaceURI===nt&&!ct[i])&&!(t.namespaceURI===tt&&!lt[i])&&!Et[n]&&(dt[n]||!yt[n]):!("application/xhtml+xml"!==ut||!at[e.namespaceURI]))}(e)?(Tt(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!ee(/<\/no(script|embed|frames)/i,e.innerHTML)?(He&&e.nodeType===Re&&(t=e.textContent,j([_,L,R],e=>{t=X(t,e," ")}),e.textContent!==t&&(V(n.removed,{element:e.cloneNode()}),e.textContent=t)),St(k.afterSanitizeElements,e,null),!1):(Tt(e),!0)},kt=function(e,t,n){if(Ge&&("id"===t||"name"===t)&&(n in i||n in mt))return!1;if(Ce&&!ve[t]&&ee(D,t));else if(Ne&&ee(O,t));else if(Ae.attributeCheck instanceof Function&&Ae.attributeCheck(t,e));else if(!ie[t]||ve[t]){if(!(_t(e)&&(Ee.tagNameCheck instanceof RegExp&&ee(Ee.tagNameCheck,e)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(e))&&(Ee.attributeNameCheck instanceof RegExp&&ee(Ee.attributeNameCheck,t)||Ee.attributeNameCheck instanceof Function&&Ee.attributeNameCheck(t,e))||"is"===t&&Ee.allowCustomizedBuiltInElements&&(Ee.tagNameCheck instanceof RegExp&&ee(Ee.tagNameCheck,n)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(n))))return!1}else if(Ze[t]);else if(ee(F,X(n,H,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==J(n,"data:")||!Je[e]){if(Se&&!ee(I,X(n,H,"")));else if(n)return!1}else;return!0},_t=function(e){return"annotation-xml"!==e&&K(e,U)},Lt=function(e){St(k.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||wt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ie,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:s,value:l}=r,c=ft(a),d=l;let u="value"===a?d:Q(d);if(i.attrName=c,i.attrValue=u,i.keepAttr=!0,i.forceKeepAttr=void 0,St(k.uponSanitizeAttribute,e,i),u=i.attrValue,!Ve||"id"!==c&&"name"!==c||(vt(a,e),u="user-content-"+u),ze&&ee(/((--!?|])>)|<\/(style|title|textarea)/i,u)){vt(a,e);continue}if("attributename"===c&&K(u,"href")){vt(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){vt(a,e);continue}if(!ke&&ee(/\/>/i,u)){vt(a,e);continue}He&&j([_,L,R],e=>{u=X(u,e," ")});const p=ft(e.nodeName);if(kt(p,c,u)){if(v&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(p,c)){case"TrustedHTML":u=v.createHTML(u);break;case"TrustedScriptURL":u=v.createScriptURL(u)}if(u!==d)try{s?e.setAttributeNS(s,a,u):e.setAttribute(a,u),wt(e)?Tt(e):G(n.removed)}catch(t){vt(a,e)}}else vt(a,e)}St(k.afterSanitizeAttributes,e,null)},Rt=function e(t){let n=null;const i=Nt(t);for(St(k.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)St(k.uponSanitizeShadowNode,n,null),xt(n),Lt(n),n.content instanceof a&&e(n.content);St(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,s=null,c=null;if(rt=!e,rt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ct(e)){if("function"!=typeof e.toString)throw te("toString is not a function");if("string"!=typeof(e=e.toString()))throw te("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Pe||bt(t),n.removed=[],"string"==typeof e&&(Ye=!1),Ye){if(e.nodeName){const t=ft(e.nodeName);if(!B[t]||Te[t])throw te("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=At("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===Le&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!Be&&!He&&!Ue&&-1===e.indexOf("<"))return v&&We?v.createHTML(e):e;if(i=At(e),!i)return Be?null:We?A:""}i&&Fe&&Tt(i.firstChild);const d=Nt(Ye?e:i);for(;s=d.nextNode();)xt(s),Lt(s),s.content instanceof a&&Rt(s.content);if(Ye)return e;if(Be){if(je)for(c=C.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(ie.shadowroot||ie.shadowrootmode)&&(c=x.call(o,c,!0)),c}let u=Ue?i.outerHTML:i.innerHTML;return Ue&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ee(xe,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),He&&j([_,L,R],e=>{u=X(u,e," ")}),v&&We?v.createHTML(u):u},n.setConfig=function(){bt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Pe=!0},n.clearConfig=function(){ht=null,Pe=!1},n.isValidAttribute=function(e,t,n){ht||bt({});const i=ft(e),o=ft(t);return kt(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&V(k[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=W(k[e],t);return-1===n?void 0:q(k[e],n,1)[0]}return G(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function Pe(){const e=window.getSelection();return{sel:e,range:e.rangeCount?e.getRangeAt(0):void 0}}function Fe(e){const t=document.createRange(),n=window.getSelection();t.setStart(e,1),t.collapse(!0),n.removeAllRanges(),n.addRange(t)}function Be(e){const t=document.createRange(),n=window.getSelection();t.setStartAfter(e),t.collapse(!0),n.removeAllRanges(),n.addRange(t)}function je(e){if(1===e.length&&l(e[0])&&b(e[0].tagName))return void Be(e[0]);const t=document.createRange(),n=window.getSelection();t.setStartBefore(e[0]),t.setEndAfter(e[e.length-1]),n.removeAllRanges(),n.addRange(t)}function We(e){const{range:t}=Pe();return void 0!==t&&(e.contains(t.startContainer)&&e.contains(t.endContainer))}function Ge(e,t){const n=t.parentNode,i=e.cloneRange();i.setStart(n,0);const o=i.extractContents(),r=document.createTextNode("");return o.append(r),n.prepend(o),Fe(r),r}function Ve(e,t){const n=t.parentNode,i=new Range;i.selectNodeContents(n),i.setEnd(e.startContainer,e.startOffset);const o=new Range;o.selectNodeContents(n),o.setStart(e.endContainer,e.endOffset);const r=i.extractContents(),a=o.extractContents();n.prepend(r),n.append(a);let s=l(e.commonAncestorContainer)?e.commonAncestorContainer:e.commonAncestorContainer.parentNode;for(;s.tagName!==t.tagName;)s=s.parentNode;const c=m(s);return je(c),c[0].parentNode}function qe(e,t={}){const{sel:n,range:i}=Pe();if(void 0===i)return;if(i.collapsed){let o=n.anchorNode.parentNode;for(;!p(o,"edith-visual");){if(u(o,e))return Ge(i,o);o=o.parentNode}return function(e,t,n={}){const i=document.createElement(t);return"a"===t?i.textContent=n.textContent||"lien":i.innerHTML="",e.insertNode(i),"a"===t&&i.insertAdjacentText("afterend"," "),Fe(i),i}(i,e,t)}let o=i.commonAncestorContainer;for(;!l(o)||!p(o,"edith-visual");){if(l(o)&&u(o,e))return Ve(i,o);o=o.parentNode}for(const t of[...o.getElementsByTagName(e)])if(n.containsNode(t,!0)){return je(m(t)),o.normalize(),o}const r=document.createElement(e);return r.appendChild(i.extractContents()),i.insertNode(r),y(o,e=>l(e)&&!b(e.tagName)&&(null===e.textContent||0===e.textContent.length)),function(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n.removeAllRanges(),n.addRange(t)}(r),r}function Ye(e,t){for(let n of[...e.children]){if(u(n,"span")&&p(n,"edith-nbsp")){v(n,{class:"edith-nbsp",contenteditable:"false"}),n.innerHTML="¶";continue}n.hasAttribute("style")&&(n=A(n)),t[n.tagName]&&(n=h(n,f("span",{attributes:{style:n.getAttribute("style")||""},innerHTML:n.innerHTML})));const e={...t};if(u(n,["b","i","q","u","s"])&&(e[n.tagName]=!0),Ye(n,e),u(n,"a")){const e={};n.hasAttribute("href")&&(e.href=n.getAttribute("href")),n.hasAttribute("target")&&(e.target=n.getAttribute("target")),v(n,e);continue}if(u(n,["b","i","q","u","s","br","sup"]))v(n,{});else if(u(n,["style","meta","link"]))n.remove();else if(u(n,"p")){if(null===n.textContent||0===n.textContent.trim().length){n.remove();continue}v(n,{}),N(n,"br")}else m(n)}}function $e(e,t){const n=document.createElement("div");return n.innerHTML=Ue.sanitize(e,{USE_PROFILES:{html:!0}}),Ye(n,t),n.normalize(),y(n,e=>s(e)&&(null===e.textContent||0===e.textContent.trim().length)),n.innerHTML=n.innerHTML.replace(/\s* \s*/g," ").replace(/\s+/g," ").replace(/(<\/b>[\n\r\s]*<b>|<\/i>[\n\r\s]*<i>|<\/u>[\n\r\s]*<u>|<\/s>[\n\r\s]*<s>)/g," "),T(n),n}!function(e){e.modeChanged="edith-mode-changed",e.initialized="edith-initialized"}(He||(He={}));class Ke{buffer=[];constructor(){}push(e){this.buffer.push(e),this.buffer.length>20&&this.buffer.shift()}pop(){return 0===this.buffer.length?null:this.buffer.pop()}}!function(e){e[e.Visual=1]="Visual",e[e.Code=2]="Code"}(ze||(ze={}));const Xe={height:80,resizable:!1,toolbar:[["style",["bold","italic","underline","strikethrough"]]],buttons:{},initialContent:""};var Je=o(74);class Qe{el;ctx;icon;title;onclick;showOnCodeView;popperEl;popper;constructor(e,t){this.ctx=e,this.icon=t.icon,this.title=t.title,this.onclick=t.onclick,this.showOnCodeView=!0===t.showOnCodeView}click(e){e.preventDefault(),this.onclick(this.ctx,e)}showTooltip(){if(void 0!==this.popper)return;this.popperEl=f("div",{textContent:this.title,attributes:{class:"edith-tooltip"}});const e=f("div",{attributes:{class:"arrow","data-popper-arrow":""}});this.popperEl.append(e),this.ctx.toolbar.append(this.popperEl),this.popper=(0,Je.createPopper)(this.el,this.popperEl,{placement:"bottom",modifiers:[{name:"arrow",options:{padding:5}},{name:"offset",options:{offset:[0,8]}}]})}hideTooltip(){void 0!==this.popper&&(this.popper.destroy(),this.popper=void 0,this.popperEl?.remove())}onEditorModeChange(e){e.detail.mode===ze.Code?this.el.setAttribute("disabled","disabled"):this.el.removeAttribute("disabled")}render(){return this.el=f("button",{attributes:{class:"edith-btn",type:"button"}}),this.el.append(f("i",{attributes:{class:this.icon}})),this.el.onclick=this.click.bind(this),this.el.onmouseenter=this.showTooltip.bind(this),this.el.onmouseleave=this.hideTooltip.bind(this),!0!==this.showOnCodeView&&this.ctx.on(He.modeChanged,this.onEditorModeChange.bind(this)),this.el}}const Ze=Object.freeze({bold:e=>new Qe(e,{icon:"fa-solid fa-bold",title:"Gras",onclick:e=>{e.editor.wrapInsideTag("b")}}),italic:e=>new Qe(e,{icon:"fa-solid fa-italic",title:"Italique",onclick:e=>{e.editor.wrapInsideTag("i")}}),underline:e=>new Qe(e,{icon:"fa-solid fa-underline",title:"Souligner",onclick:e=>{e.editor.wrapInsideTag("u")}}),strikethrough:e=>new Qe(e,{icon:"fa-solid fa-strikethrough",title:"Barrer",onclick:e=>{e.editor.wrapInsideTag("s")}}),subscript:e=>new Qe(e,{icon:"fa-solid fa-subscript",title:"Indice",onclick:e=>{e.editor.wrapInsideTag("sub")}}),superscript:e=>new Qe(e,{icon:"fa-solid fa-superscript",title:"Exposant",onclick:e=>{e.editor.wrapInsideTag("sup")}}),nbsp:e=>new Qe(e,{icon:"edith-btn-nbsp",title:"Ajouter une espace insécable",onclick:e=>{e.editor.replaceByHtml('<span class="edith-nbsp" contenteditable="false">¶</span>')}}),clear:e=>new Qe(e,{icon:"fa-solid fa-eraser",title:"Effacer la mise en forme",onclick:e=>{e.editor.clearStyle()}}),link:e=>new Qe(e,{icon:"fa-solid fa-link",title:"Lien",onclick:e=>{e.editor.insertLink()}}),codeview:e=>new Qe(e,{icon:"fa-solid fa-code",title:"Afficher le code HTML",onclick:e=>{e.editor.toggleCodeView()},showOnCodeView:!0})});var et,tt=o(690);function nt(e){const t=document.createElement("div");t.setAttribute("class","edith-modal-input");const n=document.createElement("label");n.textContent=e.label;const i=document.createElement("input");return i.setAttribute("name",e.name),i.setAttribute("type","text"),null!==e.initialState&&(i.value=e.initialState.toString()),t.append(n),t.append(i),t}function it(e){const t=document.createElement("div");t.setAttribute("class","edith-modal-checkbox");const n=document.createElement("label");n.textContent=e.label;const i=document.createElement("input");return i.setAttribute("name",e.name),i.setAttribute("type","checkbox"),e.initialState&&(i.checked=!0),n.prepend(i),t.append(n),t}function ot(e,t,n=null){return{fieldType:et.input,label:e,name:t,initialState:n}}function rt(e,t,n=!1){return{fieldType:et.checkbox,label:e,name:t,initialState:n}}!function(e){e[e.input=1]="input",e[e.checkbox=2]="checkbox"}(et||(et={}));class at{el;ctx;title;fields;callback;constructor(e,t){this.ctx=e,this.title=t.title,this.fields=t.fields||[],this.callback=t.callback}cancel(e){e.preventDefault(),this.callback(null),this.close()}submit(e){e.preventDefault();const t={};for(const e of this.el.querySelectorAll("input"))c(e,"name")&&(t[d(e,"name")]="checkbox"===d(e,"type")?e.checked:e.value);this.callback(t),this.close()}close(){this.el.remove()}show(){this.el=f("div",{attributes:{class:"edith-modal"}});const e=f("div",{attributes:{class:"edith-modal-header"}}),t=f("span",{textContent:this.title,attributes:{class:"edith-modal-title"}});e.append(t);const n=f("div",{attributes:{class:"edith-modal-content"}});for(const e of this.fields)switch(e.fieldType){case et.input:n.append(nt(e));break;case et.checkbox:n.append(it(e));break;default:throw new Error(`Unknown fieldType ${e.fieldType}`)}const i=f("div",{attributes:{class:"edith-modal-footer"}}),o=f("button",{textContent:"Annuler",attributes:{class:"edith-modal-cancel",type:"button"}});i.append(o);const r=f("button",{textContent:"Valider",attributes:{class:"edith-modal-submit",type:"button"}});return i.append(r),this.el.append(e),this.el.append(n),this.el.append(i),this.ctx.modals.append(this.el),o.onclick=this.cancel.bind(this),r.onclick=this.submit.bind(this),this.el}}class st{el;ctx;content;height;resizable;mode;visualEditor;codeEditor;codeMirror;history;throttledSnapshots;constructor(e,t){this.ctx=e,this.content=t.initialContent,this.height=t.height,this.resizable=t.resizable,this.mode=ze.Visual,this.history=new Ke,this.throttledSnapshots=function(e,t,n={}){return L(e,t,{leading:!("leading"in n)||!!n.leading,trailing:!("trailing"in n)||!!n.trailing,maxWait:t})}(()=>this.takeSnapshot(),3e3,{leading:!1,trailing:!0}),this.content=this.content.replace(/ /g,'<span class="edith-nbsp" contenteditable="false">¶</span>')}render(){this.el=f("div",{attributes:{class:"edith-editing-area",style:this.resizable?`min-height: ${this.height}px; resize: vertical`:`height: ${this.height}px`}}),this.visualEditor=f("div",{innerHTML:this.content,attributes:{class:"edith-visual",contenteditable:"true",style:this.resizable?`min-height: ${this.height-10}px`:`height: ${this.height-10}px`}}),this.el.append(this.visualEditor),this.codeEditor=f("div",{attributes:{class:"edith-code edith-hidden"}}),this.el.append(this.codeEditor);const e=this.onKeyEvent.bind(this);this.visualEditor.addEventListener("keydown",e),this.visualEditor.addEventListener("keyup",e);const t=this.onPasteEvent.bind(this);return this.visualEditor.addEventListener("paste",t),this.el}getVisualEditorElement(){return this.visualEditor}getCodeEditorElement(){return this.codeEditor}setContent(e){e=e.replace(/ /g,'<span class="edith-nbsp" contenteditable="false">¶</span>'),this.mode===ze.Visual?this.visualEditor.innerHTML=e:this.codeMirror.dispatch({changes:{from:0,to:this.codeMirror.state.doc.length,insert:e}})}getContent(){const e=this.mode===ze.Visual?this.visualEditor.innerHTML:this.codeMirror.state.doc.toJSON().map(e=>e.trim()).join("\n");if("<p><br></p>"===e)return"";const t=f("div",{innerHTML:e});E(t,e=>l(e)&&!b(e.tagName)&&(null===e.textContent||0===e.textContent.length));for(const e of t.querySelectorAll("[style]"))e.removeAttribute("style");for(const e of t.querySelectorAll("span"))0===e.attributes.length&&m(e);return t.innerHTML.replace(/\u200B/gi,"").replace(/<\/p>\s*<p>/gi,"<br>").replace(/(<p>|<\/p>)/gi,"").replace(/<span[^>]+class="edith-nbsp"[^>]*>[^<]*<\/span>/gi," ").replace(/(?:<br\s?\/?>)+$/gi,"")}takeSnapshot(){this.history.push(this.visualEditor.innerHTML)}restoreSnapshot(){this.visualEditor.innerHTML=this.history.pop()??""}wrapInsideTag(e){We(this.visualEditor)&&(qe(e),this.takeSnapshot())}replaceByHtml(e){We(this.visualEditor)&&(!function(e){const{sel:t,range:n}=Pe();if(void 0===n)return;const i=document.createDocumentFragment(),o=f("div",{innerHTML:e});i.append(...o.childNodes);const r=i.childNodes[i.childNodes.length-1];t.deleteFromDocument(),n.insertNode(i),Be(r)}(e),this.takeSnapshot())}clearStyle(){!function(){const{sel:e,range:t}=Pe();if(void 0!==t&&l(t.commonAncestorContainer))for(const n of[...t.commonAncestorContainer.children])e.containsNode(n,!0)&&g(n)}(),this.takeSnapshot()}insertLink(){const{sel:e,range:t}=Pe();if(void 0===t)return;const n=new at(this.ctx,{title:"Insérer un lien",fields:[ot("Texte à afficher","text",t.toString()),ot("URL du lien","href"),rt("Ouvrir dans une nouvelle fenêtre","openInNewTab",!0)],callback:n=>{null!==n&&(function(e){const t=window.getSelection();t.removeAllRanges(),void 0!==e.range&&t.addRange(e.range)}({sel:e,range:t}),function(e,t,n){const i=qe("a",{textContent:e});if(void 0!==i)l(i)&&(i.setAttribute("href",t),!0===n&&i.setAttribute("target","_blank"))}(n.text,n.href,n.openInNewTab))}});n.show()}toggleCodeView(){if(this.mode===ze.Visual){this.mode=ze.Code,this.visualEditor.classList.add("edith-hidden"),this.codeEditor.classList.remove("edith-hidden");const e=document.createElement("div");this.codeEditor.append(e),this.codeMirror=new tt.EditorView({doc:this.visualEditor.innerHTML,extensions:[tt.basicSetup,tt.EditorView.lineWrapping,(0,tt.html)({matchClosingTags:!0,autoCloseTags:!0})],parent:e})}else this.mode=ze.Visual,this.codeEditor.classList.add("edith-hidden"),this.visualEditor.classList.remove("edith-hidden"),this.visualEditor.innerHTML=this.codeMirror.state.doc.toJSON().map(e=>e.trim()).join("\n"),this.codeMirror.destroy(),this.codeMirror=void 0,this.codeEditor.innerHTML="";this.ctx.trigger(He.modeChanged,{mode:this.mode})}onKeyEvent(e){(e.metaKey||e.ctrlKey?this._processKeyEventWithMeta(e):this._processKeyEvent(e))&&(e.preventDefault(),e.stopPropagation())}_processKeyEvent(e){return"Enter"===e.key?("keydown"===e.type&&this.replaceByHtml("<br />"),!0):(this.throttledSnapshots(),!1)}_processKeyEventWithMeta(e){switch(e.key){case"Enter":return"keydown"===e.type&&this.replaceByHtml("<br />"),!0;case" ":return"keydown"===e.type&&this.replaceByHtml('<span class="edith-nbsp" contenteditable="false">¶</span>'),!0;case"b":return"keydown"===e.type&&this.wrapInsideTag("b"),!0;case"i":return"keydown"===e.type&&this.wrapInsideTag("i"),!0;case"k":return"keydown"===e.type&&this.insertLink(),!0;case"u":return"keydown"===e.type&&this.wrapInsideTag("u"),!0;case"s":return"keydown"===e.type&&this.wrapInsideTag("s"),!0;case"z":return"keydown"===e.type&&this.restoreSnapshot(),!0}return!1}onPasteEvent(e){e.preventDefault(),e.stopPropagation();const{sel:t,range:n}=Pe();if(void 0===n||null===e.clipboardData)return;const i=document.createDocumentFragment();if(e.clipboardData.types.includes("text/html")){let n=s(t.anchorNode)?t.anchorNode.parentNode:t.anchorNode;const o={B:!1,I:!1,U:!1,S:!1,Q:!1};for(;null!==n&&!p(n,"edith-visual");)u(n,["b","i","u","s","q"])&&(o[(n.tagName,"Q")]=!0),n=n.parentNode;let r=e.clipboardData.getData("text/html").replace(/[\r\n]+/g," ");/^<html>\s*<body>/.test(r)||(r="<html><body>"+r+"</body></html>");const a=$e(r,o);i.append(...a.childNodes)}else{const t=e.clipboardData.getData("text/plain").split(/[\r\n]+/g);for(let e=0;e<t.length;e++)0!==e&&i.append(document.createElement("br")),i.append(document.createTextNode(t[e]))}t.deleteFromDocument(),n.insertNode(i)}destroy(){this.codeMirror?.destroy(),this.codeMirror=void 0,this.el.remove()}}class lt{element;toolbar;editor;modals;constructor(e,t){var n,i;this.element=e,n=this.element,"string"==typeof(i="edith")?n.classList.add(i):n.classList.add(...i),this.toolbar=f("div",{attributes:{class:"edith-toolbar"}}),this.element.append(this.toolbar);const o=t.buttons??Xe.buttons,r=t.toolbar??Xe.toolbar;for(const{0:e,1:t}of r){const n=document.createElement("div");n.setAttribute("id",e),n.setAttribute("class","edith-btn-group"),this.toolbar.append(n);for(const e of t){const t=o[e]??Ze[e];n.append(t(this).render())}}this.editor=new st(this,{initialContent:t.initialContent??Xe.initialContent,height:t.height??Xe.height,resizable:t.resizable??Xe.resizable}),this.element.append(this.editor.render()),this.modals=f("div",{attributes:{class:"edith-modals"}}),this.element.append(this.modals),this.element.edith=this,this.trigger(He.initialized)}on(e,t){!function(e,t,n){if(e instanceof NodeList)for(const i of e)S(i,t,n);else S(e,t,n)}(this.element,e,t)}off(e,t){!function(e,t,n){if(e instanceof NodeList)for(const i of e)x(i,t,n);else x(e,t,n)}(this.element,e,t)}trigger(e,t){!function(e,t,n){e.dispatchEvent("string"==typeof t?new CustomEvent(t,{detail:n}):t)}(this.element,e,t)}setContent(e){this.editor.setContent(e)}getContent(){return this.editor.getContent()}destroy(){var e,t;e=this.element,"string"==typeof(t="edith")?e.classList.remove(t):e.classList.remove(...t),this.modals.remove(),this.editor.destroy(),this.toolbar.remove(),this.element.remove()}}lt.EdithButton=Qe;var ct=lt;return r=r.default}()});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("CodeMirror"),require("Popper")):"function"==typeof define&&define.amd?define(["CodeMirror","Popper"],t):"object"==typeof exports?exports.Edith=t(require("CodeMirror"),require("Popper")):e.Edith=t(e.CodeMirror,e.Popper)}(self,function(e,t){return function(){"use strict";var n={690:function(t){t.exports=e},74:function(e){e.exports=t}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,o),r.exports}o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};function a(e,t){return l(e)&&e.tagName===t.toUpperCase()}function s(e){return e.nodeType===Node.TEXT_NODE}function l(e){return e.nodeType===Node.ELEMENT_NODE}function c(e,t){return e.hasAttribute(t)}function d(e,t){return e.getAttribute(t)}function u(e,t){return"string"==typeof t?e.tagName===t.toUpperCase():t.some(t=>e.tagName===t.toUpperCase())}function p(e,t){return e.classList.contains(t)}function h(e,{innerHTML:t,textContent:n,attributes:i}={}){const o=document.createElement(e);if(i)for(const e in i)Object.hasOwnProperty.call(i,e)&&o.setAttribute(e,i[e]);return"string"==typeof t?o.innerHTML=t:"string"==typeof n&&(o.textContent=n),o}function f(e,t){return e.replaceWith(t),t}function m(e){const t=[...e.childNodes];return e.replaceWith(...t),t}function g(e){const t=document.createTextNode(e.textContent??"");return e.replaceWith(t),t}function b(e){return["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e)}function y(e,t){for(const n of[...e.childNodes])t(n)&&n.remove()}function E(e,t){if(t(e))e.remove();else for(const n of[...e.childNodes])E(n,t)}function T(e){y(e,e=>function(e){return e.nodeType===Node.COMMENT_NODE}(e))}function v(e,t){for(const n of e.getAttributeNames())void 0===t[n]&&e.removeAttribute(n);for(const n of Object.keys(t))e.setAttribute(n,t[n])}function A(e){const t=e.getAttribute("style")||"";return(u(e,"b")&&t.match(/font-weight\s*:\s*(normal|400);/)||u(e,"i")&&t.match(/font-style\s*:\s*normal;/)||u(e,["u","s"])&&t.match(/text-decoration\s*:\s*none;/))&&(e=f(e,h("span",{attributes:{style:t},innerHTML:e.innerHTML}))),t.match(/font-weight\s*:\s*(bold|700|800|900);/)?e=f(e,h("b",{innerHTML:`<span style="${t.replace(/font-weight\s*:\s*(bold|700|800|900);/,"")}">${e.innerHTML}</span>`})):t.match(/font-style\s*:\s*italic;/)?e=f(e,h("i",{innerHTML:`<span style="${t.replace(/font-style\s*:\s*italic;/,"")}">${e.innerHTML}</span>`})):t.match(/text-decoration\s*:\s*underline;/)?e=f(e,h("u",{innerHTML:`<span style="${t.replace(/text-decoration\s*:\s*underline;/,"")}">${e.innerHTML}</span>`})):t.match(/text-decoration\s*:\s*line-through;/)&&(e=f(e,h("s",{innerHTML:`<span style="${t.replace(/text-decoration\s*:\s*line-through;/,"")}">${e.innerHTML}</span>`}))),e}function N(e,t){const n=e.childNodes;for(;n.length>0&&a(n[0],t);)n[0].remove();for(;n.length>0&&a(n[n.length-1],t);)n[n.length-1].remove()}o.d(r,{default:function(){return ct}});let w=0;function C(e){const[t,...n]=e.split(":");return{type:t,ns:n.length>0?n[0]:null}}function S(e,t,n,i){void 0===e.ljbtEvents&&(e.ljbtEvents={});for(const o of t.split(" ")){const{type:t,ns:r}=C(o),a=(++w).toString(10);e.addEventListener(t,n),e.ljbtEvents[a]={type:t,ns:r,handler:n,originalHandler:i}}}function x(e,t,n){void 0===e.ljbtEvents&&(e.ljbtEvents={});for(const i of t.split(" ")){const{type:t,ns:o}=C(i);for(const[i,r]of Object.entries(e.ljbtEvents))r.type!==t&&"*"!==t||null!==o&&o!==r.ns||void 0!==n&&n!==(r.originalHandler??r.handler)||(delete e.ljbtEvents[i],e.removeEventListener(r.type,r.handler))}}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var _;(function e(t,n){function i(e,i,o){if("undefined"!=typeof document){"number"==typeof(o=k({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var a in o)o[a]&&(r+="; "+a,!0!==o[a]&&(r+="="+o[a].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+r}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],i={},o=0;o<n.length;o++){var r=n[o].split("="),a=r.slice(1).join("=");try{var s=decodeURIComponent(r[0]);if(i[s]=t.read(a,s),e===s)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){i(e,"",k({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,k({},this.attributes,t))},withConverter:function(t){return e(k({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})})({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});!function(e){e[e.localStorage=1]="localStorage",e[e.cookies=2]="cookies"}(_||(_={}));function L(e,t,n={}){let i,o,r,a,s,l=0;const c=!!n.leading,d="maxWait"in n,u=d?Math.max(n.maxWait||0,t):void 0,p=!("trailing"in n)||!!n.trailing;function h(t){const n=i,a=o;return i=o=void 0,l=t,r=e.apply(a,n),r}function f(e,t){return setTimeout(e,t)}function m(e){const n=e-s;return void 0===s||n>=t||n<0||d&&e-l>=u}function g(){const e=Date.now();if(m(e))return function(e){if(a=void 0,p&&i)return h(e);return i=o=void 0,r}(e);a=f(g,function(e){const n=e-l,i=t-(e-s);return d?Math.min(i,u-n):i}(e))}return function(...e){const n=Date.now(),u=m(n);if(i=e,o=this,s=n,u){if(void 0===a)return function(e){return l=e,a=f(g,t),c?h(e):r}(s);if(d)return a=f(g,t),h(s)}return void 0===a&&(a=f(g,t)),r}}const R=/[&<>"']/g;RegExp(R.source),Object.freeze({"&":"&","<":"<",">":">",'"':""","'":"'"});const{entries:M,setPrototypeOf:D,isFrozen:O,getPrototypeOf:I,getOwnPropertyDescriptor:H}=Object;let{freeze:z,seal:U,create:P}=Object,{apply:F,construct:B}="undefined"!=typeof Reflect&&Reflect;z||(z=function(e){return e}),U||(U=function(e){return e}),F||(F=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return e.apply(t,i)}),B||(B=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const j=ie(Array.prototype.forEach),W=ie(Array.prototype.lastIndexOf),G=ie(Array.prototype.pop),V=ie(Array.prototype.push),q=ie(Array.prototype.splice),Y=ie(String.prototype.toLowerCase),$=ie(String.prototype.toString),K=ie(String.prototype.match),X=ie(String.prototype.replace),J=ie(String.prototype.indexOf),Q=ie(String.prototype.trim),Z=ie(Object.prototype.hasOwnProperty),ee=ie(RegExp.prototype.test),te=(ne=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return B(ne,t)});var ne;function ie(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return F(e,t,i)}}function oe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Y;D&&D(e,null);let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(O(t)||(t[i]=e),o=e)}e[o]=!0}return e}function re(e){for(let t=0;t<e.length;t++){Z(e,t)||(e[t]=null)}return e}function ae(e){const t=P(null);for(const[n,i]of M(e)){Z(e,n)&&(Array.isArray(i)?t[n]=re(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=ae(i):t[n]=i)}return t}function se(e,t){for(;null!==e;){const n=H(e,t);if(n){if(n.get)return ie(n.get);if("function"==typeof n.value)return ie(n.value)}e=I(e)}return function(){return null}}const le=z(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ce=z(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),de=z(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ue=z(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),pe=z(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),he=z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fe=z(["#text"]),me=z(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ge=z(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),be=z(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ye=z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ee=U(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Te=U(/<%[\w\W]*|[\w\W]*%>/gm),ve=U(/\$\{[\w\W]*/gm),Ae=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ne=U(/^aria-[\-\w]+$/),we=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ce=U(/^(?:\w+script|data):/i),Se=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xe=U(/^html$/i),ke=U(/^[a-z][.\w]*(-[.\w]+)+$/i);var _e=Object.freeze({__proto__:null,ARIA_ATTR:Ne,ATTR_WHITESPACE:Se,CUSTOM_ELEMENT:ke,DATA_ATTR:Ae,DOCTYPE_NAME:xe,ERB_EXPR:Te,IS_ALLOWED_URI:we,IS_SCRIPT_OR_DATA:Ce,MUSTACHE_EXPR:Ee,TMPLIT_EXPR:ve});const Le=1,Re=3,Me=7,De=8,Oe=9,Ie=function(){return"undefined"==typeof window?null:window};var He,ze,Ue=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ie();const n=t=>e(t);if(n.version="3.3.1",n.removed=[],!t||!t.document||t.document.nodeType!==Oe||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const o=i,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:f}=t,m=c.prototype,g=se(m,"cloneNode"),b=se(m,"remove"),y=se(m,"nextSibling"),E=se(m,"childNodes"),T=se(m,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let v,A="";const{implementation:N,createNodeIterator:w,createDocumentFragment:C,getElementsByTagName:S}=i,{importNode:x}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof M&&"function"==typeof T&&N&&void 0!==N.createHTMLDocument;const{MUSTACHE_EXPR:_,ERB_EXPR:L,TMPLIT_EXPR:R,DATA_ATTR:D,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:H,CUSTOM_ELEMENT:U}=_e;let{IS_ALLOWED_URI:F}=_e,B=null;const ne=oe({},[...le,...ce,...de,...pe,...fe]);let ie=null;const re=oe({},[...me,...ge,...be,...ye]);let Ee=Object.seal(P(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,ve=null;const Ae=Object.seal(P(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ne=!0,Ce=!0,Se=!1,ke=!0,He=!1,ze=!0,Ue=!1,Pe=!1,Fe=!1,Be=!1,je=!1,We=!1,Ge=!0,Ve=!1,qe=!0,Ye=!1,$e={},Ke=null;const Xe=oe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Je=null;const Qe=oe({},["audio","video","img","source","image","track"]);let Ze=null;const et=oe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml";let ot=it,rt=!1,at=null;const st=oe({},[tt,nt,it],$);let lt=oe({},["mi","mo","mn","ms","mtext"]),ct=oe({},["annotation-xml"]);const dt=oe({},["title","style","font","a","script"]);let ut=null;const pt=["application/xhtml+xml","text/html"];let ht=null,ft=null;const mt=i.createElement("form"),gt=function(e){return e instanceof RegExp||e instanceof Function},bt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ft||ft!==e){if(e&&"object"==typeof e||(e={}),e=ae(e),ut=-1===pt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ht="application/xhtml+xml"===ut?$:Y,B=Z(e,"ALLOWED_TAGS")?oe({},e.ALLOWED_TAGS,ht):ne,ie=Z(e,"ALLOWED_ATTR")?oe({},e.ALLOWED_ATTR,ht):re,at=Z(e,"ALLOWED_NAMESPACES")?oe({},e.ALLOWED_NAMESPACES,$):st,Ze=Z(e,"ADD_URI_SAFE_ATTR")?oe(ae(et),e.ADD_URI_SAFE_ATTR,ht):et,Je=Z(e,"ADD_DATA_URI_TAGS")?oe(ae(Qe),e.ADD_DATA_URI_TAGS,ht):Qe,Ke=Z(e,"FORBID_CONTENTS")?oe({},e.FORBID_CONTENTS,ht):Xe,Te=Z(e,"FORBID_TAGS")?oe({},e.FORBID_TAGS,ht):ae({}),ve=Z(e,"FORBID_ATTR")?oe({},e.FORBID_ATTR,ht):ae({}),$e=!!Z(e,"USE_PROFILES")&&e.USE_PROFILES,Ne=!1!==e.ALLOW_ARIA_ATTR,Ce=!1!==e.ALLOW_DATA_ATTR,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ke=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,He=e.SAFE_FOR_TEMPLATES||!1,ze=!1!==e.SAFE_FOR_XML,Ue=e.WHOLE_DOCUMENT||!1,Be=e.RETURN_DOM||!1,je=e.RETURN_DOM_FRAGMENT||!1,We=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,Ge=!1!==e.SANITIZE_DOM,Ve=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,Ye=e.IN_PLACE||!1,F=e.ALLOWED_URI_REGEXP||we,ot=e.NAMESPACE||it,lt=e.MATHML_TEXT_INTEGRATION_POINTS||lt,ct=e.HTML_INTEGRATION_POINTS||ct,Ee=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&>(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ee.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&>(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ee.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ee.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),He&&(Ce=!1),je&&(Be=!0),$e&&(B=oe({},fe),ie=[],!0===$e.html&&(oe(B,le),oe(ie,me)),!0===$e.svg&&(oe(B,ce),oe(ie,ge),oe(ie,ye)),!0===$e.svgFilters&&(oe(B,de),oe(ie,ge),oe(ie,ye)),!0===$e.mathMl&&(oe(B,pe),oe(ie,be),oe(ie,ye))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Ae.tagCheck=e.ADD_TAGS:(B===ne&&(B=ae(B)),oe(B,e.ADD_TAGS,ht))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Ae.attributeCheck=e.ADD_ATTR:(ie===re&&(ie=ae(ie)),oe(ie,e.ADD_ATTR,ht))),e.ADD_URI_SAFE_ATTR&&oe(Ze,e.ADD_URI_SAFE_ATTR,ht),e.FORBID_CONTENTS&&(Ke===Xe&&(Ke=ae(Ke)),oe(Ke,e.FORBID_CONTENTS,ht)),e.ADD_FORBID_CONTENTS&&(Ke===Xe&&(Ke=ae(Ke)),oe(Ke,e.ADD_FORBID_CONTENTS,ht)),qe&&(B["#text"]=!0),Ue&&oe(B,["html","head","body"]),B.table&&(oe(B,["tbody"]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw te('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw te('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,A=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(f,r)),null!==v&&"string"==typeof A&&(A=v.createHTML(""));z&&z(e),ft=e}},yt=oe({},[...ce,...de,...ue]),Et=oe({},[...pe,...he]),Tt=function(e){V(n.removed,{element:e});try{T(e).removeChild(e)}catch(t){b(e)}},vt=function(e,t){try{V(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){V(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Be||je)try{Tt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},At=function(e){let t=null,n=null;if(Fe)e="<remove></remove>"+e;else{const t=K(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&ot===it&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(ot===it)try{t=(new h).parseFromString(o,ut)}catch(e){}if(!t||!t.documentElement){t=N.createDocument(ot,"template",null);try{t.documentElement.innerHTML=rt?A:o}catch(e){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(i.createTextNode(n),r.childNodes[0]||null),ot===it?S.call(t,Ue?"html":"body")[0]:Ue?t.documentElement:r},Nt=function(e){return w.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ct=function(e){return"function"==typeof l&&e instanceof l};function St(e,t,i){j(e,e=>{e.call(n,t,i,ft)})}const xt=function(e){let t=null;if(St(k.beforeSanitizeElements,e,null),wt(e))return Tt(e),!0;const i=ht(e.nodeName);if(St(k.uponSanitizeElement,e,{tagName:i,allowedTags:B}),ze&&e.hasChildNodes()&&!Ct(e.firstElementChild)&&ee(/<[/\w!]/g,e.innerHTML)&&ee(/<[/\w!]/g,e.textContent))return Tt(e),!0;if(e.nodeType===Me)return Tt(e),!0;if(ze&&e.nodeType===De&&ee(/<[/\w]/g,e.data))return Tt(e),!0;if(!(Ae.tagCheck instanceof Function&&Ae.tagCheck(i))&&(!B[i]||Te[i])){if(!Te[i]&&_t(i)){if(Ee.tagNameCheck instanceof RegExp&&ee(Ee.tagNameCheck,i))return!1;if(Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(i))return!1}if(qe&&!Ke[i]){const t=T(e)||e.parentNode,n=E(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const o=g(n[i],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,y(e))}}}return Tt(e),!0}return e instanceof c&&!function(e){let t=T(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});const n=Y(e.tagName),i=Y(t.tagName);return!!at[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===it?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===i||lt[i]):Boolean(yt[n]):e.namespaceURI===tt?t.namespaceURI===it?"math"===n:t.namespaceURI===nt?"math"===n&&ct[i]:Boolean(Et[n]):e.namespaceURI===it?!(t.namespaceURI===nt&&!ct[i])&&!(t.namespaceURI===tt&&!lt[i])&&!Et[n]&&(dt[n]||!yt[n]):!("application/xhtml+xml"!==ut||!at[e.namespaceURI]))}(e)?(Tt(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!ee(/<\/no(script|embed|frames)/i,e.innerHTML)?(He&&e.nodeType===Re&&(t=e.textContent,j([_,L,R],e=>{t=X(t,e," ")}),e.textContent!==t&&(V(n.removed,{element:e.cloneNode()}),e.textContent=t)),St(k.afterSanitizeElements,e,null),!1):(Tt(e),!0)},kt=function(e,t,n){if(Ge&&("id"===t||"name"===t)&&(n in i||n in mt))return!1;if(Ce&&!ve[t]&&ee(D,t));else if(Ne&&ee(O,t));else if(Ae.attributeCheck instanceof Function&&Ae.attributeCheck(t,e));else if(!ie[t]||ve[t]){if(!(_t(e)&&(Ee.tagNameCheck instanceof RegExp&&ee(Ee.tagNameCheck,e)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(e))&&(Ee.attributeNameCheck instanceof RegExp&&ee(Ee.attributeNameCheck,t)||Ee.attributeNameCheck instanceof Function&&Ee.attributeNameCheck(t,e))||"is"===t&&Ee.allowCustomizedBuiltInElements&&(Ee.tagNameCheck instanceof RegExp&&ee(Ee.tagNameCheck,n)||Ee.tagNameCheck instanceof Function&&Ee.tagNameCheck(n))))return!1}else if(Ze[t]);else if(ee(F,X(n,H,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==J(n,"data:")||!Je[e]){if(Se&&!ee(I,X(n,H,"")));else if(n)return!1}else;return!0},_t=function(e){return"annotation-xml"!==e&&K(e,U)},Lt=function(e){St(k.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||wt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ie,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:a,namespaceURI:s,value:l}=r,c=ht(a),d=l;let u="value"===a?d:Q(d);if(i.attrName=c,i.attrValue=u,i.keepAttr=!0,i.forceKeepAttr=void 0,St(k.uponSanitizeAttribute,e,i),u=i.attrValue,!Ve||"id"!==c&&"name"!==c||(vt(a,e),u="user-content-"+u),ze&&ee(/((--!?|])>)|<\/(style|title|textarea)/i,u)){vt(a,e);continue}if("attributename"===c&&K(u,"href")){vt(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){vt(a,e);continue}if(!ke&&ee(/\/>/i,u)){vt(a,e);continue}He&&j([_,L,R],e=>{u=X(u,e," ")});const p=ht(e.nodeName);if(kt(p,c,u)){if(v&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(p,c)){case"TrustedHTML":u=v.createHTML(u);break;case"TrustedScriptURL":u=v.createScriptURL(u)}if(u!==d)try{s?e.setAttributeNS(s,a,u):e.setAttribute(a,u),wt(e)?Tt(e):G(n.removed)}catch(t){vt(a,e)}}else vt(a,e)}St(k.afterSanitizeAttributes,e,null)},Rt=function e(t){let n=null;const i=Nt(t);for(St(k.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)St(k.uponSanitizeShadowNode,n,null),xt(n),Lt(n),n.content instanceof a&&e(n.content);St(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,r=null,s=null,c=null;if(rt=!e,rt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ct(e)){if("function"!=typeof e.toString)throw te("toString is not a function");if("string"!=typeof(e=e.toString()))throw te("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Pe||bt(t),n.removed=[],"string"==typeof e&&(Ye=!1),Ye){if(e.nodeName){const t=ht(e.nodeName);if(!B[t]||Te[t])throw te("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=At("\x3c!----\x3e"),r=i.ownerDocument.importNode(e,!0),r.nodeType===Le&&"BODY"===r.nodeName||"HTML"===r.nodeName?i=r:i.appendChild(r);else{if(!Be&&!He&&!Ue&&-1===e.indexOf("<"))return v&&We?v.createHTML(e):e;if(i=At(e),!i)return Be?null:We?A:""}i&&Fe&&Tt(i.firstChild);const d=Nt(Ye?e:i);for(;s=d.nextNode();)xt(s),Lt(s),s.content instanceof a&&Rt(s.content);if(Ye)return e;if(Be){if(je)for(c=C.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(ie.shadowroot||ie.shadowrootmode)&&(c=x.call(o,c,!0)),c}let u=Ue?i.outerHTML:i.innerHTML;return Ue&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ee(xe,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),He&&j([_,L,R],e=>{u=X(u,e," ")}),v&&We?v.createHTML(u):u},n.setConfig=function(){bt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Pe=!0},n.clearConfig=function(){ft=null,Pe=!1},n.isValidAttribute=function(e,t,n){ft||bt({});const i=ht(e),o=ht(t);return kt(i,o,n)},n.addHook=function(e,t){"function"==typeof t&&V(k[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=W(k[e],t);return-1===n?void 0:q(k[e],n,1)[0]}return G(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function Pe(){const e=window.getSelection();return{sel:e,range:e.rangeCount?e.getRangeAt(0):void 0}}function Fe(e){const t=document.createRange(),n=window.getSelection();t.setStart(e,1),t.collapse(!0),n.removeAllRanges(),n.addRange(t)}function Be(e){const t=document.createRange(),n=window.getSelection();t.setStartAfter(e),t.collapse(!0),n.removeAllRanges(),n.addRange(t)}function je(e){if(1===e.length&&l(e[0])&&b(e[0].tagName))return void Be(e[0]);const t=document.createRange(),n=window.getSelection();t.setStartBefore(e[0]),t.setEndAfter(e[e.length-1]),n.removeAllRanges(),n.addRange(t)}function We(e){const{range:t}=Pe();return void 0!==t&&(e.contains(t.startContainer)&&e.contains(t.endContainer))}function Ge(e,t){const n=t.parentNode,i=e.cloneRange();i.setStart(n,0);const o=i.extractContents(),r=document.createTextNode("");return o.append(r),n.prepend(o),Fe(r),r}function Ve(e,t){const n=t.parentNode,i=new Range;i.selectNodeContents(n),i.setEnd(e.startContainer,e.startOffset);const o=new Range;o.selectNodeContents(n),o.setStart(e.endContainer,e.endOffset);const r=i.extractContents(),a=o.extractContents();n.prepend(r),n.append(a);let s=l(e.commonAncestorContainer)?e.commonAncestorContainer:e.commonAncestorContainer.parentNode;for(;s.tagName!==t.tagName;)s=s.parentNode;const c=m(s);return je(c),c[0].parentNode}function qe(e,t={}){const{sel:n,range:i}=Pe();if(void 0===i)return;if(i.collapsed){let o=n.anchorNode.parentNode;for(;!p(o,"edith-visual");){if(u(o,e))return Ge(i,o);o=o.parentNode}return function(e,t,n={}){const i=document.createElement(t);return"a"===t?i.textContent=n.textContent||"lien":i.innerHTML="",e.insertNode(i),"a"===t&&i.insertAdjacentText("afterend"," "),Fe(i),i}(i,e,t)}let o=i.commonAncestorContainer;for(;!l(o)||!p(o,"edith-visual");){if(l(o)&&u(o,e))return Ve(i,o);o=o.parentNode}for(const t of[...o.getElementsByTagName(e)])if(n.containsNode(t,!0)){return je(m(t)),o.normalize(),o}const r=document.createElement(e);return r.appendChild(i.extractContents()),i.insertNode(r),y(o,e=>l(e)&&!b(e.tagName)&&(null===e.textContent||0===e.textContent.length)),function(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n.removeAllRanges(),n.addRange(t)}(r),r}function Ye(e,t){for(let n of[...e.children]){if(u(n,"span")&&p(n,"edith-nbsp")){v(n,{class:"edith-nbsp",contenteditable:"false"}),n.innerHTML="¶";continue}n.hasAttribute("style")&&(n=A(n)),t[n.tagName]&&(n=f(n,h("span",{attributes:{style:n.getAttribute("style")||""},innerHTML:n.innerHTML})));const e={...t};if(u(n,["b","i","q","u","s"])&&(e[n.tagName]=!0),Ye(n,e),u(n,"a")){const e={};n.hasAttribute("href")&&(e.href=n.getAttribute("href")),n.hasAttribute("target")&&(e.target=n.getAttribute("target")),v(n,e);continue}if(u(n,["b","i","q","u","s","br","sup"]))v(n,{});else if(u(n,["style","meta","link"]))n.remove();else if(u(n,"p")){if(null===n.textContent||0===n.textContent.trim().length){n.remove();continue}v(n,{}),N(n,"br")}else m(n)}}function $e(e,t){const n=document.createElement("div");return n.innerHTML=Ue.sanitize(e,{USE_PROFILES:{html:!0}}),Ye(n,t),n.normalize(),y(n,e=>s(e)&&(null===e.textContent||0===e.textContent.trim().length)),n.innerHTML=n.innerHTML.replace(/\s* \s*/g," ").replace(/\s+/g," ").replace(/(<\/b>[\n\r\s]*<b>|<\/i>[\n\r\s]*<i>|<\/u>[\n\r\s]*<u>|<\/s>[\n\r\s]*<s>)/g," "),T(n),n}!function(e){e.modeChanged="edith-mode-changed",e.initialized="edith-initialized"}(He||(He={}));class Ke{buffer=[];constructor(){}push(e){this.buffer.push(e),this.buffer.length>20&&this.buffer.shift()}pop(){return 0===this.buffer.length?null:this.buffer.pop()}}!function(e){e[e.Visual=1]="Visual",e[e.Code=2]="Code"}(ze||(ze={}));const Xe={height:80,resizable:!1,toolbar:[["style",["bold","italic","underline","strikethrough"]]],buttons:{},initialContent:""};var Je=o(74);class Qe{el;ctx;icon;title;onclick;showOnCodeView;popperEl;popper;constructor(e,t){this.ctx=e,this.icon=t.icon,this.title=t.title,this.onclick=t.onclick,this.showOnCodeView=!0===t.showOnCodeView}click(e){e.preventDefault(),this.onclick(this.ctx,e)}showTooltip(){if(void 0!==this.popper)return;this.popperEl=h("div",{textContent:this.title,attributes:{class:"edith-tooltip"}});const e=h("div",{attributes:{class:"arrow","data-popper-arrow":""}});this.popperEl.append(e),this.ctx.toolbar.append(this.popperEl),this.popper=(0,Je.createPopper)(this.el,this.popperEl,{placement:"bottom",modifiers:[{name:"arrow",options:{padding:5}},{name:"offset",options:{offset:[0,8]}}]})}hideTooltip(){void 0!==this.popper&&(this.popper.destroy(),this.popper=void 0,this.popperEl?.remove())}onEditorModeChange(e){e.detail.mode===ze.Code?this.el.setAttribute("disabled","disabled"):this.el.removeAttribute("disabled")}render(){return this.el=h("button",{attributes:{class:"edith-btn",type:"button"}}),this.el.append(h("i",{attributes:{class:this.icon}})),this.el.onclick=this.click.bind(this),this.el.onmouseenter=this.showTooltip.bind(this),this.el.onmouseleave=this.hideTooltip.bind(this),!0!==this.showOnCodeView&&this.ctx.on(He.modeChanged,this.onEditorModeChange.bind(this)),this.el}}const Ze=Object.freeze({bold:e=>new Qe(e,{icon:"fa-solid fa-bold",title:"Gras",onclick:e=>{e.editor.wrapInsideTag("b")}}),italic:e=>new Qe(e,{icon:"fa-solid fa-italic",title:"Italique",onclick:e=>{e.editor.wrapInsideTag("i")}}),underline:e=>new Qe(e,{icon:"fa-solid fa-underline",title:"Souligner",onclick:e=>{e.editor.wrapInsideTag("u")}}),strikethrough:e=>new Qe(e,{icon:"fa-solid fa-strikethrough",title:"Barrer",onclick:e=>{e.editor.wrapInsideTag("s")}}),subscript:e=>new Qe(e,{icon:"fa-solid fa-subscript",title:"Indice",onclick:e=>{e.editor.wrapInsideTag("sub")}}),superscript:e=>new Qe(e,{icon:"fa-solid fa-superscript",title:"Exposant",onclick:e=>{e.editor.wrapInsideTag("sup")}}),nbsp:e=>new Qe(e,{icon:"edith-btn-nbsp",title:"Ajouter une espace insécable",onclick:e=>{e.editor.replaceByHtml('<span class="edith-nbsp" contenteditable="false">¶</span>')}}),clear:e=>new Qe(e,{icon:"fa-solid fa-eraser",title:"Effacer la mise en forme",onclick:e=>{e.editor.clearStyle()}}),link:e=>new Qe(e,{icon:"fa-solid fa-link",title:"Lien",onclick:e=>{e.editor.insertLink()}}),codeview:e=>new Qe(e,{icon:"fa-solid fa-code",title:"Afficher le code HTML",onclick:e=>{e.editor.toggleCodeView()},showOnCodeView:!0})});var et,tt=o(690);function nt(e){const t=document.createElement("div");t.setAttribute("class","edith-modal-input");const n=document.createElement("label");n.textContent=e.label;const i=document.createElement("input");return i.setAttribute("name",e.name),i.setAttribute("type","text"),null!==e.initialState&&(i.value=e.initialState.toString()),t.append(n),t.append(i),t}function it(e){const t=document.createElement("div");t.setAttribute("class","edith-modal-checkbox");const n=document.createElement("label");n.textContent=e.label;const i=document.createElement("input");return i.setAttribute("name",e.name),i.setAttribute("type","checkbox"),e.initialState&&(i.checked=!0),n.prepend(i),t.append(n),t}function ot(e,t,n=null){return{fieldType:et.input,label:e,name:t,initialState:n}}function rt(e,t,n=!1){return{fieldType:et.checkbox,label:e,name:t,initialState:n}}!function(e){e[e.input=1]="input",e[e.checkbox=2]="checkbox"}(et||(et={}));class at{el;ctx;title;fields;callback;constructor(e,t){this.ctx=e,this.title=t.title,this.fields=t.fields||[],this.callback=t.callback}cancel(e){e.preventDefault(),this.callback(null),this.close()}submit(e){e.preventDefault();const t={};for(const e of this.el.querySelectorAll("input"))c(e,"name")&&(t[d(e,"name")]="checkbox"===d(e,"type")?e.checked:e.value);this.callback(t),this.close()}close(){this.el.remove()}show(){this.el=h("div",{attributes:{class:"edith-modal"}});const e=h("div",{attributes:{class:"edith-modal-header"}}),t=h("span",{textContent:this.title,attributes:{class:"edith-modal-title"}});e.append(t);const n=h("div",{attributes:{class:"edith-modal-content"}});for(const e of this.fields)switch(e.fieldType){case et.input:n.append(nt(e));break;case et.checkbox:n.append(it(e));break;default:throw new Error(`Unknown fieldType ${e.fieldType}`)}const i=h("div",{attributes:{class:"edith-modal-footer"}}),o=h("button",{textContent:"Annuler",attributes:{class:"edith-modal-cancel",type:"button"}});i.append(o);const r=h("button",{textContent:"Valider",attributes:{class:"edith-modal-submit",type:"button"}});return i.append(r),this.el.append(e),this.el.append(n),this.el.append(i),this.ctx.modals.append(this.el),o.onclick=this.cancel.bind(this),r.onclick=this.submit.bind(this),this.el}}class st{el;ctx;content;height;resizable;mode;visualEditor;codeEditor;codeMirror;history;throttledSnapshots;constructor(e,t){this.ctx=e,this.content=t.initialContent,this.height=t.height,this.resizable=t.resizable,this.mode=ze.Visual,this.history=new Ke,this.throttledSnapshots=function(e,t,n={}){return L(e,t,{leading:!("leading"in n)||!!n.leading,trailing:!("trailing"in n)||!!n.trailing,maxWait:t})}(()=>this.takeSnapshot(),3e3,{leading:!1,trailing:!0}),this.content=this.content.replace(/ /g,'<span class="edith-nbsp" contenteditable="false">¶</span>')}render(){this.el=h("div",{attributes:{class:"edith-editing-area",style:this.resizable?`min-height: ${this.height}px; resize: vertical`:`height: ${this.height}px`}}),this.visualEditor=h("div",{innerHTML:this.content,attributes:{class:"edith-visual",contenteditable:"true",style:this.resizable?`min-height: ${this.height-10}px`:`height: ${this.height-10}px`}}),this.el.append(this.visualEditor),this.codeEditor=h("div",{attributes:{class:"edith-code edith-hidden"}}),this.el.append(this.codeEditor);const e=this.onKeyEvent.bind(this);this.visualEditor.addEventListener("keydown",e),this.visualEditor.addEventListener("keyup",e);const t=this.onPasteEvent.bind(this);return this.visualEditor.addEventListener("paste",t),this.el}getVisualEditorElement(){return this.visualEditor}getCodeEditorElement(){return this.codeEditor}setContent(e){e=e.replace(/ /g,'<span class="edith-nbsp" contenteditable="false">¶</span>'),this.mode===ze.Visual?this.visualEditor.innerHTML=e:this.codeMirror.dispatch({changes:{from:0,to:this.codeMirror.state.doc.length,insert:e}})}getContent(){const e=this.mode===ze.Visual?this.visualEditor.innerHTML:this.codeMirror.state.doc.toJSON().map(e=>e.trim()).join("\n");if("<p><br></p>"===e)return"";const t=h("div",{innerHTML:e});E(t,e=>l(e)&&!b(e.tagName)&&(null===e.textContent||0===e.textContent.length));for(const e of t.querySelectorAll("[style]"))e.removeAttribute("style");for(const e of t.querySelectorAll("span"))0===e.attributes.length&&m(e);return t.innerHTML.replace(/\u200B/gi,"").replace(/<\/p>\s*<p>/gi,"<br>").replace(/(<p>|<\/p>)/gi,"").replace(/<span[^>]+class="edith-nbsp"[^>]*>[^<]*<\/span>/gi," ").replace(/(?:<br\s?\/?>)+$/gi,"")}takeSnapshot(){this.history.push(this.visualEditor.innerHTML)}restoreSnapshot(){this.visualEditor.innerHTML=this.history.pop()??""}wrapInsideTag(e){We(this.visualEditor)&&(qe(e),this.takeSnapshot())}replaceByHtml(e){We(this.visualEditor)&&(!function(e){const{sel:t,range:n}=Pe();if(void 0===n)return;const i=document.createDocumentFragment(),o=h("div",{innerHTML:e});i.append(...o.childNodes);const r=i.childNodes[i.childNodes.length-1];t.deleteFromDocument(),n.insertNode(i),Be(r)}(e),this.takeSnapshot())}clearStyle(){!function(){const{sel:e,range:t}=Pe();if(void 0!==t&&l(t.commonAncestorContainer))for(const n of[...t.commonAncestorContainer.children])e.containsNode(n,!0)&&g(n)}(),this.takeSnapshot()}insertLink(){const{sel:e,range:t}=Pe();if(void 0===t)return;const n=new at(this.ctx,{title:"Insérer un lien",fields:[ot("Texte à afficher","text",t.toString()),ot("URL du lien","href"),rt("Ouvrir dans une nouvelle fenêtre","openInNewTab",!0)],callback:n=>{null!==n&&(function(e){const t=window.getSelection();t.removeAllRanges(),void 0!==e.range&&t.addRange(e.range)}({sel:e,range:t}),function(e,t,n){const i=qe("a",{textContent:e});if(void 0!==i)l(i)&&(i.setAttribute("href",t),!0===n&&i.setAttribute("target","_blank"))}(n.text,n.href,n.openInNewTab))}});n.show()}toggleCodeView(){if(this.mode===ze.Visual){this.mode=ze.Code,this.visualEditor.classList.add("edith-hidden"),this.codeEditor.classList.remove("edith-hidden");const e=document.createElement("div");this.codeEditor.append(e),this.codeMirror=new tt.EditorView({doc:this.visualEditor.innerHTML,extensions:[tt.basicSetup,tt.EditorView.lineWrapping,(0,tt.html)({matchClosingTags:!0,autoCloseTags:!0})],parent:e})}else this.mode=ze.Visual,this.codeEditor.classList.add("edith-hidden"),this.visualEditor.classList.remove("edith-hidden"),this.visualEditor.innerHTML=this.codeMirror.state.doc.toJSON().map(e=>e.trim()).join("\n"),this.codeMirror.destroy(),this.codeMirror=void 0,this.codeEditor.innerHTML="";this.ctx.trigger(He.modeChanged,{mode:this.mode})}onKeyEvent(e){(e.metaKey||e.ctrlKey?this._processKeyEventWithMeta(e):this._processKeyEvent(e))&&(e.preventDefault(),e.stopPropagation())}_processKeyEvent(e){return"Enter"===e.key?("keydown"===e.type&&this.replaceByHtml("<br />"),!0):(this.throttledSnapshots(),!1)}_processKeyEventWithMeta(e){switch(e.key){case"Enter":return"keydown"===e.type&&this.replaceByHtml("<br />"),!0;case" ":return"keydown"===e.type&&this.replaceByHtml('<span class="edith-nbsp" contenteditable="false">¶</span>'),!0;case"b":return"keydown"===e.type&&this.wrapInsideTag("b"),!0;case"i":return"keydown"===e.type&&this.wrapInsideTag("i"),!0;case"k":return"keydown"===e.type&&this.insertLink(),!0;case"u":return"keydown"===e.type&&this.wrapInsideTag("u"),!0;case"s":return"keydown"===e.type&&this.wrapInsideTag("s"),!0;case"z":return"keydown"===e.type&&this.restoreSnapshot(),!0}return!1}onPasteEvent(e){e.preventDefault(),e.stopPropagation();const{sel:t,range:n}=Pe();if(void 0===n||null===e.clipboardData)return;const i=document.createDocumentFragment();if(e.clipboardData.types.includes("text/html")){let n=s(t.anchorNode)?t.anchorNode.parentNode:t.anchorNode;const o={B:!1,I:!1,U:!1,S:!1,Q:!1};for(;null!==n&&!p(n,"edith-visual");)u(n,["b","i","u","s","q"])&&(o[(n.tagName,"Q")]=!0),n=n.parentNode;let r=e.clipboardData.getData("text/html").replace(/[\r\n]+/g," ");/^<html>\s*<body>/.test(r)||(r="<html><body>"+r+"</body></html>");const a=$e(r,o);i.append(...a.childNodes)}else{const t=e.clipboardData.getData("text/plain").split(/[\r\n]+/g);for(let e=0;e<t.length;e++)0!==e&&i.append(document.createElement("br")),i.append(document.createTextNode(t[e]))}t.deleteFromDocument(),n.insertNode(i)}destroy(){this.codeMirror?.destroy(),this.codeMirror=void 0,this.el.remove()}}class lt{element;toolbar;editor;modals;constructor(e,t){var n,i;this.element=e,n=this.element,"string"==typeof(i="edith")?n.classList.add(i):n.classList.add(...i),this.toolbar=h("div",{attributes:{class:"edith-toolbar"}}),this.element.append(this.toolbar);const o=t.buttons??Xe.buttons,r=t.toolbar??Xe.toolbar;for(const{0:e,1:t}of r){const n=document.createElement("div");n.setAttribute("id",e),n.setAttribute("class","edith-btn-group"),this.toolbar.append(n);for(const e of t){const t=o[e]??Ze[e];n.append(t(this).render())}}this.editor=new st(this,{initialContent:t.initialContent??Xe.initialContent,height:t.height??Xe.height,resizable:t.resizable??Xe.resizable}),this.element.append(this.editor.render()),this.modals=h("div",{attributes:{class:"edith-modals"}}),this.element.append(this.modals),this.element.edith=this,this.trigger(He.initialized)}on(e,t){!function(e,t,n){if(e instanceof NodeList)for(const i of e)S(i,t,n);else S(e,t,n)}(this.element,e,t)}off(e,t){!function(e,t,n){if(e instanceof NodeList)for(const i of e)x(i,t,n);else x(e,t,n)}(this.element,e,t)}trigger(e,t){!function(e,t,n){e.dispatchEvent("string"==typeof t?new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0}):t)}(this.element,e,t)}setContent(e){this.editor.setContent(e)}getContent(){return this.editor.getContent()}destroy(){var e,t;e=this.element,"string"==typeof(t="edith")?e.classList.remove(t):e.classList.remove(...t),this.modals.remove(),this.editor.destroy(),this.toolbar.remove(),this.element.remove()}}lt.EdithButton=Qe;var ct=lt;return r=r.default}()});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lesjoursfr/edith",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Simple WYSIWYG editor.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "lesjoursfr/edith",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"editor"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@lesjoursfr/browser-tools": "^
|
|
50
|
+
"@lesjoursfr/browser-tools": "^3.0.0",
|
|
51
51
|
"dompurify": "^3.3.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"babel-loader": "10.0.0",
|
|
68
68
|
"codemirror": "6.0.2",
|
|
69
69
|
"css-loader": "7.1.4",
|
|
70
|
-
"css-minimizer-webpack-plugin": "
|
|
70
|
+
"css-minimizer-webpack-plugin": "8.0.0",
|
|
71
71
|
"eslint": "10.0.2",
|
|
72
72
|
"eslint-config-prettier": "10.1.8",
|
|
73
73
|
"fs-extra": "11.3.3",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"jsdom": "28.1.0",
|
|
76
76
|
"mini-css-extract-plugin": "2.10.0",
|
|
77
77
|
"mocha": "11.7.5",
|
|
78
|
-
"postcss": "8.5.
|
|
78
|
+
"postcss": "8.5.8",
|
|
79
79
|
"prettier": "3.8.1",
|
|
80
80
|
"sass": "1.97.3",
|
|
81
81
|
"sass-loader": "16.0.7",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"built": true
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
|
-
"packageManager": "yarn@4.
|
|
104
|
+
"packageManager": "yarn@4.13.0"
|
|
105
105
|
}
|