fuck-tiny-cloud/plugins/inlinecss/plugin.min.js

10 lines
60 KiB
JavaScript
Raw Normal View History

2023-11-01 22:54:59 -04:00
/*!
* Tiny Inline CSS plugin
*
* Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
* Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/
*
* Version: 1.0.0-22
*/
!function(){"use strict";const t=t=>parseInt(t,10),e=(t,e)=>{const n=t-e;return 0===n?0:n>0?1:-1},n=(t,e,n)=>({major:t,minor:e,patch:n}),r=e=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return r?n(t(r[1]),t(r[2]),t(r[3])):n(0,0,0)},o=t=>e=>(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(n=r=t,(o=String).prototype.isPrototypeOf(n)||(null===(i=r.constructor)||void 0===i?void 0:i.name)===o.name)?"string":e;var n,r,o,i})(e)===t,i=t=>e=>typeof e===t,s=t=>e=>t===e,a=o("string"),l=o("object"),c=o("array"),u=s(null),h=i("boolean"),d=s(void 0),f=t=>!(t=>null==t)(t),p=i("function"),m=i("number"),g=()=>{},k=t=>()=>t;function y(t,...e){return(...n)=>{const r=e.concat(n);return t.apply(null,r)}}const v=k(!1),S=k(!0);class b{constructor(t,e){this.tag=t,this.value=e}static some(t){return new b(!0,t)}static none(){return b.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?b.some(t(this.value)):b.none()}bind(t){return this.tag?t(this.value):b.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:b.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return f(t)?b.some(t):b.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}b.singletonNone=new b(!1);const C=Array.prototype.slice,w=Array.prototype.indexOf,x=Array.prototype.push,A=(t,e)=>{return n=t,r=e,w.call(n,r)>-1;var n,r},L=(t,e)=>{const n=t.length,r=new Array(n);for(let o=0;o<n;o++){const n=t[o];r[o]=e(n,o)}return r},E=(t,e)=>{for(let n=0,r=t.length;n<r;n++)e(t[n],n)},T=(t,e)=>{const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r];e(o,r)&&n.push(o)}return n},_=(t,e)=>(t=>{const e=[];for(let n=0,r=t.length;n<r;++n){if(!c(t[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+t);x.apply(e,t[n])}return e})(L(t,e)),O=p(Array.from)?Array.from:t=>C.call(t),P=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},I=(t,e)=>{const n=(e||document).createElement(t);return P(n)},N=P,M=(t,e)=>{const n=t.dom;if(1!==n.nodeType)return!1;{const t=n;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(void 0!==t.mozMatchesSelector)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}},j="undefined"!=typeof window?window:Function("return this;")(),D=(t,e)=>((t,e)=>{let n=null!=e?e:j;for(let e=0;e<t.length&&null!=n;++e)n=n[t[e]];return n})(t.split("."),e),R=Object.getPrototypeOf,B=t=>{const e=D("ownerDocument.defaultView",t);return l(t)&&((t=>((t,e)=>{const n=((t,e)=>D(t,e))(t,e);if(null==n)throw new Error(t+" not available on this browser");return n})("HTMLElement",t))(e).prototype.isPrototypeOf(t)||/^HTML\w*Element$/.test(R(t).constructor.name))},U=t=>e=>(t=>t.dom.nodeType)(e)===t,$=U(1),z=U(9),V=U(11),F=t=>N(t.dom.ownerDocument),W=t=>z(t)?t:F(t),G=t=>L(t.dom.childNodes,N),q=(t,e)=>{t.dom.appendChild(e.dom)},H=t=>{const e=t.dom;null!==e.parentNode&&e.parentNode.removeChild(e)},J=(t,e)=>{const n=F(t).dom,r=N(n.createDocumentFragment()),o=((t,e)=>{const n=(e||document).createElement("div");return n.innerHTML=t,G(N(n))})(e,n);var i;i=r,E(o,(t=>{q(i,t)})),(t=>{t.dom.textContent="",E(G(t),(t=>{H(t)}))})(t),q(t,r)},Q=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode),Y=k(Q),K=Q?t=>N(t.dom.getRootNode()):W,X=t=>{const e=t.dom.body;if(null==e)throw new Error("Body is not available yet");return N(e)},Z=(t,e)=>((t,n)=>{return(r=t.dom.childNodes,o=t=>(t=>M(t,e))(N(t)),((t,e,n)=>{for(let r=0,o=t.length;r<o;r