!function(){var i=function(i){var e=jQuery,t=0,o=[],a=[],l="editormd-logo",n=[l,l+"-1x",l+"-2x",l+"-3x",l+"-4x",l+"-5x",l+"-6x",l+"-7x",l+"-8x"],s={"zh-cn":{toolbar:{emoji:"Emoji 表情"},dialog:{emoji:{title:"Emoji 表情"}}},"zh-tw":{toolbar:{emoji:"Emoji 表情"},dialog:{emoji:{title:"Emoji 表情"}}},en:{toolbar:{emoji:"Emoji"},dialog:{emoji:{title:"Emoji"}}}};i.fn.emojiDialog=function(){var r=this,d=this.cm,c=r.settings;if(!c.emoji)return void alert("settings.emoji == false");var m=c.pluginPath+"emoji-dialog/",h=this.editor,f=(d.getCursor(),d.getSelection(),this.classPrefix);e.extend(!0,this.lang,s[this.lang.name]),this.setToolbar();var g,v=this.lang,u=f+"emoji-dialog",j=v.dialog.emoji,p=['<div class="'+f+'emoji-dialog-box" style="width: 760px;height: 334px;margin-bottom: 8px;overflow: hidden;">','<div class="'+f+'tab"></div>',"</div>"].join("\n");d.focus(),h.find("."+u).length>0?(g=h.find("."+u),a=[],g.find("a").removeClass("selected"),this.dialogShowMask(g),this.dialogLockScreen(),g.show()):g=this.createDialog({name:u,title:j.title,width:800,height:475,mask:c.dialogShowMask,drag:c.dialogDraggable,content:p,lockScreen:c.dialogLockScreen,maskStyle:{opacity:c.dialogMaskOpacity,backgroundColor:c.dialogMaskBgColor},buttons:{enter:[v.buttons.enter,function(){return d.replaceSelection(a.join(" ")),this.hide().lockScreen(!1).hideMask(),!1}],cancel:[v.buttons.cancel,function(){return this.hide().lockScreen(!1).hideMask(),!1}]}});var b=["Github emoji","Twemoji","Font awesome","Editor.md logo"],w=g.find("."+f+"tab");if(""===w.html()){for(var x='<ul class="'+f+'tab-head">',k=0;k<4;k++){x+="<li"+(0===k?' class="active"':"")+'><a href="javascript:;">'+b[k]+"</a></li>"}x+="</ul>",w.append(x);for(var y='<div class="'+f+'tab-container">',S=0;S<4;S++){y+='<div class="'+f+'tab-box" style="height: 260px;overflow: hidden;overflow-y: auto;'+(0===S?"":"display:none;")+'"></div>'}y+="</div>",w.append(y)}var C=w.find("."+f+"tab-box"),E=["github-emoji","twemoji","font-awesome",l],M=function(){var l=E[t],n=o[l],s=C.eq(t);if(""===s.html()){var r=function(t,o){for(var a="editormd-logo"===o?"5":20,l=Math.ceil(t.length/a),n='<div class="'+f+'grid-table">',s=0;s<l;s++){for(var r='<div class="'+f+'grid-table-row">',d=0;d<a;d++){var c=e.trim(t[s*a+d]);if(void 0!==c&&""!==c){var m="",h="";if("github-emoji"===o){var g="+1"===c?"plus1":c;g="black_large_square"===g?"black_square":g,g="moon"===g?"waxing_gibbous_moon":g,g=i.emoji.path+g+i.emoji.ext,m='<img src="'+g+'" width="24" class="emoji" title="&#58;'+c+'&#58;" alt="&#58;'+c+'&#58;" />',r+='<a href="javascript:;" value=":'+c+':" title=":'+c+':" class="'+f+'emoji-btn">'+m+"</a>"}else if("twemoji"===o){var v=i.twemoji.path+c+i.twemoji.ext;m='<img src="'+v+'" width="24" title="twemoji-'+c+'" alt="twemoji-'+c+'" class="emoji twemoji" />',r+='<a href="javascript:;" value=":tw-'+c+':" title=":tw-'+c+':" class="'+f+'emoji-btn">'+m+"</a>"}else"font-awesome"===o?(h='<i class="fa fa-'+c+' fa-emoji" title="'+c+'"></i>',r+='<a href="javascript:;" value=":fa-'+c+':" title=":fa-'+c+':" class="'+f+'emoji-btn">'+h+"</a>"):"editormd-logo"===o&&(h='<i class="'+c+'" title="Editor.md logo ('+c+')"></i>',r+='<a href="javascript:;" value=":'+c+':" title=":'+c+':" style="width:20%;" class="'+f+'emoji-btn">'+h+"</a>")}else r+='<a href="javascript:;" value=""></a>'}r+="</div>",n+=r}return n+="</div>"};if(0===t)for(var d=0,c=n.length;d<c;d++){var m=0===d?' style="margin: 0 0 10px;"':' style="margin: 10px 0;"';s.append("<h4"+m+">"+n[d].category+"</h4>"),s.append(r(n[d].list,l))}else s.append(r(n,l));s.find("."+f+"emoji-btn").bind(i.mouseOrTouch("click","touchend"),function(){e(this).toggleClass("selected"),e(this).hasClass("selected")&&a.push(e(this).attr("value"))})}};o.length<1?("function"==typeof g.loading&&g.loading(!0),e.getJSON(m+"emoji.json?temp="+Math.random(),function(i){"function"==typeof g.loading&&g.loading(!1),o=i,o[l]=n,M()})):M(),w.find("li").bind(i.mouseOrTouch("click","touchend"),function(){var i=e(this);t=i.index(),i.addClass("active").siblings().removeClass("active"),C.eq(t).show().siblings().hide(),M()})}};"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=i:"function"==typeof define?define.amd?define(["editormd"],function(e){i(e)}):define(function(e){var t=e("./../../editormd");i(t)}):i(window.editormd)}();