agenda-libre-ruby/public/assets/tinymce/plugins/paste/plugin-24e8fe9283723adef1fc...

11 lines
24 KiB
JavaScript

/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.0.12 (2019-07-18)
*/
!function(v){"use strict";var t,e,n,r,o,i=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return i(n())}}},a=tinymce.util.Tools.resolve("tinymce.PluginManager"),s=function(t){return!(!/(^|[ ,])powerpaste([, ]|$)/.test(t.settings.plugins)||!a.get("powerpaste")||("undefined"!=typeof v.window.console&&v.window.console.log&&v.window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option."),0))},u=function(t,e){return{clipboard:t,quirks:e}},f=function(t,e,n,r){return t.fire("PastePreProcess",{content:e,internal:n,wordContent:r})},d=function(t,e,n,r){return t.fire("PastePostProcess",{node:e,internal:n,wordContent:r})},c=function(t,e){return t.fire("PastePlainTextToggle",{state:e})},g=function(t,e){return t.fire("paste",{ieFake:e})},l=function(t,e){"text"===e.pasteFormat.get()?(e.pasteFormat.set("html"),c(t,!1)):(e.pasteFormat.set("text"),c(t,!0)),t.focus()},m=function(t,n){t.addCommand("mceTogglePlainTextPaste",function(){l(t,n)}),t.addCommand("mceInsertClipboardContent",function(t,e){e.content&&n.pasteHtml(e.content,e.internal),e.text&&n.pasteText(e.text)})},p=function(t){return function(){return t}},h=p(!1),y=p(!0),b=h,x=y,P=function(){return w},w=(r={fold:function(t,e){return t()},is:b,isSome:b,isNone:x,getOr:n=function(t){return t},getOrThunk:e=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:n,orThunk:e,map:P,ap:P,each:function(){},bind:P,flatten:P,exists:b,forall:x,filter:P,equals:t=function(t){return t.isNone()},equals_:t,toArray:function(){return[]},toString:p("none()")},Object.freeze&&Object.freeze(r),r),_=function(n){var t=function(){return n},e=function(){return o},r=function(t){return t(n)},o={fold:function(t,e){return e(n)},is:function(t){return n===t},isSome:x,isNone:b,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:e,orThunk:e,map:function(t){return _(t(n))},ap:function(t){return t.fold(P,function(t){return _(t(n))})},each:function(t){t(n)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){return t(n)?o:w},equals:function(t){return t.is(n)},equals_:function(t,e){return t.fold(b,function(t){return e(n,t)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},T={some:_,none:P,from:function(t){return null===t||t===undefined?w:_(t)}},D=(o="function",function(t){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e}(t)===o}),C=Array.prototype.slice,k=function(t,e){for(var n=t.length,r=new Array(n),o=0;o<n;o++){var i=t[o];r[o]=e(i,o,t)}return r},S=function(t,e){for(var n=0,r=t.length;n<r;n++){e(t[n],n,t)}},O=D(Array.from)?Array.from:function(t){return C.call(t)},A=function(t){var n=T.none(),e=[],r=function(t){o()?a(t):e.push(t)},o=function(){return n.isSome()},i=function(t){S(t,a)},a=function(e){n.each(function(t){v.setTimeout(function(){e(t)},0)})};return t(function(t){n=T.some(t),i(e),e=[]}),{get:r,map:function(n){return A(function(e){r(function(t){e(n(t))})})},isReady:o}},R={nu:A,pure:function(e){return A(function(t){t(e)})}},E=function(e){var t=function(t){var r;e((r=t,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this;v.setTimeout(function(){r.apply(n,t)},0)}))},n=function(){return R.nu(t)};return{map:function(r){return E(function(n){t(function(t){var e=r(t);n(e)})})},bind:function(n){return E(function(e){t(function(t){n(t).get(e)})})},anonBind:function(n){return E(function(e){t(function(t){n.get(e)})})},toLazy:n,toCached:function(){var e=null;return E(function(t){null===e&&(e=n()),e.get(t)})},get:t}},F={nu:E,pure:function(e){return E(function(t){t(e)})}},I=function(a,t){return t(function(r){var o=[],i=0;0===a.length?r([]):S(a,function(t,e){var n;t.get((n=e,function(t){o[n]=t,++i>=a.length&&r(o)}))})})},M=function(t,e){var n=k(t,e);return I(n,F.nu)},B=tinymce.util.Tools.resolve("tinymce.Env"),H=tinymce.util.Tools.resolve("tinymce.util.Delay"),j=tinymce.util.Tools.resolve("tinymce.util.Tools"),L=tinymce.util.Tools.resolve("tinymce.util.VK"),N="x-tinymce/html",$="\x3c!-- "+N+" --\x3e",W=function(t){return $+t},z=function(t){return t.replace($,"")},U=function(t){return-1!==t.indexOf($)},V=function(){return N},q=tinymce.util.Tools.resolve("tinymce.html.Entities"),K=function(t){return t.replace(/\r?\n/g,"<br>")},G=function(t,e,n){var r=t.split(/\n\n/),o=function(t,e){var n,r=[],o="<"+t;if("object"==typeof e){for(n in e)e.hasOwnProperty(n)&&r.push(n+'="'+q.encodeAllRaw(e[n])+'"');r.length&&(o+=" "+r.join(" "))}return o+">"}(e,n),i="</"+e+">",a=j.map(r,function(t){return t.split(/\n/).join("<br />")});return 1===a.length?a[0]:j.map(a,function(t){return o+t+i}).join("")},X=function(t){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(t)},Y=function(t,e,n){return e?G(t,!0===e?"p":e,n):K(t)},Z=tinymce.util.Tools.resolve("tinymce.html.DomParser"),J=tinymce.util.Tools.resolve("tinymce.html.Node"),Q=tinymce.util.Tools.resolve("tinymce.html.Schema"),tt=tinymce.util.Tools.resolve("tinymce.html.Serializer"),et={shouldBlockDrop:function(t){return t.getParam("paste_block_drop",!1)},shouldPasteDataImages:function(t){return t.getParam("paste_data_images",!1)},shouldFilterDrop:function(t){return t.getParam("paste_filter_drop",!0)},getPreProcess:function(t){return t.getParam("paste_preprocess")},getPostProcess:function(t){return t.getParam("paste_postprocess")},getWebkitStyles:function(t){return t.getParam("paste_webkit_styles")},shouldRemoveWebKitStyles:function(t){return t.getParam("paste_remove_styles_if_webkit",!0)},shouldMergeFormats:function(t){return t.getParam("paste_merge_formats",!0)},isSmartPasteEnabled:function(t){return t.getParam("smart_paste",!0)},isPasteAsTextEnabled:function(t){return t.getParam("paste_as_text",!1)},getRetainStyleProps:function(t){return t.getParam("paste_retain_style_properties")},getWordValidElements:function(t){return t.getParam("paste_word_valid_elements","-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody")},shouldConvertWordFakeLists:function(t){return t.getParam("paste_convert_word_fake_lists",!0)},shouldUseDefaultFilters:function(t){return t.getParam("paste_enable_default_filters",!0)}};function nt(e,t){return j.each(t,function(t){e=t.constructor===RegExp?e.replace(t,""):e.replace(t[0],t[1])}),e}var rt={filter:nt,innerText:function te(t){var e=Q(),n=Z({},e),r="",o=e.getShortEndedElements(),i=j.makeMap("script noscript style textarea video audio iframe object"," "),a=e.getBlockElements();return t=nt(t,[/<!\[[^\]]+\]>/g]),function s(t){var e=t.name,n=t;if("br"!==e){if("wbr"!==e)if(o[e]&&(r+=" "),i[e])r+=" ";else{if(3===t.type&&(r+=t.value),!t.shortEnded&&(t=t.firstChild))for(;s(t),t=t.next;);a[e]&&n.next&&(r+="\n","p"===e&&(r+="\n"))}}else r+="\n"}(n.parse(t)),r},trimHtml:function ee(t){return t=nt(t,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,function r(t,e,n){return e||n?"\xa0":" "}],/<br class="Apple-interchange-newline">/g,/<br>$/i])},createIdGenerator:function ne(t){var e=0;return function(){return t+e++}},isMsEdge:function(){return-1!==v.navigator.userAgent.indexOf(" Edge/")}};function ot(e){var n,t;return t=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],e=e.replace(/^[\u00a0 ]+/,""),j.each(t,function(t){if(t.test(e))return!(n=!0)}),n}function it(t){var i,a,s=1;function n(t){var e="";if(3===t.type)return t.value;if(t=t.firstChild)for(;e+=n(t),t=t.next;);return e}function u(t,e){if(3===t.type&&e.test(t.value))return t.value=t.value.replace(e,""),!1;if(t=t.firstChild)do{if(!u(t,e))return!1}while(t=t.next);return!0}function e(t,e,n){var r=t._listLevel||s;r!==s&&(r<s?i&&(i=i.parent.parent):(a=i,i=null)),i&&i.name===e?i.append(t):(a=a||i,i=new J(e,1),1<n&&i.attr("start",""+n),t.wrap(i)),t.name="li",s<r&&a&&a.lastChild.append(i),s=r,function o(t){if(t._listIgnore)t.remove();else if(t=t.firstChild)for(;o(t),t=t.next;);}(t),u(t,/^\u00a0+/),u(t,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/),u(t,/^\u00a0+/)}for(var r=[],o=t.firstChild;null!=o;)if(r.push(o),null!==(o=o.walk()))for(;void 0!==o&&o.parent!==t;)o=o.walk();for(var c=0;c<r.length;c++)if("p"===(t=r[c]).name&&t.firstChild){var l=n(t);if(/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(l)){e(t,"ul");continue}if(ot(l)){var f=/([0-9]+)\./.exec(l),d=1;f&&(d=parseInt(f[1],10)),e(t,"ol",d);continue}if(t._listLevel){e(t,"ul",1);continue}i=null}else a=i,i=null}function at(n,r,o,i){var a,s={},t=n.dom.parseStyle(i);return j.each(t,function(t,e){switch(e){case"mso-list":(a=/\w+ \w+([0-9]+)/i.exec(i))&&(o._listLevel=parseInt(a[1],10)),/Ignore/i.test(t)&&o.firstChild&&(o._listIgnore=!0,o.firstChild._listIgnore=!0);break;case"horiz-align":e="text-align";break;case"vert-align":e="vertical-align";break;case"font-color":case"mso-foreground":e="color";break;case"mso-background":case"mso-highlight":e="background";break;case"font-weight":case"font-style":return void("normal"!==t&&(s[e]=t));case"mso-element":if(/^(comment|comment-list)$/i.test(t))return void o.remove()}0!==e.indexOf("mso-comment")?0!==e.indexOf("mso-")&&("all"===et.getRetainStyleProps(n)||r&&r[e])&&(s[e]=t):o.remove()}),/(bold)/i.test(s["font-weight"])&&(delete s["font-weight"],o.wrap(new J("b",1))),/(italic)/i.test(s["font-style"])&&(delete s["font-style"],o.wrap(new J("i",1))),(s=n.dom.serializeStyle(s,o.name))||null}var st={preProcess:function(t,e){return et.shouldUseDefaultFilters(t)?function(r,t){var e,o;(e=et.getRetainStyleProps(r))&&(o=j.makeMap(e.split(/[, ]/))),t=rt.filter(t,[/<br class="?Apple-interchange-newline"?>/gi,/<b[^>]+id="?docs-internal-[^>]*>/gi,/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\xa0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(t,e){return 0<e.length?e.replace(/./," ").slice(Math.floor(e.length/2)).split("").join("\xa0"):""}]]);var n=et.getWordValidElements(r),i=Q({valid_elements:n,valid_children:"-li[p]"});j.each(i.elements,function(t){t.attributes["class"]||(t.attributes["class"]={},t.attributesOrder.push("class")),t.attributes.style||(t.attributes.style={},t.attributesOrder.push("style"))});var a=Z({},i);a.addAttributeFilter("style",function(t){for(var e,n=t.length;n--;)(e=t[n]).attr("style",at(r,o,e,e.attr("style"))),"span"===e.name&&e.parent&&!e.attributes.length&&e.unwrap()}),a.addAttributeFilter("class",function(t){for(var e,n,r=t.length;r--;)n=(e=t[r]).attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(n)&&e.remove(),e.attr("class",null)}),a.addNodeFilter("del",function(t){for(var e=t.length;e--;)t[e].remove()}),a.addNodeFilter("a",function(t){for(var e,n,r,o=t.length;o--;)if(n=(e=t[o]).attr("href"),r=e.attr("name"),n&&-1!==n.indexOf("#_msocom_"))e.remove();else if(n&&0===n.indexOf("file://")&&(n=n.split("#")[1])&&(n="#"+n),n||r){if(r&&!/^_?(?:toc|edn|ftn)/i.test(r)){e.unwrap();continue}e.attr({href:n,name:r})}else e.unwrap()});var s=a.parse(t);return et.shouldConvertWordFakeLists(r)&&it(s),t=tt({validate:r.settings.validate},i).serialize(s)}(t,e):e},isWordContent:function re(t){return/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(t)||/class="OutlineElement/.test(t)||/id="?docs\-internal\-guid\-/.test(t)}},ut=function(t,e){return{content:t,cancelled:e}},ct=function(t,e,n,r){var o,i,a,s,u,c,l=f(t,e,n,r);return t.hasEventListeners("PastePostProcess")&&!l.isDefaultPrevented()?(o=t,i=l.content,a=n,s=r,u=o.dom.create("div",{style:"display:none"},i),c=d(o,u,a,s),ut(c.node.innerHTML,c.isDefaultPrevented())):ut(l.content,l.isDefaultPrevented())},lt=function(t,e,n){var r=st.isWordContent(e),o=r?st.preProcess(t,e):e;return ct(t,o,n,r)},ft=function(t,e){var n,r;return t.insertContent((n=e,r=t.dom.create("body",{},n),j.each(r.querySelectorAll("meta"),function(t){return t.parentNode.removeChild(t)}),r.innerHTML),{merge:et.shouldMergeFormats(t),paste:!0}),!0},dt=function(t){return/^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(t)},mt=function(t){return dt(t)&&/.(gif|jpe?g|png)$/.test(t)},gt=function(t,e,n){return!(!1!==t.selection.isCollapsed()||!dt(e))&&(o=e,i=n,(r=t).undoManager.extra(function(){i(r,o)},function(){r.execCommand("mceInsertLink",!1,o)}),!0);var r,o,i},pt=function(t,e,n){return!!mt(e)&&(o=e,i=n,(r=t).undoManager.extra(function(){i(r,o)},function(){r.insertContent('<img src="'+o+'">')}),!0);var r,o,i},vt=function(t,e){var n,r;!1===et.isSmartPasteEnabled(t)?ft(t,e):(n=t,r=e,j.each([gt,pt,ft],function(t){return!0!==t(n,r,ft)}))},ht=function(t){return"\n"===t||"\r"===t},yt=function(o){var e,n;return(n={pcIsSpace:!(e=function(t,e){return-1!==" \f\t\x0B".indexOf(e)||"\xa0"===e?t.pcIsSpace||""===t.str||t.str.length===o.length-1||(n=o,(r=t.str.length+1)<n.length&&0<=r&&ht(n[r]))?{pcIsSpace:!1,str:t.str+"\xa0"}:{pcIsSpace:!0,str:t.str+" "}:{pcIsSpace:ht(e),str:t.str+e};var n,r}),str:""},S(o,function(t){n=e(n,t)}),n).str},bt=function(t,e,n){var r=n||U(e),o=lt(t,z(e),r);!1===o.cancelled&&vt(t,o.content)},xt=function(t,e){var n=t.dom.encode(e).replace(/\r\n/g,"\n"),r=yt(n),o=Y(r,t.settings.forced_root_block,t.settings.forced_root_block_attrs);bt(t,o,!1)},Pt=function(t){var e={};if(t){if(t.getData){var n=t.getData("Text");n&&0<n.length&&-1===n.indexOf("data:text/mce-internal,")&&(e["text/plain"]=n)}if(t.types)for(var r=0;r<t.types.length;r++){var o=t.types[r];try{e[o]=t.getData(o)}catch(i){e[o]=""}}}return e},wt=function(t,e){return e in t&&0<t[e].length},_t=function(t){return wt(t,"text/html")||wt(t,"text/plain")},Tt=rt.createIdGenerator("mceclip"),Dt=function(e,t,n){var r,o,i,a,s="paste"===t.type?t.clipboardData:t.dataTransfer;if(e.settings.paste_data_images&&s){var u=(i=(o=s).items?k(O(o.items),function(t){return t.getAsFile()}):[],a=o.files?O(o.files):[],function(t,e){for(var n=[],r=0,o=t.length;r<o;r++){var i=t[r];e(i,r,t)&&n.push(i)}return n}(0<i.length?i:a,function(t){return/^image\/(jpeg|png|gif|bmp)$/.test(t.type)}));if(0<u.length)return t.preventDefault(),(r=u,M(r,function(r){return F.nu(function(t){var e=r.getAsFile?r.getAsFile():r,n=new window.FileReader;n.onload=function(){t({blob:e,uri:n.result})},n.readAsDataURL(e)})})).get(function(t){n&&e.selection.setRng(n),S(t,function(t){!function(t,e){var n,r,o,i,a,s,u,c=(n=e.uri,-1!==(r=n.indexOf(","))?n.substr(r+1):null),l=Tt(),f=t.settings.images_reuse_filename&&e.blob.name?(o=t,i=e.blob.name,(a=i.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i))?o.dom.encode(a[1]):null):l,d=new v.Image;if(d.src=e.uri,s=t.settings,u=d,!s.images_dataimg_filter||s.images_dataimg_filter(u)){var m,g=t.editorUpload.blobCache,p=void 0;(m=g.findFirst(function(t){return t.base64()===c}))?p=m:(p=g.create(l,e.blob,c,f),g.add(p)),bt(t,'<img src="'+p.blobUri()+'">',!1)}else bt(t,'<img src="'+e.uri+'">',!1)}(e,t)})}),!0}return!1},Ct=function(t){return L.metaKeyPressed(t)&&86===t.keyCode||t.shiftKey&&45===t.keyCode},kt=function(u,c,l){var e,f,d=(e=i(T.none()),{clear:function(){e.set(T.none())},set:function(t){e.set(T.some(t))},isSet:function(){return e.get().isSome()},on:function(t){e.get().each(t)}});function m(t,e,n,r){var o,i;wt(t,"text/html")?o=t["text/html"]:(o=c.getHtml(),r=r||U(o),c.isDefaultContent(o)&&(n=!0)),o=rt.trimHtml(o),c.remove(),i=!1===r&&X(o),o.length&&!i||(n=!0),n&&(o=wt(t,"text/plain")&&i?t["text/plain"]:rt.innerText(o)),c.isDefaultContent(o)?e||u.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."):n?xt(u,o):bt(u,o,r)}u.on("keydown",function(t){function e(t){Ct(t)&&!t.isDefaultPrevented()&&c.remove()}if(Ct(t)&&!t.isDefaultPrevented()){if((f=t.shiftKey&&86===t.keyCode)&&B.webkit&&-1!==v.navigator.userAgent.indexOf("Version/"))return;if(t.stopImmediatePropagation(),d.set(t),window.setTimeout(function(){d.clear()},100),B.ie&&f)return t.preventDefault(),void g(u,!0);c.remove(),c.create(),u.once("keyup",e),u.once("paste",function(){u.off("keyup",e)})}});u.on("paste",function(t){var e,n,r,o=d.isSet(),i=(e=u,n=Pt(t.clipboardData||e.getDoc().dataTransfer),rt.isMsEdge()?j.extend(n,{"text/html":""}):n),a="text"===l.get()||f,s=wt(i,V());(f=!1,t.isDefaultPrevented()||(r=t.clipboardData,-1!==v.navigator.userAgent.indexOf("Android")&&r&&r.items&&0===r.items.length))?c.remove():_t(i)||!Dt(u,t,c.getLastRng()||u.selection.getRng())?(o||t.preventDefault(),!B.ie||o&&!t.ieFake||wt(i,"text/html")||(c.create(),u.dom.bind(c.getEl(),"paste",function(t){t.stopPropagation()}),u.getDoc().execCommand("Paste",!1,null),i["text/html"]=c.getHtml()),wt(i,"text/html")?(t.preventDefault(),s||(s=U(i["text/html"])),m(i,o,a,s)):H.setEditorTimeout(u,function(){m(i,o,a,s)},0)):c.remove()})},St=function(t){return B.ie&&t.inline?v.document.body:t.getBody()},Ot=function(e,t,n){var r;St(r=e)!==r.getBody()&&e.dom.bind(t,"paste keyup",function(t){Et(e,n)||e.fire("paste")})},At=function(t){return t.dom.get("mcepastebin")},Rt=function(t,e){return e===t},Et=function(t,e){var n,r=At(t);return(n=r)&&"mcepastebin"===n.id&&Rt(e,r.innerHTML)},Ft=function(a){var s=i(null),u="%MCEPASTEBIN%";return{create:function(){return e=s,n=u,o=(t=a).dom,i=t.getBody(),e.set(t.selection.getRng()),r=t.dom.add(St(t),"div",{id:"mcepastebin","class":"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},n),(B.ie||B.gecko)&&o.setStyle(r,"left","rtl"===o.getStyle(i,"direction",!0)?65535:-65535),o.bind(r,"beforedeactivate focusin focusout",function(t){t.stopPropagation()}),Ot(t,r,n),r.focus(),void t.selection.select(r,!0);var t,e,n,r,o,i},remove:function(){return function(t,e){if(At(t)){for(var n=void 0,r=e.get();n=t.dom.get("mcepastebin");)t.dom.remove(n),t.dom.unbind(n);r&&t.selection.setRng(r)}e.set(null)}(a,s)},getEl:function(){return At(a)},getHtml:function(){return function(n){var e,t,r,o,i,a=function(t,e){t.appendChild(e),n.dom.remove(e,!0)};for(t=j.grep(St(n).childNodes,function(t){return"mcepastebin"===t.id}),e=t.shift(),j.each(t,function(t){a(e,t)}),r=(o=n.dom.select("div[id=mcepastebin]",e)).length-1;0<=r;r--)i=n.dom.create("div"),e.insertBefore(i,o[r]),a(i,o[r]);return e?e.innerHTML:""}(a)},getLastRng:function(){return s.get()},isDefault:function(){return Et(a,u)},isDefaultContent:function(t){return Rt(u,t)}}},It=function(n,t){var e=Ft(n);return n.on("PreInit",function(){return kt(a=n,e,t),void a.parser.addNodeFilter("img",function(t,e,n){var r,o=function(t){t.attr("data-mce-object")||s===B.transparentSrc||t.remove()};if(!a.settings.paste_data_images&&(r=n).data&&!0===r.data.paste)for(var i=t.length;i--;)(s=t[i].attr("src"))&&(0===s.indexOf("webkit-fake-url")?o(t[i]):a.settings.allow_html_data_urls||0!==s.indexOf("data:")||o(t[i]))});var a,s}),{pasteFormat:t,pasteHtml:function(t,e){return bt(n,t,e)},pasteText:function(t){return xt(n,t)},pasteImageData:function(t,e){return Dt(n,t,e)},getDataTransferItems:Pt,hasHtmlOrText:_t,hasContentType:wt}},Mt=function(){},Bt=function(t,e,n){if(r=t,!1!==B.iOS||r===undefined||"function"!=typeof r.setData||!0===rt.isMsEdge())return!1;try{return t.clearData(),t.setData("text/html",e),t.setData("text/plain",n),t.setData(V(),e),!0}catch(o){return!1}var r},Ht=function(t,e,n,r){Bt(t.clipboardData,e.html,e.text)?(t.preventDefault(),r()):n(e.html,r)},jt=function(s){return function(t,e){var n=W(t),r=s.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),o=s.dom.create("div",{contenteditable:"true"},n);s.dom.setStyles(r,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),r.appendChild(o),s.dom.add(s.getBody(),r);var i=s.selection.getRng();o.focus();var a=s.dom.createRng();a.selectNodeContents(o),s.selection.setRng(a),H.setTimeout(function(){s.selection.setRng(i),r.parentNode.removeChild(r),e()},0)}},Lt=function(t){return{html:t.selection.getContent({contextual:!0}),text:t.selection.getContent({format:"text"})}},Nt=function(t){return!t.selection.isCollapsed()||!!(e=t).dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody());var e},$t=function(t){var e,n;t.on("cut",(e=t,function(t){Nt(e)&&Ht(t,Lt(e),jt(e),function(){H.setTimeout(function(){e.execCommand("Delete")},0)})})),t.on("copy",(n=t,function(t){Nt(n)&&Ht(t,Lt(n),jt(n),Mt)}))},Wt=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),zt=function(t,e){return Wt.getCaretRangeFromPoint(e.clientX,e.clientY,t.getDoc())},Ut=function(t,e){t.focus(),t.selection.setRng(e)},Vt=function(a,s,u){et.shouldBlockDrop(a)&&a.on("dragend dragover draggesture dragdrop drop drag",function(t){t.preventDefault(),t.stopPropagation()}),et.shouldPasteDataImages(a)||a.on("drop",function(t){var e=t.dataTransfer;e&&e.files&&0<e.files.length&&t.preventDefault()}),a.on("drop",function(t){var e,n;if(n=zt(a,t),!t.isDefaultPrevented()&&!u.get()){e=s.getDataTransferItems(t.dataTransfer);var r,o=s.hasContentType(e,V());if((s.hasHtmlOrText(e)&&(!(r=e["text/plain"])||0!==r.indexOf("file://"))||!s.pasteImageData(t,n))&&n&&et.shouldFilterDrop(a)){var i=e["mce-internal"]||e["text/html"]||e["text/plain"];i&&(t.preventDefault(),H.setEditorTimeout(a,function(){a.undoManager.transact(function(){e["mce-internal"]&&a.execCommand("Delete"),Ut(a,n),i=rt.trimHtml(i),e["text/html"]?s.pasteHtml(i,o):s.pasteText(i)})}))}}}),a.on("dragstart",function(t){u.set(!0)}),a.on("dragover dragend",function(t){et.shouldPasteDataImages(a)&&!1===u.get()&&(t.preventDefault(),Ut(a,zt(a,t))),"dragend"===t.type&&u.set(!1)})},qt=function(t){var e=t.plugins.paste,n=et.getPreProcess(t);n&&t.on("PastePreProcess",function(t){n.call(e,e,t)});var r=et.getPostProcess(t);r&&t.on("PastePostProcess",function(t){r.call(e,e,t)})};function Kt(e,n){e.on("PastePreProcess",function(t){t.content=n(e,t.content,t.internal,t.wordContent)})}function Gt(t,e){if(!st.isWordContent(e))return e;var n=[];j.each(t.schema.getBlockElements(),function(t,e){n.push(e)});var r=new RegExp("(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?("+n.join("|")+")[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*","g");return e=rt.filter(e,[[r,"$1"]]),e=rt.filter(e,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}function Xt(t,e,n,r){if(r||n)return e;var c,o=et.getWebkitStyles(t);if(!1===et.shouldRemoveWebKitStyles(t)||"all"===o)return e;if(o&&(c=o.split(/[, ]/)),c){var l=t.dom,f=t.selection.getNode();e=e.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(t,e,n,r){var o=l.parseStyle(l.decode(n)),i={};if("none"===c)return e+r;for(var a=0;a<c.length;a++){var s=o[c[a]],u=l.getStyle(f,c[a],!0);/color/.test(c[a])&&(s=l.toHex(s),u=l.toHex(u)),u!==s&&(i[c[a]]=s)}return(i=l.serializeStyle(i,"span"))?e+' style="'+i+'"'+r:e+r})}else e=e.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return e=e.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(t,e,n,r){return e+' style="'+n+'"'+r})}function Yt(n,t){n.$("a",t).find("font,u").each(function(t,e){n.dom.remove(e,!0)})}var Zt=function(t){B.webkit&&Kt(t,Xt),B.ie&&(Kt(t,Gt),function r(e,n){e.on("PastePostProcess",function(t){n(e,t.node)})}(t,Yt))},Jt=function(n,r){return function(e){e.setActive("text"===r.pasteFormat.get());var t=function(t){return e.setActive(t.state)};return n.on("PastePlainTextToggle",t),function(){return n.off("PastePlainTextToggle",t)}}},Qt=function(t,e){t.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:function(){return t.execCommand("mceTogglePlainTextPaste")},onSetup:Jt(t,e)}),t.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",onAction:function(){return t.execCommand("mceTogglePlainTextPaste")},onSetup:Jt(t,e)})};!function oe(){a.add("paste",function(t){if(!1===s(t)){var e=i(!1),n=i(et.isPasteAsTextEnabled(t)?"text":"html"),r=It(t,n),o=Zt(t);return Qt(t,r),m(t,r),qt(t),$t(t),Vt(t,r,e),u(r,o)}})}()}(window);