!function(e,t){"use strict";function n(e,t){for(var n,i=[],r=0;r]+src=\"data:image[^>]+>/g,"")),n=i.fire("BeforePastePreProcess",{content:e}),n=i.fire("PastePreProcess",n),e=n.content,!n.isDefaultPrevented()){if(i.hasEventListeners("PastePostProcess")&&!n.isDefaultPrevented()){var a=r.add(i.getBody(),"div",{style:"display:none"},e);n=i.fire("PastePostProcess",{node:a}),r.remove(a),e=n.node.innerHTML}if(!n.isDefaultPrevented()){var o=i.selection.getNode();if("PRE"==o.nodeName){if(!t)try{t=$(e).text()}catch(s){}t=t.replace(//g,">"),i.insertRawContent(t)}else i.insertContent(e)}}}function a(e){var t=e;e=i.dom.encode(e).replace(/\r\n/g,"\n");var a=i.dom.getParent(i.selection.getStart(),i.dom.isBlock),o=i.settings.forced_root_block,s;o&&(s=i.dom.createHTML(o,i.settings.forced_root_block_attrs),s=s.substr(0,s.length-3)+">"),a&&/^(PRE|DIV)$/.test(a.nodeName)||!o?e=n.filter(e,[[/\n/g,"
"]]):(e=n.filter(e,[[/\n\n/g,"

"+s],[/^(.*<\/p>)(

)$/,s+"$1"],[/\n/g,"
"]]),-1!=e.indexOf("

")&&(e=s+e)),r(e,t)}function o(){var e=i.dom,t=i.getBody(),n=i.dom.getViewPort(i.getWin()),r=i.inline?t.scrollTop:n.y,a=i.inline?t.clientHeight:n.h;s(),f=e.add(i.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"1",style:"position: absolute; top: "+(r+20)+"px;width: 10px; height: "+(a-40)+"px; overflow: hidden; opacity: 0"},v),e.setStyle(f,"left","rtl"==e.getStyle(t,"direction",!0)?65535:-65535),e.bind(f,"beforedeactivate focusin focusout",function(e){e.stopPropagation()}),g=i.selection.getRng(),f.focus(),i.selection.select(f,!0)}function s(){f&&(i.dom.unbind(f),i.dom.remove(f),g&&i.selection.setRng(g)),h=!1,f=g=null}function l(){return f?f.innerHTML:v}function c(e){var t={},n=e.clipboardData||i.getDoc().dataTransfer;if(n&&n.types){t["text/plain"]=n.getData("Text");for(var r=0;r600&&(t.width=600),a.width=t.width,r.setAttrib(o,"width",a.width)),r.setAttrib(o,"src",e.Id)}),void r.setAttrib(o,"id",null)):void r.remove(o)})},r.readAsDataURL(n),!0}return!1}var u=this,f,g,m=0,v="%MCEPASTEBIN%",h;i.on("keydown",function(n){if(!n.isDefaultPrevented()&&(t.metaKeyPressed(n)&&86==n.keyCode||n.shiftKey&&45==n.keyCode)){if(h=n.shiftKey&&86==n.keyCode,n.stopImmediatePropagation(),m=(new Date).getTime(),e.ie&&h)return n.preventDefault(),void i.fire("paste",{ieFake:!0});o()}}),i.on("paste",function(t){var d=c(t),g=(new Date).getTime()-m<100,y="text"==u.pasteFormat||h;g||t.preventDefault(),!e.ie||g&&!t.ieFake||(o(),i.dom.bind(f,"paste",function(e){e.stopPropagation()}),i.getDoc().execCommand("Paste",!1,null),d["text/html"]=l(),s()),setTimeout(function(){var e=l();return f&&f.firstChild&&"mcepastebin"===f.firstChild.id&&(y=!0),s(),e!=v&&g||(e=d["text/html"]||d["text/plain"]||v,e!=v)?void(y?a(d["text/plain"]||n.innerText(e)):r(e,d["text/plain"])):void(g||i.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."))},0);try{if(p(t))return}catch(t){}}),u.pasteHtml=r,u.pasteText=a}}),i(m,[c,d,p,v,h,l],function(e,t,n,i,r,a){function o(e){return/class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(e)}function s(s){var l=s.settings;s.on("BeforePastePreProcess",function(c){function d(e){function t(e,t,o,s){var l=e._listLevel||a;l!=a&&(a>l?n&&(n=n.parent.parent):(i=n,n=null)),n&&n.name==o?n.append(e):(i=i||n,n=new r(o,1),s>1&&n.attr("start",""+s),e.wrap(n)),e.name="li",t.value="";var c=t.next;c&&3==c.type&&(c.value=c.value.replace(/^\u00a0+/,"")),l>a&&i&&i.lastChild.append(n),a=l}for(var n,i,a=1,o=e.getAll("p"),s=0;s/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\xa0"],[/([\s\u00a0]*)<\/span>/gi,function(e,t){return t.length>0?t.replace(/./," ").slice(Math.floor(t.length/2)).split("").join("\xa0"):""}]]);var m=l.paste_word_valid_elements;m||(m="@[style],-strong/b,-em/i,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-table,-tr,-td[colspan|rowspan],-th,-thead,-tfoot,-tbody,-a[!href],sub,sup,strike,br");var v=new n({valid_elements:m}),h=new t({},v);h.addAttributeFilter("style",function(e){for(var t=e.length,n;t--;)n=e[t],n.attr("style",p(n,n.attr("style"))),"span"!=n.name||n.attributes.length||n.unwrap()});var y=h.parse(u);d(y),c.content=new i({},v).serialize(y)}})}return s.isWordContent=o,s}),i(y,[f,c,m,l],function(e,t,n,i){return function(r){function a(e){r.on("BeforePastePreProcess",function(t){t.content=e(t.content)})}function o(e){return e=i.filter(e,[/^[\s\S]*|[\s\S]*$/g,[/\u00a0<\/span>/g,"\xa0"],/
$/])}function s(e){if(!n.isWordContent(e))return e;var a=[];t.each(r.schema.getBlockElements(),function(e,t){a.push(t)});var o=new RegExp("(?:
 [\\s\\r\\n]+|
)*(<\\/?("+a.join("|")+")[^>]*>)(?:
 [\\s\\r\\n]+|
)*","g");return e=i.filter(e,[[o,"$1"]]),e=i.filter(e,[[/

/g,"

"],[/
/g," "],[/

/g,"
"]])}function l(e){return(r.settings.paste_remove_styles||r.settings.paste_remove_styles_if_webkit!==!1)&&(e=e.replace(/ style=\"[^\"]+\"/g,"")),e}e.webkit&&(a(l),a(o)),e.ie&&a(s)}}),i(b,[w,u,m,y],function(e,t,n,i){var r;e.add("paste",function(e){function a(){"text"==s.pasteFormat?(this.active(!1),s.pasteFormat="html"):(s.pasteFormat="text",this.active(!0),r||(e.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off."),r=!0))}var o=this,s,l=e.settings;o.clipboard=s=new t(e),o.quirks=new i(e),o.wordFilter=new n(e),e.settings.paste_as_text&&(o.clipboard.pasteFormat="text"),l.paste_preprocess&&e.on("PastePreProcess",function(e){l.paste_preprocess.call(o,o,e)}),l.paste_postprocess&&e.on("PastePostProcess",function(e){l.paste_postprocess.call(o,o,e)}),e.addCommand("mceInsertClipboardContent",function(e,t){t.content&&o.clipboard.pasteHtml(t.content),t.text&&o.clipboard.pasteText(t.text)}),e.paste_block_drop&&e.on("dragend dragover draggesture dragdrop drop drag",function(e){e.preventDefault(),e.stopPropagation()}),e.settings.paste_data_images||e.on("drop",function(e){var t=e.dataTransfer;t&&t.files&&t.files.length>0&&e.preventDefault()}),e.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:a,active:"text"==o.clipboard.pasteFormat}),e.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:s.pasteFormat,onclick:a})})}),o([l,u,m,y,b])}(this);