2016-12-31 08:20:45 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-05-09 18:07:57 +00:00
var XLSX = { } ; ( function make _xlsx ( XLSX ) { XLSX . version = "0.10.0" ; var current _codepage = 1200 ; if ( typeof module !== "undefined" && typeof require !== "undefined" ) { if ( typeof cptable === "undefined" ) cptable = require ( "./dist/cpexcel.js" ) } function reset _cp ( ) { set _cp ( 1200 ) } var set _cp = function ( cp ) { current _codepage = cp } ; function char _codes ( data ) { var o = [ ] ; for ( var i = 0 , len = data . length ; i < len ; ++ i ) o [ i ] = data . charCodeAt ( i ) ; return o } var debom = function ( data ) { var c1 = data . charCodeAt ( 0 ) , c2 = data . charCodeAt ( 1 ) ; if ( c1 == 255 && c2 == 254 ) return data . substr ( 2 ) ; if ( c1 == 254 && c2 == 255 ) return data . substr ( 2 ) ; if ( c1 == 65279 ) return data . substr ( 1 ) ; return data } ; var _getchar = function _gc1 ( x ) { return String . fromCharCode ( x ) } ; if ( typeof cptable !== "undefined" ) { set _cp = function ( cp ) { current _codepage = cp } ; debom = function ( data ) { if ( data . charCodeAt ( 0 ) === 255 && data . charCodeAt ( 1 ) === 254 ) { return cptable . utils . decode ( 1200 , char _codes ( data . substr ( 2 ) ) ) } return data } ; _getchar = function _gc2 ( x ) { if ( current _codepage === 1200 ) return String . fromCharCode ( x ) ; return cptable . utils . decode ( current _codepage , [ x & 255 , x >> 8 ] ) [ 0 ] } } var DENSE = null ; var DIF _XL = true ; var Base64 = function make _b64 ( ) { var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" ; return { encode : function ( input ) { var o = "" ; var c1 , c2 , c3 , e1 , e2 , e3 , e4 ; for ( var i = 0 ; i < input . length ; ) { c1 = input . charCodeAt ( i ++ ) ; c2 = input . charCodeAt ( i ++ ) ; c3 = input . charCodeAt ( i ++ ) ; e1 = c1 >> 2 ; e2 = ( c1 & 3 ) << 4 | c2 >> 4 ; e3 = ( c2 & 15 ) << 2 | c3 >> 6 ; e4 = c3 & 63 ; if ( isNaN ( c2 ) ) { e3 = e4 = 64 } else if ( isNaN ( c3 ) ) { e4 = 64 } o += map . charAt ( e1 ) + map . charAt ( e2 ) + map . charAt ( e3 ) + map . charAt ( e4 ) } return o } , decode : function b64 _decode ( input ) { var o = "" ; var c1 , c2 , c3 ; var e1 , e2 , e3 , e4 ; input = input . replace ( /[^A-Za-z0-9\+\/\=]/g , "" ) ; for ( var i = 0 ; i < input . length ; ) { e1 = map . indexOf ( input . charAt ( i ++ ) ) ; e2 = map . indexOf ( input . charAt ( i ++ ) ) ; e3 = map . indexOf ( input . charAt ( i ++ ) ) ; e4 = map . indexOf ( input . charAt ( i ++ ) ) ; c1 = e1 << 2 | e2 >> 4 ; c2 = ( e2 & 15 ) << 4 | e3 >> 2 ; c3 = ( e3 & 3 ) << 6 | e4 ; o += String . fromCharCode ( c1 ) ; if ( e3 != 64 ) { o += String . fromCharCode ( c2 ) } if ( e4 != 64 ) { o += String . fromCharCode ( c3 ) } } return o } } } ( ) ; var has _buf = typeof Buffer !== "undefined" && typeof process !== "undefined" && typeof process . versions !== "undefined" && process . versions . node ; function new _raw _buf ( len ) { return new ( has _buf ? Buffer : Array ) ( len ) } function s2a ( s ) { if ( has _buf ) return new Buffer ( s , "binary" ) ; return s . split ( "" ) . map ( function ( x ) { return x . charCodeAt ( 0 ) & 255 } ) } var bconcat = function ( bufs ) { return [ ] . concat . apply ( [ ] , bufs ) } ; var chr0 = /\u0000/g , chr1 = /[\u0001-\u0006]/ ; var SSF = { } ; var make _ssf = function make _ssf ( SSF ) { SSF . version = "0.9.2" ; function _strrev ( x ) { var o = "" , i = x . length - 1 ; while ( i >= 0 ) o += x . charAt ( i -- ) ; return o } function fill ( c , l ) { var o = "" ; while ( o . length < l ) o += c ; return o } function pad0 ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } function pad _ ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( " " , d - t . length ) + t } function rpad _ ( v , d ) { var t = "" + v ; return t . length >= d ? t : t + fill ( " " , d - t . length ) } function pad0r1 ( v , d ) { var t = "" + Math . round ( v ) ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } function pad0r2 ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } var p2 _32 = Math . pow ( 2 , 32 ) ; function pad0r ( v , d ) { if ( v > p2 _32 || v < - p2 _32 ) return pad0r1 ( v , d ) ; var i = Math . round ( v ) ; return pad0r2 ( i , d ) } function isgeneral ( s , i ) { i = i || 0 ; return s . length >= 7 + i && ( s . charCodeAt ( i ) | 32 ) === 103 && ( s . charCodeAt ( i + 1 ) | 32 ) === 101 && ( s . charCodeAt ( i + 2 ) | 32 ) === 110 && ( s . charCodeAt ( i + 3 ) | 32 ) === 101 && ( s . charCodeAt ( i + 4 ) | 32 ) === 114 && ( s . charCodeAt ( i + 5 ) | 32 ) === 97 && ( s . charCodeAt ( i + 6 ) | 32 ) === 108 } var opts _fmt = [ [ "date1904" , 0 ] , [ "output" , "" ] , [ "WTF" , false ] ] ; function fixopts ( o ) { for ( var y = 0 ; y != opts _fmt . length ; ++ y ) if ( o [ opts _fmt [ y ] [ 0 ] ] === undefined ) o [ opts _fmt [ y ] [ 0 ] ] = opts _fmt [ y ] [ 1 ] } SSF . opts = opts _fmt ; var days = [ [ "Sun" , "Sunday" ] , [ "Mon" , "Monday" ] , [ "Tue" , "Tuesday" ] , [ "Wed" , "Wednesday" ] , [ "Thu" , "Thursday" ] , [ "Fri" , "Friday" ] , [ "Sat" , "Saturday" ] ] ; var months = [ [ "J" , "Jan" , "January" ] , [ "F" , "Feb" , "February" ] , [ "M" , "Mar" , "March" ] , [ "A" , "Apr" , "April" ] , [ "M" , "May" , "May" ] , [ "J" , "Jun" , "June" ] , [ "J" , "Jul" , "July" ] , [ "A" , "Aug" , "August" ] , [ "S" , "Sep" , "September" ] , [ "O" , "Oct" , "October" ] , [ "N" , "Nov" , "November" ] , [ "D" , "Dec" , "December" ] ] ; function init _table ( t ) { t [ 0 ] = "General" ; t [ 1 ] = "0" ; t [ 2 ] = "0.00" ; t [ 3 ] = "#,##0" ; t [ 4 ] = "#,##0.00" ; t [ 9 ] = "0%" ; t [ 10 ] = "0.00%" ; t [ 11 ] = " 0.00 E + 00
return [ blob . read _shift ( 2 , "u" ) , mver ] } function check _shifts ( blob , mver ) { var shift = 9 ; blob . l += 2 ; switch ( shift = blob . read _shift ( 2 ) ) { case 9 : if ( mver != 3 ) throw new Error ( "Sector Shift: Expected 9 saw " + shift ) ; break ; case 12 : if ( mver != 4 ) throw new Error ( "Sector Shift: Expected 12 saw " + shift ) ; break ; default : throw new Error ( "Sector Shift: Expected 9 or 12 saw " + shift ) } blob . chk ( "0600" , "Mini Sector Shift: " ) ; blob . chk ( "000000000000" , "Reserved: " ) } function sectorify ( file , ssz ) { var nsectors = Math . ceil ( file . length / ssz ) - 1 ; var sectors = new Array ( nsectors ) ; for ( var i = 1 ; i < nsectors ; ++ i ) sectors [ i - 1 ] = file . slice ( i * ssz , ( i + 1 ) * ssz ) ; sectors [ nsectors - 1 ] = file . slice ( nsectors * ssz ) ; return sectors } function build _full _paths ( FI , FPD , FP , Paths ) { var i = 0 , L = 0 , R = 0 , C = 0 , j = 0 , pl = Paths . length ; var dad = new Array ( pl ) , q = new Array ( pl ) ; for ( ; i < pl ; ++ i ) { dad [ i ] = q [ i ] = i ; FP [ i ] = Paths [ i ] } for ( ; j < q . length ; ++ j ) { i = q [ j ] ; L = FI [ i ] . L ; R = FI [ i ] . R ; C = FI [ i ] . C ; if ( dad [ i ] === i ) { if ( L !== - 1 && dad [ L ] !== L ) dad [ i ] = dad [ L ] ; if ( R !== - 1 && dad [ R ] !== R ) dad [ i ] = dad [ R ] } if ( C !== - 1 ) dad [ C ] = i ; if ( L !== - 1 ) { dad [ L ] = dad [ i ] ; q . push ( L ) } if ( R !== - 1 ) { dad [ R ] = dad [ i ] ; q . push ( R ) } } for ( i = 1 ; i !== pl ; ++ i ) if ( dad [ i ] === i ) { if ( R !== - 1 && dad [ R ] !== R ) dad [ i ] = dad [ R ] ; else if ( L !== - 1 && dad [ L ] !== L ) dad [ i ] = dad [ L ] } for ( i = 1 ; i < pl ; ++ i ) { if ( FI [ i ] . type === 0 ) continue ; j = dad [ i ] ; if ( j === 0 ) FP [ i ] = FP [ 0 ] + "/" + FP [ i ] ; else while ( j !== 0 ) { FP [ i ] = FP [ j ] + "/" + FP [ i ] ; j = dad [ j ] } dad [ i ] = 0 } FP [ 0 ] += "/" ; for ( i = 1 ; i < pl ; ++ i ) { if ( FI [ i ] . type !== 2 ) FP [ i ] += "/" ; FPD [ FP [ i ] ] = FI [ i ] } } function make _find _path ( FullPaths , Paths , FileIndex , files , root _name ) { var UCFullPaths = new Array ( FullPaths . length ) ; var UCPaths = new Array ( Paths . length ) , i ; for ( i = 0 ; i < FullPaths . length ; ++ i ) UCFullPaths [ i ] = FullPaths [ i ] . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; for ( i = 0 ; i < Paths . length ; ++ i ) UCPaths [ i ] = Paths [ i ] . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; return function find _path ( path ) { var k ; if ( path . charCodeAt ( 0 ) === 47 ) { k = true ; path = root _name + path } else k = path . indexOf ( "/" ) !== - 1 ; var UCPath = path . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; var w = k === true ? UCFullPaths . indexOf ( UCPath ) : UCPaths . indexOf ( UCPath ) ; if ( w === - 1 ) return null ; return k === true ? FileIndex [ w ] : files [ Paths [ w ] ] } } function sleuth _fat ( idx , cnt , sectors , ssz , fat _addrs ) { var q ; if ( idx === ENDOFCHAIN ) { if ( cnt !== 0 ) throw new Error ( "DIFAT chain shorter than expected" ) } else if ( idx !== - 1 ) { var sector = sectors [ idx ] , m = ( ssz >>> 2 ) - 1 ; if ( ! sector ) return ; for ( var i = 0 ; i < m ; ++ i ) { if ( ( q = _ _readInt32LE ( sector , i * 4 ) ) === ENDOFCHAIN ) break ; fat _addrs . push ( q ) } sleuth _fat ( _ _readInt32LE ( sector , ssz - 4 ) , cnt - 1 , sectors , ssz , fat _addrs ) } } function get _sector _list ( sectors , start , fat _addrs , ssz , chkd ) { var sl = sectors . length ; var buf , buf _chain ; if ( ! chkd ) chkd = new Array ( sl ) ; var modulus = ssz - 1 , j , jj ; buf = [ ] ; buf _chain = [ ] ; for ( j = start ; j >= 0 ; ) { chkd [ j ] = true ; buf [ buf . length ] = j ; buf _chain . push ( sectors [ j ] ) ; var addr = fat _addrs [ Math . floor ( j * 4 / ssz ) ] ; jj = j * 4 & modulus ; if ( ssz < 4 + jj ) throw new Error ( "FAT boundary crossed: " + j + " 4 " + ssz ) ; if ( ! sectors [ addr ] ) break ; j = _ _readInt32LE ( sectors [ addr ] , jj ) } return { nodes : buf , data : _ _toBuffer ( [ buf _chain ] ) } } function make _sector _list ( sectors , dir _start , fat _addrs , ssz ) { var sl = sectors . length , sector _list = new Array ( sl ) ; var chkd = new Array ( sl ) , buf , buf _chain ; var modulus = ssz - 1 , i , j , k , jj ; for ( i = 0 ; i < sl ; ++ i ) { buf = [ ] ; k = i + dir _start ; if ( k >= sl ) k -= sl ; if ( chkd [ k ] === true ) continue ; buf _chain = [ ] ; for ( j = k ; j >= 0 ; ) { chkd [ j ] = true ; buf [ buf . length ] = j ; buf _chain . push ( sectors [ j ] ) ; var addr = fat _addrs [ Math . floor ( j * 4 / ssz ) ] ; jj = j * 4 & modulus ; if ( ssz < 4 + jj ) throw new Error ( "FAT boundary crossed: " + j + " 4 " + ssz ) ; if ( ! sectors [ addr ] ) break ; j = _ _readInt32LE ( sectors [ addr ] , jj ) } sector _list [ k ] = { nodes : buf , data : _ _toBuffer ( [ buf _chain ] ) } } return sector _list } function read _directory ( dir _start , sector _list , sectors , Paths , nmfs , files , FileIndex ) { var blob ; var minifat _store = 0 , pl = Paths . length ? 2 : 0 ; var sector = sector _list [ dir _start ] . data ; var i = 0 , namelen = 0 , name , o , ctime , mtime ; for ( ; i < sector . length ; i += 128 ) { blob = sector . slice ( i , i + 128 ) ; prep _blob ( blob , 64 ) ; namelen = blob . read _shift ( 2 ) ; if ( namelen === 0 ) continue ; name = _ _utf16le ( blob , 0 , namelen - pl ) ; Paths . push ( name ) ; o = { name : name , type : blob . read _shift ( 1 ) , color : blob . read _shift ( 1 ) , L : blob . read _shift ( 4 , "i" ) , R : blob . read _shift ( 4 , "i" ) , C : blob . read _shift ( 4 , "i" ) , clsid : blob . read _shift ( 16 ) , state : blob . read _shift ( 4 , "i" ) } ; ctime = blob
} function write _XLWideString ( data , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 4 + 2 * data . length ) } o . write _shift ( 4 , data . length ) ; if ( data . length > 0 ) o . write _shift ( 0 , data , "dbcs" ) ; return _null ? o . slice ( 0 , o . l ) : o } function parse _StrRun ( data , length ) { return { ich : data . read _shift ( 2 ) , ifnt : data . read _shift ( 2 ) } } function write _StrRun ( run , o ) { if ( ! o ) o = new _buf ( 4 ) ; o . write _shift ( 2 , run . ich || 0 ) ; o . write _shift ( 2 , run . ifnt || 0 ) ; return o } function parse _RichStr ( data , length ) { var start = data . l ; var flags = data . read _shift ( 1 ) ; var str = parse _XLWideString ( data ) ; var rgsStrRun = [ ] ; var z = { t : str , h : str } ; if ( ( flags & 1 ) !== 0 ) { var dwSizeStrRun = data . read _shift ( 4 ) ; for ( var i = 0 ; i != dwSizeStrRun ; ++ i ) rgsStrRun . push ( parse _StrRun ( data ) ) ; z . r = rgsStrRun } else z . r = [ { ich : 0 , ifnt : 0 } ] ; data . l = start + length ; return z } function write _RichStr ( str , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 15 + 4 * str . t . length ) } o . write _shift ( 1 , 0 ) ; write _XLWideString ( str . t , o ) ; return _null ? o . slice ( 0 , o . l ) : o } var parse _BrtCommentText = parse _RichStr ; function write _BrtCommentText ( str , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 23 + 4 * str . t . length ) } o . write _shift ( 1 , 1 ) ; write _XLWideString ( str . t , o ) ; o . write _shift ( 4 , 1 ) ; write _StrRun ( { ich : 0 , ifnt : 0 } , o ) ; return _null ? o . slice ( 0 , o . l ) : o } function parse _XLSBCell ( data ) { var col = data . read _shift ( 4 ) ; var iStyleRef = data . read _shift ( 2 ) ; iStyleRef += data . read _shift ( 1 ) << 16 ; var fPhShow = data . read _shift ( 1 ) ; return { c : col , iStyleRef : iStyleRef } } function write _XLSBCell ( cell , o ) { if ( o == null ) o = new _buf ( 8 ) ; o . write _shift ( - 4 , cell . c ) ; o . write _shift ( 3 , cell . iStyleRef || cell . s ) ; o . write _shift ( 1 , 0 ) ; return o } var parse _XLSBCodeName = parse _XLWideString ; var write _XLSBCodeName = write _XLWideString ; function parse _XLNullableWideString ( data ) { var cchCharacters = data . read _shift ( 4 ) ; return cchCharacters === 0 || cchCharacters === 4294967295 ? "" : data . read _shift ( cchCharacters , "dbcs" ) } function write _XLNullableWideString ( data , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 127 ) } o . write _shift ( 4 , data . length > 0 ? data . length : 4294967295 ) ; if ( data . length > 0 ) o . write _shift ( 0 , data , "dbcs" ) ; return _null ? o . slice ( 0 , o . l ) : o } var parse _XLNameWideString = parse _XLWideString ; var write _XLNameWideString = write _XLWideString ; var parse _RelID = parse _XLNullableWideString ; var write _RelID = write _XLNullableWideString ; function parse _RkNumber ( data ) { var b = data . slice ( data . l , data . l + 4 ) ; var fX100 = b [ 0 ] & 1 , fInt = b [ 0 ] & 2 ; data . l += 4 ; b [ 0 ] &= 252 ; var RK = fInt === 0 ? _ _double ( [ 0 , 0 , 0 , 0 , b [ 0 ] , b [ 1 ] , b [ 2 ] , b [ 3 ] ] , 0 ) : _ _readInt32LE ( b , 0 ) >> 2 ; return fX100 ? RK / 100 : RK } function write _RkNumber ( data , o ) { if ( o == null ) o = new _buf ( 4 ) ; var fX100 = 0 , fInt = 0 , d100 = data * 100 ; if ( data == ( data | 0 ) && data >= - ( 1 << 29 ) && data < 1 << 29 ) { fInt = 1 } else if ( d100 == ( d100 | 0 ) && d100 >= - ( 1 << 29 ) && d100 < 1 << 29 ) { fInt = 1 ; fX100 = 1 } if ( fInt ) o . write _shift ( - 4 , ( ( fX100 ? d100 : data ) << 2 ) + ( fX100 + 2 ) ) ; else throw new Error ( "unsupported RkNumber " + data ) } function parse _RfX ( data ) { var cell = { s : { } , e : { } } ; cell . s . r = data . read _shift ( 4 ) ; cell . e . r = data . read _shift ( 4 ) ; cell . s . c = data . read _shift ( 4 ) ; cell . e . c = data . read _shift ( 4 ) ; return cell } function write _RfX ( r , o ) { if ( ! o ) o = new _buf ( 16 ) ; o . write _shift ( 4 , r . s . r ) ; o . write _shift ( 4 , r . e . r ) ; o . write _shift ( 4 , r . s . c ) ; o . write _shift ( 4 , r . e . c ) ; return o } var parse _UncheckedRfX = parse _RfX ; var write _UncheckedRfX = write _RfX ; function parse _Xnum ( data , length ) { return data . read _shift ( 8 , "f" ) } function write _Xnum ( data , o ) { return ( o || new _buf ( 8 ) ) . write _shift ( 8 , data , "f" ) } var BErr = { 0 : "#NULL!" , 7 : "#DIV/0!" , 15 : "#VALUE!" , 23 : "#REF!" , 29 : "#NAME?" , 36 : "#NUM!" , 42 : "#N/A" , 43 : "#GETTING_DATA" , 255 : "#WTF?" } ; var RBErr = evert _num ( BErr ) ; function parse _BrtColor ( data , length ) { var out = { } ; var d = data . read _shift ( 1 ) ; var fValidRGB = d & 1 ; var xColorType = d >>> 1 ; var index = data . read _shift ( 1 ) ; var nTS = data . read _shift ( 2 , "i" ) ; var bR = data . read _shift ( 1 ) ; var bG = data . read _shift ( 1 ) ; var bB = data . read _shift ( 1 ) ; var bAlpha = data . read _shift ( 1 ) ; switch ( xColorType ) { case 0 : out . auto = 1 ; break ; case 1 : out . index = index ; var icv = XLSIcv [ index ] ; if ( icv ) out . rgb = icv [ 0 ] . toString ( 16 ) + icv [ 1 ] . toString ( 16 ) + icv [ 2 ] . toString ( 16 ) ; break ; case 2 : out . rgb = bR . toString ( 16 ) + bG . toString ( 16 ) + bB . toString ( 16 ) ; break ; case 3 : out . theme = index ; break } if ( nTS != 0 ) out . tint = nTS > 0 ? nTS / 32767 : nTS / 32768 ; return out } function write _BrtColor ( color , o ) { if ( ! o ) o = new _buf ( 8 ) ; if ( ! color || color . auto ) { o . write _shift (
var Props = [ ] , i = 0 ; var CodePage = 0 ; var Dictionary = - 1 , DictObj = { } ; for ( i = 0 ; i != NumProps ; ++ i ) { var PropID = blob . read _shift ( 4 ) ; var Offset = blob . read _shift ( 4 ) ; Props [ i ] = [ PropID , Offset + start _addr ] } var PropH = { } ; for ( i = 0 ; i != NumProps ; ++ i ) { if ( blob . l !== Props [ i ] [ 1 ] ) { var fail = true ; if ( i > 0 && PIDSI ) switch ( PIDSI [ Props [ i - 1 ] [ 0 ] ] . t ) { case 2 : if ( blob . l + 2 === Props [ i ] [ 1 ] ) { blob . l += 2 ; fail = false } break ; case 80 : if ( blob . l <= Props [ i ] [ 1 ] ) { blob . l = Props [ i ] [ 1 ] ; fail = false } break ; case 4108 : if ( blob . l <= Props [ i ] [ 1 ] ) { blob . l = Props [ i ] [ 1 ] ; fail = false } break } if ( ! PIDSI && blob . l <= Props [ i ] [ 1 ] ) { fail = false ; blob . l = Props [ i ] [ 1 ] } if ( fail ) throw new Error ( "Read Error: Expected address " + Props [ i ] [ 1 ] + " at " + blob . l + " :" + i ) } if ( PIDSI ) { var piddsi = PIDSI [ Props [ i ] [ 0 ] ] ; PropH [ piddsi . n ] = parse _TypedPropertyValue ( blob , piddsi . t , { raw : true } ) ; if ( piddsi . p === "version" ) PropH [ piddsi . n ] = String ( PropH [ piddsi . n ] >> 16 ) + "." + String ( PropH [ piddsi . n ] & 65535 ) ; if ( piddsi . n == "CodePage" ) switch ( PropH [ piddsi . n ] ) { case 0 : PropH [ piddsi . n ] = 1252 ; case 874 : case 932 : case 936 : case 949 : case 950 : case 1250 : case 1251 : case 1253 : case 1254 : case 1255 : case 1256 : case 1257 : case 1258 : case 1e4 : case 1200 : case 1201 : case 1252 : case 65e3 : case - 536 : case 65001 : case - 535 : set _cp ( CodePage = PropH [ piddsi . n ] ) ; break ; default : throw new Error ( "Unsupported CodePage: " + PropH [ piddsi . n ] ) } } else { if ( Props [ i ] [ 0 ] === 1 ) { CodePage = PropH . CodePage = parse _TypedPropertyValue ( blob , VT _I2 ) ; set _cp ( CodePage ) ; if ( Dictionary !== - 1 ) { var oldpos = blob . l ; blob . l = Props [ Dictionary ] [ 1 ] ; DictObj = parse _dictionary ( blob , CodePage ) ; blob . l = oldpos } } else if ( Props [ i ] [ 0 ] === 0 ) { if ( CodePage === 0 ) { Dictionary = i ; blob . l = Props [ i + 1 ] [ 1 ] ; continue } DictObj = parse _dictionary ( blob , CodePage ) } else { var name = DictObj [ Props [ i ] [ 0 ] ] ; var val ; switch ( blob [ blob . l ] ) { case 65 : blob . l += 4 ; val = parse _BLOB ( blob ) ; break ; case 30 : blob . l += 4 ; val = parse _VtString ( blob , blob [ blob . l - 4 ] ) ; break ; case 31 : blob . l += 4 ; val = parse _VtString ( blob , blob [ blob . l - 4 ] ) ; break ; case 3 : blob . l += 4 ; val = blob . read _shift ( 4 , "i" ) ; break ; case 19 : blob . l += 4 ; val = blob . read _shift ( 4 ) ; break ; case 5 : blob . l += 4 ; val = blob . read _shift ( 8 , "f" ) ; break ; case 11 : blob . l += 4 ; val = parsebool ( blob , 4 ) ; break ; case 64 : blob . l += 4 ; val = parseDate ( parse _FILETIME ( blob ) ) ; break ; default : throw new Error ( "unparsed value: " + blob [ blob . l ] ) } PropH [ name ] = val } } } blob . l = start _addr + size ; return PropH } function parse _PropertySetStream ( file , PIDSI ) { var blob = file . content ; prep _blob ( blob , 0 ) ; var NumSets , FMTID0 , FMTID1 , Offset0 , Offset1 = 0 ; blob . chk ( "feff" , "Byte Order: " ) ; var vers = blob . read _shift ( 2 ) ; var SystemIdentifier = blob . read _shift ( 4 ) ; blob . chk ( CFB . utils . consts . HEADER _CLSID , "CLSID: " ) ; NumSets = blob . read _shift ( 4 ) ; if ( NumSets !== 1 && NumSets !== 2 ) throw new Error ( "Unrecognized #Sets: " + NumSets ) ; FMTID0 = blob . read _shift ( 16 ) ; Offset0 = blob . read _shift ( 4 ) ; if ( NumSets === 1 && Offset0 !== blob . l ) throw new Error ( "Length mismatch: " + Offset0 + " !== " + blob . l ) ; else if ( NumSets === 2 ) { FMTID1 = blob . read _shift ( 16 ) ; Offset1 = blob . read _shift ( 4 ) } var PSet0 = parse _PropertySet ( blob , PIDSI ) ; var rval = { SystemIdentifier : SystemIdentifier } ; for ( var y in PSet0 ) rval [ y ] = PSet0 [ y ] ; rval . FMTID = FMTID0 ; if ( NumSets === 1 ) return rval ; if ( blob . l !== Offset1 ) throw new Error ( "Length mismatch 2: " + blob . l + " !== " + Offset1 ) ; var PSet1 ; try { PSet1 = parse _PropertySet ( blob , null ) } catch ( e ) { } for ( y in PSet1 ) rval [ y ] = PSet1 [ y ] ; rval . FMTID = [ FMTID0 , FMTID1 ] ; return rval } function parsenoop2 ( blob , length ) { blob . read _shift ( length ) ; return null } function parslurp ( blob , length , cb ) { var arr = [ ] , target = blob . l + length ; while ( blob . l < target ) arr . push ( cb ( blob , target - blob . l ) ) ; if ( target !== blob . l ) throw new Error ( "Slurp error" ) ; return arr } function parsebool ( blob , length ) { return blob . read _shift ( length ) === 1 } function parseuint16 ( blob ) { return blob . read _shift ( 2 , "u" ) } function parseuint16a ( blob , length ) { return parslurp ( blob , length , parseuint16 ) } var parse _Boolean = parsebool ; function parse _Bes ( blob ) { var v = blob . read _shift ( 1 ) , t = blob . read _shift ( 1 ) ; return t === 1 ? v : v === 1 } function parse _ShortXLUnicodeString ( blob , length , opts ) { var cch = blob . read _shift ( opts && opts . biff >= 12 ? 2 : 1 ) ; var width = 1 , encoding = "sbcs-cont" ; var cp = current _codepage ; if ( opts && opts . biff >= 8 ) current _codepage = 1200 ; if ( ! opts || opts . biff == 8 ) { var fHighByte = blob . read _shift ( 1 ) ; if ( fHighByte ) { width = 2 ; encoding = "dbcs-cont" } } else if ( opts . biff == 12 ) { width = 2 ; encoding =
++ blob . l ; var num = parse _Xnum ( blob , 8 ) ; cell . t = "n" ; cell . val = num ; return cell } function parse _BIFF2INT ( blob , length ) { var cell = parse _XLSCell ( blob , 6 ) ; ++ blob . l ; var num = blob . read _shift ( 2 ) ; cell . t = "n" ; cell . val = num ; return cell } function parse _BIFF2STRING ( blob , length ) { var cch = blob . read _shift ( 1 ) ; if ( cch === 0 ) { blob . l ++ ; return "" } return blob . read _shift ( cch , "sbcs-cont" ) } function parse _BIFF2FONTXTRA ( blob , length ) { blob . l += 6 ; blob . l += 2 ; blob . l += 1 ; blob . l += 3 ; blob . l += 1 ; blob . l += length - 13 } function parse _RString ( blob , length , opts ) { var end = blob . l + length ; var cell = parse _XLSCell ( blob , 6 ) ; var cch = blob . read _shift ( 2 ) ; var str = parse _XLUnicodeStringNoCch ( blob , cch , opts ) ; blob . l = end ; cell . t = "str" ; cell . val = str ; return cell } var DBF = function ( ) { var dbf _codepage _map = { 1 : 437 , 2 : 850 , 3 : 1252 , 4 : 1e4 , 100 : 852 , 101 : 866 , 102 : 865 , 103 : 861 , 104 : 895 , 105 : 620 , 106 : 737 , 107 : 857 , 120 : 950 , 121 : 949 , 122 : 936 , 123 : 932 , 124 : 874 , 125 : 1255 , 126 : 1256 , 150 : 10007 , 151 : 10029 , 152 : 10006 , 200 : 1250 , 201 : 1251 , 202 : 1254 , 203 : 1253 , 0 : 20127 , 8 : 865 , 9 : 437 , 10 : 850 , 11 : 437 , 13 : 437 , 14 : 850 , 15 : 437 , 16 : 850 , 17 : 437 , 18 : 850 , 19 : 932 , 20 : 850 , 21 : 437 , 22 : 850 , 23 : 865 , 24 : 437 , 25 : 437 , 26 : 850 , 27 : 437 , 28 : 863 , 29 : 850 , 31 : 852 , 34 : 852 , 35 : 852 , 36 : 860 , 37 : 850 , 38 : 866 , 55 : 850 , 64 : 852 , 77 : 936 , 78 : 949 , 79 : 950 , 80 : 874 , 87 : 1252 , 88 : 1252 , 89 : 1252 , 255 : 16969 } ; function dbf _to _aoa ( buf , opts ) { var out = [ ] ; var d = new _raw _buf ( 1 ) ; switch ( opts . type ) { case "base64" : d = s2a ( Base64 . decode ( buf ) ) ; break ; case "binary" : d = s2a ( buf ) ; break ; case "buffer" : case "array" : d = buf ; break } prep _blob ( d , 0 ) ; var ft = d . read _shift ( 1 ) ; var memo = false ; var vfp = false ; switch ( ft ) { case 2 : case 3 : break ; case 48 : vfp = true ; memo = true ; break ; case 49 : vfp = true ; break ; case 131 : memo = true ; break ; case 139 : memo = true ; break ; case 245 : memo = true ; break ; default : throw new Error ( "DBF Unsupported Version: " + ft . toString ( 16 ) ) } var filedate = new Date , nrow = 0 , fpos = 0 ; if ( ft == 2 ) nrow = d . read _shift ( 2 ) ; filedate = new Date ( d . read _shift ( 1 ) + 1900 , d . read _shift ( 1 ) - 1 , d . read _shift ( 1 ) ) ; if ( ft != 2 ) nrow = d . read _shift ( 4 ) ; if ( ft != 2 ) fpos = d . read _shift ( 2 ) ; var rlen = d . read _shift ( 2 ) ; var flags = 0 , current _cp = 1252 ; if ( ft != 2 ) { d . l += 16 ; flags = d . read _shift ( 1 ) ; if ( d [ d . l ] !== 0 ) current _cp = dbf _codepage _map [ d [ d . l ] ] ; d . l += 1 ; d . l += 2 } var fields = [ ] , field = { } ; var hend = fpos - 10 - ( vfp ? 264 : 0 ) ; while ( ft == 2 ? d . l < d . length && d [ d . l ] != 13 : d . l < hend ) { field = { } ; field . name = cptable . utils . decode ( current _cp , d . slice ( d . l , d . l + 10 ) ) . replace ( /[\u0000\r\n].*$/g , "" ) ; d . l += 11 ; field . type = String . fromCharCode ( d . read _shift ( 1 ) ) ; if ( ft != 2 ) field . offset = d . read _shift ( 4 ) ; field . len = d . read _shift ( 1 ) ; if ( ft == 2 ) field . offset = d . read _shift ( 2 ) ; field . dec = d . read _shift ( 1 ) ; if ( field . name . length ) fields . push ( field ) ; if ( ft != 2 ) d . l += 14 ; switch ( field . type ) { case "C" : break ; case "D" : break ; case "F" : break ; case "I" : break ; case "L" : break ; case "M" : break ; case "N" : break ; case "T" : break ; case "Y" : break ; case "0" : break ; case "+" : break ; case "@" : break ; default : throw new Error ( "Unknown Field Type: " + field . type ) } } if ( d [ d . l ] !== 13 ) d . l = fpos - 1 ; else if ( ft == 2 ) d . l = 521 ; if ( ft != 2 ) { if ( d . read _shift ( 1 ) !== 13 ) throw new Error ( "DBF Terminator not found " + d . l + " " + d [ d . l ] ) ; d . l = fpos } var R = 0 , C = 0 ; out [ 0 ] = [ ] ; for ( C = 0 ; C != fields . length ; ++ C ) out [ 0 ] [ C ] = fields [ C ] . name ; while ( nrow -- > 0 ) { if ( d [ d . l ] === 42 ) { d . l += rlen ; continue } ++ d . l ; out [ ++ R ] = [ ] ; C = 0 ; for ( C = 0 ; C != fields . length ; ++ C ) { var dd = d . slice ( d . l , d . l + fields [ C ] . len ) ; d . l += fields [ C ] . len ; prep _blob ( dd , 0 ) ; var s = cptable . utils . decode ( current _cp , dd ) ; switch ( fields [ C ] . type ) { case "C" : out [ R ] [ C ] = cptable . utils . decode ( current _cp , dd ) ; out [ R ] [ C ] = out [ R ] [ C ] . trim ( ) ; break ; case "D" : if ( s . length === 8 ) out [ R ] [ C ] = new Date ( + s . substr ( 0 , 4 ) , + s . substr ( 4 , 2 ) - 1 , + s . substr ( 6 , 2 ) ) ; else out [ R ] [ C ] = s ; break ; case "F" : out [ R ] [ C ] = parseFloat ( s . trim ( ) ) ; break ; case "I" : out [ R ] [ C ] = dd . read _shift ( 4 , "i" ) ; break ; case "L" : switch ( s . toUpperCase ( ) ) { case "Y" : case "T" : out [ R ] [ C ] = true ; break ; case "N" : case "F" : out [ R ] [ C ] = false ; break ; case " " : case "?" : out [ R ] [ C ] = false ; break ; default : throw new Error ( "DBF Unrecognized L:|" + s + "|" ) } break ; case "M" : if ( ! memo ) throw new Error ( "DBF Unexpected MEMO for type " + ft . toString ( 16 ) ) ; out [ R ] [ C ] = "##MEMO##" + dd . read _shift ( 4 ) ; break ; case "N" : out [ R ] [ C ] = + s . replace ( /\u0000/g , "" ) . trim ( ) ; break ; case "T" : var day = dd . read _shift ( 4 ) , ms = dd . read _shift ( 4 ) ; throw new Error ( day + " | " + ms ) ; case "Y" : out [ R ] [ C ] = dd . read ( 4 , "i" ) / 1e4 ; break ; case "0" : if ( fields [ C ] . name === "_NullFlags" ) break ; default : throw new Error ( " DBF Uns
var Ror = function ( Byte ) { return ( Byte / 2 | Byte * 128 ) & 255 } ; var XorRor = function ( byte1 , byte2 ) { return Ror ( byte1 ^ byte2 ) } ; var CreateXorKey _Method1 = function ( Password ) { var XorKey = InitialCode [ Password . length - 1 ] ; var CurrentElement = 104 ; for ( var i = Password . length - 1 ; i >= 0 ; -- i ) { var Char = Password [ i ] ; for ( var j = 0 ; j != 7 ; ++ j ) { if ( Char & 64 ) XorKey ^= XorMatrix [ CurrentElement ] ; Char *= 2 ; -- CurrentElement } } return XorKey } ; return function ( password ) { var Password = _JS2ANSI ( password ) ; var XorKey = CreateXorKey _Method1 ( Password ) ; var Index = Password . length ; var ObfuscationArray = new _raw _buf ( 16 ) ; for ( var i = 0 ; i != 16 ; ++ i ) ObfuscationArray [ i ] = 0 ; var Temp , PasswordLastChar , PadIndex ; if ( ( Index & 1 ) === 1 ) { Temp = XorKey >> 8 ; ObfuscationArray [ Index ] = XorRor ( PadArray [ 0 ] , Temp ) ; -- Index ; Temp = XorKey & 255 ; PasswordLastChar = Password [ Password . length - 1 ] ; ObfuscationArray [ Index ] = XorRor ( PasswordLastChar , Temp ) } while ( Index > 0 ) { -- Index ; Temp = XorKey >> 8 ; ObfuscationArray [ Index ] = XorRor ( Password [ Index ] , Temp ) ; -- Index ; Temp = XorKey & 255 ; ObfuscationArray [ Index ] = XorRor ( Password [ Index ] , Temp ) } Index = 15 ; PadIndex = 15 - Password . length ; while ( PadIndex > 0 ) { Temp = XorKey >> 8 ; ObfuscationArray [ Index ] = XorRor ( PadArray [ PadIndex ] , Temp ) ; -- Index ; -- PadIndex ; Temp = XorKey & 255 ; ObfuscationArray [ Index ] = XorRor ( Password [ Index ] , Temp ) ; -- Index ; -- PadIndex } return ObfuscationArray } } ( ) ; var crypto _DecryptData _Method1 = function ( password , Data , XorArrayIndex , XorArray , O ) { if ( ! O ) O = Data ; if ( ! XorArray ) XorArray = crypto _CreateXorArray _Method1 ( password ) ; var Index , Value ; for ( Index = 0 ; Index != Data . length ; ++ Index ) { Value = Data [ Index ] ; Value ^= XorArray [ XorArrayIndex ] ; Value = ( Value >> 5 | Value << 3 ) & 255 ; O [ Index ] = Value ; ++ XorArrayIndex } return [ O , XorArrayIndex , XorArray ] } ; var crypto _MakeXorDecryptor = function ( password ) { var XorArrayIndex = 0 , XorArray = crypto _CreateXorArray _Method1 ( password ) ; return function ( Data ) { var O = crypto _DecryptData _Method1 ( "" , Data , XorArrayIndex , XorArray ) ; XorArrayIndex = O [ 1 ] ; return O [ 0 ] } } ; function parse _XORObfuscation ( blob , length , opts , out ) { var o = { key : parseuint16 ( blob ) , verificationBytes : parseuint16 ( blob ) } ; if ( opts . password ) o . verifier = crypto _CreatePasswordVerifier _Method1 ( opts . password ) ; out . valid = o . verificationBytes === o . verifier ; if ( out . valid ) out . insitu _decrypt = crypto _MakeXorDecryptor ( opts . password ) ; return o } function parse _FilePassHeader ( blob , length , oo ) { var o = oo || { } ; o . Info = blob . read _shift ( 2 ) ; blob . l -= 2 ; if ( o . Info === 1 ) o . Data = parse _RC4Header ( blob , length ) ; else o . Data = parse _RC4CryptoHeader ( blob , length ) ; return o } function parse _FilePass ( blob , length , opts ) { var o = { Type : blob . read _shift ( 2 ) } ; if ( o . Type ) parse _FilePassHeader ( blob , length - 2 , o ) ; else parse _XORObfuscation ( blob , length - 2 , opts , o ) ; return o } function hex2RGB ( h ) { var o = h . substr ( h [ 0 ] === "#" ? 1 : 0 , 6 ) ; return [ parseInt ( o . substr ( 0 , 2 ) , 16 ) , parseInt ( o . substr ( 2 , 2 ) , 16 ) , parseInt ( o . substr ( 4 , 2 ) , 16 ) ] } function rgb2Hex ( rgb ) { for ( var i = 0 , o = 1 ; i != 3 ; ++ i ) o = o * 256 + ( rgb [ i ] > 255 ? 255 : rgb [ i ] < 0 ? 0 : rgb [ i ] ) ; return o . toString ( 16 ) . toUpperCase ( ) . substr ( 1 ) } function rgb2HSL ( rgb ) { var R = rgb [ 0 ] / 255 , G = rgb [ 1 ] / 255 , B = rgb [ 2 ] / 255 ; var M = Math . max ( R , G , B ) , m = Math . min ( R , G , B ) , C = M - m ; if ( C === 0 ) return [ 0 , 0 , R ] ; var H6 = 0 , S = 0 , L2 = M + m ; S = C / ( L2 > 1 ? 2 - L2 : L2 ) ; switch ( M ) { case R : H6 = ( ( G - B ) / C + 6 ) % 6 ; break ; case G : H6 = ( B - R ) / C + 2 ; break ; case B : H6 = ( R - G ) / C + 4 ; break } return [ H6 / 6 , S , L2 / 2 ] } function hsl2RGB ( hsl ) { var H = hsl [ 0 ] , S = hsl [ 1 ] , L = hsl [ 2 ] ; var C = S * 2 * ( L < . 5 ? L : 1 - L ) , m = L - C / 2 ; var rgb = [ m , m , m ] , h6 = 6 * H ; var X ; if ( S !== 0 ) switch ( h6 | 0 ) { case 0 : case 6 : X = C * h6 ; rgb [ 0 ] += C ; rgb [ 1 ] += X ; break ; case 1 : X = C * ( 2 - h6 ) ; rgb [ 0 ] += X ; rgb [ 1 ] += C ; break ; case 2 : X = C * ( h6 - 2 ) ; rgb [ 1 ] += C ; rgb [ 2 ] += X ; break ; case 3 : X = C * ( 4 - h6 ) ; rgb [ 1 ] += X ; rgb [ 2 ] += C ; break ; case 4 : X = C * ( h6 - 4 ) ; rgb [ 2 ] += C ; rgb [ 0 ] += X ; break ; case 5 : X = C * ( 6 - h6 ) ; rgb [ 2 ] += X ; rgb [ 0 ] += C ; break } for ( var i = 0 ; i != 3 ; ++ i ) rgb [ i ] = Math . round ( rgb [ i ] * 255 ) ; return rgb } function rgb _tint ( hex , tint ) { if ( tint === 0 ) return hex ; var hsl = rgb2HSL ( hex2RGB ( hex ) ) ; if ( tint < 0 ) hsl [ 2 ] = hsl [ 2 ] * ( 1 + tint ) ; else hsl [ 2 ] = 1 - ( 1 - hsl [ 2 ] ) * ( 1 - tint ) ; return rgb2Hex ( hsl2RGB ( hsl ) ) } var DEF _MDW = 6 , MAX _MDW = 15 , MIN _MDW = 1 , MDW = DEF _MDW ; function width2px ( width ) { return Math . floor ( ( width + Math . round ( 128 / MDW ) / 256 ) * MDW ) } function px2char ( px ) { return Math . floor ( ( px - 5 ) / MDW * 100 + . 5 ) / 100 } function char2width ( chr ) { return Math . round ( ( chr * MDW + 5 ) / MDW * 256 ) / 256 } function px2char _ ( px ) { return ( ( px - 5 ) / MDW * 100 + . 5 ) / 100 } function char2width _ ( chr ) { r
o [ o . length ] = "<a:gsLst>" ; o [ o . length ] = '<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>' ; o [ o . length ] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>' ; o [ o . length ] = "</a:gsLst>" ; o [ o . length ] = '<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>' ; o [ o . length ] = "</a:gradFill>" ; o [ o . length ] = "</a:bgFillStyleLst>" ; o [ o . length ] = "</a:fmtScheme>" ; o [ o . length ] = "</a:themeElements>" ; o [ o . length ] = "<a:objectDefaults>" ; o [ o . length ] = "<a:spDef>" ; o [ o . length ] = '<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style>' ; o [ o . length ] = "</a:spDef>" ; o [ o . length ] = "<a:lnDef>" ; o [ o . length ] = '<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style>' ; o [ o . length ] = "</a:lnDef>" ; o [ o . length ] = "</a:objectDefaults>" ; o [ o . length ] = "<a:extraClrSchemeLst/>" ; o [ o . length ] = "</a:theme>" ; return o . join ( "" ) } function parse _Theme ( blob , length , opts ) { var dwThemeVersion = blob . read _shift ( 4 ) ; if ( dwThemeVersion === 124226 ) return ; blob . l += length - 4 } function parse _ColorTheme ( blob , length ) { return blob . read _shift ( 4 ) } function parse _FullColorExt ( blob , length ) { var o = { } ; o . xclrType = blob . read _shift ( 2 ) ; o . nTintShade = blob . read _shift ( 2 ) ; switch ( o . xclrType ) { case 0 : blob . l += 4 ; break ; case 1 : o . xclrValue = parse _IcvXF ( blob , 4 ) ; break ; case 2 : o . xclrValue = parse _LongRGBA ( blob , 4 ) ; break ; case 3 : o . xclrValue = parse _ColorTheme ( blob , 4 ) ; break ; case 4 : blob . l += 4 ; break } blob . l += 8 ; return o } function parse _IcvXF ( blob , length ) { return parsenoop ( blob , length ) } function parse _XFExtGradient ( blob , length ) { return parsenoop ( blob , length ) } function parse _ExtProp ( blob , length ) { var extType = blob . read _shift ( 2 ) ; var cb = blob . read _shift ( 2 ) ; var o = [ extType ] ; switch ( extType ) { case 4 : case 5 : case 7 : case 8 : case 9 : case 10 : case 11 : case 13 : o [ 1 ] = parse _FullColorExt ( blob , cb ) ; break ; case 6 : o [ 1 ] = parse _XFExtGradient ( blob , cb ) ; break ; case 14 : case 15 : o [ 1 ] = blob . read _shift ( cb === 5 ? 1 : 2 ) ; break ; default : throw new Error ( "Unrecognized ExtProp type: " + extType + " " + cb ) } return o } function parse _XFExt ( blob , length ) { var end = blob . l + length ; blob . l += 2 ; var ixfe = blob . read _shift ( 2 ) ; blob . l += 2 ; var cexts = blob . read _shift ( 2 ) ; var ext = [ ] ; while ( cexts -- > 0 ) ext . push ( parse _ExtProp ( blob , end - blob . l ) ) ; return { ixfe : ixfe , ext : ext } } function update _xfext ( xf , xfext ) { xfext . forEach ( function ( xfe ) { switch ( xfe [ 0 ] ) { case 4 : break ; case 5 : break ; case 6 : break ; case 7 : break ; case 8 : break ; case 9 : break ; case 10 : break ; case 11 : break ; case 13 : break ; case 14 : break ; case 15 : break } } ) } function parse _cc _xml ( data , opts ) { var d = [ ] ; if ( ! data ) return d ; var l = 0 , i = 1 ; ( data . match ( tagregex ) || [ ] ) . forEach ( function ( x ) { var y = parsexmltag ( x ) ; switch ( y [ 0 ] ) { case "<?xml" : break ; case "<calcChain" : case "<calcChain>" : case "</calcChain>" : break ; case "<c" : delete y [ 0 ] ; if ( y . i ) i = y . i ; else y . i = i ; d . push ( y ) ; break } } ) ; return d } function write _cc _xml ( data , opts ) { } function parse _BrtCalcChainItem$ ( data , length ) { var out = { } ; out . i = data . read _shift ( 4 ) ; var cell = { } ; cell . r = data . read _shift ( 4 ) ; cell . c = data . read _shift ( 4 ) ; out . r = encode _cell ( cell ) ; var flags = data . read _shift ( 1 ) ; if ( flags & 2 ) out . l = "1" ; if ( flags & 8 ) out . a = "1" ; return out } function parse _cc _bin ( data , opts ) { var out = [ ] ; var pass = false ; recordhopper ( data , function hopper _cc ( val , R _n , RT ) { switch ( RT ) { case 63 : out . push ( val ) ; break ; default : if ( ( R _n || "" ) . indexOf ( "Begin" ) > 0 ) { } else if ( ( R _n || "" ) . indexOf ( "End" ) > 0 ) { } else if ( ! pass || opts . WTF ) throw new Error ( "Unexpected record " + RT + " " + R _n ) } } ) ; return out } function write _cc _bin ( data , opts ) { } RELS . IMG = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" ; RELS . DRAW = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing" ; function parse _drawing ( data , rels ) { if ( ! data ) return "??" ; var id = ( data . match ( / < c : c h a r t [ ^ > ] *
f = formula [ 0 ] [ last _sp ] ; var _left = true ; switch ( f [ 1 ] [ 0 ] ) { case 4 : _left = false ; case 0 : sp = fill ( " " , f [ 1 ] [ 1 ] ) ; break ; case 5 : _left = false ; case 1 : sp = fill ( "\r" , f [ 1 ] [ 1 ] ) ; break ; default : sp = "" ; if ( opts . WTF ) throw new Error ( "Unexpected PtgAttrSpaceType " + f [ 1 ] [ 0 ] ) } stack . push ( ( _left ? sp : "" ) + stack . pop ( ) + ( _left ? "" : sp ) ) ; last _sp = - 1 } } if ( stack . length > 1 && opts . WTF ) throw new Error ( "bad formula stack" ) ; return stack [ 0 ] } function parse _XLSBParsedFormula ( data , length , opts ) { var end = data . l + length ; var cce = data . read _shift ( 4 ) ; var rgce = parse _Rgce ( data , cce , opts ) ; var cb = data . read _shift ( 4 ) ; var rgcb = cb > 0 ? parse _RgbExtra ( data , cb , rgce , opts ) : null ; return [ rgce , rgcb ] } var parse _XLSBArrayParsedFormula = parse _XLSBParsedFormula ; var parse _XLSBCellParsedFormula = parse _XLSBParsedFormula ; var parse _XLSBNameParsedFormula = parse _XLSBParsedFormula ; var parse _XLSBSharedParsedFormula = parse _XLSBParsedFormula ; var PtgDataType = { 1 : "REFERENCE" , 2 : "VALUE" , 3 : "ARRAY" } ; var Cetab = { 0 : "BEEP" , 1 : "OPEN" , 2 : "OPEN.LINKS" , 3 : "CLOSE.ALL" , 4 : "SAVE" , 5 : "SAVE.AS" , 6 : "FILE.DELETE" , 7 : "PAGE.SETUP" , 8 : "PRINT" , 9 : "PRINTER.SETUP" , 10 : "QUIT" , 11 : "NEW.WINDOW" , 12 : "ARRANGE.ALL" , 13 : "WINDOW.SIZE" , 14 : "WINDOW.MOVE" , 15 : "FULL" , 16 : "CLOSE" , 17 : "RUN" , 22 : "SET.PRINT.AREA" , 23 : "SET.PRINT.TITLES" , 24 : "SET.PAGE.BREAK" , 25 : "REMOVE.PAGE.BREAK" , 26 : "FONT" , 27 : "DISPLAY" , 28 : "PROTECT.DOCUMENT" , 29 : "PRECISION" , 30 : "A1.R1C1" , 31 : "CALCULATE.NOW" , 32 : "CALCULATION" , 34 : "DATA.FIND" , 35 : "EXTRACT" , 36 : "DATA.DELETE" , 37 : "SET.DATABASE" , 38 : "SET.CRITERIA" , 39 : "SORT" , 40 : "DATA.SERIES" , 41 : "TABLE" , 42 : "FORMAT.NUMBER" , 43 : "ALIGNMENT" , 44 : "STYLE" , 45 : "BORDER" , 46 : "CELL.PROTECTION" , 47 : "COLUMN.WIDTH" , 48 : "UNDO" , 49 : "CUT" , 50 : "COPY" , 51 : "PASTE" , 52 : "CLEAR" , 53 : "PASTE.SPECIAL" , 54 : "EDIT.DELETE" , 55 : "INSERT" , 56 : "FILL.RIGHT" , 57 : "FILL.DOWN" , 61 : "DEFINE.NAME" , 62 : "CREATE.NAMES" , 63 : "FORMULA.GOTO" , 64 : "FORMULA.FIND" , 65 : "SELECT.LAST.CELL" , 66 : "SHOW.ACTIVE.CELL" , 67 : "GALLERY.AREA" , 68 : "GALLERY.BAR" , 69 : "GALLERY.COLUMN" , 70 : "GALLERY.LINE" , 71 : "GALLERY.PIE" , 72 : "GALLERY.SCATTER" , 73 : "COMBINATION" , 74 : "PREFERRED" , 75 : "ADD.OVERLAY" , 76 : "GRIDLINES" , 77 : "SET.PREFERRED" , 78 : "AXES" , 79 : "LEGEND" , 80 : "ATTACH.TEXT" , 81 : "ADD.ARROW" , 82 : "SELECT.CHART" , 83 : "SELECT.PLOT.AREA" , 84 : "PATTERNS" , 85 : "MAIN.CHART" , 86 : "OVERLAY" , 87 : "SCALE" , 88 : "FORMAT.LEGEND" , 89 : "FORMAT.TEXT" , 90 : "EDIT.REPEAT" , 91 : "PARSE" , 92 : "JUSTIFY" , 93 : "HIDE" , 94 : "UNHIDE" , 95 : "WORKSPACE" , 96 : "FORMULA" , 97 : "FORMULA.FILL" , 98 : "FORMULA.ARRAY" , 99 : "DATA.FIND.NEXT" , 100 : "DATA.FIND.PREV" , 101 : "FORMULA.FIND.NEXT" , 102 : "FORMULA.FIND.PREV" , 103 : "ACTIVATE" , 104 : "ACTIVATE.NEXT" , 105 : "ACTIVATE.PREV" , 106 : "UNLOCKED.NEXT" , 107 : "UNLOCKED.PREV" , 108 : "COPY.PICTURE" , 109 : "SELECT" , 110 : "DELETE.NAME" , 111 : "DELETE.FORMAT" , 112 : "VLINE" , 113 : "HLINE" , 114 : "VPAGE" , 115 : "HPAGE" , 116 : "VSCROLL" , 117 : "HSCROLL" , 118 : "ALERT" , 119 : "NEW" , 120 : "CANCEL.COPY" , 121 : "SHOW.CLIPBOARD" , 122 : "MESSAGE" , 124 : "PASTE.LINK" , 125 : "APP.ACTIVATE" , 126 : "DELETE.ARROW" , 127 : "ROW.HEIGHT" , 128 : "FORMAT.MOVE" , 129 : "FORMAT.SIZE" , 130 : "FORMULA.REPLACE" , 131 : "SEND.KEYS" , 132 : "SELECT.SPECIAL" , 133 : "APPLY.NAMES" , 134 : "REPLACE.FONT" , 135 : "FREEZE.PANES" , 136 : "SHOW.INFO" , 137 : "SPLIT" , 138 : "ON.WINDOW" , 139 : "ON.DATA" , 140 : "DISABLE.INPUT" , 142 : "OUTLINE" , 143 : "LIST.NAMES" , 144 : "FILE.CLOSE" , 145 : "SAVE.WORKBOOK" , 146 : "DATA.FORM" , 147 : "COPY.CHART" , 148 : "ON.TIME" , 149 : "WAIT" , 150 : "FORMAT.FONT" , 151 : "FILL.UP" , 152 : "FILL.LEFT" , 153 : "DELETE.OVERLAY" , 155 : "SHORT.MENUS" , 159 : "SET.UPDATE.STATUS" , 161 : "COLOR.PALETTE" , 162 : "DELETE.STYLE" , 163 : "WINDOW.RESTORE" , 164 : "WINDOW.MAXIMIZE" , 166 : "CHANGE.LINK" , 167 : "CALCULATE.DOCUMENT" , 168 : "ON.KEY" , 169 : "APP.RESTORE" , 170 : "APP.MOVE" , 171 : "APP.SIZE" , 172 : "APP.MINIMIZE" , 173 : "APP.MAXIMIZE" , 174 : "BRING.TO.FRONT" , 175 : "SEND.TO.BACK" , 185 : "MAIN.CHART.TYPE" , 186 : "OVERLAY.CHART.TYPE" , 187 : "SELECT.END" , 188 : "OPEN.MAIL" , 189 : "SEND.MAIL" , 190 : "STANDARD.FONT" , 191 : "CONSOLIDATE" , 192 : "SORT.SPECIAL" , 193 : "GALLERY.3D.AREA" , 194 : "GALLERY.3D.COLUMN" , 195 : "GALLERY.3D.LINE" , 196 : "GALLERY.3D.PIE" , 197 : "VIEW.3D" , 198 : "GOAL.SEEK" , 199 : "WORKGROUP" , 200 : "FILL.GROUP" , 201 : "UPDATE.LINK" , 202 : "PROMOTE" , 203 : "DEMOTE" , 204 : "SHOW.DETAIL" , 206 : "UNGROUP" , 207 : "OBJECT.PROPERTIES" , 208 : "SAVE.NEW.OBJECT" , 209 : "SHARE" , 210 : "SHARE.NAME" , 211 : "DUPLICATE" , 212 : "APPLY.STYLE" , 213 : "ASSIGN.TO.OBJECT" , 214 : "OBJECT.PROTECTION" , 215 : "HIDE.OBJECT" , 216 : "SET.EXTRACT" , 217 : " CREATE
p . t = "s" ; p . v = p . v != null ? utf8read ( p . v ) : "" ; if ( opts . cellHTML ) p . h = escapehtml ( p . v ) ; break ; case "inlineStr" : cref = d . match ( isregex ) ; p . t = "s" ; if ( cref != null && ( sstr = parse _si ( cref [ 1 ] ) ) ) p . v = sstr . t ; else p . v = "" ; break ; case "b" : p . v = parsexmlbool ( p . v ) ; break ; case "d" : if ( ! opts . cellDates ) { p . v = datenum ( parseDate ( p . v ) ) ; p . t = "n" } break ; case "e" : if ( ! opts || opts . cellText !== false ) p . w = p . v ; p . v = RBErr [ p . v ] ; break } fmtid = fillid = 0 ; if ( do _format && tag . s !== undefined ) { cf = styles . CellXf [ tag . s ] ; if ( cf != null ) { if ( cf . numFmtId != null ) fmtid = cf . numFmtId ; if ( opts . cellStyles && cf . fillId != null ) fillid = cf . fillId } } safe _format ( p , fmtid , fillid , opts , themes , styles ) ; if ( opts . cellDates && do _format && p . t == "n" && SSF . is _date ( SSF . _table [ fmtid ] ) ) { var _d = SSF . parse _date _code ( p . v ) ; if ( _d ) { p . t = "d" ; p . v = new Date ( Date . UTC ( _d . y , _d . m - 1 , _d . d , _d . H , _d . M , _d . S , _d . u ) ) } } if ( dense ) { var _r = decode _cell ( tag . r ) ; if ( ! s [ _r . r ] ) s [ _r . r ] = [ ] ; s [ _r . r ] [ _r . c ] = p } else s [ tag . r ] = p } } if ( rows . length > 0 ) s [ "!rows" ] = rows } } ( ) ; function write _ws _xml _data ( ws , opts , idx , wb , rels ) { var o = [ ] , r = [ ] , range = safe _decode _range ( ws [ "!ref" ] ) , cell , ref , rr = "" , cols = [ ] , R = 0 , C = 0 , rows = ws [ "!rows" ] ; var dense = Array . isArray ( ws ) ; for ( C = range . s . c ; C <= range . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; for ( R = range . s . r ; R <= range . e . r ; ++ R ) { r = [ ] ; rr = encode _row ( R ) ; for ( C = range . s . c ; C <= range . e . c ; ++ C ) { ref = cols [ C ] + rr ; var _cell = dense ? ( ws [ R ] || [ ] ) [ C ] : ws [ ref ] ; if ( _cell === undefined ) continue ; if ( ( cell = write _ws _xml _cell ( _cell , ref , ws , opts , idx , wb ) ) != null ) r . push ( cell ) } if ( r . length > 0 ) { var params = { r : rr } ; if ( rows && rows [ R ] ) { var row = rows [ R ] ; if ( row . hidden ) params . hidden = 1 ; var height = - 1 ; if ( row . hpx ) height = px2pt ( row . hpx ) ; else if ( row . hpt ) height = row . hpt ; if ( height > - 1 ) { params . ht = height ; params . customHeight = 1 } } o [ o . length ] = writextag ( "row" , r . join ( "" ) , params ) } } return o . join ( "" ) } var WS _XML _ROOT = writextag ( "worksheet" , null , { xmlns : XMLNS . main [ 0 ] , "xmlns:r" : XMLNS . r } ) ; function write _ws _xml ( idx , opts , wb , rels ) { var o = [ XML _HEADER , WS _XML _ROOT ] ; var s = wb . SheetNames [ idx ] , sidx = 0 , rdata = "" ; var ws = wb . Sheets [ s ] ; if ( ws == null ) ws = { } ; var ref = ws [ "!ref" ] ; if ( ref == null ) ref = "A1" ; if ( ! rels ) rels = { } ; ws [ "!comments" ] = [ ] ; ws [ "!drawing" ] = [ ] ; o [ o . length ] = writextag ( "sheetPr" , null , { codeName : escapexml ( wb . SheetNames [ idx ] ) } ) ; o [ o . length ] = writextag ( "dimension" , null , { ref : ref } ) ; o [ o . length ] = write _ws _xml _sheetviews ( ws , opts , idx , wb ) ; if ( opts . sheetFormat ) o [ o . length ] = writextag ( "sheetFormatPr" , null , { defaultRowHeight : opts . sheetFormat . defaultRowHeight || "16" , baseColWidth : opts . sheetFormat . baseColWidth || "10" } ) ; if ( ws [ "!cols" ] != null && ws [ "!cols" ] . length > 0 ) o [ o . length ] = write _ws _xml _cols ( ws , ws [ "!cols" ] ) ; o [ sidx = o . length ] = "<sheetData/>" ; ws [ "!links" ] = [ ] ; if ( ws [ "!ref" ] != null ) { rdata = write _ws _xml _data ( ws , opts , idx , wb , rels ) ; if ( rdata . length > 0 ) o [ o . length ] = rdata } if ( o . length > sidx + 1 ) { o [ o . length ] = "</sheetData>" ; o [ sidx ] = o [ sidx ] . replace ( "/>" , ">" ) } if ( ws [ "!protect" ] != null ) o [ o . length ] = write _ws _xml _protection ( ws [ "!protect" ] ) ; if ( ws [ "!autofilter" ] != null ) o [ o . length ] = write _ws _xml _autofilter ( ws [ "!autofilter" ] ) ; if ( ws [ "!merges" ] != null && ws [ "!merges" ] . length > 0 ) o [ o . length ] = write _ws _xml _merges ( ws [ "!merges" ] ) ; var relc = - 1 , rel , rId = - 1 ; if ( ws [ "!links" ] . length > 0 ) { o [ o . length ] = "<hyperlinks>" ; ws [ "!links" ] . forEach ( function ( l ) { if ( ! l [ 1 ] . Target ) return ; rId = add _rels ( rels , - 1 , escapexml ( l [ 1 ] . Target ) . replace ( /#.*$/ , "" ) , RELS . HLINK ) ; rel = { ref : l [ 0 ] , "r:id" : "rId" + rId } ; if ( ( relc = l [ 1 ] . Target . indexOf ( "#" ) ) > - 1 ) rel . location = escapexml ( l [ 1 ] . Target . substr ( relc + 1 ) ) ; if ( l [ 1 ] . Tooltip ) rel . tooltip = escapexml ( l [ 1 ] . Tooltip ) ; o [ o . length ] = writextag ( "hyperlink" , null , rel ) } ) ; o [ o . length ] = "</hyperlinks>" } delete ws [ "!links" ] ; if ( ws [ "!margins" ] != null ) o [ o . length ] = write _ws _xml _margins ( ws [ "!margins" ] ) ; var hfidx = o . length ; o [ o . length ] = "" ; if ( ws [ "!drawing" ] . length > 0 ) { rId = add _rels ( rels , - 1 , "../drawings/drawing" + ( idx + 1 ) + ".xml" , RELS . DRAW ) ; ws [ "!drawing" ] . rid = rId ; o [ o . length ] = writextag ( "drawing" , null , { "r:id" : "rId" + rId } ) } else delete ws [ "!drawing" ] ; if ( ws [ "!comments" ] . length > 0 ) { rId = add _rels ( rels , - 1 , "../drawings/vmlDrawing" + ( idx + 1 ) + ".vml" , RELS . VML ) ; o [ o . length ] = writextag ( "legacyDrawing" , null , { "r:id" : "rId" + rId } ) ; ws [ "!legacy" ] = rId } if ( o . length > 2 ) { o [ o . length ] = "</worksheet>" ; o [ 1 ] = o [ 1 ] . replace ( "/>" , ">" ) } return o . join ( "" ) } function parse _BrtRowHdr ( data , length ) { var z = { } ; var tgt = data . l + length ; z . r = data . read _shift ( 4 ) ; data . l += 4 ; var miy
} function write _BrtFileVersion ( data , o ) { if ( ! o ) o = new _buf ( 127 ) ; for ( var i = 0 ; i != 4 ; ++ i ) o . write _shift ( 4 , 0 ) ; write _XLWideString ( "SheetJS" , o ) ; write _XLWideString ( XLSX . version , o ) ; write _XLWideString ( XLSX . version , o ) ; write _XLWideString ( "7262" , o ) ; o . length = o . l ; return o . length > o . l ? o . slice ( 0 , o . l ) : o } function write _BrtBookView ( idx , o ) { if ( ! o ) o = new _buf ( 29 ) ; o . write _shift ( - 4 , 0 ) ; o . write _shift ( - 4 , 460 ) ; o . write _shift ( 4 , 28800 ) ; o . write _shift ( 4 , 17600 ) ; o . write _shift ( 4 , 500 ) ; o . write _shift ( 4 , idx ) ; o . write _shift ( 4 , idx ) ; var flags = 120 ; o . write _shift ( 1 , flags ) ; return o . length > o . l ? o . slice ( 0 , o . l ) : o } function write _BOOKVIEWS ( ba , wb , opts ) { if ( ! wb . Workbook || ! wb . Workbook . Sheets ) return ; var sheets = wb . Workbook . Sheets ; var i = 0 , vistab = - 1 , hidden = - 1 ; for ( ; i < sheets . length ; ++ i ) { if ( ! sheets [ i ] || ! sheets [ i ] . Hidden && vistab == - 1 ) vistab = i ; else if ( sheets [ i ] . Hidden == 1 && hidden == - 1 ) hidden = i } if ( hidden > vistab ) return ; write _record ( ba , "BrtBeginBookViews" ) ; write _record ( ba , "BrtBookView" , write _BrtBookView ( vistab ) ) ; write _record ( ba , "BrtEndBookViews" ) } function write _BrtCalcProp ( data , o ) { if ( ! o ) o = new _buf ( 26 ) ; o . write _shift ( 4 , 0 ) ; o . write _shift ( 4 , 1 ) ; o . write _shift ( 4 , 0 ) ; write _Xnum ( 0 , o ) ; o . write _shift ( - 4 , 1023 ) ; o . write _shift ( 1 , 51 ) ; o . write _shift ( 1 , 0 ) ; return o } function write _BrtFileRecover ( data , o ) { if ( ! o ) o = new _buf ( 1 ) ; o . write _shift ( 1 , 0 ) ; return o } function write _wb _bin ( wb , opts ) { var ba = buf _array ( ) ; write _record ( ba , "BrtBeginBook" ) ; write _record ( ba , "BrtFileVersion" , write _BrtFileVersion ( ) ) ; write _record ( ba , "BrtWbProp" , write _BrtWbProp ( ) ) ; write _BOOKVIEWS ( ba , wb , opts ) ; write _BUNDLESHS ( ba , wb , opts ) ; write _record ( ba , "BrtEndBook" ) ; return ba . end ( ) } function parse _wb ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _wb _bin ( data , opts ) ; return parse _wb _xml ( data , opts ) } function parse _ws ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _ws _bin ( data , opts , rels , wb , themes , styles ) ; return parse _ws _xml ( data , opts , rels , wb , themes , styles ) } function parse _cs ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _cs _bin ( data , opts , rels , wb , themes , styles ) ; return parse _cs _xml ( data , opts , rels , wb , themes , styles ) } function parse _ms ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _ms _bin ( data , opts , rels , wb , themes , styles ) ; return parse _ms _xml ( data , opts , rels , wb , themes , styles ) } function parse _ds ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _ds _bin ( data , opts , rels , wb , themes , styles ) ; return parse _ds _xml ( data , opts , rels , wb , themes , styles ) } function parse _sty ( data , name , themes , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _sty _bin ( data , themes , opts ) ; return parse _sty _xml ( data , themes , opts ) } function parse _theme ( data , name , opts ) { return parse _theme _xml ( data , opts ) } function parse _sst ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _sst _bin ( data , opts ) ; return parse _sst _xml ( data , opts ) } function parse _cmnt ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _comments _bin ( data , opts ) ; return parse _comments _xml ( data , opts ) } function parse _cc ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _cc _bin ( data , opts ) ; return parse _cc _xml ( data , opts ) } function write _wb ( wb , name , opts ) { return ( name . slice ( - 4 ) === ".bin" ? write _wb _bin : write _wb _xml ) ( wb , opts ) } function write _ws ( data , name , opts , wb , rels ) { return ( name . slice ( - 4 ) === ".bin" ? write _ws _bin : write _ws _xml ) ( data , opts , wb , rels ) } function write _cs ( data , name , opts , wb , rels ) { return ( name . slice ( - 4 ) === ".bin" ? write _cs _bin : write _cs _xml ) ( data , opts , wb , rels ) } function write _sty ( data , name , opts ) { return ( name . slice ( - 4 ) === ".bin" ? write _sty _bin : write _sty _xml ) ( data , opts ) } function write _sst ( data , name , opts ) { return ( name . slice ( - 4 ) === ".bin" ? write _sst _bin : write _sst _xml ) ( data , opts ) } function write _cmnt ( data , name , opts ) { return ( name . slice ( - 4 ) === ".bin" ? write _comments _bin : write _comments _xml ) ( data , opts ) } var attregexg2 = /([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g ; var attregex2 = /([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/ ; var _chr = function ( c ) { return String . fromCharCode ( c ) } ; function xlml _parsexmltag ( tag , skip _root ) { var words = tag . split ( /\s+/ ) ; var z = [ ] ; if ( ! skip _root ) z [ 0 ] = words [ 0 ] ; if ( words . length === 1 ) return z ; var m = tag . match ( attregexg2 ) , y , j , w , i ; if ( m ) for ( i = 0 ; i != m . length ; ++ i ) { y = m [ i ] . ma
var temp _val ; var country ; var cell _valid = true ; var XFs = [ ] ; var palette = [ ] ; var Workbook = { Sheets : [ ] } , wsprops = { } ; var get _rgb = function getrgb ( icv ) { if ( icv < 8 ) return XLSIcv [ icv ] ; if ( icv < 64 ) return palette [ icv - 8 ] || XLSIcv [ icv ] ; return XLSIcv [ icv ] } ; var process _cell _style = function pcs ( cell , line , options ) { var xfd = line . XF . data ; if ( ! xfd || ! xfd . patternType || ! options || ! options . cellStyles ) return ; line . s = { } ; line . s . patternType = xfd . patternType ; var t ; if ( t = rgb2Hex ( get _rgb ( xfd . icvFore ) ) ) { line . s . fgColor = { rgb : t } } if ( t = rgb2Hex ( get _rgb ( xfd . icvBack ) ) ) { line . s . bgColor = { rgb : t } } } ; var addcell = function addcell ( cell , line , options ) { if ( file _depth > 1 ) return ; if ( ! cell _valid ) return ; if ( options . cellStyles && line . XF && line . XF . data ) process _cell _style ( cell , line , options ) ; lastcell = cell ; last _cell = encode _cell ( cell ) ; if ( range . s ) { if ( cell . r < range . s . r ) range . s . r = cell . r ; if ( cell . c < range . s . c ) range . s . c = cell . c } if ( range . e ) { if ( cell . r + 1 > range . e . r ) range . e . r = cell . r + 1 ; if ( cell . c + 1 > range . e . c ) range . e . c = cell . c + 1 } if ( options . cellFormula && line . f ) { for ( var afi = 0 ; afi < array _formulae . length ; ++ afi ) { if ( array _formulae [ afi ] [ 0 ] . s . c > cell . c ) continue ; if ( array _formulae [ afi ] [ 0 ] . s . r > cell . r ) continue ; if ( array _formulae [ afi ] [ 0 ] . e . c < cell . c ) continue ; if ( array _formulae [ afi ] [ 0 ] . e . r < cell . r ) continue ; line . F = encode _range ( array _formulae [ afi ] [ 0 ] ) ; if ( array _formulae [ afi ] [ 0 ] . s . c != cell . c ) delete line . f ; if ( array _formulae [ afi ] [ 0 ] . s . r != cell . r ) delete line . f ; if ( line . f ) line . f = "" + stringify _formula ( array _formulae [ afi ] [ 1 ] , range , cell , supbooks , opts ) ; break } } if ( options . sheetRows && lastcell . r >= options . sheetRows ) cell _valid = false ; else { if ( options . dense ) { if ( ! out [ cell . r ] ) out [ cell . r ] = [ ] ; out [ cell . r ] [ cell . c ] = line } else out [ last _cell ] = line } } ; var opts = { enc : false , sbcch : 0 , snames : [ ] , sharedf : shared _formulae , arrayf : array _formulae , rrtabid : [ ] , lastuser : "" , biff : 8 , codepage : 0 , winlocked : 0 , cellStyles : ! ! options && ! ! options . cellStyles , WTF : ! ! options && ! ! options . wtf } ; if ( options . password ) opts . password = options . password ; var mergecells = [ ] ; var objects = [ ] ; var colinfo = [ ] , rowinfo = [ ] ; var defwidth = 0 , defheight = 0 ; var seencol = false ; var supbooks = [ ] ; supbooks . SheetNames = opts . snames ; supbooks . sharedf = opts . sharedf ; supbooks . arrayf = opts . arrayf ; supbooks . names = [ ] ; supbooks . XTI = [ ] ; var last _Rn = "" ; var file _depth = 0 ; var BIFF2Fmt = 0 ; var BIFF2FmtTable = [ ] ; var FilterDatabases = [ ] ; var last _lbl ; opts . codepage = 1200 ; set _cp ( 1200 ) ; while ( blob . l < blob . length - 1 ) { var s = blob . l ; var RecordType = blob . read _shift ( 2 ) ; if ( RecordType === 0 && last _Rn === "EOF" ) break ; var length = blob . l === blob . length ? 0 : blob . read _shift ( 2 ) , y ; var R = XLSRecordEnum [ RecordType ] ; if ( R && R . f ) { if ( options . bookSheets ) { if ( last _Rn === "BoundSheet8" && R . n !== "BoundSheet8" ) break } last _Rn = R . n ; if ( R . r === 2 || R . r == 12 ) { var rt = blob . read _shift ( 2 ) ; length -= 2 ; if ( ! opts . enc && rt !== RecordType ) throw "rt mismatch" ; if ( R . r == 12 ) { blob . l += 10 ; length -= 10 } } var val ; if ( R . n === "EOF" ) val = R . f ( blob , length , opts ) ; else val = slurp ( R , blob , length , opts ) ; var Rn = R . n ; switch ( Rn ) { case "Date1904" : wb . opts . Date1904 = val ; break ; case "WriteProtect" : wb . opts . WriteProtect = true ; break ; case "FilePass" : if ( ! opts . enc ) blob . l = 0 ; opts . enc = val ; if ( opts . WTF ) console . error ( val ) ; if ( ! options . password ) throw new Error ( "File is password-protected" ) ; if ( val . Type !== 0 ) throw new Error ( "Encryption scheme unsupported" ) ; if ( ! val . valid ) throw new Error ( "Password is incorrect" ) ; break ; case "WriteAccess" : opts . lastuser = val ; break ; case "FileSharing" : break ; case "CodePage" : if ( val === 21010 ) val = 1200 ; else if ( val === 32769 ) val = 1252 ; opts . codepage = val ; set _cp ( val ) ; break ; case "RRTabId" : opts . rrtabid = val ; break ; case "WinProtect" : opts . winlocked = val ; break ; case "Template" : break ; case "RefreshAll" : wb . opts . RefreshAll = val ; break ; case "BookBool" : break ; case "UsesELFs" : break ; case "MTRSettings" : break ; case "CalcCount" : wb . opts . CalcCount = val ; break ; case "CalcDelta" : wb . opts . CalcDelta = val ; break ; case "CalcIter" : wb . opts . CalcIter = val ; break ; case "CalcMode" : wb . opts . CalcMode = val ; break ; case "CalcPrecision" : wb . opts . CalcPrecision = val ; break ; case "CalcSaveRecalc" : wb . opts . CalcSaveRecalc = val ; break ; case "CalcRefMode" : opts . CalcRefMode = val ; break ; case "Uncalced" : break ; case "ForceFullCalculation" : wb . opts . FullCalc = val ; break ; case "WsBool" : break ; case "XF" : XFs . push ( val ) ; break ; case "ExtSST" : break ; case "BookExt" : break ; case "RichTextStream" : break ; case "BkHim" : break ; cas
f : parsenoop } , 417 : { n : "BrtRRConflict" , f : parsenoop } , 418 : { n : "BrtRRTQSIF" , f : parsenoop } , 419 : { n : "BrtRRFormat" , f : parsenoop } , 420 : { n : "BrtRREndFormat" , f : parsenoop } , 421 : { n : "BrtRRAutoFmt" , f : parsenoop } , 422 : { n : "BrtBeginUserShViews" , f : parsenoop } , 423 : { n : "BrtBeginUserShView" , f : parsenoop } , 424 : { n : "BrtEndUserShView" , f : parsenoop } , 425 : { n : "BrtEndUserShViews" , f : parsenoop } , 426 : { n : "BrtArrFmla" , f : parse _BrtArrFmla } , 427 : { n : "BrtShrFmla" , f : parse _BrtShrFmla } , 428 : { n : "BrtTable" , f : parsenoop } , 429 : { n : "BrtBeginExtConnections" , f : parsenoop } , 430 : { n : "BrtEndExtConnections" , f : parsenoop } , 431 : { n : "BrtBeginPCDCalcMems" , f : parsenoop } , 432 : { n : "BrtEndPCDCalcMems" , f : parsenoop } , 433 : { n : "BrtBeginPCDCalcMem" , f : parsenoop } , 434 : { n : "BrtEndPCDCalcMem" , f : parsenoop } , 435 : { n : "BrtBeginPCDHGLevels" , f : parsenoop } , 436 : { n : "BrtEndPCDHGLevels" , f : parsenoop } , 437 : { n : "BrtBeginPCDHGLevel" , f : parsenoop } , 438 : { n : "BrtEndPCDHGLevel" , f : parsenoop } , 439 : { n : "BrtBeginPCDHGLGroups" , f : parsenoop } , 440 : { n : "BrtEndPCDHGLGroups" , f : parsenoop } , 441 : { n : "BrtBeginPCDHGLGroup" , f : parsenoop } , 442 : { n : "BrtEndPCDHGLGroup" , f : parsenoop } , 443 : { n : "BrtBeginPCDHGLGMembers" , f : parsenoop } , 444 : { n : "BrtEndPCDHGLGMembers" , f : parsenoop } , 445 : { n : "BrtBeginPCDHGLGMember" , f : parsenoop } , 446 : { n : "BrtEndPCDHGLGMember" , f : parsenoop } , 447 : { n : "BrtBeginQSI" , f : parsenoop } , 448 : { n : "BrtEndQSI" , f : parsenoop } , 449 : { n : "BrtBeginQSIR" , f : parsenoop } , 450 : { n : "BrtEndQSIR" , f : parsenoop } , 451 : { n : "BrtBeginDeletedNames" , f : parsenoop } , 452 : { n : "BrtEndDeletedNames" , f : parsenoop } , 453 : { n : "BrtBeginDeletedName" , f : parsenoop } , 454 : { n : "BrtEndDeletedName" , f : parsenoop } , 455 : { n : "BrtBeginQSIFs" , f : parsenoop } , 456 : { n : "BrtEndQSIFs" , f : parsenoop } , 457 : { n : "BrtBeginQSIF" , f : parsenoop } , 458 : { n : "BrtEndQSIF" , f : parsenoop } , 459 : { n : "BrtBeginAutoSortScope" , f : parsenoop } , 460 : { n : "BrtEndAutoSortScope" , f : parsenoop } , 461 : { n : "BrtBeginConditionalFormatting" , f : parsenoop } , 462 : { n : "BrtEndConditionalFormatting" , f : parsenoop } , 463 : { n : "BrtBeginCFRule" , f : parsenoop } , 464 : { n : "BrtEndCFRule" , f : parsenoop } , 465 : { n : "BrtBeginIconSet" , f : parsenoop } , 466 : { n : "BrtEndIconSet" , f : parsenoop } , 467 : { n : "BrtBeginDatabar" , f : parsenoop } , 468 : { n : "BrtEndDatabar" , f : parsenoop } , 469 : { n : "BrtBeginColorScale" , f : parsenoop } , 470 : { n : "BrtEndColorScale" , f : parsenoop } , 471 : { n : "BrtCFVO" , f : parsenoop } , 472 : { n : "BrtExternValueMeta" , f : parsenoop } , 473 : { n : "BrtBeginColorPalette" , f : parsenoop } , 474 : { n : "BrtEndColorPalette" , f : parsenoop } , 475 : { n : "BrtIndexedColor" , f : parsenoop } , 476 : { n : "BrtMargins" , f : parse _BrtMargins } , 477 : { n : "BrtPrintOptions" , f : parsenoop } , 478 : { n : "BrtPageSetup" , f : parsenoop } , 479 : { n : "BrtBeginHeaderFooter" , f : parsenoop } , 480 : { n : "BrtEndHeaderFooter" , f : parsenoop } , 481 : { n : "BrtBeginSXCrtFormat" , f : parsenoop } , 482 : { n : "BrtEndSXCrtFormat" , f : parsenoop } , 483 : { n : "BrtBeginSXCrtFormats" , f : parsenoop } , 484 : { n : "BrtEndSXCrtFormats" , f : parsenoop } , 485 : { n : "BrtWsFmtInfo" , f : parsenoop } , 486 : { n : "BrtBeginMgs" , f : parsenoop } , 487 : { n : "BrtEndMGs" , f : parsenoop } , 488 : { n : "BrtBeginMGMaps" , f : parsenoop } , 489 : { n : "BrtEndMGMaps" , f : parsenoop } , 490 : { n : "BrtBeginMG" , f : parsenoop } , 491 : { n : "BrtEndMG" , f : parsenoop } , 492 : { n : "BrtBeginMap" , f : parsenoop } , 493 : { n : "BrtEndMap" , f : parsenoop } , 494 : { n : "BrtHLink" , f : parse _BrtHLink } , 495 : { n : "BrtBeginDCon" , f : parsenoop } , 496 : { n : "BrtEndDCon" , f : parsenoop } , 497 : { n : "BrtBeginDRefs" , f : parsenoop } , 498 : { n : "BrtEndDRefs" , f : parsenoop } , 499 : { n : "BrtDRef" , f : parsenoop } , 500 : { n : "BrtBeginScenMan" , f : parsenoop } , 501 : { n : "BrtEndScenMan" , f : parsenoop } , 502 : { n : "BrtBeginSct" , f : parsenoop } , 503 : { n : "BrtEndSct" , f : parsenoop } , 504 : { n : "BrtSlc" , f : parsenoop } , 505 : { n : "BrtBeginDXFs" , f : parsenoop } , 506 : { n : "BrtEndDXFs" , f : parsenoop } , 507 : { n : "BrtDXF" , f : parsenoop } , 508 : { n : "BrtBeginTableStyles" , f : parsenoop } , 509 : { n : "BrtEndTableStyles" , f : parsenoop } , 510 : { n : "BrtBeginTableStyle" , f : parsenoop } , 511 : { n : "BrtEndTableStyle" , f : parsenoop } , 512 : { n : "BrtTableStyleElement" , f : parsenoop } , 513 : { n : "BrtTableStyleClient" , f : parsenoop } , 514 : { n : "BrtBeginVolDeps" , f : parsenoop } , 515 : { n : "BrtEndVolDeps" , f : parsenoop } , 516 : { n : "BrtBeginVolType" , f : parsenoop } , 517 : { n : "BrtEndVolType" , f : parsenoop } , 518 : { n : "BrtBeginVolMain" , f : parsenoop } , 519 : { n : "BrtEndVolMain" , f : parsenoop } , 520 : { n : "BrtBeginVolTopic" , f : parsenoop } , 521 : { n : "BrtEndVolTopic" , f : parsenoop } , 522 : { n : "BrtVolSubtopic" , f : parsenoop } , 523 : { n : "BrtVolRef" , f : parsenoop } , 524 : { n : " BrtVo
4196 : { n : "PlotGrowth" , f : parse _PlotGrowth } , 4197 : { n : "SIIndex" , f : parse _SIIndex } , 4198 : { n : "GelFrame" , f : parse _GelFrame } , 4199 : { n : "BopPopCustom" , f : parse _BopPopCustom } , 4200 : { n : "Fbi2" , f : parse _Fbi2 } , 0 : { n : "Dimensions" , f : parse _Dimensions } , 2 : { n : "BIFF2INT" , f : parse _BIFF2INT } , 5 : { n : "BoolErr" , f : parse _BoolErr } , 7 : { n : "String" , f : parse _BIFF2STRING } , 8 : { n : "BIFF2ROW" , f : parsenoop } , 11 : { n : "Index" , f : parse _Index } , 22 : { n : "ExternCount" , f : parsenoop } , 30 : { n : "BIFF2FORMAT" , f : parse _BIFF2Format } , 31 : { n : "BIFF2FMTCNT" , f : parsenoop } , 32 : { n : "BIFF2COLINFO" , f : parsenoop } , 33 : { n : "Array" , f : parse _Array } , 37 : { n : "DefaultRowHeight" , f : parse _DefaultRowHeight } , 50 : { n : "BIFF2FONTXTRA" , f : parse _BIFF2FONTXTRA } , 62 : { n : "BIFF2WINDOW2" , f : parsenoop } , 69 : { n : "BIFF2FONTCLR" , f : parsenoop } , 86 : { n : "BIFF4FMTCNT" , f : parsenoop } , 126 : { n : "RK" , f : parsenoop } , 127 : { n : "ImData" , f : parse _ImData } , 135 : { n : "Addin" , f : parsenoop } , 136 : { n : "Edg" , f : parsenoop } , 137 : { n : "Pub" , f : parsenoop } , 145 : { n : "Sub" , f : parsenoop } , 148 : { n : "LHRecord" , f : parsenoop } , 149 : { n : "LHNGraph" , f : parsenoop } , 150 : { n : "Sound" , f : parsenoop } , 169 : { n : "CoordList" , f : parsenoop } , 171 : { n : "GCW" , f : parsenoop } , 188 : { n : "ShrFmla" , f : parsenoop } , 194 : { n : "AddMenu" , f : parsenoop } , 195 : { n : "DelMenu" , f : parsenoop } , 214 : { n : "RString" , f : parse _RString } , 223 : { n : "UDDesc" , f : parsenoop } , 234 : { n : "TabIdConf" , f : parsenoop } , 354 : { n : "XL5Modify" , f : parsenoop } , 421 : { n : "FileSharing2" , f : parsenoop } , 521 : { n : "BOF" , f : parse _BOF } , 536 : { n : "Lbl" , f : parse _Lbl } , 547 : { n : "ExternName" , f : parse _ExternName } , 561 : { n : "Font" , f : parsenoop } , 1033 : { n : "BOF" , f : parse _BOF } , 2157 : { n : "FeatInfo" , f : parsenoop } , 2163 : { n : "FeatInfo11" , f : parsenoop } , 2177 : { n : "SXAddl12" , f : parsenoop } , 2240 : { n : "AutoWebPub" , f : parsenoop } , 2241 : { n : "ListObj" , f : parsenoop } , 2242 : { n : "ListField" , f : parsenoop } , 2243 : { n : "ListDV" , f : parsenoop } , 2244 : { n : "ListCondFmt" , f : parsenoop } , 2245 : { n : "ListCF" , f : parsenoop } , 2246 : { n : "FMQry" , f : parsenoop } , 2247 : { n : "FMSQry" , f : parsenoop } , 2248 : { n : "PLV" , f : parsenoop } , 2249 : { n : "LnExt" , f : parsenoop } , 2250 : { n : "MkrExt" , f : parsenoop } , 2251 : { n : "CrtCoopt" , f : parsenoop } , 67 : { n : "BIFF2XF" , f : parsenoop } , 579 : { n : "BIFF3XF" , f : parsenoop } , 1091 : { n : "BIFF4XF" , f : parsenoop } , 29282 : { } } ; function write _biff _rec ( ba , t , payload , length ) { var len = length || ( payload || [ ] ) . length ; var o = ba . next ( 4 + len ) ; o . write _shift ( 2 , t ) ; o . write _shift ( 2 , len ) ; if ( len > 0 && is _buf ( payload ) ) ba . push ( payload ) } function write _BOF ( wb , o ) { if ( o . bookType != "biff2" ) throw "unsupported BIFF version" ; var out = new _buf ( 4 ) ; out . write _shift ( 2 , 2 ) ; out . write _shift ( 2 , 16 ) ; return out } function write _BIFF2Cell ( out , r , c ) { if ( ! out ) out = new _buf ( 7 ) ; out . write _shift ( 2 , r ) ; out . write _shift ( 2 , c ) ; out . write _shift ( 1 , 0 ) ; out . write _shift ( 1 , 0 ) ; out . write _shift ( 1 , 0 ) ; return out } function write _BIFF2INT ( r , c , val ) { var out = new _buf ( 9 ) ; write _BIFF2Cell ( out , r , c ) ; out . write _shift ( 2 , val ) ; return out } function write _BIFF2NUMBER ( r , c , val ) { var out = new _buf ( 15 ) ; write _BIFF2Cell ( out , r , c ) ; out . write _shift ( 8 , val , "f" ) ; return out } function write _BIFF2BERR ( r , c , val , t ) { var out = new _buf ( 9 ) ; write _BIFF2Cell ( out , r , c ) ; if ( t == "e" ) { out . write _shift ( 1 , val ) ; out . write _shift ( 1 , 1 ) } else { out . write _shift ( 1 , val ? 1 : 0 ) ; out . write _shift ( 1 , 0 ) } return out } function write _BIFF2LABEL ( r , c , val ) { var out = new _buf ( 8 + 2 * val . length ) ; write _BIFF2Cell ( out , r , c ) ; out . write _shift ( 1 , val . length ) ; out . write _shift ( val . length , val , "sbcs" ) ; return out . l < out . length ? out . slice ( 0 , out . l ) : out } function write _ws _biff _cell ( ba , cell , R , C , opts ) { if ( cell . v != null ) switch ( cell . t ) { case "d" : case "n" : var v = cell . t == "d" ? datenum ( cell . v ) : cell . v ; if ( v == ( v | 0 ) && v >= 0 && v < 65536 ) write _biff _rec ( ba , 2 , write _BIFF2INT ( R , C , v ) ) ; else write _biff _rec ( ba , 3 , write _BIFF2NUMBER ( R , C , v ) ) ; return ; case "b" : case "e" : write _biff _rec ( ba , 5 , write _BIFF2BERR ( R , C , cell . v , cell . t ) ) ; return ; case "s" : case "str" : write _biff _rec ( ba , 4 , write _BIFF2LABEL ( R , C , cell . v ) ) ; return } write _biff _rec ( ba , 1 , write _BIFF2Cell ( null , R , C ) ) } function write _biff _ws ( ba , ws , idx , opts , wb ) { var dense = Array . isArray ( ws ) ; var range = safe _decode _range ( ws [ "!ref" ] || "A1" ) , ref , rr = "" , cols = [ ] ; for ( var R = range . s . r ; R <= range . e . r ; ++ R ) { rr = encode _row ( R ) ; for ( var C = range . s . c ; C <= range . e . c ; ++ C ) { if ( R === range . s . r ) cols [ C ] = encode _col ( C ) ; ref = cols [ C ] + rr ; var cell = dense ? ws [ R ] [ C ] : ws [ ref ] ; if ( ! cell ) continue ; write _ws _biff _cell ( ba , cell , R , C , opts ) } } } function write _biff _buf ( wb , opts ) { var o = opts || { } ; if ( DENSE != null && o . dense == null ) o . dense
styles : [ ] , calcchains : [ ] , vba : [ ] , drawings : [ ] , TODO : [ ] , xmlns : "" } ; fix _write _opts ( opts = opts || { } ) ; var zip = new jszip ; var f = "" , rId = 0 ; opts . cellXfs = [ ] ; get _cell _style ( opts . cellXfs , { } , { revssf : { General : 0 } } ) ; if ( ! wb . Props ) wb . Props = { } ; f = "docProps/core.xml" ; zip . file ( f , write _core _props ( wb . Props , opts ) ) ; ct . coreprops . push ( f ) ; add _rels ( opts . rels , 2 , f , RELS . CORE _PROPS ) ; f = "docProps/app.xml" ; if ( wb . Props && wb . Props . SheetNames ) { } else if ( ! wb . Workbook || ! wb . Workbook . Sheets ) wb . Props . SheetNames = wb . SheetNames ; else wb . Props . SheetNames = wb . SheetNames . map ( function ( x , i ) { return [ ( wb . Workbook . Sheets [ i ] || { } ) . Hidden != 2 , x ] } ) . filter ( function ( x ) { return x [ 0 ] } ) . map ( function ( x ) { return x [ 1 ] } ) ; wb . Props . Worksheets = wb . Props . SheetNames . length ; zip . file ( f , write _ext _props ( wb . Props , opts ) ) ; ct . extprops . push ( f ) ; add _rels ( opts . rels , 3 , f , RELS . EXT _PROPS ) ; if ( wb . Custprops !== wb . Props && keys ( wb . Custprops || { } ) . length > 0 ) { f = "docProps/custom.xml" ; zip . file ( f , write _cust _props ( wb . Custprops , opts ) ) ; ct . custprops . push ( f ) ; add _rels ( opts . rels , 4 , f , RELS . CUST _PROPS ) } f = "xl/workbook." + wbext ; zip . file ( f , write _wb ( wb , f , opts ) ) ; ct . workbooks . push ( f ) ; add _rels ( opts . rels , 1 , f , RELS . WB ) ; for ( rId = 1 ; rId <= wb . SheetNames . length ; ++ rId ) { var wsrels = { "!id" : { } } ; var ws = wb . Sheets [ wb . SheetNames [ rId - 1 ] ] ; var _type = ( ws || { } ) [ "!type" ] || "sheet" ; switch ( _type ) { case "chart" : default : f = "xl/worksheets/sheet" + rId + "." + wbext ; zip . file ( f , write _ws ( rId - 1 , f , opts , wb , wsrels ) ) ; ct . sheets . push ( f ) ; add _rels ( opts . wbrels , - 1 , "worksheets/sheet" + rId + "." + wbext , RELS . WS [ 0 ] ) } if ( ws ) { var comments = ws [ "!comments" ] ; if ( comments && comments . length > 0 ) { var cf = "xl/comments" + rId + "." + wbext ; zip . file ( cf , write _cmnt ( comments , cf , opts ) ) ; ct . comments . push ( cf ) ; add _rels ( wsrels , - 1 , "../comments" + rId + "." + wbext , RELS . CMNT ) } if ( ws [ "!legacy" ] ) { zip . file ( "xl/drawings/vmlDrawing" + rId + ".vml" , write _comments _vml ( rId , ws [ "!comments" ] ) ) } delete ws [ "!comments" ] ; delete ws [ "!legacy" ] } if ( wsrels [ "!id" ] . rId1 ) zip . file ( get _rels _path ( f ) , write _rels ( wsrels ) ) } if ( opts . Strings != null && opts . Strings . length > 0 ) { f = "xl/sharedStrings." + wbext ; zip . file ( f , write _sst ( opts . Strings , f , opts ) ) ; ct . strs . push ( f ) ; add _rels ( opts . wbrels , - 1 , "sharedStrings." + wbext , RELS . SST ) } f = "xl/theme/theme1.xml" ; zip . file ( f , write _theme ( wb . Themes , opts ) ) ; ct . themes . push ( f ) ; add _rels ( opts . wbrels , - 1 , "theme/theme1.xml" , RELS . THEME ) ; f = "xl/styles." + wbext ; zip . file ( f , write _sty ( wb , f , opts ) ) ; ct . styles . push ( f ) ; add _rels ( opts . wbrels , - 1 , "styles." + wbext , RELS . STY ) ; if ( wb . vbaraw && vbafmt ) { f = "xl/vbaProject.bin" ; zip . file ( f , wb . vbaraw ) ; ct . vba . push ( f ) ; add _rels ( opts . wbrels , - 1 , "vbaProject.bin" , RELS . VBA ) } zip . file ( "[Content_Types].xml" , write _ct ( ct , opts ) ) ; zip . file ( "_rels/.rels" , write _rels ( opts . rels ) ) ; zip . file ( "xl/_rels/workbook." + wbext + ".rels" , write _rels ( opts . wbrels ) ) ; delete opts . revssf ; delete opts . ssf ; return zip } function firstbyte ( f , o ) { var x = "" ; switch ( ( o || { } ) . type || "base64" ) { case "buffer" : return [ f [ 0 ] , f [ 1 ] , f [ 2 ] , f [ 3 ] ] ; case "base64" : x = Base64 . decode ( f . substr ( 0 , 24 ) ) ; break ; case "binary" : x = f ; break ; case "array" : return [ f [ 0 ] , f [ 1 ] , f [ 2 ] , f [ 3 ] ] ; default : throw new Error ( "Unrecognized type " + ( o ? o . type : "undefined" ) ) } return [ x . charCodeAt ( 0 ) , x . charCodeAt ( 1 ) , x . charCodeAt ( 2 ) , x . charCodeAt ( 3 ) ] } function read _cfb ( cfb , opts ) { if ( cfb . find ( "EncryptedPackage" ) ) return parse _xlsxcfb ( cfb , opts ) ; return parse _xlscfb ( cfb , opts ) } function read _zip ( data , opts ) { var zip , d = data ; var o = opts || { } ; if ( ! o . type ) o . type = has _buf && Buffer . isBuffer ( data ) ? "buffer" : "base64" ; switch ( o . type ) { case "base64" : zip = new jszip ( d , { base64 : true } ) ; break ; case "binary" : case "array" : zip = new jszip ( d , { base64 : false } ) ; break ; case "buffer" : zip = new jszip ( d ) ; break ; default : throw new Error ( "Unrecognized type " + o . type ) } return parse _zip ( zip , o ) } function read _utf16 ( data , o ) { var d = data ; if ( o . type == "base64" ) d = Base64 . decode ( d ) ; d = cptable . utils . decode ( 1200 , d . slice ( 2 ) ) ; o . type = "binary" ; if ( d . charCodeAt ( 0 ) == 60 ) return parse _xlml ( d , o ) ; return PRN . to _workbook ( d , o ) } function readSync ( data , opts ) { var zip , d = data , n = [ 0 ] ; var o = opts || { } ; _ssfopts = { } ; if ( o . dateNF ) _ssfopts . dateNF = o . dateNF ; if ( ! o . type ) o . type = has _buf && Buffer . isBuffer ( data ) ? "buffer" : "base64" ; if ( o . type == "file" ) { o . type = "buffer" ; d = _fs . readFileSync ( data ) } switch ( ( n = firstbyte ( d , o ) ) [ 0 ] ) { case 208 : return read _cfb ( CFB . read ( d , o ) , o ) ; case 9 : return parse _xlscfb ( s2a ( o . type === "base64" ? Ba