if(void 0===CodeMirror)var CodeMirror=void 0;if(void 0===jQuery)var jQuery=void 0;!function(){var s={settings:{},post:function(t){return new n("post",t)},get:function(t){return new n("get",t)},request:function(t,e){return new n(t,e)}},n=function(t,e){var i={method:t,url:"",before:function(){},success:function(){},error:function(){},data:!1,async:!0,headers:{}};this.p=this.extend(i,e),this.p=this.extend(this.p,s.settings),this.p.method=this.p.method.toUpperCase(),this.prepareData(),this.xhr=new XMLHttpRequest,this.xhr.open(this.p.method,this.p.url,this.p.async),this.setHeaders(),!1!==("function"!=typeof this.p.before||this.p.before(this.xhr))&&this.send()};n.prototype={extend:function(t,e){if(e)for(var i in e)t[i]=e[i];return t},prepareData:function(){-1===["POST","PUT"].indexOf(this.p.method)||this.isFormData()||(this.p.headers["Content-Type"]="application/x-www-form-urlencoded"),"object"!=typeof this.p.data||this.isFormData()||(this.p.data=this.toParams(this.p.data)),"GET"===this.p.method&&(this.p.url=this.p.data?this.p.url+"?"+this.p.data:this.p.url)},setHeaders:function(){for(var t in this.xhr.setRequestHeader("X-Requested-With",this.p.headers["X-Requested-With"]||"XMLHttpRequest"),this.p.headers)this.xhr.setRequestHeader(t,this.p.headers[t])},isFormData:function(){return void 0!==window.FormData&&this.p.data instanceof window.FormData},isComplete:function(){return!(this.xhr.status<200||300<=this.xhr.status&&304!==this.xhr.status)},send:function(){this.p.async?(this.xhr.onload=this.loaded.bind(this),this.xhr.send(this.p.data)):(this.xhr.send(this.p.data),this.loaded.call(this))},loaded:function(){if(this.isComplete()){var t=this.parseResponse();"function"==typeof this.p.success&&this.p.success(t,this.xhr)}else{t=this.parseResponse();"function"==typeof this.p.error&&this.p.error(t,this.xhr,this.xhr.status)}},parseResponse:function(){var t=this.xhr.response,e=this.parseJson(t);return e||t},parseJson:function(t){try{var e=JSON.parse(t);if(e&&"object"==typeof e)return e}catch(t){}return!1},toParams:function(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")}};function c(t,e){return this.parse(t,e)}var r=[0],o="data"+(new Date).getTime(),a="is-hidden",l="is-hidden-mobile";c.ready=function(t){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)},c.prototype={get sdom(){return!0},get length(){return this.nodes.length},parse:function(t,e){var i;if(t){if(t.sdom)return this.nodes=t.nodes,t;i="string"!=typeof t?t.nodeType&&11===t.nodeType?t.childNodes:t.nodeType||t===window?[t]:t:/^\s*<(\w+|!)[^>]*>/.test(t)?this.create(t):this._query(t,e)}else i=[];this.nodes=this._slice(i)},create:function(t){if(/^<(\w+)\s*\/?>(?:<\/\1>|)$/.test(t))return[document.createElement(RegExp.$1)];var e=[],i=document.createElement("div"),s=i.childNodes;i.innerHTML=t;for(var n=0,r=s.length;n
",markerChar:"\ufeff",imageTypes:["image/png","image/jpeg","image/gif"],imageAttrs:["alt","title","src","class","width","height","srcset"],inlineTags:["a","span","strong","strike","b","u","em","i","code","del","ins","samp","kbd","sup","sub","mark","var","cite","small","abbr"],blockTags:["pre","ul","ol","li","p","h1","h2","h3","h4","h5","h6","dl","dt","dd","div","table","tbody","thead","tfoot","tr","th","td","blockquote","output","figcaption","figure","address","section","header","footer","aside","article","iframe"],regex:{youtube:/^https?\:\/\/(?:www\.youtube(?:\-nocookie)?\.com\/|m\.youtube\.com\/|youtube\.com\/)?(?:ytscreeningroom\?vi?=|youtu\.be\/|vi?\/|user\/.+\/u\/\w{1,2}\/|embed\/|watch\?(?:.*\&)?vi?=|\&vi?=|\?(?:.*\&)?vi?=)([^#\&\?\n\/<>"']*)/gi,vimeo:/(http|https)?:\/\/(?:www.|player.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:\/[a-zA-Z0-9_-]+)?/gi,imageurl:/((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/gi,url:/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z\u00F0-\u02AF0-9()!@:%_+.~#?&//=]*)/gi,aurl1:/(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim,aurl2:/(^|[^\/])(www\.[\S]+(\b|$))/gim},input:!0,zindex:!1,modes:{inline:{pastePlainText:!0,pasteImages:!1,enterKey:!1,toolbar:!1,autoparse:!1,source:!1,showSource:!1,styles:!1,air:!1},original:{styles:!1}}},y.lang.en={format:"Format",image:"Image",file:"File",link:"Link",bold:"Bold",italic:"Italic",deleted:"Strikethrough",underline:"Underline",superscript:"Superscript",subscript:"Subscript","bold-abbr":"B","italic-abbr":"I","deleted-abbr":"S","underline-abbr":"U","superscript-abbr":"Sup","subscript-abbr":"Sub",lists:"Lists","link-insert":"Insert Link","link-edit":"Edit Link","link-in-new-tab":"Open link in new tab",unlink:"Unlink",cancel:"Cancel",close:"Close",insert:"Insert",save:"Save",delete:"Delete",text:"Text",edit:"Edit",title:"Alt",paragraph:"Normal text",quote:"Quote",code:"Code",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",filename:"Name",optional:"optional",unorderedlist:"Unordered List",orderedlist:"Ordered List",outdent:"Outdent",indent:"Indent",horizontalrule:"Line",upload:"Upload","upload-label":"Drop files here or click to upload","accessibility-help-label":"Rich text editor",caption:"Caption",bulletslist:"Bullets",numberslist:"Numbers","image-position":"Position",none:"None",left:"Left",right:"Right",center:"Center",undo:"Undo",redo:"Redo"},y.buttons={html:{title:"HTML",icon:!0,api:"module.source.toggle"},undo:{title:"## undo ##",icon:!0,api:"module.buffer.undo"},redo:{title:"## redo ##",icon:!0,api:"module.buffer.redo"},format:{title:"## format ##",icon:!0,dropdown:{p:{title:"## paragraph ##",api:"module.block.format",args:{tag:"p"}},blockquote:{title:"## quote ##",api:"module.block.format",args:{tag:"blockquote"}},pre:{title:"## code ##",api:"module.block.format",args:{tag:"pre"}},h1:{title:"## heading1 ##",api:"module.block.format",args:{tag:"h1"}},h2:{title:"## heading2 ##",api:"module.block.format",args:{tag:"h2"}},h3:{title:"## heading3 ##",api:"module.block.format",args:{tag:"h3"}},h4:{title:"## heading4 ##",api:"module.block.format",args:{tag:"h4"}},h5:{title:"## heading5 ##",api:"module.block.format",args:{tag:"h5"}},h6:{title:"## heading6 ##",api:"module.block.format",args:{tag:"h6"}}}},bold:{title:"## bold-abbr ##",icon:!0,tooltip:"## bold ##",api:"module.inline.format",args:{tag:"b"}},italic:{title:"## italic-abbr ##",icon:!0,tooltip:"## italic ##",api:"module.inline.format",args:{tag:"i"}},deleted:{title:"## deleted-abbr ##",icon:!0,tooltip:"## deleted ##",api:"module.inline.format",args:{tag:"del"}},underline:{title:"## underline-abbr ##",icon:!0,tooltip:"## underline ##",api:"module.inline.format",args:{tag:"u"}},sup:{title:"## superscript-abbr ##",icon:!0,tooltip:"## superscript ##",api:"module.inline.format",args:{tag:"sup"}},sub:{title:"## subscript-abbr ##",icon:!0,tooltip:"## subscript ##",api:"module.inline.format",args:{tag:"sub"}},lists:{title:"## lists ##",icon:!0,observe:"list",dropdown:{observe:"list",unorderedlist:{title:"• ## unorderedlist ##",api:"module.list.toggle",args:"ul"},orderedlist:{title:"1. ## orderedlist ##",api:"module.list.toggle",args:"ol"},outdent:{title:"< ## outdent ##",api:"module.list.outdent"},indent:{title:"> ## indent ##",api:"module.list.indent"}}},ul:{title:"• ## bulletslist ##",icon:!0,api:"module.list.toggle",observe:"list",args:"ul"},ol:{title:"1. ## numberslist ##",icon:!0,api:"module.list.toggle",observe:"list",args:"ol"},outdent:{title:"## outdent ##",icon:!0,api:"module.list.outdent",observe:"list"},indent:{title:"## indent ##",icon:!0,api:"module.list.indent",observe:"list"},image:{title:"## image ##",icon:!0,api:"module.image.open"},file:{title:"## file ##",icon:!0,api:"module.file.open"},link:{title:"## link ##",icon:!0,observe:"link",dropdown:{observe:"link",link:{title:"## link-insert ##",api:"module.link.open"},unlink:{title:"## unlink ##",api:"module.link.unlink"}}},line:{title:"## horizontalrule ##",icon:!0,api:"module.line.insert"}};var f=function(t,e,i){this.module={},this.plugin={},this.instances={},this.started=!1,this.stopped=!1,this.uuid=i,this.rootElement=t,this.rootOpts=e,this.dragInside=!1,this.dragComponentInside=!1,this.keycodes=y.keycodes,this.namespace="redactor",this.$win=y.dom(window),this.$doc=y.dom(document),this.$body=y.dom("body"),this.editorReadOnly=!1,this.opts=y.create("service.options",e,t),this.lang=y.create("service.lang",this),this.buildServices(),this.buildModules(),this.buildPlugins(),this.start()};f.prototype={start:function(){this.stopped=!1,this.broadcast("start"),this.broadcast("startcode"),this.opts.clickToEdit?this.broadcast("startclicktoedit"):(this.broadcast("enable"),this.opts.showSource&&this.broadcast("startcodeshow"),this.broadcast("enablefocus")),this.broadcast("started"),this.started=!0},stop:function(){this.started=!1,this.stopped=!0,this.broadcast("stop"),this.broadcast("disable"),this.broadcast("stopped")},isStarted:function(){return this.started},isStopped:function(){return this.stopped},buildServices:function(){var t=["options","lang"],e=["uuid","keycodes","opts","lang","$win","$doc","$body"],i=[];for(var s in y.services)-1===t.indexOf(s)&&(this[s]=y.create("service."+s,this),i.push(s),e.push(s));for(var n=0;nr.height)}),y.add("service","selection",{init:function(t){this.app=t},is:function(){var t=this.get();if(t){var e=t.anchorNode;return 0!==y.dom(e).closest(".redactor-in-"+this.uuid).length||e===this.editor.getElement().get()}return!1},isCollapsed:function(){var t=this.get(),e=this.getRange();return!(!t||!t.isCollapsed)||!(!e||0!==e.toString().length)},isBackwards:function(){var t=!1,e=this.get();if(e&&!e.isCollapsed){var i=document.createRange();i.setStart(e.anchorNode,e.anchorOffset),i.setEnd(e.focusNode,e.focusOffset),t=i.collapsed,i.detach()}return t},isIn:function(t){var e=y.dom(t).get(),i=this.getCurrent();return!(!i||!e)&&e.contains(i)},isText:function(){var t=this.get();if(t){var e=t.anchorNode,i=this.getBlock(e),s=this.getBlocks();if(i&&this.inspector.isTableCellTag(i.tagName)||!1===i&&0===s.length)return!0}return!1},isAll:function(t){var e=this.utils.getNode(t);if(!e)return!1;var i=this.editor.isEditor(e),s=this.inspector.parse(e);if(!s.isFigcaption()&&this.component.isNonEditable(e)&&this.component.isActive(e))return!0;if(i){var n=this.editor.getElement().html().replace(/<\/p>$/i,"");if(this.getHtml(!1).length!==n.length)return!1}if(i&&this.editor.isEmpty()||this.isCollapsed())return!1;var r=this.offset.get(e,!0),o=this.offset.size(e,!0);return!i&&s.isComponentType("code")&&(o=this.getText().trim().length),!(!r||0!==r.start||r.end!==o)},hasNonEditable:function(){var t=this.getHtml(),e=y.dom("
").html(t);return!this.isCollapsed()&&0!==e.find(".non-editable").length},setRange:function(t){var e=window.getSelection();e.removeAllRanges(),e.addRange(t)},setAll:function(t){var e=this.utils.getNode(t);if(e){var i=this.inspector.parse(e);if(this.component.clearActive(),this.editor.focus(),this.editor.saveScroll(),this.editor.disableNonEditables(),e&&"TABLE"===e.tagName){var s=i.findFirstNode("td, th"),n=i.findLastNode("td, th");y.dom(s).prepend(this.marker.build("start")),y.dom(n).append(this.marker.build("end")),this.restoreMarkers()}else if(!i.isFigcaption()&&this.component.isNonEditable(e))this.component.setActive(e);else{i.isComponentType("code")&&(e=i.getComponentCodeElement()).focus();var r=document.createRange();r.selectNodeContents(e),this.setRange(r)}this.editor.enableNonEditables(),this.editor.restoreScroll()}},get:function(){var t=window.getSelection();return 0
<\/p>$/i,"")}return e},clear:function(){this.component.clearActive(),this.get().removeAllRanges()},collapseToStart:function(){var t=this.get();t&&!t.isCollapsed&&t.collapseToStart()},collapseToEnd:function(){var t=this.get();t&&!t.isCollapsed&&t.collapseToEnd()},saveActiveComponent:function(){var t=this.component.getActive();return!!t&&(this.savedComponent=t,!0)},restoreActiveComponent:function(){return!!this.savedComponent&&(this.component.setActive(this.savedComponent),!0)},save:function(){this._clearSaved();var t=this.getElement();!t||-1===["TD","TH","P","DIV","PRE","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE"].indexOf(t.tagName)||""!==t.innerHTML&&"
"!==t.innerHTML?this.saveActiveComponent()||(this.saved=this.offset.get()):this.savedElement=t},restore:function(){(this.saved||this.savedComponent||this.savedElement)&&(this.editor.saveScroll(),this.savedElement?this.caret.setStart(this.savedElement):this.restoreActiveComponent()||this.offset.set(this.saved),this._clearSaved(),this.editor.restoreScroll())},saveMarkers:function(){this._clearSaved(),this.saveActiveComponent()||this.marker.insert()},restoreMarkers:function(){this.editor.saveScroll(),this.restoreActiveComponent()||this.marker.restore(),this._clearSaved(),this.editor.restoreScroll()},_getNextNode:function(t){if(t.hasChildNodes())return t.firstChild;for(;t&&!t.nextSibling;)t=t.parentNode;return t?t.nextSibling:null},_getNodesComponent:function(t){var e=this.getCurrent(),i=this.inspector.parse(e);return i.isFigcaption()?[i.getFigcaption()]:[t]},_getRangeSelectedNodes:function(){var t=[],e=this.getRange(),i=e.startContainer,s=e.startContainer,n=e.endContainer,r=this.editor.getElement();if(s===r.get()&&this.isAll())t=this.utils.getChildNodes(r);else if(i===n)t=[i];else{for(;i&&i!==n;)t.push(i=this._getNextNode(i));for(i=e.startContainer;i&&i!==e.commonAncestorContainer;)t.unshift(i),i=i.parentNode}return t},_isInNodesArray:function(t,e){return-1!==t.indexOf(e)},_filterEditor:function(t){for(var e=[],i=0;i":t.get();this.$editor=y.dom(e)},_getScrollTarget:function(){var t=this.$doc;return t=this.opts.toolbarFixedTarget!==document?y.dom(this.opts.toolbarFixedTarget):this.opts.scrollTarget?y.dom(this.opts.scrollTarget):t},_isContenteditableFocus:function(){var t=this.selection.getBlock();return 0!==(t?y.dom(t).closest("[contenteditable=true]").not(".redactor-in"):[]).length}}),y.add("service","container",{init:function(t){this.app=t},start:function(){this._build()},getElement:function(){return this.$container},_build:function(){var t=this.element.isType("inline")?"":"";this.$container=y.dom(t)}}),y.add("service","source",{init:function(t){this.app=t,this.$source={},this.content=""},start:function(){this._build(),this._buildName(),this._buildStartedContent()},getElement:function(){return this.$source},getCode:function(){return this.$source.val()},getName:function(){return this.$source.attr("name")},getStartedContent:function(){return this.content},setCode:function(t){return this.insertion.set(t,!0,!1)},isNameGenerated:function(){return this.name},rebuildStartedContent:function(){this._buildStartedContent()},_build:function(){var t=this.element.getElement(),e=this.element.isType("textarea")?t.get():"