Vergleich jscripts/sceditor/jquery.sceditor.bbcode.min.js - 1.8.16 - 1.8.38

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
/* SCEditor v1.4.7 | (C) 2015, Sam Clarke | sceditor.com/license */
!function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){var d;d=function(){"use strict";var a=c(1),b=c(2),d=c(3),e=c(4),f=c(5);a.sceditor=b,b.commands=c(6),b.defaultOptions=c(7),b.RangeHelper=c(8),b.dom=c(9),b.ie=e.ie,b.ios=e.ios,b.isWysiwygSupported=e.isWysiwygSupported,b.regexEscape=f.regex,b.escapeEntities=f.entities,b.escapeUriScheme=f.uriScheme,b.PluginManager=d,b.plugins=d.plugins,a.fn.sceditor=function(c){var d,f,g=[];return c=c||{},c.runWithoutWysiwygSupport||e.isWysiwygSupported?(this.each(function(){d=this.jquery?this:a(this),f=d.data("sceditor"),d.parents(".sceditor-container").length>0||("state"===c?g.push(!!f):"instance"===c?g.push(f):f||new b(this,c))}),g.length?1===g.length?g[0]:a(g):this):void 0}}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a){a.exports=jQuery},function(a,b,c){var d;d=function(){"use strict";var a=c(1),b=c(3),d=c(8),e=c(9),f=c(5),g=c(4),h=c(10),i=window,j=document,k=a(i),l=a(j),m=g.ie,n=m&&11>m,o=function(c,p){var q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub=this,vb=c.get?c.get(0):c,wb=a(vb),xb=[],yb=[],zb=[],Ab={},Bb=[],Cb={};ub.commands=a.extend(!0,{},p.commands||o.commands),ub.opts=p=a.extend({},o.defaultOptions,p),K=function(){wb.data("sceditor",ub),a.each(p,function(b,c){a.isPlainObject(c)&&(p[b]=a.extend(!0,{},c))}),p.locale&&"en"!==p.locale&&Q(),q=a('<div class="sceditor-container" />').insertAfter(wb).css("z-index",p.zIndex),m&&q.addClass("ie ie"+m),H=!!wb.attr("required"),wb.removeAttr("required"),P(),W(),R(),O(),U(),S(),T(),g.isWysiwygSupported||ub.toggleSourceMode(),hb();var b=function(){k.unbind("load",b),p.autofocus&&mb(),p.autoExpand&&ub.expandToContent(),fb(),C.call("ready")};k.load(b),j.readyState&&"complete"===j.readyState&&b()},P=function(){var c=p.plugins;c=c?c.toString().split(","):[],C=new b(ub),a.each(c,function(b,c){C.register(a.trim(c))})},Q=function(){var a;A=o.locale[p.locale],A||(a=p.locale.split("-"),A=o.locale[a[0]]),A&&A.dateFormat&&(p.dateFormat=A.dateFormat)},O=function(){var b,c;w=a("<textarea></textarea>").hide(),s=a('<iframe frameborder="0" allowfullscreen="true"></iframe>'),p.spellcheck||w.attr("spellcheck","false"),"https:"===i.location.protocol&&s.attr("src","javascript:false"),q.append(s).append(w),t=s[0],x=w[0],ub.dimensions(p.width||wb.width(),p.height||wb.height()),b=X(),b.open(),b.write(h("html",{attrs:m?' class="ie ie"'+m:"",spellcheck:p.spellcheck?"":'spellcheck="false"',charset:p.charset,style:p.style})),b.close(),v=a(b),u=a(b.body),ub.readOnly(!!p.readOnly),(g.ios||m)&&(u.height("100%"),m||u.bind("touchend",ub.focus)),c=wb.attr("tabindex"),w.attr("tabindex",c),s.attr("tabindex",c),B=new d(t.contentWindow),ub.val(wb.hide().val())},S=function(){p.autoUpdate&&(u.bind("blur",tb),w.bind("blur",tb)),null===p.rtl&&(p.rtl="rtl"===w.css("direction")),ub.rtl(!!p.rtl),p.autoExpand&&v.bind("keyup",ub.expandToContent),p.resizeEnabled&&V(),q.attr("id",p.id),ub.emoticons(p.emoticonsEnabled)},T=function(){var b=m?"selectionchange":"keyup focus blur contextmenu mouseup touchend click",c="keydown keyup keypress focus blur contextmenu";l.click(eb),a(vb.form).bind("reset",bb).submit(ub.updateOriginal),k.bind("resize orientationChanged",fb),u.keypress(ab).keydown($).keydown(_).keyup(jb).blur(rb).keyup(sb).bind("paste",Y).bind(b,kb).bind(c,db),p.emoticonsCompat&&i.getSelection&&u.keyup(ob),w.blur(rb).keyup(sb).keydown($).bind(c,db),v.mousedown(cb).blur(rb).bind(b,kb).bind("beforedeactivate keyup mouseup",N).keyup(jb).focus(function(){z=null}),q.bind("selectionchanged",lb).bind("selectionchanged",hb).bind("selectionchanged valuechanged nodechanged",db)},R=function(){var b,c=ub.commands,d=(p.toolbarExclude||"").split(","),e=p.toolbar.split("|");r=a('<div class="sceditor-toolbar" unselectable="on" />'),a.each(e,function(e,f){b=a('<div class="sceditor-group" />'),a.each(f.split(","),function(e,f){var g,i,j=c[f];!j||a.inArray(f,d)>-1||(i=j.shortcut,g=h("toolbarButton",{name:f,dispName:ub._(j.tooltip||f)},!0),g.data("sceditor-txtmode",!!j.txtExec).data("sceditor-wysiwygmode",!!j.exec).toggleClass("disabled",!j.exec).mousedown(function(){(!m||9>m)&&(J=!0)}).click(function(){var b=a(this);return b.hasClass("disabled")||M(b,j),hb(),!1}),j.tooltip&&g.attr("title",ub._(j.tooltip)+(i?"("+i+")":"")),i&&ub.addShortcut(i,f),j.state?zb.push({name:f,state:j.state}):"string"==typeof j.exec&&zb.push({name:f,state:j.exec}),b.append(g),Cb[f]=g)}),b[0].firstChild&&r.append(b)}),a(p.toolbarContainer||q).append(r)},U=function(){a.each(ub.commands,function(b,c){c.forceNewLineAfter&&a.isArray(c.forceNewLineAfter)&&(yb=a.merge(yb,c.forceNewLineAfter))}),jb()},V=function(){var b,c,d,e,f,g,h=a('<div class="sceditor-grip" />'),j=a('<div class="sceditor-resize-cover" />'),k="touchmove mousemove",n="touchcancel touchend mouseup",o=0,r=0,s=0,t=0,u=0,v=0,w=q.width(),x=q.height(),y=!1,z=ub.rtl();b=p.resizeMinHeight||x/1.5,c=p.resizeMaxHeight||2.5*x,d=p.resizeMinWidth||w/1.25,e=p.resizeMaxWidth||1.25*w,f=function(a){"touchmove"===a.type?(a=i.event,s=a.changedTouches[0].pageX,t=a.changedTouches[0].pageY):(s=a.pageX,t=a.pageY);var f=v+(t-r),g=z?u-(s-o):u+(s-o);e>0&&g>e&&(g=e),d>0&&d>g&&(g=d),p.resizeWidth||(g=!1),c>0&&f>c&&(f=c),b>0&&b>f&&(f=b),p.resizeHeight||(f=!1),(g||f)&&(ub.dimensions(g,f),7>m&&q.height(f)),a.preventDefault()},g=function(a){y&&(y=!1,j.hide(),q.removeClass("resizing").height("auto"),l.unbind(k,f),l.unbind(n,g),a.preventDefault())},q.append(h),q.append(j.hide()),h.bind("touchstart mousedown",function(a){"touchstart"===a.type?(a=i.event,o=a.touches[0].pageX,r=a.touches[0].pageY):(o=a.pageX,r=a.pageY),u=q.width(),v=q.height(),y=!0,q.addClass("resizing"),j.show(),l.bind(k,f),l.bind(n,g),7>m&&q.height(v),a.preventDefault()})},W=function(){var b,c=p.emoticons,d=p.emoticonsRoot;a.isPlainObject(c)&&p.emoticonsEnabled&&a.each(c,function(e,f){a.each(f,function(a,f){d&&(f={url:d+(f.url||f),tooltip:f.tooltip||a},c[e][a]=f),b=j.createElement("img"),b.src=f.url||f,xb.push(b)})})},mb=function(){var b,c,d=v[0],f=u[0],g=f.firstChild,h=!!p.autofocusEnd;if(q.is(":visible")){if(ub.sourceMode())return c=h?x.value.length:0,void(x.setSelectionRange?x.setSelectionRange(c,c):(b=x.createTextRange(),b.moveEnd("character",c),b.collapse(!1),b.select()));if(e.removeWhiteSpace(f),h)for((g=f.lastChild)||(g=d.createElement("p"),u.append(g));g.lastChild;)g=g.lastChild,!n&&a(g).is("br")&&g.previousSibling&&(g=g.previousSibling);d.createRange?(b=d.createRange(),e.canHaveChildren(g)?b.selectNodeContents(g):(b.setStartBefore(g),h&&b.setStartAfter(g))):(b=f.createTextRange(),b.moveToElementText(3!==g.nodeType?g:g.parentNode)),b.collapse(!h),B.selectRange(b),F=b,h&&(v.scrollTop(f.scrollHeight),u.scrollTop(f.scrollHeight)),ub.focus()}},ub.readOnly=function(a){return"boolean"!=typeof a?"readonly"===w.attr("readonly"):(u[0].contentEditable=!a,a?w.attr("readonly","readonly"):w.removeAttr("readonly"),gb(a),ub)},ub.rtl=function(a){var b=a?"rtl":"ltr";return"boolean"!=typeof a?"rtl"===w.attr("dir"):(u.attr("dir",b),w.attr("dir",b),q.removeClass("rtl").removeClass("ltr").addClass(b),ub)},gb=function(b){var c=ub.inSourceMode()?"txtmode":"wysiwygmode";a.each(Cb,function(a,d){b!==!0&&d.data("sceditor-"+c)?d.removeClass("disabled"):d.addClass("disabled")})},ub.width=function(a,b){return a||0===a?(ub.dimensions(a,null,b),ub):q.width()},ub.dimensions=function(a,b,c){var d,e=8>m||j.documentMode<8?2:0;return a=a||0===a?a:!1,b=b||0===b?b:!1,a===!1&&b===!1?{width:ub.width(),height:ub.height()}:(s.data("outerWidthOffset")===d&&ub.updateStyleCache(),a!==!1&&(c!==!1&&(p.width=a),b===!1&&(b=q.height(),c=!1),q.width(a),a&&a.toString().indexOf("%")>-1&&(a=q.width()),s.width(a-s.data("outerWidthOffset")),w.width(a-w.data("outerWidthOffset")),g.ios&&u&&u.width(a-s.data("outerWidthOffset")-(u.outerWidth(!0)-u.width()))),b!==!1&&(c!==!1&&(p.height=b),b&&b.toString().indexOf("%")>-1&&(b=q.height(b).height(),q.height("auto")),b-=p.toolbarContainer?0:r.outerHeight(!0),s.height(b-s.data("outerHeightOffset")),w.height(b-e-w.data("outerHeightOffset"))),ub)},ub.updateStyleCache=function(){s.data("outerWidthOffset",s.outerWidth(!0)-s.width()),w.data("outerWidthOffset",w.outerWidth(!0)-w.width()),s.data("outerHeightOffset",s.outerHeight(!0)-s.height()),w.data("outerHeightOffset",w.outerHeight(!0)-w.height())},ub.height=function(a,b){return a||0===a?(ub.dimensions(null,a,b),ub):q.height()},ub.maximize=function(b){return"undefined"==typeof b?q.is(".sceditor-maximize"):(b=!!b,7>m&&a("html, body").toggleClass("sceditor-maximize",b),q.toggleClass("sceditor-maximize",b),ub.width(b?"100%":p.width,!1),ub.height(b?"100%":p.height,!1),ub)},ub.expandToContent=function(a){var b=q.height(),c=b-s.height(),d=u[0].scrollHeight||v[0].documentElement.scrollHeight,e=p.resizeMaxHeight||2*(p.height||wb.height());d+=c,(a===!0||e>=d)&&d>b&&ub.height(d)},ub.destroy=function(){C&&(C.destroy(),B=null,z=null,C=null,l.unbind("click",eb),k.unbind("resize orientationChanged",fb),a(vb.form).unbind("reset",bb).unbind("submit",ub.updateOriginal),u.unbind(),v.unbind().find("*").remove(),w.unbind().remove(),r.remove(),q.unbind().find("*").unbind().remove(),q.remove(),wb.removeData("sceditor").removeData("sceditorbbcode").show(),H&&wb.attr("required","required"))},ub.createDropDown=function(b,c,d,e){var f,g="sceditor-"+c,h=y&&y.is("."+g);ub.closeDropDown(),h||(e!==!1&&a(d).find(":not(input,textarea)").filter(function(){return 1===this.nodeType}).attr("unselectable","on"),f={top:b.offset().top,left:b.offset().left,marginTop:b.outerHeight()},a.extend(f,p.dropDownCss),y=a('<div class="sceditor-dropdown '+g+'" />').css(f).append(d).appendTo(a("body")).on("click focusin",function(a){a.stopPropagation()}),setTimeout(function(){y.find("input,textarea").first().focus()}))},eb=function(a){3!==a.which&&y&&(tb(),ub.closeDropDown())},Y=function(a){var b,c,d,e=u[0],f=v[0],g=0,h=j.createElement("div"),i=f.createDocumentFragment(),k=a?a.clipboardData:!1;if(p.disablePasting)return!1;if(p.enablePasteFiltering){if(B.saveRange(),j.body.appendChild(h),k&&k.getData&&((b=k.getData("text/html"))||(b=k.getData("text/plain"))))return h.innerHTML=b,Z(e,h),!1;for(d=u.scrollTop()||v.scrollTop();e.firstChild;)i.appendChild(e.firstChild);return c=function(a,b){if(a.childNodes.length>0||g>25){for(;a.firstChild;)b.appendChild(a.firstChild);for(;i.firstChild;)a.appendChild(i.firstChild);u.scrollTop(d),v.scrollTop(d),b.childNodes.length>0?Z(a,b):B.restoreRange()}else g++,setTimeout(function(){c(a,b)},20)},c(e,h),ub.focus(),!0}},Z=function(b,c){e.fixNesting(c);var d=c.innerHTML;C.hasHandler("toSource")&&(d=C.callOnlyFirst("toSource",d,a(c))),c.parentNode.removeChild(c),C.hasHandler("toWysiwyg")&&(d=C.callOnlyFirst("toWysiwyg",d,!0)),B.restoreRange(),ub.wysiwygEditorInsertHtml(d,null,!0)},ub.closeDropDown=function(a){y&&(y.unbind().remove(),y=null),a===!0&&ub.focus()},X=function(){return t.contentDocument?t.contentDocument:t.contentWindow&&t.contentWindow.document?t.contentWindow.document:t.document},ub.wysiwygEditorInsertHtml=function(b,c,d){var f,g,h,i=s.height();ub.focus(),(d||!a(E).is("code")&&0===a(E).parents("code").length)&&(B.insertHTML(b,c),B.saveRange(),L(u[0]),f=u.find("#sceditor-end-marker").show(),g=u.scrollTop()||v.scrollTop(),h=e.getOffset(f[0]).top+1.5*f.outerHeight(!0)-i,f.hide(),(h>g||g>h+i)&&(u.scrollTop(h),v.scrollTop(h)),qb(!1),B.restoreRange(),jb())},ub.wysiwygEditorInsertText=function(a,b){ub.wysiwygEditorInsertHtml(f.entities(a),f.entities(b))},ub.insertText=function(a,b){return ub.inSourceMode()?ub.sourceEditorInsertText(a,b):ub.wysiwygEditorInsertText(a,b),ub},ub.sourceEditorInsertText=function(a,b){var c,d,e,f=x.selectionStart,g=x.selectionEnd;d=x.scrollTop,x.focus(),"undefined"!=typeof f?(e=x.value,b&&(a+=e.substring(f,g)+b),x.value=e.substring(0,f)+a+e.substring(g,e.length),x.selectionStart=f+a.length-(b?b.length:0),x.selectionEnd=x.selectionStart):(c=j.selection.createRange(),b&&(a+=c.text+b),c.text=a,b&&c.moveEnd("character",0-b.length),c.moveStart("character",c.End-c.Start),c.select()),x.scrollTop=d,x.focus(),qb()},ub.getRangeHelper=function(){return B},ub.sourceEditorCaret=function(a){var b,c={};return x.focus(),"undefined"!=typeof x.selectionStart?a?(x.selectionStart=a.start,x.selectionEnd=a.end):(c.start=x.selectionStart,c.end=x.selectionEnd):(b=j.selection.createRange(),a?(b.moveEnd("character",a.end),b.moveStart("character",a.start),b.select()):(c.start=b.Start,c.end=b.End)),a?this:c},ub.val=function(a,b){return"string"!=typeof a?ub.inSourceMode()?ub.getSourceEditorValue(!1):ub.getWysiwygEditorValue(b):(ub.inSourceMode()?ub.setSourceEditorValue(a):(b!==!1&&C.hasHandler("toWysiwyg")&&(a=C.callOnlyFirst("toWysiwyg",a)),ub.setWysiwygEditorValue(a)),ub)},ub.insert=function(b,c,d,e,f){if(ub.inSourceMode())return ub.sourceEditorInsertText(b,c),ub;if(c){var g=B.selectedHtml(),h=a("<div>").appendTo(a("body")).hide().html(g);d!==!1&&C.hasHandler("toSource")&&(g=C.callOnlyFirst("toSource",g,h)),h.remove(),b+=g+c}return d!==!1&&C.hasHandler("toWysiwyg")&&(b=C.callOnlyFirst("toWysiwyg",b,!0)),d!==!1&&f===!0&&(b=b.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")),ub.wysiwygEditorInsertHtml(b),ub},ub.getWysiwygEditorValue=function(a){var b,c,d=B.hasSelection();return d?B.saveRange():z&&z.getBookmark&&(c=z.getBookmark()),e.fixNesting(u[0]),b=u.html(),a!==!1&&C.hasHandler("toSource")&&(b=C.callOnlyFirst("toSource",b,u)),d?(B.restoreRange(),z=null):c&&(z.moveToBookmark(c),z=null),b},ub.getBody=function(){return u},ub.getContentAreaContainer=function(){return s},ub.getSourceEditorValue=function(a){var b=w.val();return a!==!1&&C.hasHandler("toWysiwyg")&&(b=C.callOnlyFirst("toWysiwyg",b)),b},ub.setWysiwygEditorValue=function(a){a||(a="<p>"+(m?"":"<br />")+"</p>"),u[0].innerHTML=a,L(u[0]),jb(),qb()},ub.setSourceEditorValue=function(a){w.val(a),qb()},ub.updateOriginal=function(){wb.val(ub.val())},L=function(b){if(p.emoticonsEnabled&&!a(b).parents("code").length){var c=b.ownerDocument,d="\\s| | | | |&nbsp;",g=[],i=[],j=a.extend({},p.emoticons.more,p.emoticons.dropdown,p.emoticons.hidden);a.each(j,function(a){p.emoticonsCompat&&(i[a]=new RegExp("(>|^|"+d+")"+f.regex(a)+"($|<|"+d+")")),g.push(a)});var k=function(b){for(b=b.firstChild;b;){var d,f,l,m,n,o,q,r=b.parentNode,s=b.nodeValue;if(3!==b.nodeType)a(b).is("code")||k(b);else if(s)for(n=g.length;n--;)f=g[n],q=p.emoticonsCompat?s.search(i[f]):s.indexOf(f),q>-1&&(o=b.nextSibling,l=j[f],d=s.substr(q).split(f),s=s.substr(0,q)+d.shift(),b.nodeValue=s,m=e.parseHTML(h("emoticon",{key:f,url:l.url||l,tooltip:l.tooltip||f}),c),r.insertBefore(m[0],o),r.insertBefore(c.createTextNode(d.join(f)),o));b=b.nextSibling}};k(b),p.emoticonsCompat&&(Bb=u.find("img[data-sceditor-emoticon]"))}},ub.inSourceMode=function(){return q.hasClass("sourceMode")},ub.sourceMode=function(a){var b=ub.inSourceMode();return"boolean"!=typeof a?b:((b&&!a||!b&&a)&&ub.toggleSourceMode(),ub)},ub.toggleSourceMode=function(){var a=ub.inSourceMode();(g.isWysiwygSupported||!a)&&(a||(B.saveRange(),B.clear()),ub.blur(),a?ub.setWysiwygEditorValue(ub.getSourceEditorValue()):ub.setSourceEditorValue(ub.getWysiwygEditorValue()),z=null,w.toggle(),s.toggle(),q.toggleClass("wysiwygMode",a).toggleClass("sourceMode",!a),gb(),hb())},ib=function(){return x.focus(),"undefined"!=typeof x.selectionStart?x.value.substring(x.selectionStart,x.selectionEnd):j.selection.createRange().text},M=function(b,c){ub.inSourceMode()?c.txtExec&&(a.isArray(c.txtExec)?ub.sourceEditorInsertText.apply(ub,c.txtExec):c.txtExec.call(ub,b,ib())):c.exec&&(a.isFunction(c.exec)?c.exec.call(ub,b):ub.execCommand(c.exec,c.hasOwnProperty("execParam")?c.execParam:null))},N=function(){m&&(z=B.selectedRange())},ub.execCommand=function(b,c){var d=!1,e=ub.commands[b],f=a(B.parentNode());if(ub.focus(),!f.is("code")&&0===f.parents("code").length){try{d=v[0].execCommand(b,!1,c)}catch(g){}!d&&e&&e.errorMessage&&alert(ub._(e.errorMessage)),hb()}},kb=function(){function b(){B&&!B.compare(F)&&(F=B.cloneSelected(),q.trigger(a.Event("selectionchanged"))),G=!1}G||(G=!0,m?b():setTimeout(b,100))},lb=function(){var b,c=B.parentNode();D!==c&&(b=D,D=c,E=B.getFirstBlockParent(c),q.trigger(a.Event("nodechanged",{oldNode:b,newNode:D})))},ub.currentNode=function(){return D},ub.currentBlockNode=function(){return E},hb=function(a){var b,c,d="active",e=v[0],f=ub.sourceMode();if(ub.readOnly())return void r.find(d).removeClass(d);f||(c=a?a.newNode:B.parentNode(),b=B.getFirstBlockParent(c));for(var g=0;g<zb.length;g++){var h=0,i=Cb[zb[g].name],j=zb[g].state,k=f&&!i.data("sceditor-txtmode")||!f&&!i.data("sceditor-wysiwygmode");if("string"==typeof j){if(!f)try{h=e.queryCommandEnabled(j)?0:-1,h>-1&&(h=e.queryCommandState(j)?1:0)}catch(l){}}else k||(h=j.call(ub,c,b));i.toggleClass("disabled",k||0>h).toggleClass(d,h>0)}},ab=function(b){var c,d,f,g,h="code,blockquote,pre",i="li,ul,ol";return b.originalEvent.defaultPrevented?void 0:(ub.closeDropDown(),c=a(E).closest(h+","+i).first(),13===b.which&&c.length&&!c.is(i)?(z=null,d=v[0].createElement("br"),B.insertNode(d),n||(f=d.parentNode,g=f.lastChild,g&&3===g.nodeType&&""===g.nodeValue&&(f.removeChild(g),g=f.lastChild),!e.isInline(f,!0)&&g===d&&e.isInline(d.previousSibling)&&B.insertHTML("<br>")),!1):void 0)},jb=function(){var b,c,d,f=u[0];e.rTraverse(f,function(g){return b=g.nodeName.toLowerCase(),a.inArray(b,yb)>-1&&(c=!0),3===g.nodeType&&!/^\s*$/.test(g.nodeValue)||"br"===b||n&&!g.firstChild&&!e.isInline(g,!1)?(c&&(d=v[0].createElement("p"),d.className="sceditor-nlf",d.innerHTML=n?"":"<br />",f.appendChild(d)),!1):void 0})},bb=function(){ub.val(wb.val())},cb=function(){ub.closeDropDown(),z=null},fb=function(){var a=p.height,b=p.width;ub.maximize()?ub.dimensions("100%","100%",!1):(a&&a.toString().indexOf("%")>-1||b&&b.toString().indexOf("%")>-1)&&ub.dimensions(b,a)},ub._=function(){var a,b=arguments;return A&&A[b[0]]&&(b[0]=A[b[0]]),b[0].replace(/\{(\d+)\}/g,function(c,d){return b[d-0+1]!==a?b[d-0+1]:"{"+d+"}"})},db=function(b){C.call(b.type+"Event",b,ub);var c=b.target===x?"scesrc":"scewys",d=a.Event(b);d.type=c+b.type,q.trigger(d,ub)},ub.bind=function(b,c,d,e){b=b.split(" ");for(var f=b.length;f--;)a.isFunction(c)&&(d||q.bind("scewys"+b[f],c),e||q.bind("scesrc"+b[f],c),"valuechanged"===b[f]&&(qb.hasHandler=!0));return ub},ub.unbind=function(b,c,d,e){b=b.split(" ");for(var f=b.length;f--;)a.isFunction(c)&&(d||q.unbind("scewys"+b[f],c),e||q.unbind("scesrc"+b[f],c));return ub},ub.blur=function(b,c,d){return a.isFunction(b)?ub.bind("blur",b,c,d):ub.sourceMode()?w.blur():u.blur(),ub},ub.focus=function(b,c,d){if(a.isFunction(b))ub.bind("focus",b,c,d);else if(ub.inSourceMode())x.focus();else{var e,f=B.selectedRange();F||B.hasSelection()||mb(),!n&&f&&1===f.endOffset&&f.collapsed&&(e=f.endContainer,e&&1===e.childNodes.length&&a(e.firstChild).is("br")&&(f.setStartBefore(e.firstChild),f.collapse(!0),B.selectRange(f))),t.contentWindow.focus(),u[0].focus(),z&&(B.selectRange(z),z=null)}return ub},ub.keyDown=function(a,b,c){return ub.bind("keydown",a,b,c)},ub.keyPress=function(a,b,c){return ub.bind("keypress",a,b,c)},ub.keyUp=function(a,b,c){return ub.bind("keyup",a,b,c)},ub.nodeChanged=function(a){return ub.bind("nodechanged",a,!1,!0)},ub.selectionChanged=function(a){return ub.bind("selectionchanged",a,!1,!0)},ub.valueChanged=function(a,b,c){return ub.bind("valuechanged",a,b,c)},nb=function(b){var c,d=0,e=ub.emoticonsCache,f=String.fromCharCode(b.which);return a(E).is("code")||a(E).parents("code").length?void 0:(e||(e=[],a.each(a.extend({},p.emoticons.more,p.emoticons.dropdown,p.emoticons.hidden),function(a,b){e[d++]=[a,h("emoticon",{key:a,url:b.url||b,tooltip:b.tooltip||a})]}),e.sort(function(a,b){return a[0].length-b[0].length}),ub.emoticonsCache=e,ub.longestEmoticonCode=e[e.length-1][0].length),c=B.raplaceKeyword(ub.emoticonsCache,!0,!0,ub.longestEmoticonCode,p.emoticonsCompat,f),c&&p.emoticonsCompat?(Bb=u.find("img[data-sceditor-emoticon]"),/^\s$/.test(f)):!c)},ob=function(){if(Bb.length){var b,c,d,e,f,g,h=ub.currentBlockNode(),i=!1,j=/[^\s\xA0\u2002\u2003\u2009\u00a0]+/;Bb=a.map(Bb,function(k){return k&&k.parentNode?a.contains(h,k)?(b=k.previousSibling,c=k.nextSibling,f=b.nodeValue,null===f&&(f=b.innerText||""),b&&j.test(b.nodeValue.slice(-1))||c&&j.test((c.nodeValue||"")[0])?(d=k.parentNode,e=B.cloneSelected(),g=e.startContainer,f+=a(k).data("sceditor-emoticon"),g===c?i=f.length+e.startOffset:g===h&&h.childNodes[e.startOffset]===c?i=f.length:g===b&&(i=e.startOffset),c&&3===c.nodeType||(c=d.insertBefore(d.ownerDocument.createTextNode(""),c)),c.insertData(0,f),d.removeChild(b),d.removeChild(k),i!==!1&&(e.setStart(c,i),e.collapse(!0),B.selectRange(e)),null):k):k:null})}},ub.emoticons=function(b){return b||b===!1?(p.emoticonsEnabled=b,b?(u.keypress(nb),ub.sourceMode()||(B.saveRange(),L(u[0]),Bb=u.find("img[data-sceditor-emoticon]"),qb(!1),B.restoreRange())):(u.find("img[data-sceditor-emoticon]").replaceWith(function(){return a(this).data("sceditor-emoticon")}),Bb=[],u.unbind("keypress",nb),qb()),ub):p.emoticonsEnabled},ub.css=function(b){return I||(I=a('<style id="#inline" />',v[0]).appendTo(v.find("head"))[0]),"string"!=typeof b?I.styleSheet?I.styleSheet.cssText:I.innerHTML:(I.styleSheet?I.styleSheet.cssText=b:I.innerHTML=b,ub)},$=function(a){var b=[],c={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|","[":"{","]":"}"},d={8:"backspace",9:"tab",13:"enter",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"win",92:"win",93:"select",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},e={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},f=a.which,g=d[f]||String.fromCharCode(f).toLowerCase();return a.ctrlKey&&b.push("ctrl"),a.altKey&&b.push("alt"),a.shiftKey&&(b.push("shift"),e[f]?g=e[f]:c[g]&&(g=c[g])),g&&(16>f||f>18)&&b.push(g),b=b.join("+"),Ab[b]?Ab[b].call(ub):void 0},ub.addShortcut=function(a,b){return a=a.toLowerCase(),Ab[a]="string"==typeof b?function(){return M(Cb[b],ub.commands[b]),!1}:b,ub},ub.removeShortcut=function(a){return delete Ab[a.toLowerCase()],ub},_=function(b){var c,d,e,f,g;if(!p.disableBlockRemove&&8===b.which&&(f=B.selectedRange())&&(i.getSelection?(c=f.startContainer,d=f.startOffset):(c=f.parentElement(),e=v[0].selection.createRange(),e.moveToElementText(c),e.setEndPoint("EndToStart",f),d=e.text.length),0===d&&(g=pb()))){for(;c!==g;){for(;c.previousSibling;)if(c=c.previousSibling,3!==c.nodeType||c.nodeValue)return;if(!(c=c.parentNode))return}if(g&&!a(g).is("body"))return ub.clearBlockFormatting(g),!1}},pb=function(){for(var b=E;!e.hasStyling(b)||e.isInline(b,!0);)if(!(b=b.parentNode)||a(b).is("body"))return;return b},ub.clearBlockFormatting=function(b){return b=b||pb(),!b||a(b).is("body")?ub:(B.saveRange(),b.className="",z=null,a(b).attr("style",""),a(b).is("p,div,td")||e.convertElement(b,"p"),B.restoreRange(),ub)},qb=function(b){if(C&&(C.hasHandler("valuechangedEvent")||qb.hasHandler)){var c,d=ub.sourceMode(),e=!d&&B.hasSelection();b=b!==!1&&!v[0].getElementById("sceditor-start-marker"),sb.timer&&(clearTimeout(sb.timer),sb.timer=!1),e&&b&&B.saveRange(),c=d?w.val():u.html(),c!==qb.lastHtmlValue&&(qb.lastHtmlValue=c,q.trigger(a.Event("valuechanged",{rawValue:d?ub.val():c}))),e&&b&&B.removeMarkers()}},rb=function(){sb.timer&&qb()},sb=function(a){var b=a.which,c=sb.lastChar,d=13===c||32===c,e=8===c||46===c;sb.lastChar=b,13===b||32===b?d?sb.triggerNextChar=!0:qb():8===b||46===b?e?sb.triggerNextChar=!0:qb():sb.triggerNextChar&&(qb(),sb.triggerNextChar=!1),sb.timer&&clearTimeout(sb.timer),sb.timer=setTimeout(function(){qb()},1500)},tb=function(){J||ub.updateOriginal(),J=!1},K()};return o.locale={},o.command={get:function(a){return o.commands[a]||null},set:function(b,c){return b&&c?(c=a.extend(o.commands[b]||{},c),c.remove=function(){o.command.remove(b)},o.commands[b]=c,this):!1},remove:function(a){return o.commands[a]&&delete o.commands[a],this}},o}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b,c){var d;d=function(){"use strict";var a={},b=function(b){var c=this,d=[],e=function(a){return"signal"+a.charAt(0).toUpperCase()+a.slice(1)},f=function(a,c){a=[].slice.call(a);var f,g,h=e(a.shift());for(f=0;f<d.length;f++)if(h in d[f]&&(g=d[f][h].apply(b,a),c))return g};c.call=function(){f(arguments,!1)},c.callOnlyFirst=function(){return f(arguments,!0)},c.hasHandler=function(a){var b=d.length;for(a=e(a);b--;)if(a in d[b])return!0;return!1},c.exists=function(b){return b in a?(b=a[b],"function"==typeof b&&"object"==typeof b.prototype):!1},c.isRegistered=function(b){if(c.exists(b))for(var e=d.length;e--;)if(d[e]instanceof a[b])return!0;return!1},c.register=function(e){return!c.exists(e)||c.isRegistered(e)?!1:(e=new a[e],d.push(e),"init"in e&&e.init.call(b),!0)},c.deregister=function(e){var f,g=d.length,h=!1;if(!c.isRegistered(e))return h;for(;g--;)d[g]instanceof a[e]&&(f=d.splice(g,1)[0],h=!0,"destroy"in f&&f.destroy.call(b));return h},c.destroy=function(){for(var a=d.length;a--;)"destroy"in d[a]&&d[a].destroy.call(b);d=[],b=null}};return b.plugins=a,b}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b,c){var d;d=function(a,b){"use strict";var d=c(1),e=navigator.userAgent;b.ie=function(){var a,b=3,c=document,d=c.createElement("div"),e=d.getElementsByTagName("i");do d.innerHTML="<!--[if gt IE "+ ++b+"]><i></i><![endif]-->";while(e[0]);return c.documentMode&&c.all&&window.atob&&(b=10),4===b&&c.documentMode&&(b=11),b>4?b:a}(),b.ios=/iPhone|iPod|iPad| wosbrowser\//i.test(e),b.isWysiwygSupported=function(){var a,c,f,g=d('<p contenteditable="true">')[0].contentEditable;return g===f&&"inherit"===g?!1:(c=/Opera Mobi|Opera Mini/i.test(e),/Android/i.test(e)&&(c=!0,/Safari/.test(e)&&(a=/Safari\/(\d+)/.exec(e),c=a&&a[1]?a[1]<534:!0)),/ Silk\//i.test(e)&&(a=/AppleWebKit\/(\d+)/.exec(e),c=a&&a[1]?a[1]<534:!0),b.ios&&(c=/OS [0-4](_\d)+ like Mac/i.test(e)),/Firefox/i.test(e)&&(c=!1),/OneBrowser/i.test(e)&&(c=!1),"UCWEB"===navigator.vendor&&(c=!1),!c)}()}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b,c){var d;d=function(a,b){"use strict";var c=/^(?:https?|s?ftp|mailto|spotify|skype|ssh|teamspeak|tel):|(?:\/\/)/i;b.regex=function(a){return a.replace(/([\-.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")},b.entities=function(a,b){if(!a)return a;var c={"&":"&amp;","<":"&lt;",">":"&gt;"," ":" &nbsp;","\r\n":"\n","\r":"\n","\n":"<br />"};return b!==!1&&(c['"']="&#34;",c["'"]="&#39;",c["`"]="&#96;"),a=a.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(a){return c[a]||a})},b.uriScheme=function(a){var b,d=/^[^\/]*:/i,e=window.location;return a&&d.test(a)&&!c.test(a)?(b=e.pathname.split("/"),b.pop(),e.protocol+"//"+e.host+b.join("/")+"/"+a):a}}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b,c){var d;d=function(){"use strict";var a=c(1),b=c(4).ie,d=c(10),e=b&&11>b,f={bold:{exec:"bold",tooltip:"Bold",shortcut:"ctrl+b"},italic:{exec:"italic",tooltip:"Italic",shortcut:"ctrl+i"},underline:{exec:"underline",tooltip:"Underline",shortcut:"ctrl+u"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(b,c,e){for(var f=0,g=b.opts.fonts.split(","),h=a("<div />"),i=function(){return e(a(this).data("font")),b.closeDropDown(!0),!1};f<g.length;f++)h.append(d("fontOpt",{font:g[f]},!0).click(i));b.createDropDown(c,"font-picker",h)},exec:function(a){var b=this;f.font._dropDown(b,a,function(a){b.execCommand("fontname",a)})},tooltip:"Font Name"},size:{_dropDown:function(b,c,e){for(var f=a("<div />"),g=function(c){e(a(this).data("size")),b.closeDropDown(!0),c.preventDefault()},h=1;7>=h;h++)f.append(d("sizeOpt",{size:h},!0).click(g));b.createDropDown(c,"fontsize-picker",f)},exec:function(a){var b=this;f.size._dropDown(b,a,function(a){b.execCommand("fontsize",a)})},tooltip:"Font Size"},color:{_dropDown:function(b,c,d){var e,g,h,i,j={r:255,g:255,b:255},k=a("<div />"),l=b.opts.colors?b.opts.colors.split("|"):new Array(21),m=[],n=f.color;if(!n._htmlCache){for(e=0;e<l.length;++e){for(i=l[e]?l[e].split(","):new Array(21),m.push('<div class="sceditor-color-column">'),g=0;g<i.length;++g)h=i[g]||"#"+j.r.toString(16)+j.g.toString(16)+j.b.toString(16),m.push('<a href="#" class="sceditor-color-option" style="background-color: '+h+'" data-color="'+h+'"></a>'),g%5===0?(j.g-=51,j.b=255):j.b-=51;m.push("</div>"),e%5===0?(j.r-=51,j.g=255,j.b=255):(j.g=255,j.b=255)}n._htmlCache=m.join("")}k.append(n._htmlCache).find("a").click(function(c){d(a(this).attr("data-color")),b.closeDropDown(!0),c.preventDefault()}),b.createDropDown(c,"color-picker",k)},exec:function(a){var b=this;f.color._dropDown(b,a,function(a){b.execCommand("forecolor",a)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(a){var b,c,e=this;c=d("pastetext",{label:e._("Paste your text inside the following box:"),insert:e._("Insert")},!0),c.find(".button").click(function(a){b=c.find("#txt").val(),b&&e.wysiwygEditorInsertText(b),e.closeDropDown(!0),a.preventDefault()}),e.createDropDown(a,"pastetext",c)},tooltip:"Paste Text"},bulletlist:{exec:"insertunorderedlist",tooltip:"Bullet list"},orderedlist:{exec:"insertorderedlist",tooltip:"Numbered list"},indent:{state:function(b,c){var d,e,f,g=a(c),h=g.parents("ul,ol,menu"),i=h.first();if(h.length>1||i.children().length>1)return 0;if(g.is("ul,ol,menu")){if(d=this.getRangeHelper().selectedRange(),!(window.Range&&d instanceof Range))return g.is("li,ul,ol,menu")?0:-1;if(e=d.startContainer.parentNode,f=d.endContainer.parentNode,e!==e.parentNode.firstElementChild||a(f).is("li")&&f!==f.parentNode.lastElementChild)return 0}return-1},exec:function(){var b=this,c=a(b.getRangeHelper().getFirstBlockParent());b.focus(),c.parents("ul,ol,menu")&&b.execCommand("indent")},tooltip:"Add indent"},outdent:{state:function(b,c){return a(c).is("ul,ol,menu")||a(c).parents("ul,ol,menu").length>0?0:-1},exec:function(){var b=this,c=a(b.getRangeHelper().getFirstBlockParent());c.parents("ul,ol,menu")&&b.execCommand("outdent")},tooltip:"Remove one indent"},table:{forceNewLineAfter:["table"],exec:function(a){var b=this,c=d("table",{rows:b._("Rows:"),cols:b._("Cols:"),insert:b._("Insert")},!0);c.find(".button").click(function(a){var d,f,g=c.find("#rows").val()-0,h=c.find("#cols").val()-0,i="<table>";if(!(1>g||1>h)){for(d=0;g>d;d++){for(i+="<tr>",f=0;h>f;f++)i+="<td>"+(e?"":"<br />")+"</td>";i+="</tr>"}i+="</table>",b.wysiwygEditorInsertHtml(i),b.closeDropDown(!0),a.preventDefault()}}),b.createDropDown(a,"inserttable",c)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{forceNewLineAfter:["code"],exec:function(){this.wysiwygEditorInsertHtml("<code>",(e?"":"<br />")+"</code>")},tooltip:"Code"},image:{exec:function(a){var b=this,c=d("image",{url:b._("URL:"),width:b._("Width (optional):"),height:b._("Height (optional):"),insert:b._("Insert")},!0);
c.find(".button").click(function(a){var d=c.find("#image").val(),e=c.find("#width").val(),f=c.find("#height").val(),g="";e&&(g+=' width="'+e+'"'),f&&(g+=' height="'+f+'"'),d&&b.wysiwygEditorInsertHtml("<img"+g+' src="'+d+'" />'),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertimage",c)},tooltip:"Insert an image"},email:{exec:function(a){var b=this,c=d("email",{label:b._("E-mail:"),desc:b._("Description (optional):"),insert:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#email").val(),e=c.find("#des").val();d&&(b.focus(),!b.getRangeHelper().selectedHtml()||e?(e=e||d,b.wysiwygEditorInsertHtml('<a href="mailto:'+d+'">'+e+"</a>")):b.execCommand("createlink","mailto:"+d)),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertemail",c)},tooltip:"Insert an email"},link:{exec:function(a){var b=this,c=d("link",{url:b._("URL:"),desc:b._("Description (optional):"),ins:b._("Insert")},!0);c.find(".button").click(function(a){var d=c.find("#link").val(),e=c.find("#des").val();d&&(b.focus(),!b.getRangeHelper().selectedHtml()||e?(e=e||d,b.wysiwygEditorInsertHtml('<a href="'+d+'">'+e+"</a>")):b.execCommand("createlink",d)),b.closeDropDown(!0),a.preventDefault()}),b.createDropDown(a,"insertlink",c)},tooltip:"Insert a link"},unlink:{state:function(){var b=a(this.currentNode());return b.is("a")||b.parents("a").length>0?0:-1},exec:function(){var b=a(this.currentNode()),c=b.is("a")?b:b.parents("a").first();c.length&&c.replaceWith(c.contents())},tooltip:"Unlink"},quote:{forceNewLineAfter:["blockquote"],exec:function(a,b,c){var d="<blockquote>",f="</blockquote>";b?(c=c?"<cite>"+c+"</cite>":"",d=d+c+b+f,f=null):""===this.getRangeHelper().selectedHtml()&&(f=(e?"":"<br />")+f),this.wysiwygEditorInsertHtml(d,f)},tooltip:"Insert a Quote"},emoticon:{exec:function(b){var c=this,d=function(e){var f,g=c.opts.emoticonsCompat,h=c.getRangeHelper(),i=g&&" "!==h.getOuterText(!0,1)?" ":"",j=g&&" "!==h.getOuterText(!1,1)?" ":"",k=a("<div />"),l=a("<div />").appendTo(k),m=0,n=a.extend({},c.opts.emoticons.dropdown,e?c.opts.emoticons.more:{});return a.each(n,function(){m++}),m=Math.sqrt(m),a.each(n,function(b,d){l.append(a("<img />").attr({src:d.url||d,alt:b,title:d.tooltip||b}).click(function(){return c.insert(i+a(this).attr("alt")+j,null,!1).closeDropDown(!0),!1})),l.children().length>=m&&(l=a("<div />").appendTo(k))}),e||(f=a('<a class="sceditor-more">'+c._("More")+"</a>").click(function(){return c.createDropDown(b,"more-emoticons",d(!0)),!1}),k.append(f)),k};c.createDropDown(b,"emoticons",d(!1))},txtExec:function(a){f.emoticon.exec.call(this,a)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(a,b,c){var e,f=d("youtubeMenu",{label:a._("Video URL:"),insert:a._("Insert")},!0);f.find(".button").click(function(b){var d=f.find("#link").val();d&&(e=d.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),e&&(d=e[1]),/^[a-zA-Z0-9_\-]{11}$/.test(d)?c(d):alert("Invalid YouTube video")),a.closeDropDown(!0),b.preventDefault()}),a.createDropDown(b,"insertlink",f)},exec:function(a){var b=this;f.youtube._dropDown(b,a,function(a){b.wysiwygEditorInsertHtml(d("youtube",{id:a}))})},tooltip:"Insert a YouTube video"},date:{_date:function(a){var b=new Date,c=b.getYear(),d=b.getMonth()+1,e=b.getDate();return 2e3>c&&(c=1900+c),10>d&&(d="0"+d),10>e&&(e="0"+e),a.opts.dateFormat.replace(/year/i,c).replace(/month/i,d).replace(/day/i,e)},exec:function(){this.insertText(f.date._date(this))},txtExec:function(){this.insertText(f.date._date(this))},tooltip:"Insert current date"},time:{_time:function(){var a=new Date,b=a.getHours(),c=a.getMinutes(),d=a.getSeconds();return 10>b&&(b="0"+b),10>c&&(c="0"+c),10>d&&(d="0"+d),b+":"+c+":"+d},exec:function(){this.insertText(f.time._time())},txtExec:function(){this.insertText(f.time._time())},tooltip:"Insert current time"},ltr:{state:function(a,b){return b&&"ltr"===b.style.direction},exec:function(){var b=this,c=b.getRangeHelper().getFirstBlockParent(),d=a(c);b.focus(),(c&&!d.is("body")||(b.execCommand("formatBlock","p"),c=b.getRangeHelper().getFirstBlockParent(),d=a(c),c&&!d.is("body")))&&("ltr"===d.css("direction")?d.css("direction",""):d.css("direction","ltr"))},tooltip:"Left-to-Right"},rtl:{state:function(a,b){return b&&"rtl"===b.style.direction},exec:function(){var b=this,c=b.getRangeHelper().getFirstBlockParent(),d=a(c);b.focus(),(c&&!d.is("body")||(b.execCommand("formatBlock","p"),c=b.getRangeHelper().getFirstBlockParent(),d=a(c),c&&!d.is("body")))&&("rtl"===d.css("direction")?d.css("direction",""):d.css("direction","rtl"))},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize",shortcut:"ctrl+shift+m"},source:{state:function(){return this.sourceMode()},exec:function(){this.toggleSourceMode()},txtExec:function(){this.toggleSourceMode()},tooltip:"View source",shortcut:"ctrl+shift+s"},ignore:{}};return f}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b,c){var d;d=function(){"use strict";var a=c(1);return{toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|cut,copy,paste,pastetext|bulletlist,orderedlist,indent,outdent|table|code,quote|horizontalrule,image,email,link,unlink|emoticon,youtube,date,time|ltr,rtl|print,maximize,source",toolbarExclude:null,style:"jquery.sceditor.default.css",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Georgia,Impact,Sans-serif,Serif,Times New Roman,Trebuchet MS,Verdana",colors:null,locale:a("html").attr("lang")||"en",charset:"utf-8",emoticonsCompat:!1,emoticonsEnabled:!0,emoticonsRoot:"",emoticons:{dropdown:{":)":"emoticons/smile.png",":angel:":"emoticons/angel.png",":angry:":"emoticons/angry.png","8-)":"emoticons/cool.png",":'(":"emoticons/cwy.png",":ermm:":"emoticons/ermm.png",":D":"emoticons/grin.png","<3":"emoticons/heart.png",":(":"emoticons/sad.png",":O":"emoticons/shocked.png",":P":"emoticons/tongue.png",";)":"emoticons/wink.png"},more:{":alien:":"emoticons/alien.png",":blink:":"emoticons/blink.png",":blush:":"emoticons/blush.png",":cheerful:":"emoticons/cheerful.png",":devil:":"emoticons/devil.png",":dizzy:":"emoticons/dizzy.png",":getlost:":"emoticons/getlost.png",":happy:":"emoticons/happy.png",":kissing:":"emoticons/kissing.png",":ninja:":"emoticons/ninja.png",":pinch:":"emoticons/pinch.png",":pouty:":"emoticons/pouty.png",":sick:":"emoticons/sick.png",":sideways:":"emoticons/sideways.png",":silly:":"emoticons/silly.png",":sleeping:":"emoticons/sleeping.png",":unsure:":"emoticons/unsure.png",":woot:":"emoticons/w00t.png",":wassat:":"emoticons/wassat.png"},hidden:{":whistling:":"emoticons/whistling.png",":love:":"emoticons/wub.png"}},width:null,height:null,resizeEnabled:!0,resizeMinWidth:null,resizeMinHeight:null,resizeMaxHeight:null,resizeMaxWidth:null,resizeHeight:!0,resizeWidth:!0,dateFormat:"year-month-day",toolbarContainer:null,enablePasteFiltering:!1,disablePasting:!1,readOnly:!1,rtl:!1,autofocus:!1,autofocusEnd:!0,autoExpand:!1,autoUpdate:!1,spellcheck:!0,runWithoutWysiwygSupport:!1,id:null,plugins:"",zIndex:null,bbcodeTrim:!1,disableBlockRemove:!1,parserOptions:{},dropDownCss:{}}}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b,c){var d;d=function(){"use strict";var a=c(1),b=c(9),d=c(5),e=c(4),f=e.ie,g=f&&11>f,h=function(b){return a("<p>",b.ownerDocument).append(b).html()},i=function(c,e){var i,j,k,l=e||c.contentDocument||c.document,m=c,n=!!c.getSelection,o="sceditor-start-marker",p="sceditor-end-marker",q="character",r=this;r.insertHTML=function(a,b){var c,d,e=r.selectedRange();if(!e)return!1;if(n){for(b&&(a+=r.selectedHtml()+b),d=l.createElement("p"),c=l.createDocumentFragment(),d.innerHTML=a;d.firstChild;)c.appendChild(d.firstChild);r.insertNode(c)}else e.pasteHTML(k(a,b,!0)),r.restoreRange()},k=function(c,d,e){var g,h,j=l.createElement("div"),k=a(j);if("string"==typeof c?(d&&(c+=r.selectedHtml()+d),k.html(c)):(k.append(c),d&&k.append(r.selectedRange().extractContents()).append(d)),g=j.lastChild){for(;!b.isInline(g.lastChild,!0);)g=g.lastChild;return b.canHaveChildren(g)&&(h=a(g),g.lastChild||h.append("​")),f&&9>f&&a(g).is("img")&&k.append("​"),r.removeMarkers(),(h||k).append(i(o)).append(i(p)),e?k.html():a(l.createDocumentFragment()).append(k.contents())[0]}},r.insertNode=function(a,c){if(n){var d=k(a,c),e=r.selectedRange(),f=e.commonAncestorContainer;if(!d)return!1;e.deleteContents(),f&&3!==f.nodeType&&!b.canHaveChildren(f)?f.parentNode.insertBefore(d,f):e.insertNode(d),r.restoreRange()}else r.insertHTML(h(a),c?h(c):null)},r.cloneSelected=function(){var a=r.selectedRange();return a?n?a.cloneRange():a.duplicate():void 0},r.selectedRange=function(){var a,b,c=n?m.getSelection():l.selection;if(c){if(c.getRangeAt&&c.rangeCount<=0){for(b=l.body;b.firstChild;)b=b.firstChild;a=l.createRange(),a.setStart(b,0),c.addRange(a)}return n&&(a=c.getRangeAt(0)),n||"Control"===c.type||(a=c.createRange()),j(a)?a:null}},j=function(a){var b;return a&&!n&&(b=a.parentElement()),b?b.ownerDocument===l:!0},r.hasSelection=function(){var a=n?m.getSelection():l.selection;return n||!a?a&&a.rangeCount>0:"None"!==a.type&&j(a.createRange())},r.selectedHtml=function(){var a,b=r.selectedRange();if(b){if(n)return a=l.createElement("p"),a.appendChild(b.cloneContents()),a.innerHTML;if(""!==b.text&&b.htmlText)return b.htmlText}return""},r.parentNode=function(){var a=r.selectedRange();return a?a.parentElement?a.parentElement():a.commonAncestorContainer:void 0},r.getFirstBlockParent=function(a){var c=function(a){return b.isInline(a,!0)?(a=a?a.parentNode:null,a?c(a):a):a};return c(a||r.parentNode())},r.insertNodeAt=function(a,b){var c=r.selectedRange(),d=r.cloneSelected();return d?(d.collapse(a),n?d.insertNode(b):d.pasteHTML(h(b)),void r.selectRange(c)):!1},i=function(a){r.removeMarker(a);var b=l.createElement("span");return b.id=a,b.style.lineHeight="0",b.style.display="none",b.className="sceditor-selection sceditor-ignore",b.innerHTML=" ",b},r.insertMarkers=function(){r.insertNodeAt(!0,i(o)),r.insertNodeAt(!1,i(p))},r.getMarker=function(a){return l.getElementById(a)},r.removeMarker=function(a){var b=r.getMarker(a);b&&b.parentNode.removeChild(b)},r.removeMarkers=function(){r.removeMarker(o),r.removeMarker(p)},r.saveRange=function(){r.insertMarkers()},r.selectRange=function(c){if(n){var d,e=m.getSelection(),f=c.endContainer;if(!g&&c.collapsed&&f&&!b.isInline(f,!0)){for(d=f.lastChild;d&&a(d).is(".sceditor-ignore");)d=d.previousSibling;if(a(d).is("br")){var h=l.createRange();h.setEndAfter(d),h.collapse(!1),r.compare(c,h)&&(c.setStartBefore(d),c.collapse(!0))}}e&&(r.clear(),e.addRange(c))}else c.select()},r.restoreRange=function(){var c,d,e,f=r.selectedRange(),g=r.getMarker(o),h=r.getMarker(p);return g&&h&&f?(d=g.nextSibling===h,n?(f=l.createRange(),f.setStartBefore(g),f.setEndAfter(h)):(f=l.body.createTextRange(),c=l.body.createTextRange(),e=g.previousSibling,g.nextSibling!==h||e&&b.isInline(e,!0)&&!a(e).is("br")||a(g).before("​"),c.moveToElementText(g),f.setEndPoint("StartToStart",c),f.moveStart(q,0),c.moveToElementText(h),f.setEndPoint("EndToStart",c),f.moveEnd(q,0)),d&&f.collapse(!0),r.selectRange(f),void r.removeMarkers()):!1},r.selectOuterText=function(a,b){var c=r.cloneSelected();return c?(c.collapse(!1),n?(c.setStart(c.startContainer,c.startOffset-a),c.setEnd(c.endContainer,c.endOffset+b)):(c.moveStart(q,0-a),c.moveEnd(q,b)),void r.selectRange(c)):!1},r.getOuterText=function(a,b){var c,d,e="",f=r.cloneSelected();return f?(f.collapse(!a),n?(c=f.startContainer.textContent,d=f.startOffset,a&&(d-=b,0>d&&(b+=d,d=0)),e=c.substr(d,b)):(a?f.moveStart(q,0-b):f.moveEnd(q,b),e=f.text),e):""},r.raplaceKeyword=function(a,b,c,e,f,g){c||a.sort(function(a,b){return a[0].length-b[0].length});var h,i,j,k,l,m,o,p,q="[\\s    ]",s=a.length,t=e||a[s-1][0].length;if(f){if(!n)return!1;t++}for(g=g||"",h=r.getOuterText(!0,t),l=h.length,i=h+g,b&&(i+=r.getOuterText(!1,t));s--;)if(o=a[s][0],p=o.length,k=l-1-p,j=f?i.substr(Math.max(0,k-1)).search(new RegExp("(?:"+q+")"+d.regex(o)+"(?="+q+")")):i.indexOf(o,k),j>-1){if(f&&(j+=k+1),j>l||l>j+p+(f?1:0))continue;return m=l-j,r.selectOuterText(m,p-m-(/^\S/.test(g)?1:0)),r.insertHTML(a[s][1]),!0}return!1},r.compare=function(a,b){var c=n?Range.END_TO_END:"EndToEnd",d=n?Range.START_TO_START:"StartToStart",e=n?"compareBoundaryPoints":"compareEndPoints";return b||(b=r.selectedRange()),a&&b?j(a)&&j(b)&&0===a[e](c,b)&&0===a[e](d,b):!a&&!b},r.clear=function(){var a=n?m.getSelection():l.selection;a&&(a.removeAllRanges?a.removeAllRanges():a.empty&&a.empty())}};return i}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b,c){var d;d=function(){"use strict";var a=c(1),b=c(4),d={},e={traverse:function(a,b,c,d,f){if(a)for(a=f?a.lastChild:a.firstChild;a;){var g=f?a.previousSibling:a.nextSibling;if(!c&&b(a)===!1||!d&&e.traverse(a,b,c,d,f)===!1||c&&b(a)===!1)return!1;a=g}},rTraverse:function(a,b,c,d){this.traverse(a,b,c,d,!0)},parseHTML:function(b,c){var d=[],e=(c||document).createElement("div");return e.innerHTML=b,a.merge(d,e.childNodes),d},hasStyling:function(b){var c=a(b);return b&&(!c.is("p,div")||b.className||c.attr("style")||!a.isEmptyObject(c.data()))},convertElement:function(a,c){for(var d,f,g=a.attributes,h=g.length,i=a.ownerDocument.createElement(c);h--;)f=g[h],(!b.ie||f.specified)&&(b.ie<8&&/style/i.test(f.name)?e.copyCSS(a,i):i.setAttribute(f.name,f.value));for(;d=a.firstChild;)i.appendChild(d);return a.parentNode.replaceChild(i,a),i},blockLevelList:"|body|hr|p|div|h1|h2|h3|h4|h5|h6|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|blockquote|center|",canHaveChildren:function(a){return/11?|9/.test(a.nodeType)?"|iframe|area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param|command|embed|keygen|source|track|wbr|".indexOf("|"+a.nodeName.toLowerCase()+"|")<0:!1},isInline:function(a,b){var c,d=(a||{}).nodeType||3;return 1!==d?3===d:(c=a.tagName.toLowerCase(),"code"===c?!b:e.blockLevelList.indexOf("|"+c+"|")<0)},copyCSS:function(a,b){b.style.cssText=a.style.cssText+b.style.cssText},fixNesting:function(a){var b=function(a){for(;e.isInline(a.parentNode,!0);)a=a.parentNode;return a};e.traverse(a,function(a){if(1===a.nodeType&&!e.isInline(a,!0)&&e.isInline(a.parentNode,!0)){var c=b(a),d=c.parentNode,f=e.extractContents(c,a),g=a;e.copyCSS(c,g),d.insertBefore(f,c),d.insertBefore(g,c)}})},findCommonAncestor:function(b,c){return a(b).parents().has(a(c)).first()},getSibling:function(a,b){return a?(b?a.previousSibling:a.nextSibling)||e.getSibling(a.parentNode,b):null},removeWhiteSpace:function(b,c){for(var d,f,g,h,i,j,k,l,m=e.getSibling,n=e.isInline,o=b.firstChild;o;){if(k=o.nextSibling,d=o.nodeValue,f=o.nodeType,1===f&&o.firstChild&&(j=a(o).css("whiteSpace"),/pre(\-wrap)?$/i.test(j)||e.removeWhiteSpace(o,/line$/i.test(j))),3===f&&d){for(g=m(o),h=m(o,!0),l=!1;a(h).hasClass("sceditor-ignore");)h=m(h,!0);if(n(o)&&h){for(i=h;i.lastChild;)i=i.lastChild;l=3===i.nodeType?/[\t\n\r ]$/.test(i.nodeValue):!n(i)}d=d.replace(/\u200B/g,""),h&&n(h)&&!l||(d=d.replace(c?/^[\t ]+/:/^[\t\n\r ]+/,"")),g&&n(g)||(d=d.replace(c?/[\t ]+$/:/[\t\n\r ]+$/,"")),d.length?o.nodeValue=d.replace(c?/[\t ]+/g:/[\t\n\r ]+/g," "):b.removeChild(o)}o=k}},extractContents:function(b,c){var d,f=e.findCommonAncestor(b,c).get(0),g=!1,h=!1;return(d=function(f){var i,j=b.ownerDocument.createDocumentFragment();return e.traverse(f,function(e){return h||e===c?(h=!0,!1):(e===b&&(g=!0),void(a.contains(e,b)||g&&a.contains(e,c)?(i=e.cloneNode(!1),i.appendChild(d(e)),j.appendChild(i)):g&&!a.contains(j,e)&&j.appendChild(e)))},!1),j})(f)},getOffset:function(a){for(var b=0,c=0;a;)b+=a.offsetLeft,c+=a.offsetTop,a=a.offsetParent;return{left:b,top:c}},getStyle:function(b,c){var e,f,g,h=b.style;if(!h)return"";if(d[c]||(d[c]=a.camelCase(c)),c=d[c],g=h[c],"textAlign"===c){if(e=a(b),f=h.direction,g=g||e.css(c),e.parent().css(c)===g||"block"!==e.css("display")||e.is("hr")||e.is("th"))return"";if(f&&g&&(/right/i.test(g)&&"rtl"===f||/left/i.test(g)&&"ltr"===f))return""}return g},hasStyle:function(b,c,d){var f=e.getStyle(b,c);return f?!d||f===d||a.isArray(d)&&a.inArray(f,d)>-1:!1}};return e}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))},function(a,b,c){var d;d=function(){"use strict";var a={html:'<!DOCTYPE html><html{attrs}><head><style>.ie * {min-height: auto !important} .ie table td {height:15px}</style><meta http-equiv="Content-Type" content="text/html;charset={charset}" /><link rel="stylesheet" type="text/css" href="{style}" /></head><body contenteditable="true" {spellcheck}><p></p></body></html>',toolbarButton:'<a class="sceditor-button sceditor-button-{name}" data-sceditor-command="{name}" unselectable="on"><div unselectable="on">{dispName}</div></a>',emoticon:'<img src="{url}" data-sceditor-emoticon="{key}" alt="{key}" title="{tooltip}" />',fontOpt:'<a class="sceditor-font-option" href="#" data-font="{font}"><font face="{font}">{font}</font></a>',sizeOpt:'<a class="sceditor-fontsize-option" data-size="{size}" href="#"><font size="{size}">{size}</font></a>',pastetext:'<div><label for="txt">{label}</label> <textarea cols="20" rows="7" id="txt"></textarea></div><div><input type="button" class="button" value="{insert}" /></div>',table:'<div><label for="rows">{rows}</label><input type="text" id="rows" value="2" /></div><div><label for="cols">{cols}</label><input type="text" id="cols" value="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',image:'<div><label for="link">{url}</label> <input type="text" id="image" placeholder="http://" /></div><div><label for="width">{width}</label> <input type="text" id="width" size="2" /></div><div><label for="height">{height}</label> <input type="text" id="height" size="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',email:'<div><label for="email">{label}</label> <input type="text" id="email" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{insert}" /></div>',link:'<div><label for="link">{url}</label> <input type="text" id="link" placeholder="http://" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{ins}" /></div>',youtubeMenu:'<div><label for="link">{label}</label> <input type="text" id="link" placeholder="http://" /></div><div><input type="button" class="button" value="{insert}" /></div>',youtube:'<iframe width="560" height="315" src="http://www.youtube.com/embed/{id}?wmode=opaque" data-youtube-id="{id}" frameborder="0" allowfullscreen></iframe>'};return function(b,c,d){var e=a[b];return $.each(c,function(a,b){e=e.replace(new RegExp("\\{"+a+"\\}","g"),b)}),d&&(e=$(e)),e}}.call(b,c,b,a),!(void 0!==d&&(a.exports=d))}]),function(a,b,c){"use strict";var d=a.sceditor,e=d.plugins,f=d.escapeEntities,g=d.escapeUriScheme,h=d.ie,i=h&&11>h,j=d.command.get,k={bold:{txtExec:["[b]","[/b]"]},italic:{txtExec:["[i]","[/i]"]},underline:{txtExec:["[u]","[/u]"]},strike:{txtExec:["[s]","[/s]"]},subscript:{txtExec:["[sub]","[/sub]"]},superscript:{txtExec:["[sup]","[/sup]"]},left:{txtExec:["[left]","[/left]"]},center:{txtExec:["[center]","[/center]"]},right:{txtExec:["[right]","[/right]"]},justify:{txtExec:["[justify]","[/justify]"]},font:{txtExec:function(a){var b=this;j("font")._dropDown(b,a,function(a){b.insertText("[font="+a+"]","[/font]")})}},size:{txtExec:function(a){var b=this;j("size")._dropDown(b,a,function(a){b.insertText("[size="+a+"]","[/size]")})}},color:{txtExec:function(a){var b=this;j("color")._dropDown(b,a,function(a){b.insertText("[color="+a+"]","[/color]")})}},bulletlist:{txtExec:function(b,c){var d="";a.each(c.split(/\r?\n/),function(){d+=(d?"\n":"")+"[li]"+this+"[/li]"}),this.insertText("[ul]\n"+d+"\n[/ul]")}},orderedlist:{txtExec:function(b,c){var d="";a.each(c.split(/\r?\n/),function(){d+=(d?"\n":"")+"[li]"+this+"[/li]"}),e.bbcode.bbcode.get(""),this.insertText("[ol]\n"+d+"\n[/ol]")}},table:{txtExec:["[table][tr][td]","[/td][/tr][/table]"]},horizontalrule:{txtExec:["[hr]"]},code:{txtExec:["[code]","[/code]"]},image:{txtExec:function(a,b){var c=this,d=prompt(c._("Enter the image URL:"),b);d&&c.insertText("[img]"+d+"[/img]")}},email:{txtExec:function(a,b){var c=this,d=b&&b.indexOf("@")>-1?null:b,e=prompt(c._("Enter the e-mail address:"),d?"":b),f=prompt(c._("Enter the displayed text:"),d||e)||e;e&&c.insertText("[email="+e+"]"+f+"[/email]")}},link:{txtExec:function(b,c){var d=this,e=/^[a-z]+:\/\//i.test(a.trim(c))?null:c,f=prompt(d._("Enter URL:"),e?"http://":a.trim(c)),g=prompt(d._("Enter the displayed text:"),e||f)||f;f&&d.insertText("[url="+f+"]"+g+"[/url]")}},quote:{txtExec:["[quote]","[/quote]"]},youtube:{txtExec:function(a){var b=this;j("youtube")._dropDown(b,a,function(a){b.insertText("[youtube]"+a+"[/youtube]")})}},rtl:{txtExec:["[rtl]","[/rtl]"]},ltr:{txtExec:["[ltr]","[/ltr]"]}},l=function(a){return a?a.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2"):a},m=function(){var a,b=arguments;return b[0].replace(/\{(\d+)\}/g,function(c,d){return b[d-0+1]!==a?b[d-0+1]:"{"+d+"}"})},n={OPEN:"open",CONTENT:"content",NEWLINE:"newline",CLOSE:"close"},o=function(a,b,c,d,e,f){var g=this;g.type=a,g.name=b,g.val=c,g.attrs=d||{},g.children=e||[],g.closing=f||null};o.prototype={clone:function(a){var b=this;return new o(b.type,b.name,b.val,b.attrs,a?b.children:[],b.closing?b.closing.clone():null)},splitAt:function(b){var c,d=this,e=0,f=d.children.length;if("number"!=typeof b&&(b=a.inArray(b,d.children)),0>b||b>f)return null;for(;f--;)f>=b?e++:f=0;return c=d.clone(),c.children=d.children.splice(b,e),c}};var p=function(b){if(!(this instanceof p))return new p(b);var d,g,j,k,m,q,r,s,t,u,v,w,x,y,z,A=this;d=function(){A.bbcodes=e.bbcode.bbcodes,A.opts=a.extend({},p.defaults,b)},A.tokenize=function(a){var b,c,d,e=[],f=[{type:n.CLOSE,regex:/^\[\/[^\[\]]+\]/},{type:n.OPEN,regex:/^\[[^\[\]]+\]/},{type:n.NEWLINE,regex:/^(\r\n|\r|\n)/},{type:n.CONTENT,regex:/^([^\[\r\n]+|\[)/}];f.reverse();a:for(;a.length;){for(d=f.length;d--;)if(c=f[d].type,(b=a.match(f[d].regex))&&b[0]){e.push(g(c,b[0])),a=a.substr(b[0].length);continue a}a.length&&e.push(g(n.CONTENT,a)),a=""}return e},g=function(b,c){var d,f,g,h=/\[([^\]\s=]+)(?:([^\]]+))?\]/,i=/\[\/([^\[\]]+)\]/;return b===n.OPEN&&(d=c.match(h))&&(g=y(d[1]),d[2]&&(d[2]=a.trim(d[2]))&&(f=j(d[2]))),b===n.CLOSE&&(d=c.match(i))&&(g=y(d[1])),b===n.NEWLINE&&(g="#newline"),g&&(b!==n.OPEN&&b!==n.CLOSE||e.bbcode.bbcodes[g])||(b=n.CONTENT,g="#"),new o(b,g,c,f)},j=function(a){var b,c=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,d={};if("="===a.charAt(0)&&a.indexOf("=",1)<0)d.defaultattr=l(a.substr(1));else for("="===a.charAt(0)&&(a="defaultattr"+a);b=c.exec(a);)d[y(b[1])]=l(b[3])||b[4];return d},A.parse=function(a,b){var c=k(A.tokenize(a)),d=A.opts;return d.fixInvalidChildren&&t(c),d.removeEmptyTags&&s(c),d.fixInvalidNesting&&q(c),m(c,null,b),d.removeEmptyTags&&s(c),c},w=function(a,b,c){for(var d=c.length;d--;)if(c[d].type===b&&c[d].name===a)return!0;return!1},r=function(b,c){var d=b?A.bbcodes[b.name]:{},e=d.allowedChildren;return A.opts.fixInvalidChildren&&e?a.inArray(c.name||"#",e)>-1:!0},k=function(b){for(var c,d,e,f,g,h,i,j=[],k=[],l=[],m=function(){return z(l)},o=function(a){m()?m().children.push(a):k.push(a)},p=function(b){return m()&&(d=A.bbcodes[m().name])&&d.closedBy&&a.inArray(b,d.closedBy)>-1};c=b.shift();){switch(i=b[0],c.type){case n.OPEN:p(c.name)&&l.pop(),o(c),d=A.bbcodes[c.name],d&&d.isSelfClosing||!d.closedBy&&!w(c.name,n.CLOSE,b)?d&&d.isSelfClosing||(c.type=n.CONTENT):l.push(c);break;case n.CLOSE:if(m()&&c.name!==m().name&&p("/"+c.name)&&l.pop(),m()&&c.name===m().name)m().closing=c,l.pop();else if(w(c.name,n.OPEN,l)){for(;e=l.pop();){if(e.name===c.name){e.closing=c;break}f=e.clone(),j.length>1&&f.children.push(z(j)),j.push(f)}for(o(z(j)),g=j.length;g--;)l.push(j[g]);j.length=0}else c.type=n.CONTENT,o(c);break;case n.NEWLINE:m()&&i&&p((i.type===n.CLOSE?"/":"")+i.name)&&(i.type!==n.CLOSE||i.name!==m().name)&&(d=A.bbcodes[m().name],d&&d.breakAfter?l.pop():d&&d.isInline===!1&&A.opts.breakAfterBlock&&d.breakAfter!==!1&&l.pop()),o(c);break;default:o(c)}h=c}return k},m=function(a,b,c){var d,e,f,g,h,i,j,k,l=a.length;b&&(g=A.bbcodes[b.name]);for(var o=l;o--;)if(d=a[o])if(d.type===n.NEWLINE){if(e=o>0?a[o-1]:null,f=l-1>o?a[o+1]:null,k=!1,!c&&g&&g.isSelfClosing!==!0&&(e?i||f||(g.isInline===!1&&A.opts.breakEndBlock&&g.breakEnd!==!1&&(k=!0),g.breakEnd&&(k=!0),i=k):(g.isInline===!1&&A.opts.breakStartBlock&&g.breakStart!==!1&&(k=!0),g.breakStart&&(k=!0))),e&&e.type===n.OPEN&&(h=A.bbcodes[e.name])&&(c?h.isInline===!1&&(k=!0):(h.isInline===!1&&A.opts.breakAfterBlock&&h.breakAfter!==!1&&(k=!0),h.breakAfter&&(k=!0))),!c&&!j&&f&&f.type===n.OPEN&&(h=A.bbcodes[f.name])&&(h.isInline===!1&&A.opts.breakBeforeBlock&&h.breakBefore!==!1&&(k=!0),h.breakBefore&&(k=!0),j=k,k)){a.splice(o,1);continue}k&&a.splice(o,1),j=!1}else d.type===n.OPEN&&m(d.children,d,c)},q=function(b,c,d,e){var f,g,h,i,j,k,l=function(a){var b=A.bbcodes[a.name];return!b||b.isInline!==!1};for(c=c||[],e=e||b,g=0;g<b.length;g++)if((f=b[g])&&f.type===n.OPEN){if(!l(f)&&d&&(h=z(c),k=h.splitAt(f),j=c.length>1?c[c.length-2].children:e,i=a.inArray(h,j),i>-1))return k.children.splice(a.inArray(f,k.children),1),void j.splice(i+1,0,f,k);c.push(f),q(f.children,c,d||l(f),e),c.pop(f)}},t=function(a,b){for(var c,d,e=a.length;e--;)(c=a[e])&&(r(b,c)||(c.name=null,c.type=n.CONTENT,r(b,c)?(d=[e+1,0].concat(c.children),c.closing&&(c.closing.name=null,c.closing.type=n.CONTENT,d.push(c.closing)),e+=d.length-1,Array.prototype.splice.apply(a,d)):b.children.splice(e,1)),c.type===n.OPEN&&t(c.children,c))},s=function(b){for(var c,d,e=function(a){for(var b=a.length;b--;){var c=a[b].type;if(c===n.OPEN||c===n.CLOSE)return!1;if(c===n.CONTENT&&/\S|\u00A0/.test(a[b].val))return!1}return!0},f=b.length;f--;)(c=b[f])&&c.type===n.OPEN&&(d=A.bbcodes[c.name],s(c.children),e(c.children)&&d&&!d.isSelfClosing&&!d.allowsEmpty&&b.splice.apply(b,a.merge([f,1],c.children)))},A.toHTML=function(a,b){return u(A.parse(a,b),!0)},u=function(b,d){var g,j,k,l,m,o,p,q,r,s=[];for(q=function(a){return(!a||(a.isHtmlInline!==g?a.isHtmlInline:a.isInline))!==!1};b.length>0;)if(j=b.shift()){if(j.type===n.OPEN)r=j.children[j.children.length-1]||{},k=A.bbcodes[j.name],o=d&&q(k),l=u(j.children,!1),k&&k.html?(q(k)||!q(A.bbcodes[r.name])||k.isPreFormatted||k.skipLastLineBreak||i||(l+="<br />"),a.isFunction(k.html)?m=k.html.call(A,j,j.attrs,l):(j.attrs[0]=l,m=e.bbcode.formatBBCodeString(k.html,j.attrs))):m=j.val+l+(j.closing?j.closing.val:"");else{if(j.type===n.NEWLINE){if(!d){s.push("<br />");continue}p||(s.push("<div>"),(8>h||c.documentMode&&c.documentMode<8)&&s.push(" ")),i||s.push("<br />"),b.length||s.push("<br />"),s.push("</div>\n"),p=!1;continue}o=d,m=f(j.val,!0)}o&&!p?(s.push("<div>"),p=!0):!o&&p&&(s.push("</div>\n"),p=!1),s.push(m)}return p&&s.push("</div>\n"),s.join("")},A.toBBCode=function(a,b){return v(A.parse(a,b))},v=function(a){for(var b,c,d,e,f,g,h,i,j,k,l=[];a.length>0;)if(b=a.shift())if(d=A.bbcodes[b.name],e=!(!d||d.isInline!==!1),f=d&&d.isSelfClosing,h=e&&A.opts.breakBeforeBlock&&d.breakBefore!==!1||d&&d.breakBefore,i=e&&!f&&A.opts.breakStartBlock&&d.breakStart!==!1||d&&d.breakStart,j=e&&A.opts.breakEndBlock&&d.breakEnd!==!1||d&&d.breakEnd,k=e&&A.opts.breakAfterBlock&&d.breakAfter!==!1||d&&d.breakAfter,g=(d?d.quoteType:null)||A.opts.quoteType||p.QuoteType.auto,d||b.type!==n.OPEN)if(b.type===n.OPEN){if(h&&l.push("\n"),l.push("["+b.name),b.attrs){b.attrs.defaultattr&&(l.push("=",x(b.attrs.defaultattr,g,"defaultattr")),delete b.attrs.defaultattr);for(c in b.attrs)b.attrs.hasOwnProperty(c)&&l.push(" ",c,"=",x(b.attrs[c],g,c))}l.push("]"),i&&l.push("\n"),b.children&&l.push(v(b.children)),f||d.excludeClosing||(j&&l.push("\n"),l.push("[/"+b.name+"]")),k&&l.push("\n"),b.closing&&f&&l.push(b.closing.val)}else l.push(b.val);else l.push(b.val),b.children&&l.push(v(b.children)),b.closing&&l.push(b.closing.val);return l.join("")},x=function(b,c,d){var e=p.QuoteType,f=/\s|=/.test(b);return a.isFunction(c)?c(b,d):c===e.never||c===e.auto&&!f?b:'"'+b.replace("\\","\\\\").replace('"','\\"')+'"'},z=function(a){return a.length?a[a.length-1]:null},y=function(a){return a.toLowerCase()},d()};p.QuoteType={always:1,never:2,auto:3},p.defaults={breakBeforeBlock:!1,breakStartBlock:!1,breakEndBlock:!1,breakAfterBlock:!0,removeEmptyTags:!0,fixInvalidNesting:!0,fixInvalidChildren:!0,quoteType:p.QuoteType.auto},a.sceditorBBCodePlugin=e.bbcode=function(){var b,f,g,h,j=this;j.bbcodes=e.bbcode.bbcodes,j.stripQuotes=l;var n={},o={},q={ul:["li","ol","ul"],ol:["li","ol","ul"],table:["tr"],tr:["td","th"],code:["br","p","div"]};j.init=function(){j.opts=this.opts,b(),this.commands=a.extend(!0,{},k,this.commands),this.toBBCode=j.signalToSource,this.fromBBCode=j.signalToWysiwyg},b=function(){a.each(j.bbcodes,function(b){var c,d=j.bbcodes[b].tags,e=j.bbcodes[b].styles;d&&a.each(d,function(a,d){c=j.bbcodes[b].isInline===!1,n[a]=n[a]||{},n[a][c]=n[a][c]||{},n[a][c][b]=d}),e&&a.each(e,function(a,d){c=j.bbcodes[b].isInline===!1,o[c]=o[c]||{},o[c][a]=o[c][a]||{},o[c][a][b]=d})})},f=function(b,c,e){var f,g,h=d.dom.getStyle;return e=!!e,o[e]?(a.each(o[e],function(d,e){f=h(b[0],d),f&&h(b.parent()[0],d)!==f&&a.each(e,function(d,e){(!e||a.inArray(f.toString(),e)>-1)&&(g=j.bbcodes[d].format,c=a.isFunction(g)?g.call(j,b,c):m(g,c))})}),c):c},g=function(b,c,e){var f,g,h=b[0],k=h.nodeName.toLowerCase();e=!!e,n[k]&&n[k][e]&&a.each(n[k][e],function(d,e){(!e||(f=!1,a.each(e,function(c,d){return!b.attr(c)||d&&a.inArray(b.attr(c),d)<0?void 0:(f=!0,!1)}),f))&&(g=j.bbcodes[d].format,c=a.isFunction(g)?g.call(j,b,c):m(g,c))});var l=d.dom.isInline;if(e&&(!l(h,!0)||"br"===k)){for(var o,p,q,r=h.previousSibling;r&&(a(r).hasClass("sceditor-ignore")||1===r.nodeType&&!a(r).is("br")&&l(r,!0)&&!r.firstChild);)r=r.previousSibling;do{for(p=h.parentNode,q=p.lastChild;a(q).hasClass("sceditor-ignore");)q=q.previousSibling;o=q===h,h=p}while(p&&o&&l(p,!0));(!o||"li"===k||"br"===k&&i)&&(c+="\n"),"br"!==k&&r&&!a(r).is("br")&&l(r,!0)&&(c="\n"+c)}return c},j.signalToSource=function(b,e){var f,g,h=new p(j.opts.parserOptions);return e||("string"==typeof b?(f=a("<div />").css("visibility","hidden").appendTo(c.body).html(b),e=f):e=a(b)),e&&e.jquery?(d.dom.removeWhiteSpace(e[0]),g=j.elementToBbcode(e),f&&f.remove(),g=h.toBBCode(g,!0),j.opts.bbcodeTrim&&(g=a.trim(g)),g):""},j.elementToBbcode=function(b){var c=function(b,e){var h="";return d.dom.traverse(b,function(b){var d=a(b),j="",k=b.nodeType,l=b.nodeName.toLowerCase(),m=q[l],n=b.firstChild,o=!0;if("object"==typeof e&&(o=a.inArray(l,e)>-1,d.is("img")&&d.data("sceditor-emoticon")&&(o=!0),o||(m=e)),3===k||1===k)if(1===k){if(d.hasClass("sceditor-ignore"))return;if(d.hasClass("sceditor-nlf")&&(!n||!i&&1===b.childNodes.length&&/br/i.test(n.nodeName)))return;"iframe"!==l&&(j=c(b,m)),o?("code"!==l&&(j=f(d,j),j=g(d,j),j=f(d,j,!0)),h+=g(d,j,!0)):h+=j}else h+=b.nodeValue},!1,!0),h};return c(b[0])},j.signalToWysiwyg=function(b,c){var d=new p(j.opts.parserOptions),e=d.toHTML(j.opts.bbcodeTrim?a.trim(b):b);return c?h(e):e},h=function(b){var e,f,g,h=a("<div />").hide().appendTo(c.body),j=h[0];return g=function(b,e){if(!d.dom.hasStyling(b)){if(i||1!==b.childNodes.length||!a(b.firstChild).is("br"))for(;f=b.firstChild;)j.insertBefore(f,b);if(e){var g=j.lastChild;b!==g&&a(g).is("div")&&b.nextSibling===g&&j.insertBefore(c.createElement("br"),b)}j.removeChild(b)}},j.innerHTML=b.replace(/<\/div>\n/g,"</div>"),(e=j.firstChild)&&a(e).is("div")&&g(e,!0),(e=j.lastChild)&&a(e).is("div")&&g(e),j=j.innerHTML,h.remove(),j}},e.bbcode.formatBBCodeString=function(a,b){return a.replace(/\{([^}]+)\}/g,function(a,c){var d,e=!0;return"!"===c.charAt(0)&&(e=!1,c=c.substring(1)),"0"===c&&(e=!1),b[c]===d?a:e?f(b[c],!0):b[c]})};var q=function(a){return a=parseInt(a,10),isNaN(a)?"00":(a=Math.max(0,Math.min(a,255)).toString(16),a.length<2?"0"+a:a)},r=function(a){var b;return a=a||"#000",(b=a.match(/rgb\((\d{1,3}),\s*?(\d{1,3}),\s*?(\d{1,3})\)/i))?"#"+q(b[1])+q(b[2]-0)+q(b[3]-0):(b=a.match(/#([0-f])([0-f])([0-f])\s*?$/i))?"#"+b[1]+b[1]+b[2]+b[2]+b[3]+b[3]:a
},s={b:{tags:{b:null,strong:null},styles:{"font-weight":["bold","bolder","401","700","800","900"]},format:"[b]{0}[/b]",html:"<strong>{0}</strong>"},i:{tags:{i:null,em:null},styles:{"font-style":["italic","oblique"]},format:"[i]{0}[/i]",html:"<em>{0}</em>"},u:{tags:{u:null},styles:{"text-decoration":["underline"]},format:"[u]{0}[/u]",html:"<u>{0}</u>"},s:{tags:{s:null,strike:null},styles:{"text-decoration":["line-through"]},format:"[s]{0}[/s]",html:"<s>{0}</s>"},sub:{tags:{sub:null},format:"[sub]{0}[/sub]",html:"<sub>{0}</sub>"},sup:{tags:{sup:null},format:"[sup]{0}[/sup]",html:"<sup>{0}</sup>"},font:{tags:{font:{face:null}},styles:{"font-family":null},quoteType:p.QuoteType.never,format:function(a,b){var c;return a.is("font")&&(c=a.attr("face"))||(c=a.css("font-family")),"[font="+l(c)+"]"+b+"[/font]"},html:'<font face="{defaultattr}">{0}</font>'},size:{tags:{font:{size:null}},styles:{"font-size":null},format:function(a,b){var c=a.attr("size"),d=2;return c||(c=a.css("fontSize")),c.indexOf("px")>-1?(c=c.replace("px","")-0,12>c&&(d=1),c>15&&(d=3),c>17&&(d=4),c>23&&(d=5),c>31&&(d=6),c>47&&(d=7)):d=c,"[size="+d+"]"+b+"[/size]"},html:'<font size="{defaultattr}">{!0}</font>'},color:{tags:{font:{color:null}},styles:{color:null},quoteType:p.QuoteType.never,format:function(a,b){var c;return a.is("font")&&(c=a.attr("color"))||(c=a[0].style.color||a.css("color")),"[color="+r(c)+"]"+b+"[/color]"},html:function(a,b,c){return'<font color="'+f(r(b.defaultattr),!0)+'">'+c+"</font>"}},ul:{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ul]{0}[/ul]",html:"<ul>{0}</ul>"},list:{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:"<ul>{0}</ul>"},ol:{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ol]{0}[/ol]",html:"<ol>{0}</ol>"},li:{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[li]{0}[/li]",html:"<li>{0}</li>"},"*":{isInline:!1,closedBy:["/ul","/ol","/list","*","li"],html:"<li>{0}</li>"},table:{tags:{table:null},isInline:!1,isHtmlInline:!0,skipLastLineBreak:!0,format:"[table]{0}[/table]",html:"<table>{0}</table>"},tr:{tags:{tr:null},isInline:!1,skipLastLineBreak:!0,format:"[tr]{0}[/tr]",html:"<tr>{0}</tr>"},th:{tags:{th:null},allowsEmpty:!0,isInline:!1,format:"[th]{0}[/th]",html:"<th>{0}</th>"},td:{tags:{td:null},allowsEmpty:!0,isInline:!1,format:"[td]{0}[/td]",html:"<td>{0}</td>"},emoticon:{allowsEmpty:!0,tags:{img:{src:null,"data-sceditor-emoticon":null}},format:function(a,b){return a.data("sceditor-emoticon")+b},html:"{0}"},hr:{tags:{hr:null},allowsEmpty:!0,isSelfClosing:!0,isInline:!1,format:"[hr]{0}",html:"<hr />"},img:{allowsEmpty:!0,tags:{img:{src:null}},allowedChildren:["#"],quoteType:p.QuoteType.never,format:function(a,b){var c,d,e="",f=a[0],g=function(a){return f.style?f.style[a]:null};return a.attr("data-sceditor-emoticon")?b:(c=a.attr("width")||g("width"),d=a.attr("height")||g("height"),(f.complete&&(c||d)||c&&d)&&(e="="+a.width()+"x"+a.height()),"[img"+e+"]"+a.attr("src")+"[/img]")},html:function(a,b,c){var d,e,h,i,j="";return e=b.width,h=b.height,b.defaultattr&&(i=b.defaultattr.split(/x/i),e=i[0],h=2===i.length?i[1]:i[0]),e!==d&&(j+=' width="'+f(e,!0)+'"'),h!==d&&(j+=' height="'+f(h,!0)+'"'),"<img"+j+' src="'+g(c)+'" />'}},url:{allowsEmpty:!0,tags:{a:{href:null}},quoteType:p.QuoteType.never,format:function(a,b){var c=a.attr("href");return"mailto:"===c.substr(0,7)?'[email="'+c.substr(7)+'"]'+b+"[/email]":"[url="+c+"]"+b+"[/url]"},html:function(a,b,c){return b.defaultattr=f(b.defaultattr,!0)||c,'<a href="'+g(b.defaultattr)+'">'+c+"</a>"}},email:{quoteType:p.QuoteType.never,html:function(a,b,c){return'<a href="mailto:'+(f(b.defaultattr,!0)||c)+'">'+c+"</a>"}},quote:{tags:{blockquote:null},isInline:!1,quoteType:p.QuoteType.never,format:function(b,c){var d="",e=a(b),f=e.children("cite").first();return(1===f.length||e.data("author"))&&(d=f.text()||e.data("author"),e.data("author",d),f.remove(),c=this.elementToBbcode(a(b)),d="="+d.replace(/(^\s+|\s+$)/g,""),e.prepend(f)),"[quote"+d+"]"+c+"[/quote]"},html:function(a,b,c){return b.defaultattr&&(c="<cite>"+f(b.defaultattr)+"</cite>"+c),"<blockquote>"+c+"</blockquote>"}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"<code>{0}</code>"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,format:"[left]{0}[/left]",html:'<div align="left">{0}</div>'},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,format:"[center]{0}[/center]",html:'<div align="center">{0}</div>'},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,format:"[right]{0}[/right]",html:'<div align="right">{0}</div>'},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,format:"[justify]{0}[/justify]",html:'<div align="justify">{0}</div>'},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(a,b){return a=a.attr("data-youtube-id"),a?"[youtube]"+a+"[/youtube]":b},html:'<iframe width="560" height="315" frameborder="0" src="http://www.youtube.com/embed/{0}?wmode=opaque" data-youtube-id="{0}" allowfullscreen></iframe>'},rtl:{styles:{direction:["rtl"]},format:"[rtl]{0}[/rtl]",html:'<div style="direction: rtl">{0}</div>'},ltr:{styles:{direction:["ltr"]},format:"[ltr]{0}[/ltr]",html:'<div style="direction: ltr">{0}</div>'},ignore:{}};e.bbcode.bbcode={get:function(a){return s[a]||null},set:function(b,c){return b&&c?(c=a.extend(s[b]||{},c),c.remove=function(){delete s[b]},s[b]=c,this):!1},rename:function(a,b){return a in s?(s[b]=s[a],delete s[a],this):!1},remove:function(a){return a in s&&delete s[a],this}},a.fn.sceditorBBCodePlugin=function(b){return b=b||{},a.isPlainObject(b)&&(b.plugins=(b.plugins||"")+"bbcode"),this.sceditor(b)},e.bbcode.normaliseColour=r,e.bbcode.formatString=m,e.bbcode.stripQuotes=l,e.bbcode.bbcodes=s,d.BBCodeParser=p}(jQuery,window,document);

/* SCEditor v3.1.1 | (C) 2017, Sam Clarke | sceditor.com/license */

!function(){"use strict";var r=(A=jQuery)&&"object"==typeof A&&"default"in A?A:{default:A};function e(e,t){return typeof t===e}var ye=e.bind(null,"string"),be=e.bind(null,"undefined"),xe=e.bind(null,"function"),o=e.bind(null,"number");function t(e){return!Object.keys(e).length}function we(e,t){var n=e===!!e,r=n?2:1,o=n?t:e,i=n&&e;function a(e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype}for(;r<arguments.length;r++){var l,s=arguments[r];for(l in s){var c,u,d=o[l],f=s[l];be(f)||"__proto__"!==l&&"constructor"!==l&&(u=a(f),c=Array.isArray(f),i&&(u||c)?(u=a(d)===u&&Array.isArray(d)===c,o[l]=we(!0,u?d:c?[]:{},f)):o[l]=f)}}return o}function ke(e,t){-1<(t=e.indexOf(t))&&e.splice(t,1)}function Te(t,n){if(Array.isArray(t)||"length"in t&&o(t.length))for(var e=0;e<t.length;e++)n(e,t[e]);else Object.keys(t).forEach(function(e){n(e,t[e])})}var i={},Ce=1,Se=3,l=8;function a(e){return e=parseFloat(e),isFinite(e)?e:0}function Ee(e,t,n){var r=(n||document).createElement(e);return Te(t||{},function(e,t){"style"===e?r.style.cssText=t:e in r?r[e]=t:r.setAttribute(e,t)}),r}function De(e,t){for(var n=e||{};(n=n.parentNode)&&!/(9|11)/.test(n.nodeType);)if(!t||Ue(n,t))return n}function Ne(e,t){return Ue(e,t)?e:De(e,t)}function Ae(e){e.parentNode&&e.parentNode.removeChild(e)}function Me(e,t){e.appendChild(t)}function Re(e,t){return e.querySelectorAll(t)}var _e=!0;function Oe(n,e,r,o,i){e.split(" ").forEach(function(e){var t;ye(r)?(t=o["_sce-event-"+e+r]||function(e){for(var t=e.target;t&&t!==n;){if(Ue(t,r))return void o.call(t,e);t=t.parentNode}},o["_sce-event-"+e+r]=t):(t=r,i=o),n.addEventListener(e,t,i||!1)})}function Be(n,e,r,o,i){e.split(" ").forEach(function(e){var t;ye(r)?t=o["_sce-event-"+e+r]:(t=r,i=o),n.removeEventListener(e,t,i||!1)})}function Fe(e,t,n){if(arguments.length<3)return e.getAttribute(t);null==n?He(e,t):e.setAttribute(t,n)}function He(e,t){e.removeAttribute(t)}function Ie(e){je(e,"display","none")}function ze(e){je(e,"display","")}function Le(e){(Qe(e)?Ie:ze)(e)}function je(n,e,t){if(arguments.length<3){if(ye(e))return 1===n.nodeType?getComputedStyle(n)[e]:null;Te(e,function(e,t){je(n,e,t)})}else{var r=(t||0===t)&&!isNaN(t);n.style[e]=r?t+"px":t}}function Pe(e,t,n){var r=arguments.length,o={};if(e.nodeType===Ce)return 1===r?(Te(e.attributes,function(e,t){/^data\-/i.test(t.name)&&(o[t.name.substr(5)]=t.value)}),o):2===r?Fe(e,"data-"+t):void Fe(e,"data-"+t,String(n))}function Ue(e,t){var n=!1;return e&&e.nodeType===Ce?(e.matches||e.msMatchesSelector||e.webkitMatchesSelector).call(e,t):n}function We(e,t){return t.parentNode.insertBefore(e,t)}function s(e){return e.className.trim().split(/\s+/)}function qe(e,t){return Ue(e,"."+t)}function Ve(e,t){var n=s(e);n.indexOf(t)<0&&n.push(t),e.className=n.join(" ")}function $e(e,t){var n=s(e);ke(n,t),e.className=n.join(" ")}function Ge(e,t,n){((n=be(n)?!qe(e,t):n)?Ve:$e)(e,t)}function Ye(e,t){if(be(t)){var n=a((r=getComputedStyle(e)).paddingLeft)+a(r.paddingRight),r=a(r.borderLeftWidth)+a(r.borderRightWidth);return e.offsetWidth-n-r}je(e,"width",t)}function Ke(e,t){if(be(t)){var n=a((r=getComputedStyle(e)).paddingTop)+a(r.paddingBottom),r=a(r.borderTopWidth)+a(r.borderBottomWidth);return e.offsetHeight-n-r}je(e,"height",t)}function Xe(e,t,n){var r;xe(window.CustomEvent)?r=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=e.ownerDocument.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n),e.dispatchEvent(r)}function Qe(e){return e.getClientRects().length}function Ze(e,t,n,r,o){for(e=o?e.lastChild:e.firstChild;e;){var i=o?e.previousSibling:e.nextSibling;if(!n&&!1===t(e)||!r&&!1===Ze(e,t,n,r,o)||n&&!1===t(e))return!1;e=i}}function Je(e,t,n,r){Ze(e,t,n,r,!0)}function et(e,t){var n=(t=t||document).createDocumentFragment(),r=Ee("div",{},t);for(r.innerHTML=e;r.firstChild;)Me(n,r.firstChild);return n}function tt(e){return e&&(!Ue(e,"p,div")||e.className||Fe(e,"style")||!t(Pe(e)))}function nt(e,t){var n=Ee(t,{},e.ownerDocument);for(Te(e.attributes,function(e,t){try{Fe(n,t.name,t.value)}catch(e){}});e.firstChild;)Me(n,e.firstChild);return e.parentNode.replaceChild(n,e),n}var c="|body|hr|p|div|h1|h2|h3|h4|h5|h6|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|blockquote|center|details|section|article|aside|nav|main|header|hgroup|footer|fieldset|dl|dt|dd|figure|figcaption|";function rt(e){return!!/11?|9/.test(e.nodeType)&&"|iframe|area|base|basefont|br|col|frame|hr|img|input|wbr|isindex|link|meta|param|command|embed|keygen|source|track|object|".indexOf("|"+e.nodeName.toLowerCase()+"|")<0}function ot(e,t){var n=(e||{}).nodeType||Se;return n!==Ce?n===Se:"code"===(e=e.tagName.toLowerCase())?!t:c.indexOf("|"+e+"|")<0}function d(e){return e.lastChild&&d(e.lastChild)&&Ae(e.lastChild),3===e.nodeType?!e.nodeValue:rt(e)&&!e.childNodes.length}function it(e){Ze(e,function(e){var t=!ot(e,!0)&&e.nodeType!==l,n=e.parentNode;if(t&&(ot(n,!0)||"P"===n.tagName)){for(var r=e;ot(r.parentNode,!0)||"P"===r.parentNode.tagName;)r=r.parentNode;for(var o=f(r,e),i=e;n&&ot(n,!0);){if(n.nodeType===Ce){for(var a=n.cloneNode();i.firstChild;)Me(a,i.firstChild);Me(i,a)}n=n.parentNode}We(i,r),d(o)||We(o,i),d(r)&&Ae(r)}t&&Ue(e,"ul,ol")&&Ue(e.parentNode,"ul,ol")&&(o="li",t=(t=e).previousElementSibling,(t=o&&t&&!Ue(t,o)?null:t)||We(t=Ee("li"),e),Me(t,e))})}function u(e,t){return e?(t?e.previousSibling:e.nextSibling)||u(e.parentNode,t):null}function at(e){var t,n,r,o,i,a,l=je(e,"whiteSpace"),s=/line$/i.test(l),c=e.firstChild;if(!/pre(\-wrap)?$/i.test(l))for(;c;){if(i=c.nextSibling,t=c.nodeValue,(a=c.nodeType)===Ce&&c.firstChild&&at(c),a===Se){for(n=u(c),r=u(c,!0),a=!1;qe(r,"sceditor-ignore");)r=u(r,!0);if(ot(c)&&r){for(o=r;o.lastChild;)for(o=o.lastChild;qe(o,"sceditor-ignore");)o=u(o,!0);a=o.nodeType===Se?/[\t\n\r ]$/.test(o.nodeValue):!ot(o)}t=t.replace(/\u200B/g,""),r&&ot(r)&&!a||(t=t.replace(s?/^[\t ]+/:/^[\t\n\r ]+/,"")),(t=n&&ot(n)?t:t.replace(s?/[\t ]+$/:/[\t\n\r ]+$/,"")).length?c.nodeValue=t.replace(s?/[\t ]+/g:/[\t\n\r ]+/g," "):Ae(c)}c=i}}function f(e,t){var n=e.ownerDocument.createRange();return n.setStartBefore(e),n.setEndAfter(t),n.extractContents()}function lt(e){for(var t=0,n=0;e;)t+=e.offsetLeft,n+=e.offsetTop,e=e.offsetParent;return{left:t,top:n}}function p(e,t){var n=e.style;return i[t]||(i[t]=t.replace(/^-ms-/,"ms-").replace(/-(\w)/g,function(e,t){return t.toUpperCase()})),n=n[t=i[t]],"textAlign"===t&&(n=n||je(e,t),je(e.parentNode,t)===n||"block"!==je(e,"display")||Ue(e,"hr,th"))?"":n}function st(e,t){var n=e.attributes.length;if(n===t.attributes.length){for(;n--;){var r=e.attributes[n];if("style"===r.name?!function(e,t){var n=e.style.length;if(n===t.style.length){for(;n--;){var r=e.style[n];if(e.style[r]!==t.style[r])return}return 1}}(e,t):r.value!==Fe(t,r.name))return}return 1}}function ct(e){for(;e.firstChild;)We(e.firstChild,e);Ae(e)}var ut={toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|font,size,color,removeformat|cut,copy,pastetext|bulletlist,orderedlist,indent,outdent|table|code,quote|horizontalrule,image,email,link,unlink|emoticon,youtube,date,time|ltr,rtl|print,maximize,source",toolbarExclude:null,style:"jquery.sceditor.default.css",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Georgia,Impact,Sans-serif,Serif,Times New Roman,Trebuchet MS,Verdana",colors:"#000000,#44B8FF,#1E92F7,#0074D9,#005DC2,#00369B,#b3d5f4|#444444,#C3FFFF,#9DF9FF,#7FDBFF,#68C4E8,#419DC1,#d9f4ff|#666666,#72FF84,#4CEA5E,#2ECC40,#17B529,#008E02,#c0f0c6|#888888,#FFFF44,#FFFA1E,#FFDC00,#E8C500,#C19E00,#fff5b3|#aaaaaa,#FFC95F,#FFA339,#FF851B,#E86E04,#C14700,#ffdbbb|#cccccc,#FF857A,#FF5F54,#FF4136,#E82A1F,#C10300,#ffc6c3|#eeeeee,#FF56FF,#FF30DC,#F012BE,#D900A7,#B20080,#fbb8ec|#ffffff,#F551FF,#CF2BE7,#B10DC9,#9A00B2,#9A00B2,#e8b6ef",locale:Fe(document.documentElement,"lang")||"en",charset:"utf-8",emoticonsCompat:!1,emoticonsEnabled:!0,emoticonsRoot:"",emoticons:{dropdown:{":)":"emoticons/smile.png",":angel:":"emoticons/angel.png",":angry:":"emoticons/angry.png","8-)":"emoticons/cool.png",":'(":"emoticons/cwy.png",":ermm:":"emoticons/ermm.png",":D":"emoticons/grin.png","<3":"emoticons/heart.png",":(":"emoticons/sad.png",":O":"emoticons/shocked.png",":P":"emoticons/tongue.png",";)":"emoticons/wink.png"},more:{":alien:":"emoticons/alien.png",":blink:":"emoticons/blink.png",":blush:":"emoticons/blush.png",":cheerful:":"emoticons/cheerful.png",":devil:":"emoticons/devil.png",":dizzy:":"emoticons/dizzy.png",":getlost:":"emoticons/getlost.png",":happy:":"emoticons/happy.png",":kissing:":"emoticons/kissing.png",":ninja:":"emoticons/ninja.png",":pinch:":"emoticons/pinch.png",":pouty:":"emoticons/pouty.png",":sick:":"emoticons/sick.png",":sideways:":"emoticons/sideways.png",":silly:":"emoticons/silly.png",":sleeping:":"emoticons/sleeping.png",":unsure:":"emoticons/unsure.png",":woot:":"emoticons/w00t.png",":wassat:":"emoticons/wassat.png"},hidden:{":whistling:":"emoticons/whistling.png",":love:":"emoticons/wub.png"}},width:null,height:null,resizeEnabled:!0,resizeMinWidth:null,resizeMinHeight:null,resizeMaxHeight:null,resizeMaxWidth:null,resizeHeight:!0,resizeWidth:!0,dateFormat:"year-month-day",toolbarContainer:null,enablePasteFiltering:!1,disablePasting:!1,readOnly:!1,rtl:!1,autofocus:!1,autofocusEnd:!0,autoExpand:!1,autoUpdate:!1,spellcheck:!0,runWithoutWysiwygSupport:!1,startInSourceMode:!1,id:null,plugins:"",zIndex:null,bbcodeTrim:!1,disableBlockRemove:!1,allowedIframeUrls:[],parserOptions:{},dropDownCss:{}},m=/^(https?|s?ftp|mailto|spotify|skype|ssh|teamspeak|tel):|(\/\/)|data:image\/(png|bmp|gif|p?jpe?g);/i;function dt(e){return e.replace(/([\-.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")}function ft(e,t){if(!e)return e;var n={"&":"&amp;","<":"&lt;",">":"&gt;"," ":"&nbsp; ","\r\n":"<br />","\r":"<br />","\n":"<br />"};return!1!==t&&(n['"']="&#34;",n["'"]="&#39;",n["`"]="&#96;"),e.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(e){return n[e]||e})}var h={html:'<!DOCTYPE html><html{attrs}><head><meta http-equiv="Content-Type" content="text/html;charset={charset}" /><link rel="stylesheet" type="text/css" href="{style}" /></head><body contenteditable="true" {spellcheck}><p></p></body></html>',toolbarButton:'<a class="sceditor-button sceditor-button-{name}" data-sceditor-command="{name}" unselectable="on"><div unselectable="on">{dispName}</div></a>',emoticon:'<img src="{url}" data-sceditor-emoticon="{key}" alt="{key}" title="{tooltip}" />',fontOpt:'<a class="sceditor-font-option" href="#" data-font="{font}"><font face="{font}">{font}</font></a>',sizeOpt:'<a class="sceditor-fontsize-option" data-size="{size}" href="#"><font size="{size}">{size}</font></a>',pastetext:'<div><label for="txt">{label}</label> <textarea cols="20" rows="7" id="txt"></textarea></div><div><input type="button" class="button" value="{insert}" /></div>',table:'<div><label for="rows">{rows}</label><input type="text" id="rows" value="2" /></div><div><label for="cols">{cols}</label><input type="text" id="cols" value="2" /></div><div><input type="button" class="button" value="{insert}" /></div>',image:'<div><label for="image">{url}</label> <input type="text" id="image" dir="ltr" placeholder="https://" /></div><div><label for="width">{width}</label> <input type="text" id="width" size="2" dir="ltr" /></div><div><label for="height">{height}</label> <input type="text" id="height" size="2" dir="ltr" /></div><div><input type="button" class="button" value="{insert}" /></div>',email:'<div><label for="email">{label}</label> <input type="text" id="email" dir="ltr" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{insert}" /></div>',link:'<div><label for="link">{url}</label> <input type="text" id="link" dir="ltr" placeholder="https://" /></div><div><label for="des">{desc}</label> <input type="text" id="des" /></div><div><input type="button" class="button" value="{ins}" /></div>',youtubeMenu:'<div><label for="link">{label}</label> <input type="text" id="link" dir="ltr" placeholder="https://" /></div><div><input type="button" class="button" value="{insert}" /></div>',youtube:'<iframe width="560" height="315" frameborder="0" allowfullscreen src="https://www.youtube-nocookie.com/embed/{id}?wmode=opaque&start={time}" data-youtube-id="{id}"></iframe>'};function pt(e,t,n){var r=h[e];return Object.keys(t).forEach(function(e){r=r.replace(new RegExp(dt("{"+e+"}"),"g"),t[e])}),r=n?et(r):r}function n(e){if("mozHidden"in document)for(var t,n=e.getBody();n;){if((t=n).firstChild)t=t.firstChild;else{for(;t&&!t.nextSibling;)t=t.parentNode;t=t&&t.nextSibling}3===n.nodeType&&/[\n\r\t]+/.test(n.nodeValue)&&(/^pre/.test(je(n.parentNode,"whiteSpace"))||Ae(n)),n=t}}var mt={bold:{exec:"bold",tooltip:"Bold",shortcut:"Ctrl+B"},italic:{exec:"italic",tooltip:"Italic",shortcut:"Ctrl+I"},underline:{exec:"underline",tooltip:"Underline",shortcut:"Ctrl+U"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{state:function(e){if(e=e&&3===e.nodeType?e.parentNode:e){var t="ltr"===je(e,"direction"),e=je(e,"textAlign");return/left/.test(e)||e===(t?"start":"end")}},exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{state:function(e){if(e=e&&3===e.nodeType?e.parentNode:e){var t="ltr"===je(e,"direction"),e=je(e,"textAlign");return/right/.test(e)||e===(t?"end":"start")}},exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,e,n){var r=Ee("div");Oe(r,"click","a",function(e){n(Pe(this,"font")),t.closeDropDown(!0),e.preventDefault()}),t.opts.fonts.split(",").forEach(function(e){Me(r,pt("fontOpt",{font:e},!0))}),t.createDropDown(e,"font-picker",r)},exec:function(e){var t=this;mt.font._dropDown(t,e,function(e){t.execCommand("fontname",e)})},tooltip:"Font Name"},size:{_dropDown:function(t,e,n){var r=Ee("div");Oe(r,"click","a",function(e){n(Pe(this,"size")),t.closeDropDown(!0),e.preventDefault()});for(var o=1;o<=7;o++)Me(r,pt("sizeOpt",{size:o},!0));t.createDropDown(e,"fontsize-picker",r)},exec:function(e){var t=this;mt.size._dropDown(t,e,function(e){t.execCommand("fontsize",e)})},tooltip:"Font Size"},color:{_dropDown:function(t,e,n){var r=Ee("div"),o="",i=mt.color;i._htmlCache||(t.opts.colors.split("|").forEach(function(e){o+='<div class="sceditor-color-column">',e.split(",").forEach(function(e){o+='<a href="#" class="sceditor-color-option" style="background-color: '+e+'" data-color="'+e+'"></a>'}),o+="</div>"}),i._htmlCache=o),Me(r,et(i._htmlCache)),Oe(r,"click","a",function(e){n(Pe(this,"color")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"color-picker",r)},exec:function(e){var t=this;mt.color._dropDown(t,e,function(e){t.execCommand("forecolor",e)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(e){var t,n=Ee("div"),r=this;Me(n,pt("pastetext",{label:r._("Paste your text inside the following box:"),insert:r._("Insert")},!0)),Oe(n,"click",".button",function(e){(t=Re(n,"#txt")[0].value)&&r.wysiwygEditorInsertText(t),r.closeDropDown(!0),e.preventDefault()}),r.createDropDown(e,"pastetext",n)},tooltip:"Paste Text"},bulletlist:{exec:function(){n(this),this.execCommand("insertunorderedlist")},tooltip:"Bullet list"},orderedlist:{exec:function(){n(this),this.execCommand("insertorderedlist")},tooltip:"Numbered list"},indent:{state:function(e,t){var n;return Ue(t,"li")||Ue(t,"ul,ol,menu")&&(t=(n=this.getRangeHelper().selectedRange()).startContainer.parentNode,n=n.endContainer.parentNode,t!==t.parentNode.firstElementChild||Ue(n,"li")&&n!==n.parentNode.lastElementChild)?0:-1},exec:function(){var e=this.getRangeHelper().getFirstBlockParent();this.focus(),Ne(e,"ul,ol,menu")&&this.execCommand("indent")},tooltip:"Add indent"},outdent:{state:function(e,t){return Ne(t,"ul,ol,menu")?0:-1},exec:function(){Ne(this.getRangeHelper().getFirstBlockParent(),"ul,ol,menu")&&this.execCommand("outdent")},tooltip:"Remove one indent"},table:{exec:function(e){var o=this,i=Ee("div");Me(i,pt("table",{rows:o._("Rows:"),cols:o._("Cols:"),insert:o._("Insert")},!0)),Oe(i,"click",".button",function(e){var t=Number(Re(i,"#rows")[0].value),n=Number(Re(i,"#cols")[0].value),r="<table>";0<t&&0<n&&(r+=Array(t+1).join("<tr>"+Array(n+1).join("<td><br /></td>")+"</tr>"),r+="</table>",o.wysiwygEditorInsertHtml(r),o.closeDropDown(!0),e.preventDefault())}),o.createDropDown(e,"inserttable",i)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{exec:function(){this.wysiwygEditorInsertHtml("<code>","<br /></code>")},tooltip:"Code"},image:{_dropDown:function(t,e,n,r){var o=Ee("div");Me(o,pt("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0));var i=Re(o,"#image")[0];i.value=n,Oe(o,"click",".button",function(e){i.value&&r(i.value,Re(o,"#width")[0].value,Re(o,"#height")[0].value),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",o)},exec:function(e){var o=this;mt.image._dropDown(o,e,"",function(e,t,n){var r="";t&&(r+=' width="'+parseInt(t,10)+'"'),n&&(r+=' height="'+parseInt(n,10)+'"'),r+=' src="'+ft(e)+'"',o.wysiwygEditorInsertHtml("<img"+r+" />")})},tooltip:"Insert an image"},email:{_dropDown:function(n,e,r){var o=Ee("div");Me(o,pt("email",{label:n._("E-mail:"),desc:n._("Description (optional):"),insert:n._("Insert")},!0)),Oe(o,"click",".button",function(e){var t=Re(o,"#email")[0].value;t&&r(t,Re(o,"#des")[0].value),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"insertemail",o)},exec:function(e){var n=this;mt.email._dropDown(n,e,function(e,t){!n.getRangeHelper().selectedHtml()||t?n.wysiwygEditorInsertHtml('<a href="mailto:'+ft(e)+'">'+ft(t||e)+"</a>"):n.execCommand("createlink","mailto:"+e)})},tooltip:"Insert an email"},link:{_dropDown:function(t,e,n){var r=Ee("div");Me(r,pt("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0));var o=Re(r,"#link")[0];function i(e){o.value&&n(o.value,Re(r,"#des")[0].value),t.closeDropDown(!0),e.preventDefault()}Oe(r,"click",".button",i),Oe(r,"keypress",function(e){13===e.which&&o.value&&i(e)},_e),t.createDropDown(e,"insertlink",r)},exec:function(e){var n=this;mt.link._dropDown(n,e,function(e,t){t||!n.getRangeHelper().selectedHtml()?n.wysiwygEditorInsertHtml('<a href="'+ft(e)+'">'+ft(t||e)+"</a>"):n.execCommand("createlink",e)})},tooltip:"Insert a link"},unlink:{state:function(){return Ne(this.currentNode(),"a")?0:-1},exec:function(){var e=Ne(this.currentNode(),"a");if(e){for(;e.firstChild;)We(e.firstChild,e);Ae(e)}},tooltip:"Unlink"},quote:{exec:function(e,t,n){var r="<blockquote>",o="</blockquote>";t?(r=r+(n=n?"<cite>"+ft(n)+"</cite>":"")+t+o,o=null):""===this.getRangeHelper().selectedHtml()&&(o="<br />"+o),this.wysiwygEditorInsertHtml(r,o)},tooltip:"Insert a Quote"},emoticon:{exec:function(u){var d=this,f=function(e){var n,t=d.opts,r=t.emoticonsRoot||"",o=t.emoticonsCompat,i=d.getRangeHelper(),a=o&&" "!==i.getOuterText(!0,1)?" ":"",l=o&&" "!==i.getOuterText(!1,1)?" ":"",s=Ee("div"),c=Ee("div"),i=we({},t.emoticons.dropdown,e?t.emoticons.more:{});return Me(s,c),n=Math.sqrt(Object.keys(i).length),Oe(s,"click","img",function(e){d.insert(a+Fe(this,"alt")+l,null,!1).closeDropDown(!0),e.preventDefault()}),Te(i,function(e,t){Me(c,Ee("img",{src:r+(t.url||t),alt:e,title:t.tooltip||e})),c.children.length>=n&&(c=Ee("div"),Me(s,c))}),!e&&t.emoticons.more&&(Me(t=Ee("a",{className:"sceditor-more"}),document.createTextNode(d._("More"))),Oe(t,"click",function(e){d.createDropDown(u,"more-emoticons",f(!0)),e.preventDefault()}),Me(s,t)),s};d.createDropDown(u,"emoticons",f(!1))},txtExec:function(e){mt.emoticon.exec.call(this,e)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(o,e,i){var a=Ee("div");Me(a,pt("youtubeMenu",{label:o._("Video URL:"),insert:o._("Insert")},!0)),Oe(a,"click",".button",function(e){var t=(n=Re(a,"#link")[0].value).match(/(?:v=|v\/|embed\/|youtu.be\/)?([a-zA-Z0-9_-]{11})/),n=n.match(/[&|?](?:star)?t=((\d+[hms]?){1,3})/),r=0;n&&Te(n[1].split(/[hms]/),function(e,t){""!==t&&(r=60*r+Number(t))}),t&&/^[a-zA-Z0-9_\-]{11}$/.test(t[1])&&i(t[1],r),o.closeDropDown(!0),e.preventDefault()}),o.createDropDown(e,"insertlink",a)},exec:function(e){var n=this;mt.youtube._dropDown(n,e,function(e,t){n.wysiwygEditorInsertHtml(pt("youtube",{id:e,time:t}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),r=t.getMonth()+1;return n<2e3&&(n=1900+n),r<10&&(r="0"+r),(t=t.getDate())<10&&(t="0"+t),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,r).replace(/day/i,t)},exec:function(){this.insertText(mt.date._date(this))},txtExec:function(){this.insertText(mt.date._date(this))},tooltip:"Insert current date"},time:{_time:function(){var e=new Date,t=e.getHours(),n=e.getMinutes();return(t=t<10?"0"+t:t)+":"+(n=n<10?"0"+n:n)+":"+((e=e.getSeconds())<10?"0"+e:e)},exec:function(){this.insertText(mt.time._time())},txtExec:function(){this.insertText(mt.time._time())},tooltip:"Insert current time"},ltr:{state:function(e,t){return t&&"ltr"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();this.focus(),(t&&!Ue(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!Ue(t,"body")))&&(e="ltr"===je(t,"direction")?"":"ltr",je(t,"direction",e))},tooltip:"Left-to-Right"},rtl:{state:function(e,t){return t&&"rtl"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();this.focus(),(t&&!Ue(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!Ue(t,"body")))&&(e="rtl"===je(t,"direction")?"":"rtl",je(t,"direction",e))},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize()),this.focus()},txtExec:function(){this.maximize(!this.maximize()),this.focus()},tooltip:"Maximize",shortcut:"Ctrl+Shift+M"},source:{state:function(){return this.sourceMode()},exec:function(){this.toggleSourceMode(),this.focus()},txtExec:function(){this.toggleSourceMode(),this.focus()},tooltip:"View source",shortcut:"Ctrl+Shift+S"},ignore:{}},g={};function ht(i){function a(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)}function e(e,t){for(var n,r=a((e=[].slice.call(e)).shift()),o=0;o<l.length;o++)if(r in l[o]&&(n=l[o][r].apply(i,e),t))return n}var o=this,l=[];o.call=function(){e(arguments,!1)},o.callOnlyFirst=function(){return e(arguments,!0)},o.hasHandler=function(e){var t=l.length;for(e=a(e);t--;)if(e in l[t])return!0;return!1},o.exists=function(e){return e in g&&"function"==typeof(e=g[e])&&"object"==typeof e.prototype},o.isRegistered=function(e){if(o.exists(e))for(var t=l.length;t--;)if(l[t]instanceof g[e])return!0;return!1},o.register=function(e){return!(!o.exists(e)||o.isRegistered(e)||(e=new g[e],l.push(e),"init"in e&&e.init.call(i),0))},o.deregister=function(e){var t,n=l.length,r=!1;if(!o.isRegistered(e))return r;for(;n--;)l[n]instanceof g[e]&&(r=!0,"destroy"in(t=l.splice(n,1)[0])&&t.destroy.call(i));return r},o.destroy=function(){for(var e=l.length;e--;)"destroy"in l[e]&&l[e].destroy.call(i);l=[],i=null}}ht.plugins=g;var v=function(e,t,n){var r,o,i,a,l,s="",c=e.startContainer,u=e.startOffset;for(c&&3!==c.nodeType&&(c=c.childNodes[u],u=0),i=a=u;n>s.length&&c&&3===c.nodeType;)r=c.nodeValue,o=n-s.length,l&&(a=r.length,i=0),l=c,c=t?(u=i=Math.max(a-o,0),s=r.substr(i,a-i)+s,l.previousSibling):(u=i+(a=Math.min(o,r.length)),s+=r.substr(i,a),l.nextSibling);return{node:l||c,offset:u,text:s}};function gt(o,e,i){var a,l,s=e||o.contentDocument||o.document,c="sceditor-start-marker",u="sceditor-end-marker",g=this;g.insertHTML=function(e,t){var n,r;if(!g.selectedRange())return!1;for(t&&(e+=g.selectedHtml()+t),r=Ee("p",{},s),n=s.createDocumentFragment(),r.innerHTML=i(e);r.firstChild;)Me(n,r.firstChild);g.insertNode(n)},l=function(e,t,n){var r,o=s.createDocumentFragment();if("string"==typeof e?(t&&(e+=g.selectedHtml()+t),o=et(e)):(Me(o,e),t&&(Me(o,g.selectedRange().extractContents()),Me(o,t))),r=o.lastChild){for(;!ot(r.lastChild,!0);)r=r.lastChild;return(rt(r)?r.lastChild||Me(r,document.createTextNode("​")):r=o,g.removeMarkers(),Me(r,a(c)),Me(r,a(u)),n)?(Me(n=Ee("div"),o),n.innerHTML):o}},g.insertNode=function(e,t){var n,r,o=l(e,t),t=(e=g.selectedRange()).commonAncestorContainer,i=[];if(!o)return!1;function a(e){e&&d(e)&&i.indexOf(e)<0&&Ae(e)}e.startContainer!==e.endContainer&&(Te(t.childNodes,function(e,t){d(t)&&i.push(t)}),n=o.firstChild,r=o.lastChild),e.deleteContents(),t&&3!==t.nodeType&&!rt(t)?We(o,t):(e.insertNode(o),a(n&&n.previousSibling),a(r&&r.nextSibling)),g.restoreRange()},g.cloneSelected=function(){var e=g.selectedRange();if(e)return e.cloneRange()},g.selectedRange=function(){var e,t,n=o.getSelection();if(n){if(n.rangeCount<=0){for(t=s.body;t.firstChild;)t=t.firstChild;(e=s.createRange()).setStartBefore(t),n.addRange(e)}return 0<n.rangeCount?n.getRangeAt(0):e}},g.hasSelection=function(){var e=o.getSelection();return e&&0<e.rangeCount},g.selectedHtml=function(){var e,t=g.selectedRange();return t?(Me(e=Ee("p",{},s),t.cloneContents()),e.innerHTML):""},g.parentNode=function(){var e=g.selectedRange();if(e)return e.commonAncestorContainer},g.getFirstBlockParent=function(e){var t=function(e){return ot(e,!0)?(e=e?e.parentNode:null)&&t(e):e};return t(e||g.parentNode())},g.insertNodeAt=function(e,t){var n=g.selectedRange(),r=g.cloneSelected();if(!r)return!1;r.collapse(e),r.insertNode(t),g.selectRange(n)},a=function(e){return g.removeMarker(e),(e=Ee("span",{id:e,className:"sceditor-selection sceditor-ignore",style:"display:none;line-height:0"},s)).innerHTML=" ",e},g.insertMarkers=function(){var e=g.selectedRange(),t=a(c);g.removeMarkers(),g.insertNodeAt(!0,t),e&&e.collapsed?t.parentNode.insertBefore(a(u),t.nextSibling):g.insertNodeAt(!1,a(u))},g.getMarker=function(e){return s.getElementById(e)},g.removeMarker=function(e){(e=g.getMarker(e))&&Ae(e)},g.removeMarkers=function(){g.removeMarker(c),g.removeMarker(u)},g.saveRange=function(){g.insertMarkers()},g.selectRange=function(e){var t,n=o.getSelection(),r=e.endContainer;if(e.collapsed&&r&&!ot(r,!0)){for(t=r.lastChild;t&&Ue(t,".sceditor-ignore");)t=t.previousSibling;Ue(t,"br")&&((r=s.createRange()).setEndAfter(t),r.collapse(!1),g.compare(e,r)&&(e.setStartBefore(t),e.collapse(!0)))}n&&(g.clear(),n.addRange(e))},g.restoreRange=function(){var e,t=g.selectedRange(),n=g.getMarker(c),r=g.getMarker(u);if(!n||!r||!t)return!1;e=n.nextSibling===r,(t=s.createRange()).setStartBefore(n),t.setEndAfter(r),e&&t.collapse(!0),g.selectRange(t),g.removeMarkers()},g.selectOuterText=function(e,t){var n=g.cloneSelected();if(!n)return!1;n.collapse(!1),e=v(n,!0,e),t=v(n,!1,t),n.setStart(e.node,e.offset),n.setEnd(t.node,t.offset),g.selectRange(n)},g.getOuterText=function(e,t){var n=g.cloneSelected();return n?(n.collapse(!e),v(n,e,t).text):""},g.replaceKeyword=function(e,t,n,r,o,i){n||e.sort(function(e,t){return e[0].length-t[0].length});var a,l,s,c,u,d,f,p="(^|[\\s    ])",m=e.length,h=o?1:0,r=r||e[m-1][0].length;for(o&&r++,i=i||"",c=(a=g.getOuterText(!0,r)).length,a+=i,t&&(a+=g.getOuterText(!1,r));m--;)if(f=(d=e[m][0]).length,s=Math.max(0,c-f-h),u=-1,o?(l=a.substr(s).match(new RegExp(p+dt(d)+p)))&&(u=l.index+s+l[1].length):u=a.indexOf(d,s),-1<u&&u<=c&&c<=u+f+h)return u=c-u,g.selectOuterText(u,f-u-(/^\S/.test(i)?1:0)),g.insertHTML(e[m][1]),!0;return!1},g.compare=function(e,t){return t=t||g.selectedRange(),e&&t?0===e.compareBoundaryPoints(Range.END_TO_END,t)&&0===e.compareBoundaryPoints(Range.START_TO_START,t):!e&&!t},g.clear=function(){var e=o.getSelection();e&&(e.removeAllRanges?e.removeAllRanges():e.empty&&e.empty())}}var y,b,x,w=navigator.userAgent,vt=/iPhone|iPod|iPad| wosbrowser\//i.test(w),yt=(b=!!window.document.documentMode,D="-ms-ime-align"in document.documentElement.style,(A=document.createElement("div")).contentEditable=!0,"contentEditable"in document.documentElement&&"true"===A.contentEditable&&(A=/Opera Mobi|Opera Mini/i.test(w),/Android/i.test(w)&&(A=!0,/Safari/.test(w)&&(A=!(y=/Safari\/(\d+)/.exec(w))||!y[1]||y[1]<534)),/ Silk\//i.test(w)&&(A=!(y=/AppleWebKit\/(\d+)/.exec(w))||!y[1]||y[1]<534),vt&&(A=/OS [0-4](_\d)+ like Mac/i.test(w)),/Firefox/i.test(w)&&(A=!1),/OneBrowser/i.test(w)&&(A=!1),"UCWEB"===navigator.vendor&&(A=!1),!(A=!(!b&&!D)||A))),k=Object.hasOwnProperty,T=Object.setPrototypeOf,C=Object.isFrozen,S=Object.getPrototypeOf,E=Object.getOwnPropertyDescriptor,bt=Object.freeze,D=Object.seal,N=Object.create,A="undefined"!=typeof Reflect&&Reflect,M=(M=A.apply)||function(e,t,n){return e.apply(t,n)},bt=bt||function(e){return e},D=D||function(e){return e},R=(R=A.construct)||function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))},xt=_(Array.prototype.forEach),wt=_(Array.prototype.pop),kt=_(Array.prototype.push),Tt=_(String.prototype.toLowerCase),Ct=_(String.prototype.match),St=_(String.prototype.replace),Et=_(String.prototype.indexOf),Dt=_(String.prototype.trim),Nt=_(RegExp.prototype.test),At=(x=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return R(x,t)});function _(o){return function(e){for(var t=arguments.length,n=Array(1<t?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return M(o,e,n)}}function Mt(e,t){T&&T(e,null);for(var n=t.length;n--;){var r,o=t[n];"string"!=typeof o||(r=Tt(o))!==o&&(C(t)||(t[n]=r),o=r),e[o]=!0}return e}function Rt(e){var t=N(null),n=void 0;for(n in e)M(k,e,[n])&&(t[n]=e[n]);return t}function _t(e,t){for(;null!==e;){var n=E(e,t);if(n){if(n.get)return _(n.get);if("function"==typeof n.value)return _(n.value)}e=S(e)}return null}var Ot=bt(["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","section","select","shadow","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"]),Bt=bt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ft=bt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ht=bt(["animate","color-profile","cursor","discard","fedropshadow","feimage","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"]),It=bt(["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"]),zt=bt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Lt=bt(["#text"]),jt=bt(["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","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns"]),Pt=bt(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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","targetx","targety","transform","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"]),Ut=bt(["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"]),Wt=bt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qt=D(/\{\{[\s\S]*|[\s\S]*\}\}/gm),Vt=D(/<%[\s\S]*|[\s\S]*%>/gm),$t=D(/^data-[\-\w.\u00B7-\uFFFF]/),Gt=D(/^aria-[\-\w]+$/),Yt=D(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Kt=D(/^(?:\w+script|data):/i),Xt=D(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Qt="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 Zt(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var Jt=function t(e){function c(e){return t(e)}var l=0<arguments.length&&void 0!==e?e:"undefined"==typeof window?null:window;if(c.version="2.2.6",c.removed=[],!l||!l.document||9!==l.document.nodeType)return c.isSupported=!1,c;var s=l.document,i=l.document,u=l.DocumentFragment,n=l.HTMLTemplateElement,d=l.Node,a=l.Element,r=l.NodeFilter,o=l.NamedNodeMap,f=void 0===o?l.NamedNodeMap||l.MozNamedAttrMap:o,p=l.Text,m=l.Comment,h=l.DOMParser,e=l.trustedTypes,g=_t(o=a.prototype,"cloneNode"),v=_t(o,"nextSibling"),y=_t(o,"childNodes"),b=_t(o,"parentNode");"function"!=typeof n||(n=i.createElement("template")).content&&n.content.ownerDocument&&(i=n.content.ownerDocument);var x=function(e,t){if("object"!==(void 0===e?"undefined":Qt(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix",o="dompurify"+((n=t.currentScript&&t.currentScript.hasAttribute(r)?t.currentScript.getAttribute(r):n)?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(e,s),w=x&&ee?x.createHTML(""):"",k=i.implementation,T=i.createNodeIterator,C=i.getElementsByTagName,S=i.createDocumentFragment,E=s.importNode,D={};try{D=Rt(i).documentMode?i.documentMode:{}}catch(e){}var N={};function A(e){ce&&ce===e||(e=Rt(e=e&&"object"===(void 0===e?"undefined":Qt(e))?e:{}),z="ALLOWED_TAGS"in e?Mt({},e.ALLOWED_TAGS):L,j="ALLOWED_ATTR"in e?Mt({},e.ALLOWED_ATTR):P,le="ADD_URI_SAFE_ATTR"in e?Mt(Rt(se),e.ADD_URI_SAFE_ATTR):se,ie="ADD_DATA_URI_TAGS"in e?Mt(Rt(ae),e.ADD_DATA_URI_TAGS):ae,U="FORBID_TAGS"in e?Mt({},e.FORBID_TAGS):{},W="FORBID_ATTR"in e?Mt({},e.FORBID_ATTR):{},M="USE_PROFILES"in e&&e.USE_PROFILES,q=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,$=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=e.SAFE_FOR_TEMPLATES||!1,Y=e.WHOLE_DOCUMENT||!1,Q=e.RETURN_DOM||!1,Z=e.RETURN_DOM_FRAGMENT||!1,J=!1!==e.RETURN_DOM_IMPORT,ee=e.RETURN_TRUSTED_TYPE||!1,X=e.FORCE_BODY||!1,te=!1!==e.SANITIZE_DOM,ne=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,I=e.ALLOWED_URI_REGEXP||I,G&&(V=!1),Z&&(Q=!0),M&&(z=Mt({},[].concat(Zt(Lt))),j=[],!0===M.html&&(Mt(z,Ot),Mt(j,jt)),!0===M.svg&&(Mt(z,Bt),Mt(j,Pt),Mt(j,Wt)),!0===M.svgFilters&&(Mt(z,Ft),Mt(j,Pt),Mt(j,Wt)),!0===M.mathMl&&(Mt(z,It),Mt(j,Ut),Mt(j,Wt))),e.ADD_TAGS&&Mt(z=z===L?Rt(z):z,e.ADD_TAGS),e.ADD_ATTR&&Mt(j=j===P?Rt(j):j,e.ADD_ATTR),e.ADD_URI_SAFE_ATTR&&Mt(le,e.ADD_URI_SAFE_ATTR),ne&&(z["#text"]=!0),Y&&Mt(z,["html","head","body"]),z.table&&(Mt(z,["tbody"]),delete U.tbody),bt&&bt(e),ce=e)}c.isSupported=k&&void 0!==k.createHTMLDocument&&9!==D;var M,R=qt,_=Vt,O=$t,B=Gt,F=Kt,H=Xt,I=Yt,z=null,L=Mt({},[].concat(Zt(Ot),Zt(Bt),Zt(Ft),Zt(It),Zt(Lt))),j=null,P=Mt({},[].concat(Zt(jt),Zt(Pt),Zt(Ut),Zt(Wt))),U=null,W=null,q=!0,V=!0,$=!1,G=!1,Y=!1,K=!1,X=!1,Q=!1,Z=!1,J=!0,ee=!1,te=!0,ne=!0,re=!1,oe=Mt({},["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"]),ie=null,ae=Mt({},["audio","video","img","source","image","track"]),le=null,se=Mt({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ce=null,ue=i.createElement("form"),de=Mt({},["mi","mo","mn","ms","mtext"]),fe=Mt({},["foreignobject","desc","title","annotation-xml"]),pe=Mt({},Bt);Mt(pe,Ft),Mt(pe,Ht);var me=Mt({},It);function he(t){kt(c.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=w}catch(e){t.remove()}}}function ge(e,t){try{kt(c.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){kt(c.removed,{attribute:null,from:t})}t.removeAttribute(e)}function ve(e){var t=void 0,n=void 0;X?e="<remove></remove>"+e:n=(r=Ct(e,/^[\r\n\t ]+/))&&r[0];var r,o=x?x.createHTML(e):e;try{t=(new h).parseFromString(o,"text/html")}catch(e){}return t&&t.documentElement||((r=(t=k.createHTMLDocument("")).body).parentNode.removeChild(r.parentNode.firstElementChild),r.outerHTML=o),e&&n&&t.body.insertBefore(i.createTextNode(n),t.body.childNodes[0]||null),C.call(t,Y?"html":"body")[0]}function ye(e){return T.call(e.ownerDocument||e,e,r.SHOW_ELEMENT|r.SHOW_COMMENT|r.SHOW_TEXT,function(){return r.FILTER_ACCEPT},!1)}function be(e){return"object"===(void 0===d?"undefined":Qt(d))?e instanceof d:e&&"object"===(void 0===e?"undefined":Qt(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function xe(e,t,n){N[e]&&xt(N[e],function(e){e.call(c,t,n,ce)})}function we(e){var t;if(xe("beforeSanitizeElements",e,null),!((n=e)instanceof p||n instanceof m||"string"==typeof n.nodeName&&"string"==typeof n.textContent&&"function"==typeof n.removeChild&&n.attributes instanceof f&&"function"==typeof n.removeAttribute&&"function"==typeof n.setAttribute&&"string"==typeof n.namespaceURI&&"function"==typeof n.insertBefore))return he(e),1;if(Ct(e.nodeName,/[\u0080-\uFFFF]/))return he(e),1;var n=Tt(e.nodeName);if(xe("uponSanitizeElement",e,{tagName:n,allowedTags:z}),!be(e.firstElementChild)&&(!be(e.content)||!be(e.content.firstElementChild))&&Nt(/<[/\w]/g,e.innerHTML)&&Nt(/<[/\w]/g,e.textContent))return he(e),1;if(z[n]&&!U[n])return e instanceof a&&!function(e){var t=b(e);t&&t.tagName||(t={namespaceURI:Ee,tagName:"template"});var n=Tt(e.tagName),r=Tt(t.tagName);return e.namespaceURI===Se?t.namespaceURI===Ee?"svg"===n:t.namespaceURI===Ce?"svg"===n&&("annotation-xml"===r||de[r]):Boolean(pe[n]):e.namespaceURI===Ce?t.namespaceURI===Ee?"math"===n:t.namespaceURI===Se?"math"===n&&fe[r]:Boolean(me[n]):e.namespaceURI===Ee&&(t.namespaceURI!==Se||fe[r])&&(t.namespaceURI!==Ce||de[r])&&(r=Mt({},["title","style","font","a","script"]),!me[n]&&(r[n]||!pe[n]))}(e)||("noscript"===n||"noembed"===n)&&Nt(/<\/no(script|embed)/i,e.innerHTML)?(he(e),1):(G&&3===e.nodeType&&(t=e.textContent,t=St(t,R," "),t=St(t,_," "),e.textContent!==t&&(kt(c.removed,{element:e.cloneNode()}),e.textContent=t)),xe("afterSanitizeElements",e,null),0);if(ne&&!oe[n])for(var r=b(e),o=y(e),i=o.length-1;0<=i;--i)r.insertBefore(g(o[i],!0),v(e));return he(e),1}function ke(e,t,n){if(te&&("id"===t||"name"===t)&&(n in i||n in ue))return!1;if(!(V&&Nt(O,t)||q&&Nt(B,t))){if(!j[t]||W[t])return!1;if(!le[t]&&!Nt(I,St(n,H,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Et(n,"data:")||!ie[e])&&(!$||Nt(F,St(n,H,"")))&&n)return!1}return!0}function Te(e){var t,n=void 0,r=void 0;xe("beforeSanitizeAttributes",e,null);var o=e.attributes;if(o){for(var i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j},r=o.length;r--;){var a=(t=o[r]).name,l=t.namespaceURI,n=Dt(t.value),s=Tt(a);if(i.attrName=s,i.attrValue=n,i.keepAttr=!0,i.forceKeepAttr=void 0,xe("uponSanitizeAttribute",e,i),n=i.attrValue,!i.forceKeepAttr&&(ge(a,e),i.keepAttr))if(Nt(/\/>/i,n))ge(a,e);else if(G&&(n=St(n,R," "),n=St(n,_," ")),ke(e.nodeName.toLowerCase(),s,n))try{l?e.setAttributeNS(l,a,n):e.setAttribute(a,n),wt(c.removed)}catch(e){}}xe("afterSanitizeAttributes",e,null)}}Mt(me,zt);var Ce="http://www.w3.org/1998/Math/MathML",Se="http://www.w3.org/2000/svg",Ee="http://www.w3.org/1999/xhtml";return c.sanitize=function(e,t){var n,r=void 0,o=void 0,i=void 0;if("string"!=typeof(e=e||"\x3c!--\x3e")&&!be(e)){if("function"!=typeof e.toString)throw At("toString is not a function");if("string"!=typeof(e=e.toString()))throw At("dirty is not a string, aborting")}if(!c.isSupported){if("object"===Qt(l.toStaticHTML)||"function"==typeof l.toStaticHTML){if("string"==typeof e)return l.toStaticHTML(e);if(be(e))return l.toStaticHTML(e.outerHTML)}return e}if(K||A(t),c.removed=[],!(re="string"==typeof e?!1:re))if(e instanceof d)1===(t=(r=ve("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===t.nodeName||"HTML"===t.nodeName?r=t:r.appendChild(t);else{if(!Q&&!G&&!Y&&-1===e.indexOf("<"))return x&&ee?x.createHTML(e):e;if(!(r=ve(e)))return Q?null:w}r&&X&&he(r.firstChild);for(var a=ye(re?e:r);n=a.nextNode();)3===n.nodeType&&n===o||we(n)||(n.content instanceof u&&function e(t){var n,r=ye(t);for(xe("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)xe("uponSanitizeShadowNode",n,null),we(n)||(n.content instanceof u&&e(n.content),Te(n));xe("afterSanitizeShadowDOM",t,null)}(n.content),Te(n),o=n);if(o=null,re)return e;if(Q){if(Z)for(i=S.call(r.ownerDocument);r.firstChild;)i.appendChild(r.firstChild);else i=r;return J?E.call(s,i,!0):i}return e=Y?r.outerHTML:r.innerHTML,G&&(e=St(e,R," "),e=St(e,_," ")),x&&ee?x.createHTML(e):e},c.setConfig=function(e){A(e),K=!0},c.clearConfig=function(){ce=null,K=!1},c.isValidAttribute=function(e,t,n){return ce||A({}),ke(e=Tt(e),t=Tt(t),n)},c.addHook=function(e,t){"function"==typeof t&&(N[e]=N[e]||[],kt(N[e],t))},c.removeHook=function(e){N[e]&&wt(N[e])},c.removeHooks=function(e){N[e]&&(N[e]=[])},c.removeAllHooks=function(){N={}},c}(),en=window,tn=document,nn=/^image\/(p?jpe?g|gif|png|bmp)$/i;function rn(o,e){var a,x,u,i,l,f,d,s,r,c,p,t,m,h,g,v,y,b,n,w,k,T,C,S,E,D,N,A,M,R,_,O,B,F,H,I,z,L,j,P,U,W,q,V,$,G,Y,K,X,Q,Z,J,ee,te,ne,re,oe,ie,ae,le,se=this,ce={},ue=[],de=[],fe={},pe={},me={};se.commands=we(!0,{},e.commands||mt);var he=se.opts=we(!0,{},ut,e);se.opts.emoticons=e.emoticons||ut.emoticons,Array.isArray(he.allowedIframeUrls)||(he.allowedIframeUrls=[]),he.allowedIframeUrls.push("https://www.youtube-nocookie.com/embed/");var ge=Jt();function ve(e){return ge.sanitize(e,{ADD_TAGS:["iframe"],ADD_ATTR:["allowfullscreen","frameborder","target"]})}ge.addHook("uponSanitizeElement",function(e,t){var n=he.allowedIframeUrls;if("iframe"===t.tagName){for(var r=Fe(e,"src")||"",o=0;o<n.length;o++){var i=n[o];if(ye(i)&&r.substr(0,i.length)===i)return;if(i.test&&i.test(r))return}Ae(e)}}),ge.addHook("afterSanitizeAttributes",function(e){"target"in e&&Fe(e,"data-sce-target",Fe(e,"target")),He(e,"target")}),e=function(){o._sceditor=se,he.locale&&"en"!==he.locale&&M(),We(x=Ee("div",{className:"sceditor-container"}),o),je(x,"z-index",he.zIndex),n=o.required,o.required=!1;var e=rn.formats[he.format];a=e?new e:{},h=new ht(se),(he.plugins||"").split(",").forEach(function(e){h.register(e.trim())}),"init"in a&&a.init.call(se),F(),R(),A(),_(),O(),yt||se.toggleSourceMode(),Y();var t=function(){Be(en,"load",t),he.autofocus&&J(!!he.autofocusEnd),le(),X(),h.call("ready"),"onReady"in a&&a.onReady.call(se)};Oe(en,"load",t),"complete"===tn.readyState&&t()},M=function(){var e;(t=rn.locale[he.locale])||(e=he.locale.split("-"),t=rn.locale[e[0]]),t&&t.dateFormat&&(he.dateFormat=t.dateFormat)},A=function(){s=Ee("textarea"),i=Ee("iframe",{frameborder:0,allowfullscreen:!0}),he.startInSourceMode?(Ve(x,"sourceMode"),Ie(i)):(Ve(x,"wysiwygMode"),Ie(s)),he.spellcheck||Fe(x,"spellcheck","false"),"https:"===en.location.protocol&&Fe(i,"src","about:blank"),Me(x,i),Me(x,s),se.dimensions(he.width||Ye(o),he.height||Ke(o));var e=vt?" ios":"";(d=i.contentDocument).open(),d.write(pt("html",{attrs:' class="'+e+'"',spellcheck:he.spellcheck?"":'spellcheck="false"',charset:he.charset,style:he.style})),d.close(),f=d.body,l=i.contentWindow,se.readOnly(!!he.readOnly),vt&&(Ke(f,"100%"),Oe(f,"touchend",se.focus)),e=Fe(o,"tabindex"),Fe(s,"tabindex",e),Fe(i,"tabindex",e),m=new gt(l,null,ve),Ie(o),se.val(o.value),(e=he.placeholder||Fe(o,"placeholder"))&&(s.placeholder=e,Fe(f,"placeholder",e))},_=function(){he.autoUpdate&&(Oe(f,"blur",ae),Oe(s,"blur",ae)),null===he.rtl&&(he.rtl="rtl"===je(s,"direction")),se.rtl(!!he.rtl),he.autoExpand&&(Oe(f,"load",le,_e),Oe(f,"input keyup",le)),he.resizeEnabled&&B(),Fe(x,"id",he.id),se.emoticons(he.emoticonsEnabled)},O=function(){var e=o.form,t="compositionstart compositionend",n="keydown keyup keypress focus blur contextmenu input",r="onselectionchange"in d?"selectionchange":"keyup focus blur contextmenu mouseup touchend click";Oe(tn,"click",$),e&&(Oe(e,"reset",U),Oe(e,"submit",se.updateOriginal,_e)),Oe(window,"pagehide",se.updateOriginal),Oe(window,"pageshow",U),Oe(f,"keypress",P),Oe(f,"keydown",L),Oe(f,"keydown",j),Oe(f,"keyup",X),Oe(f,"blur",oe),Oe(f,"keyup",ie),Oe(f,"paste",H),Oe(f,"cut copy",I),Oe(f,t,q),Oe(f,r,Q),Oe(f,n,V),he.emoticonsCompat&&en.getSelection&&Oe(f,"keyup",te),Oe(f,"blur",function(){se.val()||Ve(f,"placeholder")}),Oe(f,"focus",function(){$e(f,"placeholder")}),Oe(s,"blur",oe),Oe(s,"keyup",ie),Oe(s,"keydown",L),Oe(s,t,q),Oe(s,n,V),Oe(d,"mousedown",W),Oe(d,r,Q),Oe(d,"keyup",X),Oe(x,"selectionchanged",Z),Oe(x,"selectionchanged",Y),Oe(x,"selectionchanged valuechanged nodechanged pasteraw paste",V)},R=function(){var i,a=se.commands,l=(he.toolbarExclude||"").split(","),e=he.toolbar.split("|");u=Ee("div",{className:"sceditor-toolbar",unselectable:"on"}),he.icons in rn.icons&&(E=new rn.icons[he.icons]),Te(e,function(e,t){i=Ee("div",{className:"sceditor-group"}),Te(t.split(","),function(e,t){var n,r,o=a[t];!o||-1<l.indexOf(t)||(n=o.shortcut,r=pt("toolbarButton",{name:t,dispName:se._(o.name||o.tooltip||t)},!0).firstChild,E&&E.create&&E.create(t)&&(We(E.create(t),r.firstChild),Ve(r,"has-icon")),r._sceTxtMode=!!o.txtExec,r._sceWysiwygMode=!!o.exec,Ge(r,"disabled",!o.exec),Oe(r,"click",function(e){qe(r,"disabled")||N(r,o),Y(),e.preventDefault()}),Oe(r,"mousedown",function(e){se.closeDropDown(),e.preventDefault()}),o.tooltip&&Fe(r,"title",se._(o.tooltip)+(n?" ("+n+")":"")),n&&se.addShortcut(n,t),o.state?de.push({name:t,state:o.state}):ye(o.exec)&&de.push({name:t,state:o.exec}),Me(i,r),pe[t]=r)}),i.firstChild&&Me(u,i)}),Me(he.toolbarContainer||x,u)},B=function(){function t(e){r="touchmove"===e.type?(e=en.event,s=e.changedTouches[0].pageX,e.changedTouches[0].pageY):(s=e.pageX,e.pageY);var t=u+(r-l),n=m?c-(s-a):c+(s-a);0<y&&y<n&&(n=y),0<v&&n<v&&(n=v),he.resizeWidth||(n=!1),0<g&&g<t&&(t=g),0<h&&t<h&&(t=h),he.resizeHeight||(t=!1),(n||t)&&se.dimensions(n,t),e.preventDefault()}var r,e=Ee("div",{className:"sceditor-grip"}),n=Ee("div",{className:"sceditor-resize-cover"}),o="touchmove mousemove",i="touchcancel touchend mouseup",a=0,l=0,s=0,c=0,u=0,d=Ye(x),f=Ke(x),p=!1,m=se.rtl(),h=he.resizeMinHeight||f/1.5,g=he.resizeMaxHeight||2.5*f,v=he.resizeMinWidth||d/1.25,y=he.resizeMaxWidth||1.25*d,b=function(e){p&&(p=!1,Ie(n),$e(x,"resizing"),Be(tn,o,t),Be(tn,i,b),e.preventDefault())};E&&E.create&&(d=E.create("grip"))&&(Me(e,d),Ve(e,"has-icon")),Me(x,e),Me(x,n),Ie(n),Oe(e,"touchstart mousedown",function(e){l="touchstart"===e.type?(e=en.event,a=e.touches[0].pageX,e.touches[0].pageY):(a=e.pageX,e.pageY),c=Ye(x),u=Ke(x),p=!0,Ve(x,"resizing"),ze(n),Oe(tn,o,t),Oe(tn,i,b),e.preventDefault()})},F=function(){var e=he.emoticons,n=he.emoticonsRoot||"";Te(me=e?we({},e.more,e.dropdown,e.hidden):me,function(e,t){me[e]=pt("emoticon",{key:e,url:n+(t.url||t),tooltip:t.tooltip||e}),he.emoticonsEnabled&&ue.push(Ee("img",{src:n+(t.url||t)}))})},J=function(e){var t,n=f.firstChild;if(Qe(x)){if(se.sourceMode())return t=e?s.value.length:0,void s.setSelectionRange(t,t);if(at(f),e)for((n=f.lastChild)||(n=Ee("p",{},d),Me(f,n));n.lastChild;)Ue(n=n.lastChild,"br")&&n.previousSibling&&(n=n.previousSibling);t=d.createRange(),rt(n)?t.selectNodeContents(n):(t.setStartBefore(n),e&&t.setStartAfter(n)),t.collapse(!e),m.selectRange(t),y=t,e&&(f.scrollTop=f.scrollHeight),se.focus()}},se.readOnly=function(e){return"boolean"!=typeof e?!s.readonly:(f.contentEditable=!e,s.readonly=!e,G(e),se)},se.rtl=function(e){var t=e?"rtl":"ltr";return"boolean"!=typeof e?"rtl"===Fe(s,"dir"):(Fe(f,"dir",t),Fe(s,"dir",t),$e(x,"rtl"),$e(x,"ltr"),Ve(x,t),E&&E.rtl&&E.rtl(e),se)},G=function(n){var r=se.inSourceMode()?"_sceTxtMode":"_sceWysiwygMode";Te(pe,function(e,t){Ge(t,"disabled",n||!t[r])})},se.width=function(e,t){return e||0===e?(se.dimensions(e,null,t),se):Ye(x)},se.dimensions=function(e,t,n){return t=!(!t&&0!==t)&&t,!1===(e=!(!e&&0!==e)&&e)&&!1===t?{width:se.width(),height:se.height()}:(!1!==e&&(!1!==n&&(he.width=e),Ye(x,e)),!1!==t&&(!1!==n&&(he.height=t),Ke(x,t)),se)},se.height=function(e,t){return e||0===e?(se.dimensions(null,e,t),se):Ke(x)},se.maximize=function(e){var t="sceditor-maximize";return be(e)?qe(x,t):((e=!!e)&&(C=en.pageYOffset),Ge(tn.documentElement,t,e),Ge(tn.body,t,e),Ge(x,t,e),se.width(e?"100%":he.width,!1),se.height(e?"100%":he.height,!1),e||en.scrollTo(0,C),le(),se)},le=function(){he.autoExpand&&!T&&(T=setTimeout(se.expandToContent,200))},se.expandToContent=function(e){var t,n;se.maximize()||(clearTimeout(T),T=!1,k||(t=he.resizeMinHeight||he.height||Ke(o),k={min:t,max:he.resizeMaxHeight||2*t}),(n=tn.createRange()).selectNodeContents(f),t=n.getBoundingClientRect(),n=d.documentElement.clientHeight-1,t=t.bottom-t.top,n=se.height()+1+(t-n),e||-1===k.max||(n=Math.min(n,k.max)),se.height(Math.ceil(Math.max(n,k.min))))},se.destroy=function(){var e;h&&(h.destroy(),h=m=null,r&&Ae(r),Be(tn,"click",$),(e=o.form)&&(Be(e,"reset",U),Be(e,"submit",se.updateOriginal,_e)),Be(window,"pagehide",se.updateOriginal),Be(window,"pageshow",U),Ae(s),Ae(u),Ae(x),delete o._sceditor,ze(o),o.required=n)},se.createDropDown=function(e,t,n){t="sceditor-"+t,se.closeDropDown(),r&&qe(r,t)||(e=we({top:e.offsetTop,left:e.offsetLeft,marginTop:e.clientHeight},he.dropDownCss),je(r=Ee("div",{className:"sceditor-dropdown "+t}),e),Me(r,n),Me(x,r),Oe(r,"click focusin",function(e){e.stopPropagation()}),!r||(n=Re(r,"input,textarea")[0])&&n.focus())},$=function(e){3!==e.which&&r&&!e.defaultPrevented&&(ae(),se.closeDropDown())},I=function(e){var t=m.selectedRange();if(t){for(var n,r,o=Ee("div",{},d),i=t.commonAncestorContainer;i&&ot(i,!0);)i.nodeType===Ce&&(r=i.cloneNode(),o.firstChild&&Me(r,o.firstChild),Me(o,r),n=n||r),i=i.parentNode;Me(n||o,t.cloneContents()),at(o),e.clipboardData.setData("text/html",o.innerHTML),Te(Re(o,"p"),function(e,t){nt(t,"div")}),Te(Re(o,"br"),function(e,t){t.nextSibling&&ot(t.nextSibling,!0)||Ae(t)}),Me(f,o),e.clipboardData.setData("text/plain",o.innerText),Ae(o),"cut"===e.type&&t.deleteContents(),e.preventDefault()}},H=function(e){var t,n,r=f,o=e.clipboardData;if(o){var i={},a=o.types,l=o.items;e.preventDefault();for(var s=0;s<a.length;s++){if(a.indexOf("text/html")<0&&en.FileReader&&l&&nn.test(l[s].type))return t=o.items[s].getAsFile(),n=void 0,(n=new FileReader).onload=function(e){z({html:'<img src="'+e.target.result+'" />'})},void n.readAsDataURL(t);i[a[s]]=o.getData(a[s])}i.text=i["text/plain"],i.html=ve(i["text/html"]),z(i)}else if(!S){var c=r.scrollTop;for(m.saveRange(),S=tn.createDocumentFragment();r.firstChild;)Me(S,r.firstChild);setTimeout(function(){var e=r.innerHTML;r.innerHTML="",Me(r,S),r.scrollTop=c,S=!1,m.restoreRange(),z({html:ve(e)})},0)}},z=function(e){var t=Ee("div",{},d);h.call("pasteRaw",e),Xe(x,"pasteraw",e),e.html?(t.innerHTML=ve(e.html),it(t)):t.innerHTML=ft(e.text||""),e={val:t.innerHTML},"fragmentToSource"in a&&(e.val=a.fragmentToSource(e.val,d,g)),h.call("paste",e),Xe(x,"paste",e),"fragmentToHtml"in a&&(e.val=a.fragmentToHtml(e.val,g)),h.call("pasteHtml",e),t=m.getFirstBlockParent(),se.wysiwygEditorInsertHtml(e.val,null,!0),function e(t){if(t.nodeType===Ce){for(var n=t.parentNode,r=t.tagName,o=t.childNodes.length;o--;)e(t.childNodes[o]);if(ot(t)){for(o=t.style.length;o--;){var i=t.style[o];je(n,i)===je(t,i)&&t.style.removeProperty(i)}if(!t.style.length)if(He(t,"style"),"FONT"===r&&(je(t,"fontFamily").toLowerCase()===je(n,"fontFamily").toLowerCase()&&He(t,"face"),je(t,"color")===je(n,"color")&&He(t,"color"),je(t,"fontSize")===je(n,"fontSize")&&He(t,"size")),!t.attributes.length&&/SPAN|FONT/.test(r))ct(t);else if(/B|STRONG|EM|SPAN|FONT/.test(r))for(var a=/B|STRONG/.test(r),l="EM"===r;n&&ot(n)&&(!a||/bold|700/i.test(je(n,"fontWeight")))&&(!l||"italic"===je(n,"fontStyle"));){if((n.tagName===r||a&&/B|STRONG/.test(n.tagName))&&st(n,t)){ct(t);break}n=n.parentNode}var s=t.nextSibling;s&&s.tagName===r&&st(s,t)&&(Me(t,s),ct(s))}}}(t)},se.closeDropDown=function(e){r&&(Ae(r),r=null),!0===e&&se.focus()},se.wysiwygEditorInsertHtml=function(e,t,n){var r=Ke(i);se.focus(),!n&&Ne(v,"code")||(m.insertHTML(e,t),m.saveRange(),D(),it(f),ze(n=Re(f,"#sceditor-end-marker")[0]),e=f.scrollTop,t=lt(n).top+1.5*n.offsetHeight-r,Ie(n),(e<t||t+r<e)&&(f.scrollTop=t),re(!1),m.restoreRange(),X())},se.wysiwygEditorInsertText=function(e,t){se.wysiwygEditorInsertHtml(ft(e),ft(t))},se.insertText=function(e,t){return se.inSourceMode()?se.sourceEditorInsertText(e,t):se.wysiwygEditorInsertText(e,t),se},se.sourceEditorInsertText=function(e,t){var n,r=s.selectionStart,o=s.selectionEnd,i=s.scrollTop;s.focus(),n=s.value,t&&(e+=n.substring(r,o)+t),s.value=n.substring(0,r)+e+n.substring(o,n.length),s.selectionStart=r+e.length-(t?t.length:0),s.selectionEnd=s.selectionStart,s.scrollTop=i,s.focus(),re()},se.getRangeHelper=function(){return m},se.sourceEditorCaret=function(e){return s.focus(),e?(s.selectionStart=e.start,s.selectionEnd=e.end,this):{start:s.selectionStart,end:s.selectionEnd}},se.val=function(e,t){return ye(e)?(se.inSourceMode()?se.setSourceEditorValue(e):(!1!==t&&"toHtml"in a&&(e=a.toHtml(e)),se.setWysiwygEditorValue(e)),se):se.inSourceMode()?se.getSourceEditorValue(!1):se.getWysiwygEditorValue(t)},se.insert=function(e,t,n,r,o){return se.inSourceMode()?se.sourceEditorInsertText(e,t):(t&&(i=m.selectedHtml(),e+=(i=!1!==n&&"fragmentToSource"in a?a.fragmentToSource(i,d,g):i)+t),!1!==n&&"fragmentToHtml"in a&&(e=a.fragmentToHtml(e,g)),!1!==n&&!0===o&&(e=e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")),se.wysiwygEditorInsertHtml(e)),se;var i},se.getWysiwygEditorValue=function(e){for(var t,n=Ee("div",{},d),r=f.childNodes,o=0;o<r.length;o++)Me(n,r[o].cloneNode(!0));return Me(f,n),it(n),Ae(n),t=n.innerHTML,!1!==e&&a.hasOwnProperty("toSource")?a.toSource(t,d):t},se.getBody=function(){return f},se.getContentAreaContainer=function(){return i},se.getSourceEditorValue=function(e){var t=s.value;return!1!==e&&"toHtml"in a?a.toHtml(t):t},se.setWysiwygEditorValue=function(e){e=e||"<p><br /></p>",f.innerHTML=ve(e),D(),X(),re(),le()},se.setSourceEditorValue=function(e){s.value=e,re()},se.updateOriginal=function(){o.value=se.val()},D=function(){var e,l,s,c,t,u,d;he.emoticonsEnabled&&(e=f,l=me,s=he.emoticonsCompat,c=e.ownerDocument,t="(^|\\s| | | | |$)",u=[],d={},De(e,"code")||(Te(l,function(e){d[e]=new RegExp(t+dt(e)+t),u.push(e)}),u.sort(function(e,t){return t.length-e.length}),function e(t){for(t=t.firstChild;t;){if(t.nodeType!==Ce||Ue(t,"code")||e(t),t.nodeType===Se)for(var n=0;n<u.length;n++){var r,o=t.nodeValue,i=u[n],a=s?o.search(d[i]):o.indexOf(i);-1<a&&(r=o.indexOf(i,a),a=et(l[i],c),i=o.substr(r+i.length),a.appendChild(c.createTextNode(i)),t.nodeValue=o.substr(0,r),t.parentNode.insertBefore(a,t.nextSibling))}t=t.nextSibling}}(e)))},se.inSourceMode=function(){return qe(x,"sourceMode")},se.sourceMode=function(e){var t=se.inSourceMode();return"boolean"!=typeof e?t:((t&&!e||!t&&e)&&se.toggleSourceMode(),se)},se.toggleSourceMode=function(){var e=se.inSourceMode();!yt&&e||(e||(m.saveRange(),m.clear()),y=null,se.blur(),e?se.setWysiwygEditorValue(se.getSourceEditorValue()):se.setSourceEditorValue(se.getWysiwygEditorValue()),Le(s),Le(i),Ge(x,"wysiwygMode",e),Ge(x,"sourceMode",!e),G(),Y())},K=function(){return s.focus(),s.value.substring(s.selectionStart,s.selectionEnd)},N=function(e,t){se.inSourceMode()?t.txtExec&&(Array.isArray(t.txtExec)?se.sourceEditorInsertText.apply(se,t.txtExec):t.txtExec.call(se,e,K())):t.exec&&(xe(t.exec)?t.exec.call(se,e):se.execCommand(t.exec,t.hasOwnProperty("execParam")?t.execParam:null))},se.execCommand=function(e,t){var n=!1,r=se.commands[e];if(se.focus(),!Ne(m.parentNode(),"code")){try{n=d.execCommand(e,!1,t)}catch(e){}!n&&r&&r.errorMessage&&alert(se._(r.errorMessage)),Y()}},Q=function(){function e(){if(l.getSelection()&&l.getSelection().rangeCount<=0)y=null;else if(m&&!m.compare(y)){if((y=m.cloneSelected())&&y.collapsed){var e=y.startContainer,t=y.startOffset;for(t&&e.nodeType!==Se&&(e=e.childNodes[t]);e&&e.parentNode!==f;)e=e.parentNode;e&&ot(e,!0)&&(m.saveRange(),n=d,Ze(f,function(e){ot(e,!0)?(r||e.nodeType===Se?/\S/.test(e.nodeValue):!Ue(e,".sceditor-ignore"))&&(r||We(r=Ee("p",{},n),e),Me(r,e)):r=null},!1,!0),m.restoreRange())}Xe(x,"selectionchanged")}var n,r;b=!1}b||(b=!0,"onselectionchange"in d?e():setTimeout(e,100))},Z=function(){var e,t=m.parentNode();g!==t&&(e=g,g=t,v=m.getFirstBlockParent(t),Xe(x,"nodechanged",{oldNode:e,newNode:g}))},se.currentNode=function(){return g},se.currentBlockNode=function(){return v},Y=function(){var e,t,n="active",r=d,o=se.sourceMode();if(se.readOnly())Te(Re(u,n),function(e,t){$e(t,n)});else{o||(t=m.parentNode(),e=m.getFirstBlockParent(t));for(var i=0;i<de.length;i++){var a=0,l=pe[de[i].name],s=de[i].state,c=o&&!l._sceTxtMode||!o&&!l._sceWysiwygMode;if(ye(s)){if(!o)try{-1<(a=r.queryCommandEnabled(s)?0:-1)&&(a=r.queryCommandState(s)?1:0)}catch(e){}}else c||(a=s.call(se,t,e));Ge(l,"disabled",c||a<0),Ge(l,n,0<a)}E&&E.update&&E.update(o,t,e)}},P=function(e){var t,n,r;e.defaultPrevented||(se.closeDropDown(),13!==e.which||!Ue(v,"li,ul,ol")&&tt(v)&&(t=Ee("br",{},d),m.insertNode(t),(r=(n=t.parentNode).lastChild)&&r.nodeType===Se&&""===r.nodeValue&&(Ae(r),r=n.lastChild),!ot(n,!0)&&r===t&&ot(t.previousSibling)&&m.insertHTML("<br>"),e.preventDefault()))},X=function(){Je(f,function(e){if(e.nodeType===Ce&&!/inline/.test(je(e,"display"))&&!Ue(e,".sceditor-nlf")&&tt(e)){var t=Ee("p",{},d);return t.className="sceditor-nlf",t.innerHTML="<br />",Me(f,t),!1}if(3===e.nodeType&&!/^\s*$/.test(e.nodeValue)||Ue(e,"br"))return!1})},U=function(){se.val(o.value)},W=function(){se.closeDropDown()},se._=function(){var n=arguments;return t&&t[n[0]]&&(n[0]=t[n[0]]),n[0].replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[+t+1]?n[+t+1]:"{"+t+"}"})},V=function(t){h&&h.call(t.type+"Event",t,se);var e=(t.target===s?"scesrc":"scewys")+t.type;ce[e]&&ce[e].forEach(function(e){e.call(se,t)})},se.bind=function(e,t,n,r){for(var o,i,a=(e=e.split(" ")).length;a--;)xe(t)&&(o="scewys"+e[a],i="scesrc"+e[a],n||(ce[o]=ce[o]||[],ce[o].push(t)),r||(ce[i]=ce[i]||[],ce[i].push(t)),"valuechanged"===e[a]&&(re.hasHandler=!0));return se},se.unbind=function(e,t,n,r){for(var o=(e=e.split(" ")).length;o--;)xe(t)&&(n||ke(ce["scewys"+e[o]]||[],t),r||ke(ce["scesrc"+e[o]]||[],t));return se},se.blur=function(e,t,n){return xe(e)?se.bind("blur",e,t,n):(se.sourceMode()?s:f).blur(),se},se.focus=function(e,t,n){if(xe(e))se.bind("focus",e,t,n);else if(se.inSourceMode())s.focus();else{if(Re(d,":focus").length)return;var r,n=m.selectedRange();y||J(!0),n&&1===n.endOffset&&n.collapsed&&(r=n.endContainer)&&1===r.childNodes.length&&Ue(r.firstChild,"br")&&(n.setStartBefore(r.firstChild),n.collapse(!0),m.selectRange(n)),l.focus(),f.focus()}return Y(),se},se.keyDown=function(e,t,n){return se.bind("keydown",e,t,n)},se.keyPress=function(e,t,n){return se.bind("keypress",e,t,n)},se.keyUp=function(e,t,n){return se.bind("keyup",e,t,n)},se.nodeChanged=function(e){return se.bind("nodechanged",e,!1,!0)},se.selectionChanged=function(e){return se.bind("selectionchanged",e,!1,!0)},se.valueChanged=function(e,t,n){return se.bind("valuechanged",e,t,n)},ee=function(e){var n=0,r=se.emoticonsCache,t=String.fromCharCode(e.which);Ne(v,"code")||(r||(r=[],Te(me,function(e,t){r[n++]=[e,t]}),r.sort(function(e,t){return e[0].length-t[0].length}),se.emoticonsCache=r,se.longestEmoticonCode=r[r.length-1][0].length),m.replaceKeyword(se.emoticonsCache,!0,!0,se.longestEmoticonCode,he.emoticonsCompat,t)&&(he.emoticonsCompat&&/^\s$/.test(t)||e.preventDefault()))},te=function(){!function(e,t){var n=/[^\s\xA0\u2002\u2003\u2009]+/,r=e&&Re(e,"img[data-sceditor-emoticon]");if(e&&r.length)for(var o=0;o<r.length;o++){var i,a,l,s,c=r[o],u=c.parentNode,d=c.previousSibling,f=c.nextSibling;(d&&n.test(d.nodeValue.slice(-1))||f&&n.test((f.nodeValue||"")[0]))&&(a=-1,l=(i=t.cloneSelected()).startContainer,s=d.nodeValue||"",s+=Pe(c,"sceditor-emoticon"),l===f&&(a=s.length+i.startOffset),l===e&&e.childNodes[i.startOffset]===f&&(a=s.length),l===d&&(a=i.startOffset),(f=f&&f.nodeType===Se?f:u.insertBefore(u.ownerDocument.createTextNode(""),f)).insertData(0,s),Ae(d),Ae(c),-1<a&&(i.setStart(f,a),i.collapse(!0),t.selectRange(i)))}}(v,m)},se.emoticons=function(e){return e||!1===e?((he.emoticonsEnabled=e)?(Oe(f,"keypress",ee),se.sourceMode()||(m.saveRange(),D(),re(!1),m.restoreRange())):(Te(Re(f,"img[data-sceditor-emoticon]"),function(e,t){var n=Pe(t,"sceditor-emoticon"),n=d.createTextNode(n);t.parentNode.replaceChild(n,t)}),Be(f,"keypress",ee),re()),se):he.emoticonsEnabled},se.css=function(e){return w||(w=Ee("style",{id:"inline"},d),Me(d.head,w)),ye(e)?(w.styleSheet?w.styleSheet.cssText=e:w.innerHTML=e,se):w.styleSheet?w.styleSheet.cssText:w.innerHTML},L=function(e){var t=[],n={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|","[":"{","]":"}"},r={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},o=e.which,i={8:"backspace",9:"tab",13:"enter",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"win",92:"win",93:"select",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[o]||String.fromCharCode(o).toLowerCase();(e.ctrlKey||e.metaKey)&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&(t.push("shift"),r[o]?i=r[o]:n[i]&&(i=n[i])),i&&(o<16||18<o)&&t.push(i),t=t.join("+"),fe[t]&&!1===fe[t].call(se)&&(e.stopPropagation(),e.preventDefault())},se.addShortcut=function(e,t){return e=e.toLowerCase(),ye(t)?fe[e]=function(){return N(pe[t],se.commands[t]),!1}:fe[e]=t,se},se.removeShortcut=function(e){return delete fe[e.toLowerCase()],se},j=function(e){var t,n,r;if(!he.disableBlockRemove&&8===e.which&&(n=m.selectedRange())&&(t=n.startContainer,0===n.startOffset&&(r=ne())&&!Ue(r,"body"))){for(;t!==r;){for(;t.previousSibling;)if((t=t.previousSibling).nodeType!==Se||t.nodeValue)return;if(!(t=t.parentNode))return}se.clearBlockFormatting(r),e.preventDefault()}},ne=function(){for(var e=v;!tt(e)||ot(e,!0);)if(!(e=e.parentNode)||Ue(e,"body"))return;return e},se.clearBlockFormatting=function(e){return!(e=e||ne())||Ue(e,"body")||(m.saveRange(),e.className="",Fe(e,"style",""),Ue(e,"p,div,td")||nt(e,"p"),m.restoreRange()),se},re=function(e){var t,n,r;h&&(h.hasHandler("valuechangedEvent")||re.hasHandler)&&(r=!(n=se.sourceMode())&&m.hasSelection(),e=(c=!1)!==e&&!d.getElementById("sceditor-start-marker"),p&&(clearTimeout(p),p=!1),r&&e&&m.saveRange(),(t=n?s.value:f.innerHTML)!==re.lastVal&&(re.lastVal=t,Xe(x,"valuechanged",{rawValue:n?se.val():t})),r&&e&&m.removeMarkers())},oe=function(){p&&re()},ie=function(e){var t=e.which,e=13===(n=ie.lastChar)||32===n,n=8===n||46===n;ie.lastChar=t,c||(13===t||32===t?e?ie.triggerNext=!0:re():8===t||46===t?n?ie.triggerNext=!0:re():ie.triggerNext&&(re(),ie.triggerNext=!1),clearTimeout(p),p=setTimeout(function(){c||re()},1500))},q=function(e){(c=/start/i.test(e.type))||re()},ae=function(){se.updateOriginal()},e()}rn.locale={},rn.formats={},rn.icons={},rn.command={get:function(e){return mt[e]||null},set:function(e,t){return!(!e||!t)&&((t=we(mt[e]||{},t)).remove=function(){rn.command.remove(e)},mt[e]=t,this)},remove:function(e){return mt[e]&&delete mt[e],this}},window.sceditor={command:rn.command,commands:mt,defaultOptions:ut,ios:vt,isWysiwygSupported:yt,regexEscape:dt,escapeEntities:ft,escapeUriScheme:function(e){var t,n=window.location;return e&&/^[^\/]*:/i.test(e)&&!m.test(e)?((t=n.pathname.split("/")).pop(),n.protocol+"//"+n.host+t.join("/")+"/"+e):e},dom:{css:je,attr:Fe,removeAttr:He,is:Ue,closest:Ne,width:Ye,height:Ke,traverse:Ze,rTraverse:Je,parseHTML:et,hasStyling:tt,convertElement:nt,blockLevelList:c,canHaveChildren:rt,isInline:ot,copyCSS:function(e,t){t.style&&e.style&&(t.style.cssText=e.style.cssText+t.style.cssText)},fixNesting:it,findCommonAncestor:function(e,t){for(;e=e.parentNode;)if(e!==t&&e.contains&&e.contains(t))return e},getSibling:u,removeWhiteSpace:at,extractContents:f,getOffset:lt,getStyle:p,hasStyle:function(e,t,n){return!!(t=p(e,t))&&(!n||t===n||Array.isArray(n)&&-1<n.indexOf(t))}},locale:rn.locale,icons:rn.icons,utils:{each:Te,isEmptyObject:t,extend:we},plugins:ht.plugins,formats:rn.formats,create:function(e,t){t=t||{},De(e,".sceditor-container")||(t.runWithoutWysiwygSupport||yt)&&new rn(e,t)},instance:function(e){return e._sceditor}},r.default.sceditor=window.sceditor,r.default.fn.sceditor=function(e){var t,n=[];return this.each(function(){t=this._sceditor,"state"===e?n.push(!!t):"instance"===e?n.push(t):t||r.default.sceditor.create(this,e)}),n.length?1===n.length?n[0]:n:this}}(),function(e){"use strict";var d=e.escapeEntities,a=e.escapeUriScheme,f=e.dom,t=e.utils,p=f.css,m=f.attr,h=f.is,n=t.extend,g=t.each,v="data-sceditor-emoticon",i=e.command.get,y={always:1,never:2,auto:3},r={bold:{txtExec:["[b]","[/b]"]},italic:{txtExec:["[i]","[/i]"]},underline:{txtExec:["[u]","[/u]"]},strike:{txtExec:["[s]","[/s]"]},subscript:{txtExec:["[sub]","[/sub]"]},superscript:{txtExec:["[sup]","[/sup]"]},left:{txtExec:["[left]","[/left]"]},center:{txtExec:["[center]","[/center]"]},right:{txtExec:["[right]","[/right]"]},justify:{txtExec:["[justify]","[/justify]"]},font:{txtExec:function(e){var t=this;i("font")._dropDown(t,e,function(e){t.insertText("[font="+e+"]","[/font]")})}},size:{txtExec:function(e){var t=this;i("size")._dropDown(t,e,function(e){t.insertText("[size="+e+"]","[/size]")})}},color:{txtExec:function(e){var t=this;i("color")._dropDown(t,e,function(e){t.insertText("[color="+e+"]","[/color]")})}},bulletlist:{txtExec:function(e,t){this.insertText("[ul]\n[li]"+t.split(/\r?\n/).join("[/li]\n[li]")+"[/li]\n[/ul]")}},orderedlist:{txtExec:function(e,t){this.insertText("[ol]\n[li]"+t.split(/\r?\n/).join("[/li]\n[li]")+"[/li]\n[/ol]")}},table:{txtExec:["[table][tr][td]","[/td][/tr][/table]"]},horizontalrule:{txtExec:["[hr]"]},code:{txtExec:["[code]","[/code]"]},image:{txtExec:function(e,t){var o=this;i("image")._dropDown(o,e,t,function(e,t,n){var r="";t&&(r+=" width="+t),n&&(r+=" height="+n),o.insertText("[img"+r+"]"+e+"[/img]")})}},email:{txtExec:function(e,n){var r=this;i("email")._dropDown(r,e,function(e,t){r.insertText("[email="+e+"]"+(t||n||e)+"[/email]")})}},link:{txtExec:function(e,n){var r=this;i("link")._dropDown(r,e,function(e,t){r.insertText("[url="+e+"]"+(t||n||e)+"[/url]")})}},quote:{txtExec:["[quote]","[/quote]"]},youtube:{txtExec:function(e){var t=this;i("youtube")._dropDown(t,e,function(e){t.insertText("[youtube]"+e+"[/youtube]")})}},rtl:{txtExec:["[rtl]","[/rtl]"]},ltr:{txtExec:["[ltr]","[/ltr]"]}},b={b:{tags:{b:null,strong:null},styles:{"font-weight":["bold","bolder","401","700","800","900"]},format:"[b]{0}[/b]",html:"<strong>{0}</strong>"},i:{tags:{i:null,em:null},styles:{"font-style":["italic","oblique"]},format:"[i]{0}[/i]",html:"<em>{0}</em>"},u:{tags:{u:null},styles:{"text-decoration":["underline"]},format:"[u]{0}[/u]",html:"<u>{0}</u>"},s:{tags:{s:null,strike:null},styles:{"text-decoration":["line-through"]},format:"[s]{0}[/s]",html:"<s>{0}</s>"},sub:{tags:{sub:null},format:"[sub]{0}[/sub]",html:"<sub>{0}</sub>"},sup:{tags:{sup:null},format:"[sup]{0}[/sup]",html:"<sup>{0}</sup>"},font:{tags:{font:{face:null}},styles:{"font-family":null},quoteType:y.never,format:function(e,t){var n;return"[font="+k(n=!h(e,"font")||!(n=m(e,"face"))?p(e,"font-family"):n)+"]"+t+"[/font]"},html:'<font face="{defaultattr}">{0}</font>'},size:{tags:{font:{size:null}},styles:{"font-size":null},format:function(e,t){var n=m(e,"size"),r=2;return-1<(n=n||p(e,"fontSize")).indexOf("px")?((n=+n.replace("px",""))<12&&(r=1),15<n&&(r=3),17<n&&(r=4),23<n&&(r=5),31<n&&(r=6),47<n&&(r=7)):r=n,"[size="+r+"]"+t+"[/size]"},html:'<font size="{defaultattr}">{!0}</font>'},color:{tags:{font:{color:null}},styles:{color:null},quoteType:y.never,format:function(e,t){var n;return"[color="+s(n=!h(e,"font")||!(n=m(e,"color"))?e.style.color||p(e,"color"):n)+"]"+t+"[/color]"},html:function(e,t,n){return'<font color="'+d(s(t.defaultattr),!0)+'">'+n+"</font>"}},ul:{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ul]{0}[/ul]",html:"<ul>{0}</ul>"},list:{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:"<ul>{0}</ul>"},ol:{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ol]{0}[/ol]",html:"<ol>{0}</ol>"},li:{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[li]{0}[/li]",html:"<li>{0}</li>"},"*":{isInline:!1,closedBy:["/ul","/ol","/list","*","li"],html:"<li>{0}</li>"},table:{tags:{table:null},isInline:!1,isHtmlInline:!0,skipLastLineBreak:!0,format:"[table]{0}[/table]",html:"<table>{0}</table>"},tr:{tags:{tr:null},isInline:!1,skipLastLineBreak:!0,format:"[tr]{0}[/tr]",html:"<tr>{0}</tr>"},th:{tags:{th:null},allowsEmpty:!0,isInline:!1,format:"[th]{0}[/th]",html:"<th>{0}</th>"},td:{tags:{td:null},allowsEmpty:!0,isInline:!1,format:"[td]{0}[/td]",html:"<td>{0}</td>"},emoticon:{allowsEmpty:!0,tags:{img:{src:null,"data-sceditor-emoticon":null}},format:function(e,t){return m(e,v)+t},html:"{0}"},hr:{tags:{hr:null},allowsEmpty:!0,isSelfClosing:!0,isInline:!1,format:"[hr]{0}",html:"<hr />"},img:{allowsEmpty:!0,tags:{img:{src:null}},allowedChildren:["#"],quoteType:y.never,format:function(t,e){var n="",r=function(e){return t.style?t.style[e]:null};return m(t,v)?e:(e=m(t,"width")||r("width"),r=m(t,"height")||r("height"),"[img"+(n=t.complete&&(e||r)||e&&r?"="+f.width(t)+"x"+f.height(t):n)+"]"+m(t,"src")+"[/img]")},html:function(e,t,n){var r="",o=t.width,i=t.height;return t.defaultattr&&(o=(t=t.defaultattr.split(/x/i))[0],i=2===t.length?t[1]:t[0]),void 0!==o&&(r+=' width="'+d(o,!0)+'"'),void 0!==i&&(r+=' height="'+d(i,!0)+'"'),"<img"+r+' src="'+a(n)+'" />'}},url:{allowsEmpty:!0,tags:{a:{href:null}},quoteType:y.never,format:function(e,t){e=m(e,"href");return"mailto:"===e.substr(0,7)?'[email="'+e.substr(7)+'"]'+t+"[/email]":"[url="+e+"]"+t+"[/url]"},html:function(e,t,n){return t.defaultattr=d(t.defaultattr,!0)||n,'<a href="'+a(t.defaultattr)+'">'+n+"</a>"}},email:{quoteType:y.never,html:function(e,t,n){return'<a href="mailto:'+(d(t.defaultattr,!0)||n)+'">'+n+"</a>"}},quote:{tags:{blockquote:null},isInline:!1,quoteType:y.never,format:function(e,t){for(var n,r="data-author",o="",i=e.children,a=0;!n&&a<i.length;a++)h(i[a],"cite")&&(n=i[a]);return(n||m(e,r))&&(o=n&&n.textContent||m(e,r),m(e,r,o),n&&e.removeChild(n),t=this.elementToBbcode(e),o="="+o.replace(/(^\s+|\s+$)/g,""),n&&e.insertBefore(n,e.firstChild)),"[quote"+o+"]"+t+"[/quote]"},html:function(e,t,n){return"<blockquote>"+(n=t.defaultattr?"<cite>"+d(t.defaultattr)+"</cite>"+n:n)+"</blockquote>"}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"<code>{0}</code>"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,allowsEmpty:!0,format:"[left]{0}[/left]",html:'<div align="left">{0}</div>'},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,allowsEmpty:!0,format:"[center]{0}[/center]",html:'<div align="center">{0}</div>'},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,allowsEmpty:!0,format:"[right]{0}[/right]",html:'<div align="right">{0}</div>'},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,allowsEmpty:!0,format:"[justify]{0}[/justify]",html:'<div align="justify">{0}</div>'},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(e,t){return(e=m(e,"data-youtube-id"))?"[youtube]"+e+"[/youtube]":t},html:'<iframe width="560" height="315" frameborder="0" src="https://www.youtube-nocookie.com/embed/{0}?wmode=opaque" data-youtube-id="{0}" allowfullscreen></iframe>'},rtl:{styles:{direction:["rtl"]},isInline:!1,format:"[rtl]{0}[/rtl]",html:'<div style="direction: rtl">{0}</div>'},ltr:{styles:{direction:["ltr"]},isInline:!1,format:"[ltr]{0}[/ltr]",html:'<div style="direction: ltr">{0}</div>'},ignore:{}};function x(e,r){return e.replace(/\{([^}]+)\}/g,function(e,t){var n=!0;return"!"===t.charAt(0)&&(n=!1,t=t.substring(1)),"0"===t&&(n=!1),void 0===r[t]?e:n?d(r[t],!0):r[t]})}function w(e){return"function"==typeof e}function k(e){return e&&e.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2")}var T="open",C="content",S="newline",E="close";function l(e,t,n,r,o,i){var a=this;a.type=e,a.name=t,a.val=n,a.attrs=r||{},a.children=o||[],a.closing=i||null}function D(e){var m=this;function a(e,t){var n,r,o;return e===T&&(n=t.match(/\[([^\]\s=]+)(?:([^\]]+))?\]/))&&(o=i(n[1]),n[2]&&(n[2]=n[2].trim())&&(r=function(e){var t,n=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,r={};if("="===e.charAt(0)&&e.indexOf("=",1)<0)r.defaultattr=k(e.substr(1));else for("="===e.charAt(0)&&(e="defaultattr"+e);t=n.exec(e);)r[i(t[1])]=k(t[3])||t[4];return r}(n[2]))),e===E&&(n=t.match(/\[\/([^\[\]]+)\]/))&&(o=i(n[1])),(o=e===S?"#newline":o)&&(e!==T&&e!==E||b[o])||(e=C,o="#"),new l(e,o,t,r)}function f(e,t,n){for(var r=n.length;r--;)if(n[r].type===t&&n[r].name===e)return 1}function p(e,t){e=(e?b[e.name]:{}).allowedChildren;return!m.opts.fixInvalidChildren||!e||-1<e.indexOf(t.name||"#")}function h(e,t,n){var r=/\s|=/.test(e);return w(t)?t(e,n):t===y.never||t===y.auto&&!r?e:'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function g(e){return e.length?e[e.length-1]:null}function i(e){return e.toLowerCase()}m.opts=n({},D.defaults,e),m.tokenize=function(e){var t,n,r,o=[],i=[{type:C,regex:/^([^\[\r\n]+|\[)/},{type:S,regex:/^(\r\n|\r|\n)/},{type:T,regex:/^\[[^\[\]]+\]/},{type:E,regex:/^\[\/[^\[\]]+\]/}];e:for(;e.length;){for(r=i.length;r--;)if(n=i[r].type,(t=e.match(i[r].regex))&&t[0]){o.push(a(n,t[0])),e=e.substr(t[0].length);continue e}e.length&&o.push(a(C,e)),e=""}return o},m.parse=function(e,t){var n=function(e){function t(){return g(d)}function n(e){(t()?t().children:u).push(e)}function r(e){return t()&&(i=b[t().name])&&i.closedBy&&-1<i.closedBy.indexOf(e)}var o,i,a,l,s,c=[],u=[],d=[];for(;o=e.shift();)switch(s=e[0],p(t(),o)||o.type===E&&t()&&o.name===t().name||(o.name="#",o.type=C),o.type){case T:r(o.name)&&d.pop(),n(o),(i=b[o.name])&&!i.isSelfClosing&&(i.closedBy||f(o.name,E,e))?d.push(o):i&&i.isSelfClosing||(o.type=C);break;case E:if(t()&&o.name!==t().name&&r("/"+o.name)&&d.pop(),t()&&o.name===t().name)t().closing=o,d.pop();else if(f(o.name,T,d)){for(;a=d.pop();){if(a.name===o.name){a.closing=o;break}a=a.clone(),c.length&&a.children.push(g(c)),c.push(a)}for(s&&s.type===S&&(i=b[o.name])&&!1===i.isInline&&(n(s),e.shift()),n(g(c)),l=c.length;l--;)d.push(c[l]);c.length=0}else o.type=C,n(o);break;case S:t()&&s&&r((s.type===E?"/":"")+s.name)&&(s.type===E&&s.name===t().name||((i=b[t().name])&&i.breakAfter||i&&!1===i.isInline&&m.opts.breakAfterBlock&&!1!==i.breakAfter)&&d.pop()),n(o);break;default:n(o)}return u}(m.tokenize(e)),e=m.opts;return e.fixInvalidNesting&&function e(t,n,r,o){var i,a,l,s;var c=function(e){var e=b[e.name];return!e||!1!==e.isInline};n=n||[];o=o||t;for(a=0;a<t.length;a++)if((i=t[a])&&i.type===T){var u;if(r&&!c(i))if(d=g(n),s=d.splitAt(i),l=1<n.length?n[n.length-2].children:o,p(i,d)&&((u=d.clone()).children=i.children,i.children=[u]),-1<(u=l.indexOf(d))){s.children.splice(0,1),l.splice(u+1,0,i,s);var d=s.children[0];return void(d&&d.type===S&&(c(i)||(s.children.splice(0,1),l.splice(u+2,0,d))))}n.push(i),e(i.children,n,r||c(i),o),n.pop()}}(n),function e(t,n,r){var o,i,a,l,s,c,u,d;var f=t.length;n&&(l=b[n.name]);var p=f;for(;p--;)(o=t[p])&&(o.type===S?(i=0<p?t[p-1]:null,a=p<f-1?t[p+1]:null,d=!1,!r&&l&&!0!==l.isSelfClosing&&(i?c||a||(!1===l.isInline&&m.opts.breakEndBlock&&!1!==l.breakEnd&&(d=!0),l.breakEnd&&(d=!0),c=d):(!1===l.isInline&&m.opts.breakStartBlock&&!1!==l.breakStart&&(d=!0),l.breakStart&&(d=!0))),i&&i.type===T&&(s=b[i.name])&&(r?!1===s.isInline&&(d=!0):(!1===s.isInline&&m.opts.breakAfterBlock&&!1!==s.breakAfter&&(d=!0),s.breakAfter&&(d=!0))),!r&&!u&&a&&a.type===T&&(s=b[a.name])&&(!1===s.isInline&&m.opts.breakBeforeBlock&&!1!==s.breakBefore&&(d=!0),s.breakBefore&&(d=!0),u=d)?t.splice(p,1):(d&&t.splice(p,1),u=!1)):o.type===T&&e(o.children,o,r))}(n,null,t),e.removeEmptyTags&&function e(t){var n,r;var o=function(e){for(var t=e.length;t--;){var n=e[t].type;if(n===T||n===E)return!1;if(n===C&&/\S|\u00A0/.test(e[t].val))return!1}return!0};var i=t.length;for(;i--;)(n=t[i])&&n.type===T&&(r=b[n.name],e(n.children),o(n.children)&&r&&!r.isSelfClosing&&!r.allowsEmpty&&t.splice.apply(t,[i,1].concat(n.children)))}(n),n},m.toHTML=function(e,t){return function e(t,n){var r,o,i,a,l,s,c,u="";s=function(e){return!1!==(!e||(void 0!==e.isHtmlInline?e.isHtmlInline:e.isInline))};for(;0<t.length;)if(r=t.shift()){if(r.type===T)c=r.children[r.children.length-1]||{},o=b[r.name],a=n&&s(o),i=e(r.children,!1),i=o&&o.html?(s(o)||!s(b[c.name])||o.isPreFormatted||o.skipLastLineBreak||(i+="<br />"),w(o.html)?o.html.call(m,r,r.attrs,i):(r.attrs[0]=i,x(o.html,r.attrs))):r.val+i+(r.closing?r.closing.val:"");else{if(r.type===S){if(!n){u+="<br />";continue}l||(u+="<div>"),u+="<br />",t.length||(u+="<br />"),u+="</div>\n",l=!1;continue}a=n,i=d(r.val,!0)}a&&!l?(u+="<div>",l=!0):!a&&l&&(u+="</div>\n",l=!1),u+=i}l&&(u+="</div>\n");return u}(m.parse(e,t),!0)},m.toBBCode=function(e,t){return function e(t){var n,r,o,i,a,l,s,c,u,d="";for(;0<t.length;)if(n=t.shift())if(o=b[n.name],u=!(!o||!1!==o.isInline),i=o&&o.isSelfClosing,l=u&&m.opts.breakBeforeBlock&&!1!==o.breakBefore||o&&o.breakBefore,s=u&&!i&&m.opts.breakStartBlock&&!1!==o.breakStart||o&&o.breakStart,c=u&&m.opts.breakEndBlock&&!1!==o.breakEnd||o&&o.breakEnd,u=u&&m.opts.breakAfterBlock&&!1!==o.breakAfter||o&&o.breakAfter,a=(o?o.quoteType:null)||m.opts.quoteType||y.auto,o||n.type!==T)if(n.type===T){if(l&&(d+="\n"),d+="["+n.name,n.attrs)for(r in n.attrs.defaultattr&&(d+="="+h(n.attrs.defaultattr,a,"defaultattr"),delete n.attrs.defaultattr),n.attrs)n.attrs.hasOwnProperty(r)&&(d+=" "+r+"="+h(n.attrs[r],a,r));d+="]",s&&(d+="\n"),n.children&&(d+=e(n.children)),i||o.excludeClosing||(c&&(d+="\n"),d+="[/"+n.name+"]"),u&&(d+="\n"),n.closing&&i&&(d+=n.closing.val)}else d+=n.val;else d+=n.val,n.children&&(d+=e(n.children)),n.closing&&(d+=n.closing.val);return d}(m.parse(e,t))}}function o(e){return e=parseInt(e,10),isNaN(e)?"00":(e=Math.max(0,Math.min(e,255)).toString(16)).length<2?"0"+e:e}function s(e){var t;return(t=(e=e||"#000").match(/rgb\((\d{1,3}),\s*?(\d{1,3}),\s*?(\d{1,3})\)/i))?"#"+o(t[1])+o(t[2])+o(t[3]):(t=e.match(/#([0-f])([0-f])([0-f])\s*?$/i))?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:e}function c(){var s=this;s.stripQuotes=k;var l={},u={ul:["li","ol","ul"],ol:["li","ol","ul"],table:["tr"],tr:["td","th"],code:["br","p","div"]};function d(o,i,t){function a(e){var t=e[0],n=e[1],r=f.getStyle(o,t),e=o.parentNode;return!(!r||e&&f.hasStyle(e,t,r))&&(!n||n.includes(r))}function e(e){l[e]&&l[e][t]&&g(l[e][t],function(e,t){var n=b[e].strictMatch;if(void 0===n&&(n=s.opts.strictMatch),!t||t[n?"every":"some"]((r=n,function(e){var t=e[0],e=e[1];if("style"===t&&"CODE"===o.nodeName)return!1;if("style"===t&&e)return e[r?"every":"some"](a);t=m(o,t);return t&&(!e||e.includes(t))}))){var r,e=b[e].format;return i=w(e)?e.call(s,o,i):function(e){var n=arguments;return e.replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[+t+1]?n[+t+1]:"{"+t+"}"})}(e,i),!1}})}return e("*"),e(o.nodeName.toLowerCase()),i}function c(e){var c=function(e,l){var s="";return f.traverse(e,function(e){var t="",n=e.nodeType,r=e.nodeName.toLowerCase(),o=u[r],i=e.firstChild,a=!0;"object"==typeof l&&(a=-1<l.indexOf(r),(a=h(e,"img")&&m(e,v)?!0:a)||(o=l)),3!==n&&1!==n||(1===n?h(e,".sceditor-nlf")&&!i||("iframe"!==r&&(t=c(e,o)),a?("code"!==r&&(t=d(e,t,!1)),t=d(e,t,!0),s+=function(e,t){var n=e.nodeName.toLowerCase(),r=f.isInline;if(!r(e,!0)||"br"===n){for(var o,i,a=e.previousSibling;a&&1===a.nodeType&&!h(a,"br")&&r(a,!0)&&!a.firstChild;)a=a.previousSibling;for(;o=((i=e.parentNode)&&i.lastChild)===e,e=i,i&&o&&r(i,!0););o&&"li"!==n||(t+="\n"),"br"!==n&&a&&!h(a,"br")&&r(a,!0)&&(t="\n"+t)}return t}(e,t)):s+=t):s+=e.nodeValue)},!1,!0),s};return c(e)}function e(e,t,n){var r,o,t=new D(s.opts.parserOptions).toHTML(s.opts.bbcodeTrim?t.trim():t);return e||n?(e=t,o=document.createElement("div"),n=function(e,t){if(!f.hasStyling(e)){if(1!==e.childNodes.length||!h(e.firstChild,"br"))for(;r=e.firstChild;)o.insertBefore(r,e);!t||e!==(t=o.lastChild)&&h(t,"div")&&e.nextSibling===t&&o.insertBefore(document.createElement("br"),e),o.removeChild(e)}},p(o,"display","none"),o.innerHTML=e.replace(/<\/div>\n/g,"</div>"),(e=o.firstChild)&&h(e,"div")&&n(e,!0),(e=o.lastChild)&&h(e,"div")&&n(e),o.innerHTML):t}function t(e,t,n,r){var o,i=(n=n||document).createElement("div"),a=n.createElement("div"),l=new D(s.opts.parserOptions);for(a.innerHTML=t,p(i,"visibility","hidden"),i.appendChild(a),n.body.appendChild(i),e&&(i.insertBefore(n.createTextNode("#"),i.firstChild),i.appendChild(n.createTextNode("#"))),r&&p(a,"whiteSpace",p(r,"whiteSpace")),o=a.getElementsByClassName("sceditor-ignore");o.length;)o[0].parentNode.removeChild(o[0]);return f.removeWhiteSpace(i),a=c(a),n.body.removeChild(i),a=l.toBBCode(a,!0),a=s.opts.bbcodeTrim?a.trim():a}s.init=function(){s.opts=this.opts,s.elementToBbcode=c,g(b,function(n,e){var r=!1===e.isInline,t=b[n].tags,e=b[n].styles;e&&(l["*"]=l["*"]||{},l["*"][r]=l["*"][r]||{},l["*"][r][n]=[["style",Object.entries(e)]]),t&&g(t,function(e,t){t&&t.style&&(t.style=Object.entries(t.style)),l[e]=l[e]||{},l[e][r]=l[e][r]||{},l[e][r][n]=t&&Object.entries(t)})}),this.commands=n(!0,{},r,this.commands),this.toBBCode=s.toSource,this.fromBBCode=s.toHtml},s.toHtml=e.bind(null,!1),s.fragmentToHtml=e.bind(null,!0),s.toSource=t.bind(null,!1),s.fragmentToSource=t.bind(null,!0)}l.prototype={clone:function(){var e=this;return new l(e.type,e.name,e.val,n({},e.attrs),[],e.closing?e.closing.clone():null)},splitAt:function(e){var t=this.clone(),n=this.children.indexOf(e);return-1<n&&(e=this.children.length-n,t.children=this.children.splice(n,e)),t}},D.QuoteType=y,D.defaults={breakBeforeBlock:!1,breakStartBlock:!1,breakEndBlock:!1,breakAfterBlock:!0,removeEmptyTags:!0,fixInvalidNesting:!0,fixInvalidChildren:!0,quoteType:y.auto,strictMatch:!1},c.get=function(e){return b[e]||null},c.set=function(e,t){return e&&t&&((t=n(b[e]||{},t)).remove=function(){delete b[e]},b[e]=t),this},c.rename=function(e,t){return e in b&&(b[t]=b[e],delete b[e]),this},c.remove=function(e){return e in b&&delete b[e],this},c.formatBBCodeString=x,e.formats.bbcode=c,e.BBCodeParser=D}(sceditor);