/*! * Sir Trevor JS v0.7.5 * * Released under the MIT license * www.opensource.org/licenses/MIT * * 2019-03-04 */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SirTrevor=e():t.SirTrevor=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=93)}([function(t,e,r){"use strict";e.isEmpty=r(119),e.isFunction=r(27),e.isObject=r(17),e.isString=r(129),e.isUndefined=r(130),e.result=r(131),e.template=r(132),e.uniqueId=r(139)},function(t,e,r){"use strict";var n={html:['
<%= i18n.t("general:drop", { block: "" + _.result(block, "title") + "" }) %>',"
"+a),a=a.replace(/\[([^\]]+)\]\(([^\)]+)\)/gm,function(t,e,r){return""+e.replace(/\n/g,"")+""}),a=(a=i.reverse(i.reverse(a).replace(/_(?!\\)((_\\|[^_])*)_(?=$|[^\\])/gm,function(t,e){return">i/<"+e.replace(/\n/g,"").replace(/[\s]+$/,"")+">i<"}).replace(/\*\*(?!\\)((\*\*\\|[^\*\*])*)\*\*(?=$|[^\\])/gm,function(t,e){return">b/<"+e.replace(/\n/g,"").replace(/[\s]+$/,"")+">b<"}))).replace(/^\> (.+)$/gm,"$1"),s.hasOwnProperty(e)&&(o=s[e],!n.isUndefined(o.prototype.toHTML)&&n.isFunction(o.prototype.toHTML)&&(a=o.prototype.toHTML(a))),u&&(a=(a=a.replace(/\n\s*\n/gm,"
")).replace(/\n/gm,"
")),a=(a=a.replace(/\t/g," ").replace(/\n/g,"
").replace(/\*\*/,"").replace(/__/,"")).replace(/\\\*/g,"*").replace(/\\\[/g,"[").replace(/\\\]/g,"]").replace(/\\\_/g,"_").replace(/\\\(/g,"(").replace(/\\\)/g,")").replace(/\\\-/g,"-"),u&&(a+="
"+this._plainTextFormatterFactory.format(t)+"
")},p.prototype.insertHTML=function(t){if(t=this._htmlFormatterFactory.format(t),Object.hasOwnProperty.call(window,"ActiveXObject")&&!window.ActiveXObject){var e=document.createElement("span");if(e.innerHTML=t,1===e.children.length&&"P"===e.children[0].tagName&&(t=e.children[0].innerHTML),""===this.getTextContent().trim())this.setContent(t);else{var r=document.getSelection().getRangeAt(0),n=document.createElement("span");r.surroundContents(n),n.innerHTML=t,r.collapse(!1),c.removeChromeArtifacts(this.el)}}else this.getCommand("insertHTML").execute(t)},p.prototype.isDebugModeEnabled=function(){return this.options.debug},p.prototype.registerHTMLFormatter=function(t,e){this._htmlFormatterFactory.formatters[t]=this._htmlFormatterFactory.formatters[t].push(e)},p.prototype.registerPlainTextFormatter=function(t){this._plainTextFormatterFactory.formatters=this._plainTextFormatterFactory.formatters.push(t)},p.prototype.destroy=function(t){this.trigger(h.destroy)},d.prototype.format=function(t){return this.formatters.reduce(function(t,e){return e(t)},t)},y.prototype=Object.create(d.prototype),y.prototype.constructor=y,y.prototype.format=function(t){return this.formatters.sanitize.concat(this.formatters.normalize).reduce(function(t,e){return e(t)},t)},y.prototype.formatForExport=function(t){return this.formatters.export.reduce(function(t,e){return e(t)},t)},p}.apply(e,n))||(t.exports=i)},function(t,e,r){var n,i;n=[r(154),r(155),r(156),r(159)],void 0===(i=function(t,e,r,n){"use strict";return{setRootPElement:t,enforcePElements:e,ensureSelectableContainers:r,inlineElementsMode:n}}.apply(e,n))||(t.exports=i)},function(t,e,r){var n;void 0===(n=function(){"use strict";return function(){return function(t){""===t.getHTML().trim()&&(window.navigator.userAgent.match(/MSIE 10/)?t.setContent(""):t.setContent("").replace(/\n/g," <%= text %>
")})}}}.call(e,r,e,t))||(t.exports=n)},function(t,e,r){var n,i;n=[r(193),r(194),r(195),r(196)],void 0===(i=function(t,e,r,n){"use strict";return function(i){i=e.init(i);return function(e){var o=new e.api.Command("createLink");o.nodeName="A",o.execute=function(o){var s,a=new e.api.Selection,u=a.range,c=a.getContaining(function(t){return t.nodeName===this.nodeName}.bind(this)),f=c?c.href:"";if(s=o||window.prompt("Enter a link.",f),s=n.run(i.transforms.pre,s),t.emptyLink(s)){if(i&&i.validation){var l=i.validation(s);if(!l.valid)return void window.alert(l.message||"The link is not valid")}c&&(u.selectNode(c),a.selection.removeAllRanges(),a.selection.addRange(u)),s&&(t.hasKnownProtocol(s)||(s=r.process(window,s)),s=n.run(i.transforms.post,s),e.api.SimpleCommand.prototype.execute.call(this,s))}else window.alert("This link appears empty")},o.queryState=function(){return!!(new e.api.Selection).getContaining(function(t){return t.nodeName===this.nodeName}.bind(this))},e.commands.linkPrompt=o}}}.apply(e,n))||(t.exports=i)},function(t,e,r){var n;void 0===(n=function(){"use strict";var t=[/^https?\:\/\//,/^mailto\:/,/^tel\:/];return{emptyLink:function(t){return/\w/.test(t)},hasKnownProtocol:function(e){return t.some(function(t){return t.test(e)})}}}.apply(e,[]))||(t.exports=n)},function(t,e,r){var n;void 0===(n=function(){return{init:function(t){return(t=t||{}).transforms||(t.transforms={}),["pre","post"].forEach(function(e){t.transforms[e]||(t.transforms[e]=[])}),t}}}.apply(e,[]))||(t.exports=n)},function(t,e,r){(function(r){var n;void 0===(n=function(){var t=[{regexp:/@/,message:"The URL you entered appears to be an email address. Do you want to add the required “mailto:” prefix?",action:function(t){return"mailto:"+t}},{regexp:/\+?\d+/,message:"The URL you entered appears to be a telephone number. Do you want to add the required “tel:” prefix?",action:function(t){return"tel:"+t}},{regexp:/.+/,message:"The URL you entered appears to be a link. Do you want to add the required “http://” prefix?",action:function(t){return"http://"+t}}];return{process:function(e,r){for(var n=0;n',listItemEditorHTML:'
"===(t=t||"").trim()&&(t="");var r=this.newTextEditor(this.listItemEditorHTML,t);if(e&&this.ul.lastchild!==e.node){var n=e.node.nextSibling;this.ul.insertBefore(r.node,n);var i=this.editorIds.indexOf(e.id)+1;this.editorIds.splice(i,0,r.id)}else this.ul.appendChild(r.node),this.editorIds.push(r.id);this.focusOn(r)},focus:function(){var t=this.getCurrentTextEditor();t||(t=this.getTextEditor(this.editorIds[0])),this.focusOn(t)},focusOnNeighbor:function(t){var e=this.previousListItem()||this.nextListItem();e&&this.focusOn(e)},focusOn:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.scribe,o=new i.api.Selection,s=i.el.lastChild;if(o.range&&(e=o.range.cloneRange()),t.el.focus(),e&&(e.setStartAfter(s,1),e.collapse(!1)),r&&r.focusAtEnd){var u=a(i);u>0&&n(i.el,{start:u})}r&&r.caretPosition&&n(i.el,{start:r.caretPosition})},focusAtEnd:function(){var t=this.editorIds[this.editorIds.length-1];this.appendToTextEditor(t)},removeCurrentListItem:function(){if(1!==this.editorIds.length){var t=this.getCurrentTextEditor(),e=this.editorIds.indexOf(t.id);this.focusOnNeighbor(t),this.editorIds.splice(e,1),this.ul.removeChild(t.node),this.removeTextEditor(t.id)}},appendToCurrentItem:function(t){this.appendToTextEditor(this.getCurrentTextEditor().id,t)},isLastListItem:function(){return 1===this.editorIds.length},nextListItem:function(){var t=this.editorIds.indexOf(this.getCurrentTextEditor().id),e=this.editorIds[t+1];return void 0!==e?this.getTextEditor(e):null},previousListItem:function(){var t=this.editorIds.indexOf(this.getCurrentTextEditor().id),e=this.editorIds[t-1];return void 0!==e?this.getTextEditor(e):null}})},function(t,e,r){"use strict";r(13);var n=r(38),i=(n.getTotalLength,n.isAtStart),o=n.isAtEnd,s=n.selectToEnd;t.exports=function(t){return function(e){e.el.addEventListener("keydown",function(r){var n,a,u;if(!t.supressKeyListeners)if("Enter"!==r.key||r.shiftKey){if(["Left","ArrowLeft","Up","ArrowUp"].indexOf(r.key)>-1&&i(e)){r.preventDefault();var c=t.previousListItem();c?t.focusOn(c,{focusAtEnd:!0}):t.mediator.trigger("block:focusPrevious",t.blockID)}else if(["Right","ArrowRight","Down","ArrowDown"].indexOf(r.key)>-1&&o(e)){r.preventDefault();var f=t.nextListItem();f?t.focusOn(f):t.mediator.trigger("block:focusNext",t.blockID)}else if("Backspace"===r.key&&i(e))if(r.preventDefault(),t.previousListItem())n=e.getContent(),t.removeCurrentListItem(),t.appendToCurrentItem(n);else{var l={format:"html",text:e.getContent()};t.removeCurrentListItem(),t.mediator.trigger("block:createBefore","Text",l,t,{autoFocus:!0}),t.isLastListItem()&&t.mediator.trigger("block:remove",t.blockID)}}else if(r.preventDefault(),0===e.getTextContent().length){var h=t.nextListItem();if(h){var p={format:"html",listItems:[]};for(t.removeCurrentListItem(),t.focusOn(h);h;)p.listItems.push({content:h.scribe.getContent()}),t.focusOn(h),t.removeCurrentListItem(),h=t.nextListItem();t.mediator.trigger("block:create","List",p,t.el,{autoFocus:!0}),t.mediator.trigger("block:create","Text",null,t.el,{autoFocus:!0})}else t.removeCurrentListItem(),t.mediator.trigger("block:create","Text",null,t.el,{autoFocus:!0})}else a=s(e),(u=document.createElement("div")).appendChild(a.extractContents()),n=u.innerHTML,t.addListItemAfterCurrent(n)})}}},function(t,e,r){"use strict";var n=r(0),i=r(2),o=r(3),s=r(8),a=n.template(["","
"].join("\n"));t.exports=s.extend({type:"tweet",icon_name:"tweet",droppable:!0,pastable:!0,fetchable:!0,drop_options:{re_render_on_reorder:!0},fetchUrl:function(t){return"/tweets/?tweet_id="+t},loadData:function(t){n.isUndefined(t.status_url)&&(t.status_url="");var e=this.inner.querySelector("twitterwidget");o.remove(e),this.inner.insertAdjacentHTML("afterbegin",a(t));var r=o.createElement("script",{src:"//platform.twitter.com/widgets.js"});this.inner.appendChild(r)},onContentPasted:function(t){var e=t.target.value;this.handleTwitterDropPaste(e)},handleTwitterDropPaste:function(t){if(this.validTweetUrl(t)){var e=t.match(/[^\/]+$/);n.isEmpty(e)||(this.loading(),e=e[0],this.fetch(this.fetchUrl(e),{dataType:"json"},this.onTweetSuccess,this.onTweetFail))}else i.log("Invalid Tweet URL")},validTweetUrl:function(t){return i.isURI(t)&&-1!==t.indexOf("twitter")&&-1!==t.indexOf("status")},onTweetSuccess:function(t){var e={user:{profile_image_url:t.user.profile_image_url,profile_image_url_https:t.user.profile_image_url_https,screen_name:t.user.screen_name,name:t.user.name},id:t.id_str,text:t.text,created_at:t.created_at,entities:t.entities,status_url:"https://twitter.com/"+t.user.screen_name+"/status/"+t.id_str};this.setAndLoadData(e),this.ready()},onTweetFail:function(){this.addMessage(i18n.t("blocks:tweet:fetch_error")),this.ready()},onDrop:function(t){var e=t.getData("text/plain");this.handleTwitterDropPaste(e)}})},function(t,e,r){"use strict";var n=r(0),i=r(2),o=r(8);t.exports=o.extend({providers:{vimeo:{regex:/(?:http[s]?:\/\/)?(?:www.)?vimeo\.co(?:.+(?:\/)([^\/].*)+$)/,html:''},youtube:{regex:/^.*(?:(?:youtu\.be\/)|(?:youtube\.com)\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*)/,html:''}},type:"video",droppable:!0,pastable:!0,icon_name:"video",loadData:function(t){if(this.providers.hasOwnProperty(t.source)){var e=this.providers[t.source],r="file:"===window.location.protocol?"http:":window.location.protocol,i=e.square?"with-square-media":"with-sixteen-by-nine-media";this.editor.classList.add("st-block__editor--"+i),this.editor.innerHTML=n.template(e.html,{protocol:r,remote_id:t.remote_id,width:this.editor.style.width})}},onContentPasted:function(t){this.handleDropPaste(t.target.value)},matchVideoProvider:function(t,e,r){var i=t.regex.exec(r);return null==i||n.isUndefined(i[1])?{}:{source:e,remote_id:i[1]}},handleDropPaste:function(t){if(i.isURI(t))for(var e in this.providers)this.providers.hasOwnProperty(e)&&this.setAndLoadData(this.matchVideoProvider(this.providers[e],e,t))},onDrop:function(t){var e=t.getData("text/plain");this.handleDropPaste(e)}})},function(t,e,r){"use strict";var n=r(1);t.exports=function(t){var e=t.name,r=(t.text,t.cmd),i=t.iconName;return'\n \n ')}},function(t,e,r){"use strict";var n=r(0),i=r(1),o=r(2),s=r(3),a=r(9),u=r(4),c=r(92),f=r(238),l=r(240),h=r(242),p=r(86),d=r(91),y=r(61),v=r(243),g=r(82),m=function(t){this.initialize(t)};Object.assign(m.prototype,r(7),r(9),{bound:["onFormSubmit","hideAllTheThings","changeBlockPosition","removeBlockDragOver","blockLimitReached","blockOrderUpdated","onBlockCountChange","renderBlockPositionerSelect"],events:{"block:reorder:dragend":"removeBlockDragOver","block:reorder:dropped":"removeBlockDragOver","block:content:dropped":"removeBlockDragOver"},initialize:function(t){if(o.log("Init SirTrevor.Editor"),this.options=Object.assign({},i.defaults,t||{}),this.ID=n.uniqueId("st-editor-"),!this._ensureAndSetElements())return!1;!n.isUndefined(this.options.onEditorRender)&&n.isFunction(this.options.onEditorRender)&&(this.onEditorRender=this.options.onEditorRender),this.mediator=Object.assign({},a),this._bindFunctions(),i.instances.push(this),this.build(),c.bindFormSubmit(this.form)},build:function(){s.hide(this.el),this.errorHandler=new v(this.outer,this.mediator,this.options.errorsContainer),this.store=new y(this.el.value,this.mediator),this.blockManager=new p(this),this.blockAddition=l.create(this),this.BlockAdditionTop=h.create(this),this.blockControls=f.create(this),this.blockPositionerSelect=new g(this.mediator),this.formatBar=new d(this.options.formatBar,this.mediator,this),this.mediator.on("block:changePosition",this.changeBlockPosition),this.mediator.on("block:limitReached",this.blockLimitReached),this.mediator.on("block:rerender",this.blockOrderUpdated),this.mediator.on("block:create",this.blockOrderUpdated),this.mediator.on("block:remove",this.blockOrderUpdated),this.mediator.on("block:replace",this.blockOrderUpdated),this.mediator.on("block:countUpdate",this.onBlockCountChange),this.mediator.on("block-positioner-select:render",this.renderBlockPositionerSelect),this.dataStore="Please use store.retrieve();",this._setEvents(),window.addEventListener("click",this.hideAllTheThings),document.body.addEventListener("keydown",this.disableBackButton),this.createBlocks(),this.wrapper.classList.add("st-ready"),n.isUndefined(this.onEditorRender)||this.onEditorRender()},createBlocks:function(){var t=this.store.retrieve();if(t.data.length>0?t.data.forEach(function(t){this.mediator.trigger("block:create",t.type,t.data)},this):!1!==this.options.defaultType&&this.mediator.trigger("block:create",this.options.defaultType,{}),this.options.focusOnInit){var e=this.wrapper.querySelectorAll(".st-block")[0];if(e)this.blockManager.findBlockById(e.getAttribute("id")).focus()}},destroy:function(){this.formatBar.destroy(),this.blockAddition.destroy(),this.blockControls.destroy(),this.blockManager.blocks.forEach(function(t){this.mediator.trigger("block:remove",t.blockID)},this),this.mediator.stopListening(),this.stopListening(),i.instances=i.instances.filter(function(t){return t.ID!==this.ID},this),window.removeEventListener("click",this.hideAllTheThings),document.body.removeEventListener("keydown",this.disableBackButton),this.store.reset(),s.replaceWith(this.outer,this.el)},getData:function(){return this.onFormSubmit(),this.store.retrieve()},reinitialize:function(t){this.destroy(),this.initialize(t||this.options)},restore:function(t){this.el.value=t,this.reinitialize()},blockLimitReached:function(t){this.wrapper.classList.toggle("st--block-limit-reached",t)},blockOrderUpdated:function(){var t=this.wrapper.querySelectorAll(".st-block")[0],e=!1;if(t){var r=this.blockManager.findBlockById(t.getAttribute("id"));e=r&&r.textable}this._toggleHideTopControls(e)},_toggleHideTopControls:function(t){this.wrapper.classList.toggle("st--hide-top-controls",t)},onBlockCountChange:function(t){this.blockPositionerSelect.onBlockCountChange(t)},renderBlockPositionerSelect:function(t){this.blockPositionerSelect.renderInBlock(t)},_setEvents:function(){Object.keys(this.events).forEach(function(t){u.on(t,this[this.events[t]],this)},this)},hideAllTheThings:function(t){this.blockControls.hide(),this.blockAddition.hide(),null===document.activeElement.getAttribute("contenteditable")&&this.formatBar.hide();Array.prototype.forEach.call(this.wrapper.querySelectorAll(".st-block__ui-delete-controls"),function(t){t.classList.remove("active")})},store:function(t,e){return o.log("The store method has been removed, please call store[methodName]"),this.store[t].call(this,e||{})},removeBlockDragOver:function(){var t=this.outer.querySelector(".st-drag-over");t&&t.classList.remove("st-drag-over")},changeBlockPosition:function(t,e){e-=1;var r=this.blockManager.getBlockPosition(t),n=this.wrapper.querySelectorAll(".st-block")[e];n&&n.getAttribute("id")!==t.getAttribute("id")&&(this.hideAllTheThings(),r>e?n.parentNode.insertBefore(t,n):s.insertAfter(t,n))},onFormSubmit:function(t){return t=!1!==t,o.log("Handling form submission for Editor "+this.ID),this.mediator.trigger("errors:reset"),this.store.reset(),this.validateBlocks(t),this.blockManager.validateBlockTypesExist(t),this.mediator.trigger("errors:render"),this.el.value=this.store.toString(),this.errorHandler.errors.length},validateBlocks:function(t){var e=this;Array.prototype.forEach.call(this.wrapper.querySelectorAll(".st-block"),function(r,i){var o=e.blockManager.findBlockById(r.getAttribute("id"));n.isUndefined(o)||e.validateAndSaveBlock(o,t)})},validateAndSaveBlock:function(t,e){if(!i.skipValidation&&e&&!t.valid())return this.mediator.trigger("errors:add",{text:n.result(t,"validationFailMsg")}),void o.log("Block "+t.blockID+" failed validation");if("text"!==t.type||!t.isEmpty()){var r=t.getData();o.log("Adding data for block "+t.blockID+" to block store:",r),this.store.addData(r)}},disableBackButton:function(t){var e=t.target||t.srcElement;if(8===t.keyCode){if(e.getAttribute("contenteditable")||"INPUT"===e.tagName||"TEXTAREA"===e.tagName)return;t.preventDefault()}},findBlockById:function(t){return this.blockManager.findBlockById(t)},getBlocksByType:function(t){return this.blockManager.getBlocksByType(t)},getBlocksByIDs:function(t){return this.blockManager.getBlocksByIDs(t)},getBlockPosition:function(t){return o.log("This method has been moved to blockManager.getBlockPosition()"),this.blockManager.getBlockPosition(t)},_ensureAndSetElements:function(){if(n.isUndefined(this.options.el))return o.log("You must provide an el"),!1;this.el=this.options.el,this.form=s.getClosest(this.el,"form");var t=s.createElement("div",{id:this.ID,class:"st-outer notranslate",dropzone:"copy link move"}),e=s.createElement("div",{class:"st-blocks"});return s.wrap(s.wrap(this.el,t),e),this.outer=this.form.querySelector("#"+this.ID),this.wrapper=this.outer.querySelector(".st-blocks"),!0}}),t.exports=m},function(t,e,r){"use strict";var n=r(20),i=r(10),o=r(239);function s(t,e){var r=document.createElement("div");r.className="st-block-controls__buttons",r.innerHTML=function(t,e){return e.reduce(function(e,r){return t.hasOwnProperty(r)&&t[r].prototype.toolbarEnabled?e+o(t[r].prototype):e},"")}.apply(null,arguments);var n=document.createElement("div");return n.className="st-block-controls",n.appendChild(r),n}t.exports.create=function(t){var e=s(n,t.blockManager.blockTypes);function r(){var t=e.parentNode;if(t)return t.removeChild(e),t.classList.remove("st-block--controls-active"),t}return i.delegate(t.wrapper,".st-block-replacer","click",function(t){t.stopPropagation();var n=this.parentNode;n&&r()!==n&&(n.appendChild(e),n.classList.toggle("st-block--controls-active"))}),i.delegate(t.wrapper,".st-block-controls__button","click",function(r){t.mediator.trigger("block:replace",e.parentNode,this.getAttribute("data-type"))}),{el:e,hide:r,destroy:function(){t=null,e=null}}}},function(t,e,r){"use strict";var n=r(1);t.exports=function(t){return'\n \n ")}},function(t,e,r){"use strict";var n=r(33),i=r(4),o=r(3),s=r(10),a=r(241);t.exports.create=function(t){t.wrapper.insertAdjacentHTML("beforeend",a());var e=t.wrapper.querySelector(".st-top-controls");return n.dropArea(e),e.addEventListener("drop",function(r){r.preventDefault();var n=e,s=r.dataTransfer.getData("text/plain"),a=document.querySelector("#"+s);n.id!==s&&o.insertAfter(a,n),t.mediator.trigger("block:rerender",s),i.trigger("block:reorder:dropped",s)}),s.delegate(t.wrapper,".st-block-addition","click",function(e){t.mediator.trigger("block:create","Text",null,this.parentNode.parentNode.id?this.parentNode.parentNode:this.parentNode)}),{destroy:function(){t=null},hide:function(){}}}},function(t,e,r){"use strict";var n=r(88);t.exports=function(){return'\n
"+l[u]+">","gi"),s=s.replace(a,"
");function h(t,e,r){return n.isUndefined(r)&&(r=""),"**"+e.replace(/<(.)?br(.)?>/g,"")+"**"+r}function p(t,e,r){return n.isUndefined(r)&&(r=""),"_"+e.replace(/<(.)?br(.)?>/g,"")+"_"+r}return s=(s=s.replace(/<(\w+)(?:\s+\w+="[^"]+(?:"\$[^"]+"[^"]+)?")*>\s*<\/\1>/gim,"").replace(/\n/gm,"").replace(/
)?([^<>]+)(?:
)?(?:<\/div>)/g,"$1\n").replace(/<\/p>/g,"\n\n").replace(/<(.)?br(.)?>/g,"\n").replace(/</g,"<").replace(/>/g,">"),o.hasOwnProperty(e)&&(f=o[e],!n.isUndefined(f.prototype.toMarkdown)&&n.isFunction(f.prototype.toMarkdown)&&(s=f.prototype.toMarkdown(s))),s=s.replace(/<\/?[^>]+(>|$)/g,"")}},function(t,e,r){}])});