!function(e){if(void 0===e)throw Error("jQuery should be loaded before CKEditor jQuery adapter.");if("undefined"==typeof CKEDITOR)throw Error("CKEditor should be loaded before CKEditor jQuery adapter.");CKEDITOR.config.jqueryOverrideVal=void 0===CKEDITOR.config.jqueryOverrideVal||CKEDITOR.config.jqueryOverrideVal,e.extend(e.fn,{ckeditorGet:function(){var e=this.eq(0).data("ckeditorInstance");if(!e)throw"CKEditor is not initialized yet, use ckeditor() with a callback.";return e},ckeditor:function(t,r){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if(!e.isFunction(t)){var n=r;r=t,t=n}var i=[];r=r||{},this.each((function(){var n=e(this),o=n.data("ckeditorInstance"),a=n.data("_ckeditorInstanceLock"),d=this,c=new e.Deferred;i.push(c.promise()),o&&!a?(t&&t.apply(o,[this]),c.resolve()):a?o.once("instanceReady",(function(){setTimeout((function e(){o.element?(o.element.$==d&&t&&t.apply(o,[d]),c.resolve()):setTimeout(e,100)}),0)}),null,null,9999):((r.autoUpdateElement||void 0===r.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)&&(r.autoUpdateElementJquery=!0),r.autoUpdateElement=!1,n.data("_ckeditorInstanceLock",!0),o=e(this).is("textarea")?CKEDITOR.replace(d,r):CKEDITOR.inline(d,r),n.data("ckeditorInstance",o),o.on("instanceReady",(function(r){var i=r.editor;setTimeout((function o(){if(i.element){if(r.removeListener(),i.on("dataReady",(function(){n.trigger("dataReady.ckeditor",[i])})),i.on("setData",(function(e){n.trigger("setData.ckeditor",[i,e.data])})),i.on("getData",(function(e){n.trigger("getData.ckeditor",[i,e.data])}),999),i.on("destroy",(function(){n.trigger("destroy.ckeditor",[i])})),i.on("save",(function(){return e(d.form).submit(),!1}),null,null,20),i.config.autoUpdateElementJquery&&n.is("textarea")&&e(d.form).length){var a=function(){n.ckeditor((function(){i.updateElement()}))};e(d.form).submit(a),e(d.form).bind("form-pre-serialize",a),n.bind("destroy.ckeditor",(function(){e(d.form).unbind("submit",a),e(d.form).unbind("form-pre-serialize",a)}))}i.on("destroy",(function(){n.removeData("ckeditorInstance")})),n.removeData("_ckeditorInstanceLock"),n.trigger("instanceReady.ckeditor",[i]),t&&t.apply(i,[d]),c.resolve()}else setTimeout(o,100)}),0)}),null,null,9999))}));var o=new e.Deferred;return this.promise=o.promise(),e.when.apply(this,i).then((function(){o.resolve()})),this.editor=this.eq(0).data("ckeditorInstance"),this}}),CKEDITOR.config.jqueryOverrideVal&&(e.fn.val=CKEDITOR.tools.override(e.fn.val,(function(t){return function(r){if(arguments.length){var n=this,i=[],o=this.each((function(){var n=e(this),o=n.data("ckeditorInstance");if(n.is("textarea")&&o){var a=new e.Deferred;return o.setData(r,(function(){a.resolve()})),i.push(a.promise()),!0}return t.call(n,r)}));if(i.length){var a=new e.Deferred;return e.when.apply(this,i).done((function(){a.resolveWith(n)})),a.promise()}return o}var d=(o=e(this).eq(0)).data("ckeditorInstance");return o.is("textarea")&&d?d.getData():t.call(o)}})))}(window.jQuery);