text: !function(){"use strict";class e{constructor(e){this.context=e,this.events={},this.initializeSummernoteResources()}filterProps(e){return Object.getOwnPropertyNames(this.__proto__).filter(t=>t.includes(e))}initializeSummernoteResources(){this.filterProps("button.").forEach(e=>{this.context.memo(e,this[e].bind(this))}),this.filterProps("summernote.").forEach(e=>{this.events[e]=this[e].bind(this)})}invoke(){this.context.invoke.apply(this.context,[...arguments])}initialize(){}destroy(){}}let t=0;class i{constructor(e,t,i){this.tag=e,this.className=t,this.attr=i,this.initialize()}initialize(){if("string"!=typeof this.tag)this.el=this.tag;else{var e=document.createElement(this.tag);this.uniqId=t++,e.className=this.className;const s=this.attr||{};for(var i in s)e.setAttribute(i,s[i]);this.el=e}}closest(e){for(var t=this,s=!1;!(s=t.hasClass(e));){if(!t.el.parentNode)return null;t=new i(t.el.parentNode)}return s?t:null}static trim(e){return e.replace(/^\s+|\s+$/g,"")}removeClass(e){this.el.className=i.trim((" "+this.el.className+" ").replace(" "+e+" "," "))}hasClass(e){if(!this.el.className)return!1;return` ${this.el.className} `.indexOf(` ${e} `)>-1}addClass(e){return this.hasClass(e)||(this.el.className=`${this.el.className} ${e}`),this}html(e){if(0==arguments.length)return this.el.innerHTML;if(Array.isArray(e)){var t=e.map(e=>e.el?e.el:e);let i=document.createDocumentFragment();t.forEach(e=>{i.appendChild(e)}),this.el.innerHTML="",this.el.append(i)}else this.el.innerHTML=e;return this}empty(){return this.html("")}append(e){return"string"==typeof e?this.el.appendChild(document.createTextNode(e)):this.el.appendChild(e.el||e),this}appendTo(e){if("string"==typeof e&&(e=document.querySelector(e)),e){(e.el?e.el:e).appendChild(this.el)}return this}remove(){return this.el.parentNode&&this.el.parentNode.removeChild(this.el),this}text(){return this.el.textContent}css(e,t){if(2==arguments.length)this.el.style[e]=t;else if(1==arguments.length){if("string"==typeof e)return getComputedStyle(this.el)[e];var i=e||{};for(var s in i)this.el.style[s]=i[s]}return this}offset(){var e=this.el.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}}position(){return{top:parseFloat(this.el.style.top),left:parseFloat(this.el.style.left)}}width(){return this.el.offsetWidth}height(){return this.el.offsetHeight}dataKey(e){return this.uniqId+"."+(e||"")}val(e){return 0==arguments.length?this.el.value:(1==arguments.length&&(this.el.value=e),this)}int(e){return 0==arguments.length?parseInt(this.val(),10):(this.val(parseInt(e,10)),this)}float(e){return 0==arguments.length?parseFloat(this.val()):(this.val(parseFloat(e)),this)}show(){return this.css("display","block")}hide(){return this.css("display","none")}addEventListener(e,t,i){this.el.addEventListener(e,t,i||!1)}removeEventListener(e,t,i){this.el.removeEventListener(e,t)}}class s{constructor(e,t){this.uploader=e,this.context=t,this.options=this.context.options.fileuploader||{},this.server=this.options.server||{},this.files=[]}uploadToServer(e,t){let i=new FormData;i.append("summernote-file-index",t),i.append("summernote-file",e),new Request({url:"",params:"",formData:i,success:i=>{this.uploader.success(e,t)},updateProgress:i=>{this.uploader.updateProgress(e,t,i.loaded,i.total)},fail:i=>{this.uploader.fail(e,t)}}).send()}removeFile(e){this.files.splice(e,1)}getFiles(){return this.files}addFile(e){this.files.push(e)}addFiles(e){Array.isArray(e)||(e=[e]),e.forEach(e=>{this.addFile(e)})}uploadFile(e,t){var i=e;this.files[e]&&(i=this.files[e]),this.uploadToServer(i,t)}uploadAllFiles(e){(e||this.files||[]).forEach((e,t)=>{this.uploadFile(e,t)})}}class l{constructor(e,t){this.uploader=e,this.context=t,this.options=t.options.fileuploader||{},this.initialize()}initialize(){this.$el=new i("div","summernote-fileuploader-upload-panel"),this.$fileInput=new i("input","",{type:"file",multiple:!0,accept:this.options.accept||"*/*"}),this.$el.append(this.$fileInput),this.initializeEvent()}openFileDialog(){this.$fileInput.el.click()}changeFileInput(e){this.uploader.addFile([...e.target.files])}initializeEvent(){this.$$changeFileInput=this.changeFileInput.bind(this),this.$fileInput.addEventListener("change",this.$$changeFileInput)}appendTo(e){const t=document.querySelector(e);t&&this.$el.appendTo(t)}destroy(){this.$fileInput.removeEventListener("change",this.$$changeFileInput),this.$el.remove(),this.$fileInput=null,this.$el=null}}class n{constructor(e,t){this.uploader=e,this.context=t,this.initialize()}initialize(){this.$el=new i("div","summernote-fileuploader-preview-panel"),this.initializeEvent()}refresh(){this.render()}renderViewItem(e,t){return new i("div","view-item",{"data-index":t,"data-name":e.name,"data-type":e.type,"data-file":e}).html("item")}render(){var e=this.uploader.getFiles().map((e,t)=>this.renderViewItem(e,t));this.$el.html(e)}initializeEvent(){}destroy(){this.$el.remove(),this.$el=null}}$.extend($.summernote.plugins,{uploader:class extends e{constructor(e){super(e)}"button.fileuploader"(){return $.summernote.ui.button({contents:"Uploader",tooltip:"File Uploader",click:()=>{this.$panel.show(),this.invoke("editor.insertText","hello")}}).render()}"button.simple-fileuploader"(){return $.summernote.ui.button({contents:"Simple Uploader",tooltip:"File Uploader",click:()=>{this.openFileDialog()}}).render()}openFileDialog(){this.uploadPanel.openFileDialog()}"summernote.init"(e,t){console.log("summernote initalized")}"summernote.keyup"(e,t){console.log("summernote keyup",t)}initialize(){super.initialize(),this.previewPanel=new n(this,this.context),this.uploadPanel=new l(this,this.context),this.fileManager=new s(this,this.context),this.$panel=new i("div","summernote-fileuploader",{droppable:!0}),this.$panel.append(this.uploadPanel.$el),this.$panel.append(this.previewPanel.$el),this.$panel.appendTo("body"),this.initializeEvent()}drop(e){console.log("drop",e)}dragover(e){console.log("dragover",e)}initializeEvent(){this.$$drop=this.drop.bind(this),this.$$dragover=this.dragover.bind(this),this.$panel.addEventListener("drop",this.$$drop),this.$panel.addEventListener("dragover",this.$$dragover)}destroy(){super.destroy(),this.$panel.removeEventListener("drop",this.$$drop),this.$panel.removeEventListener("dragover",this.$$dragover),this.uploadPanel.destroy(),this.previewPanel.destroy(),this.uploadPanel=null,this.previewPanel=null,this.$panel.remove(),this.$panel=null}addFile(e){Array.isArray(e)||(e=[e]),this.fileManager.addFiles(e),this.previewPanel.refresh()}getFiles(){return this.fileManager.getFiles()}upload(e,t){}}})}();
  