!function(){var t=null;UM.registerWidget("formula",{tpl:'<link type="text/css" rel="stylesheet" href="<%=formula_url%>formula.css"><div class="edui-formula-wrapper"><ul class="edui-tab-nav"></ul><div class="edui-tab-content"></div></div>',sourceData:{formula:{common:["{/}frac{ }{ }","^{ }/_{ }","x^{ }","x_{ }","x^{ }_{ }","{/}bar{ }","{/}sqrt{ }","{/}nthroot{ }{ }","{/}sum^{ }_{n=}","{/}sum","{/}log_{ }","{/}ln","{/}int_{ }^{ }","{/}oint_{ }^{ }"],symbol:["+","-","{/}pm","{/}times","{/}ast","{/}div","/","{/}bigtriangleup","=","{/}ne","{/}approx",">","<","{/}ge","{/}le","{/}infty","{/}cap","{/}cup","{/}because","{/}therefore","{/}subset","{/}supset","{/}subseteq","{/}supseteq","{/}nsubseteq","{/}nsupseteq","{/}in","{/}ni","{/}notin","{/}mapsto","{/}leftarrow","{/}rightarrow","{/}Leftarrow","{/}Rightarrow","{/}leftrightarrow","{/}Leftrightarrow"],letter:["{/}alpha","{/}beta","{/}gamma","{/}delta","{/}varepsilon","{/}varphi","{/}lambda","{/}mu","{/}rho","{/}sigma","{/}omega","{/}Gamma","{/}Delta","{/}Theta","{/}Lambda","{/}Xi","{/}Pi","{/}Sigma","{/}Upsilon","{/}Phi","{/}Psi","{/}Omega"]}},initContent:function(e,a){var i=this,n=i.sourceData.formula,r=e.getLang("formula").static,u=UMEDITOR_CONFIG.UMEDITOR_HOME_URL+"dialogs/formula/",o=$.extend({},r,{formula_url:u}),s=i.root();if(i.inited)return void i.preventDefault();i.inited=!0,t=e,i.$widget=a,s.html($.parseTmpl(i.tpl,o)),i.tabs=$.eduitab({selector:"#edui-formula-tab-Jpanel"});var l=[],d=0,c=0,m=i.root().find(".edui-tab-content");$.each(n,function(t,e){var a=[];$.each(e,function(t,e){a.push('<li class="edui-formula-latex-item" data-latex="'+e+'" style="background-position:-'+30*d+"px -"+30*c+'px"></li>'),++d>=8&&(++c,d=0)}),c++,d=0,m.append('<div class="edui-tab-pane"><ul>'+a.join("")+"</ul>"),l.push('<li class="edui-tab-item"><a href="javascript:void(0);" class="edui-tab-text">'+r["lang_tab_"+t]+"</a></li>")}),l.push('<li class="edui-formula-clearboth"></li>'),s.find(".edui-tab-nav").html(l.join("")),s.find(".edui-tab-content").append('<div class="edui-formula-clearboth"></div>'),i.switchTab(0)},initEvent:function(){var t=this;t.root().on("click",function(){return!1}),t.root().find(".edui-tab-nav").delegate(".edui-tab-item","click",function(){return t.switchTab(this),!1}),t.root().find(".edui-tab-pane").delegate(".edui-formula-latex-item","click",function(){var e=$(this),a=e.attr("data-latex")||"";return a&&t.insertLatex(a.replace("{/}","\\")),t.$widget.edui().hide(),!1})},switchTab:function(t){var e=this,a=e.root(),t=$.isNumeric(t)?t:$.inArray(t,a.find(".edui-tab-nav .edui-tab-item"));a.find(".edui-tab-nav .edui-tab-item").removeClass("edui-active").eq(t).addClass("edui-active"),a.find(".edui-tab-content .edui-tab-pane").removeClass("edui-active").eq(t).addClass("edui-active"),e.autoHeight(0)},autoHeight:function(){this.$widget.height(this.root()+2)},insertLatex:function(e){t.execCommand("formula",e)},width:350,height:400})}();