1 | !function t(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):"object"==typeof exports?exports.ReactMarkdownEditorLite=n(require("react")):e.ReactMarkdownEditorLite=n(e.React)}(window,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="./dist/",n(n.s=9)}([function(e,n){e.exports=t},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0}),e.PluginComponent=void 0;var i,a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"editor",{get:function t(){return this.props.editor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"editorConfig",{get:function t(){return this.props.editorConfig},enumerable:!1,configurable:!0}),e.prototype.getConfig=function(t,e){return void 0!==this.props.config[t]&&null!==this.props.config[t]?this.props.config[t]:e},e.pluginName="",e.align="left",e.defaultConfig={},e}(n(0).Component);e.PluginComponent=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(7),o=n(16),i=n(17),a,l=new(function(){function t(){this.langs={enUS:o.default,zhCN:i.default},this.current="enUS",this.setUp()}return t.prototype.setUp=function(){if("undefined"!=typeof window){var t="enUS",e,e;if(navigator.language)t=(e=navigator.language.split("-"))[0],1!==e.length&&(t+=e[e.length-1].toUpperCase());if(navigator.browserLanguage)t=(e=navigator.browserLanguage.split("-"))[0],e[1]&&(t+=e[1].toUpperCase());this.current!==t&&this.isAvailable(t)&&(this.current=t,r.globalEmitter.emit(r.globalEmitter.EVENT_LANG_CHANGE,this,t,this.langs[t]))}},t.prototype.isAvailable=function(t){return void 0!==this.langs[t]},t.prototype.add=function(t,e){this.langs[t]=e},t.prototype.setCurrent=function(t){if(!this.isAvailable(t))throw new Error("Language "+t+" is not exists");this.current!==t&&(this.current=t,r.globalEmitter.emit(r.globalEmitter.EVENT_LANG_CHANGE,this,t,this.langs[t]))},t.prototype.get=function(t,e){var n=this.langs[this.current][t]||"";return e&&Object.keys(e).forEach((function(t){n=n.replace(new RegExp("\\{"+t+"\\}","g"),e[t])})),n},t.prototype.getCurrent=function(){return this.current},t}());e.default=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0);function o(t){return r.createElement("i",{className:"rmel-iconfont rmel-icon-"+t.type})}e.default=o},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function t(e){return typeof e}:function t(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function o(t){if(!t||"object"!==r(t))return t;var e=Array.isArray(t)?[]:{};if(t&&"object"===r(t))for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]&&"object"===r(t[n])?e[n]=o(t[n]):e[n]=t[n]);return e}function i(t){return null==t||""===t}function a(t){return t&&(t instanceof Promise||("object"===r(t)||"function"==typeof t)&&"function"==typeof t.then)}function l(t,e){for(var n="",r=e;r--;)n+=t;return n}function s(t,e){var n=e.withKey,r=e.keyCode,o=e.key,i=e.aliasCommand,a={ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,shiftKey:t.shiftKey,keyCode:t.keyCode,key:t.key};if(i&&(a.ctrlKey=a.ctrlKey||a.metaKey),n&&n.length>0)for(var l=0,s=n;l<s.length;l++){var u=s[l];if(void 0!==a[u]&&!a[u])return!1}else if(a.metaKey||a.ctrlKey||a.shiftKey||a.altKey)return!1;return a.key?a.key===o:a.keyCode===r}function u(t,e){var n=t.split("\n"),r=t.substr(0,e).split("\n"),o=r.length,i=r[r.length-1].length,a=n[r.length-1],l=r.length>1?r[r.length-2]:null,s=n.length>r.length?n[r.length]:null;return{line:o,col:i,beforeText:t.substr(0,e),afterText:t.substr(e),curLine:a,prevLine:l,nextLine:s}}Object.defineProperty(e,"__esModule",{value:!0}),e.getLineAndCol=e.isKeyMatch=e.repeat=e.isPromise=e.isEmpty=e.deepClone=void 0,e.deepClone=o,e.isEmpty=i,e.isPromise=a,e.repeat=l,e.isKeyMatch=s,e.getLineAndCol=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClose=n.handleClose.bind(n),n}return r(e,t),e.prototype.handleClose=function(t){t.stopPropagation();var e=this.props.onClose;"function"==typeof e&&e()},e.prototype.render=function(){return i.createElement("div",{className:"drop-wrap "+(this.props.show?"show":"hidden"),onClick:this.handleClose},this.props.children)},e}(i.Component);e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});for(var r=n(4),o={bold:["**","**"],italic:["*","*"],underline:["++","++"],strikethrough:["~~","~~"],quote:["\n> ","\n"],inlinecode:["`","`"],code:["\n```\n","\n```\n"]},i=1;i<=6;i++)o["h"+i]=["\n"+r.repeat("#",i)+" ","\n"];function a(t){for(var e=t.row,n=void 0===e?2:e,r=t.col,o=void 0===r?2:r,i=["|"],a=["|"],l=["|"],s="",u=1;u<=o;u++)i.push(" Head |"),l.push(" --- |"),a.push(" Data |");for(var c=1;c<=n;c++)s+="\n"+a.join("");return i.join("")+"\n"+l.join("")+s}function l(t,e){var n=e;if("\n"!==n.substr(0,1)&&(n="\n"+n),"unordered"===t)return n.length>1?n.replace(/\n/g,"\n* ").trim():"* ";var r=1;return n.length>1?n.replace(/\n/g,(function(){return"\n"+r+++". "})).trim():"1. "}function s(t,e){return{text:t,newBlock:e,selection:{start:t.length,end:t.length}}}function u(t,e,n){if(void 0!==o[e])return{text:""+o[e][0]+t+o[e][1],selection:{start:o[e][0].length,end:o[e][0].length+t.length}};switch(e){case"tab":var r=1===n.tabMapValue?"\t":" ".repeat(n.tabMapValue),i=r+t.replace(/\n/g,"\n"+r),u=t.includes("\n")?t.match(/\n/g).length:0;return{text:i,selection:{start:n.tabMapValue,end:n.tabMapValue*(u+1)+t.length}};case"unordered":return s(l("unordered",t),!0);case"order":return s(l("order",t),!0);case"hr":return s("---",!0);case"table":return{text:a(n),newBlock:!0};case"image":return{text:"!["+(t||n.target)+"]("+(n.imageUrl||"")+")",selection:{start:2,end:t.length+2}};case"link":return{text:"["+t+"]("+(n.linkUrl||"")+")",selection:{start:1,end:t.length+1}}}return{text:t,selection:{start:0,end:t.length}}}e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0}),e.globalEmitter=void 0;var i,a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.EVENT_CHANGE="a1",e.EVENT_FULL_SCREEN="a2",e.EVENT_VIEW_CHANGE="a3",e.EVENT_KEY_DOWN="a4",e.EVENT_FOCUS="a5",e.EVENT_BLUR="a6",e.EVENT_SCROLL="a7",e.EVENT_LANG_CHANGE="b1",e}return r(e,t),e}(n(15).EventEmitter),l=new a;e.globalEmitter=l,e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(49),o=n(6),i=n(4);function a(t,e){var n,a;return{placeholder:o.default("","image",{target:"Uploading_"+r.v4(),imageUrl:""}).text,uploaded:new Promise((function(n){var r=!0,a=function e(i){r&&console.warn("Deprecated: onImageUpload should return a Promise, callback will be removed in future"),n(o.default("","image",{target:t.name,imageUrl:i}).text)},l=e(t,a);i.isPromise(l)&&(r=!1,l.then(a))}))}}e.default=a},function(t,e,n){n(10),t.exports=n(11)},function(t,e,n){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Plugins=e.PluginComponent=e.DropList=void 0;var r=n(12),o=n(23),i=n(24),a=n(25),l=n(26),s=n(27),u=n(28),c=n(29),d=n(30),p=n(31),f=n(32),h=n(33),y=n(34),m=n(36),g=n(38),v=n(39),b=n(40),_=n(41),w=n(43),C=n(44),O=n(46),E=n(1);Object.defineProperty(e,"PluginComponent",{enumerable:!0,get:function t(){return E.PluginComponent}});var M=n(5);e.DropList=M.default,r.default.use(y.default),r.default.use(c.default),r.default.use(d.default),r.default.use(f.default),r.default.use(p.default),r.default.use(b.default),r.default.use(v.default),r.default.use(l.default),r.default.use(s.default),r.default.use(a.default),r.default.use(i.default),r.default.use(C.default),r.default.use(m.default),r.default.use(g.default),r.default.use(u.default),r.default.use(_.default),r.default.use(w.default),r.default.use(h.default);var P=n(6);Object.defineProperty(e,"getDecorated",{enumerable:!0,get:function t(){return P.default}}),e.Plugins={Header:y.default,FontBold:c.default,FontItalic:d.default,FontUnderline:f.default,FontStrikethrough:p.default,ListUnordered:b.default,ListOrdered:v.default,BlockQuote:l.default,BlockWrap:s.default,BlockCodeInline:a.default,BlockCodeBlock:i.default,Table:C.default,Image:m.default,Link:g.default,Clear:u.default,Logger:_.default,ModeToggle:w.default,FullScreen:h.default,AutoResize:o.default,TabInsert:O.default},e.default=r.default},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o,i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},a=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),o=0,e=0;e<n;e++)for(var i=arguments[e],a=0,l=i.length;a<l;a++,o++)r[o]=i[a];return r};Object.defineProperty(e,"__esModule",{value:!0});var l=n(0),s=n(3),u=n(13),c=n(14),d=n(2),p=n(18),f=n(7),h=n(19),y=n(6),m=n(20),g=n(4),v=n(8),b=n(21),_=n(22),w=function(t){function e(e){var n=t.call(this,e)||this;return n.nodeMdText=l.createRef(),n.nodeMdPreview=l.createRef(),n.nodeMdPreviewWrapper=l.createRef(),n.hasContentChanged=!0,n.scrollScale=1,n.isSyncingScroll=!1,n.shouldSyncScroll="md",n.keyboardListeners=[],n.emitter=new f.default,n.config=m.default(b.default,n.props.config,n.props),n.state={text:(n.props.value||n.props.defaultValue||"").replace(/\u21b5/g,"\n"),html:"",view:n.config.view||b.default.view,fullScreen:!1,plugins:n.getPlugins()},n.config.canView&&!n.config.canView.menu&&(n.state.view.menu=!1),n.nodeMdText=l.createRef(),n.nodeMdPreviewWrapper=l.createRef(),n.handleChange=n.handleChange.bind(n),n.handlePaste=n.handlePaste.bind(n),n.handleDrop=n.handleDrop.bind(n),n.handleToggleMenu=n.handleToggleMenu.bind(n),n.handleKeyDown=n.handleKeyDown.bind(n),n.handleEditorKeyDown=n.handleEditorKeyDown.bind(n),n.handleLocaleUpdate=n.handleLocaleUpdate.bind(n),n.handleFocus=n.handleFocus.bind(n),n.handleBlur=n.handleBlur.bind(n),n.handleInputScroll=n.handleSyncScroll.bind(n,"md"),n.handlePreviewScroll=n.handleSyncScroll.bind(n,"html"),n}return r(e,t),e.use=function(t,n){void 0===n&&(n={});for(var r=0;r<e.plugins.length;r++)if(e.plugins[r].comp===t)return void e.plugins.splice(r,1,{comp:t,config:n});e.plugins.push({comp:t,config:n})},e.unuse=function(t){for(var n=0;n<e.plugins.length;n++)if(e.plugins[n].comp===t)return void e.plugins.splice(n,1)},e.unuseAll=function(){e.plugins=[]},e.prototype.componentDidMount=function(){var t=this.state.text;this.renderHTML(t),f.globalEmitter.on(f.globalEmitter.EVENT_LANG_CHANGE,this.handleLocaleUpdate),d.default.setUp()},e.prototype.componentWillUnmount=function(){f.globalEmitter.off(f.globalEmitter.EVENT_LANG_CHANGE,this.handleLocaleUpdate)},e.prototype.componentDidUpdate=function(t){if(void 0!==this.props.value&&this.props.value!==this.state.text){var e=this.props.value;"string"!=typeof e&&(e=String(e).toString()),e=e.replace(/\u21b5/g,"\n"),this.state.text!==e&&(this.setState({text:e}),this.renderHTML(e))}t.plugins!==this.props.plugins&&this.setState({plugins:this.getPlugins()})},e.prototype.getPlugins=function(){var t=this,n=[];if(this.props.plugins)for(var r=function t(r){if(r!==p.default.pluginName)for(var o=0,i=e.plugins;o<i.length;o++){var a=i[o];if(a.comp.pluginName===r)return void n.push(a)}else n.push({comp:p.default,config:{}})},o=0,s=this.props.plugins;o<s.length;o++){var u=s[o];"fonts"===u?(r("font-bold"),r("font-italic"),r("font-underline"),r("font-strikethrough"),r("list-unordered"),r("list-ordered"),r("block-quote"),r("block-wrap"),r("block-code-inline"),r("block-code-block")):r(u)}else n=a(e.plugins);var c={};return n.forEach((function(e){void 0===c[e.comp.align]&&(c[e.comp.align]=[]),c[e.comp.align].push(l.createElement(e.comp,{editor:t,editorConfig:t.config,config:i(i({},e.comp.defaultConfig||{}),e.config||{}),key:e.comp.pluginName}))})),c},e.prototype.handleSyncScroll=function(t,e){var n=this;if(t===this.shouldSyncScroll){this.props.onScroll&&this.props.onScroll(e,t),this.emitter.emit(this.emitter.EVENT_SCROLL,e,t);var r=this.config.syncScrollMode,o;(void 0===r?[]:r).includes("md"===t?"rightFollowLeft":"leftFollowRight")&&(this.hasContentChanged&&this.nodeMdText.current&&this.nodeMdPreviewWrapper.current&&(this.scrollScale=this.nodeMdText.current.scrollHeight/this.nodeMdPreviewWrapper.current.scrollHeight,this.hasContentChanged=!1),this.isSyncingScroll||(this.isSyncingScroll=!0,requestAnimationFrame((function(){n.nodeMdText.current&&n.nodeMdPreviewWrapper.current&&("md"===t?n.nodeMdPreviewWrapper.current.scrollTop=n.nodeMdText.current.scrollTop/n.scrollScale:n.nodeMdText.current.scrollTop=n.nodeMdPreviewWrapper.current.scrollTop*n.scrollScale),n.isSyncingScroll=!1}))))}},e.prototype.renderHTML=function(t){var e=this;if(!this.props.renderHTML)return console.error("renderHTML props is required!"),Promise.resolve();var n=this.props.renderHTML(t);return g.isPromise(n)?n.then((function(t){return e.setHtml(t)})):"function"==typeof n?this.setHtml(n()):this.setHtml(n)},e.prototype.setHtml=function(t){var e=this;return new Promise((function(n){e.setState({html:t},n)}))},e.prototype.handleToggleMenu=function(){this.setView({menu:!this.state.view.menu})},e.prototype.handleFocus=function(t){var e=this.props.onFocus;e&&e(t),this.emitter.emit(this.emitter.EVENT_FOCUS,t)},e.prototype.handleBlur=function(t){var e=this.props.onBlur;e&&e(t),this.emitter.emit(this.emitter.EVENT_BLUR,t)},e.prototype.handleChange=function(t){t.persist();var e=t.target.value;this.setText(e,t)},e.prototype.handlePaste=function(t){if(this.config.allowPasteImage&&this.config.onImageUpload){var e,n=(t.nativeEvent.clipboardData||window.clipboardData).items;n&&(t.preventDefault(),this.uploadWithDataTransfer(n))}},e.prototype.handleDrop=function(t){if(this.config.onImageUpload){var e=t.nativeEvent;if(e.dataTransfer){var n=e.dataTransfer.items;n&&(t.preventDefault(),this.uploadWithDataTransfer(n))}}},e.prototype.handleEditorKeyDown=function(t){var e=this,n=t.keyCode,r=t.key,o=t.currentTarget;if(13===n||"Enter"===r){var i=t.currentTarget.value,a=o.selectionStart,l=g.getLineAndCol(i,a),s=function n(){var r=o.value.substr(0,a-l.curLine.length)+o.value.substr(a);e.setText(r,void 0,{start:a-l.curLine.length,end:a-l.curLine.length}),t.preventDefault()},u=function n(r){e.insertText("\n"+r,!1,{start:r.length+1,end:r.length+1}),t.preventDefault()},c=l.curLine.match(/^(\s?)([-*]) /);if(c)return/^(\s?)([-*]) $/.test(l.curLine)?void s():void u(c[0]);var d=l.curLine.match(/^(\s?)(\d+)\. /);if(d){if(/^(\s?)(\d+)\. $/.test(l.curLine))return void s();var p;u(""+d[1]+(parseInt(d[2],10)+1)+". ")}}},e.prototype.handleLocaleUpdate=function(){this.forceUpdate()},e.prototype.getMdElement=function(){return this.nodeMdText.current},e.prototype.getHtmlElement=function(){return this.nodeMdPreviewWrapper.current},e.prototype.clearSelection=function(){this.nodeMdText.current&&this.nodeMdText.current.setSelectionRange(0,0,"none")},e.prototype.getSelection=function(){var t=this.nodeMdText.current;if(!t)return i({},h.initialSelection);var e=t.selectionStart,n=t.selectionEnd,r;return{start:e,end:n,text:(t.value||"").slice(e,n)}},e.prototype.setSelection=function(t){this.nodeMdText.current&&(this.nodeMdText.current.setSelectionRange(t.start,t.end,"forward"),this.nodeMdText.current.focus())},e.prototype.insertMarkdown=function(t,e){void 0===e&&(e={});var n=this.getSelection(),r=e?i({},e):{};if("image"===t&&(r=i(i({},r),{target:e.target||n.text||"",imageUrl:e.imageUrl||this.config.imageUrl})),"link"===t&&(r=i(i({},r),{linkUrl:this.config.linkUrl})),"tab"===t&&n.start!==n.end){var o=this.getMdValue().slice(0,n.start).lastIndexOf("\n")+1;this.setSelection({start:o,end:n.end})}var a=y.default(n.text,t,r),l=a.text,s=a.selection;if(a.newBlock){var u=g.getLineAndCol(this.getMdValue(),n.start),c=u.col,d=u.curLine;c>0&&d.length>0&&(l="\n"+l,s&&(s.start++,s.end++));var p=u.afterText;n.start!==n.end&&(p=g.getLineAndCol(this.getMdValue(),n.end).afterText),""!==p.trim()&&"\n\n"!==p.substr(0,2)&&("\n"!==p.substr(0,1)&&(l+="\n"),l+="\n")}this.insertText(l,!0,s)},e.prototype.insertPlaceholder=function(t,e){var n=this;this.insertText(t,!0),e.then((function(e){var r=n.getMdValue().replace(t,e);n.setText(r)}))},e.prototype.insertText=function(t,e,n){void 0===t&&(t=""),void 0===e&&(e=!1);var r=this.state.text,o=this.getSelection(),i=r.slice(0,o.start),a=r.slice(e?o.end:o.start,r.length);this.setText(i+t+a,void 0,n?{start:n.start+i.length,end:n.end+i.length}:{start:o.start,end:o.start})},e.prototype.setText=function(t,e,n){var r=this;void 0===t&&(t="");var o=this.config.onChangeTrigger,i=void 0===o?"both":o,a=t.replace(/\u21b5/g,"\n");if(this.state.text!==t){this.setState({text:a}),!this.props.onChange||"both"!==i&&"beforeRender"!==i||this.props.onChange({text:a,html:this.getHtmlValue()},e),this.emitter.emit(this.emitter.EVENT_CHANGE,t,e,void 0===e),n&&setTimeout((function(){return r.setSelection(n)})),this.hasContentChanged||(this.hasContentChanged=!0);var l=this.renderHTML(a);"both"!==i&&"afterRender"!==i||l.then((function(){r.props.onChange&&r.props.onChange({text:r.state.text,html:r.getHtmlValue()},e)}))}},e.prototype.getMdValue=function(){return this.state.text},e.prototype.getHtmlValue=function(){return"string"==typeof this.state.html?this.state.html:this.nodeMdPreview.current?this.nodeMdPreview.current.getHtml():""},e.prototype.onKeyboard=function(t){var e=this;Array.isArray(t)?t.forEach((function(t){return e.onKeyboard(t)})):this.keyboardListeners.includes(t)||this.keyboardListeners.push(t)},e.prototype.offKeyboard=function(t){var e=this;if(Array.isArray(t))t.forEach((function(t){return e.offKeyboard(t)}));else{var n=this.keyboardListeners.indexOf(t);n>=0&&this.keyboardListeners.splice(n,1)}},e.prototype.handleKeyDown=function(t){for(var e=0,n=this.keyboardListeners;e<n.length;e++){var r=n[e];if(g.isKeyMatch(t,r))return t.preventDefault(),void r.callback(t)}this.emitter.emit(this.emitter.EVENT_KEY_DOWN,t)},e.prototype.getEventType=function(t){switch(t){case"change":return this.emitter.EVENT_CHANGE;case"fullscreen":return this.emitter.EVENT_FULL_SCREEN;case"viewchange":return this.emitter.EVENT_VIEW_CHANGE;case"keydown":return this.emitter.EVENT_KEY_DOWN;case"blur":return this.emitter.EVENT_BLUR;case"focus":return this.emitter.EVENT_FOCUS;case"scroll":return this.emitter.EVENT_SCROLL}},e.prototype.on=function(t,e){var n=this.getEventType(t);n&&this.emitter.on(n,e)},e.prototype.off=function(t,e){var n=this.getEventType(t);n&&this.emitter.off(n,e)},e.prototype.setView=function(t){var e=this,n=i(i({},this.state.view),t);this.setState({view:n},(function(){e.emitter.emit(e.emitter.EVENT_VIEW_CHANGE,n)}))},e.prototype.getView=function(){return i({},this.state.view)},e.prototype.fullScreen=function(t){var e=this;this.state.fullScreen!==t&&this.setState({fullScreen:t},(function(){e.emitter.emit(e.emitter.EVENT_FULL_SCREEN,t)}))},e.prototype.isFullScreen=function(){return this.state.fullScreen},e.prototype.uploadWithDataTransfer=function(t){var e=this,n=this.config.onImageUpload;if(n){var r=[];Array.prototype.forEach.call(t,(function(t){if("file"===t.kind&&t.type.includes("image")){var o=t.getAsFile();if(o){var i=v.default(o,n);r.push(Promise.resolve(i.placeholder)),i.uploaded.then((function(t){var n=e.getMdValue().replace(i.placeholder,t),r=t.length-i.placeholder.length,o=e.getSelection();e.setText(n,void 0,{start:o.start+r,end:o.start+r})}))}}else"string"===t.kind&&"text/plain"===t.type&&r.push(new Promise((function(e){return t.getAsString(e)})))})),Promise.all(r).then((function(t){var n=t.join(""),r=e.getSelection();e.insertText(n,!0,{start:r.start===r.end?n.length:0,end:n.length})}))}},e.prototype.render=function(){var t=this,e=this.config.canView&&this.config.canView.hideMenu&&!this.config.canView.menu,n=this.state,r=n.view,o=n.fullScreen,i=function e(n){return t.state.plugins[n]||[]},a=!!r.menu,d=this.props.id,p=d?d+"_md":void 0,f=d?d+"_html":void 0;return l.createElement("div",{id:d,className:"rc-md-editor "+(o?"full":""),style:this.props.style,onKeyDown:this.handleKeyDown,onDrop:this.handleDrop},l.createElement(u.default,{visible:a,left:i("left"),right:i("right")}),l.createElement("div",{className:"editor-container"},e&&l.createElement(c.default,null,l.createElement("span",{className:"button button-type-menu",title:a?"hidden menu":"show menu",onClick:this.handleToggleMenu},l.createElement(s.default,{type:"expand-"+(a?"less":"more")}))),l.createElement("section",{className:"section sec-md "+(r.md?"visible":"in-visible")},l.createElement("textarea",{id:p,ref:this.nodeMdText,name:this.props.name||"textarea",autoFocus:this.props.autoFocus,placeholder:this.props.placeholder,readOnly:this.props.readOnly,value:this.state.text,className:"section-container input "+(this.config.markdownClass||""),wrap:"hard",onChange:this.handleChange,onScroll:this.handleInputScroll,onMouseOver:function e(){return t.shouldSyncScroll="md"},onKeyDown:this.handleEditorKeyDown,onPaste:this.handlePaste,onFocus:this.handleFocus,onBlur:this.handleBlur})),l.createElement("section",{className:"section sec-html "+(r.html?"visible":"in-visible")},l.createElement("div",{id:f,className:"section-container html-wrap",ref:this.nodeMdPreviewWrapper,onMouseOver:function e(){return t.shouldSyncScroll="html"},onScroll:this.handlePreviewScroll},l.createElement(_.HtmlRender,{html:this.state.html,className:this.config.htmlClass,ref:this.nodeMdPreview})))))},e.plugins=[],e.addLocale=d.default.add.bind(d.default),e.useLocale=d.default.setCurrent.bind(d.default),e.getLocale=d.default.getCurrent.bind(d.default),e}(l.Component);e.default=w},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0);function o(t){return r.createElement("div",{className:"rc-md-navigation "+(t.visible?"visible":"in-visible")},r.createElement("div",{className:"navigation-nav left"},r.createElement("div",{className:"button-wrap"},t.left)),r.createElement("div",{className:"navigation-nav right"},r.createElement("div",{className:"button-wrap"},t.right)))}e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0);function o(t){return r.createElement("div",{className:"tool-bar",style:t.style},t.children)}e.default=o},function(t,e,n){"use strict";var r=Object.prototype.hasOwnProperty,o="~";function i(){}function a(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function l(t,e,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var l=new a(n,r||t,i),s=o?o+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],l]:t._events[s].push(l):(t._events[s]=l,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function u(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),u.prototype.eventNames=function t(){var e=[],n,i;if(0===this._eventsCount)return e;for(i in n=this._events)r.call(n,i)&&e.push(o?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(n)):e},u.prototype.listeners=function t(e){var n=o?o+e:e,r=this._events[n];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,l=new Array(a);i<a;i++)l[i]=r[i].fn;return l},u.prototype.listenerCount=function t(e){var n=o?o+e:e,r=this._events[n];return r?r.fn?1:r.length:0},u.prototype.emit=function t(e,n,r,i,a,l){var s=o?o+e:e;if(!this._events[s])return!1;var u=this._events[s],c=arguments.length,d,p;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,n),!0;case 3:return u.fn.call(u.context,n,r),!0;case 4:return u.fn.call(u.context,n,r,i),!0;case 5:return u.fn.call(u.context,n,r,i,a),!0;case 6:return u.fn.call(u.context,n,r,i,a,l),!0}for(p=1,d=new Array(c-1);p<c;p++)d[p-1]=arguments[p];u.fn.apply(u.context,d)}else{var f=u.length,h;for(p=0;p<f;p++)switch(u[p].once&&this.removeListener(e,u[p].fn,void 0,!0),c){case 1:u[p].fn.call(u[p].context);break;case 2:u[p].fn.call(u[p].context,n);break;case 3:u[p].fn.call(u[p].context,n,r);break;case 4:u[p].fn.call(u[p].context,n,r,i);break;default:if(!d)for(h=1,d=new Array(c-1);h<c;h++)d[h-1]=arguments[h];u[p].fn.apply(u[p].context,d)}}return!0},u.prototype.on=function t(e,n,r){return l(this,e,n,r,!1)},u.prototype.once=function t(e,n,r){return l(this,e,n,r,!0)},u.prototype.removeListener=function t(e,n,r,i){var a=o?o+e:e;if(!this._events[a])return this;if(!n)return s(this,a),this;var l=this._events[a];if(l.fn)l.fn!==n||i&&!l.once||r&&l.context!==r||s(this,a);else{for(var u=0,c=[],d=l.length;u<d;u++)(l[u].fn!==n||i&&!l[u].once||r&&l[u].context!==r)&&c.push(l[u]);c.length?this._events[a]=1===c.length?c[0]:c:s(this,a)}return this},u.prototype.removeAllListeners=function t(e){var n;return e?(n=o?o+e:e,this._events[n]&&s(this,n)):(this._events=new i,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=o,u.EventEmitter=u,t.exports=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={clearTip:"Are you sure you want to clear all contents?",btnHeader:"Header",btnClear:"Clear",btnBold:"Bold",btnItalic:"Italic",btnUnderline:"Underline",btnStrikethrough:"Strikethrough",btnUnordered:"Unordered list",btnOrdered:"Ordered list",btnQuote:"Quote",btnLineBreak:"Line break",btnInlineCode:"Inline code",btnCode:"Code",btnTable:"Table",btnImage:"Image",btnLink:"Link",btnUndo:"Undo",btnRedo:"Redo",btnFullScreen:"Full screen",btnExitFullScreen:"Exit full screen",btnModeEditor:"Only display editor",btnModePreview:"Only display preview",btnModeAll:"Display both editor and preview",selectTabMap:"Actually input when typing a Tab key",tab:"Tab",spaces:"Spaces"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={clearTip:"\u60a8\u786e\u5b9a\u8981\u6e05\u7a7a\u6240\u6709\u5185\u5bb9\u5417\uff1f",btnHeader:"\u6807\u9898",btnClear:"\u6e05\u7a7a",btnBold:"\u52a0\u7c97",btnItalic:"\u659c\u4f53",btnUnderline:"\u4e0b\u5212\u7ebf",btnStrikethrough:"\u5220\u9664\u7ebf",btnUnordered:"\u65e0\u5e8f\u5217\u8868",btnOrdered:"\u6709\u5e8f\u5217\u8868",btnQuote:"\u5f15\u7528",btnLineBreak:"\u6362\u884c",btnInlineCode:"\u884c\u5185\u4ee3\u7801",btnCode:"\u4ee3\u7801\u5757",btnTable:"\u8868\u683c",btnImage:"\u56fe\u7247",btnLink:"\u94fe\u63a5",btnUndo:"\u64a4\u9500",btnRedo:"\u91cd\u505a",btnFullScreen:"\u5168\u5c4f",btnExitFullScreen:"\u9000\u51fa\u5168\u5c4f",btnModeEditor:"\u4ec5\u663e\u793a\u7f16\u8f91\u5668",btnModePreview:"\u4ec5\u663e\u793a\u9884\u89c8",btnModeAll:"\u663e\u793a\u7f16\u8f91\u5668\u4e0e\u9884\u89c8",selectTabMap:"\u6309\u4e0b Tab \u952e\u65f6\u5b9e\u9645\u7684\u8f93\u5165",tab:"\u5236\u8868\u7b26",spaces:"\u7a7a\u683c"}},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a,l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){return i.createElement("span",{className:"rc-md-divider"})},e.pluginName="divider",e}(n(1).PluginComponent);e.default=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.initialSelection=void 0,e.initialSelection={start:0,end:0,text:""}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function t(e){return typeof e}:function t(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},i=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),o=0,e=0;e<n;e++)for(var i=arguments[e],a=0,l=i.length;a<l;a++,o++)r[o]=i[a];return r};function a(t,e){var n={};return Object.keys(t).forEach((function(o){void 0!==e[o]?"object"!==r(e[o])?n[o]=e[o]:Array.isArray(e[o])?n[o]=i(e[o]):n[o]=a(t[o],e[o]):n[o]=t[o]})),n}function l(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=o({},t);return e.forEach((function(t){"object"===r(t)&&(i=a(i,t))})),i}Object.defineProperty(e,"__esModule",{value:!0}),e.default=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={theme:"default",view:{menu:!0,md:!0,html:!0},canView:{menu:!0,md:!0,html:!0,both:!0,fullScreen:!0,hideMenu:!0},htmlClass:"",markdownClass:"",syncScrollMode:["rightFollowLeft","leftFollowRight"],imageUrl:"",imageAccept:"",linkUrl:"",table:{maxRow:4,maxCol:6},allowPasteImage:!0,onImageUpload:void 0,onCustomImageUpload:void 0,shortcuts:!0};e.default=r},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0}),e.HtmlRender=e.Preview=void 0;var i=n(0),a=function(t){function e(e){var n=t.call(this,e)||this;return n.el=i.createRef(),n}return r(e,t),e.prototype.getElement=function(){return this.el.current},e.prototype.getHeight=function(){return this.el.current?this.el.current.offsetHeight:0},e}(i.Component);e.Preview=a;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getHtml=function(){return"string"==typeof this.props.html?this.props.html:this.el.current?this.el.current.innerHTML:""},e.prototype.render=function(){return"string"==typeof this.props.html?i.createElement("div",{ref:this.el,dangerouslySetInnerHTML:{__html:this.props.html},className:this.props.className||"custom-html-style"}):i.createElement("div",{ref:this.el,className:this.props.className||"custom-html-style"},this.props.html)},e}(a);e.HtmlRender=l,e.default=l},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a,l=function(t){function e(e){var n=t.call(this,e)||this;return n.timer=null,n.useTimer=n.getConfig("useTimer")||"undefined"==typeof requestAnimationFrame,n.handleChange=n.handleChange.bind(n),n.doResize=n.doResize.bind(n),n}return r(e,t),e.prototype.doResize=function(){var t=this,e=function e(n){n.style.height="auto";var r=Math.min(Math.max(t.getConfig("min"),n.scrollHeight),t.getConfig("max"));return n.style.height=r+"px",r};this.timer=null;var n=this.editor.getView(),r=this.editor.getMdElement(),o=this.editor.getHtmlElement();if(r&&n.md){var i=e(r);o&&(o.style.height=i+"px")}else o&&n.html&&e(o)},e.prototype.handleChange=function(){null===this.timer&&(this.useTimer?this.timer=window.setTimeout(this.doResize):this.timer=requestAnimationFrame(this.doResize))},e.prototype.componentDidMount=function(){this.editor.on("change",this.handleChange),this.editor.on("viewchange",this.handleChange),this.handleChange()},e.prototype.componentWillUnmount=function(){this.editor.off("change",this.handleChange),this.editor.off("viewchange",this.handleChange),null!==this.timer&&this.useTimer&&(window.clearTimeout(this.timer),this.timer=null)},e.prototype.render=function(){return i.createElement("span",null)},e.pluginName="auto-resize",e.align="left",e.defaultConfig={min:200,max:1/0,useTimer:!1},e}(n(1).PluginComponent);e.default=l},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-code-block",title:l.default.get("btnCode"),onClick:function e(){return t.editor.insertMarkdown("code")}},i.createElement(a.default,{type:"code-block"}))},e.pluginName="block-code-block",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-code-inline",title:l.default.get("btnInlineCode"),onClick:function e(){return t.editor.insertMarkdown("inlinecode")}},i.createElement(a.default,{type:"code"}))},e.pluginName="block-code-inline",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-quote",title:l.default.get("btnQuote"),onClick:function e(){return t.editor.insertMarkdown("quote")}},i.createElement(a.default,{type:"quote"}))},e.pluginName="block-quote",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-wrap",title:l.default.get("btnLineBreak"),onClick:function e(){return t.editor.insertMarkdown("hr")}},i.createElement(a.default,{type:"wrap"}))},e.pluginName="block-wrap",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClick=n.handleClick.bind(n),n}return r(e,t),e.prototype.handleClick=function(){var t;""!==this.editor.getMdValue()&&(window.confirm&&"function"==typeof window.confirm&&window.confirm(l.default.get("clearTip"))&&this.editor.setText(""))},e.prototype.render=function(){return i.createElement("span",{className:"button button-type-clear",title:l.default.get("btnClear"),onClick:this.handleClick},i.createElement(a.default,{type:"delete"}))},e.pluginName="clear",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboard={key:"b",keyCode:66,aliasCommand:!0,withKey:["ctrlKey"],callback:function t(){return n.editor.insertMarkdown("bold")}},n}return r(e,t),e.prototype.componentDidMount=function(){this.editorConfig.shortcuts&&this.editor.onKeyboard(this.handleKeyboard)},e.prototype.componentWillUnmount=function(){this.editor.offKeyboard(this.handleKeyboard)},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-bold",title:l.default.get("btnBold"),onClick:function e(){return t.editor.insertMarkdown("bold")}},i.createElement(a.default,{type:"bold"}))},e.pluginName="font-bold",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboard={key:"i",keyCode:73,aliasCommand:!0,withKey:["ctrlKey"],callback:function t(){return n.editor.insertMarkdown("italic")}},n}return r(e,t),e.prototype.componentDidMount=function(){this.editorConfig.shortcuts&&this.editor.onKeyboard(this.handleKeyboard)},e.prototype.componentWillUnmount=function(){this.editor.offKeyboard(this.handleKeyboard)},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-italic",title:l.default.get("btnItalic"),onClick:function e(){return t.editor.insertMarkdown("italic")}},i.createElement(a.default,{type:"italic"}))},e.pluginName="font-italic",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboard={key:"d",keyCode:68,aliasCommand:!0,withKey:["ctrlKey"],callback:function t(){return n.editor.insertMarkdown("strikethrough")}},n}return r(e,t),e.prototype.componentDidMount=function(){this.editorConfig.shortcuts&&this.editor.onKeyboard(this.handleKeyboard)},e.prototype.componentWillUnmount=function(){this.editor.offKeyboard(this.handleKeyboard)},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-strikethrough",title:l.default.get("btnStrikethrough"),onClick:function e(){return t.editor.insertMarkdown("strikethrough")}},i.createElement(a.default,{type:"strikethrough"}))},e.pluginName="font-strikethrough",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboard={key:"u",keyCode:85,withKey:["ctrlKey"],callback:function t(){return n.editor.insertMarkdown("underline")}},n}return r(e,t),e.prototype.componentDidMount=function(){this.editorConfig.shortcuts&&this.editor.onKeyboard(this.handleKeyboard)},e.prototype.componentWillUnmount=function(){this.editor.offKeyboard(this.handleKeyboard)},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-underline",title:l.default.get("btnUnderline"),onClick:function e(){return t.editor.insertMarkdown("underline")}},i.createElement(a.default,{type:"underline"}))},e.pluginName="font-underline",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClick=n.handleClick.bind(n),n.handleChange=n.handleChange.bind(n),n.state={enable:n.editor.isFullScreen()},n}return r(e,t),e.prototype.handleClick=function(){this.editor.fullScreen(!this.state.enable)},e.prototype.handleChange=function(t){this.setState({enable:t})},e.prototype.componentDidMount=function(){this.editor.on("fullscreen",this.handleChange)},e.prototype.componentWillUnmount=function(){this.editor.off("fullscreen",this.handleChange)},e.prototype.render=function(){if(this.editorConfig.canView&&this.editorConfig.canView.fullScreen){var t=this.state.enable;return i.createElement("span",{className:"button button-type-fullscreen",title:l.default.get(t?"btnExitFullScreen":"btnFullScreen"),onClick:this.handleClick},i.createElement(a.default,{type:t?"fullscreen-exit":"fullscreen"}))}return null},e.pluginName="full-screen",e.align="right",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(5),l=n(3),s=n(2),u=n(1),c=n(35),d=function(t){function e(e){var n=t.call(this,e)||this;return n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.state={show:!1},n}return r(e,t),e.prototype.show=function(){this.setState({show:!0})},e.prototype.hide=function(){this.setState({show:!1})},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-header",title:s.default.get("btnHeader"),onMouseEnter:this.show,onMouseLeave:this.hide},i.createElement(l.default,{type:"font-size"}),i.createElement(a.default,{show:this.state.show,onClose:this.hide},i.createElement(c.default,{onSelectHeader:function e(n){return t.editor.insertMarkdown(n)}})))},e.pluginName="header",e}(u.PluginComponent);e.default=d},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.handleHeader=function(t){var e=this.props.onSelectHeader;"function"==typeof e&&e(t)},e.prototype.render=function(){return i.createElement("ul",{className:"header-list"},i.createElement("li",{className:"list-item"},i.createElement("h1",{onClick:this.handleHeader.bind(this,"h1")},"H1")),i.createElement("li",{className:"list-item"},i.createElement("h2",{onClick:this.handleHeader.bind(this,"h2")},"H2")),i.createElement("li",{className:"list-item"},i.createElement("h3",{onClick:this.handleHeader.bind(this,"h3")},"H3")),i.createElement("li",{className:"list-item"},i.createElement("h4",{onClick:this.handleHeader.bind(this,"h4")},"H4")),i.createElement("li",{className:"list-item"},i.createElement("h5",{onClick:this.handleHeader.bind(this,"h5")},"H5")),i.createElement("li",{className:"list-item"},i.createElement("h6",{onClick:this.handleHeader.bind(this,"h6")},"H6")))},e}(i.Component);e.default=a},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s=n(1),u=n(4),c=n(8),d=n(37),p=function(t){function e(e){var n=t.call(this,e)||this;return n.inputFile=i.createRef(),n.onImageChanged=n.onImageChanged.bind(n),n.handleCustomImageUpload=n.handleCustomImageUpload.bind(n),n.handleImageUpload=n.handleImageUpload.bind(n),n.state={show:!1},n}return r(e,t),e.prototype.handleImageUpload=function(){var t;"function"==typeof this.editorConfig.onImageUpload?this.inputFile.current&&this.inputFile.current.click():this.editor.insertMarkdown("image")},e.prototype.onImageChanged=function(t){var e=this.editorConfig.onImageUpload;if(e){var n=c.default(t,e);this.editor.insertPlaceholder(n.placeholder,n.uploaded)}},e.prototype.handleCustomImageUpload=function(t){var e=this,n=this.editorConfig.onCustomImageUpload;if(n){var r=n.call(this,t);u.isPromise(r)&&r.then((function(t){t&&t.url&&e.editor.insertMarkdown("image",{target:t.text,imageUrl:t.url})}))}},e.prototype.render=function(){var t=this,e;return!!this.editorConfig.onCustomImageUpload?i.createElement("span",{className:"button button-type-image",title:l.default.get("btnImage"),onClick:this.handleCustomImageUpload},i.createElement(a.default,{type:"image"})):i.createElement("span",{className:"button button-type-image",title:l.default.get("btnImage"),onClick:this.handleImageUpload,style:{position:"relative"}},i.createElement(a.default,{type:"image"}),i.createElement(d.default,{accept:this.editorConfig.imageAccept||"",ref:this.inputFile,onChange:function e(n){n.persist(),n.target.files&&n.target.files.length>0&&t.onImageChanged(n.target.files[0])}}))},e.pluginName="image",e}(s.PluginComponent);e.default=p},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=function(t){function e(e){var n=t.call(this,e)||this;return n.timerId=void 0,n.locked=!1,n.input=i.createRef(),n}return r(e,t),e.prototype.click=function(){var t=this;!this.locked&&this.input.current&&(this.locked=!0,this.input.current.value="",this.input.current.click(),this.timerId&&window.clearTimeout(this.timerId),this.timerId=window.setTimeout((function(){t.locked=!1,window.clearTimeout(t.timerId),t.timerId=void 0}),200))},e.prototype.componentWillUnmount=function(){this.timerId&&window.clearTimeout(this.timerId)},e.prototype.render=function(){return i.createElement("input",{type:"file",ref:this.input,accept:this.props.accept,style:{position:"absolute",zIndex:-1,left:0,top:0,width:0,height:0,opacity:0},onChange:this.props.onChange})},e}(i.Component);e.default=a},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboard={key:"k",keyCode:75,aliasCommand:!0,withKey:["ctrlKey"],callback:function t(){return n.editor.insertMarkdown("link")}},n}return r(e,t),e.prototype.componentDidMount=function(){this.editorConfig.shortcuts&&this.editor.onKeyboard(this.handleKeyboard)},e.prototype.componentWillUnmount=function(){this.editor.offKeyboard(this.handleKeyboard)},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-link",title:l.default.get("btnLink"),onClick:function e(){return t.editor.insertMarkdown("link")}},i.createElement(a.default,{type:"link"}))},e.pluginName="link",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboard={key:"7",keyCode:55,withKey:["ctrlKey","shiftKey"],aliasCommand:!0,callback:function t(){return n.editor.insertMarkdown("order")}},n}return r(e,t),e.prototype.componentDidMount=function(){this.editorConfig.shortcuts&&this.editor.onKeyboard(this.handleKeyboard)},e.prototype.componentWillUnmount=function(){this.editor.offKeyboard(this.handleKeyboard)},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-ordered",title:l.default.get("btnOrdered"),onClick:function e(){return t.editor.insertMarkdown("order")}},i.createElement(a.default,{type:"list-ordered"}))},e.pluginName="list-ordered",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s,u=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboard={key:"8",keyCode:56,withKey:["ctrlKey","shiftKey"],aliasCommand:!0,callback:function t(){return n.editor.insertMarkdown("unordered")}},n}return r(e,t),e.prototype.componentDidMount=function(){this.editorConfig.shortcuts&&this.editor.onKeyboard(this.handleKeyboard)},e.prototype.componentWillUnmount=function(){this.editor.offKeyboard(this.handleKeyboard)},e.prototype.render=function(){var t=this;return i.createElement("span",{className:"button button-type-unordered",title:l.default.get("btnUnordered"),onClick:function e(){return t.editor.insertMarkdown("unordered")}},i.createElement(a.default,{type:"list-unordered"}))},e.pluginName="list-unordered",e}(n(1).PluginComponent);e.default=u},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s=n(1),u=n(42),c=600,d=function(t){function e(e){var n=t.call(this,e)||this;return n.handleKeyboards=[],n.lastPop=null,n.handleChange=n.handleChange.bind(n),n.handleRedo=n.handleRedo.bind(n),n.handleUndo=n.handleUndo.bind(n),n.handleKeyboards=[{key:"y",keyCode:89,withKey:["ctrlKey"],callback:n.handleRedo},{key:"z",keyCode:90,withKey:["metaKey","shiftKey"],callback:n.handleRedo},{key:"z",keyCode:90,aliasCommand:!0,withKey:["ctrlKey"],callback:n.handleUndo}],n.logger=new u.default,n}return r(e,t),e.prototype.handleUndo=function(){var t=this.logger.undo(this.editor.getMdValue());void 0!==t&&(this.pause(),this.lastPop=t,this.editor.setText(t),this.forceUpdate())},e.prototype.handleRedo=function(){var t=this.logger.redo();void 0!==t&&(this.lastPop=t,this.editor.setText(t),this.forceUpdate())},e.prototype.handleChange=function(t,e,n){var r=this;if(this.logger.getLast()!==t&&(null===this.lastPop||this.lastPop!==t)){if(this.logger.cleanRedo(),n)return this.logger.push(t),this.lastPop=null,void this.forceUpdate();this.timerId&&(window.clearTimeout(this.timerId),this.timerId=0),this.timerId=window.setTimeout((function(){r.logger.getLast()!==t&&(r.logger.push(t),r.lastPop=null,r.forceUpdate()),window.clearTimeout(r.timerId),r.timerId=0}),600)}},e.prototype.componentDidMount=function(){var t=this;this.editor.on("change",this.handleChange),this.handleKeyboards.forEach((function(e){return t.editor.onKeyboard(e)})),this.logger.initValue=this.editor.getMdValue(),this.forceUpdate()},e.prototype.componentWillUnmount=function(){var t=this;this.timerId&&window.clearTimeout(this.timerId),this.editor.off("change",this.handleChange),this.handleKeyboards.forEach((function(e){return t.editor.offKeyboard(e)}))},e.prototype.pause=function(){this.timerId&&(window.clearTimeout(this.timerId),this.timerId=void 0)},e.prototype.render=function(){var t=this.logger.getUndoCount()>1||this.logger.initValue!==this.editor.getMdValue(),e=this.logger.getRedoCount()>0;return i.createElement(i.Fragment,null,i.createElement("span",{className:"button button-type-undo "+(t?"":"disabled"),title:l.default.get("btnUndo"),onClick:this.handleUndo},i.createElement(a.default,{type:"undo"})),i.createElement("span",{className:"button button-type-redo "+(e?"":"disabled"),title:l.default.get("btnRedo"),onClick:this.handleRedo},i.createElement(a.default,{type:"redo"})))},e.pluginName="logger",e}(s.PluginComponent);e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=100,o=function(){function t(){this.record=[],this.recycle=[],this.initValue=""}return t.prototype.push=function(t){for(var e=this.record.push(t);this.record.length>100;)this.record.shift();return e},t.prototype.get=function(){return this.record},t.prototype.getLast=function(){var t=this.record.length;return this.record[t-1]},t.prototype.undo=function(t){var e=this.record.pop();if(void 0===e)return this.initValue;if(e!==t)return this.recycle.push(e),e;var n=this.record.pop();return void 0===n?(this.recycle.push(e),this.initValue):(this.recycle.push(e),n)},t.prototype.redo=function(){var t=this.recycle.pop();if(void 0!==t)return this.push(t),t},t.prototype.cleanRedo=function(){this.recycle=[]},t.prototype.getUndoCount=function(){return this.undo.length},t.prototype.getRedoCount=function(){return this.recycle.length},t}();e.default=o},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(3),l=n(2),s=n(1),u;!function(t){t[t.SHOW_ALL=0]="SHOW_ALL",t[t.SHOW_MD=1]="SHOW_MD",t[t.SHOW_HTML=2]="SHOW_HTML"}(u||(u={}));var c=function(t){function e(e){var n=t.call(this,e)||this;return n.handleClick=n.handleClick.bind(n),n.handleChange=n.handleChange.bind(n),n.state={view:n.editor.getView()},n}return r(e,t),Object.defineProperty(e.prototype,"isDisplay",{get:function t(){var e=this.editorConfig.canView;return!!e&&[e.html,e.md,e.both].filter((function(t){return t})).length>=2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function t(){var e=this.editorConfig.canView,n=this.state.view,r=[u.SHOW_ALL,u.SHOW_MD,u.SHOW_HTML];e&&(e.both||r.splice(r.indexOf(u.SHOW_ALL),1),e.md||r.splice(r.indexOf(u.SHOW_MD),1),e.html||r.splice(r.indexOf(u.SHOW_HTML),1));var o=u.SHOW_MD;if(n.html&&(o=u.SHOW_HTML),n.html&&n.md&&(o=u.SHOW_ALL),0===r.length)return o;if(1===r.length)return r[0];var i=r.indexOf(o);return i<r.length-1?r[i+1]:r[0]},enumerable:!1,configurable:!0}),e.prototype.handleClick=function(){switch(this.next){case u.SHOW_ALL:this.editor.setView({html:!0,md:!0});break;case u.SHOW_HTML:this.editor.setView({html:!0,md:!1});break;case u.SHOW_MD:this.editor.setView({html:!1,md:!0})}},e.prototype.handleChange=function(t){this.setState({view:t})},e.prototype.componentDidMount=function(){this.editor.on("viewchange",this.handleChange)},e.prototype.componentWillUnmount=function(){this.editor.off("viewchange",this.handleChange)},e.prototype.getDisplayInfo=function(){var t;switch(this.next){case u.SHOW_ALL:return{icon:"view-split",title:"All"};case u.SHOW_HTML:return{icon:"visibility",title:"Preview"};default:return{icon:"keyboard",title:"Editor"}}},e.prototype.render=function(){if(this.isDisplay){var t=this.getDisplayInfo();return i.createElement("span",{className:"button button-type-mode",title:l.default.get("btnMode"+t.title),onClick:this.handleClick},i.createElement(a.default,{type:t.icon}))}return null},e.pluginName="mode-toggle",e.align="right",e}(s.PluginComponent);e.default=c},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(5),l=n(3),s=n(2),u=n(1),c=n(45),d=function(t){function e(e){var n=t.call(this,e)||this;return n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.state={show:!1},n}return r(e,t),e.prototype.show=function(){this.setState({show:!0})},e.prototype.hide=function(){this.setState({show:!1})},e.prototype.render=function(){var t=this,e=this.editorConfig.table||this.props.config;return i.createElement("span",{className:"button button-type-table",title:s.default.get("btnTable"),onMouseEnter:this.show,onMouseLeave:this.hide},i.createElement(l.default,{type:"grid"}),i.createElement(a.default,{show:this.state.show,onClose:this.hide},i.createElement(c.default,{visibility:this.state.show,maxRow:e.maxRow,maxCol:e.maxCol,onSetTable:function e(n){return t.editor.insertMarkdown("table",n)}})))},e.pluginName="table",e.defaultConfig={maxRow:6,maxCol:6},e}(u.PluginComponent);e.default=d},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=function(t){function e(e){var n=t.call(this,e)||this;n.config={padding:3,width:20,height:20};var r=e.maxRow,o=void 0===r?5:r,i=e.maxCol,a=void 0===i?6:i;return n.state={maxRow:o,maxCol:a,list:n.formatTableModel(o,a)},n}return r(e,t),e.prototype.formatTableModel=function(t,e){var n;return void 0===t&&(t=0),void 0===e&&(e=0),new Array(t).fill(void 0).map((function(t){return new Array(e).fill(0)}))},e.prototype.calcWrapStyle=function(){var t=this.state,e=t.maxRow,n=t.maxCol,r=this.config,o=r.width,i=r.height,a=r.padding,l,s;return{width:(o+a)*n-a+"px",height:(i+a)*e-a+"px"}},e.prototype.calcItemStyle=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var n=this.config,r=n.width,o=n.height,i=n.padding,a,l;return{top:(o+i)*t+"px",left:(r+i)*e+"px"}},e.prototype.getList=function(t,e){var n;return this.state.list.map((function(n,r){return n.map((function(n,o){return r<=t&&o<=e?1:0}))}))},e.prototype.handleHover=function(t,e){this.setState({list:this.getList(t,e)})},e.prototype.handleSetTable=function(t,e){var n=this.props.onSetTable;"function"==typeof n&&n({row:t+1,col:e+1})},e.prototype.componentDidUpdate=function(t){!1===this.props.visibility&&t.visibility!==this.props.visibility&&this.setState({list:this.getList(-1,-1)})},e.prototype.render=function(){var t=this;return i.createElement("ul",{className:"table-list wrap",style:this.calcWrapStyle()},this.state.list.map((function(e,n){return e.map((function(e,r){return i.createElement("li",{className:"list-item "+(1===e?"active":""),key:n+"-"+r,style:t.calcItemStyle(n,r),onMouseOver:t.handleHover.bind(t,n,r),onClick:t.handleSetTable.bind(t,n,r)})}))})))},e}(i.Component);e.default=a},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),l=n(5),s=n(2),u=n(47),c=n(3),d=function(t){function e(e){var n=t.call(this,e)||this;return n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.handleChangeMapValue=n.handleChangeMapValue.bind(n),n.state={tabMapValue:n.getConfig("tabMapValue"),show:!1},n.handleKeyboard={key:"Tab",keyCode:9,aliasCommand:!0,withKey:[],callback:function t(){return n.editor.insertMarkdown("tab",{tabMapValue:n.state.tabMapValue})}},n}return r(e,t),e.prototype.show=function(){this.setState({show:!0})},e.prototype.hide=function(){this.setState({show:!1})},e.prototype.handleChangeMapValue=function(t){this.setState({tabMapValue:t})},e.prototype.componentDidMount=function(){this.editorConfig.shortcuts&&this.editor.onKeyboard(this.handleKeyboard)},e.prototype.componentWillUnmount=function(){this.editor.offKeyboard(this.handleKeyboard)},e.prototype.render=function(){return i.createElement("span",{className:"button button-type-header",title:s.default.get("selectTabMap"),onClick:this.show,onMouseLeave:this.hide},i.createElement(c.default,{type:"tab"}),i.createElement(l.default,{show:this.state.show,onClose:this.hide},i.createElement(u.default,{value:this.state.tabMapValue,onSelectMapValue:this.handleChangeMapValue})))},e.pluginName="tab-insert",e.defaultConfig={tabMapValue:1},e}(a.PluginComponent);e.default=d},function(t,e,n){"use strict";var r=this&&this.__extends||(o=function t(e,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o;Object.defineProperty(e,"__esModule",{value:!0});var i=n(48),a=n(0),l=n(2),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.handleSelectMapValue=function(t){var e=this.props.onSelectMapValue;"function"==typeof e&&e(t)},e.prototype.render=function(){var t=this,e=this.props.value;return a.createElement("ul",{className:"tab-map-list"},[1,2,4,8].map((function(n){return a.createElement("li",{key:n,className:i.default("list-item",{active:e===n})},a.createElement("div",{onClick:t.handleSelectMapValue.bind(t,n)},1===n?l.default.get("tab"):n+" "+l.default.get("spaces")))})))},e}(a.Component);e.default=s},function(t,e,n){var r,o;
|
6 | !function(){"use strict";var n={}.hasOwnProperty;function i(){for(var t=[],e=0;e<arguments.length;e++){var r=arguments[e];if(r){var o=typeof r;if("string"===o||"number"===o)t.push(r);else if(Array.isArray(r)){if(r.length){var a=i.apply(null,r);a&&t.push(a)}}else if("object"===o)if(r.toString===Object.prototype.toString)for(var l in r)n.call(r,l)&&r[l]&&t.push(l);else t.push(r.toString())}}return t.join(" ")}t.exports?(i.default=i,t.exports=i):void 0===(o=function(){return i}.apply(e,r=[]))||(t.exports=o)}()},function(t,e,n){"use strict";var r;n.r(e),n.d(e,"v1",(function(){return v})),n.d(e,"v3",(function(){return I})),n.d(e,"v4",(function(){return D})),n.d(e,"v5",(function(){return z})),n.d(e,"NIL",(function(){return Q})),n.d(e,"version",(function(){return $})),n.d(e,"validate",(function(){return s})),n.d(e,"stringify",(function(){return p})),n.d(e,"parse",(function(){return _}));var o=new Uint8Array(16);function i(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}var a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function l(t){return"string"==typeof t&&a.test(t)}for(var s=l,u=[],c=0;c<256;++c)u.push((c+256).toString(16).substr(1));function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(u[t[e+0]]+u[t[e+1]]+u[t[e+2]]+u[t[e+3]]+"-"+u[t[e+4]]+u[t[e+5]]+"-"+u[t[e+6]]+u[t[e+7]]+"-"+u[t[e+8]]+u[t[e+9]]+"-"+u[t[e+10]]+u[t[e+11]]+u[t[e+12]]+u[t[e+13]]+u[t[e+14]]+u[t[e+15]]).toLowerCase();if(!s(n))throw TypeError("Stringified UUID is invalid");return n}var p=d,f,h,y=0,m=0;function g(t,e,n){var r=e&&n||0,o=e||new Array(16),a=(t=t||{}).node||f,l=void 0!==t.clockseq?t.clockseq:h;if(null==a||null==l){var s=t.random||(t.rng||i)();null==a&&(a=f=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==l&&(l=h=16383&(s[6]<<8|s[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),c=void 0!==t.nsecs?t.nsecs:m+1,d=u-y+(c-m)/1e4;if(d<0&&void 0===t.clockseq&&(l=l+1&16383),(d<0||u>y)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");y=u,m=c,h=l;var g=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;o[r++]=g>>>24&255,o[r++]=g>>>16&255,o[r++]=g>>>8&255,o[r++]=255&g;var v=u/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=l>>>8|128,o[r++]=255&l;for(var b=0;b<6;++b)o[r+b]=a[b];return e||p(o)}var v=g;function b(t){if(!s(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}var _=b;function w(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}var C="6ba7b810-9dad-11d1-80b4-00c04fd430c8",O="6ba7b811-9dad-11d1-80b4-00c04fd430c8",E=function(t,e,n){function r(t,r,o,i){if("string"==typeof t&&(t=w(t)),"string"==typeof r&&(r=_(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+t.length);if(a.set(r),a.set(t,r.length),(a=n(a))[6]=15&a[6]|e,a[8]=63&a[8]|128,o){i=i||0;for(var l=0;l<16;++l)o[i+l]=a[l];return o}return p(a)}try{r.name=t}catch(t){}return r.DNS=C,r.URL=O,r};function M(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return P(x(S(t),8*t.length))}function P(t){for(var e=[],n=32*t.length,r="0123456789abcdef",o=0;o<n;o+=8){var i=t[o>>5]>>>o%32&255,a=parseInt(r.charAt(i>>>4&15)+r.charAt(15&i),16);e.push(a)}return e}function k(t){return 14+(t+64>>>9<<4)+1}function x(t,e){t[e>>5]|=128<<e%32,t[k(e)-1]=e;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,a=0;a<t.length;a+=16){var l=n,s=r,u=o,c=i;n=L(n,r,o,i,t[a],7,-680876936),i=L(i,n,r,o,t[a+1],12,-389564586),o=L(o,i,n,r,t[a+2],17,606105819),r=L(r,o,i,n,t[a+3],22,-1044525330),n=L(n,r,o,i,t[a+4],7,-176418897),i=L(i,n,r,o,t[a+5],12,1200080426),o=L(o,i,n,r,t[a+6],17,-1473231341),r=L(r,o,i,n,t[a+7],22,-45705983),n=L(n,r,o,i,t[a+8],7,1770035416),i=L(i,n,r,o,t[a+9],12,-1958414417),o=L(o,i,n,r,t[a+10],17,-42063),r=L(r,o,i,n,t[a+11],22,-1990404162),n=L(n,r,o,i,t[a+12],7,1804603682),i=L(i,n,r,o,t[a+13],12,-40341101),o=L(o,i,n,r,t[a+14],17,-1502002290),n=A(n,r=L(r,o,i,n,t[a+15],22,1236535329),o,i,t[a+1],5,-165796510),i=A(i,n,r,o,t[a+6],9,-1069501632),o=A(o,i,n,r,t[a+11],14,643717713),r=A(r,o,i,n,t[a],20,-373897302),n=A(n,r,o,i,t[a+5],5,-701558691),i=A(i,n,r,o,t[a+10],9,38016083),o=A(o,i,n,r,t[a+15],14,-660478335),r=A(r,o,i,n,t[a+4],20,-405537848),n=A(n,r,o,i,t[a+9],5,568446438),i=A(i,n,r,o,t[a+14],9,-1019803690),o=A(o,i,n,r,t[a+3],14,-187363961),r=A(r,o,i,n,t[a+8],20,1163531501),n=A(n,r,o,i,t[a+13],5,-1444681467),i=A(i,n,r,o,t[a+2],9,-51403784),o=A(o,i,n,r,t[a+7],14,1735328473),n=U(n,r=A(r,o,i,n,t[a+12],20,-1926607734),o,i,t[a+5],4,-378558),i=U(i,n,r,o,t[a+8],11,-2022574463),o=U(o,i,n,r,t[a+11],16,1839030562),r=U(r,o,i,n,t[a+14],23,-35309556),n=U(n,r,o,i,t[a+1],4,-1530992060),i=U(i,n,r,o,t[a+4],11,1272893353),o=U(o,i,n,r,t[a+7],16,-155497632),r=U(r,o,i,n,t[a+10],23,-1094730640),n=U(n,r,o,i,t[a+13],4,681279174),i=U(i,n,r,o,t[a],11,-358537222),o=U(o,i,n,r,t[a+3],16,-722521979),r=U(r,o,i,n,t[a+6],23,76029189),n=U(n,r,o,i,t[a+9],4,-640364487),i=U(i,n,r,o,t[a+12],11,-421815835),o=U(o,i,n,r,t[a+15],16,530742520),n=K(n,r=U(r,o,i,n,t[a+2],23,-995338651),o,i,t[a],6,-198630844),i=K(i,n,r,o,t[a+7],10,1126891415),o=K(o,i,n,r,t[a+14],15,-1416354905),r=K(r,o,i,n,t[a+5],21,-57434055),n=K(n,r,o,i,t[a+12],6,1700485571),i=K(i,n,r,o,t[a+3],10,-1894986606),o=K(o,i,n,r,t[a+10],15,-1051523),r=K(r,o,i,n,t[a+1],21,-2054922799),n=K(n,r,o,i,t[a+8],6,1873313359),i=K(i,n,r,o,t[a+15],10,-30611744),o=K(o,i,n,r,t[a+6],15,-1560198380),r=K(r,o,i,n,t[a+13],21,1309151649),n=K(n,r,o,i,t[a+4],6,-145523070),i=K(i,n,r,o,t[a+11],10,-1120210379),o=K(o,i,n,r,t[a+2],15,718787259),r=K(r,o,i,n,t[a+9],21,-343485551),n=j(n,l),r=j(r,s),o=j(o,u),i=j(i,c)}return[n,r,o,i]}function S(t){if(0===t.length)return[];for(var e=8*t.length,n=new Uint32Array(k(e)),r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}function j(t,e){var n=(65535&t)+(65535&e),r;return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function T(t,e){return t<<e|t>>>32-e}function N(t,e,n,r,o,i){return j(T(j(j(e,t),j(r,i)),o),n)}function L(t,e,n,r,o,i,a){return N(e&n|~e&r,t,e,o,i,a)}function A(t,e,n,r,o,i,a){return N(e&r|n&~r,t,e,o,i,a)}function U(t,e,n,r,o,i,a){return N(e^n^r,t,e,o,i,a)}function K(t,e,n,r,o,i,a){return N(n^(e|~r),t,e,o,i,a)}var V,H,I=E("v3",48,M);function R(t,e,n){var r=(t=t||{}).random||(t.rng||i)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=r[o];return e}return p(r)}var D=R;function W(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:return e^n^r;case 2:return e&n^e&r^n&r;case 3:return e^n^r}}function F(t,e){return t<<e|t>>>32-e}function B(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var r=unescape(encodeURIComponent(t));t=[];for(var o=0;o<r.length;++o)t.push(r.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var i=t.length/4+2,a=Math.ceil(i/16),l=new Array(a),s=0;s<a;++s){for(var u=new Uint32Array(16),c=0;c<16;++c)u[c]=t[64*s+4*c]<<24|t[64*s+4*c+1]<<16|t[64*s+4*c+2]<<8|t[64*s+4*c+3];l[s]=u}l[a-1][14]=8*(t.length-1)/Math.pow(2,32),l[a-1][14]=Math.floor(l[a-1][14]),l[a-1][15]=8*(t.length-1)&4294967295;for(var d=0;d<a;++d){for(var p=new Uint32Array(80),f=0;f<16;++f)p[f]=l[d][f];for(var h=16;h<80;++h)p[h]=F(p[h-3]^p[h-8]^p[h-14]^p[h-16],1);for(var y=n[0],m=n[1],g=n[2],v=n[3],b=n[4],_=0;_<80;++_){var w=Math.floor(_/20),C=F(y,5)+W(w,m,g,v)+b+e[w]+p[_]>>>0;b=v,v=g,g=F(m,30)>>>0,m=y,y=C}n[0]=n[0]+y>>>0,n[1]=n[1]+m>>>0,n[2]=n[2]+g>>>0,n[3]=n[3]+v>>>0,n[4]=n[4]+b>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}var G,q,z=E("v5",80,B),Q="00000000-0000-0000-0000-000000000000";function Y(t){if(!s(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}var $=Y}])})); |