/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.6.0 (2020-11-18) */ !function () { "use strict"; var e, t, r, n = tinymce.util.Tools.resolve("tinymce.PluginManager"), p = function () { return (p = Object.assign || function (e) { for (var t, r = 1, n = arguments.length; r < n; r++) for (var i in t = arguments[r]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]); return e }).apply(this, arguments) }, a = function (e) { return function () { return e } }, o = a(!1), c = a(!0), i = function () { return u }, u = (e = function (e) { return e.isNone() }, { fold: function (e, t) { return e() }, is: o, isSome: o, isNone: c, getOr: r = function (e) { return e }, getOrThunk: t = function (e) { return e() }, getOrDie: function (e) { throw new Error(e || "error: getOrDie called on none.") }, getOrNull: a(null), getOrUndefined: a(undefined), or: r, orThunk: t, map: i, each: function () { }, bind: i, exists: o, forall: c, filter: i, equals: e, equals_: e, toArray: function () { return [] }, toString: a("none()") }), s = function (r) { var e = a(r), t = function () { return i }, n = function (e) { return e(r) }, i = { fold: function (e, t) { return t(r) }, is: function (e) { return r === e }, isSome: c, isNone: o, getOr: e, getOrThunk: e, getOrDie: e, getOrNull: e, getOrUndefined: e, or: t, orThunk: t, map: function (e) { return s(e(r)) }, each: function (e) { e(r) }, bind: n, exists: n, forall: n, filter: function (e) { return e(r) ? i : u }, toArray: function () { return [r] }, toString: function () { return "some(" + r + ")" }, equals: function (e) { return e.is(r) }, equals_: function (e, t) { return e.fold(o, function (e) { return t(r, e) }) } }; return i }, l = { some: s, none: i, from: function (e) { return null === e || e === undefined ? u : s(e) } }, m = function (n) { return function (e) { return r = typeof (t = e), (null === t ? "null" : "object" == r && (Array.prototype.isPrototypeOf(t) || t.constructor && "Array" === t.constructor.name) ? "array" : "object" == r && (String.prototype.isPrototypeOf(t) || t.constructor && "String" === t.constructor.name) ? "string" : r) === n; var t, r } }, d = m("string"), h = m("object"), g = m("array"), v = Array.prototype.push, f = function (e, t) { for (var r = 0, n = e.length; r < n; r++) { t(e[r], r) } }, w = function (e) { var t = e; return { get: function () { return t }, set: function (e) { t = e } } }, b = Object.keys, y = Object.hasOwnProperty, x = function (e, t) { return j(e, t) ? l.from(e[t]) : l.none() }, j = function (e, t) { return y.call(e, t) }, O = function (e) { return e.getParam("media_scripts") }, S = tinymce.util.Tools.resolve("tinymce.util.Tools"), _ = tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"), k = tinymce.util.Tools.resolve("tinymce.html.SaxParser"), A = function (e, t) { if (e) for (var r = 0; r < e.length; r++) if (-1 !== t.indexOf(e[r].filter)) return e[r] }, T = _.DOM, C = function (e) { return e.replace(/px$/, "") }, P = function (o, e) { var c = w(!1), u = {}; return k({ validate: !1, allow_conditional_comments: !0, start: function (e, t) { if (!c.get()) if (j(t.map, "data-ephox-embed-iri")) c.set(!0), i = (n = t).map.style, a = i ? T.parseStyle(i) : {}, u = { type: "ephox-embed-iri", source: n.map["data-ephox-embed-iri"], altsource: "", poster: "", width: x(a, "max-width").map(C).getOr(""), height: x(a, "max-height").map(C).getOr("") }; else { if (u.source || "param" !== e || (u.source = t.map.movie), "iframe" !== e && "object" !== e && "embed" !== e && "video" !== e && "audio" !== e || (u.type || (u.type = e), u = S.extend(t.map, u)), "script" === e) { var r = A(o, t.map.src); if (!r) return; u = {type: "script", source: t.map.src, width: String(r.width), height: String(r.height)} } "source" === e && (u.source ? u.altsource || (u.altsource = t.map.src) : u.source = t.map.src), "img" !== e || u.poster || (u.poster = t.map.src) } var n, i, a } }).parse(e), u.source = u.source || u.src || u.data, u.altsource = u.altsource || "", u.poster = u.poster || "", u }, D = function (e) { var t = { mp3: "audio/mpeg", m4a: "audio/x-m4a", wav: "audio/wav", mp4: "video/mp4", webm: "video/webm", ogg: "video/ogg", swf: "application/x-shockwave-flash" }[e.toLowerCase().split(".").pop()]; return t || "" }, $ = tinymce.util.Tools.resolve("tinymce.html.Schema"), F = tinymce.util.Tools.resolve("tinymce.html.Writer"), M = _.DOM, z = function (e) { return /^[0-9.]+$/.test(e) ? e + "px" : e }, N = function (a, e) { !function (e, t) { for (var r = b(e), n = 0, i = r.length; n < i; n++) { var a = r[n]; t(e[a], a) } }(e, function (e, t) { var r = "" + e; if (a.map[t]) for (var n = a.length; n--;) { var i = a[n]; i.name === t && (r ? (a.map[t] = r, i.value = r) : (delete a.map[t], a.splice(n, 1))) } else r && (a.push({name: t, value: r}), a.map[t] = r) }) }, U = ["source", "altsource"], E = function (e, c, u) { var s, l = F(), m = w(!1), d = 0; return k({ validate: !1, allow_conditional_comments: !0, comment: function (e) { l.comment(e) }, cdata: function (e) { l.cdata(e) }, text: function (e, t) { l.text(e, t) }, start: function (e, t, r) { if (!m.get()) if (j(t.map, "data-ephox-embed-iri")) m.set(!0), n = c, a = (i = t).map.style, (o = a ? M.parseStyle(a) : {})["max-width"] = z(n.width), o["max-height"] = z(n.height), N(i, {style: M.serializeStyle(o)}); else { switch (e) { case"video": case"object": case"embed": case"img": case"iframe": c.height !== undefined && c.width !== undefined && N(t, {width: c.width, height: c.height}) } if (u) switch (e) { case"video": N(t, {poster: c.poster, src: ""}), c.altsource && N(t, {src: ""}); break; case"iframe": N(t, {src: c.source}); break; case"source": if (d < 2 && (N(t, {src: c[U[d]], type: c[U[d] + "mime"]}), !c[U[d]])) return; d++; break; case"img": if (!c.poster) return; s = !0 } } var n, i, a, o; l.start(e, t, r) }, end: function (e) { if (!m.get()) { if ("video" === e && u) for (var t, r = 0; r < 2; r++) { c[U[r]] && ((t = []).map = {}, d <= r && (N(t, { src: c[U[r]], type: c[U[r] + "mime"] }), l.start("source", t, !0))) } var n; c.poster && "object" === e && u && !s && ((n = []).map = {}, N(n, { src: c.poster, width: c.width, height: c.height }), l.start("img", n, !0)) } l.end(e) } }, $({})).parse(e), l.getContent() }, R = [{ regex: /youtu\.be\/([\w\-_\?&=.]+)/i, type: "iframe", w: 560, h: 314, url: "www.youtube.com/embed/$1", allowFullscreen: !0 }, { regex: /youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i, type: "iframe", w: 560, h: 314, url: "www.youtube.com/embed/$2?$4", allowFullscreen: !0 }, { regex: /youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i, type: "iframe", w: 560, h: 314, url: "www.youtube.com/embed/$1", allowFullscreen: !0 }, { regex: /vimeo\.com\/([0-9]+)/, type: "iframe", w: 425, h: 350, url: "player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc", allowFullscreen: !0 }, { regex: /vimeo\.com\/(.*)\/([0-9]+)/, type: "iframe", w: 425, h: 350, url: "player.vimeo.com/video/$2?title=0&byline=0", allowFullscreen: !0 }, { regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/, type: "iframe", w: 425, h: 350, url: 'maps.google.com/maps/ms?msid=$2&output=embed"', allowFullscreen: !1 }, { regex: /dailymotion\.com\/video\/([^_]+)/, type: "iframe", w: 480, h: 270, url: "www.dailymotion.com/embed/video/$1", allowFullscreen: !0 }, { regex: /dai\.ly\/([^_]+)/, type: "iframe", w: 480, h: 270, url: "www.dailymotion.com/embed/video/$1", allowFullscreen: !0 }], L = function (t) { var e = R.filter(function (e) { return e.regex.test(t) }); return 0 < e.length ? S.extend({}, e[0], { url: function (e, t) { for (var r, n = (r = t.match(/^(https?:\/\/|www\.)(.+)$/i)) && 1 < r.length && "www." !== r[1] ? r[1] : "https://", i = e.regex.exec(t), a = n + e.url, o = 0; o < i.length; o++) !function (e) { a = a.replace("$" + e, function () { return i[e] ? i[e] : "" }) }(o); return a.replace(/\?$/, "") }(e[0], t) }) : null }, I = function (r, e) { var n = S.extend({}, e); if (!n.source && (S.extend(n, P(O(r), n.embed)), !n.source)) return ""; n.altsource || (n.altsource = ""), n.poster || (n.poster = ""), n.source = r.convertURL(n.source, "source"), n.altsource = r.convertURL(n.altsource, "source"), n.sourcemime = D(n.source), n.altsourcemime = D(n.altsource), n.poster = r.convertURL(n.poster, "poster"); var t = L(n.source); if (t && (n.source = t.url, n.type = t.type, n.allowFullscreen = t.allowFullscreen, n.width = n.width || String(t.w), n.height = n.height || String(t.h)), n.embed) return E(n.embed, n, !0); var i = A(O(r), n.source); i && (n.type = "script", n.width = String(i.width), n.height = String(i.height)); var a, o, c, u, s, l, m, d, h = r.getParam("audio_template_callback"), f = r.getParam("video_template_callback"); return n.width = n.width || "300", n.height = n.height || "150", S.each(n, function (e, t) { n[t] = r.dom.encode("" + e) }), "iframe" === n.type ? (d = (m = n).allowFullscreen ? ' allowFullscreen="1"' : "", '") : "application/x-shockwave-flash" === n.sourcemime ? (l = '', s.poster && (l += ''), l += "") : -1 !== n.sourcemime.indexOf("audio") ? (c = n, (u = h) ? u(c) : '") : "script" === n.type ? '