386 lines
436 KiB
JavaScript
386 lines
436 KiB
JavaScript
|
/**
|
||
|
* TinyMCE version 7.6.0 (2024-12-11)
|
||
|
*/
|
||
|
!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,((e,t)=>t.isPrototypeOf(e)))?"string":o})(o)===e,n=e=>t=>typeof t===e,s=e=>t=>e===t,r=o("string"),a=o("object"),i=o=>((o,n)=>a(o)&&t(o,n,((t,o)=>e(t)===o)))(o,Object),l=o("array"),c=s(null),d=n("boolean"),u=s(void 0),m=e=>null==e,g=e=>!m(e),p=n("function"),h=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o<n;++o)if(!t(e[o]))return!1;return!0}return!1},b=()=>{},v=e=>()=>e(),x=(e,t)=>(...o)=>e(t.apply(null,o)),y=e=>()=>e,w=e=>e,S=(e,t)=>e===t;function C(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),O=e=>()=>{throw new Error(e)},_=e=>e(),T=y(!1),E=y(!0);class A{constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.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:A.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 g(e)?A.some(e):A.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()"}}A.singletonNone=new A(!1);const M=Array.prototype.slice,D=Array.prototype.indexOf,B=Array.prototype.push,I=(e,t)=>D.call(e,t),F=(e,t)=>I(e,t)>-1,R=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},N=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},z=(e,t)=>{const o=[];for(let n=0;n<e.length;n+=t){const s=M.call(e,n,n+t);o.push(s)}return o},V=(e,t)=>{const o=e.length,n=new Array(o);for(let s=0;s<o;s++){const o=e[s];n[s]=t(o,s)}return n},L=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},H=(e,t)=>{const o=[],n=[];for(let s=0,r=e.length;s<r;s++){const r=e[s];(t(r,s)?o:n).push(r)}return{pass:o,fail:n}},P=(e,t)=>{const o=[];for(let n=0,s=e.length;n<s;n++){const s=e[n];t(s,n)&&o.push(s)}return o},U=(e,t,o)=>(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,((e,n)=>{o=t(o,e,n)})),o),W=(e,t,o)=>(L(e,((e,n)=>{o=t(o,e,n)})),o),j=(e,t)=>((e,t,o)=>{for(let n=0,s=e.length;n<s;n++){const s=e[n];if(t(s,n))return A.some(s);if(o(s,n))break}return A.none()})(e,t,T),$=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return A.some(o);return A.none()},G=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!l(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);B.apply(t,e[o])}return t},q=(e,t)=>G(V(e,t)),Y=(e,t)=>{for(let o=0,n=e.length;o<n;++o)if(!0!==t(e[o],o))return!1;return!0},X=e=>{const t=M.call(e,0);return t.reverse(),t},K=(e,t)=>P(e,(e=>!F(t,e))),J=(e,t)=>{const o={};for(let n=0,s=e.length;n<s;n++){const s=e[n];o[String(s)]=t(s,n)}return o},Q=e=>[e],Z=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},ee=(e,t)=>t>=0&&t<e.length?A.some(e[t]):A.none(),te=e=>ee(e,0),oe=e=>ee(e,e.length-1),ne=p(Array.from)?Array.from:e=>M.call(e),se=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return A.none()},re=Object.keys,ae=Object.hasOwnProperty,ie=(e,t)=>{const o=re(e);for(let n=0,s=o.length;n<s;n++){const s=o[n];t(e[s],s)}},le=(e,t)=>ce(e,((e,o)=>({k:o,v:t(e,o)}))),ce=(e,t)=>{const o={};return ie(e,((e,n)=>{const s=t(e,n);o[s.k]=s.v})),o},de=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{ie(e,((e,s)=>{(t(e,s)?o:n)(e,s)}))},me=(e,t)=>{const o={};return ue(e,t,de(o),b),o},ge=(e,t)=>{const o=[];return ie(e,((e,n)=>{o.push(t(e,n))})),o},pe=(e,t)=>{const o=re(e);for(let n=0,
|
||
|
/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */let{freeze:sv,seal:rv,create:av}=Object,{apply:iv,construct:lv}="undefined"!=typeof Reflect&&Reflect;// eslint-disable-line import/no-mutable-exports
|
||
|
sv||(sv=function(e){return e}),rv||(rv=function(e){return e}),iv||(iv=function(e,t,o){return e.apply(t,o)}),lv||(lv=function(e,t){return new e(...t)});const cv=Sv(Array.prototype.forEach),dv=Sv(Array.prototype.pop),uv=Sv(Array.prototype.push),mv=Sv(String.prototype.toLowerCase),gv=Sv(String.prototype.toString),pv=Sv(String.prototype.match),hv=Sv(String.prototype.replace),fv=Sv(String.prototype.indexOf),bv=Sv(String.prototype.trim),vv=Sv(Object.prototype.hasOwnProperty),xv=Sv(RegExp.prototype.test),yv=(wv=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return lv(wv,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 wv;
|
||
|
/**
|
||
|
* 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 Sv(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),s=1;s<o;s++)n[s-1]=arguments[s];return iv(e,t,n)}}function Cv(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:mv;ev&&
|
||
|
// 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.
|
||
|
ev(e,null);let n=t.length;for(;n--;){let s=t[n];if("string"==typeof s){const e=o(s);e!==s&&(
|
||
|
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
||
|
tv(t)||(t[n]=e),s=e)}e[s]=!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 kv(e){for(let t=0;t<e.length;t++)vv(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 Ov(e){const t=av(null);for(const[o,n]of Zb(e))vv(e,o)&&(Array.isArray(n)?t[o]=kv(n):n&&"object"==typeof n&&n.constructor===Object?t[o]=Ov(n):t[o]=n);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 _v(e,t){for(;null!==e;){const o=nv(e,t);if(o){if(o.get)return Sv(o.get);if("function"==typeof o.value)return Sv(o.value)}e=ov(e)}return function(){return null}}const Tv=sv(["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"]),Ev=sv(["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"]),Av=sv(["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"]),Mv=sv(["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"]),Dv=sv(["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"]),Bv=sv(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Iv=sv(["#text"]),Fv=sv(["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"]),Rv=sv(["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 Yv=Object.freeze({__proto__:null,MUSTACHE_EXPR:Vv,ERB_EXPR:Lv,TMPLIT_EXPR:Hv,DATA_ATTR:Pv,ARIA_ATTR:Uv,IS_ALLOWED_URI:Wv,IS_SCRIPT_OR_DATA:jv,ATTR_WHITESPACE:$v,DOCTYPE_NAME:Gv,CUSTOM_ELEMENT:qv});
|
||
|
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
||
|
const Xv=function(){return"undefined"==typeof window?null:window};var Kv=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xv();const o=t=>e(t)
|
||
|
/**
|
||
|
* Version label, exposed for easier checks
|
||
|
* if DOMPurify is up to date or not
|
||
|
*/;if(o.version="3.1.7",
|
||
|
/**
|
||
|
* Array of elements that DOMPurify removed during sanitation.
|
||
|
* Empty if nothing was removed.
|
||
|
*/
|
||
|
o.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 o.isSupported=!1,o;let{document:n}=t;const s=n,r=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:p}=t,h=c.prototype,f=_v(h,"cloneNode"),b=_v(h,"remove"),v=_v(h,"nextSibling"),x=_v(h,"childNodes"),y=_v(h,"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=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,S="";const{implementation:C,createNodeIterator:k,createDocumentFragment:O,getElementsByTagName:_}=n,{importNode:T}=s;let E={};
|
||
|
/**
|
||
|
* Expose whether this browser supports running the full DOMPurify.
|
||
|
*/o.isSupported="function"==typeof Zb&&"function"==typeof y&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:M,TMPLIT_EXPR:D,DATA_ATTR:B,ARIA_ATTR:I,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:N}=Yv;let{IS_ALLOWED_URI:z}=Yv,V=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 L=Cv({},[...Tv,...Ev,...Av,...Dv,...Iv]);
|
||
|
/* Allowed attribute names */let H=null;const P=Cv({},[...Fv,...Rv,...Nv,...zv]);
|
||
|
/*
|
||
|
* 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 U=Object.seal(av(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}})),W=null,j=null,$=!0,G=!0,q=!1,Y=!0,X=!1,K=!0,J=!1,Q=!1,Z=!1,ee=!1,te=!1,oe=!1,ne=!0,se=!1,re=!0,ae=!1,ie={},le=null;
|
||
|
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */const ce=Cv({},["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 de=null;const ue=Cv({},["audio","video","img","source","image","track"]);
|
||
|
/* Attributes safe for values like "javascript:" */let me=null;const ge=Cv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",he="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";
|
||
|
/* Document namespace */
|
||
|
let be=fe,ve=!1,xe=null;const ye=Cv({},[pe,he,fe],gv);
|
||
|
/* Parsing of strict XHTML documents */let we=null;const Se=["application/xhtml+xml","text/html"];let Ce=null,ke=null;
|
||
|
/* Keep a reference to config to pass to hooks */
|
||
|
/* Ideally, do not touch anything below this line */
|
||
|
/* ______________________________________________ */
|
||
|
const Oe=n.createElement("form"),_e=function(e){return e instanceof RegExp||e instanceof Function},Te=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ke||ke!==e){if(
|
||
|
/* Shield configuration object from tampering */
|
||
|
e&&"object"==typeof e||(e={})
|
||
|
/* Shield configuration object from prototype pollution */,e=Ov(e),we=
|
||
|
// eslint-disable-next-line unicorn/prefer-includes
|
||
|
-1===Se.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.
|
||
|
Ce="application/xhtml+xml"===we?gv:mv,
|
||
|
/* Set configuration parameters */
|
||
|
V=vv(e,"ALLOWED_TAGS")?Cv({},e.ALLOWED_TAGS,Ce):L,H=vv(e,"ALLOWED_ATTR")?Cv({},e.ALLOWED_ATTR,Ce):P,xe=vv(e,"ALLOWED_NAMESPACES")?Cv({},e.ALLOWED_NAMESPACES,gv):ye,me=vv(e,"ADD_URI_SAFE_ATTR")?Cv(Ov(ge),
|
||
|
// eslint-disable-line indent
|
||
|
e.ADD_URI_SAFE_ATTR,
|
||
|
// eslint-disable-line indent
|
||
|
Ce):ge,de=vv(e,"ADD_DATA_URI_TAGS")?Cv(Ov(ue),
|
||
|
// eslint-disable-line indent
|
||
|
e.ADD_DATA_URI_TAGS,
|
||
|
// eslint-disable-line indent
|
||
|
Ce):ue,le=vv(e,"FORBID_CONTENTS")?Cv({},e.FORBID_CONTENTS,Ce):ce,W=vv(e,"FORBID_TAGS")?Cv({},e.FORBID_TAGS,Ce):{},j=vv(e,"FORBID_ATTR")?Cv({},e.FORBID_ATTR,Ce):{},ie=!!vv(e,"USE_PROFILES")&&e.USE_PROFILES,$=!1!==e.ALLOW_ARIA_ATTR,// Default true
|
||
|
G=!1!==e.ALLOW_DATA_ATTR,// Default true
|
||
|
q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,// Default false
|
||
|
Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,// Default true
|
||
|
X=e.SAFE_FOR_TEMPLATES||!1,// Default false
|
||
|
K=!1!==e.SAFE_FOR_XML,// Default true
|
||
|
J=e.WHOLE_DOCUMENT||!1,// Default false
|
||
|
ee=e.RETURN_DOM||!1,// Default false
|
||
|
te=e.RETURN_DOM_FRAGMENT||!1,// Default false
|
||
|
oe=e.RETURN_TRUSTED_TYPE||!1,// Default false
|
||
|
Z=e.FORCE_BODY||!1,// Default false
|
||
|
ne=!1!==e.SANITIZE_DOM,// Default true
|
||
|
se=e.SANITIZE_NAMED_PROPS||!1,// Default false
|
||
|
re=!1!==e.KEEP_CONTENT,// Default true
|
||
|
ae=e.IN_PLACE||!1,// Default false
|
||
|
z=e.ALLOWED_URI_REGEXP||Wv,be=e.NAMESPACE||fe,U=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(U.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(U.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(U.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(G=!1),te&&(ee=!0)
|
||
|
/* Parse profile info */,ie&&(V=Cv({},Iv),H=[],!0===ie.html&&(Cv(V,Tv),Cv(H,Fv)),!0===ie.svg&&(Cv(V,Ev),Cv(H,Rv),Cv(H,zv)),!0===ie.svgFilters&&(Cv(V,Av),Cv(H,Rv),Cv(H,zv)),!0===ie.mathMl&&(Cv(V,Dv),Cv(H,Nv),Cv(H,zv)))
|
||
|
/* Merge configuration parameters */,e.ADD_TAGS&&(V===L&&(V=Ov(V)),Cv(V,e.ADD_TAGS,Ce)),e.ADD_ATTR&&(H===P&&(H=Ov(H)),Cv(H,e.ADD_ATTR,Ce)),e.ADD_URI_SAFE_ATTR&&Cv(me,e.ADD_URI_SAFE_ATTR,Ce),e.FORBID_CONTENTS&&(le===ce&&(le=Ov(le)),Cv(le,e.FORBID_CONTENTS,Ce))
|
||
|
/* Add #text in case KEEP_CONTENT is set to true */,re&&(V["#text"]=!0)
|
||
|
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */,J&&Cv(V,["html","head","body"])
|
||
|
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */,V.table&&(Cv(V,["tbody"]),delete W.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw yv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw yv('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`.
|
||
|
S=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 o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const s="dompurify"+(o?"#"+o:"");try{return e.createPolicy(s,{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 "+s+" could not be created."),null}}(p,r)),
|
||
|
// If creating the internal policy succeeded sign internal variables.
|
||
|
null!==w&&"string"==typeof S&&(S=w.createHTML(""));
|
||
|
// Prevent further manipulation of configuration.
|
||
|
// Not available in IE8, Safari 5, etc.
|
||
|
sv&&sv(e),ke=e}},Ee=Cv({},["mi","mo","mn","ms","mtext"]),Ae=Cv({},["annotation-xml"]),Me=Cv({},["title","style","font","a","script"]),De=Cv({},[...Ev,...Av,...Mv]),Be=Cv({},[...Dv,...Bv]),Ie=function(e){uv(o.removed,{element:e});try{
|
||
|
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
||
|
y(e).removeChild(e)}catch(t){b(e)}},Fe=function(e,t){try{uv(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){uv(o.removed,{attribute:null,from:t})}
|
||
|
// We void attribute values for unremovable "is"" attributes
|
||
|
if(t.removeAttribute(e),"is"===e&&!H[e])if(ee||te)try{Ie(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){
|
||
|
/* Create a HTML document */
|
||
|
let t=null,o=null;if(Z)e="<remove></remove>"+e;else{
|
||
|
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
||
|
const t=pv(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===we&&be===fe&&(
|
||
|
// 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 s=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===fe)try{t=(new g).parseFromString(s,we)}catch(e){}
|
||
|
/* Use createHTMLDocument in case DOMParser is not available */if(!t||!t.documentElement){t=C.createDocument(be,"template",null);try{t.documentElement.innerHTML=ve?S:s}catch(e){
|
||
|
// Syntax error if dirtyPayload is invalid xml
|
||
|
}}const r=t.body||t.documentElement;
|
||
|
/* Work on whole document or just its body */
|
||
|
return e&&o&&r.insertBefore(n.createTextNode(o),r.childNodes[0]||null),be===fe?_.call(t,J?"html":"body")[0]:J?t.documentElement:r},Ne=function(e){return k.call(e.ownerDocument||e,e,
|
||
|
// eslint-disable-next-line no-bitwise
|
||
|
d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ze=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)},Ve=function(e){return"function"==typeof l&&e instanceof l},Le=function(e,t,n){E[e]&&cv(E[e],(e=>{e.call(o,t,n,ke)}))},He=function(e){let t=null;
|
||
|
/* Execute a hook if present */
|
||
|
/* Check if element is clobbered or can clobber */
|
||
|
if(Le("beforeSanitizeElements",e,null),ze(e))return Ie(e),!0;
|
||
|
/* Now let's check the element's type and name */const n=Ce(e.nodeName);
|
||
|
/* Execute a hook if present */
|
||
|
/* Detect mXSS attempts abusing namespace confusion */
|
||
|
if(Le("uponSanitizeElement",e,{tagName:n,allowedTags:V}),e.hasChildNodes()&&!Ve(e.firstElementChild)&&xv(/<[/\w]/g,e.innerHTML)&&xv(/<[/\w]/g,e.textContent))return Ie(e),!0;
|
||
|
/* Remove any occurrence of processing instructions */if(7===e.nodeType)return Ie(e),!0;
|
||
|
/* Remove any kind of possibly harmful comments */if(K&&8===e.nodeType&&xv(/<[/\w]/g,e.data))return Ie(e),!0;
|
||
|
/* Remove element if anything forbids its presence */if(!V[n]||W[n]){
|
||
|
/* Check if we have a custom element to handle */
|
||
|
if(!W[n]&&Ue(n)){if(U.tagNameCheck instanceof RegExp&&xv(U.tagNameCheck,n))return!1;if(U.tagNameCheck instanceof Function&&U.tagNameCheck(n))return!1}
|
||
|
/* Keep content except for bad-listed elements */if(re&&!le[n]){const t=y(e)||e.parentNode,o=x(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n){const s=f(o[n],!0);s.__removalCount=(e.__removalCount||0)+1,t.insertBefore(s,v(e))}}return Ie(e),!0}
|
||
|
/* Check whether element has a valid namespace */return e instanceof c&&!function(e){let t=y(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 o=mv(e.tagName),n=mv(t.tagName);return!!xe[e.namespaceURI]&&(e.namespaceURI===he?
|
||
|
// 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===fe?"svg"===o:
|
||
|
// 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===pe?"svg"===o&&("annotation-xml"===n||Ee[n]):Boolean(De[o]):e.namespaceURI===pe?
|
||
|
// 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===fe?"math"===o:
|
||
|
// The only way to switch from SVG to MathML is via
|
||
|
// <math> and HTML integration points
|
||
|
t.namespaceURI===he?"math"===o&&Ae[n]:Boolean(Be[o]):e.namespaceURI===fe?
|
||
|
// 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===he&&!Ae[n])&&!(t.namespaceURI===pe&&!Ee[n])&&!Be[o]&&(Me[o]||!De[o]):!("application/xhtml+xml"!==we||!xe[e.namespaceURI]))}(e)?(Ie(e),!0):
|
||
|
/* Make sure that older browsers don't get fallback-tag mXSS */
|
||
|
"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!xv(/<\/no(script|embed|frames)/i,e.innerHTML)?(
|
||
|
/* Sanitize element content to be template-safe */
|
||
|
X&&3===e.nodeType&&(
|
||
|
/* Get the element's text content */
|
||
|
t=e.textContent,cv([A,M,D],(e=>{t=hv(t,e," ")})),e.textContent!==t&&(uv(o.removed,{element:e.cloneNode()}),e.textContent=t))
|
||
|
/* Execute a hook if present */,Le("afterSanitizeElements",e,null),!1):(Ie(e),!0)},Pe=function(e,t,o){
|
||
|
/* Make sure attribute cannot clobber */
|
||
|
if(ne&&("id"===t||"name"===t)&&(o in n||o in Oe))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(G&&!j[t]&&xv(B,t));else if($&&xv(I,t));else if(!H[t]||j[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
|
||
|
!(Ue(e)&&(U.tagNameCheck instanceof RegExp&&xv(U.tagNameCheck,e)||U.tagNameCheck instanceof Function&&U.tagNameCheck(e))&&(U.attributeNameCheck instanceof RegExp&&xv(U.attributeNameCheck,t)||U.attributeNameCheck instanceof Function&&U.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&&U.allowCustomizedBuiltInElements&&(U.tagNameCheck instanceof RegExp&&xv(U.tagNameCheck,o)||U.tagNameCheck instanceof Function&&U.tagNameCheck(o))))return!1;
|
||
|
/* Check value is safe. First, is attr inert? If so, is safe */}else if(me[t]);else if(xv(z,hv(o,R,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==fv(o,"data:")||!de[e])if(q&&!xv(F,hv(o,R,"")));else if(o)return!1;return!0},Ue=function(e){return"annotation-xml"!==e&&pv(e,N)},We=function(e){
|
||
|
/* Execute a hook if present */
|
||
|
Le("beforeSanitizeAttributes",e,null);const{attributes:t}=e;
|
||
|
/* Check if we have attributes; if not we might have a text node */if(!t)return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H};let s=t.length;
|
||
|
/* Go backwards over all attributes; safely remove bad ones */for(;s--;){const r=t[s],{name:a,namespaceURI:i,value:l}=r,c=Ce(a);let d="value"===a?l:bv(l);const u=d;
|
||
|
/* Execute a hook if present */
|
||
|
/* Did the hooks approve of the attribute? */
|
||
|
if(n.attrName=c,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,// Allows developers to see this is a property they can set
|
||
|
Le("uponSanitizeAttribute",e,n),d=n.attrValue,n.forceKeepAttr)continue;
|
||
|
/* Remove attribute */
|
||
|
/* Did the hooks approve of the attribute? */if(!n.keepAttr){Fe(a,e);continue}
|
||
|
/* Work around a security issue in jQuery 3.0 */if(!Y&&xv(/\/>/i,d)){Fe(a,e);continue}
|
||
|
/* Sanitize attribute content to be template-safe */X&&cv([A,M,D],(e=>{d=hv(d,e," ")}))
|
||
|
/* Is `value` valid for this attribute? */;const m=Ce(e.nodeName);if(Pe(m,c,d))
|
||
|
/* 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-`
|
||
|
*/
|
||
|
!se||"id"!==c&&"name"!==c||(
|
||
|
// Remove the attribute with this value
|
||
|
Fe(a,e),
|
||
|
// Prefix the value and later re-create the attribute with the sanitized value
|
||
|
d="user-content-"+d),K&&xv(/((--!?|])>)|<\/(style|title)/i,d))Fe(a,e);else{
|
||
|
/* Handle attributes that require Trusted Types */
|
||
|
if(w&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(i);else switch(p.getAttributeType(m,c)){case"TrustedHTML":d=w.createHTML(d);break;case"TrustedScriptURL":d=w.createScriptURL(d)}
|
||
|
/* Handle invalid data-* attribute set by try-catching it */if(d!==u)try{i?e.setAttributeNS(i,a,d):
|
||
|
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
||
|
e.setAttribute(a,d),ze(e)?Ie(e):dv(o.removed)}catch(e){}}else Fe(a,e)}
|
||
|
/* Execute a hook if present */Le("afterSanitizeAttributes",e,null)},je=function e(t){let o=null;const n=Ne(t);
|
||
|
/* Execute a hook if present */for(Le("beforeSanitizeShadowDOM",t,null);o=n.nextNode();)
|
||
|
/* Execute a hook if present */
|
||
|
Le("uponSanitizeShadowNode",o,null),
|
||
|
/* Sanitize tags and elements */
|
||
|
He(o)||(
|
||
|
/* Deep shadow DOM detected */
|
||
|
o.content instanceof a&&e(o.content)
|
||
|
/* Check attributes, sanitize if necessary */,We(o));
|
||
|
/* Execute a hook if present */Le("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 o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,i=null,c=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&&!Ve(e)){if("function"!=typeof e.toString)throw yv("toString is not a function");if("string"!=typeof(e=e.toString()))throw yv("dirty is not a string, aborting")}
|
||
|
/* Return dirty HTML if DOMPurify cannot run */if(!o.isSupported)return e;
|
||
|
/* Assign config vars */if(Q||Te(t)
|
||
|
/* Clean up removed elements */,o.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=Ce(e.nodeName);if(!V[t]||W[t])throw yv("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 */
|
||
|
n=Re("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?
|
||
|
/* Node is already a body, use as is */
|
||
|
n=r:
|
||
|
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
||
|
n.appendChild(r);else{
|
||
|
/* Exit directly if we have nothing to do */
|
||
|
if(!ee&&!X&&!J&&
|
||
|
// eslint-disable-next-line unicorn/prefer-includes
|
||
|
-1===e.indexOf("<"))return w&&oe?w.createHTML(e):e;
|
||
|
/* Initialize the document to work on */
|
||
|
/* Check we have a DOM node from the data */
|
||
|
if(n=Re(e),!n)return ee?null:oe?S:""}
|
||
|
/* Remove first element node (ours) if FORCE_BODY is set */n&&Z&&Ie(n.firstChild)
|
||
|
/* Get node iterator */;const d=Ne(ae?e:n);
|
||
|
/* Now start iterating over the created document */for(;i=d.nextNode();)
|
||
|
/* Sanitize tags and elements */
|
||
|
He(i)||(
|
||
|
/* Shadow DOM detected, sanitize it */
|
||
|
i.content instanceof a&&je(i.content)
|
||
|
/* Check attributes, sanitize if necessary */,We(i));
|
||
|
/* If we sanitized `dirty` in-place, return it. */if(ae)return e;
|
||
|
/* Return sanitized string or DOM */if(ee){if(te)for(c=O.call(n.ownerDocument);n.firstChild;)
|
||
|
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
||
|
c.appendChild(n.firstChild);else c=n;return(H.shadowroot||H.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.
|
||
|
*/
|
||
|
c=T.call(s,c,!0)),c}let u=J?n.outerHTML:n.innerHTML;
|
||
|
/* Serialize doctype if allowed */return J&&V["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&xv(Gv,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u)
|
||
|
/* Sanitize final string template-safe */,X&&cv([A,M,D],(e=>{u=hv(u,e," ")})),w&&oe?w.createHTML(u):u},
|
||
|
/**
|
||
|
* Public method to set the configuration once
|
||
|
* setConfig
|
||
|
*
|
||
|
* @param {Object} cfg configuration object
|
||
|
*/
|
||
|
o.setConfig=function(){Te(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},
|
||
|
/**
|
||
|
* Public method to remove the configuration
|
||
|
* clearConfig
|
||
|
*
|
||
|
*/
|
||
|
o.clearConfig=function(){ke=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.
|
||
|
*/
|
||
|
o.isValidAttribute=function(e,t,o){
|
||
|
/* Initialize shared config vars if necessary. */
|
||
|
ke||Te({});const n=Ce(e),s=Ce(t);return Pe(n,s,o)},
|
||
|
/**
|
||
|
* AddHook
|
||
|
* Public method to add DOMPurify hooks
|
||
|
*
|
||
|
* @param {String} entryPoint entry point for the hook to add
|
||
|
* @param {Function} hookFunction function to execute
|
||
|
*/
|
||
|
o.addHook=function(e,t){"function"==typeof t&&(E[e]=E[e]||[],uv(E[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
|
||
|
*/
|
||
|
o.removeHook=function(e){if(E[e])return dv(E[e])},
|
||
|
/**
|
||
|
* RemoveHooks
|
||
|
* Public method to remove all DOMPurify hooks at a given entryPoint
|
||
|
*
|
||
|
* @param {String} entryPoint entry point for the hooks to remove
|
||
|
*/
|
||
|
o.removeHooks=function(e){E[e]&&(E[e]=[])},
|
||
|
/**
|
||
|
* RemoveAllHooks
|
||
|
* Public method to remove all DOMPurify hooks
|
||
|
*/
|
||
|
o.removeAllHooks=function(){E={}},o}();const Jv=e=>Kv().sanitize(e);var Qv=tinymce.util.Tools.resolve("tinymce.util.I18n");const Zv={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},ex="temporary-placeholder",tx=e=>()=>fe(e,ex).getOr("!not found!"),ox=(e,t)=>{const o=e.toLowerCase();if(Qv.isRtl()){const e=((e,t)=>Ee(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return be(t,e)?e:o}return o},nx=(e,t)=>fe(t,ox(e,t)),sx=(e,t)=>{const o=t();return nx(e,o).getOrThunk(tx(o))},rx=()=>Th("add-focusable",[Jr((e=>{kl(e.element,"svg").each((e=>St(e,"focusable","false")))}))]),ax=(e,t,o,n)=>{var s,r;const a=(e=>!!Qv.isRtl()&&be(Zv,e))(t)?["tox-icon--flip"]:[],i=fe(o,ox(t,o)).or(n).getOrThunk(tx(o));return{dom:{tag:e.tag,attributes:null!==(s=e.attributes)&&void 0!==s?s:{},classes:e.classes.concat(a),innerHtml:i},behaviours:ca([...null!==(r=e.behaviours)&&void 0!==r?r:[],rx()])}},ix=(e,t,o,n=A.none())=>ax(t,e,o(),n),lx={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},cx=Gm({name:"Notification",factory:e=>{const t=Di("notification-text"),o=Vb({dom:zb(`<p id=${t}>${Jv(e.backstageProvider.translate(e.text))}</p>`),behaviours:ca([_h.config({})])}),n=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),s=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),r=Vb({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(0)]},s(0)],behaviours:ca([_h.config({})])}),a={updateProgress:(e,t)=>{e.getSystem().isConnected()&&r.getOpt(e).each((e=>{_h.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(t)]},s(t)])}))},updateText:(e,t)=>{if(e.getSystem().isConnected()){const n=o.get(e);_h.set(n,[dl(t)])}}},i=G([e.icon.toArray(),e.level.toArray(),e.level.bind((e=>A.from(lx[e]))).toArray()]),l=Vb(Nb.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":e.backstageProvider.translate("Close")}},components:[ix("close",{tag:"span",classes:["tox-icon"]},e.iconProvider)],buttonBehaviours:ca([Pb.config({}),Qb.config({...e.backstageProvider.tooltips.getConfig({tooltipText:e.backstageProvider.translate("Close")})})]),action:t=>{e.onAction(t)}})),c=((e,t,o)=>{const n=o(),s=j(e,(e=>be(n,ox(e,n))));return ax({tag:"div",classes:["tox-notification__icon"]},s.getOr(ex),n,A.none())})(i,0,e.iconProvider),d=[c,{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:ca([_h.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert","aria-labelledby":t},classes:e.level.map((e=>["tox-notification","tox-notification--in",`tox-notification--${e}`])).getOr(["tox-notification","tox-notification--in"])},behaviours:ca([Pb.config({}),Bh.config({}),bh.config({mode:"special",onEscape:t=>(e.onAction(t),A.some(!0))})]),components:d.concat(e.progress?[r.asSpec()]:[]).concat([l.asSpec()]),apis:a}},configFields:[gs("level"),rs("progress"),gs("icon"),rs("onAction"),rs("text"),rs("iconProvider"),rs("backstageProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var dx=(e,t,o,n)=>{const s=t.backstage.shared,r=()=>ze(""===e.queryCommandValue("ToggleView")?e.getContentAreaContainer():e.getContainer()),a=()=>{const e=Ko(r());return A.some(e)},i=e=>{a().each((t=>{L(e,(e=>{Vt(e.element,"width"),Kt(e.element)>t.width&&Mt(e.element,"width",t.width+"px")}))}))};return{open:(t,l,c)=>{const d=()=>{n.on((t=>{l();const o=c();(e=>{_h.remove(e,u),m()})(t),((t,o)=>{0===lt(t.element).length?((t,o)=>{vf.hide(t),n.clear(),o&&e.focus()})(t,o):((e,t)=>{t&&bh.focusIn(e)})(t,o)})(t,o)}))},u=pl(cx.sketch({text:t.text,level:F(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,onAction:d,iconProvider:s.providers.icons,backs
|