!function(a,b){"use strict";var c={"font-styles":"
Normal text ",emphasis:"",lists:"",link:"",image:"",html:""},d={"font-styles":!0,emphasis:!0,lists:!0,html:!1,link:!0,image:!0,events:{},parserRules:{tags:{b:{},i:{},br:{},ol:{},ul:{},li:{},h1:{},h2:{},u:1,img:{check_attributes:{width:"numbers",alt:"alt",src:"url",height:"numbers"}},a:{set_attributes:{target:"_blank",rel:"nofollow"},check_attributes:{href:"url"}}}}},e=function(b,c){this.el=b,this.toolbar=this.createToolbar(b,c||d),this.editor=this.createEditor(c),window.editor=this.editor,a("iframe.wysihtml5-sandbox").each(function(b,c){a(c.contentWindow).off("focus.wysihtml5").on({"focus.wysihtml5":function(){a("li.dropdown").removeClass("open")}})})};e.prototype={constructor:e,createEditor:function(a){var c=d.parserRules;a&&a.parserRules&&(c=a.parserRules);var e=new b.Editor(this.el.attr("id"),{toolbar:this.toolbar.attr("id"),parserRules:c});if(a&&a.events)for(var f in a.events)e.on(f,a.events[f]);return e},createToolbar:function(b,e){var f=this,g=a("",{id:b.attr("id")+"-wysihtml5-toolbar","class":"wysihtml5-toolbar",style:"display:none"});for(var h in d){var i=!1;e[h]!=undefined?e[h]==1&&(i=!0):i=d[h],i==1&&(g.append(c[h]),h=="html"&&this.initHtml(g),h=="link"&&this.initInsertLink(g),h=="image"&&this.initInsertImage(g))}var f=this;return g.find("a[data-wysihtml5-command='formatBlock']").click(function(b){var c=a(b.srcElement);f.toolbar.find(".current-font").text(c.html())}),this.el.before(g),g},initHtml:function(a){var b="a[data-wysihtml5-action='change_view']";a.find(b).click(function(c){a.find("a.btn").not(b).toggleClass("disabled")})},initInsertImage:function(a){var b=this,c=a.find(".bootstrap-wysihtml5-insert-image-modal"),d=c.find(".bootstrap-wysihtml5-insert-image-url"),e=c.find("a.btn-primary"),f=d.val(),g=function(){var a=d.val();d.val(f),b.editor.composer.commands.exec("insertImage",a)};d.keypress(function(a){a.which==13&&(g(),c.modal("hide"))}),e.click(g),c.on("shown",function(){d.focus()}),c.on("hide",function(){b.editor.currentView.element.focus()}),a.find("a[data-wysihtml5-command=insertImage]").click(function(){c.modal("show")})},initInsertLink:function(a){var b=this,c=a.find(".bootstrap-wysihtml5-insert-link-modal"),d=c.find(".bootstrap-wysihtml5-insert-link-url"),e=c.find("a.btn-primary"),f=d.val(),g=function(){var a=d.val();d.val(f),b.editor.composer.commands.exec("createLink",{href:a,target:"_blank",rel:"nofollow"})},h=!1;d.keypress(function(a){a.which==13&&(g(),c.modal("hide"))}),e.click(g),c.on("shown",function(){d.focus()}),c.on("hide",function(){b.editor.currentView.element.focus()}),a.find("a[data-wysihtml5-command=createLink]").click(function(){c.modal("show")})}},a.fn.wysihtml5=function(b){return this.each(function(){var c=a(this);c.data("wysihtml5",new e(c,b))})},a.fn.wysihtml5.Constructor=e}(window.jQuery,window.wysihtml5);