aboutsummaryrefslogtreecommitdiff
path: root/srcs/wordpress/wp-includes/js/tinymce/plugins/paste
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-07 13:06:14 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-07 13:06:14 +0100
commit7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8 (patch)
treef7453d7dd5cbaaab246e23810b02d3edf1e451be /srcs/wordpress/wp-includes/js/tinymce/plugins/paste
parentc59bdcf77c50cbe89b4a93782cdd6d9e7532080e (diff)
downloadft_server-7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8.tar.gz
ft_server-7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8.tar.bz2
ft_server-7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8.zip
Added wordpress
Diffstat (limited to 'srcs/wordpress/wp-includes/js/tinymce/plugins/paste')
-rw-r--r--srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js2379
-rw-r--r--srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.min.js1
2 files changed, 2380 insertions, 0 deletions
diff --git a/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js b/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js
new file mode 100644
index 0000000..2bf48f7
--- /dev/null
+++ b/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js
@@ -0,0 +1,2379 @@
+(function () {
+var paste = (function (domGlobals) {
+ 'use strict';
+
+ var Cell = function (initial) {
+ var value = initial;
+ var get = function () {
+ return value;
+ };
+ var set = function (v) {
+ value = v;
+ };
+ var clone = function () {
+ return Cell(get());
+ };
+ return {
+ get: get,
+ set: set,
+ clone: clone
+ };
+ };
+
+ var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
+
+ var hasProPlugin = function (editor) {
+ if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global$1.get('powerpaste')) {
+ if (typeof domGlobals.window.console !== 'undefined' && domGlobals.window.console.log) {
+ domGlobals.window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.');
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+ var DetectProPlugin = { hasProPlugin: hasProPlugin };
+
+ var get = function (clipboard, quirks) {
+ return {
+ clipboard: clipboard,
+ quirks: quirks
+ };
+ };
+ var Api = { get: get };
+
+ var firePastePreProcess = function (editor, html, internal, isWordHtml) {
+ return editor.fire('PastePreProcess', {
+ content: html,
+ internal: internal,
+ wordContent: isWordHtml
+ });
+ };
+ var firePastePostProcess = function (editor, node, internal, isWordHtml) {
+ return editor.fire('PastePostProcess', {
+ node: node,
+ internal: internal,
+ wordContent: isWordHtml
+ });
+ };
+ var firePastePlainTextToggle = function (editor, state) {
+ return editor.fire('PastePlainTextToggle', { state: state });
+ };
+ var firePaste = function (editor, ieFake) {
+ return editor.fire('paste', { ieFake: ieFake });
+ };
+ var Events = {
+ firePastePreProcess: firePastePreProcess,
+ firePastePostProcess: firePastePostProcess,
+ firePastePlainTextToggle: firePastePlainTextToggle,
+ firePaste: firePaste
+ };
+
+ var shouldPlainTextInform = function (editor) {
+ return editor.getParam('paste_plaintext_inform', true);
+ };
+ var shouldBlockDrop = function (editor) {
+ return editor.getParam('paste_block_drop', false);
+ };
+ var shouldPasteDataImages = function (editor) {
+ return editor.getParam('paste_data_images', false);
+ };
+ var shouldFilterDrop = function (editor) {
+ return editor.getParam('paste_filter_drop', true);
+ };
+ var getPreProcess = function (editor) {
+ return editor.getParam('paste_preprocess');
+ };
+ var getPostProcess = function (editor) {
+ return editor.getParam('paste_postprocess');
+ };
+ var getWebkitStyles = function (editor) {
+ return editor.getParam('paste_webkit_styles');
+ };
+ var shouldRemoveWebKitStyles = function (editor) {
+ return editor.getParam('paste_remove_styles_if_webkit', true);
+ };
+ var shouldMergeFormats = function (editor) {
+ return editor.getParam('paste_merge_formats', true);
+ };
+ var isSmartPasteEnabled = function (editor) {
+ return editor.getParam('smart_paste', true);
+ };
+ var isPasteAsTextEnabled = function (editor) {
+ return editor.getParam('paste_as_text', false);
+ };
+ var getRetainStyleProps = function (editor) {
+ return editor.getParam('paste_retain_style_properties');
+ };
+ var getWordValidElements = function (editor) {
+ var defaultValidElements = '-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';
+ return editor.getParam('paste_word_valid_elements', defaultValidElements);
+ };
+ var shouldConvertWordFakeLists = function (editor) {
+ return editor.getParam('paste_convert_word_fake_lists', true);
+ };
+ var shouldUseDefaultFilters = function (editor) {
+ return editor.getParam('paste_enable_default_filters', true);
+ };
+ var Settings = {
+ shouldPlainTextInform: shouldPlainTextInform,
+ shouldBlockDrop: shouldBlockDrop,
+ shouldPasteDataImages: shouldPasteDataImages,
+ shouldFilterDrop: shouldFilterDrop,
+ getPreProcess: getPreProcess,
+ getPostProcess: getPostProcess,
+ getWebkitStyles: getWebkitStyles,
+ shouldRemoveWebKitStyles: shouldRemoveWebKitStyles,
+ shouldMergeFormats: shouldMergeFormats,
+ isSmartPasteEnabled: isSmartPasteEnabled,
+ isPasteAsTextEnabled: isPasteAsTextEnabled,
+ getRetainStyleProps: getRetainStyleProps,
+ getWordValidElements: getWordValidElements,
+ shouldConvertWordFakeLists: shouldConvertWordFakeLists,
+ shouldUseDefaultFilters: shouldUseDefaultFilters
+ };
+
+ var shouldInformUserAboutPlainText = function (editor, userIsInformedState) {
+ return userIsInformedState.get() === false && Settings.shouldPlainTextInform(editor);
+ };
+ var displayNotification = function (editor, message) {
+ editor.notificationManager.open({
+ text: editor.translate(message),
+ type: 'info'
+ });
+ };
+ var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) {
+ if (clipboard.pasteFormat.get() === 'text') {
+ clipboard.pasteFormat.set('html');
+ Events.firePastePlainTextToggle(editor, false);
+ } else {
+ clipboard.pasteFormat.set('text');
+ Events.firePastePlainTextToggle(editor, true);
+ if (shouldInformUserAboutPlainText(editor, userIsInformedState)) {
+ displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.');
+ userIsInformedState.set(true);
+ }
+ }
+ editor.focus();
+ };
+ var Actions = { togglePlainTextPaste: togglePlainTextPaste };
+
+ var register = function (editor, clipboard, userIsInformedState) {
+ editor.addCommand('mceTogglePlainTextPaste', function () {
+ Actions.togglePlainTextPaste(editor, clipboard, userIsInformedState);
+ });
+ editor.addCommand('mceInsertClipboardContent', function (ui, value) {
+ if (value.content) {
+ clipboard.pasteHtml(value.content, value.internal);
+ }
+ if (value.text) {
+ clipboard.pasteText(value.text);
+ }
+ });
+ };
+ var Commands = { register: register };
+
+ var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
+
+ var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay');
+
+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
+
+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.VK');
+
+ var internalMimeType = 'x-tinymce/html';
+ var internalMark = '<!-- ' + internalMimeType + ' -->';
+ var mark = function (html) {
+ return internalMark + html;
+ };
+ var unmark = function (html) {
+ return html.replace(internalMark, '');
+ };
+ var isMarked = function (html) {
+ return html.indexOf(internalMark) !== -1;
+ };
+ var InternalHtml = {
+ mark: mark,
+ unmark: unmark,
+ isMarked: isMarked,
+ internalHtmlMime: function () {
+ return internalMimeType;
+ }
+ };
+
+ var global$6 = tinymce.util.Tools.resolve('tinymce.html.Entities');
+
+ var isPlainText = function (text) {
+ return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);
+ };
+ var toBRs = function (text) {
+ return text.replace(/\r?\n/g, '<br>');
+ };
+ var openContainer = function (rootTag, rootAttrs) {
+ var key;
+ var attrs = [];
+ var tag = '<' + rootTag;
+ if (typeof rootAttrs === 'object') {
+ for (key in rootAttrs) {
+ if (rootAttrs.hasOwnProperty(key)) {
+ attrs.push(key + '="' + global$6.encodeAllRaw(rootAttrs[key]) + '"');
+ }
+ }
+ if (attrs.length) {
+ tag += ' ' + attrs.join(' ');
+ }
+ }
+ return tag + '>';
+ };
+ var toBlockElements = function (text, rootTag, rootAttrs) {
+ var blocks = text.split(/\n\n/);
+ var tagOpen = openContainer(rootTag, rootAttrs);
+ var tagClose = '</' + rootTag + '>';
+ var paragraphs = global$4.map(blocks, function (p) {
+ return p.split(/\n/).join('<br />');
+ });
+ var stitch = function (p) {
+ return tagOpen + p + tagClose;
+ };
+ return paragraphs.length === 1 ? paragraphs[0] : global$4.map(paragraphs, stitch).join('');
+ };
+ var convert = function (text, rootTag, rootAttrs) {
+ return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text);
+ };
+ var Newlines = {
+ isPlainText: isPlainText,
+ convert: convert,
+ toBRs: toBRs,
+ toBlockElements: toBlockElements
+ };
+
+ var global$7 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
+
+ var global$8 = tinymce.util.Tools.resolve('tinymce.html.Node');
+
+ var global$9 = tinymce.util.Tools.resolve('tinymce.html.Schema');
+
+ var global$a = tinymce.util.Tools.resolve('tinymce.html.Serializer');
+
+ function filter(content, items) {
+ global$4.each(items, function (v) {
+ if (v.constructor === RegExp) {
+ content = content.replace(v, '');
+ } else {
+ content = content.replace(v[0], v[1]);
+ }
+ });
+ return content;
+ }
+ function innerText(html) {
+ var schema = global$9();
+ var domParser = global$7({}, schema);
+ var text = '';
+ var shortEndedElements = schema.getShortEndedElements();
+ var ignoreElements = global$4.makeMap('script noscript style textarea video audio iframe object', ' ');
+ var blockElements = schema.getBlockElements();
+ function walk(node) {
+ var name = node.name, currentNode = node;
+ if (name === 'br') {
+ text += '\n';
+ return;
+ }
+ if (name === 'wbr') {
+ return;
+ }
+ if (shortEndedElements[name]) {
+ text += ' ';
+ }
+ if (ignoreElements[name]) {
+ text += ' ';
+ return;
+ }
+ if (node.type === 3) {
+ text += node.value;
+ }
+ if (!node.shortEnded) {
+ if (node = node.firstChild) {
+ do {
+ walk(node);
+ } while (node = node.next);
+ }
+ }
+ if (blockElements[name] && currentNode.next) {
+ text += '\n';
+ if (name === 'p') {
+ text += '\n';
+ }
+ }
+ }
+ html = filter(html, [/<!\[[^\]]+\]>/g]);
+ walk(domParser.parse(html));
+ return text;
+ }
+ function trimHtml(html) {
+ function trimSpaces(all, s1, s2) {
+ if (!s1 && !s2) {
+ return ' ';
+ }
+ return '\xA0';
+ }
+ html = filter(html, [
+ /^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,
+ /<!--StartFragment-->|<!--EndFragment-->/g,
+ [
+ /( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,
+ trimSpaces
+ ],
+ /<br class="Apple-interchange-newline">/g,
+ /<br>$/i
+ ]);
+ return html;
+ }
+ function createIdGenerator(prefix) {
+ var count = 0;
+ return function () {
+ return prefix + count++;
+ };
+ }
+ var isMsEdge = function () {
+ return domGlobals.navigator.userAgent.indexOf(' Edge/') !== -1;
+ };
+ var Utils = {
+ filter: filter,
+ innerText: innerText,
+ trimHtml: trimHtml,
+ createIdGenerator: createIdGenerator,
+ isMsEdge: isMsEdge
+ };
+
+ function isWordContent(content) {
+ return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content);
+ }
+ function isNumericList(text) {
+ var found, patterns;
+ patterns = [
+ /^[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]/
+ ];
+ text = text.replace(/^[\u00a0 ]+/, '');
+ global$4.each(patterns, function (pattern) {
+ if (pattern.test(text)) {
+ found = true;
+ return false;
+ }
+ });
+ return found;
+ }
+ function isBulletList(text) {
+ return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);
+ }
+ function convertFakeListsToProperLists(node) {
+ var currentListNode, prevListNode, lastLevel = 1;
+ function getText(node) {
+ var txt = '';
+ if (node.type === 3) {
+ return node.value;
+ }
+ if (node = node.firstChild) {
+ do {
+ txt += getText(node);
+ } while (node = node.next);
+ }
+ return txt;
+ }
+ function trimListStart(node, regExp) {
+ if (node.type === 3) {
+ if (regExp.test(node.value)) {
+ node.value = node.value.replace(regExp, '');
+ return false;
+ }
+ }
+ if (node = node.firstChild) {
+ do {
+ if (!trimListStart(node, regExp)) {
+ return false;
+ }
+ } while (node = node.next);
+ }
+ return true;
+ }
+ function removeIgnoredNodes(node) {
+ if (node._listIgnore) {
+ node.remove();
+ return;
+ }
+ if (node = node.firstChild) {
+ do {
+ removeIgnoredNodes(node);
+ } while (node = node.next);
+ }
+ }
+ function convertParagraphToLi(paragraphNode, listName, start) {
+ var level = paragraphNode._listLevel || lastLevel;
+ if (level !== lastLevel) {
+ if (level < lastLevel) {
+ if (currentListNode) {
+ currentListNode = currentListNode.parent.parent;
+ }
+ } else {
+ prevListNode = currentListNode;
+ currentListNode = null;
+ }
+ }
+ if (!currentListNode || currentListNode.name !== listName) {
+ prevListNode = prevListNode || currentListNode;
+ currentListNode = new global$8(listName, 1);
+ if (start > 1) {
+ currentListNode.attr('start', '' + start);
+ }
+ paragraphNode.wrap(currentListNode);
+ } else {
+ currentListNode.append(paragraphNode);
+ }
+ paragraphNode.name = 'li';
+ if (level > lastLevel && prevListNode) {
+ prevListNode.lastChild.append(currentListNode);
+ }
+ lastLevel = level;
+ removeIgnoredNodes(paragraphNode);
+ trimListStart(paragraphNode, /^\u00a0+/);
+ trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
+ trimListStart(paragraphNode, /^\u00a0+/);
+ }
+ var elements = [];
+ var child = node.firstChild;
+ while (typeof child !== 'undefined' && child !== null) {
+ elements.push(child);
+ child = child.walk();
+ if (child !== null) {
+ while (typeof child !== 'undefined' && child.parent !== node) {
+ child = child.walk();
+ }
+ }
+ }
+ for (var i = 0; i < elements.length; i++) {
+ node = elements[i];
+ if (node.name === 'p' && node.firstChild) {
+ var nodeText = getText(node);
+ if (isBulletList(nodeText)) {
+ convertParagraphToLi(node, 'ul');
+ continue;
+ }
+ if (isNumericList(nodeText)) {
+ var matches = /([0-9]+)\./.exec(nodeText);
+ var start = 1;
+ if (matches) {
+ start = parseInt(matches[1], 10);
+ }
+ convertParagraphToLi(node, 'ol', start);
+ continue;
+ }
+ if (node._listLevel) {
+ convertParagraphToLi(node, 'ul', 1);
+ continue;
+ }
+ currentListNode = null;
+ } else {
+ prevListNode = currentListNode;
+ currentListNode = null;
+ }
+ }
+ }
+ function filterStyles(editor, validStyles, node, styleValue) {
+ var outputStyles = {}, matches;
+ var styles = editor.dom.parseStyle(styleValue);
+ global$4.each(styles, function (value, name) {
+ switch (name) {
+ case 'mso-list':
+ matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
+ if (matches) {
+ node._listLevel = parseInt(matches[1], 10);
+ }
+ if (/Ignore/i.test(value) && node.firstChild) {
+ node._listIgnore = true;
+ node.firstChild._listIgnore = true;
+ }
+ break;
+ case 'horiz-align':
+ name = 'text-align';
+ break;
+ case 'vert-align':
+ name = 'vertical-align';
+ break;
+ case 'font-color':
+ case 'mso-foreground':
+ name = 'color';
+ break;
+ case 'mso-background':
+ case 'mso-highlight':
+ name = 'background';
+ break;
+ case 'font-weight':
+ case 'font-style':
+ if (value !== 'normal') {
+ outputStyles[name] = value;
+ }
+ return;
+ case 'mso-element':
+ if (/^(comment|comment-list)$/i.test(value)) {
+ node.remove();
+ return;
+ }
+ break;
+ }
+ if (name.indexOf('mso-comment') === 0) {
+ node.remove();
+ return;
+ }
+ if (name.indexOf('mso-') === 0) {
+ return;
+ }
+ if (Settings.getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) {
+ outputStyles[name] = value;
+ }
+ });
+ if (/(bold)/i.test(outputStyles['font-weight'])) {
+ delete outputStyles['font-weight'];
+ node.wrap(new global$8('b', 1));
+ }
+ if (/(italic)/i.test(outputStyles['font-style'])) {
+ delete outputStyles['font-style'];
+ node.wrap(new global$8('i', 1));
+ }
+ outputStyles = editor.dom.serializeStyle(outputStyles, node.name);
+ if (outputStyles) {
+ return outputStyles;
+ }
+ return null;
+ }
+ var filterWordContent = function (editor, content) {
+ var retainStyleProperties, validStyles;
+ retainStyleProperties = Settings.getRetainStyleProps(editor);
+ if (retainStyleProperties) {
+ validStyles = global$4.makeMap(retainStyleProperties.split(/[, ]/));
+ }
+ content = Utils.filter(content, [
+ /<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 (str, spaces) {
+ return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : '';
+ }
+ ]
+ ]);
+ var validElements = Settings.getWordValidElements(editor);
+ var schema = global$9({
+ valid_elements: validElements,
+ valid_children: '-li[p]'
+ });
+ global$4.each(schema.elements, function (rule) {
+ if (!rule.attributes.class) {
+ rule.attributes.class = {};
+ rule.attributesOrder.push('class');
+ }
+ if (!rule.attributes.style) {
+ rule.attributes.style = {};
+ rule.attributesOrder.push('style');
+ }
+ });
+ var domParser = global$7({}, schema);
+ domParser.addAttributeFilter('style', function (nodes) {
+ var i = nodes.length, node;
+ while (i--) {
+ node = nodes[i];
+ node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));
+ if (node.name === 'span' && node.parent && !node.attributes.length) {
+ node.unwrap();
+ }
+ }
+ });
+ domParser.addAttributeFilter('class', function (nodes) {
+ var i = nodes.length, node, className;
+ while (i--) {
+ node = nodes[i];
+ className = node.attr('class');
+ if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {
+ node.remove();
+ }
+ node.attr('class', null);
+ }
+ });
+ domParser.addNodeFilter('del', function (nodes) {
+ var i = nodes.length;
+ while (i--) {
+ nodes[i].remove();
+ }
+ });
+ domParser.addNodeFilter('a', function (nodes) {
+ var i = nodes.length, node, href, name;
+ while (i--) {
+ node = nodes[i];
+ href = node.attr('href');
+ name = node.attr('name');
+ if (href && href.indexOf('#_msocom_') !== -1) {
+ node.remove();
+ continue;
+ }
+ if (href && href.indexOf('file://') === 0) {
+ href = href.split('#')[1];
+ if (href) {
+ href = '#' + href;
+ }
+ }
+ if (!href && !name) {
+ node.unwrap();
+ } else {
+ if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
+ node.unwrap();
+ continue;
+ }
+ node.attr({
+ href: href,
+ name: name
+ });
+ }
+ }
+ });
+ var rootNode = domParser.parse(content);
+ if (Settings.shouldConvertWordFakeLists(editor)) {
+ convertFakeListsToProperLists(rootNode);
+ }
+ content = global$a({ validate: editor.settings.validate }, schema).serialize(rootNode);
+ return content;
+ };
+ var preProcess = function (editor, content) {
+ return Settings.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content;
+ };
+ var WordFilter = {
+ preProcess: preProcess,
+ isWordContent: isWordContent
+ };
+
+ var processResult = function (content, cancelled) {
+ return {
+ content: content,
+ cancelled: cancelled
+ };
+ };
+ var postProcessFilter = function (editor, html, internal, isWordHtml) {
+ var tempBody = editor.dom.create('div', { style: 'display:none' }, html);
+ var postProcessArgs = Events.firePastePostProcess(editor, tempBody, internal, isWordHtml);
+ return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());
+ };
+ var filterContent = function (editor, content, internal, isWordHtml) {
+ var preProcessArgs = Events.firePastePreProcess(editor, content, internal, isWordHtml);
+ if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {
+ return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml);
+ } else {
+ return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented());
+ }
+ };
+ var process = function (editor, html, internal) {
+ var isWordHtml = WordFilter.isWordContent(html);
+ var content = isWordHtml ? WordFilter.preProcess(editor, html) : html;
+ return filterContent(editor, content, internal, isWordHtml);
+ };
+ var ProcessFilters = { process: process };
+
+ var removeMeta = function (editor, html) {
+ var body = editor.dom.create('body', {}, html);
+ global$4.each(body.querySelectorAll('meta'), function (elm) {
+ return elm.parentNode.removeChild(elm);
+ });
+ return body.innerHTML;
+ };
+ var pasteHtml = function (editor, html) {
+ editor.insertContent(removeMeta(editor, html), {
+ merge: Settings.shouldMergeFormats(editor),
+ paste: true
+ });
+ return true;
+ };
+ var isAbsoluteUrl = function (url) {
+ return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);
+ };
+ var isImageUrl = function (url) {
+ return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);
+ };
+ var createImage = function (editor, url, pasteHtmlFn) {
+ editor.undoManager.extra(function () {
+ pasteHtmlFn(editor, url);
+ }, function () {
+ editor.insertContent('<img src="' + url + '">');
+ });
+ return true;
+ };
+ var createLink = function (editor, url, pasteHtmlFn) {
+ editor.undoManager.extra(function () {
+ pasteHtmlFn(editor, url);
+ }, function () {
+ editor.execCommand('mceInsertLink', false, url);
+ });
+ return true;
+ };
+ var linkSelection = function (editor, html, pasteHtmlFn) {
+ return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false;
+ };
+ var insertImage = function (editor, html, pasteHtmlFn) {
+ return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false;
+ };
+ var smartInsertContent = function (editor, html) {
+ global$4.each([
+ linkSelection,
+ insertImage,
+ pasteHtml
+ ], function (action) {
+ return action(editor, html, pasteHtml) !== true;
+ });
+ };
+ var insertContent = function (editor, html) {
+ if (Settings.isSmartPasteEnabled(editor) === false) {
+ pasteHtml(editor, html);
+ } else {
+ smartInsertContent(editor, html);
+ }
+ };
+ var SmartPaste = {
+ isImageUrl: isImageUrl,
+ isAbsoluteUrl: isAbsoluteUrl,
+ insertContent: insertContent
+ };
+
+ var constant = function (value) {
+ return function () {
+ return value;
+ };
+ };
+ function curry(fn) {
+ var initialArgs = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ initialArgs[_i - 1] = arguments[_i];
+ }
+ return function () {
+ var restArgs = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ restArgs[_i] = arguments[_i];
+ }
+ var all = initialArgs.concat(restArgs);
+ return fn.apply(null, all);
+ };
+ }
+ var never = constant(false);
+ var always = constant(true);
+
+ var never$1 = never;
+ var always$1 = always;
+ var none = function () {
+ return NONE;
+ };
+ var NONE = function () {
+ var eq = function (o) {
+ return o.isNone();
+ };
+ var call = function (thunk) {
+ return thunk();
+ };
+ var id = function (n) {
+ return n;
+ };
+ var noop = function () {
+ };
+ var nul = function () {
+ return null;
+ };
+ var undef = function () {
+ return undefined;
+ };
+ var me = {
+ fold: function (n, s) {
+ return n();
+ },
+ is: never$1,
+ isSome: never$1,
+ isNone: always$1,
+ getOr: id,
+ getOrThunk: call,
+ getOrDie: function (msg) {
+ throw new Error(msg || 'error: getOrDie called on none.');
+ },
+ getOrNull: nul,
+ getOrUndefined: undef,
+ or: id,
+ orThunk: call,
+ map: none,
+ ap: none,
+ each: noop,
+ bind: none,
+ flatten: none,
+ exists: never$1,
+ forall: always$1,
+ filter: none,
+ equals: eq,
+ equals_: eq,
+ toArray: function () {
+ return [];
+ },
+ toString: constant('none()')
+ };
+ if (Object.freeze) {
+ Object.freeze(me);
+ }
+ return me;
+ }();
+ var some = function (a) {
+ var constant_a = function () {
+ return a;
+ };
+ var self = function () {
+ return me;
+ };
+ var map = function (f) {
+ return some(f(a));
+ };
+ var bind = function (f) {
+ return f(a);
+ };
+ var me = {
+ fold: function (n, s) {
+ return s(a);
+ },
+ is: function (v) {
+ return a === v;
+ },
+ isSome: always$1,
+ isNone: never$1,
+ getOr: constant_a,
+ getOrThunk: constant_a,
+ getOrDie: constant_a,
+ getOrNull: constant_a,
+ getOrUndefined: constant_a,
+ or: self,
+ orThunk: self,
+ map: map,
+ ap: function (optfab) {
+ return optfab.fold(none, function (fab) {
+ return some(fab(a));
+ });
+ },
+ each: function (f) {
+ f(a);
+ },
+ bind: bind,
+ flatten: constant_a,
+ exists: bind,
+ forall: bind,
+ filter: function (f) {
+ return f(a) ? me : NONE;
+ },
+ equals: function (o) {
+ return o.is(a);
+ },
+ equals_: function (o, elementEq) {
+ return o.fold(never$1, function (b) {
+ return elementEq(a, b);
+ });
+ },
+ toArray: function () {
+ return [a];
+ },
+ toString: function () {
+ return 'some(' + a + ')';
+ }
+ };
+ return me;
+ };
+ var from = function (value) {
+ return value === null || value === undefined ? NONE : some(value);
+ };
+ var Option = {
+ some: some,
+ none: none,
+ from: from
+ };
+
+ var typeOf = function (x) {
+ if (x === null) {
+ return 'null';
+ }
+ var t = typeof x;
+ if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
+ return 'array';
+ }
+ if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
+ return 'string';
+ }
+ return t;
+ };
+ var isType = function (type) {
+ return function (value) {
+ return typeOf(value) === type;
+ };
+ };
+ var isFunction = isType('function');
+
+ var slice = Array.prototype.slice;
+ var map = function (xs, f) {
+ var len = xs.length;
+ var r = new Array(len);
+ for (var i = 0; i < len; i++) {
+ var x = xs[i];
+ r[i] = f(x, i, xs);
+ }
+ return r;
+ };
+ var each = function (xs, f) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ f(x, i, xs);
+ }
+ };
+ var filter$1 = function (xs, pred) {
+ var r = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ r.push(x);
+ }
+ }
+ return r;
+ };
+ var from$1 = isFunction(Array.from) ? Array.from : function (x) {
+ return slice.call(x);
+ };
+
+ var exports$1 = {}, module = { exports: exports$1 };
+ (function (define, exports, module, require) {
+ (function (f) {
+ if (typeof exports === 'object' && typeof module !== 'undefined') {
+ module.exports = f();
+ } else if (typeof define === 'function' && define.amd) {
+ define([], f);
+ } else {
+ var g;
+ if (typeof window !== 'undefined') {
+ g = window;
+ } else if (typeof global !== 'undefined') {
+ g = global;
+ } else if (typeof self !== 'undefined') {
+ g = self;
+ } else {
+ g = this;
+ }
+ g.EphoxContactWrapper = f();
+ }
+ }(function () {
+ return function () {
+ function r(e, n, t) {
+ function o(i, f) {
+ if (!n[i]) {
+ if (!e[i]) {
+ var c = 'function' == typeof require && require;
+ if (!f && c)
+ return c(i, !0);
+ if (u)
+ return u(i, !0);
+ var a = new Error('Cannot find module \'' + i + '\'');
+ throw a.code = 'MODULE_NOT_FOUND', a;
+ }
+ var p = n[i] = { exports: {} };
+ e[i][0].call(p.exports, function (r) {
+ var n = e[i][1][r];
+ return o(n || r);
+ }, p, p.exports, r, e, n, t);
+ }
+ return n[i].exports;
+ }
+ for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++)
+ o(t[i]);
+ return o;
+ }
+ return r;
+ }()({
+ 1: [
+ function (require, module, exports) {
+ var process = module.exports = {};
+ var cachedSetTimeout;
+ var cachedClearTimeout;
+ function defaultSetTimout() {
+ throw new Error('setTimeout has not been defined');
+ }
+ function defaultClearTimeout() {
+ throw new Error('clearTimeout has not been defined');
+ }
+ (function () {
+ try {
+ if (typeof setTimeout === 'function') {
+ cachedSetTimeout = setTimeout;
+ } else {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ } catch (e) {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ try {
+ if (typeof clearTimeout === 'function') {
+ cachedClearTimeout = clearTimeout;
+ } else {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+ } catch (e) {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+ }());
+ function runTimeout(fun) {
+ if (cachedSetTimeout === setTimeout) {
+ return setTimeout(fun, 0);
+ }
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
+ cachedSetTimeout = setTimeout;
+ return setTimeout(fun, 0);
+ }
+ try {
+ return cachedSetTimeout(fun, 0);
+ } catch (e) {
+ try {
+ return cachedSetTimeout.call(null, fun, 0);
+ } catch (e) {
+ return cachedSetTimeout.call(this, fun, 0);
+ }
+ }
+ }
+ function runClearTimeout(marker) {
+ if (cachedClearTimeout === clearTimeout) {
+ return clearTimeout(marker);
+ }
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
+ cachedClearTimeout = clearTimeout;
+ return clearTimeout(marker);
+ }
+ try {
+ return cachedClearTimeout(marker);
+ } catch (e) {
+ try {
+ return cachedClearTimeout.call(null, marker);
+ } catch (e) {
+ return cachedClearTimeout.call(this, marker);
+ }
+ }
+ }
+ var queue = [];
+ var draining = false;
+ var currentQueue;
+ var queueIndex = -1;
+ function cleanUpNextTick() {
+ if (!draining || !currentQueue) {
+ return;
+ }
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ } else {
+ queueIndex = -1;
+ }
+ if (queue.length) {
+ drainQueue();
+ }
+ }
+ function drainQueue() {
+ if (draining) {
+ return;
+ }
+ var timeout = runTimeout(cleanUpNextTick);
+ draining = true;
+ var len = queue.length;
+ while (len) {
+ currentQueue = queue;
+ queue = [];
+ while (++queueIndex < len) {
+ if (currentQueue) {
+ currentQueue[queueIndex].run();
+ }
+ }
+ queueIndex = -1;
+ len = queue.length;
+ }
+ currentQueue = null;
+ draining = false;
+ runClearTimeout(timeout);
+ }
+ process.nextTick = function (fun) {
+ var args = new Array(arguments.length - 1);
+ if (arguments.length > 1) {
+ for (var i = 1; i < arguments.length; i++) {
+ args[i - 1] = arguments[i];
+ }
+ }
+ queue.push(new Item(fun, args));
+ if (queue.length === 1 && !draining) {
+ runTimeout(drainQueue);
+ }
+ };
+ function Item(fun, array) {
+ this.fun = fun;
+ this.array = array;
+ }
+ Item.prototype.run = function () {
+ this.fun.apply(null, this.array);
+ };
+ process.title = 'browser';
+ process.browser = true;
+ process.env = {};
+ process.argv = [];
+ process.version = '';
+ process.versions = {};
+ function noop() {
+ }
+ process.on = noop;
+ process.addListener = noop;
+ process.once = noop;
+ process.off = noop;
+ process.removeListener = noop;
+ process.removeAllListeners = noop;
+ process.emit = noop;
+ process.prependListener = noop;
+ process.prependOnceListener = noop;
+ process.listeners = function (name) {
+ return [];
+ };
+ process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+ };
+ process.cwd = function () {
+ return '/';
+ };
+ process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+ };
+ process.umask = function () {
+ return 0;
+ };
+ },
+ {}
+ ],
+ 2: [
+ function (require, module, exports) {
+ (function (setImmediate) {
+ (function (root) {
+ var setTimeoutFunc = setTimeout;
+ function noop() {
+ }
+ function bind(fn, thisArg) {
+ return function () {
+ fn.apply(thisArg, arguments);
+ };
+ }
+ function Promise(fn) {
+ if (typeof this !== 'object')
+ throw new TypeError('Promises must be constructed via new');
+ if (typeof fn !== 'function')
+ throw new TypeError('not a function');
+ this._state = 0;
+ this._handled = false;
+ this._value = undefined;
+ this._deferreds = [];
+ doResolve(fn, this);
+ }
+ function handle(self, deferred) {
+ while (self._state === 3) {
+ self = self._value;
+ }
+ if (self._state === 0) {
+ self._deferreds.push(deferred);
+ return;
+ }
+ self._handled = true;
+ Promise._immediateFn(function () {
+ var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
+ if (cb === null) {
+ (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
+ return;
+ }
+ var ret;
+ try {
+ ret = cb(self._value);
+ } catch (e) {
+ reject(deferred.promise, e);
+ return;
+ }
+ resolve(deferred.promise, ret);
+ });
+ }
+ function resolve(self, newValue) {
+ try {
+ if (newValue === self)
+ throw new TypeError('A promise cannot be resolved with itself.');
+ if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
+ var then = newValue.then;
+ if (newValue instanceof Promise) {
+ self._state = 3;
+ self._value = newValue;
+ finale(self);
+ return;
+ } else if (typeof then === 'function') {
+ doResolve(bind(then, newValue), self);
+ return;
+ }
+ }
+ self._state = 1;
+ self._value = newValue;
+ finale(self);
+ } catch (e) {
+ reject(self, e);
+ }
+ }
+ function reject(self, newValue) {
+ self._state = 2;
+ self._value = newValue;
+ finale(self);
+ }
+ function finale(self) {
+ if (self._state === 2 && self._deferreds.length === 0) {
+ Promise._immediateFn(function () {
+ if (!self._handled) {
+ Promise._unhandledRejectionFn(self._value);
+ }
+ });
+ }
+ for (var i = 0, len = self._deferreds.length; i < len; i++) {
+ handle(self, self._deferreds[i]);
+ }
+ self._deferreds = null;
+ }
+ function Handler(onFulfilled, onRejected, promise) {
+ this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
+ this.onRejected = typeof onRejected === 'function' ? onRejected : null;
+ this.promise = promise;
+ }
+ function doResolve(fn, self) {
+ var done = false;
+ try {
+ fn(function (value) {
+ if (done)
+ return;
+ done = true;
+ resolve(self, value);
+ }, function (reason) {
+ if (done)
+ return;
+ done = true;
+ reject(self, reason);
+ });
+ } catch (ex) {
+ if (done)
+ return;
+ done = true;
+ reject(self, ex);
+ }
+ }
+ Promise.prototype['catch'] = function (onRejected) {
+ return this.then(null, onRejected);
+ };
+ Promise.prototype.then = function (onFulfilled, onRejected) {
+ var prom = new this.constructor(noop);
+ handle(this, new Handler(onFulfilled, onRejected, prom));
+ return prom;
+ };
+ Promise.all = function (arr) {
+ var args = Array.prototype.slice.call(arr);
+ return new Promise(function (resolve, reject) {
+ if (args.length === 0)
+ return resolve([]);
+ var remaining = args.length;
+ function res(i, val) {
+ try {
+ if (val && (typeof val === 'object' || typeof val === 'function')) {
+ var then = val.then;
+ if (typeof then === 'function') {
+ then.call(val, function (val) {
+ res(i, val);
+ }, reject);
+ return;
+ }
+ }
+ args[i] = val;
+ if (--remaining === 0) {
+ resolve(args);
+ }
+ } catch (ex) {
+ reject(ex);
+ }
+ }
+ for (var i = 0; i < args.length; i++) {
+ res(i, args[i]);
+ }
+ });
+ };
+ Promise.resolve = function (value) {
+ if (value && typeof value === 'object' && value.constructor === Promise) {
+ return value;
+ }
+ return new Promise(function (resolve) {
+ resolve(value);
+ });
+ };
+ Promise.reject = function (value) {
+ return new Promise(function (resolve, reject) {
+ reject(value);
+ });
+ };
+ Promise.race = function (values) {
+ return new Promise(function (resolve, reject) {
+ for (var i = 0, len = values.length; i < len; i++) {
+ values[i].then(resolve, reject);
+ }
+ });
+ };
+ Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) {
+ setImmediate(fn);
+ } : function (fn) {
+ setTimeoutFunc(fn, 0);
+ };
+ Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
+ if (typeof console !== 'undefined' && console) {
+ console.warn('Possible Unhandled Promise Rejection:', err);
+ }
+ };
+ Promise._setImmediateFn = function _setImmediateFn(fn) {
+ Promise._immediateFn = fn;
+ };
+ Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
+ Promise._unhandledRejectionFn = fn;
+ };
+ if (typeof module !== 'undefined' && module.exports) {
+ module.exports = Promise;
+ } else if (!root.Promise) {
+ root.Promise = Promise;
+ }
+ }(this));
+ }.call(this, require('timers').setImmediate));
+ },
+ { 'timers': 3 }
+ ],
+ 3: [
+ function (require, module, exports) {
+ (function (setImmediate, clearImmediate) {
+ var nextTick = require('process/browser.js').nextTick;
+ var apply = Function.prototype.apply;
+ var slice = Array.prototype.slice;
+ var immediateIds = {};
+ var nextImmediateId = 0;
+ exports.setTimeout = function () {
+ return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
+ };
+ exports.setInterval = function () {
+ return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
+ };
+ exports.clearTimeout = exports.clearInterval = function (timeout) {
+ timeout.close();
+ };
+ function Timeout(id, clearFn) {
+ this._id = id;
+ this._clearFn = clearFn;
+ }
+ Timeout.prototype.unref = Timeout.prototype.ref = function () {
+ };
+ Timeout.prototype.close = function () {
+ this._clearFn.call(window, this._id);
+ };
+ exports.enroll = function (item, msecs) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = msecs;
+ };
+ exports.unenroll = function (item) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = -1;
+ };
+ exports._unrefActive = exports.active = function (item) {
+ clearTimeout(item._idleTimeoutId);
+ var msecs = item._idleTimeout;
+ if (msecs >= 0) {
+ item._idleTimeoutId = setTimeout(function onTimeout() {
+ if (item._onTimeout)
+ item._onTimeout();
+ }, msecs);
+ }
+ };
+ exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) {
+ var id = nextImmediateId++;
+ var args = arguments.length < 2 ? false : slice.call(arguments, 1);
+ immediateIds[id] = true;
+ nextTick(function onNextTick() {
+ if (immediateIds[id]) {
+ if (args) {
+ fn.apply(null, args);
+ } else {
+ fn.call(null);
+ }
+ exports.clearImmediate(id);
+ }
+ });
+ return id;
+ };
+ exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) {
+ delete immediateIds[id];
+ };
+ }.call(this, require('timers').setImmediate, require('timers').clearImmediate));
+ },
+ {
+ 'process/browser.js': 1,
+ 'timers': 3
+ }
+ ],
+ 4: [
+ function (require, module, exports) {
+ var promisePolyfill = require('promise-polyfill');
+ var Global = function () {
+ if (typeof window !== 'undefined') {
+ return window;
+ } else {
+ return Function('return this;')();
+ }
+ }();
+ module.exports = { boltExport: Global.Promise || promisePolyfill };
+ },
+ { 'promise-polyfill': 2 }
+ ]
+ }, {}, [4])(4);
+ }));
+ }(undefined, exports$1, module, undefined));
+ var Promise = module.exports.boltExport;
+
+ var nu = function (baseFn) {
+ var data = Option.none();
+ var callbacks = [];
+ var map = function (f) {
+ return nu(function (nCallback) {
+ get(function (data) {
+ nCallback(f(data));
+ });
+ });
+ };
+ var get = function (nCallback) {
+ if (isReady()) {
+ call(nCallback);
+ } else {
+ callbacks.push(nCallback);
+ }
+ };
+ var set = function (x) {
+ data = Option.some(x);
+ run(callbacks);
+ callbacks = [];
+ };
+ var isReady = function () {
+ return data.isSome();
+ };
+ var run = function (cbs) {
+ each(cbs, call);
+ };
+ var call = function (cb) {
+ data.each(function (x) {
+ domGlobals.setTimeout(function () {
+ cb(x);
+ }, 0);
+ });
+ };
+ baseFn(set);
+ return {
+ get: get,
+ map: map,
+ isReady: isReady
+ };
+ };
+ var pure = function (a) {
+ return nu(function (callback) {
+ callback(a);
+ });
+ };
+ var LazyValue = {
+ nu: nu,
+ pure: pure
+ };
+
+ var errorReporter = function (err) {
+ domGlobals.setTimeout(function () {
+ throw err;
+ }, 0);
+ };
+ var make = function (run) {
+ var get = function (callback) {
+ run().then(callback, errorReporter);
+ };
+ var map = function (fab) {
+ return make(function () {
+ return run().then(fab);
+ });
+ };
+ var bind = function (aFutureB) {
+ return make(function () {
+ return run().then(function (v) {
+ return aFutureB(v).toPromise();
+ });
+ });
+ };
+ var anonBind = function (futureB) {
+ return make(function () {
+ return run().then(function () {
+ return futureB.toPromise();
+ });
+ });
+ };
+ var toLazy = function () {
+ return LazyValue.nu(get);
+ };
+ var toCached = function () {
+ var cache = null;
+ return make(function () {
+ if (cache === null) {
+ cache = run();
+ }
+ return cache;
+ });
+ };
+ var toPromise = run;
+ return {
+ map: map,
+ bind: bind,
+ anonBind: anonBind,
+ toLazy: toLazy,
+ toCached: toCached,
+ toPromise: toPromise,
+ get: get
+ };
+ };
+ var nu$1 = function (baseFn) {
+ return make(function () {
+ return new Promise(baseFn);
+ });
+ };
+ var pure$1 = function (a) {
+ return make(function () {
+ return Promise.resolve(a);
+ });
+ };
+ var Future = {
+ nu: nu$1,
+ pure: pure$1
+ };
+
+ var par = function (asyncValues, nu) {
+ return nu(function (callback) {
+ var r = [];
+ var count = 0;
+ var cb = function (i) {
+ return function (value) {
+ r[i] = value;
+ count++;
+ if (count >= asyncValues.length) {
+ callback(r);
+ }
+ };
+ };
+ if (asyncValues.length === 0) {
+ callback([]);
+ } else {
+ each(asyncValues, function (asyncValue, i) {
+ asyncValue.get(cb(i));
+ });
+ }
+ });
+ };
+
+ var par$1 = function (futures) {
+ return par(futures, Future.nu);
+ };
+ var mapM = function (array, fn) {
+ var futures = map(array, fn);
+ return par$1(futures);
+ };
+
+ var value = function () {
+ var subject = Cell(Option.none());
+ var clear = function () {
+ subject.set(Option.none());
+ };
+ var set = function (s) {
+ subject.set(Option.some(s));
+ };
+ var on = function (f) {
+ subject.get().each(f);
+ };
+ var isSet = function () {
+ return subject.get().isSome();
+ };
+ return {
+ clear: clear,
+ set: set,
+ isSet: isSet,
+ on: on
+ };
+ };
+
+ var pasteHtml$1 = function (editor, html, internalFlag) {
+ var internal = internalFlag ? internalFlag : InternalHtml.isMarked(html);
+ var args = ProcessFilters.process(editor, InternalHtml.unmark(html), internal);
+ if (args.cancelled === false) {
+ SmartPaste.insertContent(editor, args.content);
+ }
+ };
+ var pasteText = function (editor, text) {
+ text = editor.dom.encode(text).replace(/\r\n/g, '\n');
+ text = Newlines.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs);
+ pasteHtml$1(editor, text, false);
+ };
+ var getDataTransferItems = function (dataTransfer) {
+ var items = {};
+ var mceInternalUrlPrefix = 'data:text/mce-internal,';
+ if (dataTransfer) {
+ if (dataTransfer.getData) {
+ var legacyText = dataTransfer.getData('Text');
+ if (legacyText && legacyText.length > 0) {
+ if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {
+ items['text/plain'] = legacyText;
+ }
+ }
+ }
+ if (dataTransfer.types) {
+ for (var i = 0; i < dataTransfer.types.length; i++) {
+ var contentType = dataTransfer.types[i];
+ try {
+ items[contentType] = dataTransfer.getData(contentType);
+ } catch (ex) {
+ items[contentType] = '';
+ }
+ }
+ }
+ }
+ return items;
+ };
+ var getClipboardContent = function (editor, clipboardEvent) {
+ var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
+ return Utils.isMsEdge() ? global$4.extend(content, { 'text/html': '' }) : content;
+ };
+ var hasContentType = function (clipboardContent, mimeType) {
+ return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
+ };
+ var hasHtmlOrText = function (content) {
+ return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');
+ };
+ var getBase64FromUri = function (uri) {
+ var idx;
+ idx = uri.indexOf(',');
+ if (idx !== -1) {
+ return uri.substr(idx + 1);
+ }
+ return null;
+ };
+ var isValidDataUriImage = function (settings, imgElm) {
+ return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
+ };
+ var extractFilename = function (editor, str) {
+ var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);
+ return m ? editor.dom.encode(m[1]) : null;
+ };
+ var uniqueId = Utils.createIdGenerator('mceclip');
+ var pasteImage = function (editor, imageItem) {
+ var base64 = getBase64FromUri(imageItem.uri);
+ var id = uniqueId();
+ var name = editor.settings.images_reuse_filename && imageItem.blob.name ? extractFilename(editor, imageItem.blob.name) : id;
+ var img = new domGlobals.Image();
+ img.src = imageItem.uri;
+ if (isValidDataUriImage(editor.settings, img)) {
+ var blobCache = editor.editorUpload.blobCache;
+ var blobInfo = void 0, existingBlobInfo = void 0;
+ existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) {
+ return cachedBlobInfo.base64() === base64;
+ });
+ if (!existingBlobInfo) {
+ blobInfo = blobCache.create(id, imageItem.blob, base64, name);
+ blobCache.add(blobInfo);
+ } else {
+ blobInfo = existingBlobInfo;
+ }
+ pasteHtml$1(editor, '<img src="' + blobInfo.blobUri() + '">', false);
+ } else {
+ pasteHtml$1(editor, '<img src="' + imageItem.uri + '">', false);
+ }
+ };
+ var isClipboardEvent = function (event) {
+ return event.type === 'paste';
+ };
+ var readBlobsAsDataUris = function (items) {
+ return mapM(items, function (item) {
+ return Future.nu(function (resolve) {
+ var blob = item.getAsFile ? item.getAsFile() : item;
+ var reader = new window.FileReader();
+ reader.onload = function () {
+ resolve({
+ blob: blob,
+ uri: reader.result
+ });
+ };
+ reader.readAsDataURL(blob);
+ });
+ });
+ };
+ var getImagesFromDataTransfer = function (dataTransfer) {
+ var items = dataTransfer.items ? map(from$1(dataTransfer.items), function (item) {
+ return item.getAsFile();
+ }) : [];
+ var files = dataTransfer.files ? from$1(dataTransfer.files) : [];
+ var images = filter$1(items.length > 0 ? items : files, function (file) {
+ return /^image\/(jpeg|png|gif|bmp)$/.test(file.type);
+ });
+ return images;
+ };
+ var pasteImageData = function (editor, e, rng) {
+ var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;
+ if (editor.settings.paste_data_images && dataTransfer) {
+ var images = getImagesFromDataTransfer(dataTransfer);
+ if (images.length > 0) {
+ e.preventDefault();
+ readBlobsAsDataUris(images).get(function (blobResults) {
+ if (rng) {
+ editor.selection.setRng(rng);
+ }
+ each(blobResults, function (result) {
+ pasteImage(editor, result);
+ });
+ });
+ return true;
+ }
+ }
+ return false;
+ };
+ var isBrokenAndroidClipboardEvent = function (e) {
+ var clipboardData = e.clipboardData;
+ return domGlobals.navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
+ };
+ var isKeyboardPasteEvent = function (e) {
+ return global$5.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;
+ };
+ var registerEventHandlers = function (editor, pasteBin, pasteFormat) {
+ var keyboardPasteEvent = value();
+ var keyboardPastePlainTextState;
+ editor.on('keydown', function (e) {
+ function removePasteBinOnKeyUp(e) {
+ if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
+ pasteBin.remove();
+ }
+ }
+ if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
+ keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;
+ if (keyboardPastePlainTextState && global$2.webkit && domGlobals.navigator.userAgent.indexOf('Version/') !== -1) {
+ return;
+ }
+ e.stopImmediatePropagation();
+ keyboardPasteEvent.set(e);
+ window.setTimeout(function () {
+ keyboardPasteEvent.clear();
+ }, 100);
+ if (global$2.ie && keyboardPastePlainTextState) {
+ e.preventDefault();
+ Events.firePaste(editor, true);
+ return;
+ }
+ pasteBin.remove();
+ pasteBin.create();
+ editor.once('keyup', removePasteBinOnKeyUp);
+ editor.once('paste', function () {
+ editor.off('keyup', removePasteBinOnKeyUp);
+ });
+ }
+ });
+ function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) {
+ var content, isPlainTextHtml;
+ if (hasContentType(clipboardContent, 'text/html')) {
+ content = clipboardContent['text/html'];
+ } else {
+ content = pasteBin.getHtml();
+ internal = internal ? internal : InternalHtml.isMarked(content);
+ if (pasteBin.isDefaultContent(content)) {
+ plainTextMode = true;
+ }
+ }
+ content = Utils.trimHtml(content);
+ pasteBin.remove();
+ isPlainTextHtml = internal === false && Newlines.isPlainText(content);
+ if (!content.length || isPlainTextHtml) {
+ plainTextMode = true;
+ }
+ if (plainTextMode) {
+ if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {
+ content = clipboardContent['text/plain'];
+ } else {
+ content = Utils.innerText(content);
+ }
+ }
+ if (pasteBin.isDefaultContent(content)) {
+ if (!isKeyBoardPaste) {
+ editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
+ }
+ return;
+ }
+ if (plainTextMode) {
+ pasteText(editor, content);
+ } else {
+ pasteHtml$1(editor, content, internal);
+ }
+ }
+ var getLastRng = function () {
+ return pasteBin.getLastRng() || editor.selection.getRng();
+ };
+ editor.on('paste', function (e) {
+ var isKeyBoardPaste = keyboardPasteEvent.isSet();
+ var clipboardContent = getClipboardContent(editor, e);
+ var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;
+ var internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime());
+ keyboardPastePlainTextState = false;
+ if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
+ pasteBin.remove();
+ return;
+ }
+ if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
+ pasteBin.remove();
+ return;
+ }
+ if (!isKeyBoardPaste) {
+ e.preventDefault();
+ }
+ if (global$2.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
+ pasteBin.create();
+ editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
+ e.stopPropagation();
+ });
+ editor.getDoc().execCommand('Paste', false, null);
+ clipboardContent['text/html'] = pasteBin.getHtml();
+ }
+ if (hasContentType(clipboardContent, 'text/html')) {
+ e.preventDefault();
+ if (!internal) {
+ internal = InternalHtml.isMarked(clipboardContent['text/html']);
+ }
+ insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
+ } else {
+ global$3.setEditorTimeout(editor, function () {
+ insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
+ }, 0);
+ }
+ });
+ };
+ var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {
+ registerEventHandlers(editor, pasteBin, pasteFormat);
+ var src;
+ editor.parser.addNodeFilter('img', function (nodes, name, args) {
+ var isPasteInsert = function (args) {
+ return args.data && args.data.paste === true;
+ };
+ var remove = function (node) {
+ if (!node.attr('data-mce-object') && src !== global$2.transparentSrc) {
+ node.remove();
+ }
+ };
+ var isWebKitFakeUrl = function (src) {
+ return src.indexOf('webkit-fake-url') === 0;
+ };
+ var isDataUri = function (src) {
+ return src.indexOf('data:') === 0;
+ };
+ if (!editor.settings.paste_data_images && isPasteInsert(args)) {
+ var i = nodes.length;
+ while (i--) {
+ src = nodes[i].attributes.map.src;
+ if (!src) {
+ continue;
+ }
+ if (isWebKitFakeUrl(src)) {
+ remove(nodes[i]);
+ } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
+ remove(nodes[i]);
+ }
+ }
+ }
+ });
+ };
+
+ var getPasteBinParent = function (editor) {
+ return global$2.ie && editor.inline ? domGlobals.document.body : editor.getBody();
+ };
+ var isExternalPasteBin = function (editor) {
+ return getPasteBinParent(editor) !== editor.getBody();
+ };
+ var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) {
+ if (isExternalPasteBin(editor)) {
+ editor.dom.bind(pasteBinElm, 'paste keyup', function (e) {
+ if (!isDefault(editor, pasteBinDefaultContent)) {
+ editor.fire('paste');
+ }
+ });
+ }
+ };
+ var create = function (editor, lastRngCell, pasteBinDefaultContent) {
+ var dom = editor.dom, body = editor.getBody();
+ var pasteBinElm;
+ lastRngCell.set(editor.selection.getRng());
+ pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {
+ 'id': 'mcepastebin',
+ 'class': 'mce-pastebin',
+ 'contentEditable': true,
+ 'data-mce-bogus': 'all',
+ 'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
+ }, pasteBinDefaultContent);
+ if (global$2.ie || global$2.gecko) {
+ dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);
+ }
+ dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
+ e.stopPropagation();
+ });
+ delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);
+ pasteBinElm.focus();
+ editor.selection.select(pasteBinElm, true);
+ };
+ var remove = function (editor, lastRngCell) {
+ if (getEl(editor)) {
+ var pasteBinClone = void 0;
+ var lastRng = lastRngCell.get();
+ while (pasteBinClone = editor.dom.get('mcepastebin')) {
+ editor.dom.remove(pasteBinClone);
+ editor.dom.unbind(pasteBinClone);
+ }
+ if (lastRng) {
+ editor.selection.setRng(lastRng);
+ }
+ }
+ lastRngCell.set(null);
+ };
+ var getEl = function (editor) {
+ return editor.dom.get('mcepastebin');
+ };
+ var getHtml = function (editor) {
+ var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper;
+ var copyAndRemove = function (toElm, fromElm) {
+ toElm.appendChild(fromElm);
+ editor.dom.remove(fromElm, true);
+ };
+ pasteBinClones = global$4.grep(getPasteBinParent(editor).childNodes, function (elm) {
+ return elm.id === 'mcepastebin';
+ });
+ pasteBinElm = pasteBinClones.shift();
+ global$4.each(pasteBinClones, function (pasteBinClone) {
+ copyAndRemove(pasteBinElm, pasteBinClone);
+ });
+ dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);
+ for (i = dirtyWrappers.length - 1; i >= 0; i--) {
+ cleanWrapper = editor.dom.create('div');
+ pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);
+ copyAndRemove(cleanWrapper, dirtyWrappers[i]);
+ }
+ return pasteBinElm ? pasteBinElm.innerHTML : '';
+ };
+ var getLastRng = function (lastRng) {
+ return lastRng.get();
+ };
+ var isDefaultContent = function (pasteBinDefaultContent, content) {
+ return content === pasteBinDefaultContent;
+ };
+ var isPasteBin = function (elm) {
+ return elm && elm.id === 'mcepastebin';
+ };
+ var isDefault = function (editor, pasteBinDefaultContent) {
+ var pasteBinElm = getEl(editor);
+ return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);
+ };
+ var PasteBin = function (editor) {
+ var lastRng = Cell(null);
+ var pasteBinDefaultContent = '%MCEPASTEBIN%';
+ return {
+ create: function () {
+ return create(editor, lastRng, pasteBinDefaultContent);
+ },
+ remove: function () {
+ return remove(editor, lastRng);
+ },
+ getEl: function () {
+ return getEl(editor);
+ },
+ getHtml: function () {
+ return getHtml(editor);
+ },
+ getLastRng: function () {
+ return getLastRng(lastRng);
+ },
+ isDefault: function () {
+ return isDefault(editor, pasteBinDefaultContent);
+ },
+ isDefaultContent: function (content) {
+ return isDefaultContent(pasteBinDefaultContent, content);
+ }
+ };
+ };
+
+ var Clipboard = function (editor, pasteFormat) {
+ var pasteBin = PasteBin(editor);
+ editor.on('preInit', function () {
+ return registerEventsAndFilters(editor, pasteBin, pasteFormat);
+ });
+ return {
+ pasteFormat: pasteFormat,
+ pasteHtml: function (html, internalFlag) {
+ return pasteHtml$1(editor, html, internalFlag);
+ },
+ pasteText: function (text) {
+ return pasteText(editor, text);
+ },
+ pasteImageData: function (e, rng) {
+ return pasteImageData(editor, e, rng);
+ },
+ getDataTransferItems: getDataTransferItems,
+ hasHtmlOrText: hasHtmlOrText,
+ hasContentType: hasContentType
+ };
+ };
+
+ var noop = function () {
+ };
+ var hasWorkingClipboardApi = function (clipboardData) {
+ return global$2.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && Utils.isMsEdge() !== true;
+ };
+ var setHtml5Clipboard = function (clipboardData, html, text) {
+ if (hasWorkingClipboardApi(clipboardData)) {
+ try {
+ clipboardData.clearData();
+ clipboardData.setData('text/html', html);
+ clipboardData.setData('text/plain', text);
+ clipboardData.setData(InternalHtml.internalHtmlMime(), html);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ };
+ var setClipboardData = function (evt, data, fallback, done) {
+ if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {
+ evt.preventDefault();
+ done();
+ } else {
+ fallback(data.html, done);
+ }
+ };
+ var fallback = function (editor) {
+ return function (html, done) {
+ var markedHtml = InternalHtml.mark(html);
+ var outer = editor.dom.create('div', {
+ 'contenteditable': 'false',
+ 'data-mce-bogus': 'all'
+ });
+ var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);
+ editor.dom.setStyles(outer, {
+ position: 'fixed',
+ top: '0',
+ left: '-3000px',
+ width: '1000px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ editor.dom.add(editor.getBody(), outer);
+ var range = editor.selection.getRng();
+ inner.focus();
+ var offscreenRange = editor.dom.createRng();
+ offscreenRange.selectNodeContents(inner);
+ editor.selection.setRng(offscreenRange);
+ setTimeout(function () {
+ editor.selection.setRng(range);
+ outer.parentNode.removeChild(outer);
+ done();
+ }, 0);
+ };
+ };
+ var getData = function (editor) {
+ return {
+ html: editor.selection.getContent({ contextual: true }),
+ text: editor.selection.getContent({ format: 'text' })
+ };
+ };
+ var isTableSelection = function (editor) {
+ return !!editor.dom.getParent(editor.selection.getStart(), 'td[data-mce-selected],th[data-mce-selected]', editor.getBody());
+ };
+ var hasSelectedContent = function (editor) {
+ return !editor.selection.isCollapsed() || isTableSelection(editor);
+ };
+ var cut = function (editor) {
+ return function (evt) {
+ if (hasSelectedContent(editor)) {
+ setClipboardData(evt, getData(editor), fallback(editor), function () {
+ setTimeout(function () {
+ editor.execCommand('Delete');
+ }, 0);
+ });
+ }
+ };
+ };
+ var copy = function (editor) {
+ return function (evt) {
+ if (hasSelectedContent(editor)) {
+ setClipboardData(evt, getData(editor), fallback(editor), noop);
+ }
+ };
+ };
+ var register$1 = function (editor) {
+ editor.on('cut', cut(editor));
+ editor.on('copy', copy(editor));
+ };
+ var CutCopy = { register: register$1 };
+
+ var global$b = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
+
+ var getCaretRangeFromEvent = function (editor, e) {
+ return global$b.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());
+ };
+ var isPlainTextFileUrl = function (content) {
+ var plainTextContent = content['text/plain'];
+ return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;
+ };
+ var setFocusedRange = function (editor, rng) {
+ editor.focus();
+ editor.selection.setRng(rng);
+ };
+ var setup = function (editor, clipboard, draggingInternallyState) {
+ if (Settings.shouldBlockDrop(editor)) {
+ editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ });
+ }
+ if (!Settings.shouldPasteDataImages(editor)) {
+ editor.on('drop', function (e) {
+ var dataTransfer = e.dataTransfer;
+ if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
+ e.preventDefault();
+ }
+ });
+ }
+ editor.on('drop', function (e) {
+ var dropContent, rng;
+ rng = getCaretRangeFromEvent(editor, e);
+ if (e.isDefaultPrevented() || draggingInternallyState.get()) {
+ return;
+ }
+ dropContent = clipboard.getDataTransferItems(e.dataTransfer);
+ var internal = clipboard.hasContentType(dropContent, InternalHtml.internalHtmlMime());
+ if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) {
+ return;
+ }
+ if (rng && Settings.shouldFilterDrop(editor)) {
+ var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
+ if (content_1) {
+ e.preventDefault();
+ global$3.setEditorTimeout(editor, function () {
+ editor.undoManager.transact(function () {
+ if (dropContent['mce-internal']) {
+ editor.execCommand('Delete');
+ }
+ setFocusedRange(editor, rng);
+ content_1 = Utils.trimHtml(content_1);
+ if (!dropContent['text/html']) {
+ clipboard.pasteText(content_1);
+ } else {
+ clipboard.pasteHtml(content_1, internal);
+ }
+ });
+ });
+ }
+ }
+ });
+ editor.on('dragstart', function (e) {
+ draggingInternallyState.set(true);
+ });
+ editor.on('dragover dragend', function (e) {
+ if (Settings.shouldPasteDataImages(editor) && draggingInternallyState.get() === false) {
+ e.preventDefault();
+ setFocusedRange(editor, getCaretRangeFromEvent(editor, e));
+ }
+ if (e.type === 'dragend') {
+ draggingInternallyState.set(false);
+ }
+ });
+ };
+ var DragDrop = { setup: setup };
+
+ var setup$1 = function (editor) {
+ var plugin = editor.plugins.paste;
+ var preProcess = Settings.getPreProcess(editor);
+ if (preProcess) {
+ editor.on('PastePreProcess', function (e) {
+ preProcess.call(plugin, plugin, e);
+ });
+ }
+ var postProcess = Settings.getPostProcess(editor);
+ if (postProcess) {
+ editor.on('PastePostProcess', function (e) {
+ postProcess.call(plugin, plugin, e);
+ });
+ }
+ };
+ var PrePostProcess = { setup: setup$1 };
+
+ function addPreProcessFilter(editor, filterFunc) {
+ editor.on('PastePreProcess', function (e) {
+ e.content = filterFunc(editor, e.content, e.internal, e.wordContent);
+ });
+ }
+ function addPostProcessFilter(editor, filterFunc) {
+ editor.on('PastePostProcess', function (e) {
+ filterFunc(editor, e.node);
+ });
+ }
+ function removeExplorerBrElementsAfterBlocks(editor, html) {
+ if (!WordFilter.isWordContent(html)) {
+ return html;
+ }
+ var blockElements = [];
+ global$4.each(editor.schema.getBlockElements(), function (block, blockName) {
+ blockElements.push(blockName);
+ });
+ var explorerBlocksRegExp = new RegExp('(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*', 'g');
+ html = Utils.filter(html, [[
+ explorerBlocksRegExp,
+ '$1'
+ ]]);
+ html = Utils.filter(html, [
+ [
+ /<br><br>/g,
+ '<BR><BR>'
+ ],
+ [
+ /<br>/g,
+ ' '
+ ],
+ [
+ /<BR><BR>/g,
+ '<br>'
+ ]
+ ]);
+ return html;
+ }
+ function removeWebKitStyles(editor, content, internal, isWordHtml) {
+ if (isWordHtml || internal) {
+ return content;
+ }
+ var webKitStylesSetting = Settings.getWebkitStyles(editor);
+ var webKitStyles;
+ if (Settings.shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') {
+ return content;
+ }
+ if (webKitStylesSetting) {
+ webKitStyles = webKitStylesSetting.split(/[, ]/);
+ }
+ if (webKitStyles) {
+ var dom_1 = editor.dom, node_1 = editor.selection.getNode();
+ content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) {
+ var inputStyles = dom_1.parseStyle(dom_1.decode(value));
+ var outputStyles = {};
+ if (webKitStyles === 'none') {
+ return before + after;
+ }
+ for (var i = 0; i < webKitStyles.length; i++) {
+ var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true);
+ if (/color/.test(webKitStyles[i])) {
+ inputValue = dom_1.toHex(inputValue);
+ currentValue = dom_1.toHex(currentValue);
+ }
+ if (currentValue !== inputValue) {
+ outputStyles[webKitStyles[i]] = inputValue;
+ }
+ }
+ outputStyles = dom_1.serializeStyle(outputStyles, 'span');
+ if (outputStyles) {
+ return before + ' style="' + outputStyles + '"' + after;
+ }
+ return before + after;
+ });
+ } else {
+ content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
+ }
+ content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) {
+ return before + ' style="' + value + '"' + after;
+ });
+ return content;
+ }
+ function removeUnderlineAndFontInAnchor(editor, root) {
+ editor.$('a', root).find('font,u').each(function (i, node) {
+ editor.dom.remove(node, true);
+ });
+ }
+ var setup$2 = function (editor) {
+ if (global$2.webkit) {
+ addPreProcessFilter(editor, removeWebKitStyles);
+ }
+ if (global$2.ie) {
+ addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);
+ addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);
+ }
+ };
+ var Quirks = { setup: setup$2 };
+
+ var stateChange = function (editor, clipboard, e) {
+ var ctrl = e.control;
+ ctrl.active(clipboard.pasteFormat.get() === 'text');
+ editor.on('PastePlainTextToggle', function (e) {
+ ctrl.active(e.state);
+ });
+ };
+ var register$2 = function (editor, clipboard) {
+ var postRender = curry(stateChange, editor, clipboard);
+ editor.addButton('pastetext', {
+ active: false,
+ icon: 'pastetext',
+ tooltip: 'Paste as text',
+ cmd: 'mceTogglePlainTextPaste',
+ onPostRender: postRender
+ });
+ editor.addMenuItem('pastetext', {
+ text: 'Paste as text',
+ selectable: true,
+ active: clipboard.pasteFormat,
+ cmd: 'mceTogglePlainTextPaste',
+ onPostRender: postRender
+ });
+ };
+ var Buttons = { register: register$2 };
+
+ global$1.add('paste', function (editor) {
+ if (DetectProPlugin.hasProPlugin(editor) === false) {
+ var userIsInformedState = Cell(false);
+ var draggingInternallyState = Cell(false);
+ var pasteFormat = Cell(Settings.isPasteAsTextEnabled(editor) ? 'text' : 'html');
+ var clipboard = Clipboard(editor, pasteFormat);
+ var quirks = Quirks.setup(editor);
+ Buttons.register(editor, clipboard);
+ Commands.register(editor, clipboard, userIsInformedState);
+ PrePostProcess.setup(editor);
+ CutCopy.register(editor);
+ DragDrop.setup(editor, clipboard, draggingInternallyState);
+ return Api.get(clipboard, quirks);
+ }
+ });
+ function Plugin () {
+ }
+
+ return Plugin;
+
+}(window));
+})();
diff --git a/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.min.js b/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.min.js
new file mode 100644
index 0000000..f6f2781
--- /dev/null
+++ b/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.min.js
@@ -0,0 +1 @@
+!function(h){"use strict";var p=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return p(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(t){return!(!/(^|[ ,])powerpaste([, ]|$)/.test(t.settings.plugins)||!e.get("powerpaste")||("undefined"!=typeof h.window.console&&h.window.console.log&&h.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})},s=function(t,e){return t.fire("PastePlainTextToggle",{state:e})},n=function(t,e){return t.fire("paste",{ieFake:e})},m={shouldPlainTextInform:function(t){return t.getParam("paste_plaintext_inform",!0)},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)}},r=function(t,e,n){var r,o,i;"text"===e.pasteFormat.get()?(e.pasteFormat.set("html"),s(t,!1)):(e.pasteFormat.set("text"),s(t,!0),i=t,!1===n.get()&&m.shouldPlainTextInform(i)&&(o="Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",(r=t).notificationManager.open({text:r.translate(o),type:"info"}),n.set(!0))),t.focus()},c=function(t,n,e){t.addCommand("mceTogglePlainTextPaste",function(){r(t,n,e)}),t.addCommand("mceInsertClipboardContent",function(t,e){e.content&&n.pasteHtml(e.content,e.internal),e.text&&n.pasteText(e.text)})},g=tinymce.util.Tools.resolve("tinymce.Env"),v=tinymce.util.Tools.resolve("tinymce.util.Delay"),y=tinymce.util.Tools.resolve("tinymce.util.Tools"),o=tinymce.util.Tools.resolve("tinymce.util.VK"),t="x-tinymce/html",i="\x3c!-- "+t+" --\x3e",l=function(t){return i+t},b=function(t){return t.replace(i,"")},w=function(t){return-1!==t.indexOf(i)},x=function(){return t},_=tinymce.util.Tools.resolve("tinymce.html.Entities"),P=function(t){return t.replace(/\r?\n/g,"<br>")},T=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+'="'+_.encodeAllRaw(e[n])+'"');r.length&&(o+=" "+r.join(" "))}return o+">"}(e,n),i="</"+e+">",a=y.map(r,function(t){return t.split(/\n/).join("<br />")});return 1===a.length?a[0]:y.map(a,function(t){return o+t+i}).join("")},D=function(t){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(t)},C=function(t,e,n){return e?T(t,e,n):P(t)},k=tinymce.util.Tools.resolve("tinymce.html.DomParser"),F=tinymce.util.Tools.resolve("tinymce.html.Node"),E=tinymce.util.Tools.resolve("tinymce.html.Schema"),I=tinymce.util.Tools.resolve("tinymce.html.Serializer");function R(e,t){return y.each(t,function(t){e=t.constructor===RegExp?e.replace(t,""):e.replace(t[0],t[1])}),e}var S={filter:R,innerText:function(e){var n=E(),r=k({},n),o="",i=n.getShortEndedElements(),a=y.makeMap("script noscript style textarea video audio iframe object"," "),u=n.getBlockElements();return e=R(e,[/<!\[[^\]]+\]>/g]),function t(e){var n=e.name,r=e;if("br"!==n){if("wbr"!==n)if(i[n]&&(o+=" "),a[n])o+=" ";else{if(3===e.type&&(o+=e.value),!e.shortEnded&&(e=e.firstChild))for(;t(e),e=e.next;);u[n]&&r.next&&(o+="\n","p"===n&&(o+="\n"))}}else o+="\n"}(r.parse(e)),o},trimHtml:function(t){return t=R(t,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,function(t,e,n){return e||n?"\xa0":" "}],/<br class="Apple-interchange-newline">/g,/<br>$/i])},createIdGenerator:function(t){var e=0;return function(){return t+e++}},isMsEdge:function(){return-1!==h.navigator.userAgent.indexOf(" Edge/")}};function O(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 ]+/,""),y.each(t,function(t){if(t.test(e))return!(n=!0)}),n}function A(t){var i,a,u=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 s(t,e){if(3===t.type&&e.test(t.value))return t.value=t.value.replace(e,""),!1;if(t=t.firstChild)do{if(!s(t,e))return!1}while(t=t.next);return!0}function e(e,n,r){var o=e._listLevel||u;o!==u&&(o<u?i&&(i=i.parent.parent):(a=i,i=null)),i&&i.name===n?i.append(e):(a=a||i,i=new F(n,1),1<r&&i.attr("start",""+r),e.wrap(i)),e.name="li",u<o&&a&&a.lastChild.append(i),u=o,function t(e){if(e._listIgnore)e.remove();else if(e=e.firstChild)for(;t(e),e=e.next;);}(e),s(e,/^\u00a0+/),s(e,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/),s(e,/^\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(O(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 j(n,r,o,i){var a,u={},t=n.dom.parseStyle(i);return y.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&&(u[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"===m.getRetainStyleProps(n)||r&&r[e])&&(u[e]=t):o.remove()}),/(bold)/i.test(u["font-weight"])&&(delete u["font-weight"],o.wrap(new F("b",1))),/(italic)/i.test(u["font-style"])&&(delete u["font-style"],o.wrap(new F("i",1))),(u=n.dom.serializeStyle(u,o.name))||null}var M,L,N,B,H,$,W,U,z,V={preProcess:function(t,e){return m.shouldUseDefaultFilters(t)?function(r,t){var e,o;(e=m.getRetainStyleProps(r))&&(o=y.makeMap(e.split(/[, ]/))),t=S.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=m.getWordValidElements(r),i=E({valid_elements:n,valid_children:"-li[p]"});y.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=k({},i);a.addAttributeFilter("style",function(t){for(var e,n=t.length;n--;)(e=t[n]).attr("style",j(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 u=a.parse(t);return m.shouldConvertWordFakeLists(r)&&A(u),t=I({validate:r.settings.validate},i).serialize(u)}(t,e):e},isWordContent:function(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)}},q=function(t,e){return{content:t,cancelled:e}},K=function(t,e,n,r){var o,i,a,u,s,c,l=f(t,e,n,r);return t.hasEventListeners("PastePostProcess")&&!l.isDefaultPrevented()?(o=t,i=l.content,a=n,u=r,s=o.dom.create("div",{style:"display:none"},i),c=d(o,s,a,u),q(c.node.innerHTML,c.isDefaultPrevented())):q(l.content,l.isDefaultPrevented())},G=function(t,e,n){var r=V.isWordContent(e),o=r?V.preProcess(t,e):e;return K(t,o,n,r)},X=function(t,e){var n,r;return t.insertContent((n=e,r=t.dom.create("body",{},n),y.each(r.querySelectorAll("meta"),function(t){return t.parentNode.removeChild(t)}),r.innerHTML),{merge:m.shouldMergeFormats(t),paste:!0}),!0},Y=function(t){return/^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(t)},Z=function(t){return Y(t)&&/.(gif|jpe?g|png)$/.test(t)},J=function(t,e,n){return!(!1!==t.selection.isCollapsed()||!Y(e)||(o=e,i=n,(r=t).undoManager.extra(function(){i(r,o)},function(){r.execCommand("mceInsertLink",!1,o)}),0));var r,o,i},Q=function(t,e,n){return!!Z(e)&&(o=e,i=n,(r=t).undoManager.extra(function(){i(r,o)},function(){r.insertContent('<img src="'+o+'">')}),!0);var r,o,i},tt=function(t,e){var n,r;!1===m.isSmartPasteEnabled(t)?X(t,e):(n=t,r=e,y.each([J,Q,X],function(t){return!0!==t(n,r,X)}))},et=function(t){return function(){return t}},nt=et(!1),rt=et(!0),ot=nt,it=rt,at=function(){return ut},ut=(B={fold:function(t,e){return t()},is:ot,isSome:ot,isNone:it,getOr:N=function(t){return t},getOrThunk:L=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:L,map:at,ap:at,each:function(){},bind:at,flatten:at,exists:ot,forall:it,filter:at,equals:M=function(t){return t.isNone()},equals_:M,toArray:function(){return[]},toString:et("none()")},Object.freeze&&Object.freeze(B),B),st=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:it,isNone:ot,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:e,orThunk:e,map:function(t){return st(t(n))},ap:function(t){return t.fold(at,function(t){return st(t(n))})},each:function(t){t(n)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){return t(n)?o:ut},equals:function(t){return t.is(n)},equals_:function(t,e){return t.fold(ot,function(t){return e(n,t)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},ct={some:st,none:at,from:function(t){return null===t||t===undefined?ut:st(t)}},lt=(H="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)===H}),ft=Array.prototype.slice,dt=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},mt=function(t,e){for(var n=0,r=t.length;n<r;n++)e(t[n],n,t)},pt=lt(Array.from)?Array.from:function(t){return ft.call(t)},gt={},ht={exports:gt};$=undefined,W=gt,U=ht,z=undefined,function(t){"object"==typeof W&&void 0!==U?U.exports=t():"function"==typeof $&&$.amd?$([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EphoxContactWrapper=t()}(function(){return function i(a,u,s){function c(e,t){if(!u[e]){if(!a[e]){var n="function"==typeof z&&z;if(!t&&n)return n(e,!0);if(l)return l(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var o=u[e]={exports:{}};a[e][0].call(o.exports,function(t){return c(a[e][1][t]||t)},o,o.exports,i,a,u,s)}return u[e].exports}for(var l="function"==typeof z&&z,t=0;t<s.length;t++)c(s[t]);return c}({1:[function(t,e,n){var r,o,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(t){r=a}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(t){o=u}}();var c,l=[],f=!1,d=-1;function m(){f&&c&&(f=!1,c.length?l=c.concat(l):d=-1,l.length&&p())}function p(){if(!f){var t=s(m);f=!0;for(var e=l.length;e;){for(c=l,l=[];++d<e;)c&&c[d].run();d=-1,e=l.length}c=null,f=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function h(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new g(t,e)),1!==l.length||f||s(p)},g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],2:[function(t,f,e){(function(n){!function(t){var e=setTimeout;function r(){}function a(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],l(t,this)}function o(r,o){for(;3===r._state;)r=r._value;0!==r._state?(r._handled=!0,a._immediateFn(function(){var t=1===r._state?o.onFulfilled:o.onRejected;if(null!==t){var e;try{e=t(r._value)}catch(n){return void u(o.promise,n)}i(o.promise,e)}else(1===r._state?i:u)(o.promise,r._value)})):r._deferreds.push(o)}function i(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof a)return t._state=3,t._value=e,void s(t);if("function"==typeof n)return void l((r=n,o=e,function(){r.apply(o,arguments)}),t)}t._state=1,t._value=e,s(t)}catch(i){u(t,i)}var r,o}function u(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&a._immediateFn(function(){t._handled||a._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)o(t,t._deferreds[e]);t._deferreds=null}function c(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function l(t,e){var n=!1;try{t(function(t){n||(n=!0,i(e,t))},function(t){n||(n=!0,u(e,t))})}catch(r){if(n)return;n=!0,u(e,r)}}a.prototype["catch"]=function(t){return this.then(null,t)},a.prototype.then=function(t,e){var n=new this.constructor(r);return o(this,new c(t,e,n)),n},a.all=function(t){var s=Array.prototype.slice.call(t);return new a(function(o,i){if(0===s.length)return o([]);var a=s.length;function u(e,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void n.call(t,function(t){u(e,t)},i)}s[e]=t,0==--a&&o(s)}catch(r){i(r)}}for(var t=0;t<s.length;t++)u(t,s[t])})},a.resolve=function(e){return e&&"object"==typeof e&&e.constructor===a?e:new a(function(t){t(e)})},a.reject=function(n){return new a(function(t,e){e(n)})},a.race=function(o){return new a(function(t,e){for(var n=0,r=o.length;n<r;n++)o[n].then(t,e)})},a._immediateFn="function"==typeof n?function(t){n(t)}:function(t){e(t,0)},a._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},a._setImmediateFn=function(t){a._immediateFn=t},a._setUnhandledRejectionFn=function(t){a._unhandledRejectionFn=t},void 0!==f&&f.exports?f.exports=a:t.Promise||(t.Promise=a)}(this)}).call(this,t("timers").setImmediate)},{timers:3}],3:[function(s,t,c){(function(t,e){var r=s("process/browser.js").nextTick,n=Function.prototype.apply,o=Array.prototype.slice,i={},a=0;function u(t,e){this._id=t,this._clearFn=e}c.setTimeout=function(){return new u(n.call(setTimeout,window,arguments),clearTimeout)},c.setInterval=function(){return new u(n.call(setInterval,window,arguments),clearInterval)},c.clearTimeout=c.clearInterval=function(t){t.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},c.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},c.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},c._unrefActive=c.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;0<=e&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},c.setImmediate="function"==typeof t?t:function(t){var e=a++,n=!(arguments.length<2)&&o.call(arguments,1);return i[e]=!0,r(function(){i[e]&&(n?t.apply(null,n):t.call(null),c.clearImmediate(e))}),e},c.clearImmediate="function"==typeof e?e:function(t){delete i[t]}}).call(this,s("timers").setImmediate,s("timers").clearImmediate)},{"process/browser.js":1,timers:3}],4:[function(t,e,n){var r=t("promise-polyfill"),o="undefined"!=typeof window?window:Function("return this;")();e.exports={boltExport:o.Promise||r}},{"promise-polyfill":2}]},{},[4])(4)});var vt=ht.exports.boltExport,yt=function(t){var n=ct.none(),e=[],r=function(t){o()?a(t):e.push(t)},o=function(){return n.isSome()},i=function(t){mt(t,a)},a=function(e){n.each(function(t){h.setTimeout(function(){e(t)},0)})};return t(function(t){n=ct.some(t),i(e),e=[]}),{get:r,map:function(n){return yt(function(e){r(function(t){e(n(t))})})},isReady:o}},bt={nu:yt,pure:function(e){return yt(function(t){t(e)})}},wt=function(t){h.setTimeout(function(){throw t},0)},xt=function(n){var t=function(t){n().then(t,wt)};return{map:function(t){return xt(function(){return n().then(t)})},bind:function(e){return xt(function(){return n().then(function(t){return e(t).toPromise()})})},anonBind:function(t){return xt(function(){return n().then(function(){return t.toPromise()})})},toLazy:function(){return bt.nu(t)},toCached:function(){var t=null;return xt(function(){return null===t&&(t=n()),t})},toPromise:n,get:t}},_t=function(t){return xt(function(){return new vt(t)})},Pt=function(a,t){return t(function(r){var o=[],i=0;0===a.length?r([]):mt(a,function(t,e){var n;t.get((n=e,function(t){o[n]=t,++i>=a.length&&r(o)}))})})},Tt=function(t,e){var n=dt(t,e);return Pt(n,_t)},Dt=function(t,e,n){var r=n||w(e),o=G(t,b(e),r);!1===o.cancelled&&tt(t,o.content)},Ct=function(t,e){e=t.dom.encode(e).replace(/\r\n/g,"\n"),e=C(e,t.settings.forced_root_block,t.settings.forced_root_block_attrs),Dt(t,e,!1)},kt=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},Ft=function(t,e){return e in t&&0<t[e].length},Et=function(t){return Ft(t,"text/html")||Ft(t,"text/plain")},It=S.createIdGenerator("mceclip"),Rt=function(e,t,n){var r,o,i,a,u="paste"===t.type?t.clipboardData:t.dataTransfer;if(e.settings.paste_data_images&&u){var s=(i=(o=u).items?dt(pt(o.items),function(t){return t.getAsFile()}):[],a=o.files?pt(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<s.length)return t.preventDefault(),(r=s,Tt(r,function(r){return _t(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),mt(t,function(t){!function(t,e){var n,r,o,i,a,u,s,c=(n=e.uri,-1!==(r=n.indexOf(","))?n.substr(r+1):null),l=It(),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 h.Image;if(d.src=e.uri,u=t.settings,s=d,!u.images_dataimg_filter||u.images_dataimg_filter(s)){var m,p=t.editorUpload.blobCache,g=void 0;(m=p.findFirst(function(t){return t.base64()===c}))?g=m:(g=p.create(l,e.blob,c,f),p.add(g)),Dt(t,'<img src="'+g.blobUri()+'">',!1)}else Dt(t,'<img src="'+e.uri+'">',!1)}(e,t)})}),!0}return!1},St=function(t){return o.metaKeyPressed(t)&&86===t.keyCode||t.shiftKey&&45===t.keyCode},Ot=function(s,c,l){var e,f,d=(e=p(ct.none()),{clear:function(){e.set(ct.none())},set:function(t){e.set(ct.some(t))},isSet:function(){return e.get().isSome()},on:function(t){e.get().each(t)}});function m(t,e,n,r){var o,i;Ft(t,"text/html")?o=t["text/html"]:(o=c.getHtml(),r=r||w(o),c.isDefaultContent(o)&&(n=!0)),o=S.trimHtml(o),c.remove(),i=!1===r&&D(o),o.length&&!i||(n=!0),n&&(o=Ft(t,"text/plain")&&i?t["text/plain"]:S.innerText(o)),c.isDefaultContent(o)?e||s.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."):n?Ct(s,o):Dt(s,o,r)}s.on("keydown",function(t){function e(t){St(t)&&!t.isDefaultPrevented()&&c.remove()}if(St(t)&&!t.isDefaultPrevented()){if((f=t.shiftKey&&86===t.keyCode)&&g.webkit&&-1!==h.navigator.userAgent.indexOf("Version/"))return;if(t.stopImmediatePropagation(),d.set(t),window.setTimeout(function(){d.clear()},100),g.ie&&f)return t.preventDefault(),void n(s,!0);c.remove(),c.create(),s.once("keyup",e),s.once("paste",function(){s.off("keyup",e)})}}),s.on("paste",function(t){var e,n,r,o=d.isSet(),i=(e=s,n=kt(t.clipboardData||e.getDoc().dataTransfer),S.isMsEdge()?y.extend(n,{"text/html":""}):n),a="text"===l.get()||f,u=Ft(i,x());f=!1,t.isDefaultPrevented()||(r=t.clipboardData,-1!==h.navigator.userAgent.indexOf("Android")&&r&&r.items&&0===r.items.length)?c.remove():Et(i)||!Rt(s,t,c.getLastRng()||s.selection.getRng())?(o||t.preventDefault(),!g.ie||o&&!t.ieFake||Ft(i,"text/html")||(c.create(),s.dom.bind(c.getEl(),"paste",function(t){t.stopPropagation()}),s.getDoc().execCommand("Paste",!1,null),i["text/html"]=c.getHtml()),Ft(i,"text/html")?(t.preventDefault(),u||(u=w(i["text/html"])),m(i,o,a,u)):v.setEditorTimeout(s,function(){m(i,o,a,u)},0)):c.remove()})},At=function(t){return g.ie&&t.inline?h.document.body:t.getBody()},jt=function(e,t,n){var r;At(r=e)!==r.getBody()&&e.dom.bind(t,"paste keyup",function(t){Nt(e,n)||e.fire("paste")})},Mt=function(t){return t.dom.get("mcepastebin")},Lt=function(t,e){return e===t},Nt=function(t,e){var n,r=Mt(t);return(n=r)&&"mcepastebin"===n.id&&Lt(e,r.innerHTML)},Bt=function(a){var u=p(null),s="%MCEPASTEBIN%";return{create:function(){return e=u,n=s,o=(t=a).dom,i=t.getBody(),e.set(t.selection.getRng()),r=t.dom.add(At(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),(g.ie||g.gecko)&&o.setStyle(r,"left","rtl"===o.getStyle(i,"direction",!0)?65535:-65535),o.bind(r,"beforedeactivate focusin focusout",function(t){t.stopPropagation()}),jt(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(Mt(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,u)},getEl:function(){return Mt(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=y.grep(At(n).childNodes,function(t){return"mcepastebin"===t.id}),e=t.shift(),y.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 u.get()},isDefault:function(){return Nt(a,s)},isDefaultContent:function(t){return Lt(s,t)}}},Ht=function(n,t){var e=Bt(n);return n.on("preInit",function(){return Ot(a=n,e,t),void a.parser.addNodeFilter("img",function(t,e,n){var r,o=function(t){t.attr("data-mce-object")||u===g.transparentSrc||t.remove()};if(!a.settings.paste_data_images&&(r=n).data&&!0===r.data.paste)for(var i=t.length;i--;)(u=t[i].attributes.map.src)&&(0===u.indexOf("webkit-fake-url")?o(t[i]):a.settings.allow_html_data_urls||0!==u.indexOf("data:")||o(t[i]))});var a,u}),{pasteFormat:t,pasteHtml:function(t,e){return Dt(n,t,e)},pasteText:function(t){return Ct(n,t)},pasteImageData:function(t,e){return Rt(n,t,e)},getDataTransferItems:kt,hasHtmlOrText:Et,hasContentType:Ft}},$t=function(){},Wt=function(t,e,n){if(r=t,!1!==g.iOS||r===undefined||"function"!=typeof r.setData||!0===S.isMsEdge())return!1;try{return t.clearData(),t.setData("text/html",e),t.setData("text/plain",n),t.setData(x(),e),!0}catch(o){return!1}var r},Ut=function(t,e,n,r){Wt(t.clipboardData,e.html,e.text)?(t.preventDefault(),r()):n(e.html,r)},zt=function(u){return function(t,e){var n=l(t),r=u.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),o=u.dom.create("div",{contenteditable:"true"},n);u.dom.setStyles(r,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),r.appendChild(o),u.dom.add(u.getBody(),r);var i=u.selection.getRng();o.focus();var a=u.dom.createRng();a.selectNodeContents(o),u.selection.setRng(a),setTimeout(function(){u.selection.setRng(i),r.parentNode.removeChild(r),e()},0)}},Vt=function(t){return{html:t.selection.getContent({contextual:!0}),text:t.selection.getContent({format:"text"})}},qt=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},Kt=function(t){var e,n;t.on("cut",(e=t,function(t){qt(e)&&Ut(t,Vt(e),zt(e),function(){setTimeout(function(){e.execCommand("Delete")},0)})})),t.on("copy",(n=t,function(t){qt(n)&&Ut(t,Vt(n),zt(n),$t)}))},Gt=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Xt=function(t,e){return Gt.getCaretRangeFromPoint(e.clientX,e.clientY,t.getDoc())},Yt=function(t,e){t.focus(),t.selection.setRng(e)},Zt=function(a,u,s){m.shouldBlockDrop(a)&&a.on("dragend dragover draggesture dragdrop drop drag",function(t){t.preventDefault(),t.stopPropagation()}),m.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=Xt(a,t),!t.isDefaultPrevented()&&!s.get()){e=u.getDataTransferItems(t.dataTransfer);var r,o=u.hasContentType(e,x());if((u.hasHtmlOrText(e)&&(!(r=e["text/plain"])||0!==r.indexOf("file://"))||!u.pasteImageData(t,n))&&n&&m.shouldFilterDrop(a)){var i=e["mce-internal"]||e["text/html"]||e["text/plain"];i&&(t.preventDefault(),v.setEditorTimeout(a,function(){a.undoManager.transact(function(){e["mce-internal"]&&a.execCommand("Delete"),Yt(a,n),i=S.trimHtml(i),e["text/html"]?u.pasteHtml(i,o):u.pasteText(i)})}))}}}),a.on("dragstart",function(t){s.set(!0)}),a.on("dragover dragend",function(t){m.shouldPasteDataImages(a)&&!1===s.get()&&(t.preventDefault(),Yt(a,Xt(a,t))),"dragend"===t.type&&s.set(!1)})},Jt=function(t){var e=t.plugins.paste,n=m.getPreProcess(t);n&&t.on("PastePreProcess",function(t){n.call(e,e,t)});var r=m.getPostProcess(t);r&&t.on("PastePostProcess",function(t){r.call(e,e,t)})};function Qt(e,n){e.on("PastePreProcess",function(t){t.content=n(e,t.content,t.internal,t.wordContent)})}function te(t,e){if(!V.isWordContent(e))return e;var n=[];y.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=S.filter(e,[[r,"$1"]]),e=S.filter(e,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}function ee(t,e,n,r){if(r||n)return e;var c,o=m.getWebkitStyles(t);if(!1===m.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 u=o[c[a]],s=l.getStyle(f,c[a],!0);/color/.test(c[a])&&(u=l.toHex(u),s=l.toHex(s)),s!==u&&(i[c[a]]=u)}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 ne(n,t){n.$("a",t).find("font,u").each(function(t,e){n.dom.remove(e,!0)})}var re=function(t){var e,n;g.webkit&&Qt(t,ee),g.ie&&(Qt(t,te),n=ne,(e=t).on("PastePostProcess",function(t){n(e,t.node)}))},oe=function(t,e,n){var r=n.control;r.active("text"===e.pasteFormat.get()),t.on("PastePlainTextToggle",function(t){r.active(t.state)})},ie=function(t,e){var n=function(r){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=o.concat(t);return r.apply(null,n)}}(oe,t,e);t.addButton("pastetext",{active:!1,icon:"pastetext",tooltip:"Paste as text",cmd:"mceTogglePlainTextPaste",onPostRender:n}),t.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:e.pasteFormat,cmd:"mceTogglePlainTextPaste",onPostRender:n})};e.add("paste",function(t){if(!1===a(t)){var e=p(!1),n=p(!1),r=p(m.isPasteAsTextEnabled(t)?"text":"html"),o=Ht(t,r),i=re(t);return ie(t,o),c(t,o,e),Jt(t),Kt(t),Zt(t,o,n),u(o,i)}})}(window); \ No newline at end of file