/*!
* froala_editor v3.0.0-beta.2-1 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2019 Froala Labs
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(r){"use strict";(r=r&&r.hasOwnProperty("default")?r["default"]:r).URLRegEx="(^| |\\u00A0)("+r.LinkRegEx+"|([a-z0-9+-_.]{1,}@[a-z0-9+-_.]{1,}\\.[a-z0-9+-_]{1,}))$",r.PLUGINS.url=function(i){var l=i.$,a=null;function t(e,t,n){for(var r="";n.length&&"."==n[n.length-1];)r+=".",n=n.substring(0,n.length-1);var o=n;if(i.opts.linkConvertEmailAddress)i.helpers.isEmail(o)&&!/^mailto:.*/i.test(o)&&(o="mailto:"+o);else if(i.helpers.isEmail(o))return t+n;return/^((http|https|ftp|ftps|mailto|tel|sms|notes|data)\:)/i.test(o)||(o="//"+o),(t||"")+"'+n.replace(/&/g,"&").replace(/&/g,"&").replace(//g,">")+""+r}function s(){return new RegExp(r.URLRegEx,"gi")}function p(e){return i.opts.linkAlwaysNoFollow&&(a="nofollow"),i.opts.linkAlwaysBlank&&(i.opts.linkNoOpener&&(a?a+=" noopener":a="noopener"),i.opts.linkNoReferrer&&(a?a+=" noreferrer":a="noreferrer")),e.replace(s(),t)}function f(e){var t=e.split(" ");return t[t.length-1]}function n(){var t=i.selection.ranges(0),n=t.startContainer;if(!n||n.nodeType!==Node.TEXT_NODE||t.startOffset!==(n.textContent||"").length)return!1;if(function e(t){return!!t&&("A"===t.tagName||!(!t.parentNode||t.parentNode==i.el)&&e(t.parentNode))}(n))return!1;if(s().test(f(n.textContent))){l(n).before(p(n.textContent));var r=l(n.parentNode).find("a[data-fr-linked]");r.removeAttr("data-fr-linked"),n.parentNode.removeChild(n),i.events.trigger("url.linked",[r.get(0)])}else if(n.textContent.split(" ").length<=2&&n.previousSibling&&"A"===n.previousSibling.tagName){var o=n.previousSibling.innerText+n.textContent;s().test(f(o))&&(l(n.previousSibling).replaceWith(p(o)),n.parentNode.removeChild(n))}}return{_init:function(){i.events.on("keypress",function(e){!i.selection.isCollapsed()||"."!=e.key&&")"!=e.key&&"("!=e.key||n()},!0),i.events.on("keydown",function(e){var t=e.which;!i.selection.isCollapsed()||t!=r.KEYCODE.ENTER&&t!=r.KEYCODE.SPACE||n()},!0),i.events.on("paste.beforeCleanup",function(e){if(i.helpers.isURL(e)){var t=null;return i.opts.linkAlwaysBlank&&(i.opts.linkNoOpener&&(t?t+=" noopener":t="noopener"),i.opts.linkNoReferrer&&(t?t+=" noreferrer":t="noreferrer")),"'+e+""}})}}}});