/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */ !function(o){"use strict";function e(e,t){return typeof t===e}o=o&&o.hasOwnProperty("default")?o.default:o;var be=e.bind(null,"string"),xe=e.bind(null,"undefined"),we=e.bind(null,"function"),r=e.bind(null,"number");function t(e){return!Object.keys(e).length}function ke(e,t){for(var n=e===!!e,o=n?2:1,r=n?t:e,i=!!n&&e;o":">"," ":"  ","\r\n":"
","\r":"
","\n":"
"};return!1!==t&&(n['"']=""",n["'"]="'",n["`"]="`"),e.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(e){return n[e]||e})}var b={html:'

',toolbarButton:'
{dispName}
',emoticon:'{key}',fontOpt:'{font}',sizeOpt:'{size}',pastetext:'
',table:'
',image:'
',email:'
',link:'
',youtubeMenu:'
',youtube:''};function ht(e,t,n){var o=b[e];return Object.keys(t).forEach(function(e){o=o.replace(new RegExp(ft("{"+e+"}"),"g"),t[e])}),n&&(o=et(o)),o}var x=v&&v<11;function w(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"))||Be(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&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===je(e,"direction"),n=je(e,"textAlign");return"left"===n||n===(t?"start":"end")}},exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===je(e,"direction"),n=je(e,"textAlign");return"right"===n||n===(t?"end":"start")}},exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,e,n){var o=De("div");Fe(o,"click","a",function(e){n(Pe(this,"font")),t.closeDropDown(!0),e.preventDefault()}),t.opts.fonts.split(",").forEach(function(e){Re(o,ht("fontOpt",{font:e},!0))}),t.createDropDown(e,"font-picker",o)},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 o=De("div");Fe(o,"click","a",function(e){n(Pe(this,"size")),t.closeDropDown(!0),e.preventDefault()});for(var r=1;r<=7;r++)Re(o,ht("sizeOpt",{size:r},!0));t.createDropDown(e,"fontsize-picker",o)},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 o=De("div"),r="",i=mt.color;i._htmlCache||(t.opts.colors.split("|").forEach(function(e){r+='
',e.split(",").forEach(function(e){r+=''}),r+="
"}),i._htmlCache=r),Re(o,et(i._htmlCache)),Fe(o,"click","a",function(e){n(Pe(this,"color")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"color-picker",o)},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=De("div"),o=this;Re(n,ht("pastetext",{label:o._("Paste your text inside the following box:"),insert:o._("Insert")},!0)),Fe(n,"click",".button",function(e){(t=He(n,"#txt")[0].value)&&o.wysiwygEditorInsertText(t),o.closeDropDown(!0),e.preventDefault()}),o.createDropDown(e,"pastetext",n)},tooltip:"Paste Text"},bulletlist:{exec:function(){w(this),this.execCommand("insertunorderedlist")},tooltip:"Bullet list"},orderedlist:{exec:function(){w(this),this.execCommand("insertorderedlist")},tooltip:"Numbered list"},indent:{state:function(e,t){var n,o,r;return qe(t,"li")?0:qe(t,"ul,ol,menu")&&(o=(n=this.getRangeHelper().selectedRange()).startContainer.parentNode,r=n.endContainer.parentNode,o!==o.parentNode.firstElementChild||qe(r,"li")&&r!==r.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 r=this,i=De("div");Re(i,ht("table",{rows:r._("Rows:"),cols:r._("Cols:"),insert:r._("Insert")},!0)),Fe(i,"click",".button",function(e){var t=Number(He(i,"#rows")[0].value),n=Number(He(i,"#cols")[0].value),o="";0"+Array(n+1).join("")+""),o+="
"+(x?"":"
")+"
",r.wysiwygEditorInsertHtml(o),r.closeDropDown(!0),e.preventDefault())}),r.createDropDown(e,"inserttable",i)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{exec:function(){this.wysiwygEditorInsertHtml("",(x?"":"
")+"
")},tooltip:"Code"},image:{_dropDown:function(t,e,n,o){var r=De("div");Re(r,ht("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0));var i=He(r,"#image")[0];i.value=n,Fe(r,"click",".button",function(e){i.value&&o(i.value,He(r,"#width")[0].value,He(r,"#height")[0].value),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",r)},exec:function(e){var r=this;mt.image._dropDown(r,e,"",function(e,t,n){var o="";t&&(o+=' width="'+t+'"'),n&&(o+=' height="'+n+'"'),r.wysiwygEditorInsertHtml("')})},tooltip:"Insert an image"},email:{_dropDown:function(n,e,o){var r=De("div");Re(r,ht("email",{label:n._("E-mail:"),desc:n._("Description (optional):"),insert:n._("Insert")},!0)),Fe(r,"click",".button",function(e){var t=He(r,"#email")[0].value;t&&o(t,He(r,"#des")[0].value),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"insertemail",r)},exec:function(e){var n=this;mt.email._dropDown(n,e,function(e,t){n.focus(),!n.getRangeHelper().selectedHtml()||t?n.wysiwygEditorInsertHtml(''+(t||e)+""):n.execCommand("createlink","mailto:"+e)})},tooltip:"Insert an email"},link:{_dropDown:function(t,e,n){var o=De("div");Re(o,ht("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0));var r=He(o,"#link")[0];function i(e){r.value&&n(r.value,He(o,"#des")[0].value),t.closeDropDown(!0),e.preventDefault()}Fe(o,"click",".button",i),Fe(o,"keypress",function(e){13===e.which&&r.value&&i(e)},Ie),t.createDropDown(e,"insertlink",o)},exec:function(e){var n=this;mt.link._dropDown(n,e,function(e,t){n.focus(),t||!n.getRangeHelper().selectedHtml()?(t=t||e,n.wysiwygEditorInsertHtml(''+t+"")):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;)Ve(e.firstChild,e);Be(e)}},tooltip:"Unlink"},quote:{exec:function(e,t,n){var o="
",r="
";t?(o=o+(n=n?""+n+"":"")+t+r,r=null):""===this.getRangeHelper().selectedHtml()&&(r=(x?"":"
")+r),this.wysiwygEditorInsertHtml(o,r)},tooltip:"Insert a Quote"},emoticon:{exec:function(f){var p=this,h=function(e){var t,n,o=p.opts,r=o.emoticonsRoot||"",i=o.emoticonsCompat,l=p.getRangeHelper(),a=i&&" "!==l.getOuterText(!0,1)?" ":"",s=i&&" "!==l.getOuterText(!1,1)?" ":"",c=De("div"),u=De("div"),d=ke({},o.emoticons.dropdown,e?o.emoticons.more:{});return Re(c,u),n=Math.sqrt(Object.keys(d).length),Fe(c,"click","img",function(e){p.insert(a+Ae(this,"alt")+s,null,!1).closeDropDown(!0),e.preventDefault()}),Ee(d,function(e,t){Re(u,De("img",{src:r+(t.url||t),alt:e,title:t.tooltip||e})),u.children.length>=n&&(u=De("div"),Re(c,u))}),!e&&o.emoticons.more&&(Re(t=De("a",{className:"sceditor-more"}),document.createTextNode(p._("More"))),Fe(t,"click",function(e){p.createDropDown(f,"more-emoticons",h(!0)),e.preventDefault()}),Re(c,t)),c};p.createDropDown(f,"emoticons",h(!1))},txtExec:function(e){mt.emoticon.exec.call(this,e)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(i,e,l){var a=De("div");Re(a,ht("youtubeMenu",{label:i._("Video URL:"),insert:i._("Insert")},!0)),Fe(a,"click",".button",function(e){var t=He(a,"#link")[0].value,n=t.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),o=t.match(/[&|?](?:star)?t=((\d+[hms]?){1,3})/),r=0;o&&Ee(o[1].split(/[hms]/),function(e,t){""!==t&&(r=60*r+Number(t))}),n&&/^[a-zA-Z0-9_\-]{11}$/.test(n[1])&&l(n[1],r),i.closeDropDown(!0),e.preventDefault()}),i.createDropDown(e,"insertlink",a)},exec:function(e){var n=this;mt.youtube._dropDown(n,e,function(e,t){n.wysiwygEditorInsertHtml(ht("youtube",{id:e,time:t}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),o=t.getMonth()+1,r=t.getDate();return n<2e3&&(n=1900+n),o<10&&(o="0"+o),r<10&&(r="0"+r),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,o).replace(/day/i,r)},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(),o=e.getSeconds();return t<10&&(t="0"+t),n<10&&(n="0"+n),o<10&&(o="0"+o),t+":"+n+":"+o},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&&!qe(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!qe(t,"body")))&&je(t,"direction","ltr"===je(t,"direction")?"":"ltr")},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&&!qe(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!qe(t,"body")))&&je(t,"direction","rtl"===je(t,"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:{}},k={};function gt(i){var r=this,l=[],a=function(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)},e=function(e,t){e=[].slice.call(e);var n,o,r=a(e.shift());for(n=0;ns.length&&c&&3===c.nodeType;)o=c.nodeValue,r=n-s.length,a&&(l=o.length,i=0),a=c,t?(u=i=Math.max(l-r,0),s=o.substr(i,l-i)+s,c=a.previousSibling):(u=i+(l=Math.min(r,o.length)),s+=o.substr(i,l),c=a.nextSibling);return{node:a||c,offset:u,text:s}};function vt(i,e){var l,a,s=e||i.contentDocument||i.document,c="sceditor-start-marker",u="sceditor-end-marker",y=this;y.insertHTML=function(e,t){var n,o;if(!y.selectedRange())return!1;for(t&&(e+=y.selectedHtml()+t),o=De("p",{},s),n=s.createDocumentFragment(),o.innerHTML=e;o.firstChild;)Re(n,o.firstChild);y.insertNode(n)},a=function(e,t,n){var o,r=s.createDocumentFragment();if("string"==typeof e?(t&&(e+=y.selectedHtml()+t),r=et(e)):(Re(r,e),t&&(Re(r,y.selectedRange().extractContents()),Re(r,t))),o=r.lastChild){for(;!rt(o.lastChild,!0);)o=o.lastChild;if(ot(o)?o.lastChild||Re(o,document.createTextNode("​")):o=r,y.removeMarkers(),Re(o,l(c)),Re(o,l(u)),n){var i=De("div");return Re(i,r),i.innerHTML}return r}},y.insertNode=function(e,t){var n=a(e,t),o=y.selectedRange(),r=o.commonAncestorContainer;if(!n)return!1;o.deleteContents(),r&&3!==r.nodeType&&!ot(r)?Ve(n,r):o.insertNode(n),y.restoreRange()},y.cloneSelected=function(){var e=y.selectedRange();if(e)return e.cloneRange()},y.selectedRange=function(){var e,t,n=i.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'})},void n.readAsDataURL(t);l[a[c]]=i.getData(a[c])}l.text=l["text/plain"],l.html=l["text/html"],P(l)}else if(!T){var u=r.scrollTop;for(v.saveRange(),T=bt.createDocumentFragment();r.firstChild;)Re(T,r.firstChild);setTimeout(function(){var e=r.innerHTML;r.innerHTML="",Re(r,T),r.scrollTop=u,T=!1,v.restoreRange(),P({html:e})},0)}},P=function(e){var t=De("div",{},d);r.call("pasteRaw",e),Qe(w,"pasteraw",e),e.html?(t.innerHTML=e.html,it(t)):t.innerHTML=pt(e.text||"");var n={val:t.innerHTML};"fragmentToSource"in l&&(n.val=l.fragmentToSource(n.val,d,y)),r.call("paste",n),Qe(w,"paste",n),"fragmentToHtml"in l&&(n.val=l.fragmentToHtml(n.val,y)),r.call("pasteHtml",n),de.wysiwygEditorInsertHtml(n.val,null,!0)},de.closeDropDown=function(e){f&&(Be(f),f=null),!0===e&&de.focus()},de.wysiwygEditorInsertHtml=function(e,t,n){var o,r,i,l=Xe(s);de.focus(),!n&&Ne(b,"code")||(v.insertHTML(e,t),v.saveRange(),N(),_e(o=He(h,"#sceditor-end-marker")[0]),r=h.scrollTop,i=at(o).top+1.5*o.offsetHeight-l,Oe(o),(r").replace(/&/g,"&")),de.wysiwygEditorInsertHtml(e),de},de.getWysiwygEditorValue=function(e){for(var t,n=De("div",{},d),o=h.childNodes,r=0;r"+(xt?"":"
")+"

"),h.innerHTML=e,N(),Z(),le(),ue()},de.setSourceEditorValue=function(e){c.value=e,le()},de.updateOriginal=function(){a.value=de.val()},N=function(){var e,c,u,d,t,f,p;ye.emoticonsEnabled&&(e=h,c=ve,u=ye.emoticonsCompat,d=e.ownerDocument,t="(^|\\s| | | | |$)",f=[],p={},Me(e,"code")||(Ee(c,function(e){p[e]=new RegExp(t+ft(e)+t),f.push(e)}),f.sort(function(e,t){return t.length-e.length}),function e(t){for(t=t.firstChild;t;){if(t.nodeType!==Se||qe(t,"code")||e(t),t.nodeType===Te)for(var n=0;n")}e.preventDefault()}},Z=function(){Ze(h,function(e){if(e.nodeType===Se&&!/inline/.test(je(e,"display"))&&!qe(e,".sceditor-nlf")&&tt(e)){var t=De("p",{},d);return t.className="sceditor-nlf",t.innerHTML=wt?"":"
",Re(h,t),!1}if(3===e.nodeType&&!/^\s*$/.test(e.nodeValue)||qe(e,"br"))return!1})},$=function(){de.val(a.value)},U=function(){de.closeDropDown(),p=null},de._=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-0+1]?n[t-0+1]:"{"+t+"}"})},K=function(t){r&&r.call(t.type+"Event",t,de);var e=(t.target===c?"scesrc":"scewys")+t.type;fe[e]&&fe[e].forEach(function(e){e.call(de,t)})},de.bind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)if(we(t)){var i="scewys"+e[r],l="scesrc"+e[r];n||(fe[i]=fe[i]||[],fe[i].push(t)),o||(fe[l]=fe[l]||[],fe[l].push(t)),"valuechanged"===e[r]&&(le.hasHandler=!0)}return de},de.unbind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)we(t)&&(n||Ce(fe["scewys"+e[r]]||[],t),o||Ce(fe["scesrc"+e[r]]||[],t));return de},de.blur=function(e,t,n){return we(e)?de.bind("blur",e,t,n):de.sourceMode()?c.blur():h.blur(),de},de.focus=function(e,t,n){if(we(e))de.bind("focus",e,t,n);else if(de.inSourceMode())c.focus();else{if(He(d,":focus").length)return;var o,r=v.selectedRange();x||ne(),!wt&&r&&1===r.endOffset&&r.collapsed&&(o=r.endContainer)&&1===o.childNodes.length&&qe(o.firstChild,"br")&&(r.setStartBefore(o.firstChild),r.collapse(!0),v.selectRange(r)),i.focus(),h.focus(),p&&(v.selectRange(p),p=null)}return G(),de},de.keyDown=function(e,t,n){return de.bind("keydown",e,t,n)},de.keyPress=function(e,t,n){return de.bind("keypress",e,t,n)},de.keyUp=function(e,t,n){return de.bind("keyup",e,t,n)},de.nodeChanged=function(e){return de.bind("nodechanged",e,!1,!0)},de.selectionChanged=function(e){return de.bind("selectionchanged",e,!1,!0)},de.valueChanged=function(e,t,n){return de.bind("valuechanged",e,t,n)},oe=function(e){var n=0,o=de.emoticonsCache,t=String.fromCharCode(e.which);Ne(b,"code")||(o||(o=[],Ee(ve,function(e,t){o[n++]=[e,t]}),o.sort(function(e,t){return e[0].length-t[0].length}),de.emoticonsCache=o,de.longestEmoticonCode=o[o.length-1][0].length),v.replaceKeyword(de.emoticonsCache,!0,!0,de.longestEmoticonCode,ye.emoticonsCompat,t)&&(ye.emoticonsCompat&&/^\s$/.test(t)||e.preventDefault()))},re=function(){!function(e,t){var n=/[^\s\xA0\u2002\u2003\u2009\u00a0]+/,o=e&&He(e,"img[data-sceditor-emoticon]");if(e&&o.length)for(var r=0;r","/":"?","\\":"|","[":"{","]":"}"},o={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},r=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:"'"}[r]||String.fromCharCode(r).toLowerCase();(e.ctrlKey||e.metaKey)&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&(t.push("shift"),o[r]?i=o[r]:n[i]&&(i=n[i])),i&&(r<16||18{0}"},i:{tags:{i:null,em:null},styles:{"font-style":["italic","oblique"]},format:"[i]{0}[/i]",html:"{0}"},u:{tags:{u:null},styles:{"text-decoration":["underline"]},format:"[u]{0}[/u]",html:"{0}"},s:{tags:{s:null,strike:null},styles:{"text-decoration":["line-through"]},format:"[s]{0}[/s]",html:"{0}"},sub:{tags:{sub:null},format:"[sub]{0}[/sub]",html:"{0}"},sup:{tags:{sup:null},format:"[sup]{0}[/sup]",html:"{0}"},font:{tags:{font:{face:null}},styles:{"font-family":null},quoteType:x.never,format:function(e,t){var n;return v(e,"font")&&(n=g(e,"face"))||(n=m(e,"font-family")),"[font="+E(n)+"]"+t+"[/font]"},html:'{0}'},size:{tags:{font:{size:null}},styles:{"font-size":null},format:function(e,t){var n=g(e,"size"),o=2;return n||(n=m(e,"fontSize")),-1{!0}'},color:{tags:{font:{color:null}},styles:{color:null},quoteType:x.never,format:function(e,t){var n;return v(e,"font")&&(n=g(e,"color"))||(n=e.style.color||m(e,"color")),"[color="+u(n)+"]"+t+"[/color]"},html:function(e,t,n){return''+n+""}},ul:{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ul]{0}[/ul]",html:"
    {0}
"},list:{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:"
    {0}
"},ol:{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ol]{0}[/ol]",html:"
    {0}
"},li:{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[li]{0}[/li]",html:"
  • {0}
  • "},"*":{isInline:!1,closedBy:["/ul","/ol","/list","*","li"],html:"
  • {0}
  • "},table:{tags:{table:null},isInline:!1,isHtmlInline:!0,skipLastLineBreak:!0,format:"[table]{0}[/table]",html:"{0}
    "},tr:{tags:{tr:null},isInline:!1,skipLastLineBreak:!0,format:"[tr]{0}[/tr]",html:"{0}"},th:{tags:{th:null},allowsEmpty:!0,isInline:!1,format:"[th]{0}[/th]",html:"{0}"},td:{tags:{td:null},allowsEmpty:!0,isInline:!1,format:"[td]{0}[/td]",html:"{0}"},emoticon:{allowsEmpty:!0,tags:{img:{src:null,"data-sceditor-emoticon":null}},format:function(e,t){return g(e,b)+t},html:"{0}"},hr:{tags:{hr:null},allowsEmpty:!0,isSelfClosing:!0,isInline:!1,format:"[hr]{0}",html:"
    "},img:{allowsEmpty:!0,tags:{img:{src:null}},allowedChildren:["#"],quoteType:x.never,format:function(t,e){var n,o,r="",i=function(e){return t.style?t.style[e]:null};return g(t,b)?e:(n=g(t,"width")||i("width"),o=g(t,"height")||i("height"),(t.complete&&(n||o)||n&&o)&&(r="="+h.width(t)+"x"+h.height(t)),"[img"+r+"]"+g(t,"src")+"[/img]")},html:function(e,t,n){var o,r,i,l="";return o=t.width,r=t.height,t.defaultattr&&(o=(i=t.defaultattr.split(/x/i))[0],r=2===i.length?i[1]:i[0]),void 0!==o&&(l+=' width="'+f(o,!0)+'"'),void 0!==r&&(l+=' height="'+f(r,!0)+'"'),"'}},url:{allowsEmpty:!0,tags:{a:{href:null}},quoteType:x.never,format:function(e,t){var n=g(e,"href");return"mailto:"===n.substr(0,7)?'[email="'+n.substr(7)+'"]'+t+"[/email]":"[url="+n+"]"+t+"[/url]"},html:function(e,t,n){return t.defaultattr=f(t.defaultattr,!0)||n,''+n+""}},email:{quoteType:x.never,html:function(e,t,n){return''+n+""}},quote:{tags:{blockquote:null},isInline:!1,quoteType:x.never,format:function(e,t){for(var n,o="data-author",r="",i=e.children,l=0;!n&&l"+n),"
    "+n+"
    "}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"{0}"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,format:"[left]{0}[/left]",html:'
    {0}
    '},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,format:"[center]{0}[/center]",html:'
    {0}
    '},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,format:"[right]{0}[/right]",html:'
    {0}
    '},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,format:"[justify]{0}[/justify]",html:'
    {0}
    '},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(e,t){return(e=g(e,"data-youtube-id"))?"[youtube]"+e+"[/youtube]":t},html:''},rtl:{styles:{direction:["rtl"]},isInline:!1,format:"[rtl]{0}[/rtl]",html:'
    {0}
    '},ltr:{styles:{direction:["ltr"]},isInline:!1,format:"[ltr]{0}[/ltr]",html:'
    {0}
    '},ignore:{}};function k(e,o){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===o[t]?e:n?f(o[t],!0):o[t]})}function C(e){return"function"==typeof e}function E(e){return e?e.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2"):e}function S(e){var n=arguments;return e.replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[t-0+1]?n[t-0+1]:"{"+t+"}"})}var T="open",D="content",M="newline",N="close";function c(e,t,n,o,r,i){var l=this;l.type=e,l.name=t,l.val=n,l.attrs=o||{},l.children=r||[],l.closing=i||null}function B(e){var h=this;function l(e,t){var n,o,r;return e===T&&(n=t.match(/\[([^\]\s=]+)(?:([^\]]+))?\]/))&&(r=i(n[1]),n[2]&&(n[2]=n[2].trim())&&(o=function(e){var t,n=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,o={};if("="===e.charAt(0)&&e.indexOf("=",1)<0)o.defaultattr=E(e.substr(1));else for("="===e.charAt(0)&&(e="defaultattr"+e);t=n.exec(e);)o[i(t[1])]=E(t[3])||t[4];return o}(n[2]))),e===N&&(n=t.match(/\[\/([^\[\]]+)\]/))&&(r=i(n[1])),e===M&&(r="#newline"),r&&(e!==T&&e!==N||w[r])||(e=D,r="#"),new c(e,r,t,o)}function p(e,t,n){for(var o=n.length;o--;)if(n[o].type===t&&n[o].name===e)return!0;return!1}function m(e,t){var n=(e?w[e.name]:{}).allowedChildren;return!h.opts.fixInvalidChildren||!n||-1"),C(r.html)?l=r.html.call(h,o,o.attrs,i):(o.attrs[0]=i,l=k(r.html,o.attrs))):l=o.val+i+(o.closing?o.closing.val:"");else{if(o.type===M){if(!n){d.push("
    ");continue}s||d.push("
    "),y||d.push("
    "),t.length||d.push("
    "),d.push("
    \n"),s=!1;continue}a=n,l=f(o.val,!0)}a&&!s?(d.push("
    "),s=!0):!a&&s&&(d.push("
    \n"),s=!1),d.push(l)}s&&d.push("\n");return d.join("")}(h.parse(e,t),!0)},h.toBBCode=function(e,t){return function e(t){var n,o,r,i,l,a,s,c,u,d,f=[];for(;0\n/g,""),(r=a.firstChild)&&v(r,"div")&&l(r,!0),(r=a.lastChild)&&v(r,"div")&&l(r),a.innerHTML):s}function t(e,t,n,o){var r,i,l=(n=n||document).createElement("div"),a=n.createElement("div"),s=new B(c.opts.parserOptions);for(a.innerHTML=t,m(l,"visibility","hidden"),l.appendChild(a),n.body.appendChild(l),e&&(l.insertBefore(n.createTextNode("#"),l.firstChild),l.appendChild(n.createTextNode("#"))),o&&m(a,"whiteSpace",m(o,"whiteSpace")),i=a.getElementsByClassName("sceditor-ignore");i.length;)i[0].parentNode.removeChild(i[0]);return h.removeWhiteSpace(l),r=p(a),n.body.removeChild(l),r=s.toBBCode(r,!0),c.opts.bbcodeTrim&&(r=r.trim()),r}c.init=function(){c.opts=this.opts,c.elementToBbcode=p,s(w,function(n){var o,e=w[n].tags,t=w[n].styles;e&&s(e,function(e,t){o=!1===w[n].isInline,l[e]=l[e]||{},l[e][o]=l[e][o]||{},l[e][o][n]=t}),t&&s(t,function(e,t){o=!1===w[n].isInline,a[o]=a[o]||{},a[o][e]=a[o][e]||{},a[o][e][n]=t})}),this.commands=n(!0,{},r,this.commands),this.toBBCode=c.toSource,this.fromBBCode=c.toHtml},c.toHtml=e.bind(null,!1),c.fragmentToHtml=e.bind(null,!0),c.toSource=t.bind(null,!1),c.fragmentToSource=t.bind(null,!0)}c.prototype={clone:function(){var e=this;return new c(e.type,e.name,e.val,n({},e.attrs),[],e.closing?e.closing.clone():null)},splitAt:function(e){var t,n=this.clone(),o=this.children.indexOf(e);return-1