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