tinymce-editor/assets/out/tinymce/tinymce.min.js

385 regels
444 KiB
JavaScript

2020-06-09 03:09:43 +02:00
/**
2024-12-02 15:07:09 +01:00
* TinyMCE version 7.5.1 (TBD)
2020-06-09 03:09:43 +02:00
*/
2024-12-02 15:07:09 +01:00
!function(){"use strict";var e=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},t=function(e){return{eq:e}},n=t((function(e,t){return e===t})),o=function(e){return t((function(t,n){if(t.length!==n.length)return!1;for(var o=t.length,r=0;r<o;r++)if(!e.eq(t[r],n[r]))return!1;return!0}))},r=function(e){return t((function(r,s){var a=Object.keys(r),i=Object.keys(s);if(!function(e,n){return function(e,n){return t((function(t,o){return e.eq(n(t),n(o))}))}(o(e),(function(e){return function(e,t){return Array.prototype.slice.call(e).sort(t)}(e,n)}))}(n).eq(a,i))return!1;for(var l=a.length,d=0;d<l;d++){var c=a[d];if(!e.eq(r[c],s[c]))return!1}return!0}))},s=t((function(t,n){if(t===n)return!0;var a=e(t);return a===e(n)&&(function(e){return-1!==["undefined","boolean","number","string","function","xml","null"].indexOf(e)}(a)?t===n:"array"===a?o(s).eq(t,n):"object"===a&&r(s).eq(t,n))}));const a=Object.getPrototypeOf,i=(e,t,n)=>{var o;return!!n(e,t.prototype)||(null===(o=e.constructor)||void 0===o?void 0:o.name)===t.name},l=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&i(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":t})(t)===e,d=e=>t=>typeof t===e,c=e=>t=>e===t,u=(e,t)=>f(e)&&i(e,t,((e,t)=>a(e)===t)),m=l("string"),f=l("object"),g=e=>u(e,Object),p=l("array"),h=c(null),b=d("boolean"),v=c(void 0),y=e=>null==e,C=e=>!y(e),w=d("function"),E=d("number"),x=(e,t)=>{if(p(e)){for(let n=0,o=e.length;n<o;++n)if(!t(e[n]))return!1;return!0}return!1},_=()=>{},k=(e,t)=>(...n)=>e(t.apply(null,n)),S=(e,t)=>n=>e(t(n)),N=e=>()=>e,R=e=>e,A=(e,t)=>e===t;function T(e,...t){return(...n)=>{const o=t.concat(n);return e.apply(null,o)}}const O=e=>t=>!e(t),B=e=>()=>{throw new Error(e)},P=e=>e(),D=e=>{e()},L=N(!1),M=N(!0);class I{constructor(e,t){this.tag=e,this.value=t}static some(e){return new I(!0,e)}static none(){return I.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?I.some(e(this.value)):I.none()}bind(e){return this.tag?e(this.value):I.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:I.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 C(e)?I.some(e):I.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()"}}I.singletonNone=new I(!1);const F=Array.prototype.slice,U=Array.prototype.indexOf,z=Array.prototype.push,j=(e,t)=>U.call(e,t),H=(e,t)=>j(e,t)>-1,$=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return!0;return!1},V=(e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o},q=(e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)},W=(e,t)=>{for(let n=e.length-1;n>=0;n--)t(e[n],n)},K=(e,t)=>{const n=[],o=[];for(let r=0,s=e.length;r<s;r++){const s=e[r];(t(s,r)?n:o).push(s)}return{pass:n,fail:o}},Y=(e,t)=>{const n=[];for(let o=0,r=e.length;o<r;o++){const r=e[o];t(r,o)&&n.push(r)}return n},G=(e,t,n)=>(W(e,((e,o)=>{n=t(n,e,o)})),n),X=(e,t,n)=>(q(e,((e,o)=>{n=t(n,e,o)})),n),Z=(e,t,n)=>{for(let o=0,r=e.length;o<r;o++){const r=e[o];if(t(r,o))return I.some(r);if(n(r,o))break}return I.none()},Q=(e,t)=>Z(e,t,L),J=(e,t)=>{for(let n=0,o=e.length;n<o;n++)if(t(e[n],n))return I.some(n);return I.none()},ee=e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!p(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);z.apply(t,e[n])}return t},te=(e,t)=>ee(V(e,t)),ne=(e,t)=>{for(
by||(by=function(e){return e}),vy||(vy=function(e){return e}),Cy||(Cy=function(e,t,n){return e.apply(t,n)}),wy||(wy=function(e,t){return new e(...t)});const Ey=Ly(Array.prototype.forEach),xy=Ly(Array.prototype.pop),_y=Ly(Array.prototype.push),ky=Ly(String.prototype.toLowerCase),Sy=Ly(String.prototype.toString),Ny=Ly(String.prototype.match),Ry=Ly(String.prototype.replace),Ay=Ly(String.prototype.indexOf),Ty=Ly(String.prototype.trim),Oy=Ly(Object.prototype.hasOwnProperty),By=Ly(RegExp.prototype.test),Py=(Dy=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return wy(Dy,t)});
/**
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
*
* @param {Function} func - The constructor function to be wrapped and called.
* @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
*/
var Dy;
/**
* Add properties to a lookup table
*
* @param {Object} set - The set to which elements will be added.
* @param {Array} array - The array containing elements to be added to the set.
* @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
* @returns {Object} The modified set with added elements.
*/
/**
* Creates a new function that calls the given function with a specified thisArg and arguments.
*
* @param {Function} func - The function to be wrapped and called.
* @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
*/
function Ly(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return Cy(e,t,o)}}function My(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ky;fy&&
// Make 'in' and truthy checks like Boolean(set.constructor)
// independent of any properties defined on Object.prototype.
// Prevent prototype setters from intercepting set as a this value.
fy(e,null);let o=t.length;for(;o--;){let r=t[o];if("string"==typeof r){const e=n(r);e!==r&&(
// Config presets (e.g. tags.js, attrs.js) are immutable.
gy(t)||(t[o]=e),r=e)}e[r]=!0}return e}
/**
* Clean up an array to harden against CSPP
*
* @param {Array} array - The array to be cleaned.
* @returns {Array} The cleaned version of the array
*/function Iy(e){for(let t=0;t<e.length;t++)Oy(e,t)||(e[t]=null);return e}
/**
* Shallow clone an object
*
* @param {Object} object - The object to be cloned.
* @returns {Object} A new object that copies the original.
*/function Fy(e){const t=yy(null);for(const[n,o]of my(e))Oy(e,n)&&(Array.isArray(o)?t[n]=Iy(o):o&&"object"==typeof o&&o.constructor===Object?t[n]=Fy(o):t[n]=o);return t}
/**
* This method automatically checks if the prop is function or getter and behaves accordingly.
*
* @param {Object} object - The object to look up the getter function in its prototype chain.
* @param {String} prop - The property name for which to find the getter function.
* @returns {Function} The getter function found in the prototype chain or a fallback function.
*/function Uy(e,t){for(;null!==e;){const n=hy(e,t);if(n){if(n.get)return Ly(n.get);if("function"==typeof n.value)return Ly(n.value)}e=py(e)}return function(){return null}}const zy=by(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),jy=by(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hy=by(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),$y=by(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Vy=by(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),qy=by(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Wy=by(["#text"]),Ky=by(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Yy=by(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direct
// SVG
var iC=Object.freeze({__proto__:null,MUSTACHE_EXPR:Zy,ERB_EXPR:Qy,TMPLIT_EXPR:Jy,DATA_ATTR:eC,ARIA_ATTR:tC,IS_ALLOWED_URI:nC,IS_SCRIPT_OR_DATA:oC,ATTR_WHITESPACE:rC,DOCTYPE_NAME:sC,CUSTOM_ELEMENT:aC});
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
const lC=function(){return"undefined"==typeof window?null:window};var dC=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lC();const n=t=>e(t)
/**
* Version label, exposed for easier checks
* if DOMPurify is up to date or not
*/;if(n.version="3.1.7",
/**
* Array of elements that DOMPurify removed during sanitation.
* Empty if nothing was removed.
*/
n.removed=[],!t||!t.document||9!==t.document.nodeType)
// Not running in a browser, provide a factory function
// so that you can pass your own Window
return n.isSupported=!1,n;let{document:o}=t;const r=o,s=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:d,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:f,trustedTypes:g}=t,p=d.prototype,h=Uy(p,"cloneNode"),b=Uy(p,"remove"),v=Uy(p,"nextSibling"),y=Uy(p,"childNodes"),C=Uy(p,"parentNode");
// As per issue #47, the web-components registry is inherited by a
// new document created via createHTMLDocument. As per the spec
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
// a new empty registry is used when creating a template contents owner
// document, so we use that as our parent document to ensure nothing
// is inherited.
if("function"==typeof i){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let w,E="";const{implementation:x,createNodeIterator:_,createDocumentFragment:k,getElementsByTagName:S}=o,{importNode:N}=r;let R={};
/**
* Expose whether this browser supports running the full DOMPurify.
*/n.isSupported="function"==typeof my&&"function"==typeof C&&x&&void 0!==x.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:T,TMPLIT_EXPR:O,DATA_ATTR:B,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:D,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:M}=iC;let{IS_ALLOWED_URI:I}=iC,F=null;
/**
* We consider the elements and attributes below to be safe. Ideally
* don't add any new ones but feel free to remove unwanted ones.
*/
/* allowed element names */const U=My({},[...zy,...jy,...Hy,...Vy,...Wy]);
/* Allowed attribute names */let z=null;const j=My({},[...Ky,...Yy,...Gy,...Xy]);
/*
* Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
*/let H=Object.seal(yy(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$=null,V=null,q=!0,W=!0,K=!1,Y=!0,G=!1,X=!0,Z=!1,Q=!1,J=!1,ee=!1,te=!1,ne=!1,oe=!0,re=!1,se=!0,ae=!1,ie={},le=null;
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */const de=My({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);
/* Tags that are safe for data: URIs */let ce=null;const ue=My({},["audio","video","img","source","image","track"]);
/* Attributes safe for values like "javascript:" */let me=null;const fe=My({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml";
/* Document namespace */
let be=he,ve=!1,ye=null;const Ce=My({},[ge,pe,he],Sy);
/* Parsing of strict XHTML documents */let we=null;const Ee=["application/xhtml+xml","text/html"];let xe=null,_e=null;
/* Keep a reference to config to pass to hooks */
/* Ideally, do not touch anything below this line */
/* ______________________________________________ */
const ke=o.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},Ne=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!_e||_e!==e){if(
/* Shield configuration object from tampering */
e&&"object"==typeof e||(e={})
/* Shield configuration object from prototype pollution */,e=Fy(e),we=
// eslint-disable-next-line unicorn/prefer-includes
-1===Ee.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
xe="application/xhtml+xml"===we?Sy:ky,
/* Set configuration parameters */
F=Oy(e,"ALLOWED_TAGS")?My({},e.ALLOWED_TAGS,xe):U,z=Oy(e,"ALLOWED_ATTR")?My({},e.ALLOWED_ATTR,xe):j,ye=Oy(e,"ALLOWED_NAMESPACES")?My({},e.ALLOWED_NAMESPACES,Sy):Ce,me=Oy(e,"ADD_URI_SAFE_ATTR")?My(Fy(fe),
// eslint-disable-line indent
e.ADD_URI_SAFE_ATTR,
// eslint-disable-line indent
xe):fe,ce=Oy(e,"ADD_DATA_URI_TAGS")?My(Fy(ue),
// eslint-disable-line indent
e.ADD_DATA_URI_TAGS,
// eslint-disable-line indent
xe):ue,le=Oy(e,"FORBID_CONTENTS")?My({},e.FORBID_CONTENTS,xe):de,$=Oy(e,"FORBID_TAGS")?My({},e.FORBID_TAGS,xe):{},V=Oy(e,"FORBID_ATTR")?My({},e.FORBID_ATTR,xe):{},ie=!!Oy(e,"USE_PROFILES")&&e.USE_PROFILES,q=!1!==e.ALLOW_ARIA_ATTR,// Default true
W=!1!==e.ALLOW_DATA_ATTR,// Default true
K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,// Default false
Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,// Default true
G=e.SAFE_FOR_TEMPLATES||!1,// Default false
X=!1!==e.SAFE_FOR_XML,// Default true
Z=e.WHOLE_DOCUMENT||!1,// Default false
ee=e.RETURN_DOM||!1,// Default false
te=e.RETURN_DOM_FRAGMENT||!1,// Default false
ne=e.RETURN_TRUSTED_TYPE||!1,// Default false
J=e.FORCE_BODY||!1,// Default false
oe=!1!==e.SANITIZE_DOM,// Default true
re=e.SANITIZE_NAMED_PROPS||!1,// Default false
se=!1!==e.KEEP_CONTENT,// Default true
ae=e.IN_PLACE||!1,// Default false
I=e.ALLOWED_URI_REGEXP||nC,be=e.NAMESPACE||he,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),G&&(W=!1),te&&(ee=!0)
/* Parse profile info */,ie&&(F=My({},Wy),z=[],!0===ie.html&&(My(F,zy),My(z,Ky)),!0===ie.svg&&(My(F,jy),My(z,Yy),My(z,Xy)),!0===ie.svgFilters&&(My(F,Hy),My(z,Yy),My(z,Xy)),!0===ie.mathMl&&(My(F,Vy),My(z,Gy),My(z,Xy)))
/* Merge configuration parameters */,e.ADD_TAGS&&(F===U&&(F=Fy(F)),My(F,e.ADD_TAGS,xe)),e.ADD_ATTR&&(z===j&&(z=Fy(z)),My(z,e.ADD_ATTR,xe)),e.ADD_URI_SAFE_ATTR&&My(me,e.ADD_URI_SAFE_ATTR,xe),e.FORBID_CONTENTS&&(le===de&&(le=Fy(le)),My(le,e.FORBID_CONTENTS,xe))
/* Add #text in case KEEP_CONTENT is set to true */,se&&(F["#text"]=!0)
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */,Z&&My(F,["html","head","body"])
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */,F.table&&(My(F,["tbody"]),delete $.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Py('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Py('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
// Overwrite existing TrustedTypes policy.
w=e.TRUSTED_TYPES_POLICY,
// Sign local variables required by `sanitize`.
E=w.createHTML("")}else
// Uninitialized policy, attempt to initialize the internal dompurify policy.
void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;
// Allow the callers to control the unique policy name
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
// Policy creation with duplicate names throws in Trusted Types.
let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){
// Policy creation failed (most likely another DOMPurify script has
// already run). Skip creating the policy, as this will only cause errors
// if TT are enforced.
return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(g,s)),
// If creating the internal policy succeeded sign internal variables.
null!==w&&"string"==typeof E&&(E=w.createHTML(""));
// Prevent further manipulation of configuration.
// Not available in IE8, Safari 5, etc.
by&&by(e),_e=e}},Re=My({},["mi","mo","mn","ms","mtext"]),Ae=My({},["annotation-xml"]),Te=My({},["title","style","font","a","script"]),Oe=My({},[...jy,...Hy,...$y]),Be=My({},[...Vy,...qy]),Pe=function(e){_y(n.removed,{element:e});try{
// eslint-disable-next-line unicorn/prefer-dom-node-remove
C(e).removeChild(e)}catch(t){b(e)}},De=function(e,t){try{_y(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){_y(n.removed,{attribute:null,from:t})}
// We void attribute values for unremovable "is"" attributes
if(t.removeAttribute(e),"is"===e&&!z[e])if(ee||te)try{Pe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Le=function(e){
/* Create a HTML document */
let t=null,n=null;if(J)e="<remove></remove>"+e;else{
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
const t=Ny(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===we&&be===he&&(
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=w?w.createHTML(e):e;
/*
* Use the DOMParser API by default, fallback later if needs be
* DOMParser not work for svg when has multiple root element.
*/if(be===he)try{t=(new f).parseFromString(r,we)}catch(e){}
/* Use createHTMLDocument in case DOMParser is not available */if(!t||!t.documentElement){t=x.createDocument(be,"template",null);try{t.documentElement.innerHTML=ve?E:r}catch(e){
// Syntax error if dirtyPayload is invalid xml
}}const s=t.body||t.documentElement;
/* Work on whole document or just its body */
return e&&n&&s.insertBefore(o.createTextNode(n),s.childNodes[0]||null),be===he?S.call(t,Z?"html":"body")[0]:Z?t.documentElement:s},Me=function(e){return _.call(e.ownerDocument||e,e,
// eslint-disable-next-line no-bitwise
c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ie=function(e){return e instanceof m&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Fe=function(e){return"function"==typeof l&&e instanceof l},Ue=function(e,t,o){R[e]&&Ey(R[e],(e=>{e.call(n,t,o,_e)}))},ze=function(e){let t=null;
/* Execute a hook if present */
/* Check if element is clobbered or can clobber */
if(Ue("beforeSanitizeElements",e,null),Ie(e))return Pe(e),!0;
/* Now let's check the element's type and name */const o=xe(e.nodeName);
/* Execute a hook if present */
/* Detect mXSS attempts abusing namespace confusion */
if(Ue("uponSanitizeElement",e,{tagName:o,allowedTags:F}),e.hasChildNodes()&&!Fe(e.firstElementChild)&&By(/<[/\w]/g,e.innerHTML)&&By(/<[/\w]/g,e.textContent))return Pe(e),!0;
/* Remove any occurrence of processing instructions */if(7===e.nodeType)return Pe(e),!0;
/* Remove any kind of possibly harmful comments */if(X&&8===e.nodeType&&By(/<[/\w]/g,e.data))return Pe(e),!0;
/* Remove element if anything forbids its presence */if(!F[o]||$[o]){
/* Check if we have a custom element to handle */
if(!$[o]&&He(o)){if(H.tagNameCheck instanceof RegExp&&By(H.tagNameCheck,o))return!1;if(H.tagNameCheck instanceof Function&&H.tagNameCheck(o))return!1}
/* Keep content except for bad-listed elements */if(se&&!le[o]){const t=C(e)||e.parentNode,n=y(e)||e.childNodes;if(n&&t)for(let o=n.length-1;o>=0;--o){const r=h(n[o],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,v(e))}}return Pe(e),!0}
/* Check whether element has a valid namespace */return e instanceof d&&!function(e){let t=C(e);
// In JSDOM, if we're inside shadow DOM, then parentNode
// can be null. We just simulate parent in this case.
t&&t.tagName||(t={namespaceURI:be,tagName:"template"});const n=ky(e.tagName),o=ky(t.tagName);return!!ye[e.namespaceURI]&&(e.namespaceURI===pe?
// The only way to switch from HTML namespace to SVG
// is via <svg>. If it happens via any other tag, then
// it should be killed.
t.namespaceURI===he?"svg"===n:
// The only way to switch from MathML to SVG is via`
// svg if parent is either <annotation-xml> or MathML
// text integration points.
t.namespaceURI===ge?"svg"===n&&("annotation-xml"===o||Re[o]):Boolean(Oe[n]):e.namespaceURI===ge?
// The only way to switch from HTML namespace to MathML
// is via <math>. If it happens via any other tag, then
// it should be killed.
t.namespaceURI===he?"math"===n:
// The only way to switch from SVG to MathML is via
// <math> and HTML integration points
t.namespaceURI===pe?"math"===n&&Ae[o]:Boolean(Be[n]):e.namespaceURI===he?
// The only way to switch from SVG to HTML is via
// HTML integration points, and from MathML to HTML
// is via MathML text integration points
!(t.namespaceURI===pe&&!Ae[o])&&!(t.namespaceURI===ge&&!Re[o])&&!Be[n]&&(Te[n]||!Oe[n]):!("application/xhtml+xml"!==we||!ye[e.namespaceURI]))}(e)?(Pe(e),!0):
/* Make sure that older browsers don't get fallback-tag mXSS */
"noscript"!==o&&"noembed"!==o&&"noframes"!==o||!By(/<\/no(script|embed|frames)/i,e.innerHTML)?(
/* Sanitize element content to be template-safe */
G&&3===e.nodeType&&(
/* Get the element's text content */
t=e.textContent,Ey([A,T,O],(e=>{t=Ry(t,e," ")})),e.textContent!==t&&(_y(n.removed,{element:e.cloneNode()}),e.textContent=t))
/* Execute a hook if present */,Ue("afterSanitizeElements",e,null),!1):(Pe(e),!0)},je=function(e,t,n){
/* Make sure attribute cannot clobber */
if(oe&&("id"===t||"name"===t)&&(n in o||n in ke))return!1;
/* Allow valid data-* attributes: At least one character after "-"
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
We don't need to check the value; it's always URI safe. */if(W&&!V[t]&&By(B,t));else if(q&&By(P,t));else if(!z[t]||V[t]){if(
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
!(He(e)&&(H.tagNameCheck instanceof RegExp&&By(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&By(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||
// Alternative, second condition checks if it's an `is`-attribute, AND
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
"is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&By(H.tagNameCheck,n)||H.tagNameCheck instanceof Function&&H.tagNameCheck(n))))return!1;
/* Check value is safe. First, is attr inert? If so, is safe */}else if(me[t]);else if(By(I,Ry(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Ay(n,"data:")||!ce[e])if(K&&!By(D,Ry(n,L,"")));else if(n)return!1;return!0},He=function(e){return"annotation-xml"!==e&&Ny(e,M)},$e=function(e){
/* Execute a hook if present */
Ue("beforeSanitizeAttributes",e,null);const{attributes:t}=e;
/* Check if we have attributes; if not we might have a text node */if(!t)return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z};let r=t.length;
/* Go backwards over all attributes; safely remove bad ones */for(;r--;){const s=t[r],{name:a,namespaceURI:i,value:l}=s,d=xe(a);let c="value"===a?l:Ty(l);const u=c;
/* Execute a hook if present */
/* Did the hooks approve of the attribute? */
if(o.attrName=d,o.attrValue=c,o.keepAttr=!0,o.forceKeepAttr=void 0,// Allows developers to see this is a property they can set
Ue("uponSanitizeAttribute",e,o),c=o.attrValue,o.forceKeepAttr)continue;
/* Remove attribute */
/* Did the hooks approve of the attribute? */if(!o.keepAttr){De(a,e);continue}
/* Work around a security issue in jQuery 3.0 */if(!Y&&By(/\/>/i,c)){De(a,e);continue}
/* Sanitize attribute content to be template-safe */G&&Ey([A,T,O],(e=>{c=Ry(c,e," ")}))
/* Is `value` valid for this attribute? */;const m=xe(e.nodeName);if(je(m,d,c))
/* Work around a security issue with comments inside attributes */
if(
/* Full DOM Clobbering protection via namespace isolation,
* Prefix id and name attributes with `user-content-`
*/
!re||"id"!==d&&"name"!==d||(
// Remove the attribute with this value
De(a,e),
// Prefix the value and later re-create the attribute with the sanitized value
c="user-content-"+c),X&&By(/((--!?|])>)|<\/(style|title)/i,c))De(a,e);else{
/* Handle attributes that require Trusted Types */
if(w&&"object"==typeof g&&"function"==typeof g.getAttributeType)if(i);else switch(g.getAttributeType(m,d)){case"TrustedHTML":c=w.createHTML(c);break;case"TrustedScriptURL":c=w.createScriptURL(c)}
/* Handle invalid data-* attribute set by try-catching it */if(c!==u)try{i?e.setAttributeNS(i,a,c):
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
e.setAttribute(a,c),Ie(e)?Pe(e):xy(n.removed)}catch(e){}}else De(a,e)}
/* Execute a hook if present */Ue("afterSanitizeAttributes",e,null)},Ve=function e(t){let n=null;const o=Me(t);
/* Execute a hook if present */for(Ue("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)
/* Execute a hook if present */
Ue("uponSanitizeShadowNode",n,null),
/* Sanitize tags and elements */
ze(n)||(
/* Deep shadow DOM detected */
n.content instanceof a&&e(n.content)
/* Check attributes, sanitize if necessary */,$e(n));
/* Execute a hook if present */Ue("afterSanitizeShadowDOM",t,null)};
/**
* Sanitize
* Public method providing core sanitation functionality
*
* @param {String|Node} dirty string or DOM node
* @param {Object} cfg object
*/
// eslint-disable-next-line complexity
return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,s=null,i=null,d=null;
/* Stringify, in case dirty is an object */
if(
/* Make sure we have a string to sanitize.
DO NOT return early, as this will return the wrong type if
the user has requested a DOM object rather than a string */
ve=!e,ve&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Fe(e)){if("function"!=typeof e.toString)throw Py("toString is not a function");if("string"!=typeof(e=e.toString()))throw Py("dirty is not a string, aborting")}
/* Return dirty HTML if DOMPurify cannot run */if(!n.isSupported)return e;
/* Assign config vars */if(Q||Ne(t)
/* Clean up removed elements */,n.removed=[],
/* Check if dirty is correctly typed for IN_PLACE */
"string"==typeof e&&(ae=!1),ae){
/* Do some early pre-sanitization to avoid unsafe root nodes */
if(e.nodeName){const t=xe(e.nodeName);if(!F[t]||$[t])throw Py("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)
/* If dirty is a DOM element, append to an empty document to avoid
elements being stripped by the parser */
o=Le("\x3c!----\x3e"),s=o.ownerDocument.importNode(e,!0),1===s.nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?
/* Node is already a body, use as is */
o=s:
// eslint-disable-next-line unicorn/prefer-dom-node-append
o.appendChild(s);else{
/* Exit directly if we have nothing to do */
if(!ee&&!G&&!Z&&
// eslint-disable-next-line unicorn/prefer-includes
-1===e.indexOf("<"))return w&&ne?w.createHTML(e):e;
/* Initialize the document to work on */
/* Check we have a DOM node from the data */
if(o=Le(e),!o)return ee?null:ne?E:""}
/* Remove first element node (ours) if FORCE_BODY is set */o&&J&&Pe(o.firstChild)
/* Get node iterator */;const c=Me(ae?e:o);
/* Now start iterating over the created document */for(;i=c.nextNode();)
/* Sanitize tags and elements */
ze(i)||(
/* Shadow DOM detected, sanitize it */
i.content instanceof a&&Ve(i.content)
/* Check attributes, sanitize if necessary */,$e(i));
/* If we sanitized `dirty` in-place, return it. */if(ae)return e;
/* Return sanitized string or DOM */if(ee){if(te)for(d=k.call(o.ownerDocument);o.firstChild;)
// eslint-disable-next-line unicorn/prefer-dom-node-append
d.appendChild(o.firstChild);else d=o;return(z.shadowroot||z.shadowrootmode)&&(
/*
AdoptNode() is not used because internal state is not reset
(e.g. the past names map of a HTMLFormElement), this is safe
in theory but we would rather not risk another attack vector.
The state that is cloned by importNode() is explicitly defined
by the specs.
*/
d=N.call(r,d,!0)),d}let u=Z?o.outerHTML:o.innerHTML;
/* Serialize doctype if allowed */return Z&&F["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&By(sC,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u)
/* Sanitize final string template-safe */,G&&Ey([A,T,O],(e=>{u=Ry(u,e," ")})),w&&ne?w.createHTML(u):u},
/**
* Public method to set the configuration once
* setConfig
*
* @param {Object} cfg configuration object
*/
n.setConfig=function(){Ne(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},
/**
* Public method to remove the configuration
* clearConfig
*
*/
n.clearConfig=function(){_e=null,Q=!1},
/**
* Public method to check if an attribute value is valid.
* Uses last set config, if any. Otherwise, uses config defaults.
* isValidAttribute
*
* @param {String} tag Tag name of containing element.
* @param {String} attr Attribute name.
* @param {String} value Attribute value.
* @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
*/
n.isValidAttribute=function(e,t,n){
/* Initialize shared config vars if necessary. */
_e||Ne({});const o=xe(e),r=xe(t);return je(o,r,n)},
/**
* AddHook
* Public method to add DOMPurify hooks
*
* @param {String} entryPoint entry point for the hook to add
* @param {Function} hookFunction function to execute
*/
n.addHook=function(e,t){"function"==typeof t&&(R[e]=R[e]||[],_y(R[e],t))},
/**
* RemoveHook
* Public method to remove a DOMPurify hook at a given entryPoint
* (pops it from the stack of hooks if more are present)
*
* @param {String} entryPoint entry point for the hook to remove
* @return {Function} removed(popped) hook
*/
n.removeHook=function(e){if(R[e])return xy(R[e])},
/**
* RemoveHooks
* Public method to remove all DOMPurify hooks at a given entryPoint
*
* @param {String} entryPoint entry point for the hooks to remove
*/
n.removeHooks=function(e){R[e]&&(R[e]=[])},
/**
* RemoveAllHooks
* Public method to remove all DOMPurify hooks
*/
n.removeAllHooks=function(){R={}},n}();const cC=Dt.each,uC=Dt.trim,mC=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],fC={ftp:21,http:80,https:443,mailto:25},gC=["img","video"],pC=(e,t,n)=>{const o=(e=>{try{return decodeURIComponent(e)}catch(t){return unescape(e)}})(t).replace(/\s/g,"");return!e.allow_script_urls&&(!!/((java|vb)script|mhtml):/i.test(o)||!e.allow_html_data_urls&&(/^data:image\//i.test(o)?((e,t)=>C(e)?!e:!C(t)||!H(gC,t))(e.allow_svg_data_urls,n)&&/^data:image\/svg\+xml/i.test(o):/^data:/i.test(o)))};class hC{static parseDataUri(e){let t;const n=decodeURIComponent(e).split(","),o=/data:([^;]+)/.exec(n[0]);return o&&(t=o[1]),{type:t,data:n[1]}}static isDomSafe(e,t,n={}){if(n.allow_script_urls)return!0;{const o=ys.decode(e).replace(/[\s\u0000-\u001F]+/g,"");return!pC(n,o,t)}}static getDocumentBaseUrl(e){var t;let n;return n=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?null!==(t=e.href)&&void 0!==t?t:"":e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/")),n}constructor(e,t={}){this.path="",this.directory="",e=uC(e),this.settings=t;const n=t.base_uri,o=this;if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(o.source=e);const r=0===e.indexOf("//");if(0!==e.indexOf("/")||r||(e=(n&&n.protocol||"http")+"://mce_host"+e),!/^[\w\-]*:?\/\//.test(e)){const t=n?n.path:new hC(document.location.href).directory;if(""===(null==n?void 0:n.protocol))e="//mce_host"+o.toAbsPath(t,e);else{const r=/([^#?]*)([#?]?.*)/.exec(e);r&&(e=(n&&n.protocol||"http")+"://mce_host"+o.toAbsPath(t,r[1])+r[2])}}e=e.replace(/@@/g,"(mce_at)");const s=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);s&&cC(mC,((e,t)=>{let n=s[t];n&&(n=n.replace(/\(mce_at\)/g,"@@")),o[e]=n})),n&&(o.protocol||(o.protocol=n.protocol),o.userInfo||(o.userInfo=n.userInfo),o.port||"mce_host"!==o.host||(o.port=n.port),o.host&&"mce_host"!==o.host||(o.host=n.host),o.source=""),r&&(o.protocol="")}setPath(e){const t=/^(.*?)\/?(\w+)?$/.exec(e);t&&(this.path=t[0],this.directory=t[1],this.file=t[2]),this.source="",this.getURI()}toRelative(e){if("./"===e)return e;const t=new hC(e,{base_uri:this});if("mce_host"!==t.host&&this.host!==t.host&&t.host||this.port!==t.port||this.protocol!==t.protocol&&""!==t.protocol)return t.getURI();const n=this.getURI(),o=t.getURI();if(n===o||"/"===n.charAt(n.length-1)&&n.substr(0,n.length-1)===o)return n;let r=this.toRelPath(this.path,t.path);return t.query&&(r+="?"+t.query),t.anchor&&(r+="#"+t.anchor),r}toAbsolute(e,t){const n=new hC(e,{base_uri:this});return n.getURI(t&&this.isSameOrigin(n))}isSameOrigin(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;const t=this.protocol?fC[this.protocol]:null;if(t&&(this.port||t)==(e.port||t))return!0}return!1}toRelPath(e,t){let n,o,r=0,s="";const a=e.substring(0,e.lastIndexOf("/")).split("/"),i=t.split("/");if(a.length>=i.length)for(n=0,o=a.length;n<o;n++)if(n>=i.length||a[n]!==i[n]){r=n+1;break}if(a.length<i.length)for(n=0,o=i.length;n<o;n++)if(n>=a.length||a[n]!==i[n]){r=n+1;break}if(1===r)return t;for(n=0,o=a.length-(r-1);n<o;n++)s+="../";for(n=r-1,o=i.length;n<o;n++)s+=n!==r-1?"/"+i[n]:i[n];return s}toAbsPath(e,t){let n=0;const o=/\/$/.test(t)?"/":"",r=e.split("/"),s=t.split("/"),a=[];cC(r,(e=>{e&&a.push(e)}));const i=[];for(let e=s.length-1;e>=0;e--)0!==s[e].length&&"."!==s[e]&&(".."!==s[e]?n>0?n--:i.push(s[e]):n++);const l=a.length-n;let d;return d=l<=0?oe(i).join("/"):a.slice(0,l).join("/")+"/"+oe(i).join("/"),0!==d.indexOf("/")&&(d="/"+d),o&&d.lastIndexOf("/")!==d.length-1&&(d+=o),d}getURI(e=!1){let t;return this.source&&!e||(t="",e||(this.protocol?t+=this.protocol+"://":t+="//",this.userInfo&&(t+=this.userInfo+"@"),this.host&&(t+=this.host),this.port&&(t+=":"+this.port)),this.path&&(t+=this.path),th