/*
    *
    * Wijmo Library 5.20181.436
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var l in o)o.hasOwnProperty(l)&&(e[l]=o[l])};return function(o,l){function t(){this.constructor=o}e(o,l),o.prototype=null===l?Object.create(l):(t.prototype=l.prototype,new t)}}();define(["require","exports","wijmo/wijmo.grid","wijmo/wijmo.xlsx","wijmo/wijmo","wijmo/wijmo.grid.xlsx"],function(e,o,l,t,r,n){"use strict";function s(){var e,o;return(e=window.wijmo)&&(o=e.grid)&&o.detail}function i(){var e,o;return(e=window.wijmo)&&(o=e.grid)&&o.multirow}Object.defineProperty(o,"__esModule",{value:!0});var a=n||o;window.wijmo=window.wijmo||{},window.wijmo.grid=window.wijmo.grid||{},window.wijmo.grid.xlsx=a;var d=function(){function e(){}return e.save=function(e,o,l){var t=this._saveFlexGridToWorkbook(e,o);return l&&t.save(l),t},e.saveAsync=function(e,o,l,t,r){var n=this._saveFlexGridToWorkbook(e,o);return n.saveAsync(l,t,r),n},e.load=function(e,o,l){var n=this;if(o instanceof Blob){var s=new FileReader;s.onload=function(){var o=t.Workbook._base64EncArr(new Uint8Array(s.result)),r=new t.Workbook;r.load(o),o=null,e.deferUpdate(function(){n._loadToFlexGrid(e,r,l),r=null})},s.readAsArrayBuffer(o)}else if(o instanceof t.Workbook)e.deferUpdate(function(){n._loadToFlexGrid(e,o,l),o=null});else{if(o instanceof ArrayBuffer)o=t.Workbook._base64EncArr(new Uint8Array(o));else if(!r.isString(o))throw"Invalid workbook.";var i=new t.Workbook;i.load(o),o=null,e.deferUpdate(function(){n._loadToFlexGrid(e,i,l),i=null})}},e.loadAsync=function(e,o,l,n,s){var i=this;if(o instanceof Blob){var a=new FileReader;a.onload=function(){var o=t.Workbook._base64EncArr(new Uint8Array(a.result)),r=new t.Workbook;r.loadAsync(o,function(t){o=null,r=null,e.deferUpdate(function(){i._loadToFlexGrid(e,t,l),n&&n(t),t=null})},s)},a.readAsArrayBuffer(o)}else if(o instanceof t.Workbook)e.deferUpdate(function(){i._loadToFlexGrid(e,o,l),n&&n(o),o=null});else{if(o instanceof ArrayBuffer)o=t.Workbook._base64EncArr(new Uint8Array(o));else if(!r.isString(o))throw"Invalid workbook.";(new t.Workbook).loadAsync(o,function(t){o=null,e.deferUpdate(function(){i._loadToFlexGrid(e,t,l),n&&n(t),t=null})},s)}},e._saveFlexGridToWorkbook=function(e,o){var n,s,i,a,d,u,c,f,h,p,m,w,g,b=new t.Workbook,y=new t.WorkSheet,_=(new t.WorkbookStyle,new t.WorkbookFrozenPane),x=!o||null==o.includeColumnHeaders||o.includeColumnHeaders,k=!(!o||null==o.includeRowHeaders)&&o.includeRowHeaders,C=!o||null==o.includeCellStyles||o.includeCellStyles,v=o?o.activeWorksheet:null,S=o?o.includeColumns:null,T=o?o.formatItem:null,W=0,R=0,A=0,F=0,H=[];if(null==this.hasCssText&&(this.hasCssText="cssText"in document.body.style),p=e.wj_sheetInfo,y.name=o?o.sheetName:"",y.visible=!o||!1!==o.sheetVisible,p&&p.tables&&p.tables.length>0)for(var B=0;B<p.tables.length;B++)y.tables.push(p.tables[B]);if(u=[],p||!C&&!T||((m=document.createElement("div")).style.visibility="hidden",m.setAttribute(l.FlexGrid._WJS_MEASURE,"true"),e.hostElement.appendChild(m)),k){for(f=0,c=0;c<e.rowHeaders.rows.length;c++)if(!(e.rowHeaders.rows[c].renderSize<=0)){for(u[f]=[],h=0;h<e.rowHeaders.columns.length;h++)i=e._getBindingColumn(e.rowHeaders,c,e.rowHeaders.columns[h]),a=this._getColumnSetting(i,e.columnHeaders.columns.defaultSize),u[f][h]=a,0===f&&((d=new t.WorkbookColumn)._deserialize(a),y._addWorkbookColumn(d,h));f++}F=h}if(x&&e.columnHeaders.rows.length>0){for(f=0,c=0;c<e.columnHeaders.rows.length;c++)if(!(e.columnHeaders.rows[c].renderSize<=0)){for(u[f]||(u[f]=[]),h=0;h<e.columnHeaders.columns.length;h++)i=e._getBindingColumn(e.columnHeaders,c,e.columnHeaders.columns[h]),a=this._getColumnSetting(i,e.columnHeaders.columns.defaultSize),u[f][F+h]=a,0===f&&(S&&!S(i)||((d=new t.WorkbookColumn)._deserialize(a),y._addWorkbookColumn(d)));F=0,n={},s=new t.WorkbookRow,k&&(F=this._parseFlexGridRowToSheetRow(e.topLeftCells,n,c,0,u,C,m,H,!1,0,S,T)),this._parseFlexGridRowToSheetRow(e.columnHeaders,n,c,F,u,C,m,H,!1,0,S,T),n.cells.length>0&&(s._deserialize(n),y._addWorkbookRow(s,f)),f++}R=f}else for(u[0]||(u[0]=[]),h=0;h<e.columnHeaders.columns.length;h++)i=e._getBindingColumn(e.columnHeaders,0,e.columnHeaders.columns[h]),a=this._getColumnSetting(i,e.columnHeaders.columns.defaultSize),u[0][F+h]=a,S&&!S(i)||((d=new t.WorkbookColumn)._deserialize(a),y._addWorkbookColumn(d));for(c=0;c<e.cells.rows.length;c++)F=0,n={},s=new t.WorkbookRow,(w=e.rows[c])instanceof l._NewRowTemplate||((g=w instanceof l.GroupRow)?W=r.tryCast(w,l.GroupRow).level:e.rows.maxGroupLevel>-1&&(W=e.rows.maxGroupLevel+1),k&&(F=this._parseFlexGridRowToSheetRow(e.rowHeaders,n,c,0,u,C,m,H,g,W,S,T)),this._parseFlexGridRowToSheetRow(e.cells,n,c,F,u,C,m,H,g,W,S,T),n.cells.length>0&&(s._deserialize(n),y._addWorkbookRow(s,R+c)));for(A=e.cells.rows.length,c=0;c<e.columnFooters.rows.length;c++)F=0,n={},s=new t.WorkbookRow,g=(w=e.columnFooters.rows[c])instanceof l.GroupRow,k&&(F=this._parseFlexGridRowToSheetRow(e.rowHeaders,n,c,0,u,C,m,H,g,0,S,T)),this._parseFlexGridRowToSheetRow(e.columnFooters,n,c,F,u,C,m,H,g,0,S,T),n.cells.length>0&&(s._deserialize(n),y._addWorkbookRow(s,R+A+c));return _.rows=x?e.frozenRows+R:e.frozenRows,_.columns=k?e.frozenColumns+F:e.frozenColumns,y.frozenPane=_,b._addWorkSheet(y),p||!C&&!T||(e.hostElement.removeChild(m),H.forEach(function(e){return e.forEach(function(e){e&&e.parentElement&&e.parentElement.removeChild(e)})})),b.activeWorksheet=v,b},e._loadToFlexGrid=function(e,o,n){var s,i,a,d,u,c,f,h,p,m,w,g,b,y,_,x,k,C,v,S,T,W,R,A,F,H,B,N,D,E,z,I,j,G=!n||null==n.includeColumnHeaders||n.includeColumnHeaders,L=!n||null==n.includeColumnHeaders||n.includeColumnHeaders,O=n&&null!=n.sheetIndex&&!isNaN(n.sheetIndex)?n.sheetIndex:0,M=n?n.sheetName:null,P=!n||n.sheetVisible,V=null!=e.wj_sheetInfo,U=0,X=0,q=!1,J={};if(e.itemsSource=null,e.columns.clear(),e.rows.clear(),e.frozenColumns=0,e.frozenRows=0,B={},N={},X=0,d=[],D=[],O<0||O>=o.sheets.length)throw"The sheet index option is out of the sheet range of current workbook.";if(null!=M)for(s=0;s<o.sheets.length;s++)if(M===o.sheets[s].name){g=o.sheets[s];break}if(null!=(g=g||o.sheets[O]).rows){for(G&&(X=1,g.rows.length<=1&&(L=!1,X=0),h=g.rows[0]),y=this._getColumnCount(g.rows),b=this._getRowCount(g.rows,y),v=g.summaryBelow,a=g.columns,U=0;U<y;U++)e.columns.push(new l.Column),a[U]&&(isNaN(+a[U].width)||(e.columns[U].width=+a[U].width),a[U].visible||null==a[U].visible||(e.columns[U].visible=!!a[U].visible),a[U].style&&a[U].style.wordWrap&&(e.columns[U].wordWrap=a[U].style.wordWrap));for(;X<b;X++){if(_=!1,j=null,w=g.rows[X])for(k=X+1;k<g.rows.length;){if(C=g.rows[k]){(isNaN(w.groupLevel)&&!isNaN(C.groupLevel)||!isNaN(w.groupLevel)&&w.groupLevel<C.groupLevel)&&(_=!0);break}k++}for(_&&!v?(T&&(T.isCollapsed=q),(T=new l.GroupRow).isReadOnly=!1,q=null!=w.collapsed&&w.collapsed,T.level=isNaN(w.groupLevel)?0:w.groupLevel,J[T.level]=q,this._checkParentCollapsed(J,T.level)&&T._setFlag(l.RowColFlags.ParentCollapsed,!0),e.rows.push(T)):(S=new l.Row,w&&this._checkParentCollapsed(J,w.groupLevel)&&S._setFlag(l.RowColFlags.ParentCollapsed,!0),e.rows.push(S)),w&&w.height&&!isNaN(w.height)&&(e.rows[L?X-1:X].height=w.height),U=0;U<y;U++)if(w){if(x=w.cells[U],(A=x?x.formula:null)&&"="!==A[0]&&(A="="+A),x&&x.textRuns&&x.textRuns.length>0?(e.rows[L?X-1:X].isContentHtml=!0,e.setCellData(L?X-1:X,U,this._parseTextRunsToHTML(x.textRuns))):e.setCellData(L?X-1:X,U,A&&V?A:this._getItemValue(x)),_||this._setColumn(d,U,x),F=X*y+U,H=x?x.style:null,E=t.Workbook._parseExcelFormat(x),H){if(j=null==j?!!H.wordWrap:j&&!!H.wordWrap,z=this._getItemType(x),H.hAlign)I=t.Workbook._parseHAlignToString(r.asEnum(H.hAlign,t.HAlign));else switch(z){case r.DataType.Number:I="right";break;case r.DataType.Boolean:I="center";break;default:I=E&&0===E.search(/[n,c,p]/i)?"right":"left"}B[F]={fontWeight:H.font&&H.font.bold?"bold":"none",fontStyle:H.font&&H.font.italic?"italic":"none",textDecoration:H.font&&H.font.underline?"underline":"none",textAlign:I,fontFamily:H.font&&H.font.family?H.font.family:"",fontSize:H.font&&H.font.size?H.font.size+"px":"",color:H.font&&H.font.color?H.font.color:"",backgroundColor:H.fill&&H.fill.color?H.fill.color:"",whiteSpace:H.wordWrap?"pre-wrap":"normal",format:E},H.borders&&(H.borders.left&&(this._parseBorderStyle(H.borders.left.style,"Left",B[F]),B[F].borderLeftColor=H.borders.left.color),H.borders.right&&(this._parseBorderStyle(H.borders.right.style,"Right",B[F]),B[F].borderRightColor=H.borders.right.color),H.borders.top&&(this._parseBorderStyle(H.borders.top.style,"Top",B[F]),B[F].borderTopColor=H.borders.top.color),H.borders.bottom&&(this._parseBorderStyle(H.borders.bottom.style,"Bottom",B[F]),B[F].borderBottomColor=H.borders.bottom.color)),H.font&&-1===D.indexOf(H.font.family)&&D.push(H.font.family)}if(x&&r.isNumber(x.rowSpan)&&x.rowSpan>0&&r.isNumber(x.colSpan)&&x.colSpan>0&&(x.rowSpan>1||x.colSpan>1))for(s=X;s<X+x.rowSpan;s++)for(i=U;i<U+x.colSpan;i++)N[F=s*y+i]=new l.CellRange(X,U,X+x.rowSpan-1,U+x.colSpan-1)}else e.setCellData(L?X-1:X,U,""),this._setColumn(d,U,null);w&&(this._checkParentCollapsed(J,w.groupLevel)||w.visible||null==w.visible||(e.rows[L?X-1:X].visible=w.visible),e.rows[L?X-1:X].wordWrap=!!w.style&&!!w.style.wordWrap||!!j)}for(T&&(T.isCollapsed=q),g.frozenPane&&(W=g.frozenPane.columns,r.isNumber(W)&&!isNaN(W)&&(e.frozenColumns=W),R=g.frozenPane.rows,r.isNumber(R)&&!isNaN(R)&&(e.frozenRows=L&&R>0?R-1:R)),U=0;U<e.columnHeaders.columns.length;U++)u=d[U],(c=e.columns[U]).isRequired=!1,L&&(p=h?h.cells[U]:null)&&p.value?(m=t.Workbook._parseExcelFormat(p),f=r.Globalize.format(p.value,m)):f=this._numAlpha(U),c.header=f,u&&(u.dataType===r.DataType.Boolean&&(c.dataType=u.dataType),c.format=u.format,c.align=u.hAlign,c.wordWrap=c.wordWrap||!!u.wordWrap);V&&(e.wj_sheetInfo.name=g.name,e.wj_sheetInfo.visible=!0===P||!1!==g.visible,e.wj_sheetInfo.styledCells=B,e.wj_sheetInfo.mergedRanges=N,e.wj_sheetInfo.fonts=D,e.wj_sheetInfo.tables=g.tables)}},e._parseFlexGridRowToSheetRow=function(e,o,n,a,d,c,f,h,p,m,w,g){var b,y,_,x,k,C,v,S,T,W,R,A,F,H,B,N,D,E,z,I,j,G,L,O,M,P,V,U=!1;for(E=(b=e.grid).wj_sheetInfo,G=null!=(y=e.rows[n]).recordIndex?y.recordIndex:0,o.cells||(o.cells=[]),o.visible=y.isVisible,o.height=y.renderHeight||e.rows.defaultSize,o.groupLevel=m,p&&(o.collapsed=y.isCollapsed),y.wordWrap&&(o.style={wordWrap:y.wordWrap}),(y.constructor===l.Row||y.constructor===l._NewRowTemplate||s()&&y.constructor===s().DetailRow||i()&&y.constructor===i()._MultiRow)&&(U=!0),x=0;x<e.columns.length;x++)if(k=null,D=1,N=1,V=0,j=!1,H=null,M=null,O=null,S=null,I=b._getBindingColumn(e,n,e.columns[x]),B=null,E&&e===b.cells?(F=n*e.columns.length+x,E.mergedRanges&&(B=E.mergedRanges[F]),E.styledCells&&(H=E.styledCells[F])):c&&(O=this._getMeasureCell(e,x,f,h),H=(B=b.getMergedRange(e,n,x,!1))?this._getCellStyle(e,O,B.bottomRow,B.rightCol)||{}:this._getCellStyle(e,O,n,x)||{}),B||(B=b.getMergedRange(e,n,x,!1)),B?n===B.topRow&&x===B.leftCol&&(N=B.bottomRow-B.topRow+1,D=this._getColSpan(e,B,w),j=!0):j=!0,!w||w(I)){if(_=d[G][x+a],U||p?(v=j?e.getCellData(n,x,!0):null,T=j?e.getCellData(n,x,!1):null,R=!1,v&&r.isString(v)&&v.length>1&&"="===v[0]&&(R=!0),z=r.isDate(T),H&&H.format?(k=H.format,/[hsmyt\:]/i.test(k)&&(z=!0),C=t.Workbook._parseCellFormat(H.format,z)):_&&_.style&&_.style.format?(k=I.format,C=_.style.format):C=null,C||(z?C="m/d/yyyy":r.isNumber(T)&&!I.dataMap?C=r.isInt(T)?"#,##0":"#,##0.00":R?(A=v.toLowerCase()).indexOf("now()")>-1?(C="m/d/yyyy h:mm",z=!0):A.indexOf("today()")>-1||A.indexOf("date(")>-1?(C="m/d/yyyy",z=!0):A.indexOf("time(")>-1&&(C="h:mm AM/PM",z=!0):C="General")):(v=j?b.columnHeaders.getCellData(0,x,!0):null,C="General"),r.isString(v)&&-1!==v.indexOf("<span")&&(S=this._parseToTextRuns(v),v=null),M=this._parseCellStyle(H)||{},e===b.cells&&p&&y.hasChildren&&x===b.columns.firstVisibleIndex){if(v?W=v:j&&(W=y.getGroupHeader().replace(/<\/?\w+>/g,"").replace(/&#39;/g,"'")),null==W&&!H)continue;!(z=r.isDate(W))&&k&&"d"===k.toLowerCase()&&r.isInt(W)&&(C="0"),W=r.isString(W)?t.Workbook._unescapeXML(W):W,x===b.columns.firstVisibleIndex&&b.treeIndent&&(V=m),L={value:W,isDate:z,formula:R?this._parseToExcelFormula(v,z):null,colSpan:D,rowSpan:N,style:this._extend(M,{format:C,font:{bold:!0},hAlign:t.HAlign.Left,indent:V}),textRuns:S}}else v=r.isString(v)?t.Workbook._unescapeXML(v):v,T=r.isString(T)?t.Workbook._unescapeXML(T):T,!z&&k&&"d"===k.toLowerCase()&&r.isInt(T)&&(C="0"),P=M&&M.hAlign?M.hAlign:_&&_.style&&null!=_.style.hAlign?r.asEnum(_.style.hAlign,t.HAlign,!0):r.isDate(T)?t.HAlign.Left:t.HAlign.General,x!==b.columns.firstVisibleIndex||!b.treeIndent||P!==t.HAlign.Left&&P!==t.HAlign.General||(V=m),L={value:R?null:"General"===C?v:T,isDate:z,formula:R?this._parseToExcelFormula(v,z):null,colSpan:x<b.columns.firstVisibleIndex?1:D,rowSpan:N,style:this._extend(M,{format:C,hAlign:P,vAlign:N>1?e===b.cells||!1===b.centerHeadersVertically?t.VAlign.Top:t.VAlign.Center:null,indent:V}),textRuns:S};g&&g(new u(e,new l.CellRange(n,x),O,f,h,L)),o.cells.push(L)}return a+x},e._parseCellStyle=function(e,o){if(void 0===o&&(o=!1),null==e)return null;var l=e.fontSize;l=l?+l.substring(0,l.indexOf("px")):null,isNaN(l)&&(l=null);var r=e.fontWeight;r="bold"===r||+r>=700;var n="italic"===e.fontStyle,s=e.textDecorationStyle;null==s&&(s=e.textDecoration),s="underline"===s;var i=e.whiteSpace;return i=!!i&&i.indexOf("pre")>-1,{font:{bold:r,italic:n,underline:s,family:this._parseToExcelFontFamily(e.fontFamily),size:l,color:e.color},fill:{color:e.backgroundColor},borders:this._parseBorder(e,o),hAlign:t.Workbook._parseStringToHAlign(e.textAlign),wordWrap:i}},e._parseBorder=function(e,o){var l={};return l.left=this._parseEgdeBorder(e,"Left"),l.right=this._parseEgdeBorder(e,"Right"),l.top=this._parseEgdeBorder(e,"Top"),l.bottom=this._parseEgdeBorder(e,"Bottom"),o&&(l.vertical=this._parseEgdeBorder(e,"Vertical"),l.horizontal=this._parseEgdeBorder(e,"Horizontal")),l},e._parseEgdeBorder=function(e,o){var l,r=e["border"+o+"Style"],n=e["border"+o+"Width"];if(n&&n.length>2&&(n=+n.substring(0,n.length-2)),r&&"none"!==r&&"hidden"!==r){switch(l={},r=r.toLowerCase()){case"dotted":l.style=n>1?t.BorderStyle.MediumDashDotted:t.BorderStyle.Dotted;break;case"dashed":l.style=n>1?t.BorderStyle.MediumDashed:t.BorderStyle.Dashed;break;case"double":l.style=t.BorderStyle.Double;break;default:l.style=n>2?t.BorderStyle.Thick:n>1?t.BorderStyle.Medium:t.BorderStyle.Thin}l.color=e["border"+o+"Color"]}return l},e._parseBorderStyle=function(e,o,l){var r="border"+o+"Style",n="border"+o+"Width";switch(e){case t.BorderStyle.Dotted:case t.BorderStyle.Hair:l[r]="dotted",l[n]="1px";break;case t.BorderStyle.Dashed:case t.BorderStyle.ThinDashDotDotted:case t.BorderStyle.ThinDashDotted:l[r]="dashed",l[n]="1px";break;case t.BorderStyle.MediumDashed:case t.BorderStyle.MediumDashDotDotted:case t.BorderStyle.MediumDashDotted:case t.BorderStyle.SlantedMediumDashDotted:l[r]="dashed",l[n]="2px";break;case t.BorderStyle.Double:l[r]="double",l[n]="3px";break;case t.BorderStyle.Medium:l[r]="solid",l[n]="2px";break;default:l[r]="solid",l[n]="1px"}},e._parseToExcelFontFamily=function(e){var o;return e&&(o=e.split(","))&&o.length>0&&(e=o[0].replace(/\"|\'/g,"")),e},e._parseToExcelFormula=function(e,o){var l,r,n,s,i,a,d,u=/(floor|ceiling)\([+-]?\d+\.?\d*\)/gi,c=/text\(\"?\w+\"?\s*\,\s*\"\w+\"\)/gi,f=/\"?\w+\"?\s*\,\s*\"(\w+)\"/i;if(l=e.match(u))for(i=0;i<l.length;i++)d=(a=l[i]).substring(0,a.lastIndexOf(")"))+", 1)",e=e.replace(a,d);if(l=null,l=e.match(c))for(i=0;i<l.length;i++)(r=(a=l[i]).match(f))&&2===r.length&&(n=r[1],/^d{1,4}?$/.test(n)||(s=t.Workbook._parseCellFormat(n,o),d=a.replace(n,s),e=e.replace(a,d)));return e},e._parseToTextRuns=function(e){var o,l,t,r=e.split("<span "),n=[];for(o=0;o<r.length;o++)t=-1!==(l=r[o]).indexOf("</span>")?{text:l.substring(l.indexOf(">")+1,l.indexOf("</span>")),font:this._parseToTextRunFont(l.substring(l.indexOf('style="')+7,l.indexOf(';"')))}:{text:l},n.push(t);return n},e._parseToTextRunFont=function(e){var o,l,t,r,n,s,i,a,d,u=e.split(";");if(u.length>0){for(o=0;o<u.length;o++)if(2===(l=u[o].split(":")).length)switch(l[1]=l[1].trim(),l[0]){case"font-size":s=+l[1].substring(0,l[1].indexOf("px")),isNaN(s)&&(s=null);break;case"font-weight":t="bold"===l[1]||+l[1]>=700;break;case"font-style":r="italic"===l[1];break;case"text-decoration-style":case"text-decoration":n="underline"===l[1];break;case"font-family":i=this._parseToExcelFontFamily(l[1]);break;case"color":a=l[1]}d={bold:t,italic:r,underline:n,family:i,size:s,color:a}}return d},e._getMeasureCell=function(e,o,l,t){var r=t[e.cellType],n=r&&r[o],s=null==n;if(n){if(this.hasCssText){n.style;n.style.cssText="",n.style.visibility="hidden"}}else r||(t[e.cellType]=r=[]),r[o]=n=l.cloneNode();return!s&&n.parentElement||(e.hostElement.children.length>0?e.hostElement.children[0].appendChild(n):e.hostElement.appendChild(n)),n},e._getColumnSetting=function(e,o){var l=e.renderWidth;return l=l||o,{autoWidth:!0,width:l,visible:e.visible,style:{format:e.format?t.Workbook._parseCellFormat(e.format,e.dataType===r.DataType.Date):"",hAlign:t.Workbook._parseStringToHAlign(this._toExcelHAlign(e.getAlignment())),wordWrap:e.wordWrap}}},e._toExcelHAlign=function(e){return(e=e?e.trim().toLowerCase():e)?e.indexOf("center")>-1?"center":e.indexOf("right")>-1||e.indexOf("end")>-1?"right":e.indexOf("justify")>-1?"justify":"left":e},e._getColumnCount=function(e){for(var o,l=0,t=0,n=0;n<e.length;n++)(o=e[n]&&e[n].cells?e[n].cells:[])&&o.length>0&&(t=o.length,r.isInt(o[t-1].colSpan)&&o[t-1].colSpan>1&&(t=t+o[t-1].colSpan-1),t>l&&(l=t));return l},e._getRowCount=function(e,o){for(var l,t,n,s=e.length,i=s-1,a=0;a<o;a++)e:for(;i>=0;i--)if(l=e[i],t=l&&l.cells?l.cells:[],(n=t[a])&&(null!=n.value&&""!==n.value||r.isInt(n.rowSpan)&&n.rowSpan>1)){r.isInt(n.rowSpan)&&n.rowSpan>1&&i+n.rowSpan>s&&(s=i+n.rowSpan);break e}return s},e._numAlpha=function(e){var o=Math.floor(e/26)-1;return(o>-1?this._numAlpha(o):"")+String.fromCharCode(65+e%26)},e._getItemType=function(e){return null==e||null==e.value||isNaN(e.value)?null:r.getType(e.value)},e._setColumn=function(e,o,l){var n,s,i,a=e[o];a?(n=this._getItemType(l),a.dataType!==n&&a.dataType===r.DataType.Boolean&&n!==r.DataType.Boolean&&(a.dataType=n),l&&null!=l.value&&""!==l.value&&(s=t.Workbook._parseExcelFormat(l))&&a.format!==s&&"General"!==s&&(a.format=s),l&&l.style&&(l.style.hAlign&&(i=t.Workbook._parseHAlignToString(r.asEnum(l.style.hAlign,t.HAlign))),null==a.wordWrap?a.wordWrap=!!l.style.wordWrap:a.wordWrap=a.wordWrap&&!!l.style.wordWrap),i||n!==r.DataType.Number||(i="right"),a.hAlign=i):e[o]={dataType:this._getItemType(l),format:t.Workbook._parseExcelFormat(l),hAlign:"",wordWrap:null}},e._getItemValue=function(e){if(null==e||null==e.value)return null;var o=e.value;return r.isNumber(o)&&isNaN(o)?"":o instanceof Date&&isNaN(o.getTime())?"":o},e._getCellStyle=function(e,o,l,t){try{e.grid.cellFactory.updateCell(e,l,t,o),o.className=o.className.replace("wj-state-selected",""),o.className=o.className.replace("wj-state-multi-selected","")}catch(e){return null}return window.getComputedStyle(o)},e._parseTextRunsToHTML=function(e){var o,l,t,r;for(t="",r=0;r<e.length;r++)t+=(l=(o=e[r]).font)?'<span style="'+(l.bold?"font-weight: bold;":"")+(l.italic?"font-style: italic;":"")+(l.underline?"text-decoration: underline;":"")+(l.family?"font-family: "+l.family+";":"")+(null!=l.size?"font-size: "+l.size+"px;":"")+(l.color?"color: "+l.color+";":"")+'">'+o.text+"</span>":o.text;return t},e._extend=function(e,o){for(var l in o){var t=o[l];r.isObject(t)&&e[l]?r.copy(e[l],t):e[l]=t}return e},e._checkParentCollapsed=function(e,o){var l=!1;return Object.keys(e).forEach(function(t){!0===e[t]&&!1===l&&!isNaN(o)&&+t<o&&(l=!0)}),l},e._getColSpan=function(e,o,l){for(var t=0,r=o.leftCol;r<=o.rightCol;r++)l&&!l(e.columns[r])||t++;return t},e}();o.FlexGridXlsxConverter=d;var u=function(e){function o(o,l,t,r,n,s){var i=e.call(this,o,l)||this;return i._cell=t,i._patternCell=r,i._xlsxCell=s,i._cellsCache=n,i}return __extends(o,e),Object.defineProperty(o.prototype,"cell",{get:function(){return this._cell},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"xlsxCell",{get:function(){return this._xlsxCell},set:function(e){this._xlsxCell=e},enumerable:!0,configurable:!0}),o.prototype.getFormattedCell=function(){return this._cell||(this._cell=d._getMeasureCell(this.panel,this.col,this._patternCell,this._cellsCache),d._getCellStyle(this.panel,this._cell,this.row,this.col)),this._cell},o}(l.CellRangeEventArgs);o.XlsxFormatItemEventArgs=u});