!function(t){"use strict";function e(t,i){return new e.prototype.init(t,i)}Function.prototype.bind||(Function.prototype.bind=function(t){var e=this;return function(){return e.apply(t)}});var i=0;t.fn.redactor=function(i){var s=[],r=Array.prototype.slice.call(arguments,1);return this.each("string"==typeof i?function(){var e,o=t.data(this,"redactor");if("-1"!=i.search(/\./)?(e=i.split("."),"undefined"!=typeof o[e[0]]&&(e=o[e[0]][e[1]])):e=o[i],"undefined"!=typeof o&&t.isFunction(e)){var n=e.apply(o,r);void 0!==n&&n!==o&&s.push(n)}else t.error('No such method "'+i+'" for Redactor')}:function(){t.data(this,"redactor",{}),t.data(this,"redactor",e(this,i))}),0===s.length?this:1===s.length?s[0]:s},t.Redactor=e,t.Redactor.VERSION="10.2.5",t.Redactor.modules=["alignment","autosave","block","buffer","build","button","caret","clean","code","core","dropdown","file","focus","image","indent","inline","insert","keydown","keyup","lang","line","link","linkify","list","modal","observe","paragraphize","paste","placeholder","progress","selection","shortcuts","tabifier","tidy","toolbar","upload","utils"],t.Redactor.opts={lang:"en",direction:"ltr",plugins:!1,focus:!1,focusEnd:!1,placeholder:!1,visual:!0,tabindex:!1,minHeight:!1,maxHeight:!1,linebreaks:!1,replaceDivs:!0,paragraphize:!0,cleanStyleOnEnter:!1,enterKey:!0,cleanOnPaste:!0,cleanSpaces:!0,pastePlainText:!1,autosave:!1,autosaveName:!1,autosaveInterval:60,autosaveOnChange:!1,autosaveFields:!1,linkTooltip:!0,linkProtocol:"http",linkNofollow:!1,linkSize:50,imageEditable:!0,imageLink:!0,imagePosition:!0,imageFloatMargin:"10px",imageResizable:!0,imageUpload:null,imageUploadParam:"file",uploadImageField:!1,dragImageUpload:!0,fileUpload:null,fileUploadParam:"file",dragFileUpload:!0,s3:!1,convertLinks:!0,convertUrlLinks:!0,convertImageLinks:!0,convertVideoLinks:!0,preSpaces:4,tabAsSpaces:!1,tabKey:!0,scrollTarget:!1,toolbar:!0,toolbarFixed:!0,toolbarFixedTarget:document,toolbarFixedTopOffset:0,toolbarExternal:!1,toolbarOverflow:!1,source:!0,buttons:["html","formatting","bold","italic","deleted","unorderedlist","orderedlist","outdent","indent","image","file","link","alignment","horizontalrule"],buttonsHide:[],buttonsHideOnMobile:[],formatting:["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],formattingAdd:!1,tabifier:!0,deniedTags:["script","style"],allowedTags:!1,paragraphizeBlocks:["table","div","pre","form","ul","ol","h1","h2","h3","h4","h5","h6","dl","blockquote","figcaption","address","section","header","footer","aside","article","object","style","script","iframe","select","input","textarea","button","option","map","area","math","hr","fieldset","legend","hgroup","nav","figure","details","menu","summary","p"],removeComments:!1,replaceTags:[["strike","del"],["b","strong"]],replaceStyles:[["font-weight:\\s?bold","strong"],["font-style:\\s?italic","em"],["text-decoration:\\s?underline","u"],["text-decoration:\\s?line-through","del"]],removeDataAttr:!1,removeAttr:!1,allowedAttr:!1,removeWithoutAttr:["span"],removeEmpty:["p"],activeButtons:["deleted","italic","bold","underline","unorderedlist","orderedlist","alignleft","aligncenter","alignright","justify"],activeButtonsStates:{b:"bold",strong:"bold",i:"italic",em:"italic",del:"deleted",strike:"deleted",ul:"unorderedlist",ol:"orderedlist",u:"underline"},shortcuts:{"ctrl+shift+m, meta+shift+m":{func:"inline.removeFormat"},"ctrl+b, meta+b":{func:"inline.format",params:["bold"]},"ctrl+i, meta+i":{func:"inline.format",params:["italic"]},"ctrl+h, meta+h":{func:"inline.format",params:["superscript"]},"ctrl+l, meta+l":{func:"inline.format",params:["subscript"]},"ctrl+k, meta+k":{func:"link.show"},"ctrl+shift+7":{func:"list.toggle",params:["orderedlist"]},"ctrl+shift+8":{func:"list.toggle",params:["unorderedlist"]}},shortcutsAdd:!1,buffer:[],rebuffer:[],emptyHtml:"<p>​</p>",invisibleSpace:"​",imageTypes:["image/png","image/jpeg","image/gif"],indentValue:20,verifiedTags:["a","img","b","strong","sub","sup","i","em","u","small","strike","del","cite","ul","ol","li"],inlineTags:["strong","b","u","em","i","code","del","ins","samp","kbd","sup","sub","mark","var","cite","small"],alignmentTags:["P","H1","H2","H3","H4","H5","H6","DL","DT","DD","DIV","TD","BLOCKQUOTE","OUTPUT","FIGCAPTION","ADDRESS","SECTION","HEADER","FOOTER","ASIDE","ARTICLE"],blockLevelElements:["PRE","UL","OL","LI"],highContrast:!1,observe:{dropdowns:[]},langs:{en:{html:"HTML",video:"Insert Video",image:"Insert Image",table:"Table",link:"Link",link_insert:"Insert link",link_edit:"Edit link",unlink:"Unlink",formatting:"Formatting",paragraph:"Normal text",quote:"Quote",code:"Code",header1:"Header 1",header2:"Header 2",header3:"Header 3",header4:"Header 4",header5:"Header 5",bold:"Bold",italic:"Italic",fontcolor:"Font Color",backcolor:"Back Color",unorderedlist:"Unordered List",orderedlist:"Ordered List",outdent:"Outdent",indent:"Indent",cancel:"Cancel",insert:"Insert",save:"Save",_delete:"Delete",insert_table:"Insert Table",insert_row_above:"Add Row Above",insert_row_below:"Add Row Below",insert_column_left:"Add Column Left",insert_column_right:"Add Column Right",delete_column:"Delete Column",delete_row:"Delete Row",delete_table:"Delete Table",rows:"Rows",columns:"Columns",add_head:"Add Head",delete_head:"Delete Head",title:"Title",image_position:"Position",none:"None",left:"Left",right:"Right",center:"Center",image_web_link:"Image Web Link",text:"Text",mailto:"Email",web:"URL",video_html_code:"Video Embed Code or Youtube/Vimeo Link",file:"Insert File",upload:"Upload",download:"Download",choose:"Choose",or_choose:"Or choose",drop_file_here:"Drop file here",align_left:"Align text to the left",align_center:"Center text",align_right:"Align text to the right",align_justify:"Justify text",horizontalrule:"Insert Horizontal Rule",deleted:"Deleted",anchor:"Anchor",link_new_tab:"Open link in new tab",underline:"Underline",alignment:"Alignment",filename:"Name (optional)",edit:"Edit",upload_label:"Drop file here or "}},linkify:{regexps:{youtube:/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/gi,vimeo:/https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/,image:/((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/gi,url:/(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi}},codemirror:!1},e.fn=t.Redactor.prototype={keyCode:{BACKSPACE:8,DELETE:46,UP:38,DOWN:40,ENTER:13,SPACE:32,ESC:27,TAB:9,CTRL:17,META:91,SHIFT:16,ALT:18,RIGHT:39,LEFT:37,LEFT_WIN:91},init:function(e,s){if(this.$element=t(e),this.uuid=i++,this.rtePaste=!1,this.$pasteBox=!1,this.loadOptions(s),this.loadModules(),this.formatting={},t.merge(this.opts.blockLevelElements,this.opts.alignmentTags),this.reIsBlock=new RegExp("^("+this.opts.blockLevelElements.join("|")+")$","i"),this.tidy.setupAllowed(),this.opts.deniedTags!==!1)for(var r=["html","head","link","body","meta","applet"],o=0;o<r.length;o++)this.opts.deniedTags.push(r[o]);this.lang.load(),t.extend(this.opts.shortcuts,this.opts.shortcutsAdd),this.core.setCallback("start"),this.start=!0,this.build.run()},loadOptions:function(e){this.opts=t.extend({},t.extend(!0,{},t.Redactor.opts),this.$element.data(),e)},getModuleMethods:function(t){return Object.getOwnPropertyNames(t).filter(function(e){return"function"==typeof t[e]})},loadModules:function(){for(var e=t.Redactor.modules.length,i=0;e>i;i++)this.bindModuleMethods(t.Redactor.modules[i])},bindModuleMethods:function(t){if("undefined"!=typeof this[t]){this[t]=this[t]();for(var e=this.getModuleMethods(this[t]),i=e.length,s=0;i>s;s++)this[t][e[s]]=this[t][e[s]].bind(this)}},alignment:function(){return{left:function(){this.alignment.set("")},right:function(){this.alignment.set("right")},center:function(){this.alignment.set("center")},justify:function(){this.alignment.set("justify")},set:function(t){this.utils.browser("msie")||this.opts.linebreaks||this.$editor.focus(),this.alignment.blocks=this.selection.getBlocks(),this.alignment.type=t,this.buffer.set(),this.selection.save(),this.alignment.isLinebreaksOrNoBlocks()?this.alignment.setText():this.alignment.setBlocks(),this.selection.restore(),this.code.sync()},setText:function(){var e=this.selection.wrap("div");t(e).attr("data-tagblock","redactor").css("text-align",this.alignment.type)},setBlocks:function(){t.each(this.alignment.blocks,t.proxy(function(t,e){var i=this.utils.getAlignmentElement(e);i&&(this.alignment.isNeedReplaceElement(i)?this.alignment.replaceElement(i):this.alignment.alignElement(i))},this))},isLinebreaksOrNoBlocks:function(){return this.opts.linebreaks&&this.alignment.blocks[0]===!1},isNeedReplaceElement:function(t){return""===this.alignment.type&&"undefined"!=typeof t.data("tagblock")},replaceElement:function(t){t.replaceWith(t.html())},alignElement:function(t){t.css("text-align",this.alignment.type),this.utils.removeEmptyAttr(t,"style")}}},autosave:function(){return{html:!1,enable:function(){this.opts.autosave&&(this.autosave.name=this.opts.autosaveName?this.opts.autosaveName:this.$textarea.attr("name"),this.opts.autosaveOnChange||(this.autosaveInterval=setInterval(this.autosave.load,1e3*this.opts.autosaveInterval)))},onChange:function(){this.opts.autosaveOnChange&&this.autosave.load()},load:function(){if(this.opts.autosave&&(this.autosave.source=this.code.get(),this.autosave.html!==this.autosave.source)){var e={};e.name=this.autosave.name,e[this.autosave.name]=this.autosave.source,e=this.autosave.getHiddenFields(e);var i=t.ajax({url:this.opts.autosave,type:"post",data:e});i.done(this.autosave.success)}},getHiddenFields:function(e){return this.opts.autosaveFields===!1||"object"!=typeof this.opts.autosaveFields?e:(t.each(this.opts.autosaveFields,t.proxy(function(i,s){null!==s&&0===s.toString().indexOf("#")&&(s=t(s).val()),e[i]=s},this)),e)},success:function(e){var i;try{i=t.parseJSON(e)}catch(t){i=e}var s="undefined"==typeof i.error?"autosave":"autosaveError";this.core.setCallback(s,this.autosave.name,i),this.autosave.html=this.autosave.source},disable:function(){clearInterval(this.autosaveInterval)}}},block:function(){return{formatting:function(t){this.block.clearStyle=!1;var e,i;"undefined"!=typeof this.formatting[t].data?e="data":"undefined"!=typeof this.formatting[t].attr?e="attr":"undefined"!=typeof this.formatting[t].class&&(e="class"),"undefined"!=typeof this.formatting[t].clear&&(this.block.clearStyle=!0),e&&(i=this.formatting[t][e]),this.block.format(this.formatting[t].tag,e,i)},format:function(e,i,s){"quote"==e&&(e="blockquote");var r=["p","pre","blockquote","h1","h2","h3","h4","h5","h6"];if(-1!=t.inArray(e,r)){this.block.isRemoveInline="pre"==e||-1!=e.search(/h[1-6]/i),this.utils.browser("msie")||this.$editor.focus();var o=t.trim(this.$editor.html());if(this.block.isEmpty=this.utils.isEmpty(o),this.utils.browser("mozilla")&&!this.focus.isFocused()&&this.block.isEmpty){var n;this.opts.linebreaks||(n=this.$editor.children().first(),this.caret.setEnd(n))}this.block.blocks=this.selection.getBlocks(),this.block.blocksSize=this.block.blocks.length,this.block.type=i,this.block.value=s,this.buffer.set(),this.selection.save(),this.block.set(e),this.selection.restore(),this.code.sync(),this.observe.load()}},set:function(t){this.selection.get(),this.block.containerTag=this.range.commonAncestorContainer.tagName,this.range.collapsed?this.block.setCollapsed(t):this.block.setMultiple(t)},setCollapsed:function(e){if(this.opts.linebreaks&&this.block.isEmpty&&"p"!=e){var i=document.createElement(e);return this.$editor.html(i),void this.caret.setEnd(i)}var s=this.block.blocks[0];if(s!==!1){if("LI"==s.tagName){if("blockquote"!=e)return;return void this.block.formatListToBlockquote()}var r="TD"==this.block.containerTag||"TH"==this.block.containerTag;if(r&&!this.opts.linebreaks)document.execCommand("formatblock",!1,"<"+e+">"),s=this.selection.getBlock(),this.block.toggle(t(s));else if(s.tagName.toLowerCase()!=e)if(this.opts.linebreaks&&"p"==e)t(s).append("<br>"),this.utils.replaceWithContents(s);else{var o=this.utils.replaceToTag(s,e);this.block.toggle(o),"p"!=e&&"blockquote"!=e&&o.find("img").remove(),this.block.isRemoveInline&&this.utils.removeInlineTags(o),("p"==e||this.block.headTag)&&o.find("p").contents().unwrap(),this.block.formatTableWrapping(o)}else if("blockquote"==e&&s.tagName.toLowerCase()==e)if(this.opts.linebreaks)t(s).append("<br>"),this.utils.replaceWithContents(s);else{var n=this.utils.replaceToTag(s,"p");this.block.toggle(n)}else s.tagName.toLowerCase()==e&&this.block.toggle(t(s));"undefined"==typeof this.block.type&&"undefined"==typeof this.block.value&&t(s).removeAttr("class").removeAttr("style")}},setMultiple:function(e){var i=this.block.blocks[0],s="TD"==this.block.containerTag||"TH"==this.block.containerTag;if(i!==!1&&1===this.block.blocksSize)if(i.tagName.toLowerCase()==e&&"blockquote"==e)if(this.opts.linebreaks)t(i).append("<br>"),this.utils.replaceWithContents(i);else{var r=this.utils.replaceToTag(i,"p");this.block.toggle(r)}else if("LI"==i.tagName){if("blockquote"!=e)return;this.block.formatListToBlockquote()}else if("BLOCKQUOTE"==this.block.containerTag)this.block.formatBlockquote(e);else if(this.opts.linebreaks&&(s||this.range.commonAncestorContainer!=i))this.block.formatWrap(e);else if(this.opts.linebreaks&&"p"==e)t(i).prepend("<br>").append("<br>"),this.utils.replaceWithContents(i);else if("TD"===i.tagName)this.block.formatWrap(e);else{var o=this.utils.replaceToTag(i,e);this.block.toggle(o),this.block.isRemoveInline&&this.utils.removeInlineTags(o),("p"==e||this.block.headTag)&&o.find("p").contents().unwrap()}else if(this.opts.linebreaks||"p"!=e){if("blockquote"==e){for(var n=0,a=0;a<this.block.blocksSize;a++)"BLOCKQUOTE"==this.block.blocks[a].tagName&&n++;if(n==this.block.blocksSize)return void t.each(this.block.blocks,t.proxy(function(e,i){var s=!1;this.opts.linebreaks?(t(i).prepend("<br>").append("<br>"),s=this.utils.replaceWithContents(i)):s=this.utils.replaceToTag(i,"p"),s&&"undefined"==typeof this.block.type&&"undefined"==typeof this.block.value&&s.removeAttr("class").removeAttr("style")},this))}this.block.formatWrap(e)}else{var l=0,c=!1;"class"==this.block.type&&(c="toggle",l=t(this.block.blocks).filter("."+this.block.value).length,this.block.blocksSize==l?c="toggle":this.block.blocksSize>l?c="set":0===l&&(c="set"));var h=["ul","ol","li","td","th","dl","dt","dd"];t.each(this.block.blocks,t.proxy(function(i,s){if(-1==t.inArray(s.tagName.toLowerCase(),h)){var r=this.utils.replaceToTag(s,e);c?"toggle"==c?this.block.toggle(r):"remove"==c?this.block.remove(r):"set"==c&&this.block.setForce(r):this.block.toggle(r),"p"!=e&&"blockquote"!=e&&r.find("img").remove(),this.block.isRemoveInline&&this.utils.removeInlineTags(r),("p"==e||this.block.headTag)&&r.find("p").contents().unwrap(),"undefined"==typeof this.block.type&&"undefined"==typeof this.block.value&&r.removeAttr("class").removeAttr("style")}},this))}},setForce:function(t){return this.block.clearStyle&&t.removeAttr("class").removeAttr("style"),"class"==this.block.type?void t.addClass(this.block.value):"attr"==this.block.type||"data"==this.block.type?void t.attr(this.block.value.name,this.block.value.value):void 0},toggle:function(t){return this.block.clearStyle&&t.removeAttr("class").removeAttr("style"),"class"==this.block.type?void t.toggleClass(this.block.value):"attr"==this.block.type||"data"==this.block.type?void(t.attr(this.block.value.name)==this.block.value.value?t.removeAttr(this.block.value.name):t.attr(this.block.value.name,this.block.value.value)):void t.removeAttr("style class")},remove:function(t){t.removeClass(this.block.value)},formatListToBlockquote:function(){var e=t(this.block.blocks[0]).closest("ul, ol",this.$editor[0]);t(e).find("ul, ol").contents().unwrap(),t(e).find("li").append(t("<br>")).contents().unwrap();var i=this.utils.replaceToTag(e,"blockquote");this.block.toggle(i)},formatBlockquote:function(e){document.execCommand("outdent"),document.execCommand("formatblock",!1,e),this.clean.clearUnverified(),this.$editor.find("p:empty").remove();var i=this.selection.getBlock();"p"!=e&&t(i).find("img").remove(),this.opts.linebreaks||this.block.toggle(t(i)),this.$editor.find("ul, ol, tr, blockquote, p").each(t.proxy(this.utils.removeEmpty,this)),this.opts.linebreaks&&"p"==e&&this.utils.replaceWithContents(i)},formatWrap:function(e){if("UL"==this.block.containerTag||"OL"==this.block.containerTag){if("blockquote"!=e)return;this.block.formatListToBlockquote()}var i=this.selection.wrap(e);if(i!==!1){var s=t(i);this.block.formatTableWrapping(s);var r=s.find(this.opts.blockLevelElements.join(",")+", td, table, thead, tbody, tfoot, th, tr");if(r.contents().unwrap(),"p"!=e&&"blockquote"!=e&&s.find("img").remove(),t.each(this.block.blocks,t.proxy(this.utils.removeEmpty,this)),s.append(this.selection.getMarker(2)),this.opts.linebreaks||this.block.toggle(s),this.$editor.find("ul, ol, tr, blockquote, p").each(t.proxy(this.utils.removeEmpty,this)),s.find("blockquote:empty").remove(),this.block.isRemoveInline&&this.utils.removeInlineTags(s),this.opts.linebreaks&&"p"==e&&this.utils.replaceWithContents(s),this.opts.linebreaks){var o=s.next().next();0!=o.size()&&"BR"===o[0].tagName&&o.remove()}}},formatTableWrapping:function(t){0!==t.closest("table",this.$editor[0]).length&&(0===t.closest("tr",this.$editor[0]).length&&t.wrap("<tr>"),0===t.closest("td",this.$editor[0]).length&&0===t.closest("th").length&&t.wrap("<td>"))},removeData:function(e){var i=this.selection.getBlocks();t(i).removeAttr("data-"+e),this.code.sync()},setData:function(e,i){var s=this.selection.getBlocks();t(s).attr("data-"+e,i),this.code.sync()},toggleData:function(e,i){var s=this.selection.getBlocks();t.each(s,function(){t(this).attr("data-"+e)?t(this).removeAttr("data-"+e):t(this).attr("data-"+e,i)})},removeAttr:function(e){var i=this.selection.getBlocks();t(i).removeAttr(e),this.code.sync()},setAttr:function(e,i){var s=this.selection.getBlocks();t(s).attr(e,i),this.code.sync()},toggleAttr:function(e,i){var s=this.selection.getBlocks();t.each(s,function(){t(this).attr(name)?t(this).removeAttr(name):t(this).attr(name,i)})},removeClass:function(e){var i=this.selection.getBlocks();t(i).removeClass(e),this.utils.removeEmptyAttr(i,"class"),this.code.sync()},setClass:function(e){var i=this.selection.getBlocks();t(i).addClass(e),this.code.sync()},toggleClass:function(e){var i=this.selection.getBlocks();t(i).toggleClass(e),this.code.sync()}}},buffer:function(){return{set:function(t){"undefined"==typeof t||"undo"==t?this.buffer.setUndo():this.buffer.setRedo()},setUndo:function(){this.selection.save(),this.opts.buffer.push(this.$editor.html()),this.selection.restore()},setRedo:function(){this.selection.save(),this.opts.rebuffer.push(this.$editor.html()),this.selection.restore()},getUndo:function(){this.$editor.html(this.opts.buffer.pop())},getRedo:function(){this.$editor.html(this.opts.rebuffer.pop())},add:function(){this.opts.buffer.push(this.$editor.html())},undo:function(){0!==this.opts.buffer.length&&(this.buffer.set("redo"),this.buffer.getUndo(),this.selection.restore(),setTimeout(t.proxy(this.observe.load,this),50))},redo:function(){0!==this.opts.rebuffer.length&&(this.buffer.set("undo"),this.buffer.getRedo(),this.selection.restore(),setTimeout(t.proxy(this.observe.load,this),50))}}},build:function(){return{focused:!1,blured:!0,run:function(){this.build.createContainerBox(),this.build.loadContent(),this.build.loadEditor(),this.build.enableEditor(),this.build.setCodeAndCall()},isTextarea:function(){return"TEXTAREA"===this.$element[0].tagName},createContainerBox:function(){this.$box=t('<div class="redactor-box" role="application" />')},createTextarea:function(){this.$textarea=t("<textarea />").attr("name",this.build.getTextareaName())},getTextareaName:function(){return"undefined"==typeof name?"content-"+this.uuid:this.$element.attr("id")},loadContent:function(){var e=this.build.isTextarea()?"val":"html";this.content=t.trim(this.$element[e]())},enableEditor:function(){this.$editor.attr({contenteditable:!0,dir:this.opts.direction})},loadEditor:function(){var t=this.build.isTextarea()?"fromTextarea":"fromElement";this.build[t]()},fromTextarea:function(){this.$editor=t("<div />"),this.$textarea=this.$element,this.$box.insertAfter(this.$element).append(this.$editor).append(this.$element),this.$editor.addClass("redactor-editor"),this.$element.hide()},fromElement:function(){this.$editor=this.$element,this.build.createTextarea(),this.$box.insertAfter(this.$editor).append(this.$editor).append(this.$textarea),this.$editor.addClass("redactor-editor"),this.$textarea.hide()},setCodeAndCall:function(){this.code.set(this.content),this.build.setOptions(),this.build.callEditor(),this.opts.visual||setTimeout(t.proxy(this.code.showCode,this),200)},callEditor:function(){this.build.disableMozillaEditing(),this.build.disableIeLinks(),this.build.setEvents(),this.build.setHelpers(),this.opts.toolbar&&(this.opts.toolbar=this.toolbar.init(),this.toolbar.build()),this.modal.loadTemplates(),this.build.plugins(),setTimeout(t.proxy(this.observe.load,this),4),this.core.setCallback("init")},setOptions:function(){t(this.$textarea).attr("dir",this.opts.direction),this.opts.linebreaks&&this.$editor.addClass("redactor-linebreaks"),this.opts.tabindex&&this.$editor.attr("tabindex",this.opts.tabindex),this.opts.minHeight&&this.$editor.css("minHeight",this.opts.minHeight),this.opts.maxHeight&&this.$editor.css("maxHeight",this.opts.maxHeight)},setEventDropUpload:function(t){if(t.preventDefault(),this.opts.dragImageUpload&&this.opts.dragFileUpload){var e=t.dataTransfer.files;this.upload.directUpload(e[0],t)}},setEventDrop:function(t){this.code.sync(),setTimeout(this.clean.clearUnverified,1),this.core.setCallback("drop",t)},setEvents:function(){this.$editor.on("dragover.redactor dragenter.redactor",function(t){t.preventDefault(),t.stopPropagation()}),this.$editor.on("drop.redactor",t.proxy(function(t){return t=t.originalEvent||t,void 0!==window.FormData&&t.dataTransfer?0===t.dataTransfer.files.length?this.build.setEventDrop(t):(this.build.setEventDropUpload(t),setTimeout(this.clean.clearUnverified,1),void this.core.setCallback("drop",t)):!0},this)),this.$editor.on("click.redactor",t.proxy(function(t){var e=this.core.getEvent(),i="click"==e||"arrow"==e?!1:"click";this.core.addEvent(i),this.utils.disableSelectAll(),this.core.setCallback("click",t)},this)),this.$editor.on("paste.redactor",t.proxy(this.paste.init,this)),this.$editor.on("cut.redactor",t.proxy(this.code.sync,this)),this.$editor.on("keydown.redactor",t.proxy(this.keydown.init,this)),this.$editor.on("keyup.redactor",t.proxy(this.keyup.init,this)),t.isFunction(this.opts.codeKeydownCallback)&&this.$textarea.on("keydown.redactor-textarea",t.proxy(this.opts.codeKeydownCallback,this)),t.isFunction(this.opts.codeKeyupCallback)&&this.$textarea.on("keyup.redactor-textarea",t.proxy(this.opts.codeKeyupCallback,this)),this.$editor.on("focus.redactor",t.proxy(function(e){t.isFunction(this.opts.focusCallback)&&this.core.setCallback("focus",e),this.build.focused=!0,this.build.blured=!1,this.selection.getCurrent()===!1&&(this.selection.get(),this.range.setStart(this.$editor[0],0),this.range.setEnd(this.$editor[0],0),this.selection.addRange())},this)),t(document).on("mousedown.redactor-blur."+this.uuid,t.proxy(function(e){this.start||this.rtePaste||0===t(e.target).closest(".redactor-editor, .redactor-toolbar, .redactor-dropdown").size()&&(this.utils.disableSelectAll(),!this.build.blured&&t.isFunction(this.opts.blurCallback)&&this.core.setCallback("blur",e),this.build.focused=!1,this.build.blured=!0)},this))},setHelpers:function(){this.linkify.isEnabled()&&this.linkify.format(),this.placeholder.enable(),this.opts.focus&&setTimeout(this.focus.setStart,100),this.opts.focusEnd&&setTimeout(this.focus.setEnd,100)},plugins:function(){this.opts.plugins&&t.each(this.opts.plugins,t.proxy(function(i,s){var r="undefined"!=typeof RedactorPlugins&&"undefined"!=typeof RedactorPlugins[s]?RedactorPlugins:e.fn;if(t.isFunction(r[s])){this[s]=r[s]();for(var o=this.getModuleMethods(this[s]),n=o.length,a=0;n>a;a++)this[s][o[a]]=this[s][o[a]].bind(this);t.isFunction(this[s].init)&&this[s].init()}},this))},disableMozillaEditing:function(){if(this.utils.browser("mozilla"))try{document.execCommand("enableObjectResizing",!1,!1),document.execCommand("enableInlineTableEditing",!1,!1)}catch(t){}},disableIeLinks:function(){this.utils.browser("msie")&&document.execCommand("AutoUrlDetect",!1,!1)}}},button:function(){return{build:function(e,i){var s=t('<a href="#" class="re-icon re-'+e+'" rel="'+e+'" />').attr({role:"button","aria-label":i.title,tabindex:"-1"});if((i.func||i.command||i.dropdown)&&this.button.setEvent(s,e,i),i.dropdown){s.addClass("redactor-toolbar-link-dropdown").attr("aria-haspopup",!0);var r=t('<div class="redactor-dropdown redactor-dropdown-'+this.uuid+" redactor-dropdown-box-"+e+'" style="display: none;">');s.data("dropdown",r),this.dropdown.build(e,r,i.dropdown)}return this.utils.isDesktop()&&this.button.createTooltip(s,e,i.title),s},setEvent:function(e,i,s){e.on("touchstart click",t.proxy(function(t){if(e.hasClass("redactor-button-disabled"))return!1;var r="func",o=s.func;s.command?(r="command",o=s.command):s.dropdown&&(r="dropdown",o=!1),this.button.onClick(t,i,r,o)},this))},createTooltip:function(e,i,s){var r=t("<span>").addClass("redactor-toolbar-tooltip redactor-toolbar-tooltip-"+this.uuid+" redactor-toolbar-tooltip-"+i).hide().html(s);r.appendTo("body"),e.on("mouseover",function(){if(!t(this).hasClass("redactor-button-disabled")){var i=e.offset();r.css({top:i.top+e.innerHeight()+"px",left:i.left+e.innerWidth()/2-r.innerWidth()/2+"px"}),r.show()}}),e.on("mouseout",function(){r.hide()})},onClick:function(e,i,s,r){this.button.caretOffset=this.caret.getOffset(),e.preventDefault(),t(document).find(".redactor-toolbar-tooltip").hide(),this.utils.browser("msie")&&(e.returnValue=!1),"command"==s?this.inline.format(r):"dropdown"==s?this.dropdown.show(e,i):this.button.onClickCallback(e,r,i)},onClickCallback:function(e,i,s){var r;if(t.isFunction(i))i.call(this,s);else if("-1"!=i.search(/\./)){if(r=i.split("."),"undefined"==typeof this[r[0]])return;this[r[0]][r[1]](s)}else this[i](s);this.observe.buttons(e,s)},get:function(t){return this.$toolbar.find("a.re-"+t)},setActive:function(t){this.button.get(t).addClass("redactor-act")},setInactive:function(t){this.button.get(t).removeClass("redactor-act")},setInactiveAll:function(t){"undefined"==typeof t?this.$toolbar.find("a.re-icon").removeClass("redactor-act"):this.$toolbar.find("a.re-icon").not(".re-"+t).removeClass("redactor-act")},setActiveInVisual:function(){this.$toolbar.find("a.re-icon").not("a.re-html, a.re-fullscreen").removeClass("redactor-button-disabled")},setInactiveInCode:function(){this.$toolbar.find("a.re-icon").not("a.re-html, a.re-fullscreen").addClass("redactor-button-disabled")},changeIcon:function(t,e){this.button.get(t).addClass("re-"+e)},removeIcon:function(t,e){this.button.get(t).removeClass("re-"+e)},setAwesome:function(t,e){var i=this.button.get(t);i.removeClass("redactor-btn-image").addClass("fa-redactor-btn"),i.html('<i class="fa '+e+'"></i>')},addCallback:function(e,i){if("buffer"!=e){var s="dropdown"==i?"dropdown":"func",r=e.attr("rel");e.on("touchstart click",t.proxy(function(t){return e.hasClass("redactor-button-disabled")?!1:void this.button.onClick(t,r,s,i)},this))}},addDropdown:function(e,i){e.addClass("redactor-toolbar-link-dropdown").attr("aria-haspopup",!0);var s=e.attr("rel");this.button.addCallback(e,"dropdown");var r=t('<div class="redactor-dropdown redactor-dropdown-'+this.uuid+" redactor-dropdown-box-"+s+'" style="display: none;">');return e.data("dropdown",r),i&&this.dropdown.build(s,r,i),r},add:function(e,i){if(this.opts.toolbar){if(this.button.isMobileUndoRedo(e))return"buffer";var s=this.button.build(e,{title:i});return s.addClass("redactor-btn-image"),this.$toolbar.append(t("<li>").append(s)),s}},addFirst:function(e,i){if(this.opts.toolbar){if(this.button.isMobileUndoRedo(e))return"buffer";var s=this.button.build(e,{title:i});return s.addClass("redactor-btn-image"),this.$toolbar.prepend(t("<li>").append(s)),s}},addAfter:function(e,i,s){if(this.opts.toolbar){if(this.button.isMobileUndoRedo(i))return"buffer";var r=this.button.build(i,{title:s});r.addClass("redactor-btn-image");var o=this.button.get(e);return 0!==o.length?o.parent().after(t("<li>").append(r)):this.$toolbar.append(t("<li>").append(r)),r}},addBefore:function(e,i,s){if(this.opts.toolbar){if(this.button.isMobileUndoRedo(i))return"buffer";var r=this.button.build(i,{title:s});r.addClass("redactor-btn-image");var o=this.button.get(e);return 0!==o.length?o.parent().before(t("<li>").append(r)):this.$toolbar.append(t("<li>").append(r)),r}},remove:function(t){this.button.get(t).remove()},isMobileUndoRedo:function(t){return("undo"==t||"redo"==t)&&!this.utils.isDesktop()}}},caret:function(){return{setStart:function(e){if(this.utils.isBlock(e))this.caret.set(e,0,e,0);else{var i=this.utils.createSpaceElement();t(e).prepend(i),this.caret.setEnd(i)}},setEnd:function(t){return t=t[0]||t,1==t.lastChild.nodeType?this.caret.setAfter(t.lastChild):void this.caret.set(t,1,t,1)},set:function(e,i,s,r){if(e=e[0]||e,s=s[0]||s,this.utils.isBlockTag(e.tagName)&&""===e.innerHTML&&(e.innerHTML=this.opts.invisibleSpace),"BR"==e.tagName&&this.opts.linebreaks===!1){var o=t(this.opts.emptyHtml)[0];t(e).replaceWith(o),e=o,s=e}this.selection.get();try{this.range.setStart(e,i),this.range.setEnd(s,r)}catch(t){}this.selection.addRange()},setAfter:function(e){try{var i=t(e)[0].tagName;if("BR"==i||this.utils.isBlock(e))"BR"!=i&&this.utils.browser("msie")?this.caret.setStart(t(e).next()):this.caret.setAfterOrBefore(e,"after");else{var s=this.utils.createSpaceElement();t(e).after(s),this.caret.setEnd(s)}}catch(i){var s=this.utils.createSpaceElement();t(e).after(s),this.caret.setEnd(s)}},setBefore:function(e){this.utils.isBlock(e)?this.caret.setEnd(t(e).prev()):this.caret.setAfterOrBefore(e,"before")},setAfterOrBefore:function(t,e){if(this.utils.browser("msie")||this.$editor.focus(),t=t[0]||t,this.selection.get(),"after"==e)try{this.range.setStartAfter(t),this.range.setEndAfter(t)}catch(t){}else try{this.range.setStartBefore(t),this.range.setEndBefore(t)}catch(t){}this.range.collapse(!1),this.selection.addRange()},getOffsetOfElement:function(e){e=e[0]||e,this.selection.get();var i=this.range.cloneRange();return i.selectNodeContents(e),i.setEnd(this.range.endContainer,this.range.endOffset),t.trim(i.toString()).length},getOffset:function(){var t=0,e=window.getSelection();if(e.rangeCount>0){var i=window.getSelection().getRangeAt(0),s=i.cloneRange();s.selectNodeContents(this.$editor[0]),s.setEnd(i.endContainer,i.endOffset),t=s.toString().length}return t},setOffset:function(t,e){"undefined"==typeof e&&(e=t),this.focus.isFocused()||this.focus.setStart();for(var i,s=(this.selection.get(),0),r=document.createTreeWalker(this.$editor[0],NodeFilter.SHOW_TEXT,null,null);i=r.nextNode();)if(s+=i.nodeValue.length,s>t&&(this.range.setStart(i,i.nodeValue.length+t-s),t=1/0),s>=e){this.range.setEnd(i,i.nodeValue.length+e-s);break}this.range.collapse(!1),this.selection.addRange()},setToPoint:function(t,e){this.caret.setOffset(t,e)},getCoords:function(){return this.caret.getOffset()}}},clean:function(){return{onSet:function(e){e=this.clean.savePreCode(e),e=e.replace(/<script(.*?[^>]?)>([\w\W]*?)<\/script>/gi,'<pre class="redactor-script-tag" style="display: none;" $1>$2</pre>'),e=e.replace(/\$/g,"$"),e=e.replace(/<a href="(.*?[^>]?)®(.*?[^>]?)">/gi,'<a href="$1®$2">'),this.opts.replaceDivs&&!this.opts.linebreaks&&(e=this.clean.replaceDivs(e)),this.opts.linebreaks&&(e=this.clean.replaceParagraphsToBr(e)),e=this.clean.saveFormTags(e);var i=t("<div>");i.html(e);var s=i.find("font[style]");return 0!==s.length&&(s.replaceWith(function(){var e=t(this),i=t("<span>").attr("style",e.attr("style"));return i.append(e.contents())}),e=i.html()),i.remove(),e=e.replace(/<font(.*?)>/gi,""),e=e.replace(/<\/font>/gi,""),
e=this.tidy.load(e),this.opts.paragraphize&&(e=this.paragraphize.load(e)),e=this.clean.setVerified(e),e=this.clean.convertInline(e),e=e.replace(/&/g,"&")},onSync:function(e){if(e=e.replace(/\u200B/g,""),e=e.replace(/​/gi,""),this.opts.cleanSpaces&&(e=e.replace(/ /gi," ")),-1!=e.search(/^<p>(||\s||<br\s?\/?>|| )<\/p>$/i))return"";e=e.replace(/<pre class="redactor-script-tag" style="display: none;"(.*?[^>]?)>([\w\W]*?)<\/pre>/gi,"<script$1>$2</script>"),e=this.clean.restoreFormTags(e);var i={"™":"™","©":"©","…":"…","—":"—","‐":"‐"};t.each(i,function(t,i){e=e.replace(new RegExp(t,"g"),i)}),this.utils.browser("mozilla")&&(e=e.replace(/<br\s?\/?>$/gi,"")),e=e.replace(new RegExp("<br\\s?/?></li>","gi"),"</li>"),e=e.replace(new RegExp("</li><br\\s?/?>","gi"),"</li>"),e=e.replace(/<(.*?)rel="\s*?"(.*?[^>]?)>/gi,'<$1$2">'),e=e.replace(/<(.*?)style="\s*?"(.*?[^>]?)>/gi,'<$1$2">'),e=e.replace(/="">/gi,">"),e=e.replace(/""">/gi,'">'),e=e.replace(/"">/gi,'">'),e=e.replace(/<div(.*?)data-tagblock="redactor"(.*?[^>])>/gi,"<div$1$2>"),e=e.replace(/<(.*?) data-verified="redactor"(.*?[^>])>/gi,"<$1$2>");var s=t("<div/>").html(t.parseHTML(e,document,!0));return s.find("span").removeAttr("rel"),s.find("pre .redactor-invisible-space").each(function(){t(this).contents().unwrap()}),e=s.html(),e=e.replace(/<img(.*?[^>])rel="(.*?[^>])"(.*?[^>])>/gi,"<img$1$3>"),e=e.replace(/<span class="redactor-invisible-space">(.*?)<\/span>/gi,"$1"),e=e.replace(/ data-save-url="(.*?[^>])"/gi,""),e=e.replace(/<span(.*?)id="redactor-image-box"(.*?[^>])>([\w\W]*?)<img(.*?)><\/span>/gi,"$3<img$4>"),e=e.replace(/<span(.*?)id="redactor-image-resizer"(.*?[^>])>(.*?)<\/span>/gi,""),e=e.replace(/<span(.*?)id="redactor-image-editter"(.*?[^>])>(.*?)<\/span>/gi,""),e=e.replace(/<font(.*?)>/gi,""),e=e.replace(/<\/font>/gi,""),e=this.tidy.load(e),this.opts.linkNofollow&&(e=e.replace(/<a(.*?)rel="nofollow"(.*?[^>])>/gi,"<a$1$2>"),e=e.replace(/<a(.*?[^>])>/gi,'<a$1 rel="nofollow">')),e=e.replace(/\sdata-redactor-(tag|class|style)="(.*?[^>])"/gi,""),e=e.replace(new RegExp('<(.*?) data-verified="redactor"(.*?[^>])>',"gi"),"<$1$2>"),e=e.replace(new RegExp('<(.*?) data-verified="redactor">',"gi"),"<$1>"),e=e.replace(/&/g,"&")},onPaste:function(e,i){if(e=t.trim(e),e=e.replace(/\$/g,"$"),e=e.replace(/<span class="s[0-9]">/gi,"<span>"),e=e.replace(/<span class="Apple-converted-space"> <\/span>/gi," "),e=e.replace(/<span class="Apple-tab-span"[^>]*>\t<\/span>/gi," "),e=e.replace(/<span[^>]*>(\s| )<\/span>/gi," "),this.opts.pastePlainText)return this.clean.getPlainText(e);if(!this.utils.isSelectAll()&&"undefined"==typeof i){if(this.utils.isCurrentOrParent(["FIGCAPTION","A"]))return this.clean.getPlainText(e,!1);if(this.utils.isCurrentOrParent("PRE"))return e=e.replace(/”/g,'"'),e=e.replace(/“/g,'"'),e=e.replace(/‘/g,"'"),e=e.replace(/’/g,"'"),this.clean.getPreCode(e);if(this.utils.isCurrentOrParent(["BLOCKQUOTE","H1","H2","H3","H4","H5","H6"])){if(e=this.clean.getOnlyImages(e),!this.utils.browser("msie")){var s=this.selection.getBlock();s&&"P"==s.tagName&&(e=e.replace(/<img(.*?)>/gi,"<p><img$1></p>"))}return e}if(this.utils.isCurrentOrParent(["TD"]))return e=this.clean.onPasteTidy(e,"td"),this.opts.linebreaks&&(e=this.clean.replaceParagraphsToBr(e)),e=this.clean.replaceDivsToBr(e);if(this.utils.isCurrentOrParent(["LI"]))return this.clean.onPasteTidy(e,"li")}return e=this.clean.isSingleLine(e,i),this.clean.singleLine||(this.opts.linebreaks&&(e=this.clean.replaceParagraphsToBr(e)),this.opts.replaceDivs&&(e=this.clean.replaceDivs(e)),e=this.clean.saveFormTags(e)),e=this.clean.onPasteWord(e),e=this.clean.onPasteExtra(e),e=this.clean.onPasteTidy(e,"all"),!this.clean.singleLine&&this.opts.paragraphize&&(e=this.paragraphize.load(e)),e=this.clean.removeDirtyStyles(e),e=this.clean.onPasteRemoveSpans(e),e=this.clean.onPasteRemoveEmpty(e),e=this.clean.convertInline(e)},onPasteWord:function(e){if(e=e.replace(/<!--[\s\S]*?-->/gi,""),e=e.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,""),e=e.replace(/<o\:p[^>]*>[\s\S]*?<\/o\:p>/gi,""),e.match(/class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i)){e=e.replace(/<!--[\s\S]+?-->/gi,""),e=e.replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,""),e=e.replace(/<(\/?)s>/gi,"<$1strike>"),e=e.replace(/ /gi," "),e=e.replace(/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(t,e){return e.length>0?e.replace(/./," ").slice(Math.floor(e.length/2)).split("").join(" "):""}),e=this.clean.onPasteIeFixLinks(e),e=e.replace(/<img(.*?)v:shapes=(.*?)>/gi,""),e=e.replace(/src="file\:\/\/(.*?)"/,'src=""');var i=t("<div/>").html(e),s=!1,r=1,o=[];i.find("p[style]").each(function(){var e=t(this).attr("style").match(/mso\-list\:l([0-9]+)\slevel([0-9]+)/);if(e){var n=parseInt(e[1]),a=parseInt(e[2]),l=t(this).html().match(/^[\w]+\./)?"ol":"ul",c=t("<li/>").html(t(this).html());if(c.html(c.html().replace(/^([\w\.]+)</,"<")),c.find("span:first").remove(),1==a&&-1==t.inArray(n,o)){var h=t("<"+l+"/>").attr({"data-level":a,"data-list":n}).html(c);t(this).replaceWith(h),s=n,o.push(n)}else{if(a>r){for(var d=i.find('[data-level="'+r+'"][data-list="'+s+'"]'),u=d,p=r;a>p;p++)h=t("<"+l+"/>"),h.appendTo(u.find("li").last()),u=h;u.attr({"data-level":a,"data-list":n}).html(c)}else{var d=i.find('[data-level="'+a+'"][data-list="'+n+'"]').last();d.append(c)}r=a,s=n,t(this).remove()}}}),i.find("[data-level][data-list]").removeAttr("data-level data-list"),e=i.html(),e=e.replace(/·/g,""),e=e.replace(/<p class="Mso(.*?)"/gi,"<p"),e=e.replace(/ class=\"(mso[^\"]*)\"/gi,""),e=e.replace(/ class=(mso\w+)/gi,""),e=e.replace(/<o:p(.*?)>([\w\W]*?)<\/o:p>/gi,"$2"),e=e.replace(/\n/g," "),e=e.replace(/<p>\n?<li>/gi,"<li>")}return e},onPasteExtra:function(t){return t=t.replace(/<b\sid="internal-source-marker(.*?)">([\w\W]*?)<\/b>/gi,"$2"),t=t.replace(/<b(.*?)id="docs-internal-guid(.*?)">([\w\W]*?)<\/b>/gi,"$3"),t=t.replace(/<span[^>]*(font-style: italic; font-weight: bold|font-weight: bold; font-style: italic)[^>]*>/gi,'<span style="font-weight: bold;"><span style="font-style: italic;">'),t=t.replace(/<span[^>]*font-style: italic[^>]*>/gi,'<span style="font-style: italic;">'),t=t.replace(/<span[^>]*font-weight: bold[^>]*>/gi,'<span style="font-weight: bold;">'),t=t.replace(/<span[^>]*text-decoration: underline[^>]*>/gi,'<span style="text-decoration: underline;">'),t=t.replace(/<img>/gi,""),t=t.replace(/\n{3,}/gi,"\n"),t=t.replace(/<font(.*?)>([\w\W]*?)<\/font>/gi,"$2"),t=t.replace(/<p><p>/gi,"<p>"),t=t.replace(/<\/p><\/p>/gi,"</p>"),t=t.replace(/<li>(\s*|\t*|\n*)<p>/gi,"<li>"),t=t.replace(/<\/p>(\s*|\t*|\n*)<\/li>/gi,"</li>"),t=t.replace(/<\/p>\s<p/gi,"</p><p"),t=t.replace(/<img src="webkit-fake-url\:\/\/(.*?)"(.*?)>/gi,""),t=t.replace(/<p>•([\w\W]*?)<\/p>/gi,"<li>$1</li>"),this.utils.browser("mozilla")&&(t=t.replace(/<br\s?\/?>$/gi,"")),t},onPasteTidy:function(t,e){var i=["span","a","pre","blockquote","small","em","strong","code","kbd","mark","address","cite","var","samp","dfn","sup","sub","b","i","u","del","ol","ul","li","dl","dt","dd","p","br","video","audio","iframe","embed","param","object","img","table","td","th","tr","tbody","tfoot","thead","h1","h2","h3","h4","h5","h6"],s=!1,r=[["a","*"],["img",["src","alt"]],["span",["class","rel","data-verified"]],["iframe","*"],["video","*"],["audio","*"],["embed","*"],["object","*"],["param","*"],["source","*"]];"all"==e?(s=["p","span","h1","h2","h3","h4","h5","h6"],r=[["table","class"],["td",["colspan","rowspan"]],["a","*"],["img",["src","alt","data-redactor-inserted-image"]],["span",["class","rel","data-verified"]],["iframe","*"],["video","*"],["audio","*"],["embed","*"],["object","*"],["param","*"],["source","*"]]):"td"==e?i=["ul","ol","li","span","a","small","em","strong","code","kbd","mark","cite","var","samp","dfn","sup","sub","b","i","u","del","ol","ul","li","dl","dt","dd","br","iframe","video","audio","embed","param","object","img","h1","h2","h3","h4","h5","h6"]:"li"==e&&(i=["ul","ol","li","span","a","small","em","strong","code","kbd","mark","cite","var","samp","dfn","sup","sub","b","i","u","del","br","iframe","video","audio","embed","param","object","img"]);var o={deniedTags:this.opts.deniedTags?this.opts.deniedTags:!1,allowedTags:this.opts.allowedTags?this.opts.allowedTags:i,removeComments:!0,removePhp:!0,removeAttr:this.opts.removeAttr?this.opts.removeAttr:!1,allowedAttr:this.opts.allowedAttr?this.opts.allowedAttr:r,removeEmpty:s};return this.tidy.load(t,o)},onPasteRemoveEmpty:function(t){return t=t.replace(/<(p|h[1-6])>(|\s|\n|\t|<br\s?\/?>)<\/(p|h[1-6])>/gi,""),this.opts.linebreaks||(t=t.replace(/<br>$/i,"")),t},onPasteRemoveSpans:function(t){return t=t.replace(/<span>(.*?)<\/span>/gi,"$1"),t=t.replace(/<span[^>]*>\s| <\/span>/gi," ")},onPasteIeFixLinks:function(e){if(!this.utils.browser("msie"))return e;var i=t.trim(e);return 0===i.search(/^<a(.*?)>(.*?)<\/a>$/i)&&(e=e.replace(/^<a(.*?)>(.*?)<\/a>$/i,"$2")),e},isSingleLine:function(t,e){if(this.clean.singleLine=!1,!this.utils.isSelectAll()&&"undefined"==typeof e){var i=this.opts.blockLevelElements.join("|").replace("P|","").replace("DIV|",""),s=t.match(new RegExp("</("+i+")>","gi")),r=t.match(/<\/(p|div)>/gi);if(!s&&(null===r||r&&r.length<=1)){var o=t.match(/<br\s?\/?>/gi);o||(this.clean.singleLine=!0,t=t.replace(/<\/?(p|div)(.*?)>/gi,""))}}return t},stripTags:function(t,e){e=(((e||"")+"").toLowerCase().match(/<[a-z][a-z0-9]*>/g)||[]).join("");var i=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;return t.replace(i,function(t,i){return e.indexOf("<"+i.toLowerCase()+">")>-1?t:""})},savePreCode:function(t){return t=this.clean.savePreFormatting(t),t=this.clean.saveCodeFormatting(t),t=this.clean.restoreSelectionMarker(t)},savePreFormatting:function(e){var i=e.match(/<pre(.*?)>([\w\W]*?)<\/pre>/gi);return null!==i&&t.each(i,t.proxy(function(t,i){var s=i.match(/<pre(.*?)>([\w\W]*?)<\/pre>/i);s[2]=s[2].replace(/<br\s?\/?>/g,"\n"),s[2]=s[2].replace(/ /g," "),this.opts.preSpaces&&(s[2]=s[2].replace(/\t/g,Array(this.opts.preSpaces+1).join(" "))),s[2]=this.clean.encodeEntities(s[2]),s[2]=s[2].replace(/\$/g,"$"),e=e.replace(i,"<pre"+s[1]+">"+s[2]+"</pre>")},this)),e},saveCodeFormatting:function(e){var i=e.match(/<code(.*?)>([\w\W]*?)<\/code>/gi);return null!==i&&t.each(i,t.proxy(function(t,i){var s=i.match(/<code(.*?)>([\w\W]*?)<\/code>/i);s[2]=s[2].replace(/ /g," "),s[2]=this.clean.encodeEntities(s[2]),s[2]=s[2].replace(/\$/g,"$"),e=e.replace(i,"<code"+s[1]+">"+s[2]+"</code>")},this)),e},restoreSelectionMarker:function(t){return t=t.replace(/<span id="selection-marker-([0-9])" class="redactor-selection-marker" data-verified="redactor"><\/span>/g,'<span id="selection-marker-$1" class="redactor-selection-marker" data-verified="redactor"></span>')},getTextFromHtml:function(e){e=e.replace(/<br\s?\/?>|<\/H[1-6]>|<\/p>|<\/div>|<\/li>|<\/td>/gi,"\n");var i=document.createElement("div");return i.innerHTML=e,e=i.textContent||i.innerText,t.trim(e)},getPlainText:function(t,e){return t=this.clean.getTextFromHtml(t),t=t.replace(/\n\s*\n/g,"\n"),t=t.replace(/\n\n/g,"\n"),t=t.replace(/\n/g,"<br />"),this.opts.paragraphize&&"undefined"==typeof e&&!this.utils.browser("mozilla")&&(t=this.paragraphize.load(t)),t},getPreCode:function(t){return t=t.replace(/<img(.*?) style="(.*?)"(.*?[^>])>/gi,"<img$1$3>"),t=t.replace(/<img(.*?)>/gi,"<img$1>"),t=this.clean.getTextFromHtml(t),this.opts.preSpaces&&(t=t.replace(/\t/g,Array(this.opts.preSpaces+1).join(" "))),t=this.clean.encodeEntities(t)},getOnlyImages:function(t){return t=t.replace(/<img(.*?)>/gi,"[img$1]"),t=t.replace(/<([Ss]*?)>/gi,""),t=t.replace(/\[img(.*?)\]/gi,"<img$1>")},getOnlyLinksAndImages:function(t){return t=t.replace(/<a(.*?)href="(.*?)"(.*?)>([\w\W]*?)<\/a>/gi,'[a href="$2"]$4[/a]'),t=t.replace(/<img(.*?)>/gi,"[img$1]"),t=t.replace(/<(.*?)>/gi,""),t=t.replace(/\[a href="(.*?)"\]([\w\W]*?)\[\/a\]/gi,'<a href="$1">$2</a>'),t=t.replace(/\[img(.*?)\]/gi,"<img$1>")},encodeEntities:function(t){return t=String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"'),t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},removeDirtyStyles:function(e){if(this.utils.browser("msie"))return e;var i=document.createElement("div");return i.innerHTML=e,this.clean.clearUnverifiedRemove(t(i)),e=i.innerHTML,t(i).remove(),e},clearUnverified:function(){if(!this.utils.browser("msie")){this.clean.clearUnverifiedRemove(this.$editor);var t=this.$editor.find("h1, h2, h3, h4, h5, h6");t.find("span").removeAttr("style"),t.find(this.opts.verifiedTags.join(", ")).removeAttr("style"),this.code.sync()}},clearUnverifiedRemove:function(e){e.find(this.opts.verifiedTags.join(", ")).removeAttr("style"),e.find("span").not('[data-verified="redactor"]').removeAttr("style"),e.find('span[data-verified="redactor"], img[data-verified="redactor"]').each(function(e,i){var s=t(i);s.attr("style",s.attr("rel"))})},cleanEmptyParagraph:function(){},setVerified:function(t){if(this.utils.browser("msie"))return t;t=t.replace(new RegExp("<img(.*?[^>])>","gi"),'<img$1 data-verified="redactor">'),t=t.replace(new RegExp("<span(.*?[^>])>","gi"),'<span$1 data-verified="redactor">');var e=t.match(new RegExp('<(span|img)(.*?)style="(.*?)"(.*?[^>])>',"gi"));if(e)for(var i=e.length,s=0;i>s;s++)try{var r=e[s].replace(/style="(.*?)"/i,'style="$1" rel="$1"');t=t.replace(e[s],r)}catch(t){}return t},convertInline:function(e){var i=t("<div />").html(e),s=this.opts.inlineTags;return s.push("span"),i.find(s.join(",")).each(function(){var e=t(this),i=this.tagName.toLowerCase();e.attr("data-redactor-tag",i),"span"==i&&(e.attr("style")?e.attr("data-redactor-style",e.attr("style")):e.attr("class")&&e.attr("data-redactor-class",e.attr("class")))}),e=i.html(),i.remove(),e},normalizeLists:function(){this.$editor.find("li").each(function(e,i){var s=t(i).next();0===s.length||"UL"!=s[0].tagName&&"OL"!=s[0].tagName||t(i).append(s)})},removeSpaces:function(t){return t=t.replace(/\n/g,""),t=t.replace(/[\t]*/g,""),t=t.replace(/\n\s*\n/g,"\n"),t=t.replace(/^[\s\n]*/g," "),t=t.replace(/[\s\n]*$/g," "),t=t.replace(/>\s{2,}</g,"> <"),t=t.replace(/\n\n/g,"\n"),t=t.replace(/\u200B/g,"")},replaceDivs:function(t){return this.opts.linebreaks?(t=t.replace(/<div><br\s?\/?><\/div>/gi,"<br />"),t=t.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi,"$2<br />")):t=t.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi,"<p$1>$2</p>"),t=t.replace(/<div(.*?[^>])>/gi,""),t=t.replace(/<\/div>/gi,"")},replaceDivsToBr:function(t){return t=t.replace(/<div\s(.*?)>/gi,"<p>"),t=t.replace(/<div><br\s?\/?><\/div>/gi,"<br /><br />"),t=t.replace(/<div>([\w\W]*?)<\/div>/gi,"$1<br /><br />")},replaceParagraphsToBr:function(t){return t=t.replace(/<p\s(.*?)>/gi,"<p>"),t=t.replace(/<p><br\s?\/?><\/p>/gi,"<br />"),t=t.replace(/<p>([\w\W]*?)<\/p>/gi,"$1<br /><br />"),t=t.replace(/(<br\s?\/?>){1,}\n?<\/blockquote>/gi,"</blockquote>")},saveFormTags:function(t){return t.replace(/<form(.*?)>([\w\W]*?)<\/form>/gi,'<section$1 rel="redactor-form-tag">$2</section>')},restoreFormTags:function(t){return t.replace(/<section(.*?) rel="redactor-form-tag"(.*?)>([\w\W]*?)<\/section>/gi,"<form$1$2>$3</form>")}}},code:function(){return{set:function(e){e=t.trim(e.toString()),e=this.clean.onSet(e),this.utils.browser("msie")&&(e=e.replace(/<span(.*?)id="selection-marker-(1|2)"(.*?)><\/span>/gi,"")),this.$editor.html(e),this.code.sync(),""!==e&&this.placeholder.remove(),setTimeout(t.proxy(this.buffer.add,this),15),this.start===!1&&this.observe.load()},get:function(){var t=this.$textarea.val();return this.opts.replaceDivs&&(t=this.clean.replaceDivs(t)),this.opts.linebreaks&&(t=this.clean.replaceParagraphsToBr(t)),t=this.tabifier.get(t)},sync:function(){setTimeout(t.proxy(this.code.startSync,this),10)},startSync:function(){var t=this.$editor.html();this.code.syncCode&&this.code.syncCode==t||this.start&&""==t||(this.code.syncCode=t,t=this.core.setCallback("syncBefore",t),t=this.clean.onSync(t),this.$textarea.val(t),this.core.setCallback("sync",t),this.start===!1&&this.core.setCallback("change",t),this.start=!1,0==this.autosave.html&&(this.autosave.html=this.code.get()),this.opts.codemirror&&this.$textarea.next(".CodeMirror").each(function(e,i){i.CodeMirror.setValue(t)}),this.autosave.onChange(),this.autosave.enable())},toggle:function(){this.opts.visual?this.code.showCode():this.code.showVisual()},showCode:function(){this.selection.save(),this.code.offset=this.caret.getOffset();var e=t(window).scrollTop(),i=(this.$editor.innerWidth(),this.$editor.innerHeight());this.$editor.hide();var s=this.$textarea.val();this.modified=this.clean.removeSpaces(s),s=this.tabifier.get(s);var r=0,o=0,n=t("<div/>").append(t.parseHTML(this.clean.onSync(this.$editor.html()),document,!0)),a=n.find("span.redactor-selection-marker");if(a.length>0){var l=this.tabifier.get(n.html()).replace(/&/g,"&");1==a.length?(r=this.utils.strpos(l,n.find("#selection-marker-1").prop("outerHTML")),o=r):2==a.length&&(r=this.utils.strpos(l,n.find("#selection-marker-1").prop("outerHTML")),o=this.utils.strpos(l,n.find("#selection-marker-2").prop("outerHTML"))-n.find("#selection-marker-1").prop("outerHTML").toString().length)}this.selection.removeMarkers(),this.$textarea.val(s),this.opts.codemirror?this.$textarea.next(".CodeMirror").each(function(e,n){t(n).show(),n.CodeMirror.setValue(s),n.CodeMirror.setSize("100%",i),n.CodeMirror.refresh(),r==o?n.CodeMirror.setCursor(n.CodeMirror.posFromIndex(r).line,n.CodeMirror.posFromIndex(o).ch):n.CodeMirror.setSelection({line:n.CodeMirror.posFromIndex(r).line,ch:n.CodeMirror.posFromIndex(r).ch},{line:n.CodeMirror.posFromIndex(o).line,ch:n.CodeMirror.posFromIndex(o).ch}),n.CodeMirror.focus()}):(this.$textarea.height(i).show().focus(),this.$textarea.on("keydown.redactor-textarea-indenting",this.code.textareaIndenting),t(window).scrollTop(e),this.$textarea[0].setSelectionRange&&this.$textarea[0].setSelectionRange(r,o),this.$textarea[0].scrollTop=0),this.opts.visual=!1,this.button.setInactiveInCode(),this.button.setActive("html"),this.core.setCallback("source",s)},showVisual:function(){var t;if(!this.opts.visual){var e=0,i=0;if(this.opts.codemirror){var s;this.$textarea.next(".CodeMirror").each(function(r,o){s=o.CodeMirror.listSelections(),e=o.CodeMirror.indexFromPos(s[0].anchor),i=o.CodeMirror.indexFromPos(s[0].head),t=o.CodeMirror.getValue()})}else e=this.$textarea.get(0).selectionStart,i=this.$textarea.get(0).selectionEnd,t=this.$textarea.hide().val();if(e>i&&i>0){var r=i,o=e;e=r,i=o}if(e=this.code.enlargeOffset(t,e),i=this.code.enlargeOffset(t,i),t=t.substr(0,e)+this.selection.getMarkerAsHtml(1)+t.substr(e),i>e){var n=this.selection.getMarkerAsHtml(1).toString().length;t=t.substr(0,i+n)+this.selection.getMarkerAsHtml(2)+t.substr(i+n)}this.modified!==this.clean.removeSpaces(t)&&this.code.set(t),this.opts.codemirror&&this.$textarea.next(".CodeMirror").hide(),this.$editor.show(),this.utils.isEmpty(t)||this.placeholder.remove(),this.selection.restore(),this.$textarea.off("keydown.redactor-textarea-indenting"),this.button.setActiveInVisual(),this.button.setInactive("html"),this.observe.load(),this.opts.visual=!0,this.core.setCallback("visual",t)}},textareaIndenting:function(t){if(9!==t.keyCode)return!0;var e=this.$textarea,i=e.get(0).selectionStart;return e.val(e.val().substring(0,i)+" "+e.val().substring(e.get(0).selectionEnd)),e.get(0).selectionStart=e.get(0).selectionEnd=i+1,!1},enlargeOffset:function(t,e){var i=t.length,s=0;if(">"==t[e])s++;else for(var r=e;i>=r&&(s++,">"!=t[r]);r++)if("<"==t[r]||r==i){s=0;break}return e+s}}},core:function(){return{getObject:function(){return t.extend({},this)},getEditor:function(){return this.$editor},getBox:function(){return this.$box},getElement:function(){return this.$element},getTextarea:function(){return this.$textarea},getToolbar:function(){return this.$toolbar?this.$toolbar:!1},addEvent:function(t){this.core.event=t},getEvent:function(){return this.core.event},setCallback:function(e,i,s){var r=e+"Callback",o="redactor",n=this.opts[r];if(this.$textarea){var a=!1,l=t._data(this.$textarea[0],"events");if("undefined"!=typeof l&&"undefined"!=typeof l[r]&&t.each(l[r],t.proxy(function(t,e){if(e.namespace==o){var s="undefined"==typeof s?[i]:[i,s];a="undefined"==typeof s?e.handler.call(this,i):e.handler.call(this,i,s)}},this)),a)return a}return t.isFunction(n)?"undefined"==typeof s?n.call(this,i):n.call(this,i,s):"undefined"==typeof s?i:s},destroy:function(){this.opts.destroyed=!0,this.core.setCallback("destroy"),this.$element.off(".redactor").removeData("redactor"),this.$editor.off(".redactor"),t(document).off("mousedown.redactor-blur."+this.uuid),t(document).off("mousedown.redactor."+this.uuid),t(document).off("click.redactor-image-delete."+this.uuid),t(document).off("click.redactor-image-resize-hide."+this.uuid),t(document).off("touchstart.redactor."+this.uuid+" click.redactor."+this.uuid),t("body").off("scroll.redactor."+this.uuid),t(this.opts.toolbarFixedTarget).off("scroll.redactor."+this.uuid),this.$editor.removeClass("redactor-editor redactor-linebreaks redactor-placeholder"),this.$editor.removeAttr("contenteditable");var e=this.code.get();this.opts.toolbar&&this.$toolbar.find("a").each(function(){var e=t(this);e.data("dropdown")&&(e.data("dropdown").remove(),e.data("dropdown",{}))}),this.build.isTextarea()?(this.$box.after(this.$element),this.$box.remove(),this.$element.val(e).show()):(this.$box.after(this.$editor),this.$box.remove(),this.$element.html(e).show()),this.$pasteBox&&this.$pasteBox.remove(),this.$modalBox&&this.$modalBox.remove(),this.$modalOverlay&&this.$modalOverlay.remove(),t(".redactor-toolbar-tooltip-"+this.uuid).remove(),clearInterval(this.autosaveInterval)}}},dropdown:function(){return{build:function(e,i,s){"formatting"==e&&this.opts.formattingAdd&&t.each(this.opts.formattingAdd,t.proxy(function(t,e){var i,r=e.tag;"undefined"!=typeof e.class&&(r=r+"-"+e.class),e.type=this.utils.isBlockTag(e.tag)?"block":"inline",i="undefined"!=typeof e.func?e.func:"inline"==e.type?"inline.formatting":"block.formatting",this.opts.linebreaks&&"block"==e.type&&"p"==e.tag||(this.formatting[r]={tag:e.tag,style:e.style,class:e.class,attr:e.attr,data:e.data,clear:e.clear},s[r]={func:i,title:e.title})},this)),t.each(s,t.proxy(function(s,r){var o=t('<a href="#" class="redactor-dropdown-'+s+'" role="button">'+r.title+"</a>");"formatting"==e&&o.addClass("redactor-formatting-"+s),o.on("click",t.proxy(function(e){e.preventDefault();var i="func",o=r.func;r.command?(i="command",o=r.command):r.dropdown&&(i="dropdown",o=r.dropdown),t(e.target).hasClass("redactor-dropdown-link-inactive")||(this.button.onClick(e,s,i,o),this.dropdown.hideAll())},this)),this.observe.addDropdown(o,s,r),i.append(o)},this))},show:function(e,i){if(!this.opts.visual)return e.preventDefault(),!1;var s=this.button.get(i),r=s.data("dropdown").appendTo(document.body);if(this.opts.highContrast&&r.addClass("redactor-dropdown-contrast"),s.hasClass("dropact"))this.dropdown.hideAll();else{this.dropdown.hideAll(),this.observe.dropdowns(),this.core.setCallback("dropdownShow",{dropdown:r,key:i,button:s}),this.button.setActive(i),s.addClass("dropact");var o=s.offset(),n=r.width();o.left+n>t(document).width()&&(o.left=Math.max(0,o.left-n));var a=o.left+"px";if(this.$toolbar.hasClass("toolbar-fixed-box")){var l=this.$toolbar.innerHeight()+this.opts.toolbarFixedTopOffset,c="fixed";this.opts.toolbarFixedTarget!==document&&(l=this.$toolbar.innerHeight()+this.$toolbar.offset().top+this.opts.toolbarFixedTopOffset,c="absolute"),r.css({position:c,left:a,top:l+"px"}).show()}else{var l=s.innerHeight()+o.top+"px";r.css({position:"absolute",left:a,top:l}).show()}this.core.setCallback("dropdownShown",{dropdown:r,key:i,button:s}),this.$dropdown=r}t(document).one("click.redactor-dropdown",t.proxy(this.dropdown.hide,this)),this.$editor.one("click.redactor-dropdown",t.proxy(this.dropdown.hide,this)),t(document).one("keyup.redactor-dropdown",t.proxy(this.dropdown.closeHandler,this)),r.on("mouseover.redactor-dropdown",t.proxy(this.utils.disableBodyScroll,this)).on("mouseout.redactor-dropdown",t.proxy(this.utils.enableBodyScroll,this)),e.stopPropagation()},closeHandler:function(t){t.which==this.keyCode.ESC&&(this.dropdown.hideAll(),this.$editor.focus())},hideAll:function(){this.$toolbar.find("a.dropact").removeClass("redactor-act").removeClass("dropact"),this.utils.enableBodyScroll(),t(".redactor-dropdown-"+this.uuid).hide(),t(".redactor-dropdown-link-selected").removeClass("redactor-dropdown-link-selected"),this.$dropdown&&(this.$dropdown.off(".redactor-dropdown"),this.core.setCallback("dropdownHide",this.$dropdown),this.$dropdown=!1)},hide:function(e){var i=t(e.target);i.hasClass("dropact")||i.hasClass("redactor-dropdown-link-inactive")||(i.hasClass("redactor-dropdown")&&(i.removeClass("dropact"),i.off("mouseover mouseout")),this.dropdown.hideAll())}}},file:function(){return{show:function(){this.modal.load("file",this.lang.get("file"),700),this.upload.init("#redactor-modal-file-upload",this.opts.fileUpload,this.file.insert),this.selection.save(),this.selection.get();var e=this.sel.toString();t("#redactor-filename").val(e),this.modal.show()},insert:function(e,i,s){if("undefined"!=typeof e.error)return this.modal.close(),this.selection.restore(),void this.core.setCallback("fileUploadError",e);var r;if("string"==typeof e)r=e;else{var o=t("#redactor-filename").val();("undefined"==typeof o||""===o)&&(o=e.filename),r='<a href="'+e.filelink+'" id="filelink-marker">'+o+"</a>"}if(i){this.selection.removeMarkers();var n=this.selection.getMarker();this.insert.nodeToCaretPositionFromPoint(s,n)}else this.modal.close();if(this.selection.restore(),this.buffer.set(),this.insert.htmlWithoutClean(r),"string"!=typeof e){var a=t(this.$editor.find("a#filelink-marker"));0!==a.length?a.removeAttr("id").removeAttr("style"):a=!1,this.core.setCallback("fileUpload",a,e)}}}},focus:function(){return{setStart:function(){this.$editor.focus();var t=this.$editor.children().first();if(0!==t.length&&0!==t[0].length&&"BR"!=t[0].tagName&&3!=t[0].nodeType){if("UL"==t[0].tagName||"OL"==t[0].tagName){var e=t.find("li").first();if(!this.utils.isBlock(e)&&""===e.text())return void this.caret.setStart(e)}return this.opts.linebreaks&&!this.utils.isBlockTag(t[0].tagName)?(this.selection.get(),this.range.setStart(this.$editor[0],0),this.range.setEnd(this.$editor[0],0),void this.selection.addRange()):void this.caret.setStart(t)}},setEnd:function(){var t=this.$editor.children().last();this.$editor.focus(),0!==t.size()&&(this.utils.isEmpty(this.$editor.html())?(this.selection.get(),this.range.collapse(!0),this.range.setStartAfter(t[0]),this.range.setEnd(t[0],0),this.selection.addRange()):(this.selection.get(),this.range.selectNodeContents(t[0]),this.range.collapse(!1),this.selection.addRange()))},isFocused:function(){return this.$editor[0]===document.activeElement}}},image:function(){return{show:function(){this.modal.load("image",this.lang.get("image"),700),this.upload.init("#redactor-modal-image-droparea",this.opts.imageUpload,this.image.insert),this.selection.save(),this.modal.show()},showEdit:function(e){var i=e.closest("a",this.$editor[0]);if(this.modal.load("imageEdit",this.lang.get("edit"),705),this.modal.createCancelButton(),this.image.buttonDelete=this.modal.createDeleteButton(this.lang.get("_delete")),this.image.buttonSave=this.modal.createActionButton(this.lang.get("save")),this.image.buttonDelete.on("click",t.proxy(function(){this.image.remove(e)},this)),this.image.buttonSave.on("click",t.proxy(function(){this.image.update(e)},this)),t(".redactor-link-tooltip").remove(),t("#redactor-image-title").val(e.attr("alt")),this.opts.imageLink){var s=t("#redactor-image-link");s.attr("href",e.attr("src")),0!==i.length&&(s.val(i.attr("href")),"_blank"==i.attr("target")&&t("#redactor-image-link-blank").prop("checked",!0))}else t(".redactor-image-link-option").hide();if(this.opts.imagePosition){var r="block"==e.css("display")&&"none"==e.css("float")?"center":e.css("float");t("#redactor-image-align").val(r)}else t(".redactor-image-position-option").hide();this.modal.show(),t("#redactor-image-title").focus()},setFloating:function(e){var i=t("#redactor-image-align").val(),s="",r="",o="";switch(i){case"left":s="left",o="0 "+this.opts.imageFloatMargin+" "+this.opts.imageFloatMargin+" 0";break;case"right":s="right",o="0 0 "+this.opts.imageFloatMargin+" "+this.opts.imageFloatMargin;break;case"center":r="block",o="auto"}e.css({float:s,display:r,margin:o}),e.attr("rel",e.attr("style"))},update:function(e){this.image.hideResize(),this.buffer.set();var i=e.closest("a",this.$editor[0]),s=t("#redactor-image-title").val().replace(/(<([^>]+)>)/gi,"");e.attr("alt",s),this.image.setFloating(e);var r=t.trim(t("#redactor-image-link").val()),r=r.replace(/(<([^>]+)>)/gi,"");if(""!==r){var o="((xn--)?[a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}",n=new RegExp("^(http|ftp|https)://"+o,"i"),a=new RegExp("^"+o,"i");-1==r.search(n)&&0===r.search(a)&&this.opts.linkProtocol&&(r=this.opts.linkProtocol+"://"+r);var l=t("#redactor-image-link-blank").prop("checked")?!0:!1;if(0===i.length){var c=t('<a href="'+r+'">'+this.utils.getOuterHtml(e)+"</a>");l&&c.attr("target","_blank"),e.replaceWith(c)}else i.attr("href",r),l?i.attr("target","_blank"):i.removeAttr("target")}else 0!==i.length&&i.replaceWith(this.utils.getOuterHtml(e));this.modal.close(),this.observe.images(),this.code.sync()},setEditable:function(e){this.opts.imageEditable&&e.on("dragstart",t.proxy(this.image.onDrag,this));var i=t.proxy(function(){this.observe.image=e,this.image.resizer=this.image.loadEditableControls(e),t(document).on("mousedown.redactor-image-resize-hide."+this.uuid,t.proxy(this.image.hideResize,this)),this.opts.imageResizable&&this.image.resizer.on("mousedown.redactor touchstart.redactor",t.proxy(function(t){this.image.setResizable(t,e)},this))},this);e.off("mousedown.redactor").on("mousedown.redactor",t.proxy(this.image.hideResize,this)),e.off("click.redactor touchstart.redactor").on("click.redactor touchstart.redactor",i)},setResizable:function(t,e){t.preventDefault(),this.image.resizeHandle={x:t.pageX,y:t.pageY,el:e,ratio:e.width()/e.height(),h:e.height()},t=t.originalEvent||t,t.targetTouches&&(this.image.resizeHandle.x=t.targetTouches[0].pageX,this.image.resizeHandle.y=t.targetTouches[0].pageY),this.image.startResize()},startResize:function(){t(document).on("mousemove.redactor-image-resize touchmove.redactor-image-resize",t.proxy(this.image.moveResize,this)),t(document).on("mouseup.redactor-image-resize touchend.redactor-image-resize",t.proxy(this.image.stopResize,this))},moveResize:function(t){t.preventDefault(),t=t.originalEvent||t;var e=this.image.resizeHandle.h;e+=t.targetTouches?t.targetTouches[0].pageY-this.image.resizeHandle.y:t.pageY-this.image.resizeHandle.y;var i=Math.round(e*this.image.resizeHandle.ratio);if(!(50>e||100>i)){var e=Math.round(this.image.resizeHandle.el.width()/this.image.resizeHandle.ratio);this.image.resizeHandle.el.attr({width:i,height:e}),this.image.resizeHandle.el.width(i),this.image.resizeHandle.el.height(e),this.code.sync()}},stopResize:function(){this.handle=!1,t(document).off(".redactor-image-resize"),this.image.hideResize()},onDrag:function(e){return 0!==this.$editor.find("#redactor-image-box").length?(e.preventDefault(),!1):void this.$editor.on("drop.redactor-image-inside-drop",t.proxy(function(){setTimeout(t.proxy(this.image.onDrop,this),1)},this))},onDrop:function(){this.image.fixImageSourceAfterDrop(),this.observe.images(),this.$editor.off("drop.redactor-image-inside-drop"),this.clean.clearUnverified(),this.code.sync()},fixImageSourceAfterDrop:function(){this.$editor.find("img[data-save-url]").each(function(){var e=t(this);e.attr("src",e.attr("data-save-url")),e.removeAttr("data-save-url")})},hideResize:function(e){if(!e||0===t(e.target).closest("#redactor-image-box",this.$editor[0]).length){if(e&&"IMG"==e.target.tagName){
-var i=t(e.target);i.attr("data-save-url",i.attr("src"))}var s=this.$editor.find("#redactor-image-box");0!==s.length&&(t("#redactor-image-editter").remove(),t("#redactor-image-resizer").remove(),s.find("img").css({marginTop:s[0].style.marginTop,marginBottom:s[0].style.marginBottom,marginLeft:s[0].style.marginLeft,marginRight:s[0].style.marginRight}),s.css("margin",""),s.find("img").css("opacity",""),s.replaceWith(function(){return t(this).contents()}),t(document).off("mousedown.redactor-image-resize-hide."+this.uuid),"undefined"!=typeof this.image.resizeHandle&&this.image.resizeHandle.el.attr("rel",this.image.resizeHandle.el.attr("style")),this.code.sync())}},loadResizableControls:function(e,i){if(this.opts.imageResizable&&!this.utils.isMobile()){var s=t('<span id="redactor-image-resizer" data-redactor="verified"></span>');return this.utils.isDesktop()||s.css({width:"15px",height:"15px"}),s.attr("contenteditable",!1),i.append(s),i.append(e),s}return i.append(e),!1},loadEditableControls:function(e){var i=t('<span id="redactor-image-box" data-redactor="verified">');if(i.css("float",e.css("float")).attr("contenteditable",!1),"auto"!=e[0].style.margin?(i.css({marginTop:e[0].style.marginTop,marginBottom:e[0].style.marginBottom,marginLeft:e[0].style.marginLeft,marginRight:e[0].style.marginRight}),e.css("margin","")):i.css({display:"block",margin:"auto"}),e.css("opacity",".5").after(i),this.opts.imageEditable){this.image.editter=t('<span id="redactor-image-editter" data-redactor="verified">'+this.lang.get("edit")+"</span>"),this.image.editter.attr("contenteditable",!1),this.image.editter.on("click",t.proxy(function(){this.image.showEdit(e)},this)),i.append(this.image.editter);var s=this.image.editter.innerWidth();this.image.editter.css("margin-left","-"+s/2+"px")}return this.image.loadResizableControls(e,i)},remove:function(e){var i=t(e),s=i.closest("a",this.$editor[0]),r=i.closest("figure",this.$editor[0]),o=i.parent();0!==t("#redactor-image-box").length&&(o=t("#redactor-image-box").parent());var n;0!==r.length?(n=r.next(),r.remove()):0!==s.length?(o=s.parent(),s.remove()):i.remove(),t("#redactor-image-box").remove(),this.caret.setStart(0!==r.length?n:o),this.core.setCallback("imageDelete",i[0].src,i),this.modal.close(),this.code.sync()},insert:function(e,i,s){if("undefined"!=typeof e.error)return this.modal.close(),this.selection.restore(),void this.core.setCallback("imageUploadError",e);var r;"string"==typeof e?r=t(e).attr("data-redactor-inserted-image","true"):(r=t("<img>"),r.attr("src",e.filelink).attr("data-redactor-inserted-image","true"));var o=r,n=this.utils.isCurrentOrParent("P");if(n&&(o=t("<blockquote />").append(r)),i){this.selection.removeMarkers();var a=this.selection.getMarker();this.insert.nodeToCaretPositionFromPoint(s,a)}else this.modal.close();this.selection.restore(),this.buffer.set(),this.insert.html(this.utils.getOuterHtml(o),!1);var l=this.$editor.find("img[data-redactor-inserted-image=true]").removeAttr("data-redactor-inserted-image");n?l.parent().contents().unwrap().wrap("<p />"):this.opts.linebreaks&&(this.utils.isEmpty(this.code.get())||l.before("<br>"),l.after("<br>")),"string"!=typeof e&&this.core.setCallback("imageUpload",l,e)}}},indent:function(){return{increase:function(){this.utils.browser("msie")||this.$editor.focus(),this.buffer.set(),this.selection.save();var t=this.selection.getBlock();t&&"LI"==t.tagName?this.indent.increaseLists():t===!1&&this.opts.linebreaks?this.indent.increaseText():this.indent.increaseBlocks(),this.selection.restore(),this.code.sync()},increaseLists:function(){document.execCommand("indent"),this.indent.fixEmptyIndent(),this.clean.normalizeLists(),this.clean.clearUnverified()},increaseBlocks:function(){t.each(this.selection.getBlocks(),t.proxy(function(t,e){if("TD"!==e.tagName&&"TH"!==e.tagName){var i=this.utils.getAlignmentElement(e),s=this.utils.normalize(i.css("margin-left"))+this.opts.indentValue;i.css("margin-left",s+"px")}},this))},increaseText:function(){var e=this.selection.wrap("div");t(e).attr("data-tagblock","redactor"),t(e).css("margin-left",this.opts.indentValue+"px")},decrease:function(){this.buffer.set(),this.selection.save();var t=this.selection.getBlock();t&&"LI"==t.tagName?this.indent.decreaseLists():this.indent.decreaseBlocks(),this.selection.restore(),this.code.sync()},decreaseLists:function(){document.execCommand("outdent");var e=this.selection.getCurrent(),i=t(e).closest("li",this.$editor[0]);this.indent.fixEmptyIndent(),this.opts.linebreaks||0!==i.length||(document.execCommand("formatblock",!1,"p"),this.$editor.find("ul, ol, blockquote, p").each(t.proxy(this.utils.removeEmpty,this))),this.clean.clearUnverified()},decreaseBlocks:function(){t.each(this.selection.getBlocks(),t.proxy(function(t,e){var i=this.utils.getAlignmentElement(e),s=this.utils.normalize(i.css("margin-left"))-this.opts.indentValue;0>=s?this.opts.linebreaks&&"undefined"!=typeof i.data("tagblock")?i.replaceWith(i.html()+"<br />"):(i.css("margin-left",""),this.utils.removeEmptyAttr(i,"style")):i.css("margin-left",s+"px")},this))},fixEmptyIndent:function(){var e=this.selection.getBlock();if(this.range.collapsed&&e&&"LI"==e.tagName&&this.utils.isEmpty(t(e).text())){var i=t(e);i.find("span").not(".redactor-selection-marker").contents().unwrap(),i.append("<br>")}}}},inline:function(){return{formatting:function(t){var e,i;"undefined"!=typeof this.formatting[t].style?e="style":"undefined"!=typeof this.formatting[t].class&&(e="class"),e&&(i=this.formatting[t][e]),this.inline.format(this.formatting[t].tag,e,i)},format:function(e,i,s){var r=this.selection.getCurrent();if(!(r&&"TR"===r.tagName||this.utils.isCurrentOrParent("PRE")||this.utils.isCurrentOrParentHeader())){for(var o=["b","bold","i","italic","underline","strikethrough","deleted","superscript","subscript"],n=["strong","strong","em","em","u","del","del","sup","sub"],a=0;a<o.length;a++)e==o[a]&&(e=n[a]);if(this.opts.allowedTags){if(-1==t.inArray(e,this.opts.allowedTags))return}else if(-1!==t.inArray(e,this.opts.deniedTags))return;this.inline.type=i||!1,this.inline.value=s||!1,this.buffer.set(),this.utils.browser("msie")||this.opts.linebreaks||this.$editor.focus(),this.selection.get(),this.range.collapsed?this.inline.formatCollapsed(e):this.inline.formatMultiple(e)}},formatCollapsed:function(e){var i=this.selection.getCurrent(),s=t(i).closest(e+"[data-redactor-tag="+e+"]",this.$editor[0]);if(0!==s.length&&"style"!=this.inline.type&&"SPAN"!=s[0].tagName)return void(this.utils.isEmpty(s.text())?(this.caret.setAfter(s[0]),s.remove(),this.code.sync()):this.utils.isEndOfElement(s)&&this.caret.setAfter(s[0]));var r=t("<"+e+">").attr("data-verified","redactor").attr("data-redactor-tag",e);r.html(this.opts.invisibleSpace),r=this.inline.setFormat(r);var r=this.insert.node(r);this.caret.setEnd(r),this.code.sync()},formatMultiple:function(e){if(this.inline.formatConvert(e),this.selection.save(),document.execCommand("strikethrough"),this.$editor.find("strike").each(t.proxy(function(i,s){var r=t(s);this.inline.formatRemoveSameChildren(r,e);var o;this.inline.type?(o=t("<span>").attr("data-redactor-tag",e).attr("data-verified","redactor"),o=this.inline.setFormat(o)):o=t("<"+e+">").attr("data-redactor-tag",e).attr("data-verified","redactor"),r.replaceWith(o.html(r.contents()));var n=o.parent();if("A"===o[0].tagName&&n&&"U"===n[0].tagName&&o.parent().replaceWith(o),"span"==e&&n&&"SPAN"===n[0].tagName&&"style"===this.inline.type)for(var a=this.inline.value.split(";"),l=0;l<a.length;l++){if(""===a[l])return;var c=a[l].split(":");n.css(c[0],""),this.utils.removeEmptyAttr(n,"style")&&n.replaceWith(n.contents())}},this)),"span"!=e&&this.$editor.find(this.opts.inlineTags.join(", ")).each(t.proxy(function(e,i){var s=t(i);if("U"===i.tagName&&0===i.attributes.length)return void s.replaceWith(s.contents());var r=s.css("text-decoration");"line-through"===r&&(s.css("text-decoration",""),this.utils.removeEmptyAttr(s,"style"))},this)),"del"!=e){var i=this;this.$editor.find("inline").each(function(t,e){i.utils.replaceToTag(e,"del")})}if("u"!=e){var i=this;this.$editor.find("unline").each(function(t,e){i.utils.replaceToTag(e,"u")})}this.selection.restore(),this.code.sync()},formatRemoveSameChildren:function(e,i){var s=this;e.children(i).each(function(){var e=t(this);if(!e.hasClass("redactor-selection-marker"))if("style"==s.inline.type)for(var i=s.inline.value.split(";"),r=0;r<i.length;r++){if(""===i[r])return;var o=i[r].split(":");e.css(o[0],""),s.utils.removeEmptyAttr(e,"style")&&e.replaceWith(e.contents())}else e.contents().unwrap()})},formatConvert:function(e){this.selection.save();var i="";"class"==this.inline.type?i="[data-redactor-class="+this.inline.value+"]":"style"==this.inline.type&&(i='[data-redactor-style="'+this.inline.value+'"]');var s=this;"del"!=e&&this.$editor.find("del").each(function(t,e){s.utils.replaceToTag(e,"inline")}),"u"!=e&&this.$editor.find("u").each(function(t,e){s.utils.replaceToTag(e,"unline")}),"span"!=e&&this.$editor.find(e).each(function(){var e=t(this);e.replaceWith(t("<strike />").html(e.contents()))}),this.$editor.find('[data-redactor-tag="'+e+'"]'+i).each(function(){if(""!==i||"span"!=e||this.tagName.toLowerCase()!=e){var s=t(this);s.replaceWith(t("<strike />").html(s.contents()))}}),this.selection.restore()},setFormat:function(t){switch(this.inline.type){case"class":t.hasClass(this.inline.value)?(t.removeClass(this.inline.value),t.removeAttr("data-redactor-class")):(t.addClass(this.inline.value),t.attr("data-redactor-class",this.inline.value));break;case"style":t[0].style.cssText=this.inline.value,t.attr("data-redactor-style",this.inline.value)}return t},removeStyle:function(){this.buffer.set();var e=this.selection.getCurrent(),i=this.selection.getInlines();if(this.selection.save(),e&&"SPAN"===e.tagName){var s=t(e);s.removeAttr("style"),0===s[0].attributes.length&&s.replaceWith(s.contents())}t.each(i,t.proxy(function(e,i){var s=t(i);-1==t.inArray(i.tagName.toLowerCase(),this.opts.inlineTags)||s.hasClass("redactor-selection-marker")||(s.removeAttr("style"),0===s[0].attributes.length&&s.replaceWith(s.contents()))},this)),this.selection.restore(),this.code.sync()},removeStyleRule:function(e){this.buffer.set();var i=this.selection.getParent(),s=this.selection.getInlines();if(this.selection.save(),i&&"SPAN"===i.tagName){var r=t(i);r.css(e,""),this.utils.removeEmptyAttr(r,"style"),0===r[0].attributes.length&&r.replaceWith(r.contents())}t.each(s,t.proxy(function(i,s){var r=t(s);-1==t.inArray(s.tagName.toLowerCase(),this.opts.inlineTags)||r.hasClass("redactor-selection-marker")||(r.css(e,""),this.utils.removeEmptyAttr(r,"style"),0===r[0].attributes.length&&r.replaceWith(r.contents()))},this)),this.selection.restore(),this.code.sync()},removeFormat:function(){this.buffer.set();var e=this.selection.getCurrent();this.selection.save(),document.execCommand("removeFormat"),e&&"SPAN"===e.tagName&&t(e).replaceWith(t(e).contents()),t.each(this.selection.getNodes(),t.proxy(function(e,i){var s=t(i);-1==t.inArray(i.tagName.toLowerCase(),this.opts.inlineTags)||s.hasClass("redactor-selection-marker")||s.replaceWith(s.contents())},this)),this.selection.restore(),this.code.sync()},toggleClass:function(t){this.inline.format("span","class",t)},toggleStyle:function(t){this.inline.format("span","style",t)}}},insert:function(){return{set:function(e,i){this.placeholder.remove(),e=this.clean.setVerified(e),"undefined"==typeof i&&(e=this.clean.onPaste(e,!1)),this.$editor.html(e),this.selection.remove(),this.focus.setEnd(),this.clean.normalizeLists(),this.code.sync(),this.observe.load(),"undefined"==typeof i&&setTimeout(t.proxy(this.clean.clearUnverified,this),10)},text:function(e){if(this.placeholder.remove(),e=e.toString(),e=t.trim(e),e=this.clean.getPlainText(e,!1),this.$editor.focus(),this.utils.browser("msie"))this.insert.htmlIe(e);else{this.selection.get(),this.range.deleteContents();var i=document.createElement("div");i.innerHTML=e;for(var s,r,o=document.createDocumentFragment();s=i.firstChild;)r=o.appendChild(s);if(this.range.insertNode(o),r){var n=this.range.cloneRange();n.setStartAfter(r),n.collapse(!0),this.sel.removeAllRanges(),this.sel.addRange(n)}}this.code.sync(),this.clean.clearUnverified()},htmlWithoutClean:function(t){this.insert.html(t,!1)},html:function(e,i){this.placeholder.remove(),"undefined"==typeof i&&(i=!0),this.opts.linebreaks||this.$editor.focus(),e=this.clean.setVerified(e),i&&(e=this.clean.onPaste(e)),this.utils.browser("msie")?this.insert.htmlIe(e):(this.clean.singleLine?this.insert.execHtml(e):document.execCommand("insertHTML",!1,e),this.insert.htmlFixMozilla()),this.clean.normalizeLists(),this.opts.linebreaks||this.$editor.find("p").each(t.proxy(this.utils.removeEmpty,this)),this.code.sync(),this.observe.load(),i&&this.clean.clearUnverified()},htmlFixMozilla:function(){if(this.utils.browser("mozilla")){var e=t(this.selection.getBlock()).next();e.length>0&&"P"==e[0].tagName&&""===e.html()&&e.remove()}},htmlIe:function(e){if(this.utils.isIe11()){var i=this.utils.isCurrentOrParent("P"),s=t("<div>").append(e),r=s.contents().is("p, :header, dl, ul, ol, div, table, td, blockquote, pre, address, section, header, footer, aside, article");return void(i&&r?this.insert.ie11FixInserting(i,e):this.insert.ie11PasteFrag(e))}document.selection.createRange().pasteHTML(e)},execHtml:function(t){t=this.clean.setVerified(t),this.selection.get(),this.range.deleteContents();var e=document.createElement("div");e.innerHTML=t;for(var i,s,r=document.createDocumentFragment();i=e.firstChild;)s=r.appendChild(i);this.range.insertNode(r),this.range.collapse(!0),this.caret.setAfter(s)},node:function(e,i){e=e[0]||e;var s=this.caret.getOffset(),r=this.utils.getOuterHtml(e);return r=this.clean.setVerified(r),null!==r.match(/</g)&&(e=t(r)[0]),this.selection.get(),i!==!1&&this.range.deleteContents(),this.range.insertNode(e),this.range.collapse(!1),this.selection.addRange(),this.caret.setOffset(s),e},nodeToPoint:function(t,e,i){t=t[0]||t,this.selection.get();var s;if(document.caretPositionFromPoint){var r=document.caretPositionFromPoint(e,i);this.range.setStart(r.offsetNode,r.offset),this.range.collapse(!0),this.range.insertNode(t)}else if(document.caretRangeFromPoint)s=document.caretRangeFromPoint(e,i),s.insertNode(t);else if("undefined"!=typeof document.body.createTextRange){s=document.body.createTextRange(),s.moveToPoint(e,i);var o=s.duplicate();o.moveToPoint(e,i),s.setEndPoint("EndToEnd",o),s.select()}},nodeToCaretPositionFromPoint:function(t,e){e=e[0]||e;var i,s=t.clientX,r=t.clientY;if(document.caretPositionFromPoint){var o=document.caretPositionFromPoint(s,r),n=document.getSelection();i=n.getRangeAt(0),i.setStart(o.offsetNode,o.offset),i.collapse(!0),i.insertNode(e)}else if(document.caretRangeFromPoint)i=document.caretRangeFromPoint(s,r),i.insertNode(e);else if("undefined"!=typeof document.body.createTextRange){i=document.body.createTextRange(),i.moveToPoint(s,r);var a=i.duplicate();a.moveToPoint(s,r),i.setEndPoint("EndToEnd",a),i.select()}},ie11FixInserting:function(e,i){var s=document.createElement("span");s.className="redactor-ie-paste",this.insert.node(s);var r=t(e).html();r="<p>"+r.replace(/<span class="redactor-ie-paste"><\/span>/gi,"</p>"+i+"<p>")+"</p>",r=r.replace(/<p><\/p>/gi,""),t(e).replaceWith(r)},ie11PasteFrag:function(t){this.selection.get(),this.range.deleteContents();var e=document.createElement("div");e.innerHTML=t;for(var i,s,r=document.createDocumentFragment();i=e.firstChild;)s=r.appendChild(i);this.range.insertNode(r),this.range.collapse(!1),this.selection.addRange()}}},keydown:function(){return{init:function(e){if(!this.rtePaste){var i=e.which,s=i>=37&&40>=i;this.keydown.ctrl=e.ctrlKey||e.metaKey,this.keydown.current=this.selection.getCurrent(),this.keydown.parent=this.selection.getParent(),this.keydown.block=this.selection.getBlock(),this.keydown.pre=this.utils.isTag(this.keydown.current,"pre"),this.keydown.blockquote=this.utils.isTag(this.keydown.current,"blockquote"),this.keydown.figcaption=this.utils.isTag(this.keydown.current,"figcaption"),this.shortcuts.init(e,i),this.utils.isDesktop()&&(this.keydown.checkEvents(s,i),this.keydown.setupBuffer(e,i)),this.keydown.addArrowsEvent(s),this.keydown.setupSelectAll(e,i);var r=this.core.setCallback("keydown",e);if(r===!1)return e.preventDefault(),!1;if(this.opts.enterKey&&(this.utils.browser("msie")||this.utils.browser("mozilla"))&&(i===this.keyCode.DOWN||i===this.keyCode.RIGHT)){var o=!1,n=!1;if(this.keydown.block&&"TD"===this.keydown.block.tagName&&(n=t(this.keydown.block).closest("table",this.$editor[0])),n&&n.find("td").last()[0]===this.keydown.block&&(o=!0),this.utils.isEndOfElement()&&o){var a=t(this.opts.emptyHtml);n.after(a),this.caret.setStart(a)}}if(this.opts.enterKey&&i===this.keyCode.DOWN&&this.keydown.onArrowDown(),!this.opts.enterKey&&i===this.keyCode.ENTER)return e.preventDefault(),void(this.range.collapsed||this.range.deleteContents());if(i==this.keyCode.ENTER&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey){var l=this.core.setCallback("enter",e);if(l===!1)return e.preventDefault(),!1;if(this.keydown.blockquote&&this.keydown.exitFromBlockquote(e)===!0)return!1;var c,h;if(this.keydown.pre)return this.keydown.insertNewLine(e);if(this.keydown.blockquote||this.keydown.figcaption)return c=this.selection.getCurrent(),h=t(c).next(),0!==h.length&&"BR"==h[0].tagName?this.keydown.insertBreakLine(e):this.utils.isEndOfElement()&&c&&"SPAN"!=c?this.keydown.insertDblBreakLine(e):this.keydown.insertBreakLine(e);if(this.opts.linebreaks&&!this.keydown.block)return c=this.selection.getCurrent(),h=t(this.keydown.current).next(),0!==h.length&&"BR"==h[0].tagName?this.keydown.insertBreakLine(e):c!==!1&&t(c).hasClass("redactor-invisible-space")?(this.caret.setAfter(c),t(c).contents().unwrap(),this.keydown.insertDblBreakLine(e)):this.utils.isEndOfEditor()?this.keydown.insertDblBreakLine(e):this.keydown.insertBreakLine(0===h.length&&c===!1&&"undefined"!=typeof h.context?e:e);if(this.opts.linebreaks&&this.keydown.block)setTimeout(t.proxy(this.keydown.replaceDivToBreakLine,this),1);else if(!this.opts.linebreaks&&this.keydown.block){if(setTimeout(t.proxy(this.keydown.replaceDivToParagraph,this),1),"LI"===this.keydown.block.tagName){c=this.selection.getCurrent();var d=t(c).closest("li",this.$editor[0]),u=d.closest("ul,ol",this.$editor[0]);if(0!==d.length&&this.utils.isEmpty(d.html())&&0===u.next().length&&this.utils.isEmpty(u.find("li").last().html())){u.find("li").last().remove();var a=t(this.opts.emptyHtml);return u.after(a),this.caret.setStart(a),!1}}else if("P"===this.keydown.block.tagName&&"LI"===this.keydown.block.parentNode.tagName){var p=this.keydown.block;if(null===p.nextElementSibling&&this.utils.isEmpty(p.innerHTML)){var f=p.parentNode;if(null===p.previousElementSibling){var g=f.parentNode;g.removeChild(f);var a=t(this.opts.emptyHtml)[0];return g.parentNode.insertBefore(a,g.nextElementSibling),this.caret.setStart(a),!1}f.removeChild(p);var a=t("<li>"+this.opts.emptyHtml+"</li>")[0];return f.parentNode.insertBefore(a,f.nextElementSibling),this.caret.setStart(a.children[0]),!1}}}else if(!this.opts.linebreaks&&!this.keydown.block)return this.keydown.insertParagraph(e)}if(i===this.keyCode.ENTER&&(e.ctrlKey||e.shiftKey))return this.keydown.onShiftEnter(e);if(i===this.keyCode.TAB||e.metaKey&&221===i||e.metaKey&&219===i)return this.keydown.onTab(e,i);if(i===this.keyCode.BACKSPACE||i===this.keyCode.DELETE){var m=this.selection.getNodes();if(m)for(var v,b=m.length,y=0;b>y;y++){var k=t(m[y]).children("img");if(0!==k.length){var w=this;t.each(k,function(e,i){var s=t(i);"none"==s.css("float")&&(w.core.setCallback("imageDelete",i.src,s),v=i)})}else"IMG"==m[y].tagName&&v!=m[y]&&(this.core.setCallback("imageDelete",m[y].src,t(m[y])),v=m[y])}}if(i===this.keyCode.BACKSPACE){var x=this.selection.getBlock(),$="0px"!==t(x).css("margin-left");if(x&&$&&this.range.collapsed&&this.utils.isStartOfElement())return this.indent.decrease(),void e.preventDefault();if(this.utils.browser("mozilla")){var C=this.selection.getPrev(),T=t(C).prev()[0];C&&"HR"===C.tagName&&t(C).remove(),T&&"HR"===T.tagName&&t(T).remove()}this.keydown.removeInvisibleSpace(),this.keydown.removeEmptyListInTable(e)}this.code.sync()}},checkEvents:function(t,e){t||"click"!=this.core.getEvent()&&"arrow"!=this.core.getEvent()||(this.core.addEvent(!1),this.keydown.checkKeyEvents(e)&&this.buffer.set())},checkKeyEvents:function(e){var i=this.keyCode,s=[i.BACKSPACE,i.DELETE,i.ENTER,i.ESC,i.TAB,i.CTRL,i.META,i.ALT,i.SHIFT];return-1==t.inArray(e,s)?!0:!1},addArrowsEvent:function(t){return t?"click"==this.core.getEvent()||"arrow"==this.core.getEvent()?void this.core.addEvent(!1):void this.core.addEvent("arrow"):void 0},setupBuffer:function(t,e){return this.keydown.ctrl&&90===e&&!t.shiftKey&&!t.altKey&&this.opts.buffer.length?(t.preventDefault(),void this.buffer.undo()):this.keydown.ctrl&&90===e&&t.shiftKey&&!t.altKey&&0!==this.opts.rebuffer.length?(t.preventDefault(),void this.buffer.redo()):void(this.keydown.ctrl||(e==this.keyCode.BACKSPACE||e==this.keyCode.DELETE||e==this.keyCode.ENTER&&!t.ctrlKey&&!t.shiftKey)&&this.buffer.set())},setupSelectAll:function(t,e){this.keydown.ctrl&&65===e?this.utils.enableSelectAll():e==this.keyCode.LEFT_WIN||this.keydown.ctrl||this.utils.disableSelectAll()},onArrowDown:function(){for(var t=[this.keydown.blockquote,this.keydown.pre,this.keydown.figcaption],e=0;e<t.length;e++)if(t[e])return this.keydown.insertAfterLastElement(t[e]),!1},onShiftEnter:function(t){return this.buffer.set(),this.utils.isEndOfElement()?this.keydown.insertDblBreakLine(t):this.keydown.insertBreakLine(t)},onTab:function(t,e){if(!this.opts.tabKey)return!0;if(this.utils.isEmpty(this.code.get())&&this.opts.tabAsSpaces===!1)return!0;t.preventDefault();var i;return this.keydown.pre&&!t.shiftKey?(i=document.createTextNode(this.opts.preSpaces?Array(this.opts.preSpaces+1).join(" "):" "),this.insert.node(i),this.code.sync()):this.opts.tabAsSpaces!==!1?(i=document.createTextNode(Array(this.opts.tabAsSpaces+1).join(" ")),this.insert.node(i),this.code.sync()):t.metaKey&&219===e?this.indent.decrease():t.metaKey&&221===e?this.indent.increase():t.shiftKey?this.indent.decrease():this.indent.increase(),!1},replaceDivToBreakLine:function(){var e=this.selection.getBlock(),i=e.innerHTML.replace(/<br\s?\/?>/gi,"");if(("DIV"===e.tagName||"P"===e.tagName)&&""===i&&!t(e).hasClass("redactor-editor")){var s=document.createElement("br");return t(e).replaceWith(s),this.caret.setBefore(s),this.code.sync(),!1}},replaceDivToParagraph:function(){var e=this.selection.getBlock(),i=e.innerHTML.replace(/<br\s?\/?>/gi,"");if("DIV"===e.tagName&&this.utils.isEmpty(i)&&!t(e).hasClass("redactor-editor")){var s=document.createElement("p");return s.innerHTML=this.opts.invisibleSpace,t(e).replaceWith(s),this.caret.setStart(s),this.code.sync(),!1}this.opts.cleanStyleOnEnter&&"P"==e.tagName&&t(e).removeAttr("class").removeAttr("style")},insertParagraph:function(t){t.preventDefault(),this.selection.get();var e=document.createElement("p");return e.innerHTML=this.opts.invisibleSpace,this.range.deleteContents(),this.range.insertNode(e),this.caret.setStart(e),this.code.sync(),!1},exitFromBlockquote:function(e){if(this.utils.isEndOfElement()){var i=t.trim(t(this.keydown.block).html());if(-1!=i.search(/(<br\s?\/?>){2}$/i)){if(e.preventDefault(),this.opts.linebreaks){var s=document.createElement("br");t(this.keydown.blockquote).after(s),this.caret.setBefore(s),t(this.keydown.block).html(i.replace(/<br\s?\/?>$/i,""))}else{var r=t(this.opts.emptyHtml);t(this.keydown.blockquote).after(r),this.caret.setStart(r)}return!0}}},insertAfterLastElement:function(e){if(this.utils.isEndOfElement())if(this.buffer.set(),this.opts.linebreaks){var i=t("<div>").append(t.trim(this.$editor.html())).contents(),s=i.last()[0];if("SPAN"==s.tagName&&""===s.innerHTML&&(s=i.prev()[0]),this.utils.getOuterHtml(s)!=this.utils.getOuterHtml(e))return;var r=document.createElement("br");t(e).after(r),this.caret.setAfter(r)}else{if(this.$editor.contents().last()[0]!==e)return;var o=t(this.opts.emptyHtml);t(e).after(o),this.caret.setStart(o)}},insertNewLine:function(t){t.preventDefault();var e=document.createTextNode("\n");return this.selection.get(),this.range.deleteContents(),this.range.insertNode(e),this.caret.setAfter(e),this.code.sync(),!1},insertBreakLine:function(t){return this.keydown.insertBreakLineProcessing(t)},insertDblBreakLine:function(t){return this.keydown.insertBreakLineProcessing(t,!0)},insertBreakLineProcessing:function(e,i){e.stopPropagation(),this.selection.get();var s=document.createElement("br");this.utils.browser("msie")?(this.range.collapse(!1),this.range.setEnd(this.range.endContainer,this.range.endOffset)):this.range.deleteContents(),this.range.insertNode(s);var r=t(s).parent("a");if(r.length>0&&(r.find(s).remove(),r.after(s)),i===!0){var o=t(s).next();if(0!==o.length&&"BR"===o[0].tagName&&this.utils.isEndOfEditor())return this.caret.setAfter(s),this.code.sync(),!1;var n=document.createElement("br");this.range.insertNode(n),this.caret.setAfter(n)}else if(this.utils.browser("msie")){var a=document.createElement("span");a.innerHTML="​",t(s).after(a),this.range.setStartAfter(a),this.range.setEndAfter(a),t(a).remove()}else{var l=document.createRange();l.setStartAfter(s),l.collapse(!0);var c=window.getSelection();c.removeAllRanges(),c.addRange(l)}return this.code.sync(),!1},removeInvisibleSpace:function(){var e=t(this.keydown.current);0===e.text().search(/^\u200B$/g)&&e.remove()},removeEmptyListInTable:function(e){var i=t(this.keydown.current),s=t(this.keydown.parent),r=i.closest("td",this.$editor[0]);if(0!==r.length&&i.closest("li",this.$editor[0])&&1===s.children("li").length){if(!this.utils.isEmpty(i.text()))return;e.preventDefault(),i.remove(),s.remove(),this.caret.setStart(r)}}}},keyup:function(){return{init:function(e){if(!this.rtePaste){var i=e.which;this.keyup.current=this.selection.getCurrent(),this.keyup.parent=this.selection.getParent();var s=this.utils.isRedactorParent(t(this.keyup.parent).parent()),r=this.core.setCallback("keyup",e);if(r===!1)return e.preventDefault(),!1;if(!this.opts.linebreaks&&3===this.keyup.current.nodeType&&this.keyup.current.length<=1&&(this.keyup.parent===!1||"BODY"==this.keyup.parent.tagName)&&this.keyup.replaceToParagraph(),!this.opts.linebreaks&&this.utils.isRedactorParent(this.keyup.current)&&"DIV"===this.keyup.current.tagName&&this.keyup.replaceToParagraph(!1),this.opts.linebreaks||!t(this.keyup.parent).hasClass("redactor-invisible-space")||s!==!1&&"BODY"!=s[0].tagName||(t(this.keyup.parent).contents().unwrap(),this.keyup.replaceToParagraph()),this.linkify.isEnabled()&&this.linkify.isKey(i)&&this.linkify.format(),i===this.keyCode.DELETE||i===this.keyCode.BACKSPACE){if(this.utils.browser("mozilla")){var o=t(this.keydown.current).closest("td",this.$editor[0]);if(0!==o.size()&&""!==o.text())return e.preventDefault(),!1}return this.clean.clearUnverified(),this.observe.image?(e.preventDefault(),this.image.hideResize(),this.buffer.set(),this.image.remove(this.observe.image),this.observe.image=!1,!1):(this.$editor.find("p").each(t.proxy(function(e,i){this.utils.removeEmpty(e,t(i).html())},this)),this.opts.linebreaks&&this.keyup.current&&"DIV"==this.keyup.current.tagName&&this.utils.isEmpty(this.keyup.current.innerHTML)&&(t(this.keyup.current).after(this.selection.getMarkerAsHtml()),this.selection.restore(),t(this.keyup.current).remove()),this.keyup.removeEmptyLists(),this.keyup.formatEmpty(e))}}},replaceToParagraph:function(e){var i,s=t(this.keyup.current);i=t("<p>").append(e===!1?s.html():s.clone()),s.replaceWith(i);var r=t(i).next();"undefined"!=typeof r[0]&&"BR"==r[0].tagName&&r.remove(),this.caret.setEnd(i)},removeEmptyLists:function(){var e=function(){var e=t.trim(this.innerHTML).replace(/\/t\/n/g,"");""===e&&t(this).remove()};this.$editor.find("li").each(e),this.$editor.find("ul, ol").each(e)},formatEmpty:function(e){var i=t.trim(this.$editor.html());if(this.utils.isEmpty(i))return e.preventDefault(),this.opts.linebreaks?(this.$editor.html(this.selection.getMarkerAsHtml()),this.selection.restore()):(this.$editor.html(this.opts.emptyHtml),this.focus.setStart()),this.code.sync(),!1}}},lang:function(){return{load:function(){this.opts.curLang=this.opts.langs[this.opts.lang]},get:function(t){return"undefined"!=typeof this.opts.curLang[t]?this.opts.curLang[t]:""}}},line:function(){return{insert:function(){this.buffer.set();var t=this.selection.getBlocks();return t[0]!==!1&&this.line.isExceptLastOrFirst(t)?void(this.utils.browser("msie")||this.$editor.focus()):void(this.utils.browser("msie")?this.line.insertInIe():this.line.insertInOthersBrowsers())},isExceptLastOrFirst:function(e){var i=["li","td","th","blockquote","figcaption","pre","dl","dt","dd"],s=e[0].tagName.toLowerCase(),r=this.selection.getLastBlock();r="undefined"==typeof r?s:r.tagName.toLowerCase();var o=-1!=t.inArray(s,i),n=-1!=t.inArray(r,i);return o&&n||o?!0:void 0},insertInIe:function(){this.utils.saveScroll(),this.buffer.set(),this.insert.node(document.createElement("hr")),this.utils.restoreScroll(),this.code.sync()},insertInOthersBrowsers:function(){this.buffer.set();var t='<p id="redactor-insert-line"><br /></p>';this.opts.linebreaks&&(t='<br id="redactor-insert-line">'),document.execCommand("insertHtml",!1,"<hr>"+t),this.line.setFocus(),this.code.sync()},setFocus:function(){var e=this.$editor.find("#redactor-insert-line"),i=t(e).next()[0],s=i;this.utils.browser("mozilla")&&i&&""===i.innerHTML&&(s=t(i).next()[0],t(i).remove()),s?(e.remove(),this.opts.linebreaks||(this.$editor.focus(),this.line.setStart(s))):(e.removeAttr("id"),this.line.setStart(e[0]))},setStart:function(t){if("undefined"!=typeof t){var e=document.createTextNode("");this.selection.get(),this.range.setStart(t,0),this.range.insertNode(e),this.range.collapse(!0),this.selection.addRange()}}}},link:function(){return{show:function(e){"undefined"!=typeof e&&e.preventDefault&&e.preventDefault(),this.observe.isCurrent("a")?this.modal.load("link",this.lang.get("link_edit"),600):this.modal.load("link",this.lang.get("link_insert"),600),this.modal.createCancelButton();var i=this.lang.get(this.observe.isCurrent("a")?"edit":"insert");this.link.buttonInsert=this.modal.createActionButton(i),this.selection.get(),this.link.getData(),this.link.cleanUrl(),"_blank"==this.link.target&&t("#redactor-link-blank").prop("checked",!0),this.link.$inputUrl=t("#redactor-link-url"),this.link.$inputText=t("#redactor-link-url-text"),this.link.$inputText.val(this.link.text),this.link.$inputUrl.val(this.link.url),this.link.buttonInsert.on("click",t.proxy(this.link.insert,this)),t(".redactor-link-tooltip").remove(),this.selection.save(),this.modal.show(),this.link.$inputUrl.focus()},cleanUrl:function(){var t=self.location.href.replace(/\/$/i,"");if("undefined"!=typeof this.link.url&&(this.link.url=this.link.url.replace(t,""),this.link.url=this.link.url.replace(/^\/#/,"#"),this.link.url=this.link.url.replace("mailto:",""),!this.opts.linkProtocol)){var e=new RegExp("^(http|ftp|https)://"+self.location.host,"i");this.link.url=this.link.url.replace(e,"")}},getData:function(){this.link.$node=!1;var e=t(this.selection.getCurrent()).closest("a",this.$editor[0]);0!==e.length&&"A"===e[0].tagName?(this.link.$node=e,this.link.url=e.attr("href"),this.link.text=e.text(),this.link.target=e.attr("target")):(this.link.text=this.sel.toString(),this.link.url="",this.link.target="")},insert:function(){this.placeholder.remove();var e="",i=this.link.$inputUrl.val(),s=this.link.$inputText.val().replace(/(<([^>]+)>)/gi,"");if(""===t.trim(i))return void this.link.$inputUrl.addClass("redactor-input-error").on("keyup",function(){t(this).removeClass("redactor-input-error"),t(this).off("keyup")});if(-1!=i.search("@")&&/(http|ftp|https):\/\//i.test(i)===!1)i=i.replace("mailto:",""),i="mailto:"+i;else if(0!==i.search("#")){t("#redactor-link-blank").prop("checked")&&(e="_blank");var r="((xn--)?[a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}",o=new RegExp("^(http|ftp|https)://"+r,"i"),n=new RegExp("^"+r,"i"),a=new RegExp(".(html|php)$","i");
+var i=t(e.target);i.attr("data-save-url",i.attr("src"))}var s=this.$editor.find("#redactor-image-box");0!==s.length&&(t("#redactor-image-editter").remove(),t("#redactor-image-resizer").remove(),s.find("img").css({marginTop:s[0].style.marginTop,marginBottom:s[0].style.marginBottom,marginLeft:s[0].style.marginLeft,marginRight:s[0].style.marginRight}),s.css("margin",""),s.find("img").css("opacity",""),s.replaceWith(function(){return t(this).contents()}),t(document).off("mousedown.redactor-image-resize-hide."+this.uuid),"undefined"!=typeof this.image.resizeHandle&&this.image.resizeHandle.el.attr("rel",this.image.resizeHandle.el.attr("style")),this.code.sync())}},loadResizableControls:function(e,i){if(this.opts.imageResizable&&!this.utils.isMobile()){var s=t('<span id="redactor-image-resizer" data-redactor="verified"></span>');return this.utils.isDesktop()||s.css({width:"15px",height:"15px"}),s.attr("contenteditable",!1),i.append(s),i.append(e),s}return i.append(e),!1},loadEditableControls:function(e){var i=t('<span id="redactor-image-box" data-redactor="verified">');if(i.css("float",e.css("float")).attr("contenteditable",!1),"auto"!=e[0].style.margin?(i.css({marginTop:e[0].style.marginTop,marginBottom:e[0].style.marginBottom,marginLeft:e[0].style.marginLeft,marginRight:e[0].style.marginRight}),e.css("margin","")):i.css({display:"block",margin:"auto"}),e.css("opacity",".5").after(i),this.opts.imageEditable){this.image.editter=t('<span id="redactor-image-editter" data-redactor="verified">'+this.lang.get("edit")+"</span>"),this.image.editter.attr("contenteditable",!1),this.image.editter.on("click",t.proxy(function(){this.image.showEdit(e)},this)),i.append(this.image.editter);var s=this.image.editter.innerWidth();this.image.editter.css("margin-left","-"+s/2+"px")}return this.image.loadResizableControls(e,i)},remove:function(e){var i=t(e),s=i.closest("a",this.$editor[0]),r=i.closest("figure",this.$editor[0]),o=i.parent();0!==t("#redactor-image-box").length&&(o=t("#redactor-image-box").parent());var n;0!==r.length?(n=r.next(),r.remove()):0!==s.length?(o=s.parent(),s.remove()):i.remove(),t("#redactor-image-box").remove(),this.caret.setStart(0!==r.length?n:o),this.core.setCallback("imageDelete",i[0].src,i),this.modal.close(),this.code.sync()},insert:function(e,i,s){if("undefined"!=typeof e.error)return this.modal.close(),this.selection.restore(),void this.core.setCallback("imageUploadError",e);var r;"string"==typeof e?r=t(e).attr("data-redactor-inserted-image","true"):(r=t("<img>"),r.attr("src",e.filelink).attr("data-redactor-inserted-image","true"));var o=r,n=this.utils.isCurrentOrParent("P");if(n&&(o=t("<blockquote />").append(r)),i){this.selection.removeMarkers();var a=this.selection.getMarker();this.insert.nodeToCaretPositionFromPoint(s,a)}else this.modal.close();this.selection.restore(),this.buffer.set(),this.insert.html(this.utils.getOuterHtml(o),!1);var l=this.$editor.find("img[data-redactor-inserted-image=true]").removeAttr("data-redactor-inserted-image");n?l.parent().contents().unwrap().wrap("<p />"):this.opts.linebreaks&&(this.utils.isEmpty(this.code.get())||l.before("<br>"),l.after("<br>")),"string"!=typeof e&&this.core.setCallback("imageUpload",l,e)}}},indent:function(){return{increase:function(){this.utils.browser("msie")||this.$editor.focus(),this.buffer.set(),this.selection.save();var t=this.selection.getBlock();t&&"LI"==t.tagName?this.indent.increaseLists():t===!1&&this.opts.linebreaks?this.indent.increaseText():this.indent.increaseBlocks(),this.selection.restore(),this.code.sync()},increaseLists:function(){document.execCommand("indent"),this.indent.fixEmptyIndent(),this.clean.normalizeLists(),this.clean.clearUnverified()},increaseBlocks:function(){t.each(this.selection.getBlocks(),t.proxy(function(t,e){if("TD"!==e.tagName&&"TH"!==e.tagName){var i=this.utils.getAlignmentElement(e),s=this.utils.normalize(i.css("margin-left"))+this.opts.indentValue;i.css("margin-left",s+"px")}},this))},increaseText:function(){var e=this.selection.wrap("div");t(e).attr("data-tagblock","redactor"),t(e).css("margin-left",this.opts.indentValue+"px")},decrease:function(){this.buffer.set(),this.selection.save();var t=this.selection.getBlock();t&&"LI"==t.tagName?this.indent.decreaseLists():this.indent.decreaseBlocks(),this.selection.restore(),this.code.sync()},decreaseLists:function(){document.execCommand("outdent");var e=this.selection.getCurrent(),i=t(e).closest("li",this.$editor[0]);this.indent.fixEmptyIndent(),this.opts.linebreaks||0!==i.length||(document.execCommand("formatblock",!1,"p"),this.$editor.find("ul, ol, blockquote, p").each(t.proxy(this.utils.removeEmpty,this))),this.clean.clearUnverified()},decreaseBlocks:function(){t.each(this.selection.getBlocks(),t.proxy(function(t,e){var i=this.utils.getAlignmentElement(e),s=this.utils.normalize(i.css("margin-left"))-this.opts.indentValue;0>=s?this.opts.linebreaks&&"undefined"!=typeof i.data("tagblock")?i.replaceWith(i.html()+"<br />"):(i.css("margin-left",""),this.utils.removeEmptyAttr(i,"style")):i.css("margin-left",s+"px")},this))},fixEmptyIndent:function(){var e=this.selection.getBlock();if(this.range.collapsed&&e&&"LI"==e.tagName&&this.utils.isEmpty(t(e).text())){var i=t(e);i.find("span").not(".redactor-selection-marker").contents().unwrap(),i.append("<br>")}}}},inline:function(){return{formatting:function(t){var e,i;"undefined"!=typeof this.formatting[t].style?e="style":"undefined"!=typeof this.formatting[t].class&&(e="class"),e&&(i=this.formatting[t][e]),this.inline.format(this.formatting[t].tag,e,i)},format:function(e,i,s){var r=this.selection.getCurrent();if(!(r&&"TR"===r.tagName||this.utils.isCurrentOrParent("PRE")||this.utils.isCurrentOrParentHeader())){for(var o=["b","bold","i","italic","underline","strikethrough","deleted","superscript","subscript"],n=["strong","strong","em","em","u","del","del","sup","sub"],a=0;a<o.length;a++)e==o[a]&&(e=n[a]);if(this.opts.allowedTags){if(-1==t.inArray(e,this.opts.allowedTags))return}else if(-1!==t.inArray(e,this.opts.deniedTags))return;this.inline.type=i||!1,this.inline.value=s||!1,this.buffer.set(),this.utils.browser("msie")||this.opts.linebreaks||this.$editor.focus(),this.selection.get(),this.range.collapsed?this.inline.formatCollapsed(e):this.inline.formatMultiple(e)}},formatCollapsed:function(e){var i=this.selection.getCurrent(),s=t(i).closest(e+"[data-redactor-tag="+e+"]",this.$editor[0]);if(0!==s.length&&"style"!=this.inline.type&&"SPAN"!=s[0].tagName)return void(this.utils.isEmpty(s.text())?(this.caret.setAfter(s[0]),s.remove(),this.code.sync()):this.utils.isEndOfElement(s)&&this.caret.setAfter(s[0]));var r=t("<"+e+">").attr("data-verified","redactor").attr("data-redactor-tag",e);r.html(this.opts.invisibleSpace),r=this.inline.setFormat(r);var r=this.insert.node(r);this.caret.setEnd(r),this.code.sync()},formatMultiple:function(e){if(this.inline.formatConvert(e),this.selection.save(),document.execCommand("strikethrough"),this.$editor.find("strike").each(t.proxy(function(i,s){var r=t(s);this.inline.formatRemoveSameChildren(r,e);var o;this.inline.type?(o=t("<span>").attr("data-redactor-tag",e).attr("data-verified","redactor"),o=this.inline.setFormat(o)):o=t("<"+e+">").attr("data-redactor-tag",e).attr("data-verified","redactor"),r.replaceWith(o.html(r.contents()));var n=o.parent();if("A"===o[0].tagName&&n&&"U"===n[0].tagName&&o.parent().replaceWith(o),"span"==e&&n&&"SPAN"===n[0].tagName&&"style"===this.inline.type)for(var a=this.inline.value.split(";"),l=0;l<a.length;l++){if(""===a[l])return;var c=a[l].split(":");n.css(c[0],""),this.utils.removeEmptyAttr(n,"style")&&n.replaceWith(n.contents())}},this)),"span"!=e&&this.$editor.find(this.opts.inlineTags.join(", ")+", a").each(t.proxy(function(e,i){var s=t(i);if("U"===i.tagName&&0===i.attributes.length)return void s.replaceWith(s.contents());var r=s.css("text-decoration");0===r.indexOf("line-through")&&(s.css("text-decoration",""),this.utils.removeEmptyAttr(s,"style"))},this)),"del"!=e){var i=this;this.$editor.find("inline").each(function(t,e){i.utils.replaceToTag(e,"del")})}if("u"!=e){var i=this;this.$editor.find("unline").each(function(t,e){i.utils.replaceToTag(e,"u")})}this.selection.restore(),this.code.sync()},formatRemoveSameChildren:function(e,i){var s=this;e.children(i).each(function(){var e=t(this);if(!e.hasClass("redactor-selection-marker"))if("style"==s.inline.type)for(var i=s.inline.value.split(";"),r=0;r<i.length;r++){if(""===i[r])return;var o=i[r].split(":");e.css(o[0],""),s.utils.removeEmptyAttr(e,"style")&&e.replaceWith(e.contents())}else e.contents().unwrap()})},formatConvert:function(e){this.selection.save();var i="";"class"==this.inline.type?i="[data-redactor-class="+this.inline.value+"]":"style"==this.inline.type&&(i='[data-redactor-style="'+this.inline.value+'"]');var s=this;"del"!=e&&this.$editor.find("del").each(function(t,e){s.utils.replaceToTag(e,"inline")}),"u"!=e&&this.$editor.find("u").each(function(t,e){s.utils.replaceToTag(e,"unline")}),"span"!=e&&this.$editor.find(e).each(function(){var e=t(this);e.replaceWith(t("<strike />").html(e.contents()))}),this.$editor.find('[data-redactor-tag="'+e+'"]'+i).each(function(){if(""!==i||"span"!=e||this.tagName.toLowerCase()!=e){var s=t(this);s.replaceWith(t("<strike />").html(s.contents()))}}),this.selection.restore()},setFormat:function(t){switch(this.inline.type){case"class":t.hasClass(this.inline.value)?(t.removeClass(this.inline.value),t.removeAttr("data-redactor-class")):(t.addClass(this.inline.value),t.attr("data-redactor-class",this.inline.value));break;case"style":t[0].style.cssText=this.inline.value,t.attr("data-redactor-style",this.inline.value)}return t},removeStyle:function(){this.buffer.set();var e=this.selection.getCurrent(),i=this.selection.getInlines();if(this.selection.save(),e&&"SPAN"===e.tagName){var s=t(e);s.removeAttr("style"),0===s[0].attributes.length&&s.replaceWith(s.contents())}t.each(i,t.proxy(function(e,i){var s=t(i);-1==t.inArray(i.tagName.toLowerCase(),this.opts.inlineTags)||s.hasClass("redactor-selection-marker")||(s.removeAttr("style"),0===s[0].attributes.length&&s.replaceWith(s.contents()))},this)),this.selection.restore(),this.code.sync()},removeStyleRule:function(e){this.buffer.set();var i=this.selection.getParent(),s=this.selection.getInlines();if(this.selection.save(),i&&"SPAN"===i.tagName){var r=t(i);r.css(e,""),this.utils.removeEmptyAttr(r,"style"),0===r[0].attributes.length&&r.replaceWith(r.contents())}t.each(s,t.proxy(function(i,s){var r=t(s);-1==t.inArray(s.tagName.toLowerCase(),this.opts.inlineTags)||r.hasClass("redactor-selection-marker")||(r.css(e,""),this.utils.removeEmptyAttr(r,"style"),0===r[0].attributes.length&&r.replaceWith(r.contents()))},this)),this.selection.restore(),this.code.sync()},removeFormat:function(){this.buffer.set();var e=this.selection.getCurrent();this.selection.save(),document.execCommand("removeFormat"),e&&"SPAN"===e.tagName&&t(e).replaceWith(t(e).contents()),t.each(this.selection.getNodes(),t.proxy(function(e,i){var s=t(i);-1==t.inArray(i.tagName.toLowerCase(),this.opts.inlineTags)||s.hasClass("redactor-selection-marker")||s.replaceWith(s.contents())},this)),this.selection.restore(),this.code.sync()},toggleClass:function(t){this.inline.format("span","class",t)},toggleStyle:function(t){this.inline.format("span","style",t)}}},insert:function(){return{set:function(e,i){this.placeholder.remove(),e=this.clean.setVerified(e),"undefined"==typeof i&&(e=this.clean.onPaste(e,!1)),this.$editor.html(e),this.selection.remove(),this.focus.setEnd(),this.clean.normalizeLists(),this.code.sync(),this.observe.load(),"undefined"==typeof i&&setTimeout(t.proxy(this.clean.clearUnverified,this),10)},text:function(e){if(this.placeholder.remove(),e=e.toString(),e=t.trim(e),e=this.clean.getPlainText(e,!1),this.$editor.focus(),this.utils.browser("msie"))this.insert.htmlIe(e);else{this.selection.get(),this.range.deleteContents();var i=document.createElement("div");i.innerHTML=e;for(var s,r,o=document.createDocumentFragment();s=i.firstChild;)r=o.appendChild(s);if(this.range.insertNode(o),r){var n=this.range.cloneRange();n.setStartAfter(r),n.collapse(!0),this.sel.removeAllRanges(),this.sel.addRange(n)}}this.code.sync(),this.clean.clearUnverified()},htmlWithoutClean:function(t){this.insert.html(t,!1)},html:function(e,i){this.placeholder.remove(),"undefined"==typeof i&&(i=!0),this.opts.linebreaks||this.$editor.focus(),e=this.clean.setVerified(e),i&&(e=this.clean.onPaste(e)),this.utils.browser("msie")?this.insert.htmlIe(e):(this.clean.singleLine?this.insert.execHtml(e):document.execCommand("insertHTML",!1,e),this.insert.htmlFixMozilla()),this.clean.normalizeLists(),this.opts.linebreaks||this.$editor.find("p").each(t.proxy(this.utils.removeEmpty,this)),this.code.sync(),this.observe.load(),i&&this.clean.clearUnverified()},htmlFixMozilla:function(){if(this.utils.browser("mozilla")){var e=t(this.selection.getBlock()).next();e.length>0&&"P"==e[0].tagName&&""===e.html()&&e.remove()}},htmlIe:function(e){if(this.utils.isIe11()){var i=this.utils.isCurrentOrParent("P"),s=t("<div>").append(e),r=s.contents().is("p, :header, dl, ul, ol, div, table, td, blockquote, pre, address, section, header, footer, aside, article");return void(i&&r?this.insert.ie11FixInserting(i,e):this.insert.ie11PasteFrag(e))}document.selection.createRange().pasteHTML(e)},execHtml:function(t){t=this.clean.setVerified(t),this.selection.get(),this.range.deleteContents();var e=document.createElement("div");e.innerHTML=t;for(var i,s,r=document.createDocumentFragment();i=e.firstChild;)s=r.appendChild(i);this.range.insertNode(r),this.range.collapse(!0),this.caret.setAfter(s)},node:function(e,i){e=e[0]||e;var s=this.caret.getOffset(),r=this.utils.getOuterHtml(e);return r=this.clean.setVerified(r),null!==r.match(/</g)&&(e=t(r)[0]),this.selection.get(),i!==!1&&this.range.deleteContents(),this.range.insertNode(e),this.range.collapse(!1),this.selection.addRange(),this.caret.setOffset(s),e},nodeToPoint:function(t,e,i){t=t[0]||t,this.selection.get();var s;if(document.caretPositionFromPoint){var r=document.caretPositionFromPoint(e,i);this.range.setStart(r.offsetNode,r.offset),this.range.collapse(!0),this.range.insertNode(t)}else if(document.caretRangeFromPoint)s=document.caretRangeFromPoint(e,i),s.insertNode(t);else if("undefined"!=typeof document.body.createTextRange){s=document.body.createTextRange(),s.moveToPoint(e,i);var o=s.duplicate();o.moveToPoint(e,i),s.setEndPoint("EndToEnd",o),s.select()}},nodeToCaretPositionFromPoint:function(t,e){e=e[0]||e;var i,s=t.clientX,r=t.clientY;if(document.caretPositionFromPoint){var o=document.caretPositionFromPoint(s,r),n=document.getSelection();i=n.getRangeAt(0),i.setStart(o.offsetNode,o.offset),i.collapse(!0),i.insertNode(e)}else if(document.caretRangeFromPoint)i=document.caretRangeFromPoint(s,r),i.insertNode(e);else if("undefined"!=typeof document.body.createTextRange){i=document.body.createTextRange(),i.moveToPoint(s,r);var a=i.duplicate();a.moveToPoint(s,r),i.setEndPoint("EndToEnd",a),i.select()}},ie11FixInserting:function(e,i){var s=document.createElement("span");s.className="redactor-ie-paste",this.insert.node(s);var r=t(e).html();r="<p>"+r.replace(/<span class="redactor-ie-paste"><\/span>/gi,"</p>"+i+"<p>")+"</p>",r=r.replace(/<p><\/p>/gi,""),t(e).replaceWith(r)},ie11PasteFrag:function(t){this.selection.get(),this.range.deleteContents();var e=document.createElement("div");e.innerHTML=t;for(var i,s,r=document.createDocumentFragment();i=e.firstChild;)s=r.appendChild(i);this.range.insertNode(r),this.range.collapse(!1),this.selection.addRange()}}},keydown:function(){return{init:function(e){if(!this.rtePaste){var i=e.which,s=i>=37&&40>=i;this.keydown.ctrl=e.ctrlKey||e.metaKey,this.keydown.current=this.selection.getCurrent(),this.keydown.parent=this.selection.getParent(),this.keydown.block=this.selection.getBlock(),this.keydown.pre=this.utils.isTag(this.keydown.current,"pre"),this.keydown.blockquote=this.utils.isTag(this.keydown.current,"blockquote"),this.keydown.figcaption=this.utils.isTag(this.keydown.current,"figcaption"),this.shortcuts.init(e,i),this.utils.isDesktop()&&(this.keydown.checkEvents(s,i),this.keydown.setupBuffer(e,i)),this.keydown.addArrowsEvent(s),this.keydown.setupSelectAll(e,i);var r=this.core.setCallback("keydown",e);if(r===!1)return e.preventDefault(),!1;if(this.opts.enterKey&&(this.utils.browser("msie")||this.utils.browser("mozilla"))&&(i===this.keyCode.DOWN||i===this.keyCode.RIGHT)){var o=!1,n=!1;if(this.keydown.block&&"TD"===this.keydown.block.tagName&&(n=t(this.keydown.block).closest("table",this.$editor[0])),n&&n.find("td").last()[0]===this.keydown.block&&(o=!0),this.utils.isEndOfElement()&&o){var a=t(this.opts.emptyHtml);n.after(a),this.caret.setStart(a)}}if(this.opts.enterKey&&i===this.keyCode.DOWN&&this.keydown.onArrowDown(),!this.opts.enterKey&&i===this.keyCode.ENTER)return e.preventDefault(),void(this.range.collapsed||this.range.deleteContents());if(i==this.keyCode.ENTER&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey){var l=this.core.setCallback("enter",e);if(l===!1)return e.preventDefault(),!1;if(this.keydown.blockquote&&this.keydown.exitFromBlockquote(e)===!0)return!1;var c,h;if(this.keydown.pre)return this.keydown.insertNewLine(e);if(this.keydown.blockquote||this.keydown.figcaption)return c=this.selection.getCurrent(),h=t(c).next(),0!==h.length&&"BR"==h[0].tagName?this.keydown.insertBreakLine(e):this.utils.isEndOfElement()&&c&&"SPAN"!=c?this.keydown.insertDblBreakLine(e):this.keydown.insertBreakLine(e);if(this.opts.linebreaks&&!this.keydown.block)return c=this.selection.getCurrent(),h=t(this.keydown.current).next(),0!==h.length&&"BR"==h[0].tagName?this.keydown.insertBreakLine(e):c!==!1&&t(c).hasClass("redactor-invisible-space")?(this.caret.setAfter(c),t(c).contents().unwrap(),this.keydown.insertDblBreakLine(e)):this.utils.isEndOfEditor()?this.keydown.insertDblBreakLine(e):this.keydown.insertBreakLine(0===h.length&&c===!1&&"undefined"!=typeof h.context?e:e);if(this.opts.linebreaks&&this.keydown.block)setTimeout(t.proxy(this.keydown.replaceDivToBreakLine,this),1);else if(!this.opts.linebreaks&&this.keydown.block){if(setTimeout(t.proxy(this.keydown.replaceDivToParagraph,this),1),"LI"===this.keydown.block.tagName){c=this.selection.getCurrent();var d=t(c).closest("li",this.$editor[0]),u=d.closest("ul,ol",this.$editor[0]);if(0!==d.length&&this.utils.isEmpty(d.html())&&0===u.next().length&&this.utils.isEmpty(u.find("li").last().html())){u.find("li").last().remove();var a=t(this.opts.emptyHtml);return u.after(a),this.caret.setStart(a),!1}}else if("P"===this.keydown.block.tagName&&"LI"===this.keydown.block.parentNode.tagName){var p=this.keydown.block;if(null===p.nextElementSibling&&this.utils.isEmpty(p.innerHTML)){var f=p.parentNode;if(null===p.previousElementSibling){var g=f.parentNode;g.removeChild(f);var a=t(this.opts.emptyHtml)[0];return g.parentNode.insertBefore(a,g.nextElementSibling),this.caret.setStart(a),!1}f.removeChild(p);var a=t("<li>"+this.opts.emptyHtml+"</li>")[0];return f.parentNode.insertBefore(a,f.nextElementSibling),this.caret.setStart(a.children[0]),!1}}}else if(!this.opts.linebreaks&&!this.keydown.block)return this.keydown.insertParagraph(e)}if(i===this.keyCode.ENTER&&(e.ctrlKey||e.shiftKey))return this.keydown.onShiftEnter(e);if(i===this.keyCode.TAB||e.metaKey&&221===i||e.metaKey&&219===i)return this.keydown.onTab(e,i);if(i===this.keyCode.BACKSPACE||i===this.keyCode.DELETE){var m=this.selection.getNodes();if(m)for(var v,b=m.length,y=0;b>y;y++){var k=t(m[y]).children("img");if(0!==k.length){var w=this;t.each(k,function(e,i){var s=t(i);"none"==s.css("float")&&(w.core.setCallback("imageDelete",i.src,s),v=i)})}else"IMG"==m[y].tagName&&v!=m[y]&&(this.core.setCallback("imageDelete",m[y].src,t(m[y])),v=m[y])}}if(i===this.keyCode.BACKSPACE){var x=this.selection.getBlock(),$="0px"!==t(x).css("margin-left");if(x&&$&&this.range.collapsed&&this.utils.isStartOfElement())return this.indent.decrease(),void e.preventDefault();if(this.utils.browser("mozilla")){var C=this.selection.getPrev(),T=t(C).prev()[0];C&&"HR"===C.tagName&&t(C).remove(),T&&"HR"===T.tagName&&t(T).remove()}this.keydown.removeInvisibleSpace(),this.keydown.removeEmptyListInTable(e)}this.code.sync()}},checkEvents:function(t,e){t||"click"!=this.core.getEvent()&&"arrow"!=this.core.getEvent()||(this.core.addEvent(!1),this.keydown.checkKeyEvents(e)&&this.buffer.set())},checkKeyEvents:function(e){var i=this.keyCode,s=[i.BACKSPACE,i.DELETE,i.ENTER,i.ESC,i.TAB,i.CTRL,i.META,i.ALT,i.SHIFT];return-1==t.inArray(e,s)?!0:!1},addArrowsEvent:function(t){return t?"click"==this.core.getEvent()||"arrow"==this.core.getEvent()?void this.core.addEvent(!1):void this.core.addEvent("arrow"):void 0},setupBuffer:function(t,e){return this.keydown.ctrl&&90===e&&!t.shiftKey&&!t.altKey&&this.opts.buffer.length?(t.preventDefault(),void this.buffer.undo()):this.keydown.ctrl&&90===e&&t.shiftKey&&!t.altKey&&0!==this.opts.rebuffer.length?(t.preventDefault(),void this.buffer.redo()):void(this.keydown.ctrl||(e==this.keyCode.BACKSPACE||e==this.keyCode.DELETE||e==this.keyCode.ENTER&&!t.ctrlKey&&!t.shiftKey)&&this.buffer.set())},setupSelectAll:function(t,e){this.keydown.ctrl&&65===e?this.utils.enableSelectAll():e==this.keyCode.LEFT_WIN||this.keydown.ctrl||this.utils.disableSelectAll()},onArrowDown:function(){for(var t=[this.keydown.blockquote,this.keydown.pre,this.keydown.figcaption],e=0;e<t.length;e++)if(t[e])return this.keydown.insertAfterLastElement(t[e]),!1},onShiftEnter:function(t){return this.buffer.set(),this.utils.isEndOfElement()?this.keydown.insertDblBreakLine(t):this.keydown.insertBreakLine(t)},onTab:function(t,e){if(!this.opts.tabKey)return!0;if(this.utils.isEmpty(this.code.get())&&this.opts.tabAsSpaces===!1)return!0;t.preventDefault();var i;return this.keydown.pre&&!t.shiftKey?(i=document.createTextNode(this.opts.preSpaces?Array(this.opts.preSpaces+1).join(" "):" "),this.insert.node(i),this.code.sync()):this.opts.tabAsSpaces!==!1?(i=document.createTextNode(Array(this.opts.tabAsSpaces+1).join(" ")),this.insert.node(i),this.code.sync()):t.metaKey&&219===e?this.indent.decrease():t.metaKey&&221===e?this.indent.increase():t.shiftKey?this.indent.decrease():this.indent.increase(),!1},replaceDivToBreakLine:function(){var e=this.selection.getBlock(),i=e.innerHTML.replace(/<br\s?\/?>/gi,"");if(("DIV"===e.tagName||"P"===e.tagName)&&""===i&&!t(e).hasClass("redactor-editor")){var s=document.createElement("br");return t(e).replaceWith(s),this.caret.setBefore(s),this.code.sync(),!1}},replaceDivToParagraph:function(){var e=this.selection.getBlock(),i=e.innerHTML.replace(/<br\s?\/?>/gi,"");if("DIV"===e.tagName&&this.utils.isEmpty(i)&&!t(e).hasClass("redactor-editor")){var s=document.createElement("p");return s.innerHTML=this.opts.invisibleSpace,t(e).replaceWith(s),this.caret.setStart(s),this.code.sync(),!1}this.opts.cleanStyleOnEnter&&"P"==e.tagName&&t(e).removeAttr("class").removeAttr("style")},insertParagraph:function(t){t.preventDefault(),this.selection.get();var e=document.createElement("p");return e.innerHTML=this.opts.invisibleSpace,this.range.deleteContents(),this.range.insertNode(e),this.caret.setStart(e),this.code.sync(),!1},exitFromBlockquote:function(e){if(this.utils.isEndOfElement()){var i=t.trim(t(this.keydown.block).html());if(-1!=i.search(/(<br\s?\/?>){2}$/i)){if(e.preventDefault(),this.opts.linebreaks){var s=document.createElement("br");t(this.keydown.blockquote).after(s),this.caret.setBefore(s),t(this.keydown.block).html(i.replace(/<br\s?\/?>$/i,""))}else{var r=t(this.opts.emptyHtml);t(this.keydown.blockquote).after(r),this.caret.setStart(r)}return!0}}},insertAfterLastElement:function(e){if(this.utils.isEndOfElement())if(this.buffer.set(),this.opts.linebreaks){var i=t("<div>").append(t.trim(this.$editor.html())).contents(),s=i.last()[0];if("SPAN"==s.tagName&&""===s.innerHTML&&(s=i.prev()[0]),this.utils.getOuterHtml(s)!=this.utils.getOuterHtml(e))return;var r=document.createElement("br");t(e).after(r),this.caret.setAfter(r)}else{if(this.$editor.contents().last()[0]!==e)return;var o=t(this.opts.emptyHtml);t(e).after(o),this.caret.setStart(o)}},insertNewLine:function(t){t.preventDefault();var e=document.createTextNode("\n");return this.selection.get(),this.range.deleteContents(),this.range.insertNode(e),this.caret.setAfter(e),this.code.sync(),!1},insertBreakLine:function(t){return this.keydown.insertBreakLineProcessing(t)},insertDblBreakLine:function(t){return this.keydown.insertBreakLineProcessing(t,!0)},insertBreakLineProcessing:function(e,i){e.stopPropagation(),this.selection.get();var s=document.createElement("br");this.utils.browser("msie")?(this.range.collapse(!1),this.range.setEnd(this.range.endContainer,this.range.endOffset)):this.range.deleteContents(),this.range.insertNode(s);var r=t(s).parent("a");if(r.length>0&&(r.find(s).remove(),r.after(s)),i===!0){var o=t(s).next();if(0!==o.length&&"BR"===o[0].tagName&&this.utils.isEndOfEditor())return this.caret.setAfter(s),this.code.sync(),!1;var n=document.createElement("br");this.range.insertNode(n),this.caret.setAfter(n)}else if(this.utils.browser("msie")){var a=document.createElement("span");a.innerHTML="​",t(s).after(a),this.range.setStartAfter(a),this.range.setEndAfter(a),t(a).remove()}else{var l=document.createRange();l.setStartAfter(s),l.collapse(!0);var c=window.getSelection();c.removeAllRanges(),c.addRange(l)}return this.code.sync(),!1},removeInvisibleSpace:function(){var e=t(this.keydown.current);0===e.text().search(/^\u200B$/g)&&e.remove()},removeEmptyListInTable:function(e){var i=t(this.keydown.current),s=t(this.keydown.parent),r=i.closest("td",this.$editor[0]);if(0!==r.length&&i.closest("li",this.$editor[0])&&1===s.children("li").length){if(!this.utils.isEmpty(i.text()))return;e.preventDefault(),i.remove(),s.remove(),this.caret.setStart(r)}}}},keyup:function(){return{init:function(e){if(!this.rtePaste){var i=e.which;this.keyup.current=this.selection.getCurrent(),this.keyup.parent=this.selection.getParent();var s=this.utils.isRedactorParent(t(this.keyup.parent).parent()),r=this.core.setCallback("keyup",e);if(r===!1)return e.preventDefault(),!1;if(!this.opts.linebreaks&&3===this.keyup.current.nodeType&&this.keyup.current.length<=1&&(this.keyup.parent===!1||"BODY"==this.keyup.parent.tagName)&&this.keyup.replaceToParagraph(),!this.opts.linebreaks&&this.utils.isRedactorParent(this.keyup.current)&&"DIV"===this.keyup.current.tagName&&this.keyup.replaceToParagraph(!1),this.opts.linebreaks||!t(this.keyup.parent).hasClass("redactor-invisible-space")||s!==!1&&"BODY"!=s[0].tagName||(t(this.keyup.parent).contents().unwrap(),this.keyup.replaceToParagraph()),this.linkify.isEnabled()&&this.linkify.isKey(i)&&this.linkify.format(),i===this.keyCode.DELETE||i===this.keyCode.BACKSPACE){if(this.utils.browser("mozilla")){var o=t(this.keydown.current).closest("td",this.$editor[0]);if(0!==o.size()&&""!==o.text())return e.preventDefault(),!1}return this.clean.clearUnverified(),this.observe.image?(e.preventDefault(),this.image.hideResize(),this.buffer.set(),this.image.remove(this.observe.image),this.observe.image=!1,!1):(this.$editor.find("p").each(t.proxy(function(e,i){this.utils.removeEmpty(e,t(i).html())},this)),this.opts.linebreaks&&this.keyup.current&&"DIV"==this.keyup.current.tagName&&this.utils.isEmpty(this.keyup.current.innerHTML)&&(t(this.keyup.current).after(this.selection.getMarkerAsHtml()),this.selection.restore(),t(this.keyup.current).remove()),this.keyup.removeEmptyLists(),this.keyup.formatEmpty(e))}}},replaceToParagraph:function(e){var i,s=t(this.keyup.current);i=t("<p>").append(e===!1?s.html():s.clone()),s.replaceWith(i);var r=t(i).next();"undefined"!=typeof r[0]&&"BR"==r[0].tagName&&r.remove(),this.caret.setEnd(i)},removeEmptyLists:function(){var e=function(){var e=t.trim(this.innerHTML).replace(/\/t\/n/g,"");""===e&&t(this).remove()};this.$editor.find("li").each(e),this.$editor.find("ul, ol").each(e)},formatEmpty:function(e){var i=t.trim(this.$editor.html());if(this.utils.isEmpty(i))return e.preventDefault(),this.opts.linebreaks?(this.$editor.html(this.selection.getMarkerAsHtml()),this.selection.restore()):(this.$editor.html(this.opts.emptyHtml),this.focus.setStart()),this.code.sync(),!1}}},lang:function(){return{load:function(){this.opts.curLang=this.opts.langs[this.opts.lang]},get:function(t){return"undefined"!=typeof this.opts.curLang[t]?this.opts.curLang[t]:""}}},line:function(){return{insert:function(){this.buffer.set();var t=this.selection.getBlocks();return t[0]!==!1&&this.line.isExceptLastOrFirst(t)?void(this.utils.browser("msie")||this.$editor.focus()):void(this.utils.browser("msie")?this.line.insertInIe():this.line.insertInOthersBrowsers())},isExceptLastOrFirst:function(e){var i=["li","td","th","blockquote","figcaption","pre","dl","dt","dd"],s=e[0].tagName.toLowerCase(),r=this.selection.getLastBlock();r="undefined"==typeof r?s:r.tagName.toLowerCase();var o=-1!=t.inArray(s,i),n=-1!=t.inArray(r,i);return o&&n||o?!0:void 0},insertInIe:function(){this.utils.saveScroll(),this.buffer.set(),this.insert.node(document.createElement("hr")),this.utils.restoreScroll(),this.code.sync()},insertInOthersBrowsers:function(){this.buffer.set();var t='<p id="redactor-insert-line"><br /></p>';this.opts.linebreaks&&(t='<br id="redactor-insert-line">'),document.execCommand("insertHtml",!1,"<hr>"+t),this.line.setFocus(),this.code.sync()},setFocus:function(){var e=this.$editor.find("#redactor-insert-line"),i=t(e).next()[0],s=i;this.utils.browser("mozilla")&&i&&""===i.innerHTML&&(s=t(i).next()[0],t(i).remove()),s?(e.remove(),this.opts.linebreaks||(this.$editor.focus(),this.line.setStart(s))):(e.removeAttr("id"),this.line.setStart(e[0]))},setStart:function(t){if("undefined"!=typeof t){var e=document.createTextNode("");this.selection.get(),this.range.setStart(t,0),this.range.insertNode(e),this.range.collapse(!0),this.selection.addRange()}}}},link:function(){return{show:function(e){"undefined"!=typeof e&&e.preventDefault&&e.preventDefault(),this.observe.isCurrent("a")?this.modal.load("link",this.lang.get("link_edit"),600):this.modal.load("link",this.lang.get("link_insert"),600),this.modal.createCancelButton();var i=this.lang.get(this.observe.isCurrent("a")?"edit":"insert");this.link.buttonInsert=this.modal.createActionButton(i),this.selection.get(),this.link.getData(),this.link.cleanUrl(),"_blank"==this.link.target&&t("#redactor-link-blank").prop("checked",!0),this.link.$inputUrl=t("#redactor-link-url"),this.link.$inputText=t("#redactor-link-url-text"),this.link.$inputText.val(this.link.text),this.link.$inputUrl.val(this.link.url),this.link.buttonInsert.on("click",t.proxy(this.link.insert,this)),t(".redactor-link-tooltip").remove(),this.selection.save(),this.modal.show(),this.link.$inputUrl.focus()},cleanUrl:function(){var t=self.location.href.replace(/\/$/i,"");if("undefined"!=typeof this.link.url&&(this.link.url=this.link.url.replace(t,""),this.link.url=this.link.url.replace(/^\/#/,"#"),this.link.url=this.link.url.replace("mailto:",""),!this.opts.linkProtocol)){var e=new RegExp("^(http|ftp|https)://"+self.location.host,"i");this.link.url=this.link.url.replace(e,"")}},getData:function(){this.link.$node=!1;var e=t(this.selection.getCurrent()).closest("a",this.$editor[0]);0!==e.length&&"A"===e[0].tagName?(this.link.$node=e,this.link.url=e.attr("href"),this.link.text=e.text(),this.link.target=e.attr("target")):(this.link.text=this.sel.toString(),this.link.url="",this.link.target="")},insert:function(){this.placeholder.remove();var e="",i=this.link.$inputUrl.val(),s=this.link.$inputText.val().replace(/(<([^>]+)>)/gi,"");if(""===t.trim(i))return void this.link.$inputUrl.addClass("redactor-input-error").on("keyup",function(){t(this).removeClass("redactor-input-error"),t(this).off("keyup")});if(-1!=i.search("@")&&/(http|ftp|https):\/\//i.test(i)===!1)i=i.replace("mailto:",""),i="mailto:"+i;else if(0!==i.search("#")){t("#redactor-link-blank").prop("checked")&&(e="_blank");var r="((xn--)?[a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}",o=new RegExp("^(http|ftp|https)://"+r,"i"),n=new RegExp("^"+r,"i"),a=new RegExp(".(html|php)$","i");
-1==i.search(o)&&-1==i.search(a)&&0===i.search(n)&&this.opts.linkProtocol&&(i=this.opts.linkProtocol+"://"+i)}this.link.set(s,i,e),this.modal.close()},set:function(e,i,s){e=t.trim(e.replace(/<|>/g,"")),this.selection.restore();var r=this.selection.getBlocks();if(""!==e||""!==i){if(""===e&&""!==i&&(e=i),this.link.$node){this.buffer.set();var o=this.link.$node,n=o.children();if(n.length>0){for(;n.length;)n=n.children();n=n.end()}else n=o;o.attr("href",i),n.text(e),""!==s?o.attr("target",s):o.removeAttr("target"),this.selection.selectElement(o),this.code.sync()}else{if(this.utils.browser("mozilla")&&""===this.link.text){var a=t("<a />").attr("href",i).text(e);""!==s&&a.attr("target",s),a=t(this.insert.node(a)),this.opts.linebreaks&&a.after(" "),this.selection.selectElement(a)}else{var a;this.utils.browser("msie")?(a=t('<a href="'+i+'">').text(e),""!==s&&a.attr("target",s),a=t(this.insert.node(a)),this.selection.getText().match(/\s$/)&&a.after(" "),this.selection.selectElement(a)):(document.execCommand("createLink",!1,i),a=t(this.selection.getCurrent()).closest("a",this.$editor[0]),this.utils.browser("mozilla")&&(a=t('a[_moz_dirty=""]')),""!==s&&a.attr("target",s),a.removeAttr("style").removeAttr("_moz_dirty"),this.selection.getText().match(/\s$/)&&a.after(" "),(""!==this.link.text||this.link.text!=e)&&(!this.opts.linebreaks&&r&&r.length<=1?a.text(e):this.opts.linebreaks&&a.text(e),this.selection.selectElement(a)))}this.code.sync(),this.core.setCallback("insertedLink",a)}setTimeout(t.proxy(function(){this.observe.links()},this),5)}},unlink:function(e){"undefined"!=typeof e&&e.preventDefault&&e.preventDefault();var i=this.selection.getNodes();if(i){this.buffer.set();for(var s=i.length,r=[],o=0;s>o;o++){"A"===i[o].tagName&&r.push(i[o]);var n=t(i[o]).closest("a",this.$editor[0]);n.replaceWith(n.contents())}this.core.setCallback("deletedLink",r),t(".redactor-link-tooltip").remove(),this.code.sync()}},toggleClass:function(t){this.link.setClass(t,"toggleClass")},addClass:function(t){this.link.setClass(t,"addClass")},removeClass:function(t){this.link.setClass(t,"removeClass")},setClass:function(e,i){var s=this.selection.getInlinesTags(["a"]);s!==!1&&t.each(s,function(){t(this)[i](e)})}}},linkify:function(){return{isKey:function(t){return t==this.keyCode.ENTER||t==this.keyCode.SPACE},isEnabled:function(){return this.opts.convertLinks&&(this.opts.convertUrlLinks||this.opts.convertImageLinks||this.opts.convertVideoLinks)&&!this.utils.isCurrentOrParent("PRE")},format:function(){var e=this.linkify,i=this.opts;this.$editor.find(":not(iframe,img,a,pre)").addBack().contents().filter(function(){return 3===this.nodeType&&""!=t.trim(this.nodeValue)&&!t(this).parent().is("pre")&&(this.nodeValue.match(i.linkify.regexps.youtube)||this.nodeValue.match(i.linkify.regexps.vimeo)||this.nodeValue.match(i.linkify.regexps.image)||this.nodeValue.match(i.linkify.regexps.url))}).each(function(){var s=t(this).text(),r=s;i.convertVideoLinks&&(r.match(i.linkify.regexps.youtube)||r.match(i.linkify.regexps.vimeo))?r=e.convertVideoLinks(r):i.convertImageLinks&&r.match(i.linkify.regexps.image)?r=e.convertImages(r):i.convertUrlLinks&&(r=e.convertLinks(r)),t(this).before(s.replace(s,r)).remove()});var s=this.$editor.find(".redactor-linkify-object").each(function(){var e=t(this);return e.removeClass("redactor-linkify-object"),""===e.attr("class")&&e.removeAttr("class"),e[0]});setTimeout(t.proxy(function(){this.observe.load(),this.core.setCallback("linkify",s)},this),100),this.code.sync()},convertVideoLinks:function(t){var e='<iframe class="redactor-linkify-object" width="500" height="281" src="',i='" frameborder="0" allowfullscreen></iframe>';return t.match(this.opts.linkify.regexps.youtube)&&(t=t.replace(this.opts.linkify.regexps.youtube,e+"//www.youtube.com/embed/$1"+i)),t.match(this.opts.linkify.regexps.vimeo)&&(t=t.replace(this.opts.linkify.regexps.vimeo,e+"//player.vimeo.com/video/$2"+i)),t},convertImages:function(t){var e=t.match(this.opts.linkify.regexps.image);return e&&(t=t.replace(t,'<img src="'+e+'" class="redactor-linkify-object" />'),this.opts.linebreaks&&(this.utils.isEmpty(this.code.get())||(t="<br>"+t)),t+="<br>"),t},convertLinks:function(e){var i=e.match(this.opts.linkify.regexps.url);if(i){i=t.grep(i,function(e,s){return t.inArray(e,i)===s});for(var s=i.length,r=0;s>r;r++){var o=i[r],n=o,a=this.opts.linkProtocol+"://";null!==o.match(/(https?|ftp):\/\//i)&&(a=""),n.length>this.opts.linkSize&&(n=n.substring(0,this.opts.linkSize)+"..."),-1===n.search("%")&&(n=decodeURIComponent(n));var l="\\b";-1!=t.inArray(o.slice(-1),["/","&","="])&&(l="");var c=new RegExp("("+o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")+l+")","g");e=e.replace(c,'<a href="'+a+t.trim(o)+'" class="redactor-linkify-object">'+t.trim(n)+"</a>")}}return e}}},list:function(){return{toggle:function(e){this.placeholder.remove(),this.utils.browser("msie")||this.opts.linebreaks||this.$editor.focus(),this.buffer.set(),this.selection.save();var i=this.selection.getParent(),s=t(i).closest("ol, ul",this.$editor[0]);this.utils.isRedactorParent(s)||0===s.length||(s=!1);var r,o,n=!1;if(s&&s.length){n=!0;var a=s[0].tagName;r="orderedlist"===e&&"UL"===a,o="unorderedlist"===e&&"OL"===a}r?this.utils.replaceToTag(s,"ol"):o?this.utils.replaceToTag(s,"ul"):n?this.list.remove(e,s):this.list.insert(e),this.selection.restore(),this.code.sync()},insert:function(e){var i=this.selection.getCurrent(),s=t(i).closest("td, th",this.$editor[0]);this.utils.browser("msie")&&this.opts.linebreaks?this.list.insertInIe(e):document.execCommand("insert"+e);var r=this.selection.getParent(),o=t(r).closest("ol, ul",this.$editor[0]);if(0!==s.length){var n=s.clone();s.after(n).remove("")}if(this.utils.isEmpty(o.find("li").text())){var a=o.children("li");a.find("br").remove(),a.append(this.selection.getMarkerAsHtml()),this.opts.linebreaks&&this.utils.browser("mozilla")&&2==a.size()&&this.utils.isEmpty(a.eq(1).text())&&a.eq(1).remove()}if(o.length){var l=o.parent();this.utils.isRedactorParent(l)&&"LI"!=l[0].tagName&&this.utils.isBlock(l[0])&&l.replaceWith(l.contents())}this.utils.browser("msie")||this.$editor.focus(),this.clean.clearUnverified()},insertInIe:function(e){var i=this.selection.wrap("div"),s=t(i).html(),r=t("orderedlist"==e?"<ol>":"<ul>"),o=t("<li>");if(""===t.trim(s))o.append(this.selection.getMarkerAsHtml()),r.append(o),this.$editor.find("#selection-marker-1").replaceWith(r);else{var n=s.split(/<br\s?\/?>/gi);if(n)for(var a=0;a<n.length;a++)""!==t.trim(n[a])&&r.append(t("<li>").html(n[a]));else o.append(s),r.append(o);t(i).replaceWith(r)}},remove:function(e){t.inArray("ul",this.selection.getBlocks())&&(e="unorderedlist"),document.execCommand("insert"+e);var i=t(this.selection.getCurrent());this.indent.fixEmptyIndent(),this.opts.linebreaks||0!==i.closest("li, th, td",this.$editor[0]).length||(document.execCommand("formatblock",!1,"p"),this.$editor.find("ul, ol, blockquote").each(t.proxy(this.utils.removeEmpty,this)));var s=t(this.selection.getCurrent()).closest("table",this.$editor[0]),r=s.prev();this.opts.linebreaks||0===s.length||0===r.length||"BR"!=r[0].tagName||r.remove(),this.clean.clearUnverified()}}},modal:function(){return{callbacks:{},loadTemplates:function(){this.opts.modal={imageEdit:String()+'<section id="redactor-modal-image-edit"><label>'+this.lang.get("title")+'</label><input type="text" id="redactor-image-title" /><label class="redactor-image-link-option">'+this.lang.get("link")+'</label><input type="text" id="redactor-image-link" class="redactor-image-link-option" aria-label="'+this.lang.get("link")+'" /><label class="redactor-image-link-option"><input type="checkbox" id="redactor-image-link-blank" aria-label="'+this.lang.get("link_new_tab")+'"> '+this.lang.get("link_new_tab")+'</label><label class="redactor-image-position-option">'+this.lang.get("image_position")+'</label><select class="redactor-image-position-option" id="redactor-image-align" aria-label="'+this.lang.get("image_position")+'"><option value="none">'+this.lang.get("none")+'</option><option value="left">'+this.lang.get("left")+'</option><option value="center">'+this.lang.get("center")+'</option><option value="right">'+this.lang.get("right")+"</option></select></section>",image:String()+'<section id="redactor-modal-image-insert"><div id="redactor-modal-image-droparea"></div></section>',file:String()+'<section id="redactor-modal-file-insert"><div id="redactor-modal-file-upload-box"><label>'+this.lang.get("filename")+'</label><input type="text" id="redactor-filename" aria-label="'+this.lang.get("filename")+'" /><br><br><div id="redactor-modal-file-upload"></div></div></section>',link:String()+'<section id="redactor-modal-link-insert"><label>URL</label><input type="url" id="redactor-link-url" aria-label="URL" /><label>'+this.lang.get("text")+'</label><input type="text" id="redactor-link-url-text" aria-label="'+this.lang.get("text")+'" /><label><input type="checkbox" id="redactor-link-blank"> '+this.lang.get("link_new_tab")+"</label></section>"},t.extend(this.opts,this.opts.modal)},addCallback:function(t,e){this.modal.callbacks[t]=e},createTabber:function(e){this.modal.$tabber=t("<div>").attr("id","redactor-modal-tabber"),e.prepend(this.modal.$tabber)},addTab:function(e,i,s){var r=t('<a href="#" rel="tab'+e+'">').text(i);s&&r.addClass("active");var o=this;r.on("click",function(e){e.preventDefault(),t(".redactor-tab").hide(),t(".redactor-"+t(this).attr("rel")).show(),o.modal.$tabber.find("a").removeClass("active"),t(this).addClass("active")}),this.modal.$tabber.append(r)},addTemplate:function(t,e){this.opts.modal[t]=e},getTemplate:function(t){return this.opts.modal[t]},getModal:function(){return this.$modalBody.find("section")},load:function(t,e,i){this.modal.templateName=t,this.modal.width=i,this.modal.build(),this.modal.enableEvents(),this.modal.setTitle(e),this.modal.setDraggable(),this.modal.setContent(),"undefined"!=typeof this.modal.callbacks[t]&&this.modal.callbacks[t].call(this)},show:function(){this.utils.disableBodyScroll(),this.utils.isMobile()?this.modal.showOnMobile():this.modal.showOnDesktop(),this.opts.highContrast&&this.$modalBox.addClass("redactor-modal-contrast"),this.$modalOverlay.show(),this.$modalBox.show(),this.$modal.attr("tabindex","-1"),this.$modal.focus(),this.modal.setButtonsWidth(),this.utils.saveScroll(),this.utils.isMobile()||(setTimeout(t.proxy(this.modal.showOnDesktop,this),0),t(window).on("resize.redactor-modal",t.proxy(this.modal.resize,this))),this.core.setCallback("modalOpened",this.modal.templateName,this.$modal),t(document).off("focusin.modal"),this.$modal.find("input[type=text],input[type=url],input[type=email]").on("keydown.redactor-modal",t.proxy(this.modal.setEnter,this))},showOnDesktop:function(){var e=this.$modal.outerHeight(),i=t(window).height(),s=t(window).width();return this.modal.width>s?void this.$modal.css({width:"96%",marginTop:i/2-e/2+"px"}):void this.$modal.css(e>i?{width:this.modal.width+"px",marginTop:"20px"}:{width:this.modal.width+"px",marginTop:i/2-e/2+"px"})},showOnMobile:function(){this.$modal.css({width:"96%",marginTop:"2%"})},resize:function(){this.utils.isMobile()?this.modal.showOnMobile():this.modal.showOnDesktop()},setTitle:function(t){this.$modalHeader.html(t)},setContent:function(){this.$modalBody.html(this.modal.getTemplate(this.modal.templateName))},setDraggable:function(){"undefined"!=typeof t.fn.draggable&&(this.$modal.draggable({handle:this.$modalHeader}),this.$modalHeader.css("cursor","move"))},setEnter:function(t){13==t.which&&(t.preventDefault(),this.$modal.find("button.redactor-modal-action-btn").click())},createCancelButton:function(){var e=t("<button>").addClass("redactor-modal-btn redactor-modal-close-btn").html(this.lang.get("cancel"));e.on("click",t.proxy(this.modal.close,this)),this.$modalFooter.append(e)},createDeleteButton:function(t){return this.modal.createButton(t,"delete")},createActionButton:function(t){return this.modal.createButton(t,"action")},createButton:function(e,i){var s=t("<button>").addClass("redactor-modal-btn").addClass("redactor-modal-"+i+"-btn").html(e);return this.$modalFooter.append(s),s},setButtonsWidth:function(){var t=this.$modalFooter.find("button"),e=t.length;0!==e&&t.css("width",100/e+"%")},build:function(){this.modal.buildOverlay(),this.$modalBox=t('<div id="redactor-modal-box"/>').hide(),this.$modal=t('<div id="redactor-modal" role="dialog" aria-labelledby="redactor-modal-header" />'),this.$modalHeader=t('<header id="redactor-modal-header"/>'),this.$modalClose=t('<button type="button" id="redactor-modal-close" tabindex="1" aria-label="Close" />').html("×"),this.$modalBody=t('<div id="redactor-modal-body" />'),this.$modalFooter=t("<footer />"),this.$modal.append(this.$modalHeader),this.$modal.append(this.$modalClose),this.$modal.append(this.$modalBody),this.$modal.append(this.$modalFooter),this.$modalBox.append(this.$modal),this.$modalBox.appendTo(document.body)},buildOverlay:function(){this.$modalOverlay=t('<div id="redactor-modal-overlay">').hide(),t("body").prepend(this.$modalOverlay)},enableEvents:function(){this.$modalClose.on("click.redactor-modal",t.proxy(this.modal.close,this)),t(document).on("keyup.redactor-modal",t.proxy(this.modal.closeHandler,this)),this.$editor.on("keyup.redactor-modal",t.proxy(this.modal.closeHandler,this)),this.$modalBox.on("click.redactor-modal",t.proxy(this.modal.close,this))},disableEvents:function(){this.$modalClose.off("click.redactor-modal"),t(document).off("keyup.redactor-modal"),this.$editor.off("keyup.redactor-modal"),this.$modalBox.off("click.redactor-modal"),t(window).off("resize.redactor-modal")},closeHandler:function(t){t.which==this.keyCode.ESC&&this.modal.close(!1)},close:function(e){if(e){if(!t(e.target).hasClass("redactor-modal-close-btn")&&e.target!=this.$modalClose[0]&&e.target!=this.$modalBox[0])return;e.preventDefault()}this.$modalBox&&(this.modal.disableEvents(),this.utils.enableBodyScroll(),this.$modalOverlay.remove(),this.$modalBox.fadeOut("fast",t.proxy(function(){this.$modalBox.remove(),setTimeout(t.proxy(this.utils.restoreScroll,this),0),void 0!==e&&this.selection.restore(),t(document.body).css("overflow",this.modal.bodyOveflow),this.core.setCallback("modalClosed",this.modal.templateName)},this)))}}},observe:function(){return{load:function(){if("undefined"==typeof this.opts.destroyed){if(this.utils.browser("msie")){var e=this;this.$editor.find("pre, code").on("mouseover",function(){e.$editor.attr("contenteditable",!1),t(this).attr("contenteditable",!0)}).on("mouseout",function(){e.$editor.attr("contenteditable",!0),t(this).removeAttr("contenteditable")})}this.observe.images(),this.observe.links()}},toolbar:function(t,e){this.observe.buttons(t,e),this.observe.dropdowns()},isCurrent:function(e,i){if("undefined"==typeof i)var i=t(this.selection.getCurrent());return i.is(e)||i.parents(e).length>0},dropdowns:function(){var e=t(this.selection.getCurrent());t.each(this.opts.observe.dropdowns,t.proxy(function(t,i){var s=i.observe,r=s.element,o=i.item,n="undefined"!=typeof s.in?s.in:!1,a="undefined"!=typeof s.out?s.out:!1;e.closest(r).size()>0?this.observe.setDropdownProperties(o,n,a):this.observe.setDropdownProperties(o,a,n)},this))},setDropdownProperties:function(t,e,i){i&&"undefined"!=typeof i.attr&&this.observe.setDropdownAttr(t,i.attr,!0),"undefined"!=typeof e.attr&&this.observe.setDropdownAttr(t,e.attr),"undefined"!=typeof e.title&&t.text(e.title)},setDropdownAttr:function(e,i,s){t.each(i,function(t,i){"class"==t?s?e.removeClass(i):e.addClass(i):s?e.removeAttr(t):e.attr(t,i)})},addDropdown:function(t,e,i){"undefined"!=typeof i.observe&&(i.item=t,this.opts.observe.dropdowns.push(i))},buttons:function(e,i){var s=this.selection.getCurrent(),r=this.selection.getParent();if(e!==!1?this.button.setInactiveAll():this.button.setInactiveAll(i),e===!1&&"html"!==i)return void(-1!=t.inArray(i,this.opts.activeButtons)&&this.button.toggleActive(i));t.each(this.opts.activeButtonsStates,t.proxy(function(e,i){var o=t(r).closest(e,this.$editor[0]),n=t(s).closest(e,this.$editor[0]);(0===o.length||this.utils.isRedactorParent(o))&&this.utils.isRedactorParent(n)&&(0!==o.length||0!==n.closest(e,this.$editor[0]).length)&&this.button.setActive(i)},this));var o=t(r).closest(this.opts.alignmentTags.toString().toLowerCase(),this.$editor[0]);if(this.utils.isRedactorParent(r)&&o.length){var n=""===o.css("text-align")?"left":o.css("text-align");this.button.setActive("align"+n)}},addButton:function(t,e){this.opts.activeButtons.push(e),this.opts.activeButtonsStates[t]=e},images:function(){this.$editor.find("img").each(t.proxy(function(e,i){var s=t(i);s.closest("a",this.$editor[0]).on("click",function(t){t.preventDefault()}),this.utils.browser("msie")&&s.attr("unselectable","on"),this.image.setEditable(s)},this)),t(document).on("click.redactor-image-delete."+this.uuid,t.proxy(function(t){this.observe.image=!1,"IMG"==t.target.tagName&&this.utils.isRedactorParent(t.target)&&(this.observe.image=this.observe.image&&this.observe.image==t.target?!1:t.target)},this))},links:function(){this.opts.linkTooltip&&(this.$editor.find("a").on("touchstart.redactor."+this.uuid+" click.redactor."+this.uuid,t.proxy(this.observe.showTooltip,this)),this.$editor.on("touchstart.redactor."+this.uuid+" click.redactor."+this.uuid,t.proxy(this.observe.closeTooltip,this)),t(document).on("touchstart.redactor."+this.uuid+" click.redactor."+this.uuid,t.proxy(this.observe.closeTooltip,this)))},getTooltipPosition:function(t){return t.offset()},showTooltip:function(e){var i=t(e.target);if("IMG"!=i[0].tagName&&("A"!==i[0].tagName&&(i=i.closest("a",this.$editor[0])),"A"===i[0].tagName)){var s=i,r=this.observe.getTooltipPosition(s),o=t('<span class="redactor-link-tooltip"></span>'),n=s.attr("href");void 0===n&&(n=""),n.length>24&&(n=n.substring(0,24)+"...");var a=t('<a href="'+s.attr("href")+'" target="_blank" />').html(n).addClass("redactor-link-tooltip-action"),l=t('<a href="#" />').html(this.lang.get("edit")).on("click",t.proxy(this.link.show,this)).addClass("redactor-link-tooltip-action"),c=t('<a href="#" />').html(this.lang.get("unlink")).on("click",t.proxy(this.link.unlink,this)).addClass("redactor-link-tooltip-action");o.append(a).append(" | ").append(l).append(" | ").append(c),o.css({top:r.top+parseInt(s.css("line-height"),10)+"px",left:r.left+"px"}),t(".redactor-link-tooltip").remove(),t("body").append(o)}},closeTooltip:function(e){e=e.originalEvent||e;var i=e.target,s=t(i).closest("a",this.$editor[0]);(0===s.length||"A"!==s[0].tagName||"A"===i.tagName)&&("A"===i.tagName&&this.utils.isRedactorParent(i)||t(i).hasClass("redactor-link-tooltip-action")||t(".redactor-link-tooltip").remove())}}},paragraphize:function(){return{load:function(e){return this.opts.linebreaks?e:""===e||"<p></p>"===e?this.opts.emptyHtml:(e+="\n",this.paragraphize.safes=[],this.paragraphize.z=0,e=e.replace(/(<br\s?\/?>){1,}\n?<\/blockquote>/gi,"</blockquote>"),e=this.paragraphize.getSafes(e),e=this.paragraphize.getSafesComments(e),e=this.paragraphize.replaceBreaksToNewLines(e),e=this.paragraphize.replaceBreaksToParagraphs(e),e=this.paragraphize.clear(e),e=this.paragraphize.restoreSafes(e),e=e.replace(new RegExp("<br\\s?/?>\n?<("+this.opts.paragraphizeBlocks.join("|")+")(.*?[^>])>","gi"),"<p><br /></p>\n<$1$2>"),t.trim(e))},getSafes:function(e){var i=t("<div />").append(e);return i.find("blockquote p").replaceWith(function(){return t(this).append("<br />").contents()}),e=i.html(),i.find(this.opts.paragraphizeBlocks.join(", ")).each(t.proxy(function(t,i){this.paragraphize.z++,this.paragraphize.safes[this.paragraphize.z]=i.outerHTML,e=e.replace(i.outerHTML,"\n{replace"+this.paragraphize.z+"}")},this)),e},getSafesComments:function(e){var i=e.match(/<!--([\w\W]*?)-->/gi);return i?(t.each(i,t.proxy(function(t,i){this.paragraphize.z++,this.paragraphize.safes[this.paragraphize.z]=i,e=e.replace(i,"\n{replace"+this.paragraphize.z+"}")},this)),e):e},restoreSafes:function(e){return t.each(this.paragraphize.safes,function(t,i){i="undefined"!=typeof i?i.replace(/\$/g,"$"):i,e=e.replace("{replace"+t+"}",i)}),e},replaceBreaksToParagraphs:function(t){var e=t.split(new RegExp("\n","g"),-1);if(t="",e)for(var i=e.length,s=0;i>s;s++){if(!e.hasOwnProperty(s))return;-1==e[s].search("{replace")?(e[s]=e[s].replace(/<p>\n\t?<\/p>/gi,""),e[s]=e[s].replace(/<p><\/p>/gi,""),""!==e[s]&&(t+="<p>"+e[s].replace(/^\n+|\n+$/g,"")+"</p>")):t+=e[s]}return t},replaceBreaksToNewLines:function(t){return t=t.replace(/<br \/>\s*<br \/>/gi,"\n\n"),t=t.replace(/<br\s?\/?>\n?<br\s?\/?>/gi,"\n<br /><br />"),t=t.replace(new RegExp("\r\n","g"),"\n"),t=t.replace(new RegExp("\r","g"),"\n"),t=t.replace(new RegExp("/\n\n+/"),"g","\n\n")},clear:function(t){return t=t.replace(new RegExp("</blockquote></p>","gi"),"</blockquote>"),t=t.replace(new RegExp("<p></blockquote>","gi"),"</blockquote>"),t=t.replace(new RegExp("<p><blockquote>","gi"),"<blockquote>"),t=t.replace(new RegExp("<blockquote></p>","gi"),"<blockquote>"),t=t.replace(new RegExp("<p><p ","gi"),"<p "),t=t.replace(new RegExp("<p><p>","gi"),"<p>"),t=t.replace(new RegExp("</p></p>","gi"),"</p>"),t=t.replace(new RegExp("<p>\\s?</p>","gi"),""),t=t.replace(new RegExp("\n</p>","gi"),"</p>"),t=t.replace(new RegExp("<p> ? ?\n?<p>","gi"),"<p>"),t=t.replace(new RegExp("<p> *</p>","gi"),"")}}},paste:function(){return{init:function(){return this.opts.cleanOnPaste?(this.rtePaste=!0,this.buffer.set(),this.selection.save(),this.utils.saveScroll(),this.paste.createPasteBox(),t(window).on("scroll.redactor-freeze",t.proxy(function(){t(window).scrollTop(this.saveBodyScroll)},this)),void setTimeout(t.proxy(function(){var e=this.$pasteBox.html();this.$pasteBox.remove(),this.selection.restore(),this.utils.restoreScroll(),this.paste.insert(e),t(window).off("scroll.redactor-freeze"),this.linkify.isEnabled()&&this.linkify.format()},this),1)):void setTimeout(t.proxy(this.code.sync,this),1)},createPasteBox:function(){if(this.$pasteBox=t("<div>").html("").attr("contenteditable","true").css({position:"fixed",width:0,top:0,left:"-9999px"}),this.utils.browser("msie"))this.$box.append(this.$pasteBox);else{var e=t(".modal-body:visible");e.length>0?e.append(this.$pasteBox):t("body").append(this.$pasteBox)}this.$pasteBox.get(0).focus()},insert:function(e){e=this.core.setCallback("pasteBefore",e),e=this.utils.isSelectAll()?this.clean.onPaste(e,!1):this.clean.onPaste(e),e=this.core.setCallback("paste",e),this.utils.isSelectAll()?this.insert.set(e,!1):this.insert.html(e,!1),this.utils.disableSelectAll(),this.rtePaste=!1,setTimeout(t.proxy(this.clean.clearUnverified,this),10),setTimeout(t.proxy(function(){var e=this.$editor.find("span");t.each(e,function(e,i){var s=i.innerHTML.replace(/\u200B/,"");""===s&&0===i.attributes.length&&t(i).remove()})},this),10)}}},placeholder:function(){return{enable:function(){this.placeholder.is()&&(this.$editor.attr("placeholder",this.$element.attr("placeholder")),this.placeholder.toggle(),this.$editor.on("keydown.redactor-placeholder",t.proxy(this.placeholder.toggle,this)))},toggle:function(){setTimeout(t.proxy(function(){var t=this.utils.isEmpty(this.$editor.html(),!1)?"addClass":"removeClass";this.$editor[t]("redactor-placeholder")},this),5)},remove:function(){this.$editor.removeClass("redactor-placeholder")},is:function(){return this.opts.placeholder?this.$element.attr("placeholder",this.opts.placeholder):!("undefined"==typeof this.$element.attr("placeholder")||""===this.$element.attr("placeholder"))}}},progress:function(){return{show:function(){t(document.body).append(t('<div id="redactor-progress"><span></span></div>')),t("#redactor-progress").fadeIn()},hide:function(){t("#redactor-progress").fadeOut(1500,function(){t(this).remove()})}}},selection:function(){return{get:function(){this.sel=document.getSelection(),this.range=document.getSelection&&this.sel.getRangeAt&&this.sel.rangeCount?this.sel.getRangeAt(0):document.createRange()},addRange:function(){try{this.sel.removeAllRanges()}catch(t){}this.sel.addRange(this.range)},getCurrent:function(){var t=!1;return this.selection.get(),this.sel&&this.sel.rangeCount>0&&(t=this.sel.getRangeAt(0).startContainer),this.utils.isRedactorParent(t)},getParent:function(e){return e=e||this.selection.getCurrent(),e?this.utils.isRedactorParent(t(e).parent()[0]):!1},getPrev:function(){return window.getSelection().anchorNode.previousSibling},getNext:function(){return window.getSelection().anchorNode.nextSibling},getBlock:function(e){for(e=e||this.selection.getCurrent();e;){if(this.utils.isBlockTag(e.tagName))return t(e).hasClass("redactor-editor")?!1:e;e=e.parentNode}return!1},getInlines:function(e,i){if(this.selection.get(),this.range&&this.range.collapsed)return!1;var s=[];e="undefined"==typeof e||e===!1?this.selection.getNodes():e;var r=this.opts.inlineTags;if(r.push("span"),"undefined"!=typeof i)for(var o=0;o<i.length;o++)r.push(i[o]);return t.each(e,t.proxy(function(e,i){-1!=t.inArray(i.tagName.toLowerCase(),r)&&s.push(i)},this)),0===s.length?!1:s},getInlinesTags:function(e){if(this.selection.get(),this.range&&this.range.collapsed)return!1;var i=[],s=this.selection.getNodes();return t.each(s,t.proxy(function(s,r){-1!=t.inArray(r.tagName.toLowerCase(),e)&&i.push(r)},this)),0===i.length?!1:i},getBlocks:function(e){if(this.selection.get(),this.range&&this.range.collapsed)return[this.selection.getBlock()];var i=[];return e="undefined"==typeof e?this.selection.getNodes():e,t.each(e,t.proxy(function(t,e){this.utils.isBlock(e)&&i.push(e)},this)),0===i.length?[this.selection.getBlock()]:i},getLastBlock:function(){return this.selection.lastBlock},getNodes:function(){this.selection.get();var e=this.selection.getNodesMarker(1),i=this.selection.getNodesMarker(2);if(this.range.collapsed===!1){if(window.getSelection){var s=window.getSelection();if(s.rangeCount>0){var r=s.getRangeAt(0),o=r.startContainer,n=r.startOffset,a=r.cloneRange();a.collapse(!1),a.insertNode(i),a.setStart(o,n),a.collapse(!0),a.insertNode(e),r.setStartAfter(e),r.setEndBefore(i),s.removeAllRanges(),s.addRange(r)}}}else this.selection.setNodesMarker(this.range,e,!0),i=e;var l=[],c=0,h=this;this.$editor.find("*").each(function(){if(this==e){var s=t(this).parent();0!==s.length&&"BODY"!=s[0].tagName&&h.utils.isRedactorParent(s[0])&&l.push(s[0]),l.push(this),c=1}else c>0&&(l.push(this),c+=1);return this==i?!1:void 0});for(var d=[],u=l.length,p=0;u>p;p++)"nodes-marker-1"!=l[p].id&&"nodes-marker-2"!=l[p].id&&d.push(l[p]);return this.selection.removeNodesMarkers(),d},getNodesMarker:function(e){return t('<span id="nodes-marker-'+e+'" class="redactor-nodes-marker" data-verified="redactor">'+this.opts.invisibleSpace+"</span>")[0]},setNodesMarker:function(t,e,i){var t=t.cloneRange();try{t.collapse(i),t.insertNode(e)}catch(t){}},removeNodesMarkers:function(){t(document).find("span.redactor-nodes-marker").remove(),this.$editor.find("span.redactor-nodes-marker").remove()},fromPoint:function(t,e){this.caret.setOffset(t,e)},wrap:function(t){if(this.selection.get(),this.range.collapsed)return!1;var e=document.createElement(t);return e.appendChild(this.range.extractContents()),this.range.insertNode(e),e},selectElement:function(t){if(this.utils.browser("mozilla")){t=t[0]||t;var e=document.createRange();e.selectNodeContents(t)}else this.caret.set(t,0,t,1)},selectAll:function(){this.selection.get(),this.range.selectNodeContents(this.$editor[0]),this.selection.addRange()},remove:function(){this.selection.get(),this.sel.removeAllRanges()},save:function(){this.selection.createMarkers()},createMarkers:function(){this.selection.get();var t=this.selection.getMarker(1);if(this.selection.setMarker(this.range,t,!0),this.range.collapsed===!1){var e=this.selection.getMarker(2);this.selection.setMarker(this.range,e,!1)}this.savedSel=this.$editor.html()},getMarker:function(e){return"undefined"==typeof e&&(e=1),t('<span id="selection-marker-'+e+'" class="redactor-selection-marker" data-verified="redactor">'+this.opts.invisibleSpace+"</span>")[0]},getMarkerAsHtml:function(t){return this.utils.getOuterHtml(this.selection.getMarker(t))},setMarker:function(t,e,i){t=t.cloneRange();try{t.collapse(i),t.insertNode(e)}catch(t){this.focus.setStart()}},restore:function(){var t=this.$editor.find("span#selection-marker-1"),e=this.$editor.find("span#selection-marker-2");this.utils.browser("mozilla")&&this.$editor.focus(),0!==t.length&&0!==e.length?this.caret.set(t,0,e,0):0!==t.length?this.caret.set(t,0,t,0):this.$editor.focus(),this.selection.removeMarkers(),this.savedSel=!1},removeMarkers:function(){this.$editor.find("span.redactor-selection-marker").each(function(e,i){var s=t(i).text().replace(/\u200B/g,"");""===s?t(i).remove():t(i).replaceWith(function(){return t(this).contents()})})},getText:function(){return this.selection.get(),this.sel.toString()},getHtml:function(){var t="";if(this.selection.get(),this.sel.rangeCount){for(var e=document.createElement("div"),i=this.sel.rangeCount,s=0;i>s;++s)e.appendChild(this.sel.getRangeAt(s).cloneContents());t=e.innerHTML}return this.clean.onSync(t)},replaceSelection:function(t){this.selection.get(),this.range.deleteContents();var e=document.createElement("div");e.innerHTML=t;for(var i,s=document.createDocumentFragment();i=e.firstChild;)s.appendChild(i);this.range.insertNode(s)},replaceWithHtml:function(t){t=this.selection.getMarkerAsHtml(1)+t+this.selection.getMarkerAsHtml(2),this.selection.get(),window.getSelection&&window.getSelection().getRangeAt?this.selection.replaceSelection(t):document.selection&&document.selection.createRange&&this.range.pasteHTML(t),this.selection.restore(),this.code.sync()}}},shortcuts:function(){return{init:function(e,i){return this.opts.shortcuts?void t.each(this.opts.shortcuts,t.proxy(function(i,s){for(var r=i.split(","),o=r.length,n=0;o>n;n++)"string"==typeof r[n]&&this.shortcuts.handler(e,t.trim(r[n]),t.proxy(function(){var t;"-1"!=s.func.search(/\./)?(t=s.func.split("."),"undefined"!=typeof this[t[0]]&&this[t[0]][t[1]].apply(this,s.params)):this[s.func].apply(this,s.params)},this))},this)):(!e.ctrlKey&&!e.metaKey||66!==i&&73!==i||e.preventDefault(),!1)},handler:function(e,i,s){var r={8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",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",59:";",61:"=",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:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"};i=i.toLowerCase().split(" ");var n=r[e.keyCode],a=String.fromCharCode(e.which).toLowerCase(),l="",c={};t.each(["alt","ctrl","meta","shift"],function(t,i){e[i+"Key"]&&n!==i&&(l+=i+"+")}),n&&(c[l+n]=!0),a&&(c[l+a]=!0,c[l+o[a]]=!0,"shift+"===l&&(c[o[a]]=!0));for(var h=0,d=i.length;d>h;h++)if(c[i[h]])return e.preventDefault(),s.apply(this,arguments)}}},tabifier:function(){return{get:function(t){if(!this.opts.tabifier)return t;var e=["area","body","head","hr","i?frame","link","meta","noscript","style","script","table","tbody","thead","tfoot"],i=["li","dt","dt","h[1-6]","option","script"],s=["p","blockquote","div","dl","fieldset","form","frameset","map","ol","pre","select","td","th","tr","ul"];this.tabifier.lineBefore=new RegExp("^<(/?"+e.join("|/?")+"|"+i.join("|")+")[ >]"),this.tabifier.lineAfter=new RegExp("^<(br|/?"+e.join("|/?")+"|/"+i.join("|/")+")[ >]"),this.tabifier.newLevel=new RegExp("^</?("+s.join("|")+")[ >]");var r=0,o=t.length,n=0,a=null,l=null,c="",h="",d="";for(this.tabifier.cleanlevel=0;o>r;r++){if(n=r,-1==t.substr(r).indexOf("<"))return h+=t.substr(r),this.tabifier.finish(h);for(;o>n&&"<"!=t.charAt(n);)n++;for(r!=n&&(d=t.substr(r,n-r),d.match(/^\s{2,}$/g)||("\n"==h.charAt(h.length-1)?h+=this.tabifier.getTabs():"\n"==d.charAt(0)&&(h+="\n"+this.tabifier.getTabs(),
d=d.replace(/^\s+/,"")),h+=d),d.match(/\n/)&&(h+="\n"+this.tabifier.getTabs())),a=n;o>n&&">"!=t.charAt(n);)n++;c=t.substr(a,n-a),r=n;var u;if("!--"==c.substr(1,3)){if(!c.match(/--$/)){for(;"-->"!=t.substr(n,3);)n++;n+=2,c=t.substr(a,n-a),r=n}"\n"!=h.charAt(h.length-1)&&(h+="\n"),h+=this.tabifier.getTabs(),h+=c+">\n"}else"!"==c[1]?h=this.tabifier.placeTag(c+">",h):"?"==c[1]?h+=c+">\n":(u=c.match(/^<(script|style|pre)/i))?(u[1]=u[1].toLowerCase(),c=this.tabifier.cleanTag(c),h=this.tabifier.placeTag(c,h),l=String(t.substr(r+1)).toLowerCase().indexOf("</"+u[1]),l&&(d=t.substr(r+1,l),r+=l,h+=d)):(c=this.tabifier.cleanTag(c),h=this.tabifier.placeTag(c,h))}return this.tabifier.finish(h)},getTabs:function(){for(var t="",e=0;e<this.tabifier.cleanlevel;e++)t+=" ";return t},finish:function(t){return t=t.replace(/\n\s*\n/g,"\n"),t=t.replace(/^[\s\n]*/,""),t=t.replace(/[\s\n]*$/,""),t=t.replace(/<script(.*?)>\n<\/script>/gi,"<script$1></script>"),this.tabifier.cleanlevel=0,t},cleanTag:function(t){var e="";t=t.replace(/\n/g," "),t=t.replace(/\s{2,}/g," "),t=t.replace(/^\s+|\s+$/g," ");var i="";t.match(/\/$/)&&(i="/",t=t.replace(/\/+$/,""));for(var s;s=/\s*([^= ]+)(?:=((['"']).*?\3|[^ ]+))?/.exec(t);)s[2]?e+=s[1].toLowerCase()+"="+s[2]:s[1]&&(e+=s[1].toLowerCase()),e+=" ",t=t.substr(s[0].length);return e.replace(/\s*$/,"")+i+">"},placeTag:function(t,e){var i=t.match(this.tabifier.newLevel);return(t.match(this.tabifier.lineBefore)||i)&&(e=e.replace(/\s*$/,""),e+="\n"),i&&"/"==t.charAt(1)&&this.tabifier.cleanlevel--,"\n"==e.charAt(e.length-1)&&(e+=this.tabifier.getTabs()),i&&"/"!=t.charAt(1)&&this.tabifier.cleanlevel++,e+=t,(t.match(this.tabifier.lineAfter)||t.match(this.tabifier.newLevel))&&(e=e.replace(/ *$/,"")),e}}},tidy:function(){return{setupAllowed:function(){var e=t.inArray("span",this.opts.removeEmpty);if(-1!==e&&this.opts.removeEmpty.splice(e,1),this.opts.allowedTags&&(this.opts.deniedTags=!1),this.opts.allowedAttr&&(this.opts.removeAttr=!1),!this.opts.linebreaks){var i=["p","section"];this.opts.allowedTags&&this.tidy.addToAllowed(i),this.opts.deniedTags&&this.tidy.removeFromDenied(i)}},addToAllowed:function(e){for(var i=e.length,s=0;i>s;s++)-1==t.inArray(e[s],this.opts.allowedTags)&&this.opts.allowedTags.push(e[s])},removeFromDenied:function(e){for(var i=e.length,s=0;i>s;s++){var r=t.inArray(e[s],this.opts.deniedTags);-1!=r&&this.opts.deniedTags.splice(r,1)}},load:function(e,i){return this.tidy.settings={deniedTags:this.opts.deniedTags,allowedTags:this.opts.allowedTags,removeComments:this.opts.removeComments,replaceTags:this.opts.replaceTags,replaceStyles:this.opts.replaceStyles,removeDataAttr:this.opts.removeDataAttr,removeAttr:this.opts.removeAttr,allowedAttr:this.opts.allowedAttr,removeWithoutAttr:this.opts.removeWithoutAttr,removeEmpty:this.opts.removeEmpty},t.extend(this.tidy.settings,i),e=this.tidy.removeComments(e),this.tidy.$div=t("<div />").append(e),this.tidy.replaceTags(),this.tidy.replaceStyles(),this.tidy.removeTags(),this.tidy.removeAttr(),this.tidy.removeEmpty(),this.tidy.removeParagraphsInLists(),this.tidy.removeDataAttr(),this.tidy.removeWithoutAttr(),e=this.tidy.$div.html(),this.tidy.$div.remove(),e},removeComments:function(t){return this.tidy.settings.removeComments?t.replace(/<!--[\s\S]*?-->/gi,""):t},replaceTags:function(e){if(!this.tidy.settings.replaceTags)return e;for(var i=this.tidy.settings.replaceTags.length,s=[],r=[],o=0;i>o;o++)r.push(this.tidy.settings.replaceTags[o][1]),s.push(this.tidy.settings.replaceTags[o][0]);t.each(s,t.proxy(function(e,i){this.tidy.$div.find(i).replaceWith(function(){return t("<"+r[e]+" />",{html:t(this).html()})})},this))},replaceStyles:function(){if(this.tidy.settings.replaceStyles){var e=this.tidy.settings.replaceStyles.length;this.tidy.$div.find("span").each(t.proxy(function(i,s){for(var r=t(s),o=r.attr("style"),n=0;e>n;n++)if(o&&o.match(new RegExp("^"+this.tidy.settings.replaceStyles[n][0],"i"))){var a=this.tidy.settings.replaceStyles[n][1];r.replaceWith(function(){var e=document.createElement(a);return t(e).append(t(this).contents())})}},this))}},removeTags:function(){!this.tidy.settings.deniedTags&&this.tidy.settings.allowedTags&&this.tidy.$div.find("*").not(this.tidy.settings.allowedTags.join(",")).each(function(e,i){""===i.innerHTML?t(i).remove():t(i).contents().unwrap()}),this.tidy.settings.deniedTags&&this.tidy.$div.find(this.tidy.settings.deniedTags.join(",")).each(function(e,i){t(i).hasClass("redactor-script-tag")||t(i).hasClass("redactor-selection-marker")||(""===i.innerHTML?t(i).remove():t(i).contents().unwrap())})},removeAttr:function(){var e;if(!this.tidy.settings.removeAttr&&this.tidy.settings.allowedAttr){var i=[],s=[];e=this.tidy.settings.allowedAttr.length;for(var r=0;e>r;r++)i.push(this.tidy.settings.allowedAttr[r][0]),s.push(this.tidy.settings.allowedAttr[r][1]);this.tidy.$div.find("*").each(t.proxy(function(e,r){var o=t(r),n=t.inArray(o[0].tagName.toLowerCase(),i),a=this.tidy.removeAttrGetRemoves(n,s,o);a&&t.each(a,function(t,e){o.removeAttr(e)})},this))}if(this.tidy.settings.removeAttr){e=this.tidy.settings.removeAttr.length;for(var r=0;e>r;r++){var o=this.tidy.settings.removeAttr[r][1];t.isArray(o)&&(o=o.join(" ")),this.tidy.$div.find(this.tidy.settings.removeAttr[r][0]).removeAttr(o)}}},removeAttrGetRemoves:function(e,i,s){var r=[];return-1==e?t.each(s[0].attributes,function(t,e){r.push(e.name)}):"*"==i[e]?r=[]:t.each(s[0].attributes,function(s,o){t.isArray(i[e])?-1==t.inArray(o.name,i[e])&&r.push(o.name):i[e]!=o.name&&r.push(o.name)}),r},removeAttrs:function(e,i){return i=new RegExp(i,"g"),e.each(function(){for(var e=t(this),s=this.attributes.length-1,r=s;r>=0;r--){var o=this.attributes[r];o&&o.specified&&o.name.search(i)>=0&&e.removeAttr(o.name)}})},removeEmpty:function(){this.tidy.settings.removeEmpty&&this.tidy.$div.find(this.tidy.settings.removeEmpty.join(",")).each(function(){var e=t(this),i=e.text();i=i.replace(/\u200B/g,""),i=i.replace(/ /gi,""),i=i.replace(/\s/g,""),""===i&&0===e.children().length&&e.remove()})},removeParagraphsInLists:function(){this.tidy.$div.find("li p").contents().unwrap()},removeDataAttr:function(){if(this.tidy.settings.removeDataAttr){var e=this.tidy.settings.removeDataAttr;t.isArray(this.tidy.settings.removeDataAttr)&&(e=this.tidy.settings.removeDataAttr.join(",")),this.tidy.removeAttrs(this.tidy.$div.find(e),"^(data-)")}},removeWithoutAttr:function(){this.tidy.settings.removeWithoutAttr&&this.tidy.$div.find(this.tidy.settings.removeWithoutAttr.join(",")).each(function(){0===this.attributes.length&&t(this).contents().unwrap()})}}},toolbar:function(){return{init:function(){return{html:{title:this.lang.get("html"),func:"code.toggle"},formatting:{title:this.lang.get("formatting"),dropdown:{p:{title:this.lang.get("paragraph"),func:"block.format"},blockquote:{title:this.lang.get("quote"),func:"block.format"},pre:{title:this.lang.get("code"),func:"block.format"},h1:{title:this.lang.get("header1"),func:"block.format"},h2:{title:this.lang.get("header2"),func:"block.format"},h3:{title:this.lang.get("header3"),func:"block.format"},h4:{title:this.lang.get("header4"),func:"block.format"},h5:{title:this.lang.get("header5"),func:"block.format"}}},bold:{title:this.lang.get("bold"),func:"inline.format"},italic:{title:this.lang.get("italic"),func:"inline.format"},deleted:{title:this.lang.get("deleted"),func:"inline.format"},underline:{title:this.lang.get("underline"),func:"inline.format"},unorderedlist:{title:"• "+this.lang.get("unorderedlist"),func:"list.toggle"},orderedlist:{title:"1. "+this.lang.get("orderedlist"),func:"list.toggle"},outdent:{title:"< "+this.lang.get("outdent"),func:"indent.decrease"},indent:{title:"> "+this.lang.get("indent"),func:"indent.increase"},image:{title:this.lang.get("image"),func:"image.show"},file:{title:this.lang.get("file"),func:"file.show"},link:{title:this.lang.get("link"),dropdown:{link:{title:this.lang.get("link_insert"),func:"link.show",observe:{element:"a",in:{title:this.lang.get("link_edit")},out:{title:this.lang.get("link_insert")}}},unlink:{title:this.lang.get("unlink"),func:"link.unlink",observe:{element:"a",out:{attr:{class:"redactor-dropdown-link-inactive","aria-disabled":!0}}}}}},alignment:{title:this.lang.get("alignment"),dropdown:{left:{title:this.lang.get("align_left"),func:"alignment.left"},center:{title:this.lang.get("align_center"),func:"alignment.center"},right:{title:this.lang.get("align_right"),func:"alignment.right"},justify:{title:this.lang.get("align_justify"),func:"alignment.justify"}}},horizontalrule:{title:this.lang.get("horizontalrule"),func:"line.insert"}}},build:function(){this.toolbar.hideButtons(),this.toolbar.hideButtonsOnMobile(),this.toolbar.isButtonSourceNeeded(),0!==this.opts.buttons.length&&(this.$toolbar=this.toolbar.createContainer(),this.toolbar.setOverflow(),this.toolbar.append(),this.toolbar.setFormattingTags(),this.toolbar.loadButtons(),this.toolbar.setFixed(),this.opts.activeButtons&&this.$editor.on("mouseup.redactor keyup.redactor focus.redactor",t.proxy(this.observe.toolbar,this)))},createContainer:function(){return t("<ul>").addClass("redactor-toolbar").attr({id:"redactor-toolbar-"+this.uuid,role:"toolbar"})},setFormattingTags:function(){t.each(this.opts.toolbar.formatting.dropdown,t.proxy(function(e){-1==t.inArray(e,this.opts.formatting)&&delete this.opts.toolbar.formatting.dropdown[e]},this))},loadButtons:function(){t.each(this.opts.buttons,t.proxy(function(e,i){if(this.opts.toolbar[i]){if("file"===i){if(this.opts.fileUpload===!1)return;if(!this.opts.fileUpload&&this.opts.s3===!1)return}if("image"===i){if(this.opts.imageUpload===!1)return;if(!this.opts.imageUpload&&this.opts.s3===!1)return}var s=this.opts.toolbar[i];this.$toolbar.append(t("<li>").append(this.button.build(i,s)))}},this))},append:function(){this.opts.toolbarExternal?(this.$toolbar.addClass("redactor-toolbar-external"),t(this.opts.toolbarExternal).html(this.$toolbar)):this.$box.prepend(this.$toolbar)},setFixed:function(){this.utils.isDesktop()&&(this.opts.toolbarExternal||this.opts.toolbarFixed&&(this.toolbar.observeScroll(),t(this.opts.toolbarFixedTarget).on("scroll.redactor."+this.uuid,t.proxy(this.toolbar.observeScroll,this))))},setOverflow:function(){this.utils.isMobile()&&this.opts.toolbarOverflow&&this.$toolbar.addClass("redactor-toolbar-overflow")},isButtonSourceNeeded:function(){if(!this.opts.source){var t=this.opts.buttons.indexOf("html");-1!==t&&this.opts.buttons.splice(t,1)}},hideButtons:function(){0!==this.opts.buttonsHide.length&&t.each(this.opts.buttonsHide,t.proxy(function(t,e){var i=this.opts.buttons.indexOf(e);this.opts.buttons.splice(i,1)},this))},hideButtonsOnMobile:function(){this.utils.isMobile()&&0!==this.opts.buttonsHideOnMobile.length&&t.each(this.opts.buttonsHideOnMobile,t.proxy(function(t,e){var i=this.opts.buttons.indexOf(e);this.opts.buttons.splice(i,1)},this))},observeScroll:function(){var e=t(this.opts.toolbarFixedTarget).scrollTop(),i=1;this.opts.toolbarFixedTarget===document&&(i=this.$box.offset().top),e+this.opts.toolbarFixedTopOffset>i?this.toolbar.observeScrollEnable(e,i):this.toolbar.observeScrollDisable()},observeScrollEnable:function(e,i){var s=this.opts.toolbarFixedTopOffset+e-i,r=0,o=i+this.$box.height()-32,n=this.$box.innerWidth();this.$toolbar.addClass("toolbar-fixed-box"),this.$toolbar.css({position:"absolute",width:n,top:s+"px",left:r}),e>o&&t(".redactor-dropdown-"+this.uuid+":visible").hide(),this.toolbar.setDropdownsFixed(),this.$toolbar.css("visibility",o>e?"visible":"hidden")},observeScrollDisable:function(){this.$toolbar.css({position:"relative",width:"auto",top:0,left:0,visibility:"visible"}),this.toolbar.unsetDropdownsFixed(),this.$toolbar.removeClass("toolbar-fixed-box")},setDropdownsFixed:function(){var e=this.$toolbar.innerHeight()+this.opts.toolbarFixedTopOffset,i="fixed";this.opts.toolbarFixedTarget!==document&&(e=this.$toolbar.innerHeight()+this.$toolbar.offset().top+this.opts.toolbarFixedTopOffset,i="absolute"),t(".redactor-dropdown-"+this.uuid).each(function(){t(this).css({position:i,top:e+"px"})})},unsetDropdownsFixed:function(){var e=this.$toolbar.innerHeight()+this.$toolbar.offset().top;t(".redactor-dropdown-"+this.uuid).each(function(){t(this).css({position:"absolute",top:e+"px"})})}}},upload:function(){return{init:function(e,i,s){this.upload.direct=!1,this.upload.callback=s,this.upload.url=i,this.upload.$el=t(e),this.upload.$droparea=t('<div id="redactor-droparea" />'),this.upload.$placeholdler=t('<div id="redactor-droparea-placeholder" />').text(this.lang.get("upload_label")),this.upload.$input=t('<input type="file" name="file" />'),this.upload.$placeholdler.append(this.upload.$input),this.upload.$droparea.append(this.upload.$placeholdler),this.upload.$el.append(this.upload.$droparea),this.upload.$droparea.off("redactor.upload"),this.upload.$input.off("redactor.upload"),this.upload.$droparea.on("dragover.redactor.upload",t.proxy(this.upload.onDrag,this)),this.upload.$droparea.on("dragleave.redactor.upload",t.proxy(this.upload.onDragLeave,this)),this.upload.$input.on("change.redactor.upload",t.proxy(function(t){t=t.originalEvent||t,this.upload.traverseFile(this.upload.$input[0].files[0],t)},this)),this.upload.$droparea.on("drop.redactor.upload",t.proxy(function(t){t.preventDefault(),this.upload.$droparea.removeClass("drag-hover").addClass("drag-drop"),this.upload.onDrop(t)},this))},directUpload:function(t,e){this.upload.direct=!0,this.upload.traverseFile(t,e)},onDrop:function(t){t=t.originalEvent||t;var e=t.dataTransfer.files;this.upload.traverseFile(e[0],t)},traverseFile:function(t,e){if(this.opts.s3)return this.upload.setConfig(t),void this.upload.s3uploadFile(t);var i=window.FormData?new FormData:null;if(window.FormData){this.upload.setConfig(t);var s="image"==this.upload.type?this.opts.imageUploadParam:this.opts.fileUploadParam;i.append(s,t)}this.progress.show(),this.core.setCallback("uploadStart",e,i),this.upload.sendData(i,e)},setConfig:function(t){this.upload.getType(t),this.upload.direct&&(this.upload.url="image"==this.upload.type?this.opts.imageUpload:this.opts.fileUpload,this.upload.callback="image"==this.upload.type?this.image.insert:this.file.insert)},getType:function(t){this.upload.type="image",-1==this.opts.imageTypes.indexOf(t.type)&&(this.upload.type="file")},getHiddenFields:function(e,i){return e===!1||"object"!=typeof e?i:(t.each(e,t.proxy(function(e,s){null!==s&&0===s.toString().indexOf("#")&&(s=t(s).val()),i.append(e,s)},this)),i)},sendData:function(e,i){"image"==this.upload.type?(e=this.upload.getHiddenFields(this.opts.uploadImageFields,e),e=this.upload.getHiddenFields(this.upload.imageFields,e)):(e=this.upload.getHiddenFields(this.opts.uploadFileFields,e),e=this.upload.getHiddenFields(this.upload.fileFields,e));var s=new XMLHttpRequest;s.open("POST",this.upload.url),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.onreadystatechange=t.proxy(function(){if(4==s.readyState){var e=s.responseText;e=e.replace(/^\[/,""),e=e.replace(/\]$/,"");var r;try{r="string"==typeof e?t.parseJSON(e):e}catch(t){r={error:!0}}this.progress.hide(),this.upload.direct||this.upload.$droparea.removeClass("drag-drop"),this.upload.callback(r,this.upload.direct,i)}},this),s.send(e)},onDrag:function(t){t.preventDefault(),this.upload.$droparea.addClass("drag-hover")},onDragLeave:function(t){t.preventDefault(),this.upload.$droparea.removeClass("drag-hover")},clearImageFields:function(){this.upload.imageFields={}},addImageFields:function(t,e){this.upload.imageFields[t]=e},removeImageFields:function(t){delete this.upload.imageFields[t]},clearFileFields:function(){this.upload.fileFields={}},addFileFields:function(t,e){this.upload.fileFields[t]=e},removeFileFields:function(t){delete this.upload.fileFields[t]},s3uploadFile:function(e){this.upload.s3executeOnSignedUrl(e,t.proxy(function(t){this.upload.s3uploadToS3(e,t)},this))},s3executeOnSignedUrl:function(t,e){var i=new XMLHttpRequest,s="-1"!==this.opts.s3.search(/\?/)?"?":"&";i.open("GET",this.opts.s3+s+"name="+t.name+"&type="+t.type,!0),i.overrideMimeType&&i.overrideMimeType("text/plain; charset=x-user-defined");var r=this;i.onreadystatechange=function(){4==this.readyState&&200==this.status?(r.progress.show(),e(decodeURIComponent(this.responseText))):4==this.readyState&&200!=this.status},i.send()},s3createCORSRequest:function(t,e){var i=new XMLHttpRequest;return"withCredentials"in i?i.open(t,e,!0):"undefined"!=typeof XDomainRequest?(i=new XDomainRequest,i.open(t,e)):i=null,i},s3uploadToS3:function(e,i){var s=this.upload.s3createCORSRequest("PUT",i);s&&(s.onload=t.proxy(function(){if(200==s.status){this.progress.hide();var t=i.split("?");if(!t[0])return!1;this.upload.direct||this.upload.$droparea.removeClass("drag-drop");var e={filelink:t[0]};if("file"==this.upload.type){var r=t[0].split("/");e.filename=r[r.length-1]}this.upload.callback(e,this.upload.direct,!1)}},this),s.onerror=function(){},s.upload.onprogress=function(){},s.setRequestHeader("Content-Type",e.type),s.setRequestHeader("x-amz-acl","public-read"),s.send(e))}}},utils:function(){return{isMobile:function(){return/(iPhone|iPod|BlackBerry|Android)/.test(navigator.userAgent)},isDesktop:function(){return!/(iPhone|iPod|iPad|BlackBerry|Android)/.test(navigator.userAgent)},isString:function(t){return"[object String]"==Object.prototype.toString.call(t)},isEmpty:function(e,i){return e=e.replace(/[\u200B-\u200D\uFEFF]/g,""),e=e.replace(/ /gi,""),e=e.replace(/<\/?br\s?\/?>/g,""),e=e.replace(/\s/g,""),e=e.replace(/^<p>[^\W\w\D\d]*?<\/p>$/i,""),e=e.replace(/<iframe(.*?[^>])>$/i,"iframe"),e=e.replace(/<source(.*?[^>])>$/i,"source"),i!==!1&&(e=e.replace(/<[^\/>][^>]*><\/[^>]+>/gi,""),e=e.replace(/<[^\/>][^>]*><\/[^>]+>/gi,"")),e=t.trim(e),""===e},normalize:function(t){return"undefined"==typeof t?0:parseInt(t.replace("px",""),10)},hexToRgb:function(t){if("undefined"!=typeof t){if(-1==t.search(/^#/))return t;var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,i,s){return e+e+i+i+s+s});var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return"rgb("+parseInt(i[1],16)+", "+parseInt(i[2],16)+", "+parseInt(i[3],16)+")"}},getOuterHtml:function(e){return t("<div>").append(t(e).eq(0).clone()).html()},getAlignmentElement:function(e){return-1!==t.inArray(e.tagName,this.opts.alignmentTags)?t(e):t(e).closest(this.opts.alignmentTags.toString().toLowerCase(),this.$editor[0])},removeEmptyAttr:function(e,i){var s=t(e);return"undefined"==typeof s.attr(i)?!0:""===s.attr(i)?(s.removeAttr(i),!0):!1},removeEmpty:function(e,i){var s=t(t.parseHTML(i));if(s.find(".redactor-invisible-space").removeAttr("style").removeAttr("class"),0===s.find("hr, br, img, iframe, source").length){var r=t.trim(s.text());this.utils.isEmpty(r,!1)&&s.remove()}},saveScroll:function(){this.saveEditorScroll=this.$editor.scrollTop(),this.saveBodyScroll=t(window).scrollTop(),this.opts.scrollTarget&&(this.saveTargetScroll=t(this.opts.scrollTarget).scrollTop())},restoreScroll:function(){("undefined"!=typeof this.saveScroll||"undefined"!=typeof this.saveBodyScroll)&&(t(window).scrollTop(this.saveBodyScroll),this.$editor.scrollTop(this.saveEditorScroll),this.opts.scrollTarget&&t(this.opts.scrollTarget).scrollTop(this.saveTargetScroll))},createSpaceElement:function(){var t=document.createElement("span");return t.className="redactor-invisible-space",t.innerHTML=this.opts.invisibleSpace,t},removeInlineTags:function(e){var i=this.opts.inlineTags;i.push("span"),"PRE"==e.tagName&&i.push("a"),t(e).find(i.join(",")).not("span.redactor-selection-marker").contents().unwrap()},replaceWithContents:function(e,i){var s=this;return t(e).replaceWith(function(){return i===!0&&s.utils.removeInlineTags(this),t(this).contents()}),t(e)},replaceToTag:function(e,i,s){var r,o=this;return t(e).replaceWith(function(){r=t("<"+i+" />").append(t(this).contents());for(var e=0;e<this.attributes.length;e++)r.attr(this.attributes[e].name,this.attributes[e].value);return s===!0&&o.utils.removeInlineTags(r),r}),r},isStartOfElement:function(){var t=this.selection.getBlock();if(!t)return!1;var e=this.caret.getOffsetOfElement(t);return 0===e?!0:!1},isEndOfElement:function(e){if("undefined"==typeof e){var e=this.selection.getBlock();if(!e)return!1}var i=this.caret.getOffsetOfElement(e),s=t.trim(t(e).text()).replace(/\n\r\n/g,"");return i==s.length?!0:!1},isStartOfEditor:function(){var t=this.caret.getOffsetOfElement(this.$editor[0]);return 0===t?!0:!1},isEndOfEditor:function(){var e=this.$editor[0],i=this.caret.getOffsetOfElement(e),s=t.trim(t(e).html().replace(/(<([^>]+)>)/gi,""));return i==s.length?!0:!1},isBlock:function(t){return t=t[0]||t,t&&this.utils.isBlockTag(t.tagName)},isBlockTag:function(t){return"undefined"==typeof t?!1:this.reIsBlock.test(t)},isTag:function(e,i){var s=t(e).closest(i,this.$editor[0]);return 1==s.length?s[0]:!1},isSelectAll:function(){return this.selectAll},enableSelectAll:function(){this.selectAll=!0},disableSelectAll:function(){this.selectAll=!1},isRedactorParent:function(e){return e?0===t(e).parents(".redactor-editor").length||t(e).hasClass("redactor-editor")?!1:e:!1},isCurrentOrParentHeader:function(){return this.utils.isCurrentOrParent(["H1","H2","H3","H4","H5","H6"])},isCurrentOrParent:function(e){var i=this.selection.getParent(),s=this.selection.getCurrent();if(t.isArray(e)){var r=0;return t.each(e,t.proxy(function(t,e){this.utils.isCurrentOrParentOne(s,i,e)&&r++},this)),0===r?!1:!0}return this.utils.isCurrentOrParentOne(s,i,e)},isCurrentOrParentOne:function(t,e,i){return i=i.toUpperCase(),e&&e.tagName===i?e:t&&t.tagName===i?t:!1},isOldIe:function(){return this.utils.browser("msie")&&parseInt(this.utils.browser("version"),10)<9?!0:!1},isLessIe10:function(){return this.utils.browser("msie")&&parseInt(this.utils.browser("version"),10)<10?!0:!1},isIe11:function(){return!!navigator.userAgent.match(/Trident\/7\./)},browser:function(t){var e=navigator.userAgent.toLowerCase(),i=/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return"safari"==t?"undefined"!=typeof i[3]?"safari"==i[3]:!1:"version"==t?i[2]:"webkit"==t?"chrome"==i[1]||"opr"==i[1]||"webkit"==i[1]:"rv"==i[1]?"msie"==t:"opr"==i[1]?"webkit"==t:t==i[1]},strpos:function(t,e,i){var s=t.indexOf(e,i);return s>=0?s:!1},disableBodyScroll:function(){var e=t("html"),i=window.innerWidth;if(!i){var s=document.documentElement.getBoundingClientRect();i=s.right-Math.abs(s.left)}var r=document.body.clientWidth<i,o=this.utils.measureScrollbar();e.css("overflow","hidden"),r&&e.css("padding-right",o)},measureScrollbar:function(){var e=t("body"),i=document.createElement("div");i.className="redactor-scrollbar-measure",e.append(i);var s=i.offsetWidth-i.clientWidth;return e[0].removeChild(i),s},enableBodyScroll:function(){t("html").css({overflow:"","padding-right":""}),t("body").remove("redactor-scrollbar-measure")}}}},t(window).on("load.tools.redactor",function(){t('[data-tools="redactor"]').redactor()}),e.prototype.init.prototype=e.prototype}(jQuery);
\ No newline at end of file