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" ; 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 } , L = ( 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 } , V = ( 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 ) => ( V ( 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 ( L ( 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 : nv , seal : sv , create : rv } = Object , { apply : av , construct : iv } = "undefined" != typeof Reflect && Reflect ; // eslint-disable-line import/no-mutable-exports
nv || ( nv = function ( e ) { return e } ) , sv || ( sv = function ( e ) { return e } ) , av || ( av = function ( e , t , o ) { return e . apply ( t , o ) } ) , iv || ( iv = function ( e , t ) { return new e ( ... t ) } ) ; const lv = wv ( Array . prototype . forEach ) , cv = wv ( Array . prototype . pop ) , dv = wv ( Array . prototype . push ) , uv = wv ( String . prototype . toLowerCase ) , mv = wv ( String . prototype . toString ) , gv = wv ( String . prototype . match ) , pv = wv ( String . prototype . replace ) , hv = wv ( String . prototype . indexOf ) , fv = wv ( String . prototype . trim ) , bv = wv ( Object . prototype . hasOwnProperty ) , vv = wv ( RegExp . prototype . test ) , xv = ( yv = TypeError , function ( ) { for ( var e = arguments . length , t = new Array ( e ) , o = 0 ; o < e ; o ++ ) t [ o ] = arguments [ o ] ; return iv ( yv , 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 yv ;
/ * *
* 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 wv ( 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 av ( e , t , n ) } } function Sv ( e , t ) { let o = arguments . length > 2 && void 0 !== arguments [ 2 ] ? arguments [ 2 ] : uv ; Zb &&
// 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.
Zb ( 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.
ev ( 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
* / f u n c t i o n C v ( e ) { f o r ( l e t t = 0 ; t < e . l e n g t h ; t + + ) b v ( e , t ) | | ( e [ t ] = n u l l ) ; r e t u r n e }
/ * *
* Shallow clone an object
*
* @ param { Object } object - The object to be cloned .
* @ returns { Object } A new object that copies the original .
* / f u n c t i o n k v ( e ) { c o n s t t = r v ( n u l l ) ; f o r ( c o n s t [ o , n ] o f Q b ( e ) ) b v ( e , o ) & & ( A r r a y . i s A r r a y ( n ) ? t [ o ] = C v ( n ) : n & & " o b j e c t " = = t y p e o f n & & n . c o n s t r u c t o r = = = O b j e c t ? t [ o ] = k v ( n ) : t [ o ] = n ) ; r e t u r n 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 .
* / f u n c t i o n O v ( e , t ) { f o r ( ; n u l l ! = = e ; ) { c o n s t o = o v ( e , t ) ; i f ( o ) { i f ( o . g e t ) r e t u r n w v ( o . g e t ) ; i f ( " f u n c t i o n " = = t y p e o f o . v a l u e ) r e t u r n w v ( o . v a l u e ) } e = t v ( e ) } r e t u r n f u n c t i o n ( ) { r e t u r n n u l l } } c o n s t _ v = n v ( [ " a " , " a b b r " , " a c r o n y m " , " a d d r e s s " , " a r e a " , " a r t i c l e " , " a s i d e " , " a u d i o " , " b " , " b d i " , " b d o " , " b i g " , " b l i n k " , " b l o c k q u o t e " , " b o d y " , " b r " , " b u t t o n " , " c a n v a s " , " c a p t i o n " , " c e n t e r " , " c i t e " , " c o d e " , " c o l " , " c o l g r o u p " , " c o n t e n t " , " d a t a " , " d a t a l i s t " , " d d " , " d e c o r a t o r " , " d e l " , " d e t a i l s " , " d f n " , " d i a l o g " , " d i r " , " d i v " , " d l " , " d t " , " e l e m e n t " , " e m " , " f i e l d s e t " , " f i g c a p t i o n " , " f i g u r e " , " f o n t " , " f o o t e r " , " f o r m " , " h 1 " , " h 2 " , " h 3 " , " h 4 " , " h 5 " , " h 6 " , " h e a d " , " h e a d e r " , " h g r o u p " , " h r " , " h t m l " , " i " , " i m g " , " i n p u t " , " i n s " , " k b d " , " l a b e l " , " l e g e n d " , " l i " , " m a i n " , " m a p " , " m a r k " , " m a r q u e e " , " m e n u " , " m e n u i t e m " , " m e t e r " , " n a v " , " n o b r " , " o l " , " o p t g r o u p " , " o p t i o n " , " o u t p u t " , " p " , " p i c t u r e " , " p r e " , " p r o g r e s s " , " q " , " r p " , " r t " , " r u b y " , " s " , " s a m p " , " s e c t i o n " , " s e l e c t " , " s h a d o w " , " s m a l l " , " s o u r c e " , " s p a c e r " , " s p a n " , " s t r i k e " , " s t r o n g " , " s t y l e " , " s u b " , " s u m m a r y " , " s u p " , " t a b l e " , " t b o d y " , " t d " , " t e m p l a t e " , " t e x t a r e a " , " t f o o t " , " t h " , " t h e a d " , " t i m e " , " t r " , " t r a c k " , " t t " , " u " , " u l " , " v a r " , " v i d e o " , " w b r " ] ) , T v = n v ( [ " s v g " , " a " , " a l t g l y p h " , " a l t g l y p h d e f " , " a l t g l y p h i t e m " , " a n i m a t e c o l o r " , " a n i m a t e m o t i o n " , " a n i m a t e t r a n s f o r m " , " c i r c l e " , " c l i p p a t h " , " d e f s " , " d e s c " , " e l l i p s e " , " f i l t e r " , " f o n t " , " g " , " g l y p h " , " g l y p h r e f " , " h k e r n " , " i m a g e " , " l i n e " , " l i n e a r g r a d i e n t " , " m a r k e r " , " m a s k " , " m e t a d a t a " , " m p a t h " , " p a t h " , " p a t t e r n " , " p o l y g o n " , " p o l y l i n e " , " r a d i a l g r a d i e n t " , " r e c t " , " s t o p " , " s t y l e " , " s w i t c h " , " s y m b o l " , " t e x t " , " t e x t p a t h " , " t i t l e " , " t r e f " , " t s p a n " , " v i e w " , " v k e r n " ] ) , E v = n v ( [ " f e B l e n d " , " f e C o l o r M a t r i x " , " f e C o m p o n e n t T r a n s f e r " , " f e C o m p o s i t e " , " f e C o n v o l v e M a t r i x " , " f e D i f f u s e L i g h t i n g " , " f e D i s p l a c e m e n t M a p " , " f e D i s t a n t L i g h t " , " f e D r o p S h a d o w " , " f e F l o o d " , " f e F u n c A " , " f e F u n c B " , " f e F u n c G " , " f e F u n c R " , " f e G a u s s i a n B l u r " , " f e I m a g e " , " f e M e r g e " , " f e M e r g e N o d e " , " f e M o r p h o l o g y " , " f e O f f s e t " , " f e P o i n t L i g h t " , " f e S p e c u l a r L i g h t i n g " , " f e S p o t L i g h t " , " f e T i l e " , " f e T u r b u l e n c e " ] ) , A v = n v ( [ " a n i m a t e " , " c o l o r - p r o f i l e " , " c u r s o r " , " d i s c a r d " , " f o n t - f a c e " , " f o n t - f a c e - f o r m a t " , " f o n t - f a c e - n a m e " , " f o n t - f a c e - s r c " , " f o n t - f a c e - u r i " , " f o r e i g n o b j e c t " , " h a t c h " , " h a t c h p a t h " , " m e s h " , " m e s h g r a d i e n t " , " m e s h p a t c h " , " m e s h r o w " , " m i s s i n g - g l y p h " , " s c r i p t " , " s e t " , " s o l i d c o l o r " , " u n k n o w n " , " u s e " ] ) , M v = n v ( [ " m a t h " , " m e n c l o s e " , " m e r r o r " , " m f e n c e d " , " m f r a c " , " m g l y p h " , " m i " , " m l a b e l e d t r " , " m m u l t i s c r i p t s " , " m n " , " m o " , " m o v e r " , " m p a d d e d " , " m p h a n t o m " , " m r o o t " , " m r o w " , " m s " , " m s p a c e " , " m s q r t " , " m s t y l e " , " m s u b " , " m s u p " , " m s u b s u p " , " m t a b l e " , " m t d " , " m t e x t " , " m t r " , " m u n d e r " , " m u n d e r o v e r " , " m p r e s c r i p t s " ] ) , D v = n v ( [ " m a c t i o n " , " m a l i g n g r o u p " , " m a l i g n m a r k " , " m l o n g d i v " , " m s c a r r i e s " , " m s c a r r y " , " m s g r o u p " , " m s t a c k " , " m s l i n e " , " m s r o w " , " s e m a n t i c s " , " a n n o t a t i o n " , " a n n o t a t i o n - x m l " , " m p r e s c r i p t s " , " n o n e " ] ) , B v = n v ( [ " # t e x t " ] ) , I v = n v ( [ " a c c e p t " , " a c t i o n " , " a l i g n " , " a l t " , " a u t o c a p i t a l i z e " , " a u t o c o m p l e t e " , " a u t o p i c t u r e i n p i c t u r e " , " a u t o p l a y " , " b a c k g r o u n d " , " b g c o l o r " , " b o r d e r " , " c a p t u r e " , " c e l l p a d d i n g " , " c e l l s p a c i n g " , " c h e c k e d " , " c i t e " , " c l a s s " , " c l e a r " , " c o l o r " , " c o l s " , " c o l s p a n " , " c o n t r o l s " , " c o n t r o l s l i s t " , " c o o r d s " , " c r o s s o r i g i n " , " d a t e t i m e " , " d e c o d i n g " , " d e f a u l t " , " d i r " , " d i s a b l e d " , " d i s a b l e p i c t u r e i n p i c t u r e " , " d i s a b l e r e m o t e p l a y b a c k " , " d o w n l o a d " , " d r a g g a b l e " , " e n c t y p e " , " e n t e r k e y h i n t " , " f a c e " , " f o r " , " h e a d e r s " , " h e i g h t " , " h i d d e n " , " h i g h " , " h r e f " , " h r e f l a n g " , " i d " , " i n p u t m o d e " , " i n t e g r i t y " , " i s m a p " , " k i n d " , " l a b e l " , " l a n g " , " l i s t " , " l o a d i n g " , " l o o p " , " l o w " , " m a x " , " m a x l e n g t h " , " m e d i a " , " m e t h o d " , " m i n " , " m i n l e n g t h " , " m u l t i p l e " , " m u t e d " , " n a m e " , " n o n c e " , " n o s h a d e " , " n o v a l i d a t e " , " n o w r a p " , " o p e n " , " o p t i m u m " , " p a t t e r n " , " p l a c e h o l d e r " , " p l a y s i n l i n e " , " p o p o v e r " , " p o p o v e r t a r g e t " , " p o p o v e r t a r g e t a c t i o n " , " p o s t e r " , " p r e l o a d " , " p u b d a t e " , " r a d i o g r o u p " , " r e a d o n l y " , " r e l " , " r e q u i r e d " , " r e v " , " r e v e r s e d " , " r o l e " , " r o w s " , " r o w s p a n " , " s p e l l c h e c k " , " s c o p e " , " s e l e c t e d " , " s h a p e " , " s i z e " , " s i z e s " , " s p a n " , " s r c l a n g " , " s t a r t " , " s r c " , " s r c s e t " , " s t e p " , " s t y l e " , " s u m m a r y " , " t a b i n d e x " , " t i t l e " , " t r a n s l a t e " , " t y p e " , " u s e m a p " , " v a l i g n " , " v a l u e " , " w i d t h " , " w r a p " , " x m l n s " , " s l o t " ] ) , F v = n v ( [ " a c c e n t - h e i g h t " , " a c c u m u l a t e " , " a d d i t i v e " , " a l i g n m e n t - b a s e l i n e " , " a m p l i t u d e " , " a s c e n t " , " a t t r i b u t e n a m e " , " a t t r i b u t e t y p e " , " a z i m u t h " , " b a s e f r e q u e n c y " , " b a s e l i n e - s h i f t " , " b e g i n " , " b i a s " , " b y " , " c l a s s " , " c l i p " , " c l i p p a t h u n i t s " , " c l i p - p a t h " , " c l i p - r u l e " , " c o l o r " , " c o l o r - i n t e r p o l a t i o n " , " c o l o r - i n t e r p o l a t i o n - f i l t e r s " , " c o l o r - p r o f i l e " , " c o l o r - r e n d e r i n g " , " c x " , " c y " , " d " , " d x " , " d y " , " d i f f u s e c o n s t a n t " , " d i r e c t
// SVG
var qv = Object . freeze ( { _ _proto _ _ : null , MUSTACHE _EXPR : zv , ERB _EXPR : Lv , TMPLIT _EXPR : Vv , DATA _ATTR : Hv , ARIA _ATTR : Pv , IS _ALLOWED _URI : Uv , IS _SCRIPT _OR _DATA : Wv , ATTR _WHITESPACE : jv , DOCTYPE _NAME : $v , CUSTOM _ELEMENT : Gv } ) ;
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
const Yv = function ( ) { return "undefined" == typeof window ? null : window } ; var Xv = function e ( ) { let t = arguments . length > 0 && void 0 !== arguments [ 0 ] ? arguments [ 0 ] : Yv ( ) ; const o = t => e ( t )
/ * *
* Version label , exposed for easier checks
* if DOMPurify is up to date or not
* / ; i f ( o . v e r s i o n = " 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 = Ov ( h , "cloneNode" ) , b = Ov ( h , "remove" ) , v = Ov ( h , "nextSibling" ) , x = Ov ( h , "childNodes" ) , y = Ov ( 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 . i s S u p p o r t e d = " f u n c t i o n " = = t y p e o f Q b & & " f u n c t i o n " = = t y p e o f y & & C & & v o i d 0 ! = = C . c r e a t e H T M L D o c u m e n t ; c o n s t { M U S T A C H E _ E X P R : A , E R B _ E X P R : M , T M P L I T _ E X P R : D , D A T A _ A T T R : B , A R I A _ A T T R : I , I S _ S C R I P T _ O R _ D A T A : F , A T T R _ W H I T E S P A C E : R , C U S T O M _ E L E M E N T : N } = q v ; l e t { I S _ A L L O W E D _ U R I : z } = q v , L = n u l l ;
/ * *
* 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 V = Sv ( { } , [ ... _v , ... Tv , ... Ev , ... Mv , ... Bv ] ) ;
/* Allowed attribute names */ let H = null ; const P = Sv ( { } , [ ... Iv , ... Fv , ... Rv , ... Nv ] ) ;
/ *
* 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 ` .
* / l e t U = O b j e c t . s e a l ( r v ( n u l l , { t a g N a m e C h e c k : { w r i t a b l e : ! 0 , c o n f i g u r a b l e : ! 1 , e n u m e r a b l e : ! 0 , v a l u e : n u l l } , a t t r i b u t e N a m e C h e c k : { w r i t a b l e : ! 0 , c o n f i g u r a b l e : ! 1 , e n u m e r a b l e : ! 0 , v a l u e : n u l l } , a l l o w C u s t o m i z e d B u i l t I n E l e m e n t s : { w r i t a b l e : ! 0 , c o n f i g u r a b l e : ! 1 , e n u m e r a b l e : ! 0 , v a l u e : ! 1 } } ) ) , W = n u l l , j = n u l l , $ = ! 0 , G = ! 0 , q = ! 1 , Y = ! 0 , X = ! 1 , K = ! 0 , J = ! 1 , Q = ! 1 , Z = ! 1 , e e = ! 1 , t e = ! 1 , o e = ! 1 , n e = ! 0 , s e = ! 1 , r e = ! 0 , a e = ! 1 , i e = { } , l e = n u l l ;
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ const ce = Sv ( { } , [ "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 = Sv ( { } , [ "audio" , "video" , "img" , "source" , "image" , "track" ] ) ;
/* Attributes safe for values like "javascript:" */ let me = null ; const ge = Sv ( { } , [ "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 = Sv ( { } , [ pe , he , fe ] , mv ) ;
/* 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 = kv ( 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 ? mv : uv ,
/* Set configuration parameters */
L = bv ( e , "ALLOWED_TAGS" ) ? Sv ( { } , e . ALLOWED _TAGS , Ce ) : V , H = bv ( e , "ALLOWED_ATTR" ) ? Sv ( { } , e . ALLOWED _ATTR , Ce ) : P , xe = bv ( e , "ALLOWED_NAMESPACES" ) ? Sv ( { } , e . ALLOWED _NAMESPACES , mv ) : ye , me = bv ( e , "ADD_URI_SAFE_ATTR" ) ? Sv ( kv ( ge ) ,
// eslint-disable-line indent
e . ADD _URI _SAFE _ATTR ,
// eslint-disable-line indent
Ce ) : ge , de = bv ( e , "ADD_DATA_URI_TAGS" ) ? Sv ( kv ( ue ) ,
// eslint-disable-line indent
e . ADD _DATA _URI _TAGS ,
// eslint-disable-line indent
Ce ) : ue , le = bv ( e , "FORBID_CONTENTS" ) ? Sv ( { } , e . FORBID _CONTENTS , Ce ) : ce , W = bv ( e , "FORBID_TAGS" ) ? Sv ( { } , e . FORBID _TAGS , Ce ) : { } , j = bv ( e , "FORBID_ATTR" ) ? Sv ( { } , e . FORBID _ATTR , Ce ) : { } , ie = ! ! bv ( 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 || Uv , 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 && ( L = Sv ( { } , Bv ) , H = [ ] , ! 0 === ie . html && ( Sv ( L , _v ) , Sv ( H , Iv ) ) , ! 0 === ie . svg && ( Sv ( L , Tv ) , Sv ( H , Fv ) , Sv ( H , Nv ) ) , ! 0 === ie . svgFilters && ( Sv ( L , Ev ) , Sv ( H , Fv ) , Sv ( H , Nv ) ) , ! 0 === ie . mathMl && ( Sv ( L , Mv ) , Sv ( H , Rv ) , Sv ( H , Nv ) ) )
/* Merge configuration parameters */ , e . ADD _TAGS && ( L === V && ( L = kv ( L ) ) , Sv ( L , e . ADD _TAGS , Ce ) ) , e . ADD _ATTR && ( H === P && ( H = kv ( H ) ) , Sv ( H , e . ADD _ATTR , Ce ) ) , e . ADD _URI _SAFE _ATTR && Sv ( me , e . ADD _URI _SAFE _ATTR , Ce ) , e . FORBID _CONTENTS && ( le === ce && ( le = kv ( le ) ) , Sv ( le , e . FORBID _CONTENTS , Ce ) )
/* Add #text in case KEEP_CONTENT is set to true */ , re && ( L [ "#text" ] = ! 0 )
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ , J && Sv ( L , [ "html" , "head" , "body" ] )
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ , L . table && ( Sv ( L , [ "tbody" ] ) , delete W . tbody ) , e . TRUSTED _TYPES _POLICY ) { if ( "function" != typeof e . TRUSTED _TYPES _POLICY . createHTML ) throw xv ( 'TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.' ) ; if ( "function" != typeof e . TRUSTED _TYPES _POLICY . createScriptURL ) throw xv ( '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.
nv && nv ( e ) , ke = e } } , Ee = Sv ( { } , [ "mi" , "mo" , "mn" , "ms" , "mtext" ] ) , Ae = Sv ( { } , [ "annotation-xml" ] ) , Me = Sv ( { } , [ "title" , "style" , "font" , "a" , "script" ] ) , De = Sv ( { } , [ ... Tv , ... Ev , ... Av ] ) , Be = Sv ( { } , [ ... Mv , ... Dv ] ) , Ie = function ( e ) { dv ( 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 { dv ( o . removed , { attribute : t . getAttributeNode ( e ) , from : t } ) } catch ( e ) { dv ( 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 = gv ( 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 .
* / i f ( b e = = = f e ) t r y { t = ( n e w g ) . p a r s e F r o m S t r i n g ( s , w e ) } c a t c h ( 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 ) } , Le = function ( e ) { return "function" == typeof l && e instanceof l } , Ve = function ( e , t , n ) { E [ e ] && lv ( 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 ( Ve ( "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 ( Ve ( "uponSanitizeElement" , e , { tagName : n , allowedTags : L } ) , e . hasChildNodes ( ) && ! Le ( e . firstElementChild ) && vv ( /<[/\w]/g , e . innerHTML ) && vv ( /<[/\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 && vv ( /<[/\w]/g , e . data ) ) return Ie ( e ) , ! 0 ;
/* Remove element if anything forbids its presence */ if ( ! L [ n ] || W [ n ] ) {
/* Check if we have a custom element to handle */
if ( ! W [ n ] && Ue ( n ) ) { if ( U . tagNameCheck instanceof RegExp && vv ( 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 = uv ( e . tagName ) , n = uv ( 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 || ! vv ( /<\/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 , lv ( [ A , M , D ] , ( e => { t = pv ( t , e , " " ) } ) ) , e . textContent !== t && ( dv ( o . removed , { element : e . cloneNode ( ) } ) , e . textContent = t ) )
/* Execute a hook if present */ , Ve ( "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 ;
/ * A l l o w v a l i d d a t a - * a t t r i b u t e s : A t l e a s t o n e c h a r a c t e r a f t e r " - "
( 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 . * / i f ( G & & ! j [ t ] & & v v ( B , t ) ) ; e l s e i f ( $ & & v v ( I , t ) ) ; e l s e i f ( ! H [ t ] | | j [ t ] ) { i f (
// 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 && vv ( U . tagNameCheck , e ) || U . tagNameCheck instanceof Function && U . tagNameCheck ( e ) ) && ( U . attributeNameCheck instanceof RegExp && vv ( 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 && vv ( 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 ( vv ( z , pv ( o , R , "" ) ) ) ; else if ( "src" !== t && "xlink:href" !== t && "href" !== t || "script" === e || 0 !== hv ( o , "data:" ) || ! de [ e ] ) if ( q && ! vv ( F , pv ( o , R , "" ) ) ) ; else if ( o ) return ! 1 ; return ! 0 } , Ue = function ( e ) { return "annotation-xml" !== e && gv ( e , N ) } , We = function ( e ) {
/* Execute a hook if present */
Ve ( "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 : fv ( 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
Ve ( "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 && vv ( /\/>/i , d ) ) { Fe ( a , e ) ; continue }
/* Sanitize attribute content to be template-safe */ X && lv ( [ A , M , D ] , ( e => { d = pv ( 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 (
/ * F u l l D O M C l o b b e r i n g p r o t e c t i o n v i a n a m e s p a c e i s o l a t i o n ,
* 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 && vv ( /((--!?|])>)|<\/(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 ) : cv ( o . removed ) } catch ( e ) { } } else Fe ( a , e ) }
/* Execute a hook if present */ Ve ( "afterSanitizeAttributes" , e , null ) } , je = function e ( t ) { let o = null ; const n = Ne ( t ) ;
/* Execute a hook if present */ for ( Ve ( "beforeSanitizeShadowDOM" , t , null ) ; o = n . nextNode ( ) ; )
/* Execute a hook if present */
Ve ( "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 */ Ve ( "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 (
/ * M a k e s u r e w e h a v e a s t r i n g t o s a n i t i z e .
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 && ! Le ( e ) ) { if ( "function" != typeof e . toString ) throw xv ( "toString is not a function" ) ; if ( "string" != typeof ( e = e . toString ( ) ) ) throw xv ( "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 ( ! L [ t ] || W [ t ] ) throw xv ( "root node is forbidden and cannot be sanitized in-place" ) } } else if ( e instanceof l )
/ * I f d i r t y i s a D O M e l e m e n t , a p p e n d t o a n e m p t y d o c u m e n t t o a v o i d
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 && L [ "!doctype" ] && n . ownerDocument && n . ownerDocument . doctype && n . ownerDocument . doctype . name && vv ( $v , n . ownerDocument . doctype . name ) && ( u = "<!DOCTYPE " + n . ownerDocument . doctype . name + ">\n" + u )
/* Sanitize final string template-safe */ , X && lv ( [ A , M , D ] , ( e => { u = pv ( 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 ] || [ ] , dv ( 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 cv ( 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 Kv = e => Xv ( ) . sanitize ( e ) ; var Jv = tinymce . util . Tools . resolve ( "tinymce.util.I18n" ) ; const Qv = { 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 } , Zv = "temporary-placeholder" , ex = e => ( ) => fe ( e , Zv ) . getOr ( "!not found!" ) , tx = ( e , t ) => { const o = e . toLowerCase ( ) ; if ( Jv . 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 } , ox = ( e , t ) => fe ( t , tx ( e , t ) ) , nx = ( e , t ) => { const o = t ( ) ; return ox ( e , o ) . getOrThunk ( ex ( o ) ) } , sx = ( ) => Th ( "add-focusable" , [ Jr ( ( e => { kl ( e . element , "svg" ) . each ( ( e => St ( e , "focusable" , "false" ) ) ) } ) ) ] ) , rx = ( e , t , o , n ) => { var s , r ; const a = ( e => ! ! Jv . isRtl ( ) && be ( Qv , e ) ) ( t ) ? [ "tox-icon--flip" ] : [ ] , i = fe ( o , tx ( t , o ) ) . or ( n ) . getOrThunk ( ex ( 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 : [ ] , sx ( ) ] ) } } , ax = ( e , t , o , n = A . none ( ) ) => rx ( t , e , o ( ) , n ) , ix = { success : "checkmark" , error : "warning" , err : "error" , warning : "warning" , warn : "warning" , info : "info" } , lx = Gm ( { name : "Notification" , factory : e => { const t = Di ( "notification-text" ) , o = zb ( { dom : Nb ( ` <p id= ${ t } > ${ Kv ( 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 = zb ( { 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 ( ix [ e ] ) ) ) . toArray ( ) ] ) , l = zb ( Rb . sketch ( { dom : { tag : "button" , classes : [ "tox-notification__dismiss" , "tox-button" , "tox-button--naked" , "tox-button--icon" ] , attributes : { "aria-label" : e . backstageProvider . translate ( "Close" ) } } , components : [ ax ( "close" , { tag : "span" , classes : [ "tox-icon" ] } , e . iconProvider ) ] , buttonBehaviours : ca ( [ Hb . config ( { } ) , Jb . 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 , tx ( e , n ) ) ) ) ; return rx ( { tag : "div" , classes : [ "tox-notification__icon" ] } , s . getOr ( Zv ) , 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 ( [ Hb . 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 cx = ( 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 => { V ( e , ( e => { Lt ( 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 ( lx . 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