// WoltLabPage.js
$.Redactor.prototype.WoltLabPage=function(){"use strict";return{init:function(){var t=this.button.add("woltlabPage","");require(["WoltLabSuite/Core/Ui/Redactor/Page"],function(e){new e(this,t[0])}.bind(this))}}};
// WoltLabPaste.js
-$.Redactor.prototype.WoltLabPaste=function(){"use strict";return{init:function(){var e=null,t=!1,i=document.documentMode&&"object"==typeof window.clipboardData,r=this.paste.init;this.paste.init=function(a){var n="pre"===this.opts.type||this.utils.isCurrentOrParent("pre");if(t=!n&&this.utils.isCurrentOrParent("kbd"),n||t){e=i?window.clipboardData.getData("Text"):a.originalEvent.clipboardData.getData("text/plain");var s=this.clean.encodeEntities;this.clean.encodeEntities=function(e){return this.clean.encodeEntities=s,WCF.String.escapeHTML(e)}.bind(this)}r.call(this,a)}.bind(this);var a=this.paste.getPasteBoxCode;this.paste.getPasteBoxCode=function(r){var n=a.call(this,r);return t?e:!r||n&&!i?n:e}.bind(this),this.core.editor().off("paste.redactor").on("paste.redactor",this.paste.init.bind(this)),this.paste.detectClipboardUpload=function(e){e=e.originalEvent||e;var t;if(i){if(!window.clipboardData.files.length)return!1;t=window.clipboardData.files.item(0)}else{if(this.detect.isFirefox())return!1;var r=e.clipboardData,a=r.types;if(Array.isArray(a)&&-1!==a.indexOf("public.tiff"))return e.preventDefault(),!1;if(!r.items||!r.items.length)return;var n=!1;if(t=r.items[0].getAsFile(),null===t&&(this.detect.isWebkit()&&r.items.length>1&&(t=r.items[1].getAsFile(),n=!0,null!==t&&e.preventDefault()),null===t))return!1}var s=new FileReader;return s.readAsDataURL(t),s.onload=this.paste.insertFromClipboard.bind(this),n===!1}.bind(this),this.paste.insertFromClipboard=function(e){window.FormData&&(this.buffer.set(),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this.$element[0].id,{blob:this.utils.dataURItoBlob(e.target.result)}),this.rtePaste=!1)}.bind(this);var n="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",s=this.paste.insert;this.paste.insert=function(e,i){if(t&&(i.pre=!0),i.pre)return s.call(this,e,i);if(this.utils.isCurrentOrParent("kbd")){s.call(this,e,i);var r=this.selection.current();r.nodeType===Node.TEXT_NODE&&(r=r.parentNode);for(var a=r.closest("kbd"),l=elByTag("p",a);l.length;)l[0].outerHTML=l[0].innerHTML;var o=a.innerHTML.split(/<br\s*\/?>/);if(o.length>1){for(var d=this.selection.block(),c=1,h=o.length;h>c;c++){var p=elCreate(d.nodeName);p.innerHTML="<kbd>"+o[c]+(c===h-1?this.marker.html():"")+"</kbd>",d.parentNode.insertBefore(p,d.nextSibling),d=p}a.innerHTML=o[0],this.selection.restore()}}else{var u=elCreate("div");u.innerHTML=e;var f=[];i.pre||i.text||elBySelAll("img",u,function(e){var t=e.src;if(0===t.indexOf("data:image")&&t!==n){e.src=n;var i=WCF.getUUID();elData(e,"uuid",i),f.push({src:t,uuid:i}),elHide(e)}}.bind(this)),elBySelAll(".redactor-selection-marker",u,elRemove),u.appendChild(elCreate("woltlab-selection-marker")),s.call(this,u.innerHTML,i);var b=elBySel("woltlab-selection-marker",this.$editor[0]);if(b){var A=document.createRange();A.setStartBefore(b),A.setEndBefore(b);var v=window.getSelection();v.removeAllRanges(),v.addRange(A),elRemove(b)}f.length&&window.setTimeout(function(){for(var e,t,i=0,r=f.length;r>i;i++)e=f[i],t=elBySel('img[data-uuid="'+e.uuid+'"]',this.$editor[0]),t&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this.$element[0].id,{blob:this.utils.dataURItoBlob(e.src),replace:t})}.bind(this),50),this.rtePaste=!1}}.bind(this),this.paste.clipboardUpload=function(){}}}};
+$.Redactor.prototype.WoltLabPaste=function(){"use strict";return{init:function(){var e=null,t=!1,i=document.documentMode&&"object"==typeof window.clipboardData,r=this.paste.init;this.paste.init=function(a){var n="pre"===this.opts.type||this.utils.isCurrentOrParent("pre");if(t=!n&&this.utils.isCurrentOrParent("kbd"),n||t){e=i?window.clipboardData.getData("Text"):a.originalEvent.clipboardData.getData("text/plain");var s=this.clean.encodeEntities;this.clean.encodeEntities=function(e){return this.clean.encodeEntities=s,WCF.String.escapeHTML(e)}.bind(this)}r.call(this,a)}.bind(this);var a=this.paste.getPasteBoxCode;this.paste.getPasteBoxCode=function(r){var n=a.call(this,r);return t?e:!r||n&&!i?n:e}.bind(this),this.core.editor().off("paste.redactor").on("paste.redactor",this.paste.init.bind(this)),this.paste.detectClipboardUpload=function(e){e=e.originalEvent||e;var t;if(i){if(!window.clipboardData.files.length)return!1;t=window.clipboardData.files.item(0)}else{if(this.detect.isFirefox())return!1;var r=e.clipboardData,a=r.types;if(Array.isArray(a)&&-1!==a.indexOf("public.tiff"))return e.preventDefault(),!1;if(!r.items||!r.items.length)return;var n=!1;if(t=r.items[0].getAsFile(),null===t&&(this.detect.isWebkit()&&r.items.length>1&&(t=r.items[1].getAsFile(),n=!0,null!==t&&e.preventDefault()),null===t))return!1}var s=new FileReader;return s.readAsDataURL(t),s.onload=this.paste.insertFromClipboard.bind(this),n===!1}.bind(this),this.paste.insertFromClipboard=function(e){window.FormData&&(this.buffer.set(),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this.$element[0].id,{blob:this.utils.dataURItoBlob(e.target.result)}),this.rtePaste=!1)}.bind(this);var n="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",s=this.paste.insert;this.paste.insert=function(e,i){if(t&&(i.pre=!0),this.utils.isCurrentOrParent("kbd")){s.call(this,e,i);var r=this.selection.current();r.nodeType===Node.TEXT_NODE&&(r=r.parentNode);for(var a=r.closest("kbd"),l=elByTag("p",a);l.length;)l[0].outerHTML=l[0].innerHTML;var o=a.innerHTML.split(/<br\s*\/?>/);if(o.length>1){for(var d=this.selection.block(),c=1,h=o.length;h>c;c++){var p=elCreate(d.nodeName);p.innerHTML="<kbd>"+o[c]+(c===h-1?this.marker.html():"")+"</kbd>",d.parentNode.insertBefore(p,d.nextSibling),d=p}a.innerHTML=o[0],this.selection.restore()}}else{if(i.pre)return s.call(this,e,i);var u=elCreate("div");u.innerHTML=e;var f=[];i.pre||i.text||elBySelAll("img",u,function(e){var t=e.src;if(0===t.indexOf("data:image")&&t!==n){e.src=n;var i=WCF.getUUID();elData(e,"uuid",i),f.push({src:t,uuid:i}),elHide(e)}}.bind(this)),elBySelAll(".redactor-selection-marker",u,elRemove),u.appendChild(elCreate("woltlab-selection-marker")),s.call(this,u.innerHTML,i);var b=elBySel("woltlab-selection-marker",this.$editor[0]);if(b){var A=document.createRange();A.setStartBefore(b),A.setEndBefore(b);var v=window.getSelection();v.removeAllRanges(),v.addRange(A),elRemove(b)}f.length&&window.setTimeout(function(){for(var e,t,i=0,r=f.length;r>i;i++)e=f[i],t=elBySel('img[data-uuid="'+e.uuid+'"]',this.$editor[0]),t&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this.$element[0].id,{blob:this.utils.dataURItoBlob(e.src),replace:t})}.bind(this),50),this.rtePaste=!1}}.bind(this),this.paste.clipboardUpload=function(){}}}};
// WoltLabQuote.js
$.Redactor.prototype.WoltLabQuote=function(){"use strict";return{init:function(){var t=this.button.add("woltlabQuote","");this.WoltLabBlock.register("woltlab-quote",!0),this.opts.replaceTags.blockquote="woltlab-quote",this.opts.activeButtonsStates["woltlab-quote"]="woltlabQuote",require(["WoltLabSuite/Core/Ui/Redactor/Quote"],function(o){new o(this,t)}.bind(this))}}};
// WoltLabReply.js