froala-editor
Version:
The next generation Javascript WYSIWYG HTML rich text editor made by devs for devs. High performance and modern design make it easy to use for developers and loved by users.
7 lines (6 loc) • 26 kB
JavaScript
/*!
* froala_editor v5.0.1 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2026 Froala Labs
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],e):e(("undefined"!=typeof globalThis?globalThis:t||self).FroalaEditor)}(this,function(S){"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){{var r;if(t)return"string"==typeof t?n(t,e):"Map"===(r="Object"===(r={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Object.assign(S.DEFAULTS,{wordDeniedTags:[],wordDeniedAttrs:[],wordAllowedStyleProps:["font-family","font-size","background","color","width","text-align","vertical-align","background-color","padding","margin","height","margin-top","margin-left","margin-right","margin-bottom","text-decoration","font-weight","font-style","text-indent","border","border-.*","line-height","list-style-type","text-transform"],wordPasteModal:!0,wordPasteKeepFormatting:!0}),S.PLUGINS.wordPaste=function(w){var r,n,v,M=w.$,i="word_paste",f={},N=!0;function l(t){var e=w.opts.wordAllowedStyleProps,t=(t||(w.opts.wordAllowedStyleProps=["list-style-type","margin-left"]),n=s(n=(n=0===n.indexOf("<colgroup>")?"<table>"+n+"</table>":n).replace(/<span[\n\r ]*style='mso-spacerun:yes'>([\r\n\u00a0 ]*)<\/span>/g,function(t,e){for(var r="",n=0;n++<e.length;)r+=" ";return r}),w.paste.getRtfClipboard()),w.doc.createElement("DIV"));t.innerHTML=n,w.html.cleanBlankSpaces(t),n=t.innerHTML,n=(n=w.paste.cleanEmptyTagsAndDivs(n)).replace(/\u200b/g,""),w.modals.hide(i),(w.helpers.isMobile()||w.opts.iframe)&&w.events.focus(),w.paste.clean(n,!0,!0),w.opts.wordAllowedStyleProps=e}function A(t){t.parentNode&&t.parentNode.removeChild(t)}function H(t,e){if(e(t))for(var r=t.firstChild;r;){var n=r,i=r.previousSibling,r=r.nextSibling;H(n,e),n.previousSibling||n.nextSibling||n.parentNode||!r||i===r.previousSibling||!r.parentNode?n.previousSibling||n.nextSibling||n.parentNode||!r||r.previousSibling||r.nextSibling||r.parentNode||(i?r=n.childNodes.length?i.nextSibling:i.nextSibling?i.nextSibling.nextSibling:null:t.firstChild&&(r=t.firstChild.nextSibling)):r=i?i.nextSibling:t.firstChild}}function O(t){return M(t).hasClass("ListContainerWrapper")&&0<M(t).find("ol").length}function I(t){return M(t).hasClass("ListContainerWrapper")&&0<M(t).find("ul").length}function P(t){if(O(t)||I(t))return 1;if(t.getAttribute("style")&&/mso-list:[\s]*l/gi.test(t.getAttribute("style").replace(/\n/gi,""))){try{if(!t.querySelector('[style="mso-list:Ignore"]'))return!!(t.outerHTML&&0<=t.outerHTML.indexOf("\x3c!--[if !supportLists]--\x3e"))}catch(e){return}return 1}}var g=null,c={};function _(t){var e;if(O(t)||I(t))e=M(t).find("li").attr("data-aria-level");else{var r=(null==(r=t.getAttribute("style"))?void 0:r.replace(/\n/g,""))||"",n=g&&(null==(n=g.getAttribute("style"))?void 0:n.replace(/\n/g,""))||"",i=r.match(/mso-list:(\s*l([0-9]+)\s*level([0-9]+)\s*)lfo([0-9]+)/i),l=n.match(/mso-list:(\s*l([0-9]+)\s*level([0-9]+)\s*)lfo([0-9]+)/i);if(i){if(c[i[1]])return g=t,c[i[1]].toString();var a=l&&l[2],s=i[2],n=n&&c[l[1]]||0,s=a&&a!==s&&parseFloat((null==(a=g)||null==(a=a.style)?void 0:a.marginLeft)||0)<parseFloat(t.style.marginLeft||0)?n+parseInt(i[3],10):parseInt(i[3],10);!l||l[4]===i[4]&&l[3]===i[3]||s!==parseInt(i[3],10)||(s+=1),e=s.toString(),c[i[1]]=s}else e=r.replace(/.*level([0-9]+?).*/gi,"$1")}return g=t,e}function D(t,e,r,n){var i,l,a,s,o,d,u,f=navigator.userAgent.toLowerCase(),g=(-1!=f.indexOf("safari")&&(f=-1<f.indexOf("chrome")?1:"safari"),t.innerHTML.includes("mso-list:\nIgnore")&&(t.innerHTML=t.innerHTML.replace(/mso-list:\nIgnore/gi,"mso-list:Ignore")),/[0-9a-zA-Z\u0590-\u05FF]./gi),c="",p=O(t),m=null==(m=M(t).find("ol"))||null==(m=m.attr("style"))||null==(m=m.split(";"))?void 0:m.find(function(t){return t.trim().startsWith("list-style-type")});if(m==undefined&&I(t)&&(m=null==(N=M(t).find("ul"))||null==(N=N.attr("style"))||null==(N=N.split(";"))?void 0:N.find(function(t){return t.trim().startsWith("list-style-type")})),p)s="ol",o=m?"list-style-type: "+m.replace("list-style-type:","").trim()+";":"";else if(I(t))s="ul",o=m?"list-style-type: "+m.replace("list-style-type:","").trim()+";":"";else{var h=t.querySelector('span[style="mso-list:Ignore"]');if(!h)for(var b=t.querySelectorAll('span[style*="mso-list"]'),y=0;y<b.length;y++)if("mso-list:Ignore"===b[y].getAttribute("style").replace(/[\n\r\s]+/g,"")){h=b[y];break}var v,N=!1;(h=null==h&&"safari"==f?t.querySelector('span[lang="PT-BR"]'):h)&&(N=N||g.test(h.textContent),N="o"!==h.textContent.trim()&&N),null!==h&&(v=h.textContent.trim().split(".")[0]),s=1==N?(v=(v=h.textContent.trim().split(".")[0]).replace(/\(([^)]+)\)|[)]$/g,"$1"),isNaN(parseInt(v))?/^(m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3}))$/.test(v)?(o="lower-roman;",t.nextElementSibling&&1===t.nextElementSibling.textContent.trim().split(".")[0].length&&(o="lower-alpha;")):/^(M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3}))$/.test(v)?(o="upper-roman;",t.nextElementSibling&&1===t.nextElementSibling.textContent.trim().split(".")[0].length&&(o="upper-alpha;")):/^[\u0590-\u05FF]$/.test(v)?o="hebrew;":v.match(/^v$/)||(v.match(/^[a-z]$/)||v.match(/^[a-z]\)$/)?o="lower-alpha;":(v.match(/^[A-Z]$/)||v.match(/^[A-Z]\)$/))&&(o="upper-alpha;")):o="decimal;",o=o?"list-style-type: "+o:"","ol"):("\xa7"==(v=null!=h?h.textContent.trim().split(".")[0]:v)?o="square;":"\xb7"==v?o="disc;":"o"==v&&(o="circle;"),o=o?"list-style-type: "+o:"","ul"),h==undefined||h.textContent==undefined||isNaN(parseInt(h.textContent.trim().split(".")[1],10))||(c=' class="decimal_type" ')}for(var m=1,f="",N=(_(t),t.style.marginLeft),A="",x=function(t){t=t?t.match(/margin-left\s*:\s*([^;]+)/i):null;return t?t[1].trim():""}(e[t.tagName.toLowerCase()+"."+t.className]),x=x||0,E=(N&&parseFloat(N)!==parseFloat(x)&&(N.includes("in")?(A="in",N=parseFloat(N)-.5):N.includes("pt")?(A="px",N=parseFloat(N)-10):N.includes("cm")&&(A="cm",N=parseFloat(N)-1),u=" margin-left: "+N+A+";"),m="list-style-type: upper-alpha;"==o?p?parseInt(M(t).find("ol").attr("start")):v.charCodeAt(0)-64:"list-style-type: lower-alpha;"==o?p?parseInt(M(t).find("ol").attr("start")):v.charCodeAt(0)-96:"list-style-type: upper-roman;"==o||"list-style-type: lower-roman;"==o?p?parseInt(M(t).find("ol").attr("start")):function(t){for(var e={I:1,V:5,X:10,L:50,C:100,D:500,M:1e3,i:1,v:5,x:10,l:50,c:100,d:500,m:1e3},r=0,n=0,i=t.length-1;0<=i;i--){var l=e[t[i]];n<=l?r+=l:r-=l,n=l}return r}(v):"list-style-type: hebrew;"===o?p?parseInt(M(t).find("ol").attr("start")):v.charCodeAt(0)-1488+1:p?parseInt(M(t).find("ol").attr("start")):parseInt(v),f=f+(o||"")+(u||""),d="<"+s,"none"===t.style.display&&(d+=' class="fr-mso-hidden"'),d=(d=(d+=c||"")+("ol"!=s||1==m||isNaN(m)?"":' start = "'+m+'"'))+(f?' style = "'+f+'"':"")+">",!1);t;){if(!P(t)){if(t.outerHTML&&0<t.outerHTML.indexOf("mso-bookmark")&&0==(t.textContent||"").length){t=t.nextElementSibling;continue}break}var C=_(t);if((r=r||C)<C)d+=(a=D(t,e,C,t.style.marginLeft)).el.outerHTML,t=a.currentNode;else{if(C<r)break;var S=O(t),T=l&&O(l);if(l&&S!==T)break;t.firstElementChild&&t.firstElementChild.firstElementChild&&t.firstElementChild.firstElementChild.firstChild&&(g.lastIndex=0),l&&l.firstElementChild&&l.firstElementChild.firstElementChild&&l.firstElementChild.firstElementChild.firstChild&&(g.lastIndex=0,i=g.test(l.firstElementChild.firstElementChild.firstChild.data||l.firstElementChild.firstElementChild.firstChild.firstChild&&l.firstElementChild.firstElementChild.firstChild.firstChild.data||""));var L,S=!1,T=l&&_(l),S=((!n&&!t.style.marginLeft||n&&t.style.marginLeft&&n===t.style.marginLeft||T&&T===C)&&(S=!0),n=t.style.marginLeft,S||i===undefined?(T=function(t,n){var e=t.cloneNode(!0),r=(-1!==["H1","H2","H3","H4","H5","H6"].indexOf(t.tagName)&&((o=document.createElement(t.tagName.toLowerCase())).setAttribute("style",t.getAttribute("style")),o.innerHTML=e.innerHTML,e.innerHTML=o.outerHTML),H(e,function(t){if(t.nodeType==Node.COMMENT_NODE&&(w.browser.msie||w.browser.safari||w.browser.edge))try{if("[if !supportLists]"===t.data){for(t=t.nextSibling;t&&t.nodeType!==Node.COMMENT_NODE;){var e=t.nextSibling;t.parentNode.removeChild(t),t=e}t&&t.nodeType==Node.COMMENT_NODE&&t.parentNode.removeChild(t)}}catch(r){return!1}return t.nodeType===Node.ELEMENT_NODE&&(t.getAttribute("style")&&"mso-list:Ignore"===t.getAttribute("style").replace(/[\n\r\s]+/g,"")&&t.parentNode.removeChild(t),t.setAttribute("style",F(t)),k(t,n)),!0}),(O(t)?M(t).find("li").get(0):e).innerHTML);if(O(t)||I(t))for(var r="",i=M(t).find("li"),l=0;l<i.length;l++){var a=M(i.get(l).innerHTML),s=(a.find("span").each(function(){" "===M(this).html()&&(0<M(this).prev().text().trim().length?M(this).remove():M(this).html("​"))}),i[l].style.marginLeft);s?(s=parseFloat(parseFloat(s).toFixed(2))+s.match(/[a-zA-Z]+/g)[0],r+='<li style = "margin-left: '.concat(s,';">').concat(a.get(0).innerHTML,"</li>")):r+="<li >".concat(a.get(0).innerHTML,"</li>")}else{var o,e=null==(o=M(t).find("p").get(0))?void 0:o.style.marginLeft;r=(e?(e=parseFloat(parseFloat(e).toFixed(2))+e.match(/[a-zA-Z]+/g)[0],'<li style = "margin-left: '.concat(e,';">')):"<li>").concat(r,"</li>")}return r=r.replace(/<!--[\s\S]*?-->/gi,"")}(t,e),!t.nextSibling||t.nextSibling.innerText==undefined||t.nextSibling.innerText==undefined||d.includes('class="decimal_type"')||isNaN(parseInt(t.nextSibling.innerText.trim().split(".")[1],10))||(d=d.substring(3,0)+' class="decimal_type"'+d.substring(3,d.length)),d+=T):(1==C&&(d+="</"+s+">",E=!0,l=null),d+=(a=D(t,e,C,t.style.marginLeft)).el.outerHTML,t=a.currentNode),t&&t.nextElementSibling);if(S&&(l=S.previousElementSibling),t&&!P(t)){if(t.outerHTML&&0<t.outerHTML.indexOf("mso-bookmark")&&0==(t.textContent||"").length){t=t.nextElementSibling;continue}break}t&&t.parentNode&&t.parentNode.removeChild(t),S&&P(S)&&(T=(L=function L(t){t=t.match(/mso-list:\s*l(\d+)/);return t?parseInt(t[1]):null})(t.getAttribute("style")||""),C=L(S.getAttribute("style")||""),S=null!==T&&T===C?S:null),t=S}}E||(d+="</"+s+">");x=document.createElement("div");return x.innerHTML=d,{el:x,currentNode:t}}function F(t,e){var e=1<arguments.length&&e!==undefined?e:null,r="",e=["line-height","font-family","font-size","color","background"].concat(o(e||[])),n=t.getAttribute("style");return n&&e.forEach(function(e){var t=n.split(";").find(function(t){return t.trim().includes(e+":")});t&&(t=t.includes("mso")?t.match(new RegExp(e+":.*(;|)"))[0]:t).trim().startsWith(e)&&(r+=t+";")}),r}function p(t,e){for(var r=document.createElement(e),n=0;n<t.attributes.length;n++){var i=t.attributes[n].name;"FONT"===t.tagName&&(w.browser.msie&&["id","class","style"].indexOf(i)<0||!w.browser.msie&&CSS.supports(i,t.getAttribute(i)))?M(r).css(i,t.getAttribute(i)):r.setAttribute(i,t.getAttribute(i))}return r.innerHTML=t.innerHTML,t.parentNode.replaceChild(r,t),r}function m(t,e){w.node.clearAttributes(t);for(var r=t.firstElementChild,n=0,i=!1,l=null;r;){if(r.firstElementChild&&-1!==r.firstElementChild.tagName.indexOf("W:"))for(var a=0;a<r.children.length;a++)"<('[^']*'|\"[^\"]*\"|[^\"'>])*>"==r.children[a]&&(r.innerHTML+=r.children[a]);(l=(l=r.getAttribute("width"))||r.style.width)||(i=i||!0),n+=parseInt(l,10),r.firstChild&&(r.firstChild,r.firstChild.data!==S.UNICODE_NBSP)||(r.firstChild&&A(r.firstChild),r.innerHTML="<br>");for(var s=r.firstElementChild,o=1===r.children.length;s;)"P"!==s.tagName||P(s)||o&&x(s),s=s.nextElementSibling;e&&((d=r.getAttribute("class"))&&(d=(d=E(d)).match(/xl[0-9]+/gi))&&e[d="."+d[0]]&&C(r,e[d]),e.td)&&C(r,e.td);var d=r.getAttribute("style"),u=((d=d&&E(d))&&";"!==d.slice(-1)&&(d+=";"),r.getAttribute("valign")),f=(!u&&d&&(f=d.match(/vertical-align:.+?[; "]{1,1}/gi))&&(u=f[f.length-1].replace(/vertical-align:(.+?)[; "]{1,1}/gi,"$1")),null),g=(d&&"general"===(f=(g=d.match(/text-align:.+?[; "]{1,1}/gi))?g[g.length-1].replace(/text-align:(.+?)[; "]{1,1}/gi,"$1"):f)&&(f=null),null),c=(d&&(c=d.match(/background:.+?[; "]{1,1}/gi))&&(g=c[c.length-1].replace(/background:(.+?)[; "]{1,1}/gi,"$1")),r.getAttribute("colspan")),p=r.getAttribute("rowspan");c&&r.setAttribute("colspan",c),p&&r.setAttribute("rowspan",p),u&&(r.style["vertical-align"]=u),f&&(r.style["text-align"]=f),g&&(r.style["background-color"]=g),l&&r.setAttribute("width",l),r=r.nextElementSibling}for(r=t.firstElementChild;r;)l=r.getAttribute("width"),i&&r.removeAttribute("width"),r=r.nextElementSibling;if(t.previousSibling?v!=n&&(N=!1):v=n,!t.nextElementSibling){for(var m,h=t,t=h.closest("table"),b=0,y=function y(){var r=0;Array.from(h.children).forEach(function(t){t=parseInt(t.getAttribute("width"),10);isNaN(t)||(r+=t)}),b<r&&(b=r),N?Array.from(h.children).forEach(function(t){var e=parseInt(t.getAttribute("width"),10);!isNaN(e)&&0<r&&(e=100*e/r,t.setAttribute("width","".concat(e,"%")))}):Array.from(h.children).forEach(function(t){var e=parseInt(t.getAttribute("width"),10);isNaN(e)||t.setAttribute("width","".concat(e,"px"))}),h=h.previousElementSibling};h;)y();t&&0<b&&!(t.getAttribute("width")||"").trim().endsWith("%")&&(m=parseInt(t.style.width,10),isNaN(m)||0===m)&&(t.style.width="".concat(b,"px"))}}function x(t){var e=t.getAttribute("align");e&&(t.style["text-align"]=e,t.removeAttribute("align"))}function E(t){return t.replace(/\n|\r|\n\r|"/g,"")}function C(t,e){var r;e&&((r=t.getAttribute("style"))&&";"!==r.slice(-1)&&(r+=";"),e&&";"!==e.slice(-1)&&(e+=";"),e=e.replace(/\n/gi,""),t.setAttribute("style",e+(r||"")))}var h=null;function a(t,e,r){for(var n=t.split(r),i=1;i<n.length;i++)if(1<(l=(l=n[i]).split("shplid")).length){for(var l=l[1],a="",s=0;s<l.length&&"\\"!==l[s]&&"{"!==l[s]&&" "!==l[s]&&"\r"!==l[s]&&"\n"!==l[s];)a+=l[s],s++;var o=l.split("bliptag");if(!(o&&o.length<2)){var d=null;if(-1!==o[0].indexOf("pngblip")?d="image/png":-1!==o[0].indexOf("jpegblip")&&(d="image/jpeg"),d){o=o[1].split("}");if(!(o&&o.length<2)){var u=void 0;if(2<o.length&&-1!==o[0].indexOf("blipuid"))u=o[1].split(" ");else{if((u=o[0].split(" "))&&u.length<2)continue;u.shift()}o=u.join("");h[e+a]={image_hex:o,image_type:d}}}}}}function b(t,e){if(e){if("IMG"===t.tagName){var r=t.getAttribute("src");if(!r||-1===r.indexOf("file://"))return;if(0===r.indexOf("file://")&&w.helpers.isURL(t.getAttribute("alt")))return void t.setAttribute("src",t.getAttribute("alt"));(r=f[t.getAttribute("v:shapes")])||(r=t.getAttribute("v:shapes"),t.parentNode&&t.parentNode.parentNode&&0<=t.parentNode.parentNode.innerHTML.indexOf("msEquation")&&(r=null))}else r=t.parentNode.getAttribute("o:spid");t.removeAttribute("height"),r&&(h={},a(e=e,"i","\\shppict"),a(e,"s","\\shp{"),e=h[r.substring(7)])&&(r=function(t){for(var e=t.match(/[0-9a-f]{2}/gi),r=[],n=0;n<e.length;n++)r.push(String.fromCharCode(parseInt(e[n],16)));return t=r.join(""),btoa(t)}(e.image_hex),e="data:"+e.image_type+";base64,"+r,"IMG"===t.tagName?(t.src=e,t.setAttribute("data-fr-image-pasted",!0)):M(t).parent().before('<img data-fr-image-pasted="true" src="'.concat(e,'" style="').concat(t.parentNode.getAttribute("style"),'">')).remove())}}function k(t,e){var r=t.tagName,n=r.toLowerCase();t.firstElementChild&&("I"===t.firstElementChild.tagName?p(t.firstElementChild,"em"):"B"===t.firstElementChild.tagName&&p(t.firstElementChild,"strong"));if(-1!==["SCRIPT","APPLET","EMBED","NOFRAMES","NOSCRIPT"].indexOf(r))return A(t),!1;for(var i=["META","LINK","XML","ST1:","O:","W:","FONT"],l=0;l<i.length;l++)if(-1!==r.indexOf(i[l]))return t.innerHTML&&(t.outerHTML=t.innerHTML),A(t),!1;if("TD"!==r){var a=t.getAttribute("class")||"MsoNormal";if(e&&a){for(var s=(a=E(a)).split(" "),o=0;o<s.length;o++){var d=[],u="."+s[o];d.push(u),d.push(n+u);for(var f=0;f<d.length;f++)e[d[f]]&&C(t,e[d[f]])}t.removeAttribute("class")}e&&e[n]&&C(t,e[n])}if(-1!==["P","H1","H2","H3","H4","H5","H6","PRE"].indexOf(r)&&((a=t.getAttribute("class"))&&(e&&e[r.toLowerCase()+"."+a]&&C(t,e[r.toLowerCase()+"."+a]),-1!==a.toLowerCase().indexOf("mso"))&&((a=(a=E(a)).replace(/[0-9a-z-_]*mso[0-9a-z-_]*/gi,""))?t.setAttribute("class",a):t.removeAttribute("class")),(a=t.getAttribute("style"))&&(a=a.match(/text-align:.+?[; "]{1,1}/gi))&&a[a.length-1].replace(/(text-align:.+?[; "]{1,1})/gi,"$1"),x(t)),"TR"===r&&m(t,e),"A"!==r||t.attributes.getNamedItem("href")||t.attributes.getNamedItem("name")||!t.innerHTML||(t.outerHTML=t.innerHTML),"A"==r&&t.getAttribute("href")&&t.querySelector("img"))for(var g=t.querySelectorAll("span"),c=0;c<g.length;c++)g[c].innerText||(g[c].outerHTML=g[c].innerHTML);return"TD"!==r&&"TH"!==r||t.innerHTML||(t.innerHTML="<br>"),t.getAttribute("lang")&&t.removeAttribute("lang"),t.getAttribute("style")&&-1!==t.getAttribute("style").toLowerCase().indexOf("mso")&&((a=(a=E(t.getAttribute("style"))).replace(/[0-9a-z-_]*mso[0-9a-z-_]*:.+?(;{1,1}|$)/gi,"").replace("line-height:107%",""))?t.setAttribute("style",a):t.removeAttribute("style")),!0}function s(t,e){for(var s=(t=(t=0<=t.indexOf("<html")?t.replace(/[.\s\S\w\W<>]*(<html[^>]*>[.\s\S\w\W<>]*<\/html>)[.\s\S\w\W<>]*/i,"$1"):t).replace(/ /g," ")).match(/(MSFontService|class="?Mso|class='?Mso|class="?Xl|class='?Xl|class=Xl|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument|LibreOffice)/gi),r=t.split("v:shape"),n=1;n<r.length;n++){var i=r[n],l=i.split(' id="')[1];l&&1<l.length&&(l=l.split('"')[0],i=i.split(' o:spid="')[1])&&1<i.length&&(i=i.split('"')[0],f[l]=i)}var t=(new DOMParser).parseFromString(t,"text/html"),a=t.head,t=t.body,o=function(t){var e={};if((t=t.getElementsByTagName("style")).length){var r=t[0].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);if(r)for(var n=0;n<r.length;n++){var i=r[n],l=i.replace(/([\S ]+\s+){[\s\S]+?}/gi,"$1"),a=i.replace(/[\S ]+\s+{([\s\S]+?)}/gi,"$1"),l=l.replace(/^[\s]|[\s]$/gm,""),a=a.replace(/^[\s]|[\s]$/gm,"");l=l.replace(/\n|\r|\n\r/g,""),a=a.replace(/\n|\r|\n\r/g,"");for(var s=l.split(", "),o=0;o<s.length;o++)e[s[o]]=a}}return e}(a);H(t,function(t){var e;return t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute("style")&&(e=t.getAttribute("style"),t.setAttribute("style",e),t.style.fontFamily||t.setAttribute("style",e.replace(/mso-(bidi|fareast|fareast-theme)-font-family/g,"font-family"))),!0}),H(t,function(t){if(t.nodeType===Node.TEXT_NODE&&/\n|\u00a0|\r/.test(t.data)){if(!/\S| /.test(t.data)&&!/[\u00a0]+/.test(t.data))return t.data===S.UNICODE_NBSP?(t.data="\u200b",!0):1===t.data.length&&10===t.data.charCodeAt(0)?(t.data=" ",!0):(A(t),!1);t.data=t.data.replace(/\n|\r/gi," ")}return!0}),H(t,function(t){return t.nodeType!==Node.ELEMENT_NODE||"V:IMAGEDATA"!==t.tagName&&"IMG"!==t.tagName||b(t,e),!0});t.querySelectorAll('a[class*="msocomoff"]').forEach(function(t){var e=t.getAttribute("href").split("#_msoanchor_")[1];t.setAttribute("name","_msocom_".concat(e))}),w.browser.safari&&t.querySelectorAll('a[name^="_mso"]').forEach(function(t){var e=t.getAttribute("href");e&&(e=e.split("#")[1],t.setAttribute("href","#".concat(e)))});for(var d=t.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol"),u=d.length-1;0<=u;u--)d[u].previousElementSibling&&"LI"===d[u].previousElementSibling.tagName&&d[u].previousElementSibling.appendChild(d[u]);H(t,function(t){if(t.nodeType===Node.TEXT_NODE)t.data=t.data.replace(/<br>(\n|\r)/gi,"<br>");else{var e,r,n,i,l;if(t.nodeType===Node.ELEMENT_NODE)return P(t)?(e=t.parentNode,i=t.previousSibling,r=D(t,o).el,n=null,(n=i?i.nextSibling:e.firstChild)?e.insertBefore(r,n):e.appendChild(r),!1):("FONT"===t.tagName&&(s&&"LibreOffice"===s[0]||o["."+t.getAttribute("class")])?t=p(t,"span"):s&&"\x3c!--StartFragment--\x3e"===s[0]&&"UL"===t.tagName&&(M(t).find("li span").each(function(){" "===M(this).html()&&(0<M(this).prev().text().trim().length?M(this).remove():M(this).html("​"))}),M(t).is("ul")&&t.setAttribute("style",F(t,["margin","margin-left","list-style-type"])),M(t).find("ul").each(function(){this.setAttribute("style",F(this,["margin","margin-left","list-style-type"]))})),"img"!==t.tagName.toLowerCase()&&(l=t,Array.from(l.attributes).map(function(t){return t.name}).filter(function(t){return t.toLowerCase().startsWith("data-")||t.toLowerCase().startsWith("xml:")}).forEach(function(t){M(l).removeAttr(t)})),k(t,o));if(t.nodeType!==Node.COMMENT_NODE)return!0;if(-1<t.data.indexOf("[if !supportLineBreakNewLine]"))for(var a=t.nextSibling;a;)(a=t.nextSibling)&&A(a),a.data&&-1<a.data.indexOf("[endif]")&&(a=null);-1<t.data.indexOf("[if supportFields]")&&-1<t.data.indexOf("FORMCHECKBOX")&&((i=document.createElement("input")).type="checkbox",t.parentNode.insertBefore(i,t.nextSibling)),A(t)}return!1}),g=null,c={},H(t,function(t){if(t.nodeType===Node.ELEMENT_NODE&&"SPAN"===t.tagName){var e=t.innerHTML||"";if(""===(e=e.replace(/ /g," ")).trim())return t.outerHTML=e,!1}return!0}),t.innerHTML=function(t){for(var e=M(document.createElement("div")).attr("id","top-level"),r=(e.html(t),e[0].querySelectorAll("ol, ul")),n=0;n<r.length;n++)if(M(r[n]).parentsUntil("#top-level","ol, ul").length){r[n].style.removeProperty("margin-left");for(var i=r[n].children,l=0;l<i.length;l++)"LI"==i[l].tagName&&i[l].style.removeProperty("margin-left")}return e[0].innerHTML}(t.innerHTML),H(t,function(t){if(t.nodeType===Node.ELEMENT_NODE){var e=t.tagName;if(!t.innerHTML&&-1===["BR","IMG","INPUT"].indexOf(e)){for(var r=t.parentNode;r&&(A(t),!(t=r).innerHTML)&&"TD"!==t.parentNode.tagName;)r=t.parentNode;return!1}var n=t,e=n.getAttribute("style");if(e){(e=E(e))&&";"!==e.slice(-1)&&(e+=";");var i=e.match(/(^|\S+?):.+?;{1,1}/gi);if(i){for(var l={},a=0;a<i.length;a++){var s=i[a].split(":");2!==s.length||"text-align"===s[0]&&"SPAN"===n.tagName||(l[s[0]]=s[1])}var o,d="";for(o in l)if(l.hasOwnProperty(o)){if("font-size"===o&&"pt;"===l[o].slice(-3)){var u,f=null;try{f=parseFloat(l[o].slice(0,-3),10)}catch(g){f=null}f&&("px"===(u=w.opts.fontSizeUnit)?(f=Math.round(1.33*f),l[o]=f+"px;"):"pt"===u&&(f=Math.round(f),l[o]=f+"pt;"))}d+=o+":"+l[o]}d&&n.setAttribute("style",d)}}}return!0}),H(t,function(t){if(t&&"A"===t.nodeName){if(t.hasAttribute("name")&&t.getAttribute("name").startsWith("_Toc")&&t.parentNode&&(t.parentNode.id=t.getAttribute("name")),""===t.href){for(var e=document.createDocumentFragment();t.firstChild;)e.appendChild(t.firstChild);t.parentNode.replaceChild(e,t)}t.hasAttribute("href")&&t.getAttribute("href").startsWith("#_Toc")&&(t.removeChild(t.lastChild),t.removeChild(t.lastChild))}return!0}),H(t,function(t){return t&&"P"===t.tagName&&"DIV"===t.parentNode.tagName&&1==t.parentNode.children.length&&M(t).unwrap(),!0}),H(t,function(t){if(t&&"SPAN"===t.tagName)for(;t.nextSibling&&t.nextSibling.nodeType===Node.ELEMENT_NODE&&"SPAN"===t.nextSibling.tagName&&t.getAttribute("style")===t.nextSibling.getAttribute("style");)M(t).append(t.nextSibling.innerHTML),M(t.nextSibling).remove();return!0}),H(t,function(t){var e;return t.nodeType===Node.ELEMENT_NODE&&"BR"===t.tagName&&((e=t.getAttribute("style")||"").includes("page-break-before")||e.includes("page-break-after"))&&w.pageBreak.insert(t),!0});a=t.outerHTML,t=w.opts.htmlAllowedStyleProps;return w.opts.htmlAllowedStyleProps=w.opts.wordAllowedStyleProps,a=w.clean.html(a,w.opts.wordDeniedTags,w.opts.wordDeniedAttrs,!1),w.opts.htmlAllowedStyleProps=t,a}return{_init:function(){w.events.on("paste.wordPaste",function(t){var e;return n=t,w.opts.wordPasteModal?(r||(t='<h4><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 74.95 73.23" style="height: 25px; vertical-align: text-bottom; margin-right: 5px; display: inline-block"><defs><style>.a{fill:#2a5699;}.b{fill:#fff;}</style></defs><path class="a" d="M615.15,827.22h5.09V834c9.11.05,18.21-.09,27.32.05a2.93,2.93,0,0,1,3.29,3.25c.14,16.77,0,33.56.09,50.33-.09,1.72.17,3.63-.83,5.15-1.24.89-2.85.78-4.3.84-8.52,0-17,0-25.56,0v6.81h-5.32c-13-2.37-26-4.54-38.94-6.81q0-29.8,0-59.59c13.05-2.28,26.11-4.5,39.17-6.83Z" transform="translate(-575.97 -827.22)"/><path class="b" d="M620.24,836.59h28.1v54.49h-28.1v-6.81h22.14v-3.41H620.24v-4.26h22.14V873.2H620.24v-4.26h22.14v-3.41H620.24v-4.26h22.14v-3.41H620.24v-4.26h22.14v-3.41H620.24V846h22.14v-3.41H620.24Zm-26.67,15c1.62-.09,3.24-.16,4.85-.25,1.13,5.75,2.29,11.49,3.52,17.21,1-5.91,2-11.8,3.06-17.7,1.7-.06,3.41-.15,5.1-.26-1.92,8.25-3.61,16.57-5.71,24.77-1.42.74-3.55,0-5.24.09-1.13-5.64-2.45-11.24-3.47-16.9-1,5.5-2.29,10.95-3.43,16.42q-2.45-.13-4.92-.3c-1.41-7.49-3.07-14.93-4.39-22.44l4.38-.18c.88,5.42,1.87,10.82,2.64,16.25,1.2-5.57,2.43-11.14,3.62-16.71Z" transform="translate(-575.97 -827.22)"/></svg> '+w.language.translate("Word Paste Detected")+"</h4>",e=function(){var t='<div class="fr-word-paste-modal" style="padding: 20px 20px 10px 20px;">';return t=(t+='<p style="text-align: left;">'+w.language.translate("The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?")+"</p>")+'<div style="text-align: right; margin-top: 50px;"><button class="fr-remove-word fr-command">'+w.language.translate("Clean")+'</button> <button class="fr-keep-word fr-command">'+w.language.translate("Keep")+"</button></div></div>"}(),t=w.modals.create(i,t,e),e=t.$body,(r=t.$modal).addClass("fr-middle"),w.events.bindClick(e,"button.fr-remove-word",function(){(r.data("instance")||w).wordPaste.clean()}),w.events.bindClick(e,"button.fr-keep-word",function(){(r.data("instance")||w).wordPaste.clean(!0)}),w.events.$on(M(w.o_win),"resize",function(){w.modals.resize(i)})),w.modals.show(i),w.modals.resize(i)):l(w.opts.wordPasteKeepFormatting),!1})},clean:l,_wordClean:s}}});