UNPKG

froala-editor

Version:

A beautiful Javascript WYSIWYG HTML rich text editor. High performance and modern design make it easy to use for developers and loved by users.

7 lines (6 loc) 199 kB
/*! * froala_editor v2.8.3 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2018 Froala Labs */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):e.FroalaEditor=t(e.jQuery)}(this,function(M){"use strict";var e;(M=M&&M.hasOwnProperty("default")?M["default"]:M).prototype.contains=function(e){if(!e)return!1;if(Array.isArray(e)){for(var t=0;t<e.length;t++)if(this.contains(e[t])&&this!=e[t])return!0;return!1}for(t=0;t<this.length;t++)try{if(this[t].nodeType===Node.ELEMENT_NODE&&this[t].contains(e)&&this[t]!=e)return!0}catch(n){return!1}return!1},M.prototype.findVisible=function(e){for(var t=this.find(e),n=t.length-1;0<=n;n--)M(t[n]).isVisible()||t.splice(n,1);return t},M.prototype.isVisible=function(){return"none"!=this.css("display")&&"hidden"!=this.css("visiblity")&&"hidden"!=this.attr("type")},Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),(e=window.Node||window.Element)&&e.prototype&&null==e.prototype.firstElementChild&&Object.defineProperty(e.prototype,"firstElementChild",{get:function(){for(var e,t=this.childNodes,n=0;e=t[n++];)if(1===e.nodeType)return e;return null}}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),r=1;r<arguments.length;r++){var o=arguments[r];if(null!=o)for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])}return n},writable:!0,configurable:!0});var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function R(e,t){return new R.Bootstrap(e,t)}M.fn.froalaEditor=function(o){for(var i=[],e=0;e<arguments.length;e++)i.push(arguments[e]);if("string"==typeof o){var a=[];return this.each(function(){var e=M(this).data("froala.editor");if(e){var t,n;if(0<o.indexOf(".")&&e[o.split(".")[0]]?(e[o.split(".")[0]]&&(t=e[o.split(".")[0]]),n=o.split(".")[1]):(t=e,n=o.split(".")[0]),!t[n])return M.error("Method "+o+" does not exist in Froala Editor.");var r=t[n].apply(e,i.slice(1));r===undefined?a.push(this):0===a.length&&a.push(r)}}),1==a.length?a[0]:a}if("object"===(void 0===o?"undefined":d(o))||!o)return this.each(function(){if(!M(this).data("froala.editor")){new R(this,o)}})},Object.assign(R,{DEFAULTS:{initOnClick:!1,pluginsEnabled:null},MODULES:{},PLUGINS:{},VERSION:"2.8.3",INSTANCES:[],OPTS_MAPPING:{},SHARED:{},ID:0}),M.fn.froalaEditor.Constructor=R,M.FroalaEditor=R,(M.FE=R).XS=0,R.SM=1,R.MD=2,R.LG=3;var t;R.LinkRegExCommon="[a-z\\u0080-\\u009f\\u00a1-\\uffff0-9-_\\.]{1,}",R.LinkRegExEnd="((:[0-9]{1,5})|)(((\\/|\\?|#)[a-z\\u00a1-\\uffff0-9@?\\|!^=%&amp;\\/~+#-\\'*-_{}]*)|())",R.LinkRegExTLD="(("+R.LinkRegExCommon+")(\\.(com|net|org|edu|mil|gov|co|biz|info|me|dev)))",R.LinkRegExHTTP="((ftp|http|https):\\/\\/"+R.LinkRegExCommon+")",R.LinkRegExAuth="((ftp|http|https):\\/\\/[\\u0021-\\uffff]{1,}@"+R.LinkRegExCommon+")",R.LinkRegEx="("+R.LinkRegExTLD+"|"+R.LinkRegExHTTP+"|"+(R.LinkRegExWWW="(www\\."+R.LinkRegExCommon+"\\.[a-z0-9-]{2,24})")+"|"+R.LinkRegExAuth+")"+R.LinkRegExEnd,R.LinkProtocols=["mailto","tel","sms","notes","data"],R.MAIL_REGEX=/.+@.+\..+/i,R.MODULES.helpers=function(i){function e(){var e,t,n={},r=(e=-1,t=void 0,"Microsoft Internet Explorer"===navigator.appName?(t=navigator.userAgent,null!==new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})").exec(t)&&(e=parseFloat(RegExp.$1))):"Netscape"===navigator.appName&&(t=navigator.userAgent,null!==new RegExp("Trident/.*rv:([0-9]{1,}[\\.0-9]{0,})").exec(t)&&(e=parseFloat(RegExp.$1))),e);if(0<r)n.msie=!0;else{var o=navigator.userAgent.toLowerCase(),i=/(edge)[ /]([\w.]+)/.exec(o)||/(chrome)[ /]([\w.]+)/.exec(o)||/(webkit)[ /]([\w.]+)/.exec(o)||/(opera)(?:.*version|)[ /]([\w.]+)/.exec(o)||/(msie) ([\w.]+)/.exec(o)||o.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(o)||[],a=i[1]||"";i[2];i[1]&&(n[a]=!0),n.chrome?n.webkit=!0:n.webkit&&(n.safari=!0)}return n.msie&&(n.version=r),n}function t(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&!o()}function n(){return/(Android)/g.test(navigator.userAgent)&&!o()}function r(){return/(Blackberry)/g.test(navigator.userAgent)}function o(){return/(Windows Phone)/gi.test(navigator.userAgent)}function a(e){return parseInt(e,10)||0}var s=void 0;var l=null;return{_init:function(){i.browser=e(),function(){var a=/^\s*:scope/gi,s=i.o_doc.createElement("div");function e(e,t){var i=e[t];e[t]=function(e){var t=void 0,n=!1,r=!1;if(e&&e.match(a)){e=e.replace(a,""),this.parentNode||(s.appendChild(this),r=!0);var o=this.parentNode;return this.id||(this.id="rootedQuerySelector_id_"+(new Date).getTime(),n=!0),t=i.call(o,"#"+this.id+" "+e),n&&(this.id=""),r&&s.removeChild(this),t}return i.call(this,e)}}try{s.querySelectorAll(":scope *")}catch(t){e(Element.prototype,"querySelector"),e(Element.prototype,"querySelectorAll"),e(HTMLElement.prototype,"querySelector"),e(HTMLElement.prototype,"querySelectorAll")}}()},isIOS:t,isMac:function(){return null===l&&(l=0<=navigator.platform.toUpperCase().indexOf("MAC")),l},isAndroid:n,isBlackberry:r,isWindowsPhone:o,isMobile:function(){return n()||t()||r()},isEmail:function(e){return!/^(https?:|ftps?:|)\/\//i.test(e)&&R.MAIL_REGEX.test(e)},requestAnimationFrame:function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}},getPX:a,screenSize:function(){var e=M(i.doc.createElement("DIV"));e.addClass("fr-visibility-helper"),M("body").first().append(e);try{var t=a(e.css("margin-left"));return e.remove(),t}catch(n){return R.LG}},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch},sanitizeURL:function(e){return/^(https?:|ftps?:|)\/\//i.test(e)?e:/^([A-Za-z]:(\\){1,2}|[A-Za-z]:((\\){1,2}[^\\]+)+)(\\)?$/i.test(e)?e:new RegExp("^("+R.LinkProtocols.join("|")+"):\\/\\/","i").test(e)?e:e=encodeURIComponent(e).replace(/%23/g,"#").replace(/%2F/g,"/").replace(/%25/g,"%").replace(/mailto%3A/gi,"mailto:").replace(/file%3A/gi,"file:").replace(/sms%3A/gi,"sms:").replace(/tel%3A/gi,"tel:").replace(/notes%3A/gi,"notes:").replace(/data%3Aimage/gi,"data:image").replace(/blob%3A/gi,"blob:").replace(/%3A(\d)/gi,":$1").replace(/webkit-fake-url%3A/gi,"webkit-fake-url:").replace(/%3F/g,"?").replace(/%3D/g,"=").replace(/%26/g,"&").replace(/&amp;/g,"&").replace(/%2C/g,",").replace(/%3B/g,";").replace(/%2B/g,"+").replace(/%40/g,"@").replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/%7B/g,"{").replace(/%7D/g,"}")},isArray:function(e){return e&&!Object.prototype.propertyIsEnumerable.call(e,"length")&&"object"===(void 0===e?"undefined":d(e))&&"number"==typeof e.length},RGBToHex:function(e){function t(e){return("0"+parseInt(e,10).toString(16)).slice(-2)}try{return e&&"transparent"!==e?/^#[0-9A-F]{6}$/i.test(e)?e:("#"+t((e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))[1])+t(e[2])+t(e[3])).toUpperCase():""}catch(n){return null}},HEXtoRGB:function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,n,r){return t+t+n+n+r+r});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16)+")":""},isURL:function(e){return!!/^(https?:|ftps?:|)\/\//i.test(e)&&(e=String(e).replace(/</g,"%3C").replace(/>/g,"%3E").replace(/"/g,"%22").replace(/ /g,"%20"),new RegExp("^"+R.LinkRegExHTTP+R.LinkRegExEnd+"$","gi").test(e))},getAlignment:function(e){e.css||(e=M(e));var t=(e.css("text-align")||"").replace(/-(.*)-/g,"");if(["left","right","justify","center"].indexOf(t)<0){if(!s){var n=M('<div dir="'+("rtl"===i.opts.direction?"rtl":"auto")+'" style="text-align: '+i.$el.css("text-align")+'; position: fixed; left: -3000px;"><span id="s1">.</span><span id="s2">.</span></div>');M("body:first").append(n);var r=n.find("#s1").get(0).getBoundingClientRect().left,o=n.find("#s2").get(0).getBoundingClientRect().left;n.remove(),s=r<o?"left":"right"}t=s}return t},scrollTop:function(){return i.o_win.pageYOffset?i.o_win.pageYOffset:i.o_doc.documentElement&&i.o_doc.documentElement.scrollTop?i.o_doc.documentElement.scrollTop:i.o_doc.body.scrollTop?i.o_doc.body.scrollTop:0},scrollLeft:function(){return i.o_win.pageXOffset?i.o_win.pageXOffset:i.o_doc.documentElement&&i.o_doc.documentElement.scrollLeft?i.o_doc.documentElement.scrollLeft:i.o_doc.body.scrollLeft?i.o_doc.body.scrollLeft:0},isInViewPort:function(e){var t=e.getBoundingClientRect();return 0<=t.top&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)||t.top<=0&&t.bottom>=(window.innerHeight||document.documentElement.clientHeight)}}},R.MODULES.events=function(l){var a={},e=void 0;function t(e,t,n){p(e,t,n)}function n(e){if(void 0===e&&(e=!0),!l.$wp)return!1;if(l.helpers.isIOS()&&l.$win.get(0).focus(),l.core.hasFocus())return!1;if(!l.core.hasFocus()&&e){var t=l.$win.scrollTop();if(l.browser.msie&&l.$box&&l.$box.css("position","fixed"),l.browser.msie&&l.$wp&&l.$wp.css("overflow","visible"),i(),l.el.focus(),l.events.trigger("focus"),o(),l.browser.msie&&l.$box&&l.$box.css("position",""),l.browser.msie&&l.$wp&&l.$wp.css("overflow","auto"),t!==l.$win.scrollTop()&&l.$win.scrollTop(t),!l.selection.info(l.el).atStart)return!1}if(!l.core.hasFocus()||0<l.$el.find(".fr-marker").length)return!1;if(l.selection.info(l.el).atStart&&l.selection.isCollapsed()&&null!==l.html.defaultTag()){var n=l.markers.insert();if(n&&!l.node.blockParent(n)){M(n).remove();var r=l.$el.find(l.html.blockTagsQuery()).get(0);r&&(M(r).prepend(R.MARKERS),l.selection.restore())}else n&&M(n).remove()}}var r=!1;function o(){e=!0}function i(){e=!1}function s(){return e}function d(e,t,n){var r=e.split(" ");if(1<r.length){for(var o=0;o<r.length;o++)d(r[o],t,n);return!0}void 0===n&&(n=!1);var i=void 0;0!==e.indexOf("shared.")?(a[e]=a[e]||[],i=a[e]):(l.shared._events[e]=l.shared._events[e]||[],i=l.shared._events[e]),n?i.unshift(t):i.push(t)}var c=[];function p(e,t,n,r,o){"function"==typeof n&&(o=r,r=n,n=!1);var i=o?l.shared.$_events:c,a=o?l.sid:l.id,s=t.trim().split(" ").join(".ed"+a+" ")+".ed"+a;n?e.on(s,n,r):e.on(s,r),i.push([e,s])}function f(e){for(var t=0;t<e.length;t++)e[t][0].off(e[t][1])}function u(e,t,n){if(!l.edit.isDisabled()||n){var r=void 0;if(0!==e.indexOf("shared."))r=a[e];else{if(0<l.shared.count)return!1;r=l.shared._events[e]}var o=void 0;if(r)for(var i=0;i<r.length;i++)if(!1===(o=r[i].apply(l,t)))return!1;return(!l.opts.events||!l.opts.events[e]||!1!==(o=l.opts.events[e].apply(l,t)))&&(!1!==(o=l.$oel.triggerHandler("froalaEditor."+e,M.merge([l],t||[])))&&o)}}function h(){for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&delete a[e]}function g(){for(var e in l.shared._events)Object.prototype.hasOwnProperty.call(l.shared._events,e)&&delete l.shared._events[e]}return{_init:function(){l.shared.$_events=l.shared.$_events||[],l.shared._events={},l.helpers.isMobile()?(l._mousedown="touchstart",l._mouseup="touchend",l._move="touchmove",l._mousemove="touchmove"):(l._mousedown="mousedown",l._mouseup="mouseup",l._move="",l._mousemove="mousemove"),t(l.$el,"click mouseup mousedown touchstart touchend dragenter dragover dragleave dragend drop dragstart",function(e){u(e.type,[e])}),d("mousedown",function(){for(var e=0;e<R.INSTANCES.length;e++)R.INSTANCES[e]!==l&&R.INSTANCES[e].popups&&R.INSTANCES[e].popups.areVisible()&&R.INSTANCES[e].$el.find(".fr-marker").remove()}),t(l.$win,l._mousedown,function(e){u("window.mousedown",[e]),o()}),t(l.$win,l._mouseup,function(e){u("window.mouseup",[e])}),t(l.$win,"cut copy keydown keyup touchmove touchend",function(e){u("window."+e.type,[e])}),t(l.$doc,"dragend drop",function(e){u("document."+e.type,[e])}),t(l.$el,"keydown keypress keyup input",function(e){u(e.type,[e])}),t(l.$el,"focus",function(e){s()&&(n(!1),!1===r&&u(e.type,[e]))}),t(l.$el,"blur",function(e){s()&&!0===r&&(u(e.type,[e]),o())}),d("focus",function(){r=!0}),d("blur",function(){r=!1}),o(),t(l.$el,"cut copy paste beforepaste",function(e){u(e.type,[e])}),d("destroy",h),d("shared.destroy",g)},on:d,trigger:u,bindClick:function(e,t,n){p(e,l._mousedown,t,function(e){var t,n;l.edit.isDisabled()||(n=M((t=e).currentTarget),l.edit.isDisabled()||l.node.hasClass(n.get(0),"fr-disabled")?t.preventDefault():"mousedown"===t.type&&1!==t.which||(l.helpers.isMobile()||t.preventDefault(),(l.helpers.isAndroid()||l.helpers.isWindowsPhone())&&0===n.parents(".fr-dropdown-menu").length&&(t.preventDefault(),t.stopPropagation()),n.addClass("fr-selected"),l.events.trigger("commands.mousedown",[n])))},!0),p(e,l._mouseup+" "+l._move,t,function(e){l.edit.isDisabled()||function(e,t){var n=M(e.currentTarget);if(l.edit.isDisabled()||l.node.hasClass(n.get(0),"fr-disabled"))return e.preventDefault();if(("mouseup"!==e.type||1===e.which)&&l.node.hasClass(n.get(0),"fr-selected"))if("touchmove"!==e.type){if(e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault(),!l.node.hasClass(n.get(0),"fr-selected"))return l.button.getButtons(".fr-selected",!0).removeClass("fr-selected");if(l.button.getButtons(".fr-selected",!0).removeClass("fr-selected"),n.data("dragging")||n.attr("disabled"))return n.removeData("dragging");var r=n.data("timeout");r&&(clearTimeout(r),n.removeData("timeout")),t.apply(l,[e])}else n.data("timeout")||n.data("timeout",setTimeout(function(){n.data("dragging",!0)},100))}(e,n)},!0),p(e,"mousedown click mouseup",t,function(e){l.edit.isDisabled()||e.stopPropagation()},!0),d("window.mouseup",function(){l.edit.isDisabled()||(e.find(t).removeClass("fr-selected"),o())})},disableBlur:i,enableBlur:o,blurActive:s,focus:n,chainTrigger:function(e,t,n){if(!l.edit.isDisabled()||n){var r=void 0;if(0!==e.indexOf("shared."))r=a[e];else{if(0<l.shared.count)return!1;r=l.shared._events[e]}var o=void 0;if(r)for(var i=0;i<r.length;i++)void 0!==(o=r[i].apply(l,[t]))&&(t=o);return void 0!==(o=l.$oel.triggerHandler("froalaEditor."+e,M.merge([l],[t])))&&(t=o),t}},$on:p,$off:function(){f(c),c=[],0===l.shared.count&&(f(l.shared.$_events),l.shared.$_events=[])}}},R.MODULES.accessibility=function(p){var i=!0;function s(t){t&&t.length&&!p.$el.find('[contenteditable="true"]').is(":focus")&&(t.data("blur-event-set")||t.parents(".fr-popup").length||(p.events.$on(t,"blur",function(){var e=t.parents(".fr-toolbar, .fr-popup").data("instance")||p;e.events.blurActive()&&e.events.trigger("blur"),setTimeout(function(){e.events.enableBlur()},100)},!0),t.data("blur-event-set",!0)),(t.parents(".fr-toolbar, .fr-popup").data("instance")||p).events.disableBlur(),t.get(0).focus(),p.shared.$f_el=t)}function f(e,t){var n=t?"last":"first",r=e.findVisible("button:not(.fr-disabled), .fr-group span.fr-command")[n]();if(r.length)return s(r),!0}function a(e){return e.is("input, textarea, select")&&t(),p.events.disableBlur(),e.get(0).focus(),!0}function u(e,t){var n=e.find("input, textarea, button, select").filter(function(){return M(this).isVisible()}).not(":disabled");if((n=t?n.last():n.first()).length)return a(n);if(p.shared.with_kb){var r=e.findVisible(".fr-active-item").first();if(r.length)return a(r);var o=e.findVisible("[tabIndex]").first();if(o.length)return a(o)}}function t(){0===p.$el.find(".fr-marker").length&&p.core.hasFocus()&&p.selection.save()}function l(){var e=p.popups.areVisible();if(e){var t=e.find(".fr-buttons");return t.find("button:focus, .fr-group span:focus").length?!f(e.data("instance").$tb):!f(t)}return!f(p.$tb)}function d(){var e=null;return p.shared.$f_el.is(".fr-dropdown.fr-active")?e=p.shared.$f_el:p.shared.$f_el.closest(".fr-dropdown-menu").prev().is(".fr-dropdown.fr-active")&&(e=p.shared.$f_el.closest(".fr-dropdown-menu").prev()),e}function n(e,t,n){if(p.shared.$f_el){var r=d();r&&(p.button.click(r),p.shared.$f_el=r);var o=e.findVisible("button:not(.fr-disabled), .fr-group span.fr-command"),i=o.index(p.shared.$f_el);if(0===i&&!n||i===o.length-1&&n){var a=void 0;if(t){if(e.parent().is(".fr-popup"))a=!u(e.parent().children().not(".fr-buttons"),!n);!1===a&&(p.shared.$f_el=null)}t&&!1===a||f(e,!n)}else s(M(o.get(i+(n?1:-1))));return!1}}function c(e,t){return n(e,t,!0)}function h(e,t){return n(e,t)}function g(e){if(p.shared.$f_el){var t=void 0;if(p.shared.$f_el.is(".fr-dropdown.fr-active"))return s(t=e?p.shared.$f_el.next().find(".fr-command:not(.fr-disabled)").first():p.shared.$f_el.next().find(".fr-command:not(.fr-disabled)").last()),!1;if(p.shared.$f_el.is("a.fr-command"))return(t=e?p.shared.$f_el.closest("li").nextAllVisible().first().find(".fr-command:not(.fr-disabled)").first():p.shared.$f_el.closest("li").prevAllVisible().first().find(".fr-command:not(.fr-disabled)").first()).length||(t=e?p.shared.$f_el.closest(".fr-dropdown-menu").find(".fr-command:not(.fr-disabled)").first():p.shared.$f_el.closest(".fr-dropdown-menu").find(".fr-command:not(.fr-disabled)").last()),s(t),!1}}function m(){if(p.shared.$f_el){if(p.shared.$f_el.hasClass("fr-dropdown"))p.button.click(p.shared.$f_el);else if(p.shared.$f_el.is("button.fr-back")){p.opts.toolbarInline&&(p.events.disableBlur(),p.events.focus());var e=p.popups.areVisible(p);e&&(p.shared.with_kb=!1),p.button.click(p.shared.$f_el),b(e)}else{if(p.events.disableBlur(),p.button.click(p.shared.$f_el),p.shared.$f_el.attr("data-popup")){var t=p.popups.areVisible(p);t&&t.data("popup-button",p.shared.$f_el)}else if(p.shared.$f_el.attr("data-modal")){var n=p.modals.areVisible(p);n&&n.data("modal-button",p.shared.$f_el)}p.shared.$f_el=null}return!1}}function v(){p.shared.$f_el&&(p.events.disableBlur(),p.shared.$f_el.blur(),p.shared.$f_el=null),!1!==p.events.trigger("toolbar.focusEditor")&&(p.events.disableBlur(),p.$el.get(0).focus(),p.events.focus())}function r(r){r&&r.length&&(p.events.$on(r,"keydown",function(e){if(!M(e.target).is("a.fr-command, button.fr-command, .fr-group span.fr-command"))return!0;var t=r.parents(".fr-popup").data("instance")||r.data("instance")||p;p.shared.with_kb=!0;var n=t.accessibility.exec(e,r);return p.shared.with_kb=!1,n},!0),p.events.$on(r,"mouseenter","[tabIndex]",function(e){var t=r.parents(".fr-popup").data("instance")||r.data("instance")||p;if(!i)return e.stopPropagation(),void e.preventDefault();var n=M(e.currentTarget);t.shared.$f_el&&t.shared.$f_el.not(n)&&t.accessibility.focusEditor()},!0))}function b(e){var t=e.data("popup-button");t&&setTimeout(function(){s(t),e.data("popup-button",null)},0)}function o(e){var t=p.popups.areVisible(e);t&&t.data("popup-button",null)}function e(e){var t=-1!==navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey;if(e.which===R.KEYCODE.F10&&!t&&!e.shiftKey&&e.altKey){p.shared.with_kb=!0;var n=p.popups.areVisible(p),r=!1;return n&&(r=u(n.children().not(".fr-buttons"))),r||l(),p.shared.with_kb=!1,e.preventDefault(),e.stopPropagation(),!1}return!0}return{_init:function(){p.$wp?p.events.on("keydown",e,!0):p.events.$on(p.$win,"keydown",e,!0),p.events.on("mousedown",function(e){o(p),p.shared.$f_el&&(p.accessibility.restoreSelection(),e.stopPropagation(),p.events.disableBlur(),p.shared.$f_el=null)},!0),p.events.on("blur",function(){p.shared.$f_el=null,o(p)},!0)},registerPopup:function(e){var d,c,t=p.popups.get(e),n=(d=e,c=p.popups.get(d),{_tiKeydown:function(e){var t=c.data("instance")||p;if(!1===t.events.trigger("popup.tab",[e]))return!1;var n=e.which,r=c.find(":focus").first();if(R.KEYCODE.TAB===n){e.preventDefault();var o=c.children().not(".fr-buttons"),i=o.findVisible("input, textarea, button, select").not(".fr-no-touch input, .fr-no-touch textarea, .fr-no-touch button, .fr-no-touch select, :disabled").toArray(),a=i.indexOf(this)+(e.shiftKey?-1:1);if(0<=a&&a<i.length)return t.events.disableBlur(),M(i[a]).focus(),e.stopPropagation(),!1;var s=c.find(".fr-buttons");if(s.length&&f(s,Boolean(e.shiftKey)))return e.stopPropagation(),!1;if(u(o))return e.stopPropagation(),!1}else{if(R.KEYCODE.ENTER!==n||!e.target||"TEXTAREA"===e.target.tagName)return R.KEYCODE.ESC===n?(e.preventDefault(),e.stopPropagation(),t.accessibility.restoreSelection(),t.popups.isVisible(d)&&c.findVisible(".fr-back").length?(t.opts.toolbarInline&&(t.events.disableBlur(),t.events.focus()),t.button.exec(c.findVisible(".fr-back").first()),b(c)):t.popups.isVisible(d)&&c.findVisible(".fr-dismiss").length?t.button.exec(c.findVisible(".fr-dismiss").first()):(t.popups.hide(d),t.opts.toolbarInline&&t.toolbar.showInline(null,!0),b(c)),!1):R.KEYCODE.SPACE===n&&(r.is(".fr-submit")||r.is(".fr-dismiss"))?(e.preventDefault(),e.stopPropagation(),t.events.disableBlur(),t.button.exec(r),!0):t.keys.isBrowserAction(e)?void e.stopPropagation():r.is("input[type=text], textarea")?void e.stopPropagation():R.KEYCODE.SPACE===n&&(r.is(".fr-link-attr")||r.is("input[type=file]"))?void e.stopPropagation():(e.stopPropagation(),e.preventDefault(),!1);var l=null;0<c.findVisible(".fr-submit").length?l=c.findVisible(".fr-submit").first():c.findVisible(".fr-dismiss").length&&(l=c.findVisible(".fr-dismiss").first()),l&&(e.preventDefault(),e.stopPropagation(),t.events.disableBlur(),t.button.exec(l))}},_tiMouseenter:function(){var e=c.data("instance")||p;o(e)}});r(t.find(".fr-buttons")),p.events.$on(t,"mouseenter","tabIndex",n._tiMouseenter,!0),p.events.$on(t.children().not(".fr-buttons"),"keydown","[tabIndex]",n._tiKeydown,!0),p.popups.onHide(e,function(){(t.data("instance")||p).accessibility.restoreSelection()}),p.popups.onShow(e,function(){i=!1,setTimeout(function(){i=!0},0)})},registerToolbar:r,focusToolbarElement:s,focusToolbar:f,focusContent:u,focusPopup:function(r){var o=r.children().not(".fr-buttons");o.data("mouseenter-event-set")||(p.events.$on(o,"mouseenter","[tabIndex]",function(e){var t=r.data("instance")||p;if(!i)return e.stopPropagation(),void e.preventDefault();var n=o.find(":focus").first();n.length&&!n.is("input, button, textarea, select")&&(t.events.disableBlur(),n.blur(),t.events.disableBlur(),t.events.focus())}),o.data("mouseenter-event-set",!0)),!u(o)&&p.shared.with_kb&&f(r.find(".fr-buttons"))},focusModal:function(e){p.core.hasFocus()||(p.events.disableBlur(),p.events.focus()),p.accessibility.saveSelection(),p.events.disableBlur(),p.el.blur(),p.selection.clear(),p.events.disableBlur(),p.shared.with_kb?e.find(".fr-command[tabIndex], [tabIndex]").first().focus():e.find("[tabIndex]").first().focus()},focusEditor:v,focusPopupButton:b,focusModalButton:function(e){var t=e.data("modal-button");t&&setTimeout(function(){s(t),e.data("modal-button",null)},0)},hasFocus:function(){return null!==p.shared.$f_el},exec:function(e,t){var n=-1!==navigator.userAgent.indexOf("Mac OS X")?e.metaKey:e.ctrlKey,r=e.which,o=!1;return r!==R.KEYCODE.TAB||n||e.shiftKey||e.altKey?r!==R.KEYCODE.ARROW_RIGHT||n||e.shiftKey||e.altKey?r!==R.KEYCODE.TAB||n||!e.shiftKey||e.altKey?r!==R.KEYCODE.ARROW_LEFT||n||e.shiftKey||e.altKey?r!==R.KEYCODE.ARROW_UP||n||e.shiftKey||e.altKey?r!==R.KEYCODE.ARROW_DOWN||n||e.shiftKey||e.altKey?r!==R.KEYCODE.ENTER&&r!==R.KEYCODE.SPACE||n||e.shiftKey||e.altKey?r!==R.KEYCODE.ESC||n||e.shiftKey||e.altKey?r!==R.KEYCODE.F10||n||e.shiftKey||!e.altKey||(o=l()):o=function(e){if(p.shared.$f_el){var t=d();return t?(p.button.click(t),s(t)):e.parent().findVisible(".fr-back").length?(p.shared.with_kb=!1,p.opts.toolbarInline&&(p.events.disableBlur(),p.events.focus()),p.button.exec(e.parent().findVisible(".fr-back")).first(),b(e.parent())):p.shared.$f_el.is("button, .fr-group span")&&(e.parent().is(".fr-popup")?(p.accessibility.restoreSelection(),p.shared.$f_el=null,!1!==p.events.trigger("toolbar.esc")&&(p.popups.hide(e.parent()),p.opts.toolbarInline&&p.toolbar.showInline(null,!0),b(e.parent()))):v()),!1}}(t):o=m():o=p.shared.$f_el&&p.shared.$f_el.is(".fr-dropdown:not(.fr-active)")?m():g(!0):o=g():o=h(t):o=h(t,!0):o=c(t):o=c(t,!0),p.shared.$f_el||void 0!==o||(o=!0),!o&&p.keys.isBrowserAction(e)&&(o=!0),!!o||(e.preventDefault(),e.stopPropagation(),!1)},saveSelection:t,restoreSelection:function(){p.$el.find(".fr-marker").length&&(p.events.disableBlur(),p.selection.restore(),p.events.enableBlur())}}},R.MODULES.node=function(a){function s(e){return e&&"IFRAME"!==e.tagName?Array.prototype.slice.call(e.childNodes||[]):[]}function l(e){return!!e&&(e.nodeType===Node.ELEMENT_NODE&&0<=R.BLOCK_TAGS.indexOf(e.tagName.toLowerCase()))}function d(e){var t={},n=e.attributes;if(n)for(var r=0;r<n.length;r++){var o=n[r];t[o.nodeName]=o.value}return t}function t(e){for(var t="",n=d(e),r=Object.keys(n).sort(),o=0;o<r.length;o++){var i=r[o],a=n[i];a.indexOf("'")<0&&0<=a.indexOf('"')?t+=" "+i+"='"+a+"'":0<=a.indexOf('"')&&0<=a.indexOf("'")?t+=" "+i+'="'+(a=a.replace(/"/g,"&quot;"))+'"':t+=" "+i+'="'+a+'"'}return t}function n(e){return e===a.el}return{isBlock:l,isEmpty:function(e,t){if(!e)return!0;if(e.querySelector("table"))return!1;var n=s(e);1===n.length&&l(n[0])&&(n=s(n[0]));for(var r=!1,o=0;o<n.length;o++){var i=n[o];if(!(t&&a.node.hasClass(i,"fr-marker")||i.nodeType===Node.TEXT_NODE&&0===i.textContent.length)){if("BR"!==i.tagName&&0<(i.textContent||"").replace(/\u200B/gi,"").replace(/\n/g,"").length)return!1;if(r)return!1;"BR"===i.tagName&&(r=!0)}}return!(e.querySelectorAll(R.VOID_ELEMENTS.join(",")).length-e.querySelectorAll("br").length||e.querySelector(a.opts.htmlAllowedEmptyTags.join(":not(.fr-marker),")+":not(.fr-marker)")||1<e.querySelectorAll(R.BLOCK_TAGS.join(",")).length||e.querySelector(a.opts.htmlDoNotWrapTags.join(":not(.fr-marker),")+":not(.fr-marker)"))},blockParent:function(e){for(;e&&e.parentNode!==a.el&&(!e.parentNode||!a.node.hasClass(e.parentNode,"fr-inner"));)if(l(e=e.parentNode))return e;return null},deepestParent:function(e,t,n){if(void 0===t&&(t=[]),void 0===n&&(n=!0),t.push(a.el),0<=t.indexOf(e.parentNode)||e.parentNode&&a.node.hasClass(e.parentNode,"fr-inner")||e.parentNode&&0<=R.SIMPLE_ENTER_TAGS.indexOf(e.parentNode.tagName)&&n)return null;for(;t.indexOf(e.parentNode)<0&&e.parentNode&&!a.node.hasClass(e.parentNode,"fr-inner")&&(R.SIMPLE_ENTER_TAGS.indexOf(e.parentNode.tagName)<0||!n)&&(!l(e)||!l(e.parentNode)||!n);)e=e.parentNode;return e},rawAttributes:d,attributes:t,clearAttributes:function(e){for(var t=e.attributes,n=t.length-1;0<=n;n--){var r=t[n];e.removeAttribute(r.nodeName)}},openTagString:function(e){return"<"+e.tagName.toLowerCase()+t(e)+">"},closeTagString:function(e){return"</"+e.tagName.toLowerCase()+">"},isFirstSibling:function e(t,n){void 0===n&&(n=!0);for(var r=t.previousSibling;r&&n&&a.node.hasClass(r,"fr-marker");)r=r.previousSibling;return!r||r.nodeType===Node.TEXT_NODE&&""===r.textContent&&e(r)},isLastSibling:function e(t,n){void 0===n&&(n=!0);for(var r=t.nextSibling;r&&n&&a.node.hasClass(r,"fr-marker");)r=r.nextSibling;return!r||r.nodeType===Node.TEXT_NODE&&""===r.textContent&&e(r)},isList:function(e){return!!e&&0<=["UL","OL"].indexOf(e.tagName)},isLink:function(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&"a"===e.tagName.toLowerCase()},isElement:n,contents:s,isVoid:function(e){return e&&e.nodeType===Node.ELEMENT_NODE&&0<=R.VOID_ELEMENTS.indexOf((e.tagName||"").toLowerCase())},hasFocus:function(e){return e===a.doc.activeElement&&(!a.doc.hasFocus||a.doc.hasFocus())&&Boolean(n(e)||e.type||e.href||~e.tabIndex)},isEditable:function(e){return(!e.getAttribute||"false"!==e.getAttribute("contenteditable"))&&["STYLE","SCRIPT"].indexOf(e.tagName)<0},isDeletable:function(e){return e&&e.nodeType===Node.ELEMENT_NODE&&e.getAttribute("class")&&0<=(e.getAttribute("class")||"").indexOf("fr-deletable")},hasClass:function(e,t){return e instanceof M&&(e=e.get(0)),e&&e.classList&&e.classList.contains(t)},filter:function(e){return a.browser.msie?e:{acceptNode:e}}}},Object.assign(R.DEFAULTS,{htmlAllowedTags:["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","br","button","canvas","caption","cite","code","col","colgroup","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meter","nav","noscript","object","ol","optgroup","option","output","p","param","pre","progress","queue","rp","rt","ruby","s","samp","script","style","section","select","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","var","video","wbr"],htmlRemoveTags:["script","style"],htmlAllowedAttrs:["accept","accept-charset","accesskey","action","align","allowfullscreen","allowtransparency","alt","async","autocomplete","autofocus","autoplay","autosave","background","bgcolor","border","charset","cellpadding","cellspacing","checked","cite","class","color","cols","colspan","content","contenteditable","contextmenu","controls","coords","data","data-.*","datetime","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","frameborder","headers","height","hidden","high","href","hreflang","http-equiv","icon","id","ismap","itemprop","keytype","kind","label","lang","language","list","loop","low","max","maxlength","media","method","min","mozallowfullscreen","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","scrolling","seamless","selected","shape","size","sizes","span","src","srcdoc","srclang","srcset","start","step","summary","spellcheck","style","tabindex","target","title","type","translate","usemap","value","valign","webkitallowfullscreen","width","wrap"],htmlAllowedStyleProps:[".*"],htmlAllowComments:!0,htmlUntouched:!1,fullPage:!1}),R.HTML5Map={B:"STRONG",I:"EM",STRIKE:"S"},R.MODULES.clean=function(c){var p=void 0,f=void 0,u=void 0,h=void 0;function o(e){if(e.nodeType===Node.ELEMENT_NODE&&e.getAttribute("class")&&0<=e.getAttribute("class").indexOf("fr-marker"))return!1;var t=c.node.contents(e),n=[],r=void 0;for(r=0;r<t.length;r++)t[r].nodeType!==Node.ELEMENT_NODE||c.node.isVoid(t[r])?t[r].nodeType===Node.TEXT_NODE&&(t[r].textContent=t[r].textContent.replace(/\u200b/g,"")):t[r].textContent.replace(/\u200b/g,"").length!==t[r].textContent.length&&o(t[r]);if(e.nodeType===Node.ELEMENT_NODE&&!c.node.isVoid(e)&&(e.normalize(),t=c.node.contents(e),n=e.querySelectorAll(".fr-marker"),t.length-n.length==0)){for(r=0;r<t.length;r++)if(t[r].nodeType===Node.ELEMENT_NODE&&(t[r].getAttribute("class")||"").indexOf("fr-marker")<0)return!1;for(r=0;r<n.length;r++)e.parentNode.insertBefore(n[r].cloneNode(!0),e);return e.parentNode.removeChild(e),!1}}function s(e,t){if(e.nodeType===Node.COMMENT_NODE)return"\x3c!--"+e.nodeValue+"--\x3e";if(e.nodeType===Node.TEXT_NODE)return t?e.textContent.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):e.textContent.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\u00A0/g,"&nbsp;").replace(/\u0009/g,"");if(e.nodeType!==Node.ELEMENT_NODE)return e.outerHTML;if(e.nodeType===Node.ELEMENT_NODE&&0<=["STYLE","SCRIPT","NOSCRIPT"].indexOf(e.tagName))return e.outerHTML;if(e.nodeType===Node.ELEMENT_NODE&&"svg"===e.tagName){var n=document.createElement("div"),r=e.cloneNode(!0);return n.appendChild(r),n.innerHTML}if("IFRAME"===e.tagName)return e.outerHTML.replace(/&lt;/g,"<").replace(/&gt;/g,">");var o=e.childNodes;if(0===o.length)return e.outerHTML;for(var i="",a=0;a<o.length;a++)"PRE"===e.tagName&&(t=!0),i+=s(o[a],t);return c.node.openTagString(e)+i+c.node.closeTagString(e)}var a=[];function g(e){var t=e.replace(/;;/gi,";");return";"!==(t=t.replace(/^;/gi,"")).charAt(t.length)&&(t+=";"),t}function l(e){var t=void 0;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=t.match(u),r=null;"style"===t&&c.opts.htmlAllowedStyleProps.length&&(r=e[t].match(h)),n&&r?e[t]=g(r.join(";")):n&&("style"!==t||r)||delete e[t]}for(var o="",i=Object.keys(e).sort(),a=0;a<i.length;a++)e[t=i[a]].indexOf('"')<0?o+=" "+t+'="'+e[t]+'"':o+=" "+t+"='"+e[t]+"'";return o}function d(e,t){var n=void 0,r=document.implementation.createHTMLDocument("Froala DOC").createElement("DIV");M(r).append(e);var o="";if(r){var i=c.node.contents(r);for(n=0;n<i.length;n++)t(i[n]);for(i=c.node.contents(r),n=0;n<i.length;n++)o+=s(i[n])}return o}function m(e,t,n){a=[];var r=e=e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,function(e){return a.push(e),"[FROALA.EDITOR.SCRIPT "+(a.length-1)+"]"}).replace(/<noscript\b[^<]*(?:(?!<\/noscript>)<[^<]*)*<\/noscript>/gi,function(e){return a.push(e),"[FROALA.EDITOR.NOSCRIPT "+(a.length-1)+"]"}).replace(/<meta((?:[\w\W]*?)) http-equiv="/g,'<meta$1 data-fr-http-equiv="').replace(/<img((?:[\w\W]*?)) src="/g,'<img$1 data-fr-src="'),o=null;c.opts.fullPage&&(r=c.html.extractNode(e,"body")||(0<=e.indexOf("<body")?"":e),n&&(o=c.html.extractNode(e,"head")||"")),r=d(r,t),o&&(o=d(o,t));var i=function(e,t,n){if(c.opts.fullPage){var r=c.html.extractDoctype(n),o=l(c.html.extractNodeAttrs(n,"html"));return t=null===t?c.html.extractNode(n,"head")||"<title></title>":t,r+"<html"+o+"><head"+l(c.html.extractNodeAttrs(n,"head"))+">"+t+"</head><body"+l(c.html.extractNodeAttrs(n,"body"))+">"+e+"</body></html>"}return e}(r,o,e);return i.replace(/\[FROALA\.EDITOR\.SCRIPT ([\d]*)\]/gi,function(e,t){return 0<=c.opts.htmlRemoveTags.indexOf("script")?"":a[parseInt(t,10)]}).replace(/\[FROALA\.EDITOR\.NOSCRIPT ([\d]*)\]/gi,function(e,t){return 0<=c.opts.htmlRemoveTags.indexOf("noscript")?"":a[parseInt(t,10)].replace(/&lt;/g,"<").replace(/&gt;/g,">")}).replace(/<img((?:[\w\W]*?)) data-fr-src="/g,'<img$1 src="')}function v(e){var t=c.doc.createElement("DIV");return t.innerText=e,t.textContent}function b(e){for(var t=c.node.contents(e),n=0;n<t.length;n++)t[n].nodeType!==Node.TEXT_NODE&&b(t[n]);!function(e){if("SPAN"===e.tagName&&0<=(e.getAttribute("class")||"").indexOf("fr-marker"))return;var t,n;if("PRE"===e.tagName&&0<=(n=(t=e).innerHTML).indexOf("\n")&&(t.innerHTML=n.replace(/\n/g,"<br>")),e.nodeType===Node.ELEMENT_NODE&&(e.getAttribute("data-fr-src")&&0!==e.getAttribute("data-fr-src").indexOf("blob:")&&e.setAttribute("data-fr-src",c.helpers.sanitizeURL(v(e.getAttribute("data-fr-src")))),e.getAttribute("href")&&e.setAttribute("href",c.helpers.sanitizeURL(v(e.getAttribute("href")))),e.getAttribute("src")&&e.setAttribute("src",c.helpers.sanitizeURL(v(e.getAttribute("src")))),0<=["TABLE","TBODY","TFOOT","TR"].indexOf(e.tagName)&&(e.innerHTML=e.innerHTML.trim())),!c.opts.pasteAllowLocalImages&&e.nodeType===Node.ELEMENT_NODE&&"IMG"===e.tagName&&e.getAttribute("data-fr-src")&&0===e.getAttribute("data-fr-src").indexOf("file://"))return e.parentNode.removeChild(e);if(e.nodeType===Node.ELEMENT_NODE&&R.HTML5Map[e.tagName]&&""===c.node.attributes(e)){var r=R.HTML5Map[e.tagName],o="<"+r+">"+e.innerHTML+"</"+r+">";e.insertAdjacentHTML("beforebegin",o),(e=e.previousSibling).parentNode.removeChild(e.nextSibling)}if(c.opts.htmlAllowComments||e.nodeType!==Node.COMMENT_NODE)if(e.tagName&&e.tagName.match(f))e.parentNode.removeChild(e);else if(e.tagName&&!e.tagName.match(p))"svg"===e.tagName?e.parentNode.removeChild(e):c.browser.safari&&"path"===e.tagName&&e.parentNode&&"svg"===e.parentNode.tagName||(e.outerHTML=e.innerHTML);else{var i=e.attributes;if(i)for(var a=i.length-1;0<=a;a--){var s=i[a],l=s.nodeName.match(u),d=null;"style"===s.nodeName&&c.opts.htmlAllowedStyleProps.length&&(d=s.value.match(h)),l&&d?s.value=g(d.join(";")):l&&("style"!==s.nodeName||d)||e.removeAttribute(s.nodeName)}}else 0!==e.data.indexOf("[FROALA.EDITOR")&&e.parentNode.removeChild(e)}(e)}return{_init:function(){c.opts.fullPage&&M.merge(c.opts.htmlAllowedTags,["head","title","style","link","base","body","html","meta"])},html:function(e,t,n,r){void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===r&&(r=!1);var o=M.merge([],c.opts.htmlAllowedTags),i=void 0;for(i=0;i<t.length;i++)0<=o.indexOf(t[i])&&o.splice(o.indexOf(t[i]),1);var a=M.merge([],c.opts.htmlAllowedAttrs);for(i=0;i<n.length;i++)0<=a.indexOf(n[i])&&a.splice(a.indexOf(n[i]),1);return a.push("data-fr-.*"),a.push("fr-.*"),p=new RegExp("^"+o.join("$|^")+"$","gi"),u=new RegExp("^"+a.join("$|^")+"$","gi"),f=new RegExp("^"+c.opts.htmlRemoveTags.join("$|^")+"$","gi"),h=c.opts.htmlAllowedStyleProps.length?new RegExp("((^|;|\\s)"+c.opts.htmlAllowedStyleProps.join(":.+?(?=;|$))|((^|;|\\s)")+":.+?(?=(;)|$))","gi"):null,e=m(e,b,!0)},toHTML5:function(){var e=c.el.querySelectorAll(Object.keys(R.HTML5Map).join(","));if(e.length){var t=!1;c.el.querySelector(".fr-marker")||(c.selection.save(),t=!0);for(var n=0;n<e.length;n++)""===c.node.attributes(e[n])&&M(e[n]).replaceWith("<"+R.HTML5Map[e[n].tagName]+">"+e[n].innerHTML+"</"+R.HTML5Map[e[n].tagName]+">");t&&c.selection.restore()}},tables:function(){!function(){for(var e=c.el.querySelectorAll("tr"),t=0;t<e.length;t++){for(var n=e[t].children,r=!0,o=0;o<n.length;o++)if("TH"!==n[o].tagName){r=!1;break}if(!1!==r&&0!==n.length){for(var i=e[t];i&&"TABLE"!==i.tagName&&"THEAD"!==i.tagName;)i=i.parentNode;var a=i;"THEAD"!==a.tagName&&(a=c.doc.createElement("THEAD"),i.insertBefore(a,i.firstChild)),a.appendChild(e[t])}}}()},lists:function(){!function(){var e,t=[];do{if(t.length){var n=t[0],r=c.doc.createElement("ul");n.parentNode.insertBefore(r,n);do{var o=n;n=n.nextSibling,r.appendChild(o)}while(n&&"LI"===n.tagName)}t=[];for(var i=c.el.querySelectorAll("li"),a=0;a<i.length;a++)e=i[a],c.node.isList(e.parentNode)||t.push(i[a])}while(0<t.length)}(),function(){for(var e=c.el.querySelectorAll("ol + ol, ul + ul"),t=0;t<e.length;t++){var n=e[t];if(c.node.isList(n.previousSibling)&&c.node.openTagString(n)===c.node.openTagString(n.previousSibling)){for(var r=c.node.contents(n),o=0;o<r.length;o++)n.previousSibling.appendChild(r[o]);n.parentNode.removeChild(n)}}}(),function(){for(var e=c.el.querySelectorAll("ul, ol"),t=0;t<e.length;t++)for(var n=c.node.contents(e[t]),r=null,o=n.length-1;0<=o;o--)"LI"!==n[o].tagName?(r||(r=M(c.doc.createElement("LI"))).insertBefore(n[o]),r.prepend(n[o])):r=null}(),function(){var e,t=void 0,n=void 0;do{n=!1;var r=c.el.querySelectorAll("li:empty");for(t=0;t<r.length;t++)r[t].parentNode.removeChild(r[t]);var o=c.el.querySelectorAll("ul, ol");for(t=0;t<o.length;t++)(e=o[t]).querySelector("LI")||(n=!0,e.parentNode.removeChild(e))}while(!0===n)}(),function(){for(var e=c.el.querySelectorAll("ul > ul, ol > ol, ul > ol, ol > ul"),t=0;t<e.length;t++){var n=e[t],r=n.previousSibling;r&&("LI"===r.tagName?r.appendChild(n):M(n).wrap("<li></li>"))}}(),function(){for(var e=c.el.querySelectorAll("li > ul, li > ol"),t=0;t<e.length;t++){var n=e[t];if(n.nextSibling){var r=n.nextSibling,o=M(c.doc.createElement("LI"));M(n.parentNode).after(o);do{var i=r;r=r.nextSibling,o.append(i)}while(r)}}}(),function(){for(var e=c.el.querySelectorAll("li > ul, li > ol"),t=0;t<e.length;t++){var n=e[t];if(c.node.isFirstSibling(n))M(n).before("<br/>");else if(n.previousSibling&&"BR"===n.previousSibling.tagName){for(var r=n.previousSibling.previousSibling;r&&c.node.hasClass(r,"fr-marker");)r=r.previousSibling;r&&"BR"!==r.tagName&&M(n.previousSibling).remove()}}}(),function(){for(var e=c.el.querySelectorAll("li:empty"),t=0;t<e.length;t++)M(e[t]).remove()}()},invisibleSpaces:function(e){return e.replace(/\u200b/g,"").length===e.length?e:c.clean.exec(e,o)},exec:m}},Object.assign(R.DEFAULTS,{indentMargin:20}),R.COMMANDS={bold:{title:"Bold",toggle:!0,refresh:function(e){var t=this.format.is("strong");e.toggleClass("fr-active",t).attr("aria-pressed",t)}},italic:{title:"Italic",toggle:!0,refresh:function(e){var t=this.format.is("em");e.toggleClass("fr-active",t).attr("aria-pressed",t)}},underline:{title:"Underline",toggle:!0,refresh:function(e){var t=this.format.is("u");e.toggleClass("fr-active",t).attr("aria-pressed",t)}},strikeThrough:{title:"Strikethrough",toggle:!0,refresh:function(e){var t=this.format.is("s");e.toggleClass("fr-active",t).attr("aria-pressed",t)}},subscript:{title:"Subscript",toggle:!0,refresh:function(e){var t=this.format.is("sub");e.toggleClass("fr-active",t).attr("aria-pressed",t)}},superscript:{title:"Superscript",toggle:!0,refresh:function(e){var t=this.format.is("sup");e.toggleClass("fr-active",t).attr("aria-pressed",t)}},outdent:{title:"Decrease Indent"},indent:{title:"Increase Indent"},undo:{title:"Undo",undo:!1,forcedRefresh:!0,disabled:!0},redo:{title:"Redo",undo:!1,forcedRefresh:!0,disabled:!0},insertHR:{title:"Insert Horizontal Line"},clearFormatting:{title:"Clear Formatting"},selectAll:{title:"Select All",undo:!1}},R.RegisterCommand=function(e,t){R.COMMANDS[e]=t},R.MODULES.commands=function(a){function o(e){return a.html.defaultTag()&&(e="<"+a.html.defaultTag()+">"+e+"</"+a.html.defaultTag()+">"),e}var i={bold:function(){e("bold","strong")},subscript:function(){a.format.is("sup")&&a.format.remove("sup"),e("subscript","sub")},superscript:function(){a.format.is("sub")&&a.format.remove("sub"),e("superscript","sup")},italic:function(){e("italic","em")},strikeThrough:function(){e("strikeThrough","s")},underline:function(){e("underline","u")},undo:function(){a.undo.run()},redo:function(){a.undo.redo()},indent:function(){n(1)},outdent:function(){n(-1)},show:function(){a.opts.toolbarInline&&a.toolbar.showInline(null,!0)},insertHR:function(){a.selection.remove();var e="";a.core.isEmpty()&&(e=o(e="<br>")),a.html.insert('<hr id="fr-just">'+e);var t=a.$el.find("hr#fr-just");t.removeAttr("id");var n=void 0;if(0===t.next().length){var r=a.html.defaultTag();r?t.after(M(a.doc.createElement(r)).append("<br>").get(0)):t.after("<br>")}t.prev().is("hr")?n=a.selection.setAfter(t.get(0),!1):t.next().is("hr")?n=a.selection.setBefore(t.get(0),!1):a.selection.setAfter(t.get(0),!1)||a.selection.setBefore(t.get(0),!1),n||void 0===n||(e=o(e=R.MARKERS+"<br>"),t.after(e)),a.selection.restore()},clearFormatting:function(){a.format.remove()},selectAll:function(){a.doc.execCommand("selectAll",!1,!1)}};function t(e,t){if(!1!==a.events.trigger("commands.before",M.merge([e],t||[]))){var n=R.COMMANDS[e]&&R.COMMANDS[e].callback||i[e],r=!0,o=!1;R.COMMANDS[e]&&("undefined"!=typeof R.COMMANDS[e].focus&&(r=R.COMMANDS[e].focus),"undefined"!=typeof R.COMMANDS[e].accessibilityFocus&&(o=R.COMMANDS[e].accessibilityFocus)),(!a.core.hasFocus()&&r&&!a.popups.areVisible()||!a.core.hasFocus()&&o&&a.accessibility.hasFocus())&&a.events.focus(!0),R.COMMANDS[e]&&!1!==R.COMMANDS[e].undo&&(a.$el.find(".fr-marker").length&&(a.events.disableBlur(),a.selection.restore()),a.undo.saveStep()),n&&n.apply(a,M.merge([e],t||[])),a.events.trigger("commands.after",M.merge([e],t||[])),R.COMMANDS[e]&&!1!==R.COMMANDS[e].undo&&a.undo.saveStep()}}function e(e,t){a.format.toggle(t)}function n(e){a.selection.save(),a.html.wrap(!0,!0,!0,!0),a.selection.restore();for(var t=a.selection.blocks(),n=0;n<t.length;n++)if("LI"!==t[n].tagName&&"LI"!==t[n].parentNode.tagName){var r=M(t[n]),o="rtl"===a.opts.direction||"rtl"===r.css("direction")?"margin-right":"margin-left",i=a.helpers.getPX(r.css(o));if(r.width()<2*a.opts.indentMargin&&0<e)continue;r.css(o,Math.max(i+e*a.opts.indentMargin,0)||""),r.removeClass("fr-temp-div")}a.selection.save(),a.html.unwrap(),a.selection.restore()}function r(e){return function(){t(e)}}var s={};for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(s[l]=r(l));return Object.assign(s,{exec:t,_init:function(){a.events.on("keydown",function(e){var t=a.selection.element();if(t&&"HR"===t.tagName&&!a.keys.isArrow(e.which))return e.preventDefault(),!1}),a.events.on("keyup",function(e){var t=a.selection.element();if(t&&"HR"===t.tagName)if(e.which===R.KEYCODE.ARROW_LEFT||e.which===R.KEYCODE.ARROW_UP){if(t.previousSibling)return a.node.isBlock(t.previousSibling)?a.selection.setAtEnd(t.previousSibling):M(t).before(R.MARKERS),a.selection.restore(),!1}else if((e.which===R.KEYCODE.ARROW_RIGHT||e.which===R.KEYCODE.ARROW_DOWN)&&t.nextSibling)return a.node.isBlock(t.nextSibling)?a.selection.setAtStart(t.nextSibling):M(t).after(R.MARKERS),a.selection.restore(),!1}),a.events.on("mousedown",function(e){if(e.target&&"HR"===e.target.tagName)return e.preventDefault(),e.stopPropagation(),!1}),a.events.on("mouseup",function(){var e=a.selection.element();e===a.selection.endElement()&&e&&"HR"===e.tagName&&(e.nextSibling&&(a.node.isBlock(e.nextSibling)?a.selection.setAtStart(e.nextSibling):M(e).after(R.MARKERS)),a.selection.restore())})}})},R.MODULES.edit=function(t){function e(){if(t.browser.mozilla)try{t.doc.execCommand("enableObjectResizing",!1,"false"),t.doc.execCommand("enableInlineTableEditing",!1,"false")}catch(e){}if(t.browser.msie)try{t.doc.body.addEventListener("mscontrolselect",function(e){return e.preventDefault(),!1})}catch(e){}}var n=!1;function r(){return n}return{_init:function(){t.events.on("focus",function(){r()?t.edit.off():t.edit.on()})},on:function(){t.$wp?(t.$el.attr("contenteditable",!0),t.$el.removeClass("fr-disabled").attr("aria-disabled",!1),t.$tb&&t.$tb.removeClass("fr-disabled").removeAttr("aria-disabled"),e()):t.$el.is("a")&&t.$el.attr("contenteditable",!0),n=!1},off:function(){t.events.disableBlur(),t.$wp?(t.$el.attr("contenteditable",!1),t.$el.addClass("fr-disabled").attr("aria-disabled",!0),t.$tb&&t.$tb.addClass("fr-disabled").attr("aria-disabled",!0)):t.$el.is("a")&&t.$el.attr("contenteditable",!1),t.events.enableBlur(),n=!0},disableDesign:e,isDisabled:r}},R.MODULES.spaces=function(l){function r(e,t){var n=e.previousSibling,r=e.nextSibling,o=e.textContent,i=e.parentNode;if(!l.html.isPreformatted(i)){t&&(o=o.replace(/[\f\n\r\t\v ]{2,}/g," "),r&&"BR"!==r.tagName&&!l.node.isBlock(r)||!(l.node.isBlock(i)||l.node.isLink(i)&&!i.nextSibling||l.node.isElement(i))||(o=o.replace(/[\f\n\r\t\v ]{1,}$/g,"")),n&&"BR"!==n.tagName&&!l.node.isBlock(n)||!(l.node.isBlock(i)||l.node.isLink(i)&&!i.previousSibling||l.node.isElement(i))||(o=o.replace(/^[\f\n\r\t\v ]{1,}/g,""))," "===o&&(n&&l.node.isVoid(n)||r&&l.node.isVoid(r))&&(o="")),(!n&&l.node.isBlock(r)||!r&&l.node.isBlock(n))&&l.node.isBlock(i)&&i!==l.el&&(o=o.replace(/^[\f\n\r\t\v ]{1,}/g,"")),t||(o=o.replace(new RegExp(R.UNICODE_NBSP,"g")," "));for(var a="",s=0;s<o.length;s++)32!==o.charCodeAt(s)||0!==s&&32!==a.charCodeAt(s-1)?a+=o[s]:a+=R.UNICODE_NBSP;(!r||r&&l.node.isBlock(r)||r&&r.nodeType===Node.ELEMENT_NODE&&l.win.getComputedStyle(r)&&"block"===l.win.getComputedStyle(r).display)&&(a=a.replace(/ $/,R.UNICODE_NBSP)),!n||l.node.isVoid(n)||l.node.isBlock(n)||1!==(a=a.replace(/^\u00A0([^ $])/," $1")).length||160!==a.charCodeAt(0)||!r||l.node.isVoid(r)||l.node.isBlock(r)||(a=" "),t||(a=a.replace(/([^ \u00A0])\u00A0([^ \u00A0])/g,"$1 $2")),e.textContent!==a&&(e.textContent=a)}}function d(e,t){if(void 0!==e&&e||(e=l.el),void 0===t&&(t=!1),!e.getAttribute||"false"!==e.getAttribute("contenteditable"))if(e.nodeType===Node.TEXT_NODE)r(e,t);else if(e.nodeType===Node.ELEMENT_NODE)for(var n=l.doc.createTreeWalker(e,NodeFilter.SHOW_TEXT,l.node.filter(function(e){for(var t=e.parentNode;t&&t!==l.el;){if("STYLE"===t.tagName||"IFRAME"===t.tagName)return!1;if("PRE"===t.tagName)return!1;t=t.parentNode}return null!==e.textContent.match(/([ \u00A0\f\n\r\t\v]{2,})|(^[ \u00A0\f\n\r\t\v]{1,})|([ \u00A0\f\n\r\t\v]{1,}$)/g)&&!l.node.hasClass(e.parentNode,"fr-marker")}),!1);n.nextNode();)r(n.currentNode,t)}return{normalize:d,normalizeAroundCursor:function(){for(var e=[],t=l.el.querySelectorAll(".fr-marker"),n=0;n<t.length;n++){for(var r=null,o=l.node.blockParent(t[n]),i=(r=o||t[n]).nextSibling,a=r.previousSibling;i&&"BR"===i.tagName;)i=i.nextSibling;for(;a&&"BR"===a.tagName;)a=a.previousSibling;r&&e.indexOf(r)<0&&e.push(r),a&&e.indexOf(a)<0&&e.push(a),i&&e.indexOf(i)<0&&e.push(i)}for(var s=0;s<e.length;s++)d(e[s])}}},R.MARKERS=(R.START_MARKER='<span class="fr-marker" data-id="0" data-type="true" style="display: none; line-height: 0;">'+(R.INVISIBLE_SPACE="&#8203;")+"</span>")+(R.END_MARKER='<span class="fr-marker" data-id="0" data-type="false" style="display: none; line-height: 0;">'+R.INVISIBLE_SPACE+"</span>"),R.MODULES.markers=function(f){function l(){if(!f.$wp)return null;try{var e=f.selection.ranges(0),t=e.commonAncestorContainer;if(t!==f.el&&!f.$el.contains(t))return null;var n=e.cloneRange(),r=e.cloneRange();n.collapse(!0);var o=M(f.doc.createElement("SPAN")).addClass("fr-marker").attr("style","display: none; line-height: 0;").html(R.INVISIBLE_SPACE).get(0);if(n.insertNode(o),o=f.$el.find("span.fr-marker").get(0)){for(var i=o.nextSibling;i&&i.nodeType===Node.TEXT_NODE&&0===i.textContent.length;)M(i).remove(),i=f.$el.find("span.fr-marker").get(0).nextSibling;return f.selection.clear(),f.selection.get().addRange(r),o}return null}catch(a){}}function d(){f.$el.find(".fr-marker").remove()}return{place:function(e,t,n){var r,o,i,a=void 0,s=void 0,l=void 0;try{var d=e.cloneRange();if(d.collapse(t),d.insertNode((r=t,o=n,(i=M(f.doc.createElement("SPAN"))).addClass("fr-marker").attr("data-id",o).attr("data-type",r).attr("style","display: "+(f.browser.safari?"none":"inline-block")+"; line-height: 0;").html(R.INVISIBLE_SPACE),i.get(0))),!0===t)for(l=(a=f.$el.find('span.fr-marker[data-type="true"][data-id="'+n+'"]').get(0)).nextSibling;l&&l.nodeType===Node.TEXT_NODE&&0===l.textContent.length;)M(l).remove(),l=a.nextSibling;if(!0===t&&!e.collapsed){for(;!f.node.isElement(a.parentNode