|
|
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>typeof t===e,o=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(s=n.constructor)||void 0===s?void 0:s.name)===r.name)?"string":t;var o,n,r,s})(e),n=t("boolean"),r=e=>null==e,s=e=>!r(e),a=t("function"),i=t("number"),l=e=>()=>e,d=(e,t)=>e===t,c=l(!1);class m{constructor(e,t){this.tag=e,this.value=t}static some(e){return new m(!0,e)}static none(){return m.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?m.some(e(this.value)):m.none()}bind(e){return this.tag?e(this.value):m.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:m.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return s(e)?m.some(e):m.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}m.singletonNone=new m(!1);const u=Array.prototype.indexOf,g=(e,t)=>{return o=e,n=t,u.call(o,n)>-1;var o,n},p=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r<o;r++){const o=e[r];n[r]=t(o,r)}return n},h=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},f=Object.keys;let y=0;const v=(w=/^\s+|\s+$/g,e=>e.replace(w,""));var w;const b=(e,t)=>({element:e,offset:t}),N=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},T={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return N(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return N(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return N(o)},fromDom:N,fromPoint:(e,t,o)=>m.from(e.dom.elementFromPoint(t,o)).map(N)},A=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},C=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,S=A,x=e=>e.dom.nodeName.toLowerCase(),D=e=>e.dom.nodeType,E=e=>t=>D(t)===e,O=E(1),M=E(3),P=E(9),R=E(11),k=e=>m.from(e.dom.parentNode).map(T.fromDom),B=e=>m.from(e.dom.nextSibling).map(T.fromDom),L=e=>p(e.dom.childNodes,T.fromDom),$=e=>T.fromDom(e.dom.host),V=(e,t)=>{k(e).each((o=>{o.dom.insertBefore(t.dom,e.dom)}))},I=(e,t)=>{B(e).fold((()=>{k(e).each((e=>{j(e,t)}))}),(e=>{V(e,t)}))},j=(e,t)=>{e.dom.appendChild(t.dom)},q=(e,t)=>{h(t,((o,n)=>{const r=0===n?e:t[n-1];I(r,o)}))},H=(e,t,r)=>{if(!(o(r)||n(r)||i(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")},z=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},F=(e,t)=>m.from(z(e,t)),K=(e,t)=>{e.dom.removeAttribute(t)},U=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Y=e=>void 0!==e.style&&a(e.style.getPropertyValue),_=e=>{const t=M(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=(e=>T.fromDom(e.dom.getRootNode()))(e);return R(o=t)&&s(o.dom.host)?m.some(t):m.none();var o})(T.fromDom(t)).fold((()=>o.body.contains(t)),(n=_,r=$,e=>n(r(e))));var n,r},G=(e,t)=>Y(e)?e.style.getPropertyValue(t):"",J=(e=>{const t=t=>e(t)?m.from(t.dom.nodeValue):m.none();return{get:o=>{if(!e(o))throw
|