/**
 * IE11 polyfill for string.repeat function, from
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat#Polyfill
 */ if ( String . prototype . repeat === undefined ) { String . prototype . repeat = function ( count ) : string { if ( this === null ) { throw new TypeError ( 'can\'t convert ' + this + ' to object' ) ; } const str = '' + this ; count = + count ; if ( count !== count ) { count = 0 ; } if ( count < 0 ) { throw new RangeError ( 'repeat count must be non-negative' ) ; } if ( count === Infinity ) { throw new RangeError ( 'repeat count must be less than infinity' ) ; } count = Math . floor ( count ) ; if ( str . length === 0 || count === 0 ) { return '' ; } if ( str . length * count >= 1 << 28 ) { throw new RangeError ( 'repeat count must not overflow maximum string size' ) ; } let rpt = '' ; for ( let i = 0 ; i < count ; i ++ ) { rpt += str ; } return rpt ; } ; } /**
 * IE11 polyfill for string.startsWith function, from https://stackoverflow.com/a/30867255.
 */ if ( String . prototype . startsWith === undefined ) { String . prototype . startsWith = function ( searchString , position ) : boolean { position = position || 0 ; return this . indexOf ( searchString , position ) === position ; } ; } /**
 * IE11 polyfill for string.endsWith function, from
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
 */ if ( String . prototype . endsWith === undefined ) { String . prototype . endsWith = function ( search , length ? ) : boolean { if ( length === undefined || length > this . length ) { length = this . length as number ; } return this . substring ( length - search . length , length ) === search ; } ; } /**
 * IE11 polyfill for string.includes function, from
 * https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/String/includes
 */ if ( String . prototype . includes === undefined ) { String . prototype . includes = function ( search , start ) : boolean { if ( typeof start !== 'number' ) { start = 0 ; } if ( start + search . length > this . length ) { return false ; } else { return this . indexOf ( search , start ) !== - 1 ; } } ; } /**
 * IE11 polyfill for string.trimLeft function, from
 * https://stackoverflow.com/a/2308168
 */ if ( String . prototype . trimLeft === undefined ) { String . prototype . trimLeft = function ( ) : string { return this . replace ( /^\s+/ , '' ) ; } ; } /**
 * IE11 polyfill for string.trimLeft function, from
 * https://stackoverflow.com/a/2308168
 */ if ( String . prototype . trimRight === undefined ) { String . prototype . trimRight = function ( ) : string { return this . replace ( /\s+$/ , '' ) ; } ; } /**
 * IE11 polyfill for Array.forEach function, from ...
 */ if ( Array . prototype . forEach === undefined ) { Array . prototype . forEach = ( action , that ) => { const n = this . length ; for ( let i = 0 ; i < n ; i ++ ) { if ( i in this ) { action . call ( that , ( this as any ) [ i ] , i , this ) ; } } } ; } /**
 * IE11 polyfill for Array.fill function, from ...
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill
 */ if ( Array . prototype . fill === undefined ) { Array . prototype . fill = ( value , start , end ) => { if ( this === null ) { throw new TypeError ( 'this is null or not defined' ) ; } const O = Object ( this ) ; const len = O . length >>> 0 ; const relativeStart = start >> 0 ; let k = relativeStart < 0 ? Math . max ( len + relativeStart , 0 ) : Math . min ( relativeStart , len ) ; const relativeEnd = end === undefined ? len : end >> 0 ; const final = relativeEnd < 0 ? Math . max ( len + relativeEnd , 0 ) : Math . min ( relativeEnd , len ) ; while ( k < final ) { O [ k ] = value ; ++ k ; } return O ; } ; } /**
 * IE11 polyfill for Math.log10 function
 */ if ( Math . log10 === undefined ) { Math . log10 = ( x ) => Math . log ( x ) * Math . LOG10E ; } /**
 * IE11 polyfill for Number.EPSILON.
 */ interface NumberPolyfill { EPSILON : number ; } if ( Number . EPSILON === undefined ) { ( Number as NumberPolyfill ) . EPSILON = Math . pow ( 2 , - 52 ) ; } [ Float32Array , Uint8Array , Int8Array , Uint32Array , Int32Array ] . forEach ( ( arrayType ) => { if ( ! arrayType . prototype . slice ) { Object . defineProperty ( arrayType . prototype , 'slice' , { value : Array . prototype . slice } ) ; } if ( ! arrayType . prototype . reduce ) { Object . defineProperty ( arrayType . prototype , 'reduce' , { value : Array . prototype . reduce } ) ; } if ( ! arrayType . prototype . filter ) { Object . defineProperty ( arrayType . prototype , 'filter' , { value : Array . prototype . filter } ) ; } if ( ! arrayType . prototype . map ) { Object . defineProperty ( arrayType . prototype , 'map' , { value : Array . prototype . map } ) ; } if ( ! arrayType . prototype . indexOf ) { Object . defineProperty ( arrayType . prototype , 'indexOf' , { value : Array . prototype . indexOf } ) ; } } ) ; if ( typeof Object . assign === 'undefined' ) { Object . defineProperty ( Object , 'assign' , { value ( target , varArgs ) { if ( target === undefined && target === null ) { throw new TypeError ( 'Cannot convert undefined or null to object' ) ; } const to = Object ( target ) ; for ( let index = 1 ; index < arguments . length ; index ++ ) { const nextSource = arguments [ index ] ; if ( nextSource !== undefined && nextSource !== null ) { for ( const nextKey in nextSource ) { if ( Object . prototype . hasOwnProperty . call ( nextSource , nextKey ) ) { to [ nextKey ] = nextSource [ nextKey ] ; } } } } return to ; } , configurable : true , writable : true , } ) ; }