!function(a){"use strict";function b(b){return a.grep(b,function(c,d){return c.length&&a.inArray(c,b)===d})}var c={bodyClass:"xe_content editable",toolbarCanCollapse:!0,toolbarGroups:[{name:"clipboard",groups:["undo","clipboard"]},{name:"editing",groups:["find","selection"]},{name:"links"},{name:"insert"},{name:"tools"},{name:"document",groups:["mode"]},"/",{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},"/",{name:"styles"},{name:"colors"},{name:"xecomponent"},{name:"others"}],allowedContent:!0,removePlugins:"stylescombo,language,bidi,flash,pagebreak",removeButtons:"Save,Preview,Print,Cut,Copy,Paste",uiColor:"#EFF0F0"},d=xe.createApp("XeCkEditor",{ckeconfig:{},editor_sequence:null,init:function(){var a=this;CKEDITOR.env.iOS&&(c.removePlugins+=",enterkey"),CKEDITOR.on("instanceCreated",function(b){a.cast("CKEDITOR_CREATED")}),CKEDITOR.on("ready",function(b){a.cast("CKEDITOR_READY")}),CKEDITOR.on("instanceReady",function(b){a.cast("CKEDITOR_INSTANCE_READY")}),CKEDITOR.on("instanceLoaded",function(b){a.cast("CKEDITOR_LOADED")})},editorInit:function(d,e){var f=this,g=d,h=g.closest("form"),i=h.find(e.content_field),j=g.data();g.data().editorSequence;this.ckeconfig=a.extend({},c,e.ckeconfig||{}),this.editor_sequence=j.editorSequence,h.attr("editor_sequence",j.editorSequence),CKEDITOR.env.mobile&&(CKEDITOR.env.isCompatible=!0);var k=CKEDITOR.appendTo(g[0],{},i.val());k.on("customConfigLoaded",function(d){if(k.config=a.extend({},d.editor.config,f.ckeconfig),a.isFunction(CKEDITOR.editorConfig)){var g={};CKEDITOR.editorConfig(g),a.each(g,function(a,b){k.config[a]=b})}if(d.editor.config.bodyClass){var h=d.editor.config.bodyClass.split(" ");h.push(c.bodyClass),h=b(h),k.config.bodyClass=h.join(" ")}if(e.loadXeComponent){var i=d.editor.config.extraPlugins.split(",");i.push("xe_component"),i=b(i),k.config.extraPlugins=i.join(",")}if(CKEDITOR.env.iOS&&d.editor.config.removePlugins){var j=d.editor.config.removePlugins.split(",");j.push("enterkey"),j=b(j),k.config.removePlugins=j.join(",")}e.enableToolbar||(k.config.toolbar=[])}),g.data("cke_instance",k),window.editorRelKeys[j.editorSequence]={},window.editorRelKeys[j.editorSequence].primary=h.find("[name="+j.editorPrimaryKeyName+"]")[0],window.editorRelKeys[j.editorSequence].content=h.find("[name="+j.editorContentKeyName+"]")[0],window.editorRelKeys[j.editorSequence].func=function(a){return f.getContent.call(f,a)},window.editorRelKeys[j.editorSequence].pasteHTML=function(a){k.insertHtml(a,"html")}},getContent:function(a){var b=this,c=_getCkeInstance(a).getData();return b.cast("GET_CONTENT",[c]),c},getInstance:function(a){return CKEDITOR.instances[a]},API_EDITOR_CREATED:function(){}});a.fn.XeCkEditor=function(a){var b=new d(this.eq(0),a);return b&&(xe.registerApp(b),b.editorInit(this.eq(0),a)),b},window.xe.XeCkEditor=function(){return new d}}(jQuery);