2022-11-28 14:00:45 +00:00
/ * *
* Minified by jsDelivr using Terser v5 . 15.1 .
* Original file : / n p m / s i m p l e - d a t a t a b l e s @ 4 . 0 . 7 / d i s t / u m d / s i m p l e - d a t a t a b l e s . j s
*
* Do NOT use SRI with dynamically generated files ! More information : https : //www.jsdelivr.com/using-sri-with-dynamic-files
* /
2022-11-28 14:05:48 +00:00
! function ( t ) { if ( typeof exports === "object" && typeof module !== "undefined" ) module . exports = t ( ) ; else if ( typeof define === "function" && define . amd ) define ( [ ] , t ) ; else { ( typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : this ) . simpleDatatables = t ( ) } } ( ( ( ) => function t ( e , s , i ) { function a ( r , o ) { if ( ! s [ r ] ) { if ( ! e [ r ] ) { const h = typeof require === "function" && require ; if ( ! o && h ) return h ( r , ! 0 ) ; if ( n ) return n ( r , ! 0 ) ; const l = new Error ( ` Cannot find module ' ${ r } ' ` ) ; throw l . code = "MODULE_NOT_FOUND" , l } const d = s [ r ] = { exports : { } } ; e [ r ] [ 0 ] . call ( d . exports , ( ( t ) => a ( e [ r ] [ 1 ] [ t ] || t ) ) , d , d . exports , t , e , s , i ) } return s [ r ] . exports } for ( var n = typeof require === "function" && require , r = 0 ; r < i . length ; r ++ ) a ( i [ r ] ) ; return a } ( { 1 : [ function ( t , e , s ) { ( function ( t ) { ( function ( ) { "use strict" ;
typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : void 0 !== t || typeof self !== "undefined" && self ; const e = { exports : { } } . exports = function ( ) { const t = 6e4 ; const e = 36e5 ; const s = "millisecond" ; const i = "second" ; const a = "minute" ; const n = "hour" ; const r = "day" ; const o = "week" ; const h = "month" ; const l = "quarter" ; const d = "year" ; const c = "date" ; const u = "Invalid Date" ; const p = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/ ; const f = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g ; const g = { name : "en" , weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday" . split ( "_" ) , months : "January_February_March_April_May_June_July_August_September_October_November_December" . split ( "_" ) } ; const m = function ( t , e , s ) { const i = String ( t ) ; return ! i || i . length >= e ? t : ` ${ Array ( e + 1 - i . length ) . join ( s ) } ${ t } ` } ; const b = { s : m , z ( t ) { const e = - t . utcOffset ( ) ; const s = Math . abs ( e ) ; const i = Math . floor ( s / 60 ) ; const a = s % 60 ; return ` ${ ( e <= 0 ? "+" : "-" ) + m ( i , 2 , "0" ) } : ${ m ( a , 2 , "0" ) } ` } , m : function t ( e , s ) { if ( e . date ( ) < s . date ( ) ) return - t ( s , e ) ; const i = 12 * ( s . year ( ) - e . year ( ) ) + ( s . month ( ) - e . month ( ) ) ; const a = e . clone ( ) . add ( i , h ) ; const n = s - a < 0 ; const r = e . clone ( ) . add ( i + ( n ? - 1 : 1 ) , h ) ; return + ( - ( i + ( s - a ) / ( n ? a - r : r - a ) ) || 0 ) } , a ( t ) { return t < 0 ? Math . ceil ( t ) || 0 : Math . floor ( t ) } , p ( t ) { return { M : h , y : d , w : o , d : r , D : c , h : n , m : a , s : i , ms : s , Q : l } [ t ] || String ( t || "" ) . toLowerCase ( ) . replace ( /s$/ , "" ) } , u ( t ) { return void 0 === t } } ; let v = "en" ; const y = { } ; y [ v ] = g ; const w = function ( t ) { return t instanceof T } ; const C = function t ( e , s , i ) { let a ; if ( ! e ) return v ; if ( typeof e === "string" ) { const n = e . toLowerCase ( ) ; y [ n ] && ( a = n ) , s && ( y [ n ] = s , a = n ) ; const r = e . split ( "-" ) ; if ( ! a && r . length > 1 ) return t ( r [ 0 ] ) } else { const o = e . name ; y [ o ] = e , a = o } return ! i && a && ( v = a ) , a || ! i && v } ; const x = function ( t , e ) { if ( w ( t ) ) return t . clone ( ) ; const s = typeof e === "object" ? e : { } ; return s . date = t , s . args = arguments , new T ( s ) } ; const M = b ; M . l = C , M . i = w , M . w = function ( t , e ) { return x ( t , { locale : e . $L , utc : e . $u , x : e . $x , $offset : e . $offset } ) } ; var T = function ( ) { function g ( t ) { this . $L = C ( t . locale , null , ! 0 ) , this . parse ( t ) } const m = g . prototype ; return m . parse = function ( t ) { this . $d = function ( t ) { const e = t . date ; const s = t . utc ; if ( e === null ) return new Date ( NaN ) ; if ( M . u ( e ) ) return new Date ; if ( e instanceof Date ) return new Date ( e ) ; if ( typeof e === "string" && ! /Z$/i . test ( e ) ) { const i = e . match ( p ) ; if ( i ) { const a = i [ 2 ] - 1 || 0 ; const n = ( i [ 7 ] || "0" ) . substring ( 0 , 3 ) ; return s ? new Date ( Date . UTC ( i [ 1 ] , a , i [ 3 ] || 1 , i [ 4 ] || 0 , i [ 5 ] || 0 , i [ 6 ] || 0 , n ) ) : new Date ( i [ 1 ] , a , i [ 3 ] || 1 , i [ 4 ] || 0 , i [ 5 ] || 0 , i [ 6 ] || 0 , n ) } } return new Date ( e ) } ( t ) , this . $x = t . x || { } , this . init ( ) } , m . init = function ( ) { const t = this . $d ; this . $y = t . getFullYear ( ) , this . $M = t . getMonth ( ) , this . $D = t . getDate ( ) , this . $W = t . getDay ( ) , this . $H = t . getHours ( ) , this . $m = t . getMinutes ( ) , this . $s = t . getSeconds ( ) , this . $ms = t . getMilliseconds ( ) } , m . $utils = function ( ) { return M } , m . isValid = function ( ) { return ! ( this . $d . toString ( ) === u ) } , m . isSame = function ( t , e ) { const s = x ( t ) ; return this . startOf ( e ) <= s && s <= this . endOf ( e ) } , m . isAfter = function ( t , e ) { return x ( t ) < this . startOf ( e ) } , m . isBefore = function ( t , e ) { return this . endOf ( e ) < x ( t ) } , m . $g = function ( t , e , s ) { return M . u ( t ) ? this [ e ] : this . set ( s , t ) } , m . unix = function ( ) { return Math . floor ( this . valueOf ( ) / 1e3 ) } , m . valueOf = function ( ) { return this . $d . getTime ( ) } , m . startOf = function ( t , e ) { const s = this ; const l = ! ! M . u ( e ) || e ; const u = M . p ( t ) ; const p = function ( t , e ) { const i = M . w ( s . $u ? Date . UTC ( s . $y , e , t ) : new Date ( s . $y , e , t ) , s ) ; return l ? i : i . endOf ( r ) } ; const f = function ( t , e ) { return M . w ( s . toDate ( ) [ t ] . apply ( s . toDate ( "s" ) , ( l ? [ 0 , 0 , 0 , 0 ] : [ 23 , 59 , 59 , 999 ] ) . slice ( e ) ) , s ) } ; const g = this . $W ; const m = this . $M ; const b = this . $D ; const v = ` set ${ this . $u ? "UTC" : "" } ` ; switch ( u ) { case d : return l ? p ( 1 , 0 ) : p ( 31 , 11 ) ; case h : return l ? p ( 1 , m ) : p ( 0 , m + 1 ) ; case o : var y = this . $locale ( ) . weekStart || 0 ; var w = ( g < y ? g + 7 : g ) - y ; return p ( l ? b - w : b + ( 6 - w ) , m ) ; case r : case c : return f ( ` ${ v } Hours ` , 0 ) ; case n : return f ( ` ${ v } Minutes ` , 1 ) ; case a : return f ( ` ${ v } Seconds ` , 2 ) ; case i : return f ( ` ${ v } Milliseconds ` , 3 ) ; default : return this . clone ( ) } } , m . endOf = function ( t ) { return this . startOf ( t , ! 1 ) } , m . $set = function ( t , e ) { let o ; const l = M . p ( t ) ; const u = ` set ${ this . $u ? "UTC" : "" } ` ; const p = ( o = { } , o [ r ] = ` ${ u } Date ` , o [ c ] = ` ${ u } Date ` , o [ h ] = ` ${ u } Month ` , o [ d ] =
Object . defineProperty ( s , "__esModule" , { value : ! 0 } ) ; const i = t => Object . prototype . toString . call ( t ) === "[object Object]" ; const a = ( t , e ) => { const s = document . createElement ( t ) ; if ( e && typeof e === "object" ) for ( const t in e ) t === "html" ? s . innerHTML = e [ t ] : s . setAttribute ( t , e [ t ] ) ; return s } ; const n = t => { t instanceof NodeList ? t . forEach ( ( t => n ( t ) ) ) : t . innerHTML = "" } ; const r = ( t , e , s ) => a ( "li" , { class : t , html : ` <a href="#" data-page=" ${ e } "> ${ s } </a> ` } ) ; const o = ( t , e ) => { let s ; let i ; e === 1 ? ( s = 0 , i = t . length ) : e === - 1 && ( s = t . length - 1 , i = - 1 ) ; for ( let a = ! 0 ; a ; ) { a = ! 1 ; for ( let n = s ; n != i ; n += e ) if ( t [ n + e ] && t [ n ] . value > t [ n + e ] . value ) { const s = t [ n ] ; const i = t [ n + e ] ; const r = s ; t [ n ] = i , t [ n + e ] = r , a = ! 0 } } return t } ; class h { constructor ( t ) { this . dt = t , this . cursor = ! 1 }
build ( t ) { const e = a ( "tr" ) ; let s = this . dt . headings ; return s . length || ( s = t . map ( ( ( ) => "" ) ) ) , s . forEach ( ( ( s , i ) => { const n = a ( "td" ) ; t [ i ] && t [ i ] . length || ( t [ i ] = "" ) , n . innerHTML = t [ i ] , n . data = t [ i ] , e . appendChild ( n ) } ) ) , e }
setCursor ( t = ! 1 ) { this . cursor && this . cursor . classList . remove ( "dataTable-cursor" ) , t && ( t . classList . add ( "dataTable-cursor" ) , this . cursor = t ) }
render ( t ) { return t }
add ( t ) { if ( Array . isArray ( t ) ) { const e = this . dt ; Array . isArray ( t [ 0 ] ) ? t . forEach ( ( t => { e . data . push ( this . build ( t ) ) } ) ) : e . data . push ( this . build ( t ) ) , e . data . length && ( e . hasRows = ! 0 ) , this . update ( ) , e . columns . rebuild ( ) } }
remove ( t ) { const e = this . dt ; Array . isArray ( t ) ? ( t . sort ( ( ( t , e ) => e - t ) ) , t . forEach ( ( t => { e . data . splice ( t , 1 ) } ) ) ) : t == "all" ? e . data = [ ] : e . data . splice ( t , 1 ) , e . data . length || ( e . hasRows = ! 1 ) , this . update ( ) , e . columns . rebuild ( ) }
update ( ) { this . dt . data . forEach ( ( ( t , e ) => { t . dataIndex = e } ) ) }
findRowIndex ( t , e ) { return this . dt . data . findIndex ( ( s => s . children [ t ] . innerText . toLowerCase ( ) . includes ( String ( e ) . toLowerCase ( ) ) ) ) }
findRow ( t , e ) { const s = this . findRowIndex ( t , e ) ; if ( s < 0 ) return { index : - 1 , row : null , cols : [ ] } ; const i = this . dt . data [ s ] ; return { index : s , row : i , cols : [ ... i . cells ] . map ( ( t => t . innerHTML ) ) } }
updateRow ( t , e ) { const s = this . build ( e ) ; this . dt . data . splice ( t , 1 , s ) , this . update ( ) , this . dt . columns . rebuild ( ) } } class l { constructor ( t ) { this . dt = t }
swap ( t ) { if ( t . length && t . length === 2 ) { const e = [ ] ; this . dt . headings . forEach ( ( ( t , s ) => { e . push ( s ) } ) ) ; const s = t [ 0 ] ; const i = t [ 1 ] ; const a = e [ i ] ; e [ i ] = e [ s ] , e [ s ] = a , this . order ( e ) } }
order ( t ) { let e ; let s ; let i ; let a ; let n ; let r ; let o ; const h = [ [ ] , [ ] , [ ] , [ ] ] ; const l = this . dt ; t . forEach ( ( ( t , i ) => { n = l . headings [ t ] , r = n . getAttribute ( "data-sortable" ) !== "false" , e = n . cloneNode ( ! 0 ) , e . originalCellIndex = i , e . sortable = r , h [ 0 ] . push ( e ) , l . hiddenColumns . includes ( t ) || ( s = n . cloneNode ( ! 0 ) , s . originalCellIndex = i , s . sortable = r , h [ 1 ] . push ( s ) ) } ) ) , l . data . forEach ( ( ( e , s ) => { i = e . cloneNode ( ! 1 ) , a = e . cloneNode ( ! 1 ) , i . dataIndex = a . dataIndex = s , e . searchIndex !== null && void 0 !== e . searchIndex && ( i . searchIndex = a . searchIndex = e . searchIndex ) , t . forEach ( ( t => { o = e . cells [ t ] . cloneNode ( ! 0 ) , o . data = e . cells [ t ] . data , i . appendChild ( o ) , l . hiddenColumns . includes ( t ) || ( o = e . cells [ t ] . cloneNode ( ! 0 ) , o . data = e . cells [ t ] . data , a . appendChild ( o ) ) } ) ) , h [ 2 ] . push ( i ) , h [ 3 ] . push ( a ) } ) ) , l . headings = h [ 0 ] , l . activeHeadings = h [ 1 ] , l . data = h [ 2 ] , l . activeRows = h [ 3 ] , l . update ( ) }
hide ( t ) { if ( t . length ) { const e = this . dt ; t . forEach ( ( t => { e . hiddenColumns . includes ( t ) || e . hiddenColumns . push ( t ) } ) ) , this . rebuild ( ) } }
show ( t ) { if ( t . length ) { let e ; const s = this . dt ; t . forEach ( ( t => { e = s . hiddenColumns . indexOf ( t ) , e > - 1 && s . hiddenColumns . splice ( e , 1 ) } ) ) , this . rebuild ( ) } }
visible ( t ) { let e ; const s = this . dt ; return t = t || s . headings . map ( ( t => t . originalCellIndex ) ) , isNaN ( t ) ? Array . isArray ( t ) && ( e = [ ] , t . forEach ( ( t => { e . push ( ! s . hiddenColumns . includes ( t ) ) } ) ) ) : e = ! s . hiddenColumns . includes ( t ) , e }
add ( t ) { let e ; const s = document . createElement ( "th" ) ; if ( ! this . dt . headings . length ) return this . dt . insert ( { headings : [ t . heading ] , data : t . data . map ( ( t => [ t ] ) ) } ) , void this . rebuild ( ) ; this . dt . hiddenHeader ? s . innerHTML = "" : t . heading . nodeName ? s . appendChild ( t . heading ) : s . innerHTML = t . heading , this . dt . headings . push ( s ) , this . dt . data . forEach ( ( ( s , i ) => { t . data [ i ] && ( e = document . createElement ( "td" ) , t . data [ i ] . nodeName ? e . appendChild ( t . data [ i ] ) : e . innerHTML = t . data [ i ] , e . data = e . innerHTML , t . render && ( e . innerHTML = t . render . call ( this , e . data , e , s ) ) , s . appendChild ( e ) ) } ) ) , t . type && s . setAttribute ( "data-type" , t . type ) , t . format && s . setAttribute ( "data-format" , t . format ) , t . hasOwnProperty ( "sortable" ) && ( s . sortable = t . sortable , s . setAttribute ( "data-sortable" , ! 0 === t . sortable ? "true" : "false" ) ) , this . rebuild ( ) , this . dt . renderHeader ( ) }
remove ( t ) { Array . isArray ( t ) ? ( t . sort ( ( ( t , e ) => e - t ) ) , t . forEach ( ( t => this . remove ( t ) ) ) ) : ( this . dt . headings . splice ( t , 1 ) , this . dt . data . forEach ( ( e => { e . removeChild ( e . cells [ t ] ) } ) ) ) , this . rebuild ( ) }
filter ( t , e , s , i ) { const a = this . dt ; if ( a . filterState || ( a . filterState = { originalData : a . data } ) , ! a . filterState [ t ] ) { const e = [ ... i , ( ) => ! 0 ] ; a . filterState [ t ] = function ( ) { let t = 0 ; return ( ) => e [ t ++ % e . length ] } ( ) } const n = a . filterState [ t ] ( ) ; const r = Array . from ( a . filterState . originalData ) . filter ( ( e => { const s = e . cells [ t ] ; const i = s . hasAttribute ( "data-content" ) ? s . getAttribute ( "data-content" ) : s . innerText ; return typeof n === "function" ? n ( i ) : i === n } ) ) ; a . data = r , a . data . length ? ( this . rebuild ( ) , a . update ( ) ) : ( a . clear ( ) , a . hasRows = ! 1 , a . setMessage ( a . options . labels . noRows ) ) , s || a . emit ( "datatable.sort" , t , e ) }
sort ( e , s , i ) { const a = this . dt ; if ( a . hasHeadings && ( e < 0 || e > a . headings . length ) ) return ! 1 ; const n = a . options . filters && a . options . filters [ a . headings [ e ] . textContent ] ; if ( n && n . length !== 0 ) return void this . filter ( e , s , i , n ) ; a . sorting = ! 0 , i || a . emit ( "datatable.sorting" , e , s ) ; let r = a . data ; const h = [ ] ; const l = [ ] ; let d = 0 ; let c = 0 ; const u = a . headings [ e ] ; const p = [ ] ; if ( u . getAttribute ( "data-type" ) === "date" ) { let e = ! 1 ; u . hasAttribute ( "data-format" ) && ( e = u . getAttribute ( "data-format" ) ) , p . push ( Promise . resolve ( ) . then ( ( ( ) => t ( "./date-7061ceee.js" ) ) ) . then ( ( ( { parseDate : t } ) => s => t ( s , e ) ) ) ) } Promise . all ( p ) . then ( ( t => { const n = t [ 0 ] ; let p ; let f ; Array . from ( r ) . forEach ( ( t => { const s = t . cells [ e ] ; const i = s . hasAttribute ( "data-content" ) ? s . getAttribute ( "data-content" ) : s . innerText ; let a ; a = n ? n ( i ) : typeof i === "string" ? i . replace ( /(\$|,|\s|%)/g , "" ) : i , parseFloat ( a ) == a ? l [ c ++ ] = { value : Number ( a ) , row : t } : h [ d ++ ] = { value : typeof i === "string" ? i . toLowerCase ( ) : i , row : t } } ) ) , s || ( s = u . classList . contains ( "asc" ) ? "desc" : "asc" ) , s == "desc" ? ( p = o ( h , - 1 ) , f = o ( l , - 1 ) , u . classList . remove ( "asc" ) , u . classList . add ( "desc" ) , u . setAttribute ( "aria-sort" , "descending" ) ) : ( p = o ( l , 1 ) , f = o ( h , 1 ) , u . classList . remove ( "desc" ) , u . classList . add ( "asc" ) , u . setAttribute ( "aria-sort" , "ascending" ) ) , a . lastTh && u != a . lastTh && ( a . lastTh . classList . remove ( "desc" ) , a . lastTh . classList . remove ( "asc" ) , a . lastTh . removeAttribute ( "aria-sort" ) ) , a . lastTh = u , r = p . concat ( f ) , a . data = [ ] ; const g = [ ] ; r . forEach ( ( ( t , e ) => { a . data . push ( t . row ) , t . row . searchIndex !== null && void 0 !== t . row . searchIndex && g . push ( e ) } ) ) , a . searchData = g , this . rebuild ( ) , a . update ( ) , i || a . emit ( "datatable.sort" , e , s ) } ) ) }
rebuild ( ) { let t ; let e ; let s ; let i ; const a = this . dt ; const n = [ ] ; a . activeRows = [ ] , a . activeHeadings = [ ] , a . headings . forEach ( ( ( t , e ) => { t . originalCellIndex = e , t . sortable = t . getAttribute ( "data-sortable" ) !== "false" , a . hiddenColumns . includes ( e ) || a . activeHeadings . push ( t ) } ) ) , a . data . forEach ( ( ( r , o ) => { t = r . cloneNode ( ! 1 ) , e = r . cloneNode ( ! 1 ) , t . dataIndex = e . dataIndex = o , r . searchIndex !== null && void 0 !== r . searchIndex && ( t . searchIndex = e . searchIndex = r . searchIndex ) , Array . from ( r . cells ) . forEach ( ( n => { s = n . cloneNode ( ! 0 ) , s . data = n . data , t . appendChild ( s ) , a . hiddenColumns . includes ( s . cellIndex ) || ( i = s . cloneNode ( ! 0 ) , i . data = s . data , e . appendChild ( i ) ) } ) ) , n . push ( t ) , a . activeRows . push ( e ) } ) ) , a . data = n , a . update ( ) } } const d = function ( t ) { let e = ! 1 ; let s = ! 1 ; if ( ( t = t || this . options . data ) . headings ) { e = a ( "thead" ) ; const s = a ( "tr" ) ; t . headings . forEach ( ( t => { const e = a ( "th" , { html : t } ) ; s . appendChild ( e ) } ) ) , e . appendChild ( s ) } t . data && t . data . length && ( s = a ( "tbody" ) , t . data . forEach ( ( e => { if ( t . headings && t . headings . length !== e . length ) throw new Error ( "The number of rows do not match the number of headings." ) ; const i = a ( "tr" ) ; e . forEach ( ( t => { const e = a ( "td" , { html : t } ) ; i . appendChild ( e ) } ) ) , s . appendChild ( i ) } ) ) ) , e && ( this . dom . tHead !== null && this . dom . removeChild ( this . dom . tHead ) , this . dom . appendChild ( e ) ) , s && ( this . dom . tBodies . length && this . dom . removeChild ( this . dom . tBodies [ 0 ] ) , this . dom . appendChild ( s ) ) } ; const c = { sortable : ! 0 , searchable : ! 0 , paging : ! 0 , perPage : 10 , perPageSelect : [ 5 , 10 , 15 , 20 , 25 ] , nextPrev : ! 0 , firstLast : ! 1 , prevText : "‹" , nextText : "›" , firstText : "«" , lastText : "»" , ellipsisText : "…" , ascText : "▴" , descText : "▾" , truncatePager : ! 0 , pagerDelta : 2 , scrollY : "" , fixedColumns : ! 0 , fixedHeight : ! 1 , header : ! 0 , hiddenHeader : ! 1 , footer : ! 1 , tabIndex : ! 1 , rowNavigation : ! 1 , labels : { placeholder : "Search on page..." , perPage : "{select} entries per page" , noRows : "No entries found" , noResults : "No results match your search query" , info : "Showing {start} to {end} of {rows} entries" } , layout : { top : "{select}{search}" , bottom : "{info}{pager}" } } ; s . DataTable = class { constructor ( t , e = { } ) { const s = typeof t === "string" ? document . querySelector ( t ) : t ; if ( this . options = { ... c , ... e , layout : { ... c . layout , ... e . layout } , labels : { ... c . labels , ... e . labels } } , this . rows = new h ( this ) , this . columns = new l ( this ) , this . initialized = ! 1 , this . initialLayout = s . innerHTML , this . initialSortable = this . options . sortable , this . options . tabIndex ? s . tabIndex = this . options . tabIndex : this . options . rowNavigation && s . tabIndex === - 1 && ( s . tabIndex = 0 ) , this . options . header || ( this . options . sortable = ! 1 ) , s . tHead === null && ( ! this . options . data || this . options . data && ! this . options . data . headings ) && ( this . options . sortable = ! 1 ) , s . tBodies . length && ! s . tBodies [ 0 ] . rows . length && this . options . data && ! this . options . data . data ) throw new Error ( "You seem to be using the data option, but you've not defined any rows." ) ; this . dom = s , this . table = this . dom , this . listeners = { onResize : t => this . onResize ( t ) } , this . init ( ) }
init ( t ) { if ( this . initialized || this . dom . classList . contains ( "dataTable-table" ) ) return ! 1 ; Object . assign ( this . options , t || { } ) , this . currentPage = 1 , this . onFirstPage = ! 0 , this . hiddenColumns = [ ] , this . columnRenderers = [ ] , this . selectedColumns = [ ] , this . render ( ) , setTimeout ( ( ( ) => { this . emit ( "datatable.init" ) , this . initialized = ! 0 , this . options . plugins && Object . entries ( this . options . plugins ) . forEach ( ( ( [ t , e ] ) => { this [ t ] && typeof this [ t ] === "function" && ( this [ t ] = this [ t ] ( e , { createElement : a } ) , e . enabled && this [ t ] . init && typeof this [ t ] . init === "function" && this [ t ] . init ( ) ) } ) ) } ) , 10 ) }
render ( ) { let t = "" ; if ( this . options . data && d . call ( this ) , this . body = this . dom . tBodies [ 0 ] , this . head = this . dom . tHead , this . foot = this . dom . tFoot , this . body || ( this . body = a ( "tbody" ) , this . dom . appendChild ( this . body ) ) , this . hasRows = this . body . rows . length > 0 , ! this . head ) { const t = a ( "thead" ) ; const e = a ( "tr" ) ; this . hasRows && ( Array . from ( this . body . rows [ 0 ] . cells ) . forEach ( ( ( ) => { e . appendChild ( a ( "th" ) ) } ) ) , t . appendChild ( e ) ) , this . head = t , this . dom . insertBefore ( this . head , this . body ) , this . hiddenHeader = this . options . hiddenHeader } if ( this . headings = [ ] , this . hasHeadings = this . head . rows . length > 0 , this . hasHeadings && ( this . header = this . head . rows [ 0 ] , this . headings = [ ] . slice . call ( this . header . cells ) ) , this . options . header || this . head && this . dom . removeChild ( this . dom . tHead ) , this . options . footer ? this . head && ! this . foot && ( this . foot = a ( "tfoot" , { html : this . head . innerHTML } ) , this . dom . appendChild ( this . foot ) ) : this . foot && this . dom . removeChild ( this . dom . tFoot ) , this . wrapper = a ( "div" , { class : "dataTable-wrapper dataTable-loading" } ) , t += "<div class='dataTable-top'>" , t += this . options . layout . top , t += "</div>" , this . options . scrollY . length ? t += ` <div class='dataTable-container' style='height: ${ this . options . scrollY } ; overflow-Y: auto;'></div> ` : t += "<div class='dataTable-container'></div>" , t += "<div class='dataTable-bottom'>" , t += this . options . layout . bottom , t += "</div>" , t = t . replace ( "{info}" , this . options . paging ? "<div class='dataTable-info'></div>" : "" ) , this . options . paging && this . options . perPageSelect ) { let e = "<div class='dataTable-dropdown'><label>" ; e += this . options . labels . perPage , e += "</label></div>" ; const s = a ( "select" , { class : "dataTable-selector" } ) ; this . options . perPageSelect . forEach ( ( t => { const e = t === this . options . perPage ; const i = new Option ( t , t , e , e ) ; s . add ( i ) } ) ) , e = e . replace ( "{select}" , s . outerHTML ) , t = t . replace ( "{select}" , e ) } else t = t . replace ( "{select}" , "" ) ; if ( this . options . searchable ) { const e = ` <div class='dataTable-search'><input class='dataTable-input' placeholder=' ${ this . options . labels . placeholder } ' type='text'></div> ` ; t = t . replace ( "{search}" , e ) } else t = t . replace ( "{search}" , "" ) ; this . hasHeadings && this . renderHeader ( ) , this . dom . classList . add ( "dataTable-table" ) ; const e = a ( "nav" , { class : "dataTable-pagination" } ) ; const s = a ( "ul" , { class : "dataTable-pagination-list" } ) ; e . appendChild ( s ) , t = t . replace ( /\{pager\}/g , e . outerHTML ) , this . wrapper . innerHTML = t , this . container = this . wrapper . querySelector ( ".dataTable-container" ) , this . pagers = this . wrapper . querySelectorAll ( ".dataTable-pagination-list" ) , this . label = this . wrapper . querySelector ( ".dataTable-info" ) , this . dom . parentNode . replaceChild ( this . wrapper , this . dom ) , this . container . appendChild ( this . dom ) , this . rect = this . dom . getBoundingClientRect ( ) , this . data = Array . from ( this . body . rows ) , this . activeRows = this . data . slice ( ) , this . activeHeadings = this . headings . slice ( ) , this . update ( ) , this . setColumns ( ) , this . fixHeight ( ) , this . fixColumns ( ) , this . options . header || this . wrapper . classList . add ( "no-header" ) , this . options . footer || this . wrapper . classList . add ( "no-footer" ) , this . options . sortable && this . wrapper . classList . add ( "sortable" ) , this . options . searchable && this . wrapper . classList . add ( "searchable" ) , this . options . fixedHeight && this . wrapper . classList . add ( "fixed-height" ) , this . options . fixedColumns && this . wrapper . classList . add ( "fixed-columns" ) , this . bindEvents ( ) }
renderPage ( t = ! 1 ) { if ( this . hasHeadings && ( n ( this . header ) , this . activeHeadings . forEach ( ( t => this . header . appendChild ( t ) ) ) ) , this . hasRows && this . totalPages ) { this . currentPage > this . totalPages && ( this . currentPage = 1 ) ; const t = this . currentPage - 1 ; const e = document . createDocumentFragment ( ) ; this . pages [ t ] . forEach ( ( t => e . appendChild ( this . rows . render ( t ) ) ) ) , this . clear ( e ) , this . onFirstPage = this . currentPage === 1 , this . onLastPage = this . currentPage === this . lastPage } else this . setMessage ( this . options . labels . noRows ) ; let e ; let s = 0 ; let i = 0 ; let a = 0 ; if ( this . totalPages && ( s = this . currentPage - 1 , i = s * this . options . perPage , a = i + this . pages [ s ] . length , i += 1 , e = this . searching ? this . searchData . length : this . data . length ) , this . label && this . options . labels . info . length ) { const t = this . options . labels . info . replace ( "{start}" , i ) . replace ( "{end}" , a ) . replace ( "{page}" , this . currentPage ) . replace ( "{pages}" , this . totalPages ) . replace ( "{rows}" , e ) ; this . label . innerHTML = e ? t : "" } if ( this . currentPage == 1 && this . fixHeight ( ) , this . options . rowNavigation && ( ! this . rows . cursor || ! this . pages [ this . currentPage - 1 ] . includes ( this . rows . cursor ) ) ) { const e = this . pages [ this . currentPage - 1 ] ; t ? this . rows . setCursor ( e [ e . length - 1 ] ) : this . rows . setCursor ( e [ 0 ] ) } }
renderPager ( ) { if ( n ( this . pagers ) , this . totalPages > 1 ) { const t = "pager" ; const e = document . createDocumentFragment ( ) ; const s = this . onFirstPage ? 1 : this . currentPage - 1 ; const i = this . onLastPage ? this . totalPages : this . currentPage + 1 ; this . options . firstLast && e . appendChild ( r ( t , 1 , this . options . firstText ) ) , this . options . nextPrev && ! this . onFirstPage && e . appendChild ( r ( t , s , this . options . prevText ) ) ; let n = this . links ; this . options . truncatePager && ( n = ( ( t , e , s , i , n ) => { let r ; const o = 2 * ( i = i || 2 ) ; let h = e - i ; let l = e + i ; const d = [ ] ; const c = [ ] ; e < 4 - i + o ? l = 3 + o : e > s - ( 3 - i + o ) && ( h = s - ( 2 + o ) ) ; for ( let e = 1 ; e <= s ; e ++ ) if ( e == 1 || e == s || e >= h && e <= l ) { const s = t [ e - 1 ] ; s . classList . remove ( "active" ) , d . push ( s ) } return d . forEach ( ( e => { const s = e . children [ 0 ] . getAttribute ( "data-page" ) ; if ( r ) { const e = r . children [ 0 ] . getAttribute ( "data-page" ) ; if ( s - e == 2 ) c . push ( t [ e ] ) ; else if ( s - e != 1 ) { const t = a ( "li" , { class : "ellipsis" , html : ` <a href="#"> ${ n } </a> ` } ) ; c . push ( t ) } } c . push ( e ) , r = e } ) ) , c } ) ( this . links , this . currentPage , this . pages . length , this . options . pagerDelta , this . options . ellipsisText ) ) , this . links [ this . currentPage - 1 ] . classList . add ( "active" ) , n . forEach ( ( t => { t . classList . remove ( "active" ) , e . appendChild ( t ) } ) ) , this . links [ this . currentPage - 1 ] . classList . add ( "active" ) , this . options . nextPrev && ! this . onLastPage && e . appendChild ( r ( t , i , this . options . nextText ) ) , this . options . firstLast && e . appendChild ( r ( t , this . totalPages , this . options . lastText ) ) , this . pagers . forEach ( ( t => { t . appendChild ( e . cloneNode ( ! 0 ) ) } ) ) } }
renderHeader ( ) { this . labels = [ ] , this . headings && this . headings . length && this . headings . forEach ( ( ( t , e ) => { if ( this . labels [ e ] = t . textContent , t . firstElementChild && t . firstElementChild . classList . contains ( "dataTable-sorter" ) && ( t . innerHTML = t . firstElementChild . innerHTML ) , t . sortable = t . getAttribute ( "data-sortable" ) !== "false" , t . originalCellIndex = e , this . options . sortable && t . sortable ) { const e = a ( "a" , { href : "#" , class : "dataTable-sorter" , html : t . innerHTML } ) ; t . innerHTML = "" , t . setAttribute ( "data-sortable" , "" ) , t . appendChild ( e ) } } ) ) , this . fixColumns ( ) }
bindEvents ( ) { if ( this . options . perPageSelect ) { const t = this . wrapper . querySelector ( ".dataTable-selector" ) ; t && t . addEventListener ( "change" , ( ( ) => { this . options . perPage = parseInt ( t . value , 10 ) , this . update ( ) , this . fixHeight ( ) , this . emit ( "datatable.perpage" , this . options . perPage ) } ) , ! 1 ) } this . options . searchable && ( this . input = this . wrapper . querySelector ( ".dataTable-input" ) , this . input && this . input . addEventListener ( "keyup" , ( ( ) => this . search ( this . input . value ) ) , ! 1 ) ) , this . wrapper . addEventListener ( "click" , ( t => { const e = t . target . closest ( "a" ) ; e && e . nodeName . toLowerCase ( ) === "a" && ( e . hasAttribute ( "data-page" ) ? ( this . page ( e . getAttribute ( "data-page" ) ) , t . preventDefault ( ) ) : this . options . sortable && e . classList . contains ( "dataTable-sorter" ) && e . parentNode . getAttribute ( "data-sortable" ) != "false" && ( this . columns . sort ( this . headings . indexOf ( e . parentNode ) ) , t . preventDefault ( ) ) ) } ) , ! 1 ) , this . options . rowNavigation ? ( this . table . addEventListener ( "keydown" , ( t => { t . keyCode === 38 ? this . rows . cursor . previousElementSibling ? ( this . rows . setCursor ( this . rows . cursor . previousElementSibling ) , t . preventDefault ( ) , t . stopPropagation ( ) ) : this . onFirstPage || this . page ( this . currentPage - 1 , ! 0 ) : t . keyCode === 40 ? this . rows . cursor . nextElementSibling ? ( this . rows . setCursor ( this . rows . cursor . nextElementSibling ) , t . preventDefault ( ) , t . stopPropagation ( ) ) : this . onLastPage || this . page ( this . currentPage + 1 ) : [ 13 , 32 ] . includes ( t . keyCode ) && this . emit ( "datatable.selectrow" , this . rows . cursor , t ) } ) ) , this . body . addEventListener ( "mousedown" , ( t => { if ( this . table . matches ( ":focus" ) ) { const e = Array . from ( this . body . rows ) . find ( ( e => e . contains ( t . target ) ) ) ; this . emit ( "datatable.selectrow" , e , t ) } } ) ) ) : this . body . addEventListener ( "mousedown" , ( t => { const e = Array . from ( this . body . rows ) . find ( ( e => e . contains ( t . target ) ) ) ; this . emit ( "datatable.selectrow" , { event : t , row : e } ) } ) ) , window . addEventListener ( "resize" , this . listeners . onResize ) }
onResize ( ) { this . rect = this . container . getBoundingClientRect ( ) , this . rect . width && this . fixColumns ( ) }
setColumns ( t ) { t || this . data . forEach ( ( t => { Array . from ( t . cells ) . forEach ( ( t => { t . data = t . innerHTML } ) ) } ) ) , this . options . columns && this . headings . length && this . options . columns . forEach ( ( t => { Array . isArray ( t . select ) || ( t . select = [ t . select ] ) , t . hasOwnProperty ( "render" ) && typeof t . render === "function" && ( this . selectedColumns = this . selectedColumns . concat ( t . select ) , this . columnRenderers . push ( { columns : t . select , renderer : t . render } ) ) , t . select . forEach ( ( e => { const s = this . headings [ e ] ; s && ( t . type && s . setAttribute ( "data-type" , t . type ) , t . format && s . setAttribute ( "data-format" , t . format ) , t . hasOwnProperty ( "sortable" ) && s . setAttribute ( "data-sortable" , t . sortable ) , t . hasOwnProperty ( "hidden" ) && ! 1 !== t . hidden && this . columns . hide ( [ e ] ) , t . hasOwnProperty ( "sort" ) && t . select . length === 1 && this . columns . sort ( t . select [ 0 ] , t . sort , ! 0 ) ) } ) ) } ) ) , this . hasRows && ( this . data . forEach ( ( ( t , e ) => { t . dataIndex = e , Array . from ( t . cells ) . forEach ( ( t => { t . data = t . innerHTML } ) ) } ) ) , this . selectedColumns . length && this . data . forEach ( ( t => { Array . from ( t . cells ) . forEach ( ( ( e , s ) => { this . selectedColumns . includes ( s ) && this . columnRenderers . forEach ( ( i => { i . columns . includes ( s ) && ( e . innerHTML = i . renderer . call ( this , e . data , e , t ) ) } ) ) } ) ) } ) ) , this . columns . rebuild ( ) ) , this . renderHeader ( ) }
destroy ( ) { this . dom . innerHTML = this . initialLayout , this . dom . classList . remove ( "dataTable-table" ) , this . wrapper . parentNode . replaceChild ( this . dom , this . wrapper ) , this . initialized = ! 1 , window . removeEventListener ( "resize" , this . listeners . onResize ) }
update ( ) { this . wrapper . classList . remove ( "dataTable-empty" ) , this . paginate ( ) , this . renderPage ( ) , this . links = [ ] ; let t = this . pages . length ; for ( ; t -- ; ) { const e = t + 1 ; this . links [ t ] = r ( t === 0 ? "active" : "" , e , e ) } this . sorting = ! 1 , this . renderPager ( ) , this . rows . update ( ) , this . emit ( "datatable.update" ) }
paginate ( ) { let t = this . activeRows ; return this . searching && ( t = [ ] , this . searchData . forEach ( ( e => t . push ( this . activeRows [ e ] ) ) ) ) , this . options . paging ? this . pages = t . map ( ( ( e , s ) => s % this . options . perPage == 0 ? t . slice ( s , s + this . options . perPage ) : null ) ) . filter ( ( t => t ) ) : this . pages = [ t ] , this . totalPages = this . lastPage = this . pages . length , this . totalPages }
fixColumns ( ) { if ( ( this . options . scrollY . length || this . options . fixedColumns ) && this . activeHeadings && this . activeHeadings . length ) { let t ; let e = ! 1 ; if ( this . columnWidths = [ ] , this . dom . tHead ) { this . options . scrollY . length && ( e = a ( "thead" ) , e . appendChild ( a ( "tr" ) ) , e . style . height = "0px" , this . headerTable && ( this . dom . tHead = this . headerTable . tHead ) ) , this . activeHeadings . forEach ( ( t => { t . style . width = "" } ) ) ; const t = this . activeHeadings . reduce ( ( ( t , e ) => t + e . offsetWidth ) , 0 ) ; if ( this . activeHeadings . forEach ( ( ( s , i ) => { const n = s . offsetWidth ; const r = n / t * 100 ; if ( s . style . width = ` ${ r } % ` , this . columnWidths [ i ] = n , this . options . scrollY . length ) { const t = a ( "th" ) ; e . firstElementChild . appendChild ( t ) , t . style . width = ` ${ r } % ` , t . style . paddingTop = "0" , t . style . paddingBottom = "0" , t . style . border = "0" } } ) ) , this . options . scrollY . length ) { const t = this . dom . parentElement ; if ( ! this . headerTable ) { this . headerTable = a ( "table" , { class : "dataTable-table" } ) ; const e = a ( "div" , { class : "dataTable-headercontainer" } ) ; e . appendChild ( this . headerTable ) , t . parentElement . insertBefore ( e , t ) } const s = this . dom . tHead ; this . dom . replaceChild ( e , s ) , this . headerTable . tHead = s , this . headerTable . parentElement . style . paddingRight = ` ${ this . headerTable . clientWidth - this . dom . clientWidth + parseInt ( this . headerTable . parentElement . style . paddingRight || "0" , 10 ) } px ` , t . scrollHeight > t . clientHeight && ( t . style . overflowY = "scroll" ) } } else { t = [ ] , e = a ( "thead" ) ; const s = a ( "tr" ) ; Array . from ( this . dom . tBodies [ 0 ] . rows [ 0 ] . cells ) . forEach ( ( ( ) => { const e = a ( "th" ) ; s . appendChild ( e ) , t . push ( e ) } ) ) , e . appendChild ( s ) , this . dom . insertBefore ( e , this . body ) ; const i = [ ] ; t . forEach ( ( ( t , e ) => { const s = t . offsetWidth ; const a = s / this . rect . width * 100 ; i . push ( a ) , this . columnWidths [ e ] = s } ) ) , this . data . forEach ( ( t => { Array . from ( t . cells ) . forEach ( ( ( t , e ) => { this . columns . visible ( t . cellIndex ) && ( t . style . width = ` ${ i [ e ] } % ` ) } ) ) } ) ) , this . dom . removeChild ( e ) } } }
fixHeight ( ) { this . options . fixedHeight && ( this . container . style . height = null , this . rect = this . container . getBoundingClientRect ( ) , this . container . style . height = ` ${ this . rect . height } px ` ) }
search ( t ) { return ! ! this . hasRows && ( t = t . toLowerCase ( ) , this . currentPage = 1 , this . searching = ! 0 , this . searchData = [ ] , t . length ? ( this . clear ( ) , this . data . forEach ( ( ( e , s ) => { const i = this . searchData . includes ( e ) ; t . split ( " " ) . reduce ( ( ( t , s ) => { let i = ! 1 ; let a = null ; let n = null ; for ( let t = 0 ; t < e . cells . length ; t ++ ) if ( a = e . cells [ t ] , n = a . hasAttribute ( "data-content" ) ? a . getAttribute ( "data-content" ) : a . textContent , n . toLowerCase ( ) . includes ( s ) && this . columns . visible ( a . cellIndex ) ) { i = ! 0 ; break } return t && i } ) , ! 0 ) && ! i ? ( e . searchIndex = s , this . searchData . push ( s ) ) : e . searchIndex = null } ) ) , this . wrapper . classList . add ( "search-results" ) , this . searchData . length ? this . update ( ) : ( this . wrapper . classList . remove ( "search-results" ) , this . setMessage ( this . options . labels . noResults ) ) , void this . emit ( "datatable.search" , t , this . searchData ) ) : ( this . searching = ! 1 , this . update ( ) , this . emit ( "datatable.search" , t , this . searchData ) , this . wrapper . classList . remove ( "search-results" ) , ! 1 ) ) }
page ( t , e = ! 1 ) { return t != this . currentPage && ( isNaN ( t ) || ( this . currentPage = parseInt ( t , 10 ) ) , ! ( t > this . pages . length || t < 0 ) && ( this . renderPage ( e ) , this . renderPager ( ) , void this . emit ( "datatable.page" , t ) ) ) }
sortColumn ( t , e ) { this . columns . sort ( t , e ) }
insert ( t ) { let e = [ ] ; if ( i ( t ) ) { if ( t . headings && ! this . hasHeadings && ! this . hasRows ) { const e = a ( "tr" ) ; t . headings . forEach ( ( t => { const s = a ( "th" , { html : t } ) ; e . appendChild ( s ) } ) ) , this . head . appendChild ( e ) , this . header = e , this . headings = [ ] . slice . call ( e . cells ) , this . hasHeadings = ! 0 , this . options . sortable = this . initialSortable , this . renderHeader ( ) , this . activeHeadings = this . headings . slice ( ) } t . data && Array . isArray ( t . data ) && ( e = t . data ) } else Array . isArray ( t ) && t . forEach ( ( t => { const s = [ ] ; Object . entries ( t ) . forEach ( ( ( [ t , e ] ) => { const i = this . labels . indexOf ( t ) ; i > - 1 && ( s [ i ] = e ) } ) ) , e . push ( s ) } ) ) ; e . length && ( this . rows . add ( e ) , this . hasRows = ! 0 ) , this . update ( ) , this . setColumns ( ) , this . fixColumns ( ) }
refresh ( ) { this . options . searchable && ( this . input . value = "" , this . searching = ! 1 ) , this . currentPage = 1 , this . onFirstPage = ! 0 , this . update ( ) , this . emit ( "datatable.refresh" ) }
clear ( t ) { this . body && n ( this . body ) ; let e = this . body ; this . body || ( e = this . dom ) , t && ( typeof t === "string" && ( document . createDocumentFragment ( ) . innerHTML = t ) , e . appendChild ( t ) ) }
export ( t ) { if ( ! this . hasHeadings && ! this . hasRows ) return ! 1 ; const e = this . activeHeadings ; let s = [ ] ; const a = [ ] ; let n ; let r ; let o ; let h ; if ( ! i ( t ) ) return ! 1 ; const l = { download : ! 0 , skipColumn : [ ] , lineDelimiter : "\n" , columnDelimiter : "," , tableName : "myTable" , replacer : null , space : 4 , ... t } ; if ( l . type ) { if ( l . type !== "txt" && l . type !== "csv" || ( s [ 0 ] = this . header ) , l . selection ) if ( isNaN ( l . selection ) ) { if ( Array . isArray ( l . selection ) ) for ( n = 0 ; n < l . selection . length ; n ++ ) s = s . concat ( this . pages [ l . selection [ n ] - 1 ] ) } else s = s . concat ( this . pages [ l . selection - 1 ] ) ; else s = s . concat ( this . activeRows ) ; if ( s . length ) { if ( l . type === "txt" || l . type === "csv" ) { for ( o = "" , n = 0 ; n < s . length ; n ++ ) { for ( r = 0 ; r < s [ n ] . cells . length ; r ++ ) if ( ! l . skipColumn . includes ( e [ r ] . originalCellIndex ) && this . columns . visible ( e [ r ] . originalCellIndex ) ) { let t = s [ n ] . cells [ r ] . textContent ; t = t . trim ( ) , t = t . replace ( /\s{2,}/g , " " ) , t = t . replace ( /\n/g , " " ) , t = t . replace ( /"/g , "\"\"" ) , t = t . replace ( /#/g , "%23" ) , t . includes ( "," ) && ( t = ` " ${ t } " ` ) , o += t + l . columnDelimiter } o = o . trim ( ) . substring ( 0 , o . length - 1 ) , o += l . lineDelimiter } o = o . trim ( ) . substring ( 0 , o . length - 1 ) , l . download && ( o = ` data:text/csv;charset=utf-8, ${ o } ` ) } else if ( l . type === "sql" ) { for ( o = ` INSERT INTO \` ${ l . tableName } \` ( ` , n = 0 ; n < e . length ; n ++ ) ! l . skipColumn . includes ( e [ n ] . originalCellIndex ) && this . columns . visible ( e [ n ] . originalCellIndex ) && ( o += ` \` ${ e [ n ] . textContent } \` , ` ) ; for ( o = o . trim ( ) . substring ( 0 , o . length - 1 ) , o += ") VALUES " , n = 0 ; n < s . length ; n ++ ) { for ( o += "(" , r = 0 ; r < s [ n ] . cells . length ; r ++ ) ! l . skipColumn . includes ( e [ r ] . originalCellIndex ) && this . columns . visible ( e [ r ] . originalCellIndex ) && ( o += ` " ${ s [ n ] . cells [ r ] . textContent } ", ` ) ; o = o . trim ( ) . substring ( 0 , o . length - 1 ) , o += ")," } o = o . trim ( ) . substring ( 0 , o . length - 1 ) , o += ";" , l . download && ( o = ` data:application/sql;charset=utf-8, ${ o } ` ) } else if ( l . type === "json" ) { for ( r = 0 ; r < s . length ; r ++ ) for ( a [ r ] = a [ r ] || { } , n = 0 ; n < e . length ; n ++ ) ! l . skipColumn . includes ( e [ n ] . originalCellIndex ) && this . columns . visible ( e [ n ] . originalCellIndex ) && ( a [ r ] [ e [ n ] . textContent ] = s [ r ] . cells [ n ] . textContent ) ; o = JSON . stringify ( a , l . replacer , l . space ) , l . download && ( o = ` data:application/json;charset=utf-8, ${ o } ` ) } return l . download && ( l . filename = l . filename || "datatable_export" , l . filename += ` . ${ l . type } ` , o = encodeURI ( o ) , h = document . createElement ( "a" ) , h . href = o , h . download = l . filename , document . body . appendChild ( h ) , h . click ( ) , document . body . removeChild ( h ) ) , o } } return ! 1 }
import ( t ) { let e = ! 1 ; if ( ! i ( t ) ) return ! 1 ; const s = { lineDelimiter : "\n" , columnDelimiter : "," , removeDoubleQuotes : ! 1 , ... t } ; if ( s . data . length || i ( s . data ) ) { if ( s . type === "csv" ) { e = { data : [ ] } ; const t = s . data . split ( s . lineDelimiter ) ; t . length && ( s . headings && ( e . headings = t [ 0 ] . split ( s . columnDelimiter ) , s . removeDoubleQuotes && ( e . headings = e . headings . map ( ( t => t . trim ( ) . replace ( /(^"|"$)/g , "" ) ) ) ) , t . shift ( ) ) , t . forEach ( ( ( t , i ) => { e . data [ i ] = [ ] ; const a = t . split ( s . columnDelimiter ) ; a . length && a . forEach ( ( t => { s . removeDoubleQuotes && ( t = t . trim ( ) . replace ( /(^"|"$)/g , "" ) ) , e . data [ i ] . push ( t ) } ) ) } ) ) ) } else if ( s . type === "json" ) { const t = ( t => { let e = ! 1 ; try { e = JSON . parse ( t ) } catch ( t ) { return ! 1 } return ! ( e === null || ! Array . isArray ( e ) && ! i ( e ) ) && e } ) ( s . data ) ; t && ( e = { headings : [ ] , data : [ ] } , t . forEach ( ( ( t , s ) => { e . data [ s ] = [ ] , Object . entries ( t ) . forEach ( ( ( [ t , i ] ) => { e . headings . includes ( t ) || e . headings . push ( t ) , e . data [ s ] . push ( i ) } ) ) } ) ) ) } i ( s . data ) && ( e = s . data ) , e && this . insert ( e ) } return ! 1 }
print ( ) { const t = this . activeHeadings ; const e = this . activeRows ; const s = a ( "table" ) ; const i = a ( "thead" ) ; const n = a ( "tbody" ) ; const r = a ( "tr" ) ; t . forEach ( ( t => { r . appendChild ( a ( "th" , { html : t . textContent } ) ) } ) ) , i . appendChild ( r ) , e . forEach ( ( t => { const e = a ( "tr" ) ; Array . from ( t . cells ) . forEach ( ( t => { e . appendChild ( a ( "td" , { html : t . textContent } ) ) } ) ) , n . appendChild ( e ) } ) ) , s . appendChild ( i ) , s . appendChild ( n ) ; const o = window . open ( ) ; o . document . body . appendChild ( s ) , o . print ( ) }
setMessage ( t ) { let e = 1 ; this . hasRows ? e = this . data [ 0 ] . cells . length : this . activeHeadings . length && ( e = this . activeHeadings . length ) , this . wrapper . classList . add ( "dataTable-empty" ) , this . label && ( this . label . innerHTML = "" ) , this . totalPages = 0 , this . renderPager ( ) , this . clear ( a ( "tr" , { html : ` <td class="dataTables-empty" colspan=" ${ e } "> ${ t } </td> ` } ) ) }
on ( t , e ) { this . events = this . events || { } , this . events [ t ] = this . events [ t ] || [ ] , this . events [ t ] . push ( e ) }
off ( t , e ) { this . events = this . events || { } , t in this . events != 0 && this . events [ t ] . splice ( this . events [ t ] . indexOf ( e ) , 1 ) }
emit ( t ) { if ( this . events = this . events || { } , t in this . events != 0 ) for ( let e = 0 ; e < this . events [ t ] . length ; e ++ ) this . events [ t ] [ e ] . apply ( this , Array . prototype . slice . call ( arguments , 1 ) ) } } } , { "./date-7061ceee.js" : 1 } ] } , { } , [ 2 ] ) ( 2 ) ) ) ;
// # sourceMappingURL=/sm/afce570b8c86f3793c25206b2ee88ec4026e17a15166d732e9c4d2c718c1b4ad.map