@mescius/wijmo.grid.pdf 5.20232.939

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015-esm.js ADDED
@@ -0,0 +1,14 @@
1
+ /*!
2
+ *
3
+ * Wijmo Library 5.20232.939
4
+ * https://developer.mescius.com/wijmo
5
+ *
6
+ * Copyright(c) MESCIUS inc. All rights reserved.
7
+ *
8
+ * Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
9
+ * us.sales@mescius.com
10
+ * https://developer.mescius.com/wijmo/licensing
11
+ *
12
+ */
13
+
14
+ import{asFunction,asType,CancelEventArgs,Color,isFunction,Rect,Size,isObject,assert,asInt,asString,changeType,isArray,isString,DataType,Point,_getModule,removeChild,toPlainText,clamp,EventArgs,_registerModule}from"@mescius/wijmo";import*as pdf from"@mescius/wijmo.pdf";import*as selfModule from"@mescius/wijmo.grid.pdf";export function softGrid(){return _getModule("wijmo.grid")}export function softDetail(){return _getModule("wijmo.grid.detail")}export function softMultiRow(){return _getModule("wijmo.grid.multirow")}export function softSheet(){return _getModule("wijmo.grid.sheet")}export function softOlap(){return _getModule("wijmo.olap")}export function softTransposed(){return _getModule("wijmo.grid.transposed")}export function softTransposedMultiRow(){return _getModule("wijmo.grid.transposedmultirow")}export var ScaleMode;!function(e){e[e.ActualSize=0]="ActualSize";e[e.PageWidth=1]="PageWidth";e[e.SinglePage=2]="SinglePage"}(ScaleMode||(ScaleMode={}));export var ExportMode;!function(e){e[e.All=0]="All";e[e.Selection=1]="Selection"}(ExportMode||(ExportMode={}));export var _CellType;!function(e){e[e.None=0]="None";e[e.Cell=1]="Cell";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.TopLeft=4]="TopLeft";e[e.ColumnFooter=5]="ColumnFooter";e[e.BottomLeft=6]="BottomLeft"}(_CellType||(_CellType={}));export function _merge(e,t,r=!1){!e&&t&&(e={});if(t&&e)for(var o in t){var l=t[o],i=e[o];if(isObject(l)){if(void 0===i||!isObject(i)&&r){if(isFunction(l.clone)){e[o]=i=l.clone();continue}e[o]=i={}}isObject(i)&&_merge(e[o],l,r)}else(void 0===i||r&&void 0!==l)&&(e[o]=l)}return e}export function _combineColumns(e,t){return{aggregate:t.aggregate,binding:t.binding,name:t.name,dataType:t.dataType,wordWrap:t.wordWrap,multiLine:t.multiLine,getAlignment:e=>{if("getAlignment"in t)return t.getAlignment(e)},index:e.index,visibleIndex:e.visibleIndex,isVisible:e.isVisible,renderWidth:e.renderWidth}}export function _cloneStyle(e){if(!e)return null;var t={},toCamel=e=>e.replace(/\-([a-z])/g,(e,t,r)=>r>0?t.toUpperCase():t);for(let r=0,o=e.length;r<o;r++){let o=e[r];t[toCamel(o)]=e.getPropertyValue(o)}return t}export class PdfFormatItemEventArgs extends CancelEventArgs{constructor(e,t,r,o,l,i,s,n,a){super();this.cancelBorders=!1;this._p=e;this._rng=t;"undefined"!=typeof HTMLElement&&(this._cell=asType(r,HTMLElement,!0));this._canvas=o;this._clientRect=l;this._contentRect=i;this._style=s;this._getFormattedCell=n;this._getTextRect=a}get panel(){return this._p}get range(){return this._rng.clone()}get row(){return this._rng.row}get col(){return this._rng.col}get data(){return this._data}set data(e){this._data=e}get canvas(){return this._canvas}get cell(){return this._cell}get clientRect(){return this._clientRect}get contentRect(){return this._contentRect}drawBackground(e){let t=this.clientRect;e&&t.width>0&&t.height>0&&this.canvas.paths.rect(t.left,t.top,t.width,t.height).fill(e||this.style.backgroundColor)}getFormattedCell(){return asFunction(this._getFormattedCell)()}get tagContent(){return this._tagContent}set tagContent(e){this._tagContent=e}get style(){return this._style}get textTop(){!this._textRect&&isFunction(this._getTextRect)&&(this._textRect=this._getTextRect());return this._textRect?this._textRect.top:this._contentRect.top}}export class _FlexGridPdfCoreConverter{static draw(e,t,r,o,l,i){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The doc argument cannot be null.");null==(i=this._applyDefaultDrawSettings(i)).scaleMode&&(i.scaleMode=null==o?ScaleMode.ActualSize:null==l?ScaleMode.PageWidth:ScaleMode.SinglePage);this._drawInternal(e,t,r,o,l,i)}static _applyDefaultDrawSettings(e){return _merge(_merge({},e),_FlexGridPdfCoreConverter.DefaultDrawSettings)}static _drawInternal(e,t,r,o,l,i){var s=null!=r,n=new Size(t.width,t.height);r||(r=new Point(0,t.y));isArray(i.embeddedFonts)&&i.embeddedFonts.forEach(e=>{t.registerFont(e)});var a=this._getRowsToRender(e,i),d=new FlexGridRenderer(e,i,a,this.BorderWidth,!0),h=new Rect(r.x||0,r.y||0,o||n.width,l||n.height),g=this._getScaleFactor(d,i.scaleMode,h);if(r.y>0&&this._canBreakRows(i.scaleMode)){var c=a.find(e.cells,e=>d.isRenderableRow(e));if(c){var u=(h.height-h.top)*(1/g);if((d.showColumnHeader?pdf.pxToPt(e.columnHeaders.height):0)+pdf.pxToPt(c.renderHeight)-this.BorderWidth>u){t.addPage();h=new Rect(r.x||0,0,o||n.width,l||n.height)}}}var p=this._getPages(d,a,h,i,s,g),f=(i.progress?this._getCellsCount(e,i,p):0)/i._progressMax,w=0,_=0,C=i.progress?()=>{if(++w-_>=50){_=w;i.progress(w/f)}}:null;i.progress&&i.progress(0);for(var m=0;m<p.length;m++){m>0&&t.addPage();var R=p[m],x=0===R.pageCol?h.left:0,b=0===R.pageRow?h.top:0;t.saveState();t.paths.rect(0,0,t._widthCtm,t._heightCtm).clip();t.scale(g,g,new Point(x,b));t.translate(x,b);var S=new FlexGridRenderer(e,i,R.range,this.BorderWidth,m===p.length-1);S.render(t,C);t.restoreState();t.x=x;t.y=b+S.renderSize.height*g}i.progress&&0<i._progressMax&&i.progress(i._progressMax)}static _getCellsCount(e,t,r){for(var o=0,l=0;l<r.length;l++){o+=new FlexGridRenderer(e,t,r[l].range,0,!1).getCellsCount()}return o}static _getRowsToRender(e,t){var r=[];t.exportMode==ExportMode.All?r.push(new _CellRange(0,0,e.rows.length-1,e.columns.length-1)):r=e.getSelection();var o=new RowRange(r);if(o.isValid&&!t.drawDetailRows){var l=[];o.forEach(e.cells,(t,r,o)=>{if(!e.isDetailRow(t)){var i=l.length;i&&l[i-1].bottomRow+1===o?l[i-1].row2++:l.push(new _CellRange(o,r.col,o,r.col2))}});o=new RowRange(l)}return o}static _getScaleFactor(e,t,r){var o=1;if(t==ScaleMode.ActualSize)return o;var l=e.renderSize;if(t==ScaleMode.SinglePage){(i=Math.min(r.width/l.width,r.height/l.height))<1&&(o=i)}else{var i;(i=r.width/l.width)<1&&(o=i)}return o}static _canBreakRows(e){return e==ScaleMode.ActualSize||e==ScaleMode.PageWidth}static _getPages(e,t,r,o,l,i){let s=[],n=[],a=pdf.pxToPt,d=e.flex,h=e.showColumnHeader,g=e.showColumnFooter,c=e.showRowHeader,u=h?a(d.columnHeaders.height):0,p=g?a(d.columnFooters.height):0,f=c?a(d.rowHeaders.width):0,w=this._canBreakRows(o.scaleMode),_=o.scaleMode==ScaleMode.ActualSize,C=(r.width-r.left)*(1/i),m=(r.height-r.top)*(1/i),R=r.width*(1/i),x=r.height*(1/i),b=u,S=f,T=l&&o.scaleMode==ScaleMode.ActualSize,y=m;if(w){let r=0,o=0;t.forEach(d.cells,(t,l,i,n)=>{y=s.length?x:m;if(e.isRenderableRow(t)){let e=a(t.renderHeight);r++;b+=e;(h||r>1)&&(b-=this.BorderWidth);if(b>y){if(T||u+e>y&&0===o){s.push(n);b=u}else{s.push(n-1);b=u+e}o=0;h&&(b-=this.BorderWidth)}else o++}})}let v=Math.max(t.length()-1,0);s.length&&s[s.length-1]===v||s.push(v);g&&b+p>y&&s.push(-1);if(_){let r=0;for(let o=t.leftCol;o<=t.rightCol;o++){let t=d.columns[o];if(e.isRenderableColumn(t)){let e=a(t.renderWidth),l=n.length?R:C;r++;S+=e;(c||r>1)&&(S-=this.BorderWidth);if(S>l){if(f+e>l||T){n.push(o);S=f}else{n.push(o-1);S=f+e}c&&(S-=this.BorderWidth)}}}}n.length&&n[n.length-1]===t.rightCol||n.push(t.rightCol);let P=[],G=!1,M=1,F=l&&o.maxPages>0?1:o.maxPages;for(let e=0;e<s.length&&!G;e++)for(let r=0;r<n.length&&!G;r++,M++)if(!(G=M>F)){let o=0===e?0:s[e-1]+1,l=0===r?t.leftCol:n[r-1]+1,i=-1===s[e]?new RowRange([new _CellRange(-1,l,-1,n[r])]):t.subrange(o,s[e]-o+1,l,n[r]);P.push(new PdfPageRowRange(i,r,e))}return P}}_FlexGridPdfCoreConverter.BorderWidth=1;_FlexGridPdfCoreConverter.DefFont=new pdf.PdfFont;_FlexGridPdfCoreConverter.DefaultDrawSettings={customCellContent:!1,drawDetailRows:!1,exportMode:ExportMode.All,maxPages:Number.MAX_VALUE,repeatMergedValuesAcrossPages:!0,recalculateStarWidths:!0,styles:{cellStyle:{font:{family:_FlexGridPdfCoreConverter.DefFont.family,size:_FlexGridPdfCoreConverter.DefFont.size,style:_FlexGridPdfCoreConverter.DefFont.style,weight:_FlexGridPdfCoreConverter.DefFont.weight},padding:1.5,verticalAlign:"middle"},headerCellStyle:{font:{weight:"bold"}}},quickCellStyles:!0,_progressMax:1};class FlexGridRenderer{constructor(e,t,r,o,l){this._flex=e;this._borderWidth=o;this._lastPage=l;this._settings=t||{};this._topLeft=new PanelSectionRenderer(this,e.topLeftCells,this.showRowHeader&&this.showColumnHeader?new RowRange([new _CellRange(0,0,e.topLeftCells.rows.length-1,e.topLeftCells.columns.length-1)]):new RowRange([]),o);this._rowHeader=new PanelSectionRenderer(this,e.rowHeaders,this.showRowHeader?r.clone(0,e.rowHeaders.columns.length-1):new RowRange([]),o);this._columnHeader=new PanelSectionRenderer(this,e.columnHeaders,this.showColumnHeader?new RowRange([new _CellRange(0,r.leftCol,e.columnHeaders.rows.length-1,r.rightCol)]):new RowRange([]),o);this._cells=new PanelSectionRenderer(this,e.cells,r,o);this._bottomLeft=new PanelSectionRenderer(this,e.bottomLeftCells,this.showRowHeader&&this.showColumnFooter?new RowRange([new _CellRange(0,0,e.bottomLeftCells.rows.length-1,e.bottomLeftCells.columns.length-1)]):new RowRange([]),o);this._columnFooter=new PanelSectionRenderer(this,e.columnFooters,this.showColumnFooter?new RowRange([new _CellRange(0,r.leftCol,e.columnFooters.rows.length-1,r.rightCol)]):new RowRange([]),o)}get settings(){return this._settings}isRenderableRow(e){return this._flex.isRenderableRow(e)}isRenderableColumn(e){return this._flex.isRenderableColumn(e)}getCellsCount(){return this._topLeft.getCellsCount()+this._rowHeader.getCellsCount()+this._columnHeader.getCellsCount()+this._cells.getCellsCount()+this._bottomLeft.getCellsCount()+this._columnFooter.getCellsCount()}render(e,t){let r,o,l,i;if(e.tagged){r=o=l=i=new TrStructCache(e,e.tag(pdf.PdfTagType.Table));e.addTag(r.el);if(e.version>=pdf.PdfVersion.v1_5){r.el.add((o=new TrStructCache(e,e.tag(pdf.PdfTagType.THead))).el);r.el.add((l=new TrStructCache(e,e.tag(pdf.PdfTagType.TBody))).el);r.el.add((i=new TrStructCache(e,e.tag(pdf.PdfTagType.TFoot))).el)}}let s=Math.max(0,Math.max(this._topLeft.renderSize.width,this._rowHeader.renderSize.width)-this._borderWidth),n=Math.max(0,Math.max(this._topLeft.renderSize.height,this._columnHeader.renderSize.height)-this._borderWidth);this._topLeft.render(e,0,0,t,o);this._rowHeader.render(e,0,n,t,l);this._columnHeader.render(e,s,0,t,o);this._cells.render(e,s,n,t,l);n+=Math.max(0,this._cells.renderSize.height-this._borderWidth);this._bottomLeft.render(e,0,n,t,i);this._columnFooter.render(e,s,n,t,i)}get flex(){return this._flex}get renderSize(){var e=Math.max(this._topLeft.renderSize.height,this._columnHeader.renderSize.height)+Math.max(this._rowHeader.renderSize.height,this._cells.renderSize.height)+Math.max(this._bottomLeft.renderSize.height,this._columnFooter.renderSize.height),t=Math.max(this._topLeft.renderSize.width,this._rowHeader.renderSize.width)+Math.max(this._columnHeader.renderSize.width,this._cells.renderSize.width);this._columnHeader.renderableRowsCount>0&&(e-=this._borderWidth);this._columnFooter.renderableRowsCount>0&&(e-=this._borderWidth);this._rowHeader.renderableColumnsCount>0&&(t-=this._borderWidth);return new Size(t,e)}get showColumnHeader(){return this._flex.showColumnHeader}get showRowHeader(){return this._flex.showRowHeader}get showColumnFooter(){return this._lastPage&&this._flex.showColumnFooter}alignMergedTextToTheTopRow(e){return this._flex.alignMergedTextToTheTopRow(e)}getColumn(e,t,r){return this._flex.getColumn(e,t,r)}isAlternatingRow(e){return this._flex.isAlternatingRow(e)}isGroupRow(e){return this._flex.isGroupRow(e)}isNewRow(e){return this._flex.isNewRow(e)}isExpandableGroupRow(e){return this._flex.isExpandableGroupRow(e)}isBooleanCell(e,t,r){return this._flex.isBooleanCell(e,t,r)}getCellStyle(e,t,r){return this._flex.getCellStyle(e,t,r)}}class PanelSection{constructor(e,t,r){this._flex=e;this._panel=t;this._range=r.clone()}get renderableRowsCount(){if(null==this._renderableRowsCnt){this._renderableRowsCnt=0;this._range.forEach(this._panel,e=>{this._flex.isRenderableRow(e)&&this._renderableRowsCnt++})}return this._renderableRowsCnt}get renderableColumnsCount(){if(null==this._renderableColumnsCnt){this._renderableColumnsCnt=0;if(this._range.isValid)for(var e=this._range.leftCol;e<=this._range.rightCol;e++)this._flex.isRenderableColumn(this._panel.columns[e])&&this._renderableColumnsCnt++}return this._renderableColumnsCnt}get size(){if(null==this._size){var e=this._range.getRenderSize(this._flex,this._panel);this._size=new Size(pdf.pxToPt(e.width),pdf.pxToPt(e.height))}return this._size}get range(){return this._range}get panel(){return this._panel}}class PanelSectionRenderer extends PanelSection{constructor(e,t,r,o){super(e.flex,t,r);this._gr=e;this._borderWidth=o}get gr(){return this._gr}get renderSize(){if(null==this._renderSize){this._renderSize=this.size.clone();this.renderableColumnsCount>1&&(this._renderSize.width-=this._borderWidth*(this.renderableColumnsCount-1));this.renderableRowsCount>1&&(this._renderSize.height-=this._borderWidth*(this.renderableRowsCount-1))}return this._renderSize}_getRangeWidth(e,t){for(var r=0,o=0,l=this.panel,i=e;i<=t;i++){var s=l.columns[i];if(this._gr.isRenderableColumn(s)){o++;r+=s.renderWidth}}r=pdf.pxToPt(r);o>1&&(r-=this._borderWidth*(o-1));return r}_getRangeHeight(e,t){for(var r=0,o=0,l=this.panel,i=e;i<=t;i++){var s=l.rows[i];if(this._gr.isRenderableRow(s)){o++;r+=s.renderHeight}}r=pdf.pxToPt(r);o>1&&(r-=this._borderWidth*(o-1));return r}getCellsCount(){var e=0,t=this.range,r=this.panel,o=new GetMergedRangeProxy(this._gr.flex);if(!t.isValid)return e;t.forEach(r,(l,i,s)=>{if(this._gr.isRenderableRow(l))for(var n=t.leftCol;n<=t.rightCol;n++)if(this._gr.isRenderableColumn(r.columns[n])){var a=!1,d=void 0,h=o.getMergedRange(r,s,n);if(h){let e=s===h.firstVisibleRow,r=n===h.leftCol,o=s===i.topRow,l=n===i.leftCol,g=h.rowSpan>1,c=h.columnSpan>1;if(g&&c&&(e&&r||o&&l)||g&&!c&&(e||o)||!g&&c&&(r||l)){a=!0;c&&(d=Math.min(t.rightCol,h.rightCol))}}else a=!0;a&&e++;d&&(n=d)}});return e}render(e,t,r,o,l){var i=this.range;if(i.isValid){for(var s={},n=this.panel,a=new GetMergedRangeProxy(this._gr.flex),d=new _CellRangeExt(n,0,0,0,0),h=new _CellRenderer(this,e,this._borderWidth),g=i.leftCol;g<=i.rightCol;g++)s[g]=r;i.forEach(n,(r,g,c)=>{if(this._gr.isRenderableRow(r))for(var u=l?l.getTR(c,n.cellType):null,p=t,f=i.leftCol;f<=i.rightCol;f++){var w=this.gr.getColumn(n,c,f);if(this._gr.isRenderableColumn(w)){var _,C=void 0,m=void 0,R=!1,x=void 0,b=this._gr.flex.getCellContent(this.panel,r,w,f),S=a.getMergedRange(n,c,f);if(S){if(c>=S.topRow){d.copyFrom(S);let e=c===S.firstVisibleRow,t=f===S.leftCol,r=c===g.topRow,o=f===g.leftCol,l=S.rowSpan>1,n=S.columnSpan>1;if(l&&n&&(e&&t||r&&o)||l&&!n&&(e||r)||!l&&n&&(t||o)){R=!0;_=e&&t||this.gr.settings.repeatMergedValuesAcrossPages?b:"";C=l?this._getRangeHeight(c,Math.min(S.bottomRow,g.bottomRow)):this._getRangeHeight(c,c);if(n){m=this._getRangeWidth(Math.max(i.leftCol,S.leftCol),Math.min(i.rightCol,S.rightCol));x=Math.min(i.rightCol,S.rightCol);for(var T=f+1;T<=x;T++)s[T]+=C-this._borderWidth}}}else C=this._getRangeHeight(c,c);null==m&&(m=this._getRangeWidth(f,f))}else{d.setRange(c,f,c,f);R=!0;_=b;C=this._getRangeHeight(c,c);m=this._getRangeWidth(f,f)}if(R&&m>0&&C>0){let t=h.renderCell(_,r,w,d,new Rect(p,s[f],m,C));if(u){let r=e.tag(n.cellType===_CellType.ColumnHeader||n.cellType==_CellType.TopLeft?pdf.PdfTagType.TH:pdf.PdfTagType.TD);t&&r.add(t);u.add(r)}o&&o()}C&&(s[f]+=C-this._borderWidth);m&&(p+=m-this._borderWidth);x&&(f=x)}}})}}}class TrStructCache{constructor(e,t){this.doc=e;this.tableSection=t;this._trh=[];this._trb=[];this._trf=[]}get el(){return this.tableSection}getTR(e,t){let r=t===_CellType.TopLeft||t===_CellType.ColumnHeader?this._trh:t===_CellType.RowHeader||t===_CellType.Cell?this._trb:this._trf,o=r[e];o||this.tableSection.add(r[e]=o=this.doc.tag(pdf.PdfTagType.TR));return o}}export class _CellRenderer{constructor(e,t,r){this.InvisiblePen=new pdf.PdfPen(Color.fromRgba(0,0,0,0),0);this._pr=e;this._area=t;this._borderWidth=r}renderCell(e,t,r,o,l){var i,s=this._pr.gr.flex,n=this._pr.panel,getGridCell=e=>s.getCell(n,o.topRow,o.leftCol,e),a=null,d=this._pr.gr.getCellStyle(n,t,r),h=this._pr.gr.settings.customCellContent,g=isFunction(this._pr.gr.settings.formatItem);if(h){var c=s.getComputedStyle(n,a=getGridCell(g));d.color=c.color;d.backgroundColor=c.backgroundColor;var u=s.getComputedDefBorderColor();d.borderLeftColor="none"!=c.borderLeftStyle?c.borderLeftColor:u;d.borderRightColor="none"!=c.borderRightStyle?c.borderRightColor:u;d.borderTopColor="none"!=c.borderTopStyle?c.borderTopColor:u;d.borderBottomColor="none"!=c.borderBottomStyle?c.borderBottomColor:u;d.font=new pdf.PdfFont(c.fontFamily,pdf._asPt(c.fontSize,!0,void 0),c.fontStyle,c.fontWeight);d.textAlign=c.textAlign}if(d.font&&!(d.font instanceof pdf.PdfFont)){let e=d.font;d.font=new pdf.PdfFont(e.family,e.size,e.style,e.weight)}d.boxSizing="border-box";d.borderWidth=this._borderWidth;d.borderStyle="solid";h||this._pr.gr.isExpandableGroupRow(t)&&0===r.visibleIndex||(d.textAlign=r.getAlignment(t));if(n.cellType===_CellType.Cell&&s.rows.maxGroupLevel>=0&&o.leftCol===s.columns.firstVisibleIndex){var p=s.isGroupRow(t)?Math.max(t.level,0):s.rows.maxGroupLevel+1,f=pdf._asPt(d.paddingLeft||d.padding),w=pdf.pxToPt(p*s.treeIndent);d.paddingLeft=f+w}var _=this._measureCell(e,n,t,r,d,l);let C,m=o.rowSpan>1&&o.visibleRowsCount>1&&this._pr.gr.alignMergedTextToTheTopRow(n)?new Rect(_.contentRect.left,_.contentRect.top,_.contentRect.width,_.contentRect.height/(o.visibleRowsCount||1)):_.contentRect,R=!0,x=!0;if(g){(i=new PdfFormatItemEventArgs(n,o,a,this._area,_.rect,_.contentRect,d,()=>a||getGridCell(!0),()=>_.textRect=this._calculateTextRect(e,n,t,r,m,d))).data=e;this._pr.gr.settings.formatItem(i);if(i.data!==e){e=asString(i.data);_.textRect=null}R=!i.cancel;x=!i.cancelBorders;C=i.tagContent}R&&!_.textRect&&(_.textRect=this._calculateTextRect(e,n,t,r,m,d));return this._renderCell(e,t,r,o,_,d,R,x,null==C)||C}_renderCell(e,t,r,o,l,i,s,n,a){if(!s&&!n)return;let d,h=this._area.document.tagged,g=this._area.document;h&&g.beginArtifact({type:pdf.PdfArtifactType.Layout});this._renderEmptyCell(l,i,s,n);h&&g.endArtifact();if(s){a=!0===h&&!0===a;let o;if(this._isBooleanCellAndValue(e,this._pr.panel,t,r)){if(a){d=g.tag(pdf.PdfTagType.Span,null,{actual:e.toString()});o=g.beginTagContent(pdf.PdfTagType.Span)}this._renderBooleanCell(e,l,i)}else{if(a){d=g.tag(pdf.PdfTagType.P);o=g.beginTagContent(pdf.PdfTagType.P)}this._renderTextCell(e,l,i)}if(a){g.endTagContent();d.add(o)}}return d}_isBooleanCellAndValue(e,t,r,o){return this._pr.gr.isBooleanCell(t,r,o)&&this._isBoolean(e)}_isBoolean(e){var t=isString(e)&&e.toLowerCase();return"true"===t||"false"===t||!0===e||!1===e}_measureCell(e,t,r,o,l,i){this._decompositeStyle(l);var s=i.left,n=i.top,a=i.height,d=i.width,h=this._parseBorder(l),g=h.left.width,c=h.top.width,u=h.bottom.width,p=h.right.width,f=this._parsePadding(l),w=0,_=0,C=0,m=0;if("content-box"===l.boxSizing||void 0===l.boxSizing){w=f.top+a+f.bottom;_=f.left+d+f.right;C=a;m=d}else{if("border-box"!==l.boxSizing)throw"Invalid value: "+l.boxSizing;if(pdf._IE&&l instanceof CSSStyleDeclaration){w=f.top+f.bottom+a;_=f.left+f.right+d}else{w=Math.max(a-c-u,0);_=Math.max(d-g-p,0)}C=Math.max(w-f.top-f.bottom,0);m=Math.max(_-f.left-f.right,0)}return{rect:i=new Rect(s,n,d,a),clientRect:new Rect(s+g,n+c,_,w),contentRect:new Rect(s+g+f.left,n+c+f.top,m,C),textRect:null}}_decompositeStyle(e){if(e){var t;if(t=e.borderColor){e.borderLeftColor||(e.borderLeftColor=t);e.borderRightColor||(e.borderRightColor=t);e.borderTopColor||(e.borderTopColor=t);e.borderBottomColor||(e.borderBottomColor=t)}if(t=e.borderWidth){e.borderLeftWidth||(e.borderLeftWidth=t);e.borderRightWidth||(e.borderRightWidth=t);e.borderTopWidth||(e.borderTopWidth=t);e.borderBottomWidth||(e.borderBottomWidth=t)}if(t=e.borderStyle){e.borderLeftStyle||(e.borderLeftStyle=t);e.borderRightStyle||(e.borderRightStyle=t);e.borderTopStyle||(e.borderTopStyle=t);e.borderBottomStyle||(e.borderBottomStyle=t)}if(t=e.padding){e.paddingLeft||(e.paddingLeft=t);e.paddingRight||(e.paddingRight=t);e.paddingTop||(e.paddingTop=t);e.paddingBottom||(e.paddingBottom=t)}}}_parseBorder(e){var t={left:{width:0},top:{width:0},bottom:{width:0},right:{width:0}};"none"!==e.borderLeftStyle&&(t.left={width:pdf._asPt(e.borderLeftWidth),style:e.borderLeftStyle,color:e.borderLeftColor});"none"!==e.borderTopStyle&&(t.top={width:pdf._asPt(e.borderTopWidth),style:e.borderTopStyle,color:e.borderTopColor});"none"!==e.borderBottomStyle&&(t.bottom={width:pdf._asPt(e.borderBottomWidth),style:e.borderBottomStyle,color:e.borderBottomColor});"none"!==e.borderRightStyle&&(t.right={width:pdf._asPt(e.borderRightWidth),style:e.borderRightStyle,color:e.borderRightColor});return t}_parsePadding(e){return{left:pdf._asPt(e.paddingLeft),top:pdf._asPt(e.paddingTop),bottom:pdf._asPt(e.paddingBottom),right:pdf._asPt(e.paddingRight)}}_renderEmptyCell(e,t,r,o){var l=e.rect.left,i=e.rect.top,s=e.clientRect.width,n=e.clientRect.height,a=e.clientRect.left-e.rect.left,d=e.clientRect.top-e.rect.top,h=e.rect.top+e.rect.height-(e.clientRect.top+e.clientRect.height),g=e.rect.left+e.rect.width-(e.clientRect.left+e.clientRect.width);r=r&&t.backgroundColor&&s>0&&n>0;if(o&&(a||g||h||d)){var c=t.borderLeftColor||t.borderColor,u=t.borderRightColor||t.borderColor,p=t.borderTopColor||t.borderColor,f=t.borderBottomColor||t.borderColor;if(a&&d&&h&&g&&a===g&&a===h&&a===d&&c===u&&c===f&&c===p){var w=a,_=w/2,C=this._area.paths.rect(l+_,i+_,s+w,n+w);if(r){C.fillAndStroke(t.backgroundColor,new pdf.PdfPen(c,w));return}C.stroke(new pdf.PdfPen(c,w))}else{a&&this._area.paths.polygon([[l,i],[l+a,i+d],[l+a,i+d+n],[l,i+d+n+h]]).fill(c);d&&this._area.paths.polygon([[l,i],[l+a,i+d],[l+a+s,i+d],[l+a+s+g,i]]).fill(p);g&&this._area.paths.polygon([[l+a+s+g,i],[l+a+s,i+d],[l+a+s,i+d+n],[l+a+s+g,i+d+n+h]]).fill(u);h&&this._area.paths.polygon([[l,i+d+n+h],[l+a,i+d+n],[l+a+s,i+d+n],[l+a+s+g,i+d+n+h]]).fill(f)}}r&&this._area.paths.rect(e.clientRect.left,e.clientRect.top,e.clientRect.width,e.clientRect.height).fillAndStroke(t.backgroundColor,this.InvisiblePen)}_renderBooleanCell(e,t,r){if(!(!t.textRect||t.textRect.height<=0||t.textRect.width<=0)){var o=t.textRect.left,l=t.textRect.top,i=t.textRect.height;this._area.paths.rect(o,l,i,i).fillAndStroke(Color.fromRgba(255,255,255),new pdf.PdfPen(void 0,.5));if(!0===changeType(e,DataType.Boolean,"")){var s=i/20,n=i-.5-2*s,a=i/8;this._area.document.saveState();this._area.translate(o+.25+s,l+.25+s).paths.moveTo(a/2,.6*n).lineTo(n-.6*n,n-a).lineTo(n-a/2,a/2).stroke(new pdf.PdfPen(void 0,a));this._area.document.restoreState()}}}_renderTextCell(e,t,r){!e||!t.textRect||t.textRect.height<=0||t.textRect.width<=0||this._area.drawText(e,t.textRect.left,t.textRect.top,{brush:r.color,font:r.font,height:t.textRect.height,width:t.textRect.width,align:"center"===r.textAlign?pdf.PdfTextHorizontalAlign.Center:"right"===r.textAlign?pdf.PdfTextHorizontalAlign.Right:"justify"===r.textAlign?pdf.PdfTextHorizontalAlign.Justify:pdf.PdfTextHorizontalAlign.Left})}_calculateTextRect(e,t,r,o,l,i){if(null!=e&&!isString(e))return null;var s=l.clone();if(this._isBooleanCellAndValue(e,t,r,o)){var n=this._getTextLineHeight(i.font);switch(i.verticalAlign){case"middle":s.top=l.top+l.height/2-n/2;break;case"bottom":s.top=l.top+l.height-n}switch(i.textAlign){case"justify":case"center":s.left=l.left+l.width/2-n/2;break;case"right":s.left=l.left+l.width-n}s.height=s.width=n}else if(s.height>0&&s.width>0)switch(i.verticalAlign){case"bottom":if((d=this._area.measureText(e,i.font,{height:s.height,width:s.width})).size.height<s.height){var a=(h=this._area.document._document).currentLineHeight(!0)-h.currentLineHeight(!1);s.top+=s.height-d.size.height-a;s.height=d.size.height}break;case"middle":var d;if((d=this._area.measureText(e,i.font,{height:s.height,width:s.width})).size.height<s.height){var h;a=(h=this._area.document._document).currentLineHeight(!0)-h.currentLineHeight(!1);s.top+=s.height/2-(d.size.height-a)/2;s.height=d.size.height}}return s}_getTextLineHeight(e){return this._area.lineHeight(e)}}class GetMergedRangeProxy{constructor(e){this._columns={};this._flex=e}getMergedRange(e,t,r){let o=this._columns[r];if(o&&t>=o.topRow&&t<=o.bottomRow)return o;{let o=this._flex.getMergedRange(e,t,r),l=e.columns,i=e.rows;if(o&&!o.isSingleCell&&(!l[o.col].isVisible||!l[o.col2].isVisible||!i[o.row].isVisible||!i[o.row2].isVisible)){o=o.clone();for(;o.col<o.col2&&!l[o.col].isVisible;)o.col++;for(;o.col2>o.col&&!l[o.col2].isVisible;)o.col2--;for(;o.row<o.row2&&!i[o.row].isVisible;)o.row++;for(;o.row2>o.row&&!i[o.row2].isVisible;)o.row2--}o&&o.isSingleCell&&(o=null);return this._columns[r]=o?new _CellRangeExt(e,o):null}}}export class _CellRange{constructor(e,t,r,o){if("number"==typeof e){this._row=e;this._col=t;this._row2=r;this._col2=o}else{this._row=e.row;this._col=e.col;this._row2=e.row2;this._col2=e.col2}(this._row<0||this._row2<0)&&(this._row=this._row2=-1);(this._col<0||this._col2<0)&&(this._col=this._col2=-1)}get row(){return this._row}set row(e){this._row=e}get col(){return this._col}set col(e){this._col=e}get row2(){return this._row2}set row2(e){this._row2=e}get col2(){return this._col2}set col2(e){this._col2=e}get topRow(){return Math.min(this._row,this._row2)}get bottomRow(){return Math.max(this._row,this._row2)}get leftCol(){return Math.min(this._col,this._col2)}get rightCol(){return Math.max(this._col,this._col2)}get columnSpan(){return Math.abs(this._col2-this._col)+1}get rowSpan(){return Math.abs(this._row2-this._row)+1}get isValid(){return this._row>-1&&this._col>-1&&this._row2>-1&&this._col2>-1}get isSingleCell(){return this._row===this._row2&&this._col===this._col2}copyFrom(e){this.setRange(e.row,e.col,e.row2,e.col2)}clone(){return new _CellRange(this._row,this._col,this._row2,this._col2)}getRenderSize(e,t){let r=new Size(0,0);if(this.isValid){for(let o=this.topRow;o<=this.bottomRow;o++){let l=t.rows[o];e.isRenderableRow(l)&&(r.height+=l.renderHeight)}for(let o=this.leftCol;o<=this.rightCol;o++){let l=t.columns[o];e.isRenderableColumn(l)&&(r.width+=l.renderWidth)}}return r}setRange(e=-1,t=-1,r=e,o=t){this._row=asInt(e);this._col=asInt(t);this._row2=asInt(r);this._col2=asInt(o)}}export class _CellRangeExt extends _CellRange{constructor(e,t,r,o,l){super(t,r,o,l);this.firstVisibleRow=-1;this.visibleRowsCount=0;if(e){var i=this.topRow,s=this.bottomRow,n=e.rows.length;if(n>0)for(var a=i;a<=s&&a<n;a++)if(e.rows[a].isVisible){this.firstVisibleRow<0&&(this.firstVisibleRow=a);this.visibleRowsCount++}}}copyFrom(e){super.copyFrom(e);this.firstVisibleRow=e.firstVisibleRow;this.visibleRowsCount=e.visibleRowsCount}clone(){return new _CellRangeExt(null,this.row,this.col,this.row2,this.col2)}}class RowRange{constructor(e){this._ranges=e||[]}length(){for(var e=0,t=0;t<this._ranges.length;t++){var r=this._ranges[t];r.isValid&&(e+=r.bottomRow-r.topRow+1)}return e}get isValid(){return this._ranges.length&&this._ranges[0].isValid}get leftCol(){return this._ranges.length?this._ranges[0].leftCol:-1}get rightCol(){return this._ranges.length?this._ranges[0].rightCol:-1}clone(e,t){for(var r=[],o=0;o<this._ranges.length;o++){var l=this._ranges[o].clone();arguments.length>0&&(l.col=e);arguments.length>1&&(l.col2=t);r.push(l)}return new RowRange(r)}getRenderSize(e,t){for(var r=new Size(0,0),o=0;o<this._ranges.length;o++){var l=this._ranges[o].getRenderSize(e,t);r.width=Math.max(r.width,l.width);r.height+=l.height}return r}find(e,t){var r=null;this.forEach(e,e=>{if(!0===t(e)){r=e;return!1}});return r}forEach(e,t){for(var r=0,o=!1,l=0;l<this._ranges.length&&!o;l++){var i=this._ranges[l];if(i.isValid)for(var s=i.topRow;s<=i.bottomRow&&!o;s++)o=!1===t(e.rows[s],i,s,r++)}}subrange(e,t,r,o){var l=[];if(e>=0&&t>0)for(var i=0,s=0,n=0;n<this._ranges.length&&t>0;n++,i=s+1){var a=this._ranges[n];if(!(e>(s=i+(a.bottomRow-a.topRow)))){var d=e>i?a.topRow+(e-i):a.topRow,h=Math.min(a.bottomRow,d+t-1),g=arguments.length>2?r:a.leftCol,c=arguments.length>2?o:a.rightCol;l.push(new _CellRange(d,g,h,c));t-=h-d+1}}return new RowRange(l)}}class PdfPageRowRange{constructor(e,t,r){this._col=t;this._row=r;this._range=e}get range(){return this._range}get pageCol(){return this._col}get pageRow(){return this._row}}var _fc;const FAKE_CELL="wj-pdf-fake-cell";function getFakeCell(e){if(!_fc){(_fc=document.createElement("div")).setAttribute(FAKE_CELL,"true");softGrid()&&_fc.setAttribute(softGrid().FlexGrid._WJS_MEASURE,"true")}let t=_fc.style;t.cssText="";t.position="absolute";t.overflow="hidden";t.width="1px";t.height="1px";t.clipPath="inset(100%)";t.clip="rect(0 0 0 0)";let r=e.hostElement,o=r.children.length?r.children[0]:r;_fc.parentNode!==o&&o.appendChild(_fc);return _fc}export function _removeFakeCell(){if(_fc){removeChild(_fc);_fc=null}}export class FlexGridPdfConverter{static draw(e,t,r,o,l){this.drawToPosition(e,t,null,r,o,l)}static drawToPosition(e,t,r,o,l,i){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The doc argument cannot be null.");let s,n=softGrid()&&e instanceof softGrid().FlexGrid,a=e;try{i=_FlexGridPdfCoreConverter._applyDefaultDrawSettings(i);let d=e;if(n){if(i&&i.recalculateStarWidths){s=a.columns.getTotalSize();a.columns._updateStarSizes(pdf.ptToPx(t.width))}d=this._getFlexGridAdapter(a,i)}_FlexGridPdfCoreConverter.draw(d,t,r,o,l,i)}finally{_removeFakeCell();n&&i&&i.recalculateStarWidths&&a.columns._updateStarSizes(s)}}static export(e,t,r){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The fileName argument cannot be empty.");var o=(r=this._applyDefaultExportSettings(r)).documentOptions.ended;r.documentOptions.ended=(e,i)=>{r.progress&&r.progress(1);o&&!1===o.apply(l,[e,i])||pdf.saveBlob(i.blob,t);e.dispose()};var l=new pdf.PdfDocument(r.documentOptions);this.drawToPosition(e,l,null,null,null,r);l.end()}static _getFlexGridAdapter(e,t){return new(softMultiRow()&&e instanceof softMultiRow().MultiRow&&MultiRowAdapter||softSheet()&&e instanceof softSheet().FlexSheet&&FlexSheetAdapter||softOlap()&&e instanceof softOlap().PivotGrid&&PivotGridAdapter||softTransposed()&&e instanceof softTransposed().TransposedGrid&&_TransposedGridAdapter||softTransposedMultiRow()&&e instanceof softTransposedMultiRow().TransposedMultiRow&&TransposedMultiRowAdapter||FlexGridAdapter)(e,t)}static _applyDefaultExportSettings(e){return _merge(_merge({},e),this._DefaultExportSettings)}}FlexGridPdfConverter._DefaultExportSettings=_merge({scaleMode:ScaleMode.PageWidth,documentOptions:{compress:!1,pageSettings:{margins:{left:36,right:36,top:18,bottom:18}}},_progressMax:.9},_FlexGridPdfCoreConverter.DefaultDrawSettings);class FlexGridAdapter{constructor(e,t){this._defBorderColor=null;this._flex=e;this._settings=t;t.quickCellStyles&&(this._styleCache=new StyleCache(500))}get flex(){return this._flex}get settings(){return this._settings}get columns(){return this._flex.columns}get rows(){return this._flex.rows}get bottomLeftCells(){return this._flex.bottomLeftCells}get cells(){return this._flex.cells}get columnFooters(){return this._flex.columnFooters}get columnHeaders(){return this._flex.columnHeaders}get rowHeaders(){return this._flex.rowHeaders}get topLeftCells(){return this._flex.topLeftCells}get treeIndent(){return this._flex.treeIndent}getSelection(){var e=[],t=this._flex.selection,r=softGrid();switch(this._flex.selectionMode){case r.SelectionMode.None:break;case r.SelectionMode.Cell:case r.SelectionMode.CellRange:e.push(new _CellRange(t.row,t.col,t.row2,t.col2));break;case r.SelectionMode.Row:e.push(new _CellRange(t.topRow,0,t.topRow,this._flex.cells.columns.length-1));break;case r.SelectionMode.RowRange:e.push(new _CellRange(t.topRow,0,t.bottomRow,this._flex.cells.columns.length-1));break;case r.SelectionMode.ListBox:for(var o=-1,l=0;l<this._flex.rows.length;l++){if(this._flex.rows[l].isSelected){o<0&&(o=l);l===this._flex.rows.length-1&&e.push(new _CellRange(o,0,l,this._flex.cells.columns.length-1))}else{o>=0&&e.push(new _CellRange(o,0,l-1,this._flex.cells.columns.length-1));o=-1}}}return e}getCell(e,t,r,o){var l=e.getCellElement(t,r);if(!l){l=getFakeCell(e);this._flex.cellFactory.updateCell(e,t,r,l,null,o)}return l}getComputedDefBorderColor(){if(null==this._defBorderColor){let e=window.getComputedStyle(this._flex.hostElement);this._defBorderColor="none"!=e.borderRightStyle?e.borderRightColor:"none"!=e.borderBottomStyle?e.borderBottomColor:"none"!=e.borderLeftStyle?e.borderLeftColor:"none"!=e.borderTopStyle?e.borderTopColor:"rgba(0,0,0,0.2)"}return this._defBorderColor}getComputedStyle(e,t){let r,o=null==t.getAttribute(FAKE_CELL),l=t.className,i=l.indexOf("wj-state-selected")>=0||l.indexOf("wj-state-multi-selected")>=0;i&&(t.className=l.replace("wj-state-selected","").replace("wj-state-multi-selected",""));if(this._styleCache){let o=e.hostElement,l=t.style.cssText.split(/;\s+/).filter(e=>{var t=e.substring(0,e.indexOf(":"));return/^(color|background-color|border-color|border-left-color|border-right-color|border-top-color|border-bottom-color|font|textAlign)/i.test(t)}).join(";"),i=t;do{l=i.className+l}while(i!==o&&(i=i.parentElement));if(!(r=this._styleCache.getValue(l))){r=window.getComputedStyle(t);r=this._styleCache.add(l,r)}}else r=_cloneStyle(window.getComputedStyle(t));o&&i&&(t.className=l);return r}getMergedRange(e,t,r){let o=this._flex.getMergedRange(e,t,r,!1);return o?new _CellRange(o.row,o.col,o.row2,o.col2):null}get showColumnHeader(){return!!(this._flex.headersVisibility&softGrid().HeadersVisibility.Column)}get showRowHeader(){return!!(this._flex.headersVisibility&softGrid().HeadersVisibility.Row)}get showColumnFooter(){return this._flex.columnFooters.rows.length>0}alignMergedTextToTheTopRow(e){return!1}getCellData(e,t,r){return e.getCellData(t,r,!0)}getCellContent(e,t,r,o){let l,i=softGrid();if(this.settings.customCellContent){let i=this.getCell(e,t.index,o,!0);!(l=(l=i.innerText.trim()).replace(/\r/gm,"").replace(/\n+/gm,"\n"))&&this.isBooleanCell(e,t,r)&&(l=null==(l=this._extractCheckboxValue(i))?"":l+"")}else{let s=r.isContentHtml;l=this.getCellData(e,t.index,o);if(this.isGroupRow(t)&&e.cellType===i.CellType.Cell&&r.index===e.columns.firstVisibleIndex){s=!0;l||(l=t.getGroupHeader())}s&&(l=toPlainText(l).trim())}return l}isBooleanCell(e,t,r){return r.dataType===DataType.Boolean&&e.cellType===softGrid().CellType.Cell&&(!this.isExpandableGroupRow(t)||r.visibleIndex>0)}getColumn(e,t,r){return e.columns[r]}isAlternatingRow(e){let t=!1,r=this._flex.alternatingRowStep;if(r){t=e.visibleIndex%(r+1)==0;1==r&&(t=!t)}return t}isGroupRow(e){return e instanceof softGrid().GroupRow}isNewRow(e){return e instanceof softGrid()._NewRowTemplate}isDetailRow(e){return softDetail()&&e instanceof softDetail().DetailRow}isExpandableGroupRow(e){return e instanceof softGrid().GroupRow&&e.hasChildren}isRenderableRow(e){return e.isVisible&&e.renderHeight>0&&!this.isNewRow(e)}isRenderableColumn(e){return e.isVisible&&e.renderWidth>0}getCellStyle(e,t,r){var o=this.settings.styles,l=_merge({},o.cellStyle),i=this._flex,s=softGrid();switch(e.cellType){case s.CellType.Cell:this.isExpandableGroupRow(t)?_merge(l,o.groupCellStyle,!0):this.isAlternatingRow(t)&&_merge(l,o.altCellStyle,!0);break;case s.CellType.ColumnHeader:case s.CellType.RowHeader:case s.CellType.TopLeft:case s.CellType.BottomLeft:_merge(l,o.headerCellStyle,!0);break;case s.CellType.ColumnFooter:_merge(l,o.headerCellStyle,!0);_merge(l,o.footerCellStyle,!0)}!this.settings.customCellContent&&i._getShowErrors()&&i._getError(e,t.index,r.index)&&_merge(l,o.errorCellStyle,!0);return l}_extractCheckboxValue(e){var t=e.querySelector("input[type=checkbox]");if(t&&"none"!==t.style.display&&"hidden"!==t.style.visibility)return t.checked}}class FlexSheetAdapter extends FlexGridAdapter{getCellData(e,t,r){return e.cellType===softGrid().CellType.Cell?e.rows[t]instanceof softSheet().HeaderRow?this.flex.columnHeaders.getCellData(t,r,!0):this.flex.getCellValue(t,r,!0):super.getCellData(e,t,r)}getCellStyle(e,t,r){var o=super.getCellStyle(e,t,r),l=this.flex.selectedSheet.findTable(t.index,r.index);if(l){var i=l.getRange(),s=t.index-i.topRow,n=r.index-i.leftCol,a=l._getTableCellAppliedStyles(s,n);a&&(a.font=new pdf.PdfFont(a.fontFamily,pdf._asPt(a.fontSize,!0,void 0),a.fontStyle,a.fontWeight));_merge(o,a,!0)}return o}get showColumnHeader(){return!1}get showRowHeader(){return!1}get showColumnFooter(){return!1}}class MultiRowAdapter extends FlexGridAdapter{getColumn(e,t,r){return _combineColumns(super.getColumn(e,t,r),this.flex.getBindingColumn(e,t,r))}isAlternatingRow(e){if(e instanceof softMultiRow()._MultiRow){let t=!1,r=this.flex.alternatingRowStep;if(r){t=e.dataIndex%(r+1)==0;1==r&&(t=!t)}return t}return super.isAlternatingRow(e)}}class PivotGridAdapter extends FlexGridAdapter{alignMergedTextToTheTopRow(e){let t=softGrid();return!this.flex.centerHeadersVertically&&(e.cellType===t.CellType.ColumnHeader||e.cellType===t.CellType.RowHeader)}}class _TransposedGridAdapter extends FlexGridAdapter{getColumn(e,t,r){let o=super.getColumn(e,t,r);if(e.cellType!=softGrid().CellType.Cell)return o;{let r=e.grid._getBindingColumn(e,t,o);return r?_combineColumns(o,r):o}}}class TransposedMultiRowAdapter extends FlexGridAdapter{getColumn(e,t,r){let o=super.getColumn(e,t,r);if(e.cellType!=softGrid().CellType.Cell)return o;{let l=this.flex.getBindingColumn(e,t,r);return l?_combineColumns(o,l):o}}}class StyleCache{constructor(e){this._cache={};this._size=0;this._max=e}add(e,t){this._size>=this._max&&this.clear();let r=this._cache[e]=_cloneStyle(t);this._size++;return r}clear(){this._cache={};this._size=0}getValue(e){return this._cache[e]||null}hasKey(e){return!!this._cache[e]}}var PdfWebWorkerResponseStatus;!function(e){e[e.Done=1]="Done";e[e.Progress=2]="Progress"}(PdfWebWorkerResponseStatus||(PdfWebWorkerResponseStatus={}));const DefGridName="";export class PdfWebWorkerExportDoneEventArgs extends EventArgs{constructor(e){super();this._buf=e}get blob(){this._blob||(this._blob=new Blob([new Uint8Array(this._buf)],{type:"application/pdf"}));return this._blob}get buffer(){return this._buf}}export class PdfWebWorkerClient{static exportGrid(e,t,r,o,l,i){(o=FlexGridPdfConverter._applyDefaultExportSettings(o)).progress=o.progress||i;this.addGrid(e,t,DefGridName,o);this.export(e,o.documentOptions,e=>{isFunction(l)&&!1===l(e)||pdf.saveBlob(e.blob,r)},i)}static export(e,t,r,o){e.addEventListener("message",(function handler(t){let l=t.data;switch(l.status){case PdfWebWorkerResponseStatus.Done:e.removeEventListener("message",handler);isFunction(r)&&r(new PdfWebWorkerExportDoneEventArgs(l.data));break;case PdfWebWorkerResponseStatus.Progress:o&&o(l.data);break;default:throw`Unknown status: ${l.status}`}}));let l=this._clientDataToArrayBuffer(e);e.postMessage({content:l,settings:t},[l]);this._clearClientData(e)}static addGrid(e,t,r,o){let l=this._gridToJson(t,o);this._addClientData(e,JSON.stringify(l),r,o,!0)}static addImage(e,t,r,o){let l=isString(t)&&t.indexOf("data:image/svg")>=0?t:pdf._PdfImageHelper.getDataUri(t);this._addClientData(e,l,r,o)}static addString(e,t,r){this._addClientData(e,t,r,null)}static serializeGrid(e,t){let r=this._gridToJson(e,t);return strToBuf(JSON.stringify(r))}static _addClientData(e,t,r,o,l=!1){asType(e,Worker);asString(r);asString(t,!0);let i=e;i.clientData=i.clientData||{};i.clientData[r]={content:t,settings:o?JSON.stringify(o):null};var s=i.clientData[r];if(l){s.isGrid=!0;s.progressMessaging=!!o&&isFunction(o.progress)}}static _clearClientData(e){delete e.clientData}static _clientDataToArrayBuffer(e){let t=e;return strToBuf(JSON.stringify(t.clientData||{}))}static _gridToJson(e,t){t=FlexGridPdfConverter._applyDefaultExportSettings(t);let r,o;try{r=new pdf.PdfDocument(t.documentOptions);if(t&&t.recalculateStarWidths){o=e.columns.getTotalSize();e.columns._updateStarSizes(pdf.ptToPx(r.width))}return this._getJsonConverter(e,t).convert()}finally{_removeFakeCell();t&&t.recalculateStarWidths&&e.columns._updateStarSizes(o);if(null!=r){r.dispose();r=null}}}static _getJsonConverter(e,t){return new(softMultiRow()&&e instanceof softMultiRow().MultiRow&&MultiRowJsonConverter||softOlap()&&e instanceof softOlap().PivotGrid&&PivotGridJsonConverter||softTransposed()&&e instanceof softTransposed().TransposedGrid&&TransposedGridJsonConverter||softTransposedMultiRow()&&e instanceof softTransposedMultiRow().TransposedMultiRow&&TransposedMultirowJsonConverter||FlexGridJsonConverter)(e,t,FlexGridPdfConverter._getFlexGridAdapter(e,t))}}export class PdfWebWorker{static initExportGrid(){this.initExport((e,t)=>{var r=t[DefGridName];if(r.progressMessaging){r.settings._progressMax=FlexGridPdfConverter._DefaultExportSettings._progressMax;r.settings.progress=e=>{this.sendExportProgress(e)};e.ended.addHandler(()=>{this.sendExportProgress(1)})}FlexGridPdfConverter.draw(r.content,e,null,null,r.settings);e.end()})}static initExport(e){self.addEventListener("message",(function handler(t){self.removeEventListener("message",handler);let r=t.data,o=JSON.parse(bufToStr(r.content)),l=r.settings||{};l.ended=(e,t)=>{blobToBuf(t.blob,e=>{self.postMessage({data:e,status:PdfWebWorkerResponseStatus.Done},[e])})};let i=new pdf.PdfDocument(l);Object.keys(o).forEach(e=>{let t=o[e];t.settings&&(t.settings=JSON.parse(t.settings));if(t.isGrid){t.settings&&PdfWebWorker._disableUnsupportedFeatures(t.settings);t.content=PdfWebWorker._deserializeGridFromString(t.content,t.settings)}});e(i,o)}))}static sendExportProgress(e){e=clamp(e,0,1);self.postMessage({data:e,status:PdfWebWorkerResponseStatus.Progress})}static deserializeGrid(e,t){return this._deserializeGridFromString(bufToStr(e),t)}static _deserializeGridFromString(e,t){return this._getJsonAdapter(JSON.parse(e),FlexGridPdfConverter._applyDefaultExportSettings(t))}static _disableUnsupportedFeatures(e){e.customCellContent=!1}static _getJsonAdapter(e,t){switch(e.typeName){case"MultiRow":return new MultiRowJsonAdapter(e,t);case"PivotGrid":return new PivotGridJsonAdapter(e,t);case"TransposedGrid":return new TransposedGridJsonAdapter(e,t);case"TransposedMultiRow":return new TransposedMultiRowJsonAdapter(e,t);default:return new FlexGridJsonAdapter(e,t)}}}function bufToStr(e){for(var t=new Uint16Array(e),r="",o=0,l=t.length;o<l;o++)r+=String.fromCharCode(t[o]);return r}function strToBuf(e){for(var t=new ArrayBuffer(2*e.length),r=new Uint16Array(t),o=0,l=e.length;o<l;o++)r[o]=e.charCodeAt(o);return t}function blobToBuf(e,t){asFunction(t);var r=new FileReader;r.onload=function(e){t(e.target.result)};r.readAsArrayBuffer(e)}var RowState,ColState;!function(e){e[e.None=0]="None";e[e.Alternate=1]="Alternate";e[e.Group=2]="Group";e[e.ExpandableGroup=4]="ExpandableGroup";e[e.New=8]="New";e[e.Visible=16]="Visible";e[e.Detail=32]="Detail"}(RowState||(RowState={}));!function(e){e[e.None=0]="None";e[e.Visible=1]="Visible"}(ColState||(ColState={}));class FlexGridJsonConverter{constructor(e,t,r){this._flex=e;this._settings=t;this._adapter=r}convert(){var e={};e.typeName=this._getTypeName(this._flex);e.selection=this._serializeSelection();e.showColumnFooter=this.adapter.showColumnFooter;e.showColumnHeader=this.adapter.showColumnHeader;e.showRowHeader=this.adapter.showRowHeader;e.treeIndent=this._flex.treeIndent;e.bottomLeftCells=this._serializePanel(this._flex.bottomLeftCells);e.cells=this._serializePanel(this._flex.cells);e.columnFooters=this._serializePanel(this._flex.columnFooters);e.columnHeaders=this._serializePanel(this._flex.columnHeaders);e.rowHeaders=this._serializePanel(this._flex.rowHeaders);e.topLeftCells=this._serializePanel(this._flex.topLeftCells);return e}get adapter(){return this._adapter}get flex(){return this._flex}_getTypeName(e){return e.constructor.toString().match(/function\s*(\w+)/)[1]}_getRowState(e){var t=RowState.None;this.adapter.isAlternatingRow(e)&&(t|=RowState.Alternate);e instanceof softGrid().GroupRow&&(t|=RowState.Group);this.adapter.isDetailRow(e)&&(t|=RowState.Detail);this.adapter.isExpandableGroupRow(e)&&(t|=RowState.ExpandableGroup);e instanceof softGrid()._NewRowTemplate&&(t|=RowState.New);e.isVisible&&(t|=RowState.Visible);return t}_getColumnState(e){var t=ColState.None;e.isVisible&&(t|=ColState.Visible);return t}_serializeSelection(){let e=this.adapter.getSelection(),t=[];for(let o=0;o<e.length;o++){var r=e[o];t.push([r.row,r.col,r.row2,r.col2])}return t}_serializeColumns(e){let t=[];for(let r=0,o=(e||[]).length;r<o;r++){let o=e[r],l=null;if(o){l={aggregate:o.aggregate,renderWidth:o.renderWidth,visibleIndex:o.visibleIndex};let e=o.getAlignment();e&&(l.alignment=e);let t=this._getColumnState(o);t!==ColState.None&&(l.state=t);o.binding&&(l.binding=o.binding);null!=o.dataType&&(l.dataType=o.dataType);null!=o.name&&(l.name=o.name);o.wordWrap&&(l.wordWrap=!0);o.multiLine&&(l.multiLine=!0)}t.push(l)}return t}_serializePanel(e){let t={cellType:e.cellType,height:e.height,width:e.width},getAlignment=e=>{if(e.align)return e.align;if(!e.dataMap)switch(e.dataType){case DataType.Boolean:return"center";case DataType.Number:return"right"}return null};t.mergedRanges=this._serializeMergedRanges(e);t.columns=this._serializeColumns(e.columns);t.columnsFirstVisibleIndex=e.columns.firstVisibleIndex;t.rows=[];t.rowsMaxGroupLevel=e.rows.maxGroupLevel;let r=!this._settings.customCellContent&&this._flex._getShowErrors();for(let o=0,l=e.rows.length,i=e.columns.length;o<l;o++){let l=e.rows[o],s={renderHeight:l.renderHeight};t.rows.push(s);let n=getAlignment(l);n&&(s.alignment=n);l instanceof softGrid().GroupRow&&(s.level=l.level);let a=this._getRowState(l);a!==RowState.None&&(s.state=a);l.binding&&(s.binding=l.binding);null!=l.dataType&&(s.dataType=l.dataType);l.wordWrap&&(s.wordWrap=!0);l.multiLine&&(s.multiLine=!0);s.cells=[];let d=softGrid();for(let t=0;t<i;t++){let l=this._adapter.getCellContent(e,e.rows[o],e.columns[t],t);if(isFunction(this._settings.formatItem)){let r=new PdfFormatItemEventArgs(e,new d.CellRange(o,t),null,null,null,null,null,()=>this._adapter.getCell(e,o,t,!0),null);r.data=l;this._settings.formatItem(r);r.data!==l&&(l=r.data)}s.cells[t]=l;if(r&&this._flex._getError(e,o,t)){s.errors||(s.errors={});s.errors[t]=1}}}return t}_serializeMergedRanges(e){for(var t=[],r=[],o=0;o<e.columns.length;o++)r[o]=0;for(var l=0;l<e.rows.length;l++)for(var i=0;i<e.columns.length;i++)if(!(l<r[i])){var s=e.grid.getMergedRange(e,l,i);if(null!=s&&!s.isSingleCell){t.push([s.row,s.col,s.row2,s.col2]);for(var n=s.col;n<=s.col2;n++)r[n]=s.row2+1;s.col===s.col2||(i=s.col2)}}return t}}class MultiRowJsonConverter extends FlexGridJsonConverter{convert(){let e=super.convert();e.rowsPerItem=this.flex.rowsPerItem;return e}_serializePanel(e){let t=super._serializePanel(e);t.cellGroups=this._serializeCellGroup(e);return t}_serializeCellGroup(e){let t=[],r=[],o=softGrid(),l=this.flex.rowsPerItem;e.cellType!==o.CellType.TopLeft&&e.cellType!==o.CellType.ColumnHeader||(l=e.rows.length);for(let o=0;o<l;o++){r[o]=[];for(let l=0;l<e.columns.length;l++){let i=this.flex.getBindingColumn(e,o,l),s=t.indexOf(i);r[o][l]=s<0?t.push(i)-1:s}}return{bindingColumns:this._serializeColumns(t),mappings:r}}}class PivotGridJsonConverter extends FlexGridJsonConverter{convert(){let e=super.convert();e.centerHeadersVertically=this.flex.centerHeadersVertically;return e}}class TransposedGridJsonConverter extends FlexGridJsonConverter{convert(){let e=super.convert(),t=new Array(this.flex.cells.rows.length),r=this.flex.cells,o=softGrid();for(var l=0,i=r.rows.length;l<i;l++){var s=r.rows[l].dataItem,n=s&&s._rowInfo;n instanceof o.Column||(n=_combineColumns(n,n));t[l]=n}e.rowInfo=this._serializeColumns(t);return e}}class TransposedMultirowJsonConverter extends FlexGridJsonConverter{convert(){let e=super.convert();e.cellGroups=this._serializeCellGroup();e.columnsPerItem=this.flex.columnsPerItem;return e}_serializeCellGroup(){let e=[],t=[],r=this.flex.columnsPerItem,o=this.flex.cells;for(let l=0;l<o.rows.length;l++){t[l]=[];for(let i=0;i<r;i++){let r=this.flex.getBindingColumn(o,l,i),s=e.indexOf(r);t[l][i]=s<0?e.push(r)-1:s}}return{bindingColumns:this._serializeColumns(e),mappings:t}}}class RowJson{constructor(e,t){this.index=t;this.binding=e.binding;this.dataType=e.dataType;this.alignment=e.alignment;this.level=e.level;this.renderHeight=e.renderHeight;this.cells=e.cells;this.wordWrap=e.wordWrap||!1;this.multiLine=e.multiLine||!1;this.errors=e.errors;this._state=e.state}get isAlternatingRow(){return(this._state&RowState.Alternate)!==RowState.None}get isGroupRow(){return(this._state&RowState.Group)!==RowState.None}get isDetailRow(){return(this._state&RowState.Detail)!==RowState.None}get isExpandableGroupRow(){return(this._state&RowState.ExpandableGroup)!==RowState.None}get isNewRow(){return(this._state&RowState.New)!==RowState.None}get isVisible(){return(this._state&RowState.Visible)!==RowState.None}}class ColumnJson{constructor(e,t){this.index=t;this.binding=e.binding;this.dataType=e.dataType;this.aggregate=e.aggregate;this.name=e.name;this.renderWidth=e.renderWidth;this.visibleIndex=e.visibleIndex;this.wordWrap=e.wordWrap||!1;this.multiLine=e.multiLine||!1;this._alignment=e.alignment;this._state=e.state}getAlignment(e){return this._alignment?this._alignment:e&&e.alignment?e.alignment:""}get isVisible(){return(this._state&ColState.Visible)!==ColState.None}}class RowJsonCollection{constructor(e,t=-1){this.maxGroupLevel=t;this.length=e.length;for(let t=0;t<e.length;t++)this[t]=new RowJson(e[t],t)}}class ColumnJsonCollection{constructor(e,t=-1){this.firstVisibleIndex=t;this.length=e.length;for(let t=0;t<e.length;t++){let r=e[t];this[t]=r?new ColumnJson(e[t],t):null}}}class GridJsonPanel{constructor(e){this.height=e.height;this.width=e.width;this.cellType=e.cellType;this.columns=new ColumnJsonCollection(e.columns,e.columnsFirstVisibleIndex);this.rows=new RowJsonCollection(e.rows,e.rowsMaxGroupLevel);this._mergedRanges=this._deserializeMergedRanges(e.mergedRanges)}getCellData(e,t){return this.rows[e].cells[t]}getMergedRange(e,t){let r=this._mergedRanges[e];if(r)for(let e=0,l=r.length;e<l;e++){var o=r[e];if(t>=o.col&&t<=o.col2)return o}return null}_deserializeMergedRanges(e){let t=[];e=e||[];for(let e=0,r=this.rows.length;e<r;e++)t[e]=[];for(let r=0,o=e.length;r<o;r++){let o=e[r],l=new _CellRange(o[0],o[1],o[2],o[3]);for(let e=l.row;e<=l.row2;e++)t[e].push(l)}return t}}class FlexGridJsonAdapter{constructor(e,t){this.settings=t;this.bottomLeftCells=this.deserializePanel(e.bottomLeftCells);this.cells=this.deserializePanel(e.cells);this.columnFooters=this.deserializePanel(e.columnFooters);this.columnHeaders=this.deserializePanel(e.columnHeaders);this.rowHeaders=this.deserializePanel(e.rowHeaders);this.topLeftCells=this.deserializePanel(e.topLeftCells);this.treeIndent=e.treeIndent;this.showColumnFooter=e.showColumnFooter;this.showColumnHeader=e.showColumnHeader;this.showRowHeader=e.showRowHeader;this._selection=[];for(let t=0;t<e.selection.length;t++){let r=e.selection[t];this._selection.push(new _CellRange(r[0],r[1],r[2],r[3]))}}get columns(){return this.cells.columns}get rows(){return this.cells.rows}getSelection(){return this._selection}getCell(e,t,r,o){throw"Not implemented"}getComputedDefBorderColor(){throw"Not implemented"}getComputedStyle(e,t){throw"Not implemented"}getMergedRange(e,t,r){return e.getMergedRange(t,r)}alignMergedTextToTheTopRow(e){return!1}getCellData(e,t,r){return e.getCellData(t,r)}getCellContent(e,t,r,o){return this.getCellData(e,t.index,o)}isBooleanCell(e,t,r){return r.dataType===DataType.Boolean&&e.cellType===_CellType.Cell&&!this.isExpandableGroupRow(t)}getColumn(e,t,r){return e.columns[r]}isAlternatingRow(e){return e.isAlternatingRow}isGroupRow(e){return e.isGroupRow}isNewRow(e){return e.isNewRow}isDetailRow(e){return e.isDetailRow}isExpandableGroupRow(e){return e.isExpandableGroupRow}isRenderableRow(e){return e.isVisible&&e.renderHeight>0&&!this.isNewRow(e)}isRenderableColumn(e){return e.isVisible&&e.renderWidth>0}getCellStyle(e,t,r){var o=this.settings.styles,l=_merge({},o.cellStyle);switch(e.cellType){case _CellType.Cell:this.isExpandableGroupRow(t)?_merge(l,o.groupCellStyle,!0):this.isAlternatingRow(t)&&_merge(l,o.altCellStyle,!0);break;case _CellType.ColumnHeader:case _CellType.RowHeader:case _CellType.TopLeft:case _CellType.BottomLeft:_merge(l,o.headerCellStyle,!0);break;case _CellType.ColumnFooter:_merge(l,o.headerCellStyle,!0);_merge(l,o.footerCellStyle,!0)}t.errors&&t.errors[r.index]&&_merge(l,o.errorCellStyle,!0);return l}deserializePanel(e){return new GridJsonPanel(e)}}class PivotGridJsonAdapter extends FlexGridJsonAdapter{constructor(e,t){super(e,t);this._centerHeadersVertically=e.centerHeadersVertically}alignMergedTextToTheTopRow(e){return!this._centerHeadersVertically&&(e.cellType===_CellType.ColumnHeader||e.cellType===_CellType.RowHeader)}}class MultiRowJsonPanel extends GridJsonPanel{constructor(e){super(e);e.cellGroups&&(this._cellGroups={bindingColumns:new ColumnJsonCollection(e.cellGroups.bindingColumns),mappings:e.cellGroups.mappings})}getColumn(e,t,r){var o=this.columns[t];if(this._cellGroups){this.cellType!==_CellType.ColumnHeader&&this.cellType!==_CellType.BottomLeft&&(e%=r);return _combineColumns(o,this._cellGroups.bindingColumns[this._cellGroups.mappings[e][t]])}return o}}class MultiRowJsonAdapter extends FlexGridJsonAdapter{constructor(e,t){super(e,t);this._rowsPerItem=e.rowsPerItem}deserializePanel(e){return new MultiRowJsonPanel(e)}getColumn(e,t,r){return e.getColumn(t,r,this._rowsPerItem)}}class TransposedGridJsonAdapter extends FlexGridJsonAdapter{constructor(e,t){super(e,t);this._rowInfo=new ColumnJsonCollection(e.rowInfo)}getColumn(e,t,r){let o=super.getColumn(e,t,r);if(e.cellType!==_CellType.Cell)return o;{let e=this._rowInfo[t];return e?_combineColumns(o,e):o}}}class TransposedMultiRowJsonAdapter extends FlexGridJsonAdapter{constructor(e,t){super(e,t);this._columnsPerItem=e.columnsPerItem;e.cellGroups&&(this._cellGroups={bindingColumns:new ColumnJsonCollection(e.cellGroups.bindingColumns),mappings:e.cellGroups.mappings})}getColumn(e,t,r){let o=super.getColumn(e,t,r);if(this._cellGroups&&e.cellType===_CellType.Cell){r%=this._columnsPerItem;return _combineColumns(o,this._cellGroups.bindingColumns[this._cellGroups.mappings[t][r]])}return o}}_registerModule("wijmo.grid.pdf",selfModule);
package/es5-esm.js ADDED
@@ -0,0 +1,14 @@
1
+ /*!
2
+ *
3
+ * Wijmo Library 5.20232.939
4
+ * https://developer.mescius.com/wijmo
5
+ *
6
+ * Copyright(c) MESCIUS inc. All rights reserved.
7
+ *
8
+ * Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
9
+ * us.sales@mescius.com
10
+ * https://developer.mescius.com/wijmo/licensing
11
+ *
12
+ */
13
+
14
+ var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{asFunction,asType,CancelEventArgs,Color,isFunction,Rect,Size,isObject,assert,asInt,asString,changeType,isArray,isString,DataType,Point,_getModule,removeChild,toPlainText,clamp,EventArgs,_registerModule}from"@mescius/wijmo";import*as pdf from"@mescius/wijmo.pdf";import*as selfModule from"@mescius/wijmo.grid.pdf";export function softGrid(){return _getModule("wijmo.grid")}export function softDetail(){return _getModule("wijmo.grid.detail")}export function softMultiRow(){return _getModule("wijmo.grid.multirow")}export function softSheet(){return _getModule("wijmo.grid.sheet")}export function softOlap(){return _getModule("wijmo.olap")}export function softTransposed(){return _getModule("wijmo.grid.transposed")}export function softTransposedMultiRow(){return _getModule("wijmo.grid.transposedmultirow")}export var ScaleMode;!function(e){e[e.ActualSize=0]="ActualSize";e[e.PageWidth=1]="PageWidth";e[e.SinglePage=2]="SinglePage"}(ScaleMode||(ScaleMode={}));export var ExportMode;!function(e){e[e.All=0]="All";e[e.Selection=1]="Selection"}(ExportMode||(ExportMode={}));export var _CellType;!function(e){e[e.None=0]="None";e[e.Cell=1]="Cell";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.TopLeft=4]="TopLeft";e[e.ColumnFooter=5]="ColumnFooter";e[e.BottomLeft=6]="BottomLeft"}(_CellType||(_CellType={}));export function _merge(e,t,r){void 0===r&&(r=!1);!e&&t&&(e={});if(t&&e)for(var o in t){var n=t[o],i=e[o];if(isObject(n)){if(void 0===i||!isObject(i)&&r){if(isFunction(n.clone)){e[o]=i=n.clone();continue}e[o]=i={}}isObject(i)&&_merge(e[o],n,r)}else(void 0===i||r&&void 0!==n)&&(e[o]=n)}return e}export function _combineColumns(e,t){return{aggregate:t.aggregate,binding:t.binding,name:t.name,dataType:t.dataType,wordWrap:t.wordWrap,multiLine:t.multiLine,getAlignment:function(e){if("getAlignment"in t)return t.getAlignment(e)},index:e.index,visibleIndex:e.visibleIndex,isVisible:e.isVisible,renderWidth:e.renderWidth}}export function _cloneStyle(e){if(!e)return null;for(var t={},toCamel=function(e){return e.replace(/\-([a-z])/g,(function(e,t,r){return r>0?t.toUpperCase():t}))},r=0,o=e.length;r<o;r++){var n=e[r];t[toCamel(n)]=e.getPropertyValue(n)}return t}var PdfFormatItemEventArgs=function(e){__extends(PdfFormatItemEventArgs,e);function PdfFormatItemEventArgs(t,r,o,n,i,l,s,a,d){var u=e.call(this)||this;u.cancelBorders=!1;u._p=t;u._rng=r;"undefined"!=typeof HTMLElement&&(u._cell=asType(o,HTMLElement,!0));u._canvas=n;u._clientRect=i;u._contentRect=l;u._style=s;u._getFormattedCell=a;u._getTextRect=d;return u}Object.defineProperty(PdfFormatItemEventArgs.prototype,"panel",{get:function(){return this._p},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"range",{get:function(){return this._rng.clone()},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"row",{get:function(){return this._rng.row},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"col",{get:function(){return this._rng.col},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"data",{get:function(){return this._data},set:function(e){this._data=e},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"canvas",{get:function(){return this._canvas},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"cell",{get:function(){return this._cell},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"clientRect",{get:function(){return this._clientRect},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"contentRect",{get:function(){return this._contentRect},enumerable:!0,configurable:!0});PdfFormatItemEventArgs.prototype.drawBackground=function(e){var t=this.clientRect;e&&t.width>0&&t.height>0&&this.canvas.paths.rect(t.left,t.top,t.width,t.height).fill(e||this.style.backgroundColor)};PdfFormatItemEventArgs.prototype.getFormattedCell=function(){return asFunction(this._getFormattedCell)()};Object.defineProperty(PdfFormatItemEventArgs.prototype,"tagContent",{get:function(){return this._tagContent},set:function(e){this._tagContent=e},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"style",{get:function(){return this._style},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"textTop",{get:function(){!this._textRect&&isFunction(this._getTextRect)&&(this._textRect=this._getTextRect());return this._textRect?this._textRect.top:this._contentRect.top},enumerable:!0,configurable:!0});return PdfFormatItemEventArgs}(CancelEventArgs);export{PdfFormatItemEventArgs};var _FlexGridPdfCoreConverter=function(){function _FlexGridPdfCoreConverter(){}_FlexGridPdfCoreConverter.draw=function(e,t,r,o,n,i){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The doc argument cannot be null.");null==(i=this._applyDefaultDrawSettings(i)).scaleMode&&(i.scaleMode=null==o?ScaleMode.ActualSize:null==n?ScaleMode.PageWidth:ScaleMode.SinglePage);this._drawInternal(e,t,r,o,n,i)};_FlexGridPdfCoreConverter._applyDefaultDrawSettings=function(e){return _merge(_merge({},e),_FlexGridPdfCoreConverter.DefaultDrawSettings)};_FlexGridPdfCoreConverter._drawInternal=function(e,t,r,o,n,i){var l=null!=r,s=new Size(t.width,t.height);r||(r=new Point(0,t.y));isArray(i.embeddedFonts)&&i.embeddedFonts.forEach((function(e){t.registerFont(e)}));var a=this._getRowsToRender(e,i),d=new FlexGridRenderer(e,i,a,this.BorderWidth,!0),u=new Rect(r.x||0,r.y||0,o||s.width,n||s.height),p=this._getScaleFactor(d,i.scaleMode,u);if(r.y>0&&this._canBreakRows(i.scaleMode)){var c=a.find(e.cells,(function(e){return d.isRenderableRow(e)}));if(c){var f=(u.height-u.top)*(1/p);if((d.showColumnHeader?pdf.pxToPt(e.columnHeaders.height):0)+pdf.pxToPt(c.renderHeight)-this.BorderWidth>f){t.addPage();u=new Rect(r.x||0,0,o||s.width,n||s.height)}}}var h=this._getPages(d,a,u,i,l,p),g=(i.progress?this._getCellsCount(e,i,h):0)/i._progressMax,_=0,w=0,C=i.progress?function(){if(++_-w>=50){w=_;i.progress(_/g)}}:null;i.progress&&i.progress(0);for(var m=0;m<h.length;m++){m>0&&t.addPage();var b=h[m],R=0===b.pageCol?u.left:0,y=0===b.pageRow?u.top:0;t.saveState();t.paths.rect(0,0,t._widthCtm,t._heightCtm).clip();t.scale(p,p,new Point(R,y));t.translate(R,y);var x=new FlexGridRenderer(e,i,b.range,this.BorderWidth,m===h.length-1);x.render(t,C);t.restoreState();t.x=R;t.y=y+x.renderSize.height*p}i.progress&&0<i._progressMax&&i.progress(i._progressMax)};_FlexGridPdfCoreConverter._getCellsCount=function(e,t,r){for(var o=0,n=0;n<r.length;n++){o+=new FlexGridRenderer(e,t,r[n].range,0,!1).getCellsCount()}return o};_FlexGridPdfCoreConverter._getRowsToRender=function(e,t){var r=[];t.exportMode==ExportMode.All?r.push(new _CellRange(0,0,e.rows.length-1,e.columns.length-1)):r=e.getSelection();var o=new RowRange(r);if(o.isValid&&!t.drawDetailRows){var n=[];o.forEach(e.cells,(function(t,r,o){if(!e.isDetailRow(t)){var i=n.length;i&&n[i-1].bottomRow+1===o?n[i-1].row2++:n.push(new _CellRange(o,r.col,o,r.col2))}}));o=new RowRange(n)}return o};_FlexGridPdfCoreConverter._getScaleFactor=function(e,t,r){var o=1;if(t==ScaleMode.ActualSize)return o;var n=e.renderSize;if(t==ScaleMode.SinglePage){(i=Math.min(r.width/n.width,r.height/n.height))<1&&(o=i)}else{var i;(i=r.width/n.width)<1&&(o=i)}return o};_FlexGridPdfCoreConverter._canBreakRows=function(e){return e==ScaleMode.ActualSize||e==ScaleMode.PageWidth};_FlexGridPdfCoreConverter._getPages=function(e,t,r,o,n,i){var l=this,s=[],a=[],d=pdf.pxToPt,u=e.flex,p=e.showColumnHeader,c=e.showColumnFooter,f=e.showRowHeader,h=p?d(u.columnHeaders.height):0,g=c?d(u.columnFooters.height):0,_=f?d(u.rowHeaders.width):0,w=this._canBreakRows(o.scaleMode),C=o.scaleMode==ScaleMode.ActualSize,m=(r.width-r.left)*(1/i),b=(r.height-r.top)*(1/i),R=r.width*(1/i),y=r.height*(1/i),x=h,v=_,P=n&&o.scaleMode==ScaleMode.ActualSize,S=b;if(w){var T=0,G=0;t.forEach(u.cells,(function(t,r,o,n){S=s.length?y:b;if(e.isRenderableRow(t)){var i=d(t.renderHeight);T++;x+=i;(p||T>1)&&(x-=l.BorderWidth);if(x>S){if(P||h+i>S&&0===G){s.push(n);x=h}else{s.push(n-1);x=h+i}G=0;p&&(x-=l.BorderWidth)}else G++}}))}var F=Math.max(t.length()-1,0);s.length&&s[s.length-1]===F||s.push(F);c&&x+g>S&&s.push(-1);if(C)for(var A=0,M=t.leftCol;M<=t.rightCol;M++){var W=u.columns[M];if(e.isRenderableColumn(W)){var J=d(W.renderWidth),E=a.length?R:m;A++;v+=J;(f||A>1)&&(v-=this.BorderWidth);if(v>E){if(_+J>E||P){a.push(M);v=_}else{a.push(M-1);v=_+J}f&&(v-=this.BorderWidth)}}}a.length&&a[a.length-1]===t.rightCol||a.push(t.rightCol);var H=[],z=!1,O=1,L=n&&o.maxPages>0?1:o.maxPages;for(M=0;M<s.length&&!z;M++)for(var j=0;j<a.length&&!z;j++,O++)if(!(z=O>L)){var D=0===M?0:s[M-1]+1,k=0===j?t.leftCol:a[j-1]+1,B=-1===s[M]?new RowRange([new _CellRange(-1,k,-1,a[j])]):t.subrange(D,s[M]-D+1,k,a[j]);H.push(new PdfPageRowRange(B,j,M))}return H};_FlexGridPdfCoreConverter.BorderWidth=1;_FlexGridPdfCoreConverter.DefFont=new pdf.PdfFont;_FlexGridPdfCoreConverter.DefaultDrawSettings={customCellContent:!1,drawDetailRows:!1,exportMode:ExportMode.All,maxPages:Number.MAX_VALUE,repeatMergedValuesAcrossPages:!0,recalculateStarWidths:!0,styles:{cellStyle:{font:{family:_FlexGridPdfCoreConverter.DefFont.family,size:_FlexGridPdfCoreConverter.DefFont.size,style:_FlexGridPdfCoreConverter.DefFont.style,weight:_FlexGridPdfCoreConverter.DefFont.weight},padding:1.5,verticalAlign:"middle"},headerCellStyle:{font:{weight:"bold"}}},quickCellStyles:!0,_progressMax:1};return _FlexGridPdfCoreConverter}();export{_FlexGridPdfCoreConverter};var FlexGridRenderer=function(){function FlexGridRenderer(e,t,r,o,n){this._flex=e;this._borderWidth=o;this._lastPage=n;this._settings=t||{};this._topLeft=new PanelSectionRenderer(this,e.topLeftCells,this.showRowHeader&&this.showColumnHeader?new RowRange([new _CellRange(0,0,e.topLeftCells.rows.length-1,e.topLeftCells.columns.length-1)]):new RowRange([]),o);this._rowHeader=new PanelSectionRenderer(this,e.rowHeaders,this.showRowHeader?r.clone(0,e.rowHeaders.columns.length-1):new RowRange([]),o);this._columnHeader=new PanelSectionRenderer(this,e.columnHeaders,this.showColumnHeader?new RowRange([new _CellRange(0,r.leftCol,e.columnHeaders.rows.length-1,r.rightCol)]):new RowRange([]),o);this._cells=new PanelSectionRenderer(this,e.cells,r,o);this._bottomLeft=new PanelSectionRenderer(this,e.bottomLeftCells,this.showRowHeader&&this.showColumnFooter?new RowRange([new _CellRange(0,0,e.bottomLeftCells.rows.length-1,e.bottomLeftCells.columns.length-1)]):new RowRange([]),o);this._columnFooter=new PanelSectionRenderer(this,e.columnFooters,this.showColumnFooter?new RowRange([new _CellRange(0,r.leftCol,e.columnFooters.rows.length-1,r.rightCol)]):new RowRange([]),o)}Object.defineProperty(FlexGridRenderer.prototype,"settings",{get:function(){return this._settings},enumerable:!0,configurable:!0});FlexGridRenderer.prototype.isRenderableRow=function(e){return this._flex.isRenderableRow(e)};FlexGridRenderer.prototype.isRenderableColumn=function(e){return this._flex.isRenderableColumn(e)};FlexGridRenderer.prototype.getCellsCount=function(){return this._topLeft.getCellsCount()+this._rowHeader.getCellsCount()+this._columnHeader.getCellsCount()+this._cells.getCellsCount()+this._bottomLeft.getCellsCount()+this._columnFooter.getCellsCount()};FlexGridRenderer.prototype.render=function(e,t){var r,o,n,i;if(e.tagged){r=o=n=i=new TrStructCache(e,e.tag(pdf.PdfTagType.Table));e.addTag(r.el);if(e.version>=pdf.PdfVersion.v1_5){r.el.add((o=new TrStructCache(e,e.tag(pdf.PdfTagType.THead))).el);r.el.add((n=new TrStructCache(e,e.tag(pdf.PdfTagType.TBody))).el);r.el.add((i=new TrStructCache(e,e.tag(pdf.PdfTagType.TFoot))).el)}}var l=Math.max(0,Math.max(this._topLeft.renderSize.width,this._rowHeader.renderSize.width)-this._borderWidth),s=Math.max(0,Math.max(this._topLeft.renderSize.height,this._columnHeader.renderSize.height)-this._borderWidth);this._topLeft.render(e,0,0,t,o);this._rowHeader.render(e,0,s,t,n);this._columnHeader.render(e,l,0,t,o);this._cells.render(e,l,s,t,n);s+=Math.max(0,this._cells.renderSize.height-this._borderWidth);this._bottomLeft.render(e,0,s,t,i);this._columnFooter.render(e,l,s,t,i)};Object.defineProperty(FlexGridRenderer.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"renderSize",{get:function(){var e=Math.max(this._topLeft.renderSize.height,this._columnHeader.renderSize.height)+Math.max(this._rowHeader.renderSize.height,this._cells.renderSize.height)+Math.max(this._bottomLeft.renderSize.height,this._columnFooter.renderSize.height),t=Math.max(this._topLeft.renderSize.width,this._rowHeader.renderSize.width)+Math.max(this._columnHeader.renderSize.width,this._cells.renderSize.width);this._columnHeader.renderableRowsCount>0&&(e-=this._borderWidth);this._columnFooter.renderableRowsCount>0&&(e-=this._borderWidth);this._rowHeader.renderableColumnsCount>0&&(t-=this._borderWidth);return new Size(t,e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showColumnHeader",{get:function(){return this._flex.showColumnHeader},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showRowHeader",{get:function(){return this._flex.showRowHeader},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showColumnFooter",{get:function(){return this._lastPage&&this._flex.showColumnFooter},enumerable:!0,configurable:!0});FlexGridRenderer.prototype.alignMergedTextToTheTopRow=function(e){return this._flex.alignMergedTextToTheTopRow(e)};FlexGridRenderer.prototype.getColumn=function(e,t,r){return this._flex.getColumn(e,t,r)};FlexGridRenderer.prototype.isAlternatingRow=function(e){return this._flex.isAlternatingRow(e)};FlexGridRenderer.prototype.isGroupRow=function(e){return this._flex.isGroupRow(e)};FlexGridRenderer.prototype.isNewRow=function(e){return this._flex.isNewRow(e)};FlexGridRenderer.prototype.isExpandableGroupRow=function(e){return this._flex.isExpandableGroupRow(e)};FlexGridRenderer.prototype.isBooleanCell=function(e,t,r){return this._flex.isBooleanCell(e,t,r)};FlexGridRenderer.prototype.getCellStyle=function(e,t,r){return this._flex.getCellStyle(e,t,r)};return FlexGridRenderer}(),PanelSection=function(){function PanelSection(e,t,r){this._flex=e;this._panel=t;this._range=r.clone()}Object.defineProperty(PanelSection.prototype,"renderableRowsCount",{get:function(){var e=this;if(null==this._renderableRowsCnt){this._renderableRowsCnt=0;this._range.forEach(this._panel,(function(t){e._flex.isRenderableRow(t)&&e._renderableRowsCnt++}))}return this._renderableRowsCnt},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"renderableColumnsCount",{get:function(){if(null==this._renderableColumnsCnt){this._renderableColumnsCnt=0;if(this._range.isValid)for(var e=this._range.leftCol;e<=this._range.rightCol;e++)this._flex.isRenderableColumn(this._panel.columns[e])&&this._renderableColumnsCnt++}return this._renderableColumnsCnt},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"size",{get:function(){if(null==this._size){var e=this._range.getRenderSize(this._flex,this._panel);this._size=new Size(pdf.pxToPt(e.width),pdf.pxToPt(e.height))}return this._size},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"panel",{get:function(){return this._panel},enumerable:!0,configurable:!0});return PanelSection}(),PanelSectionRenderer=function(e){__extends(PanelSectionRenderer,e);function PanelSectionRenderer(t,r,o,n){var i=e.call(this,t.flex,r,o)||this;i._gr=t;i._borderWidth=n;return i}Object.defineProperty(PanelSectionRenderer.prototype,"gr",{get:function(){return this._gr},enumerable:!0,configurable:!0});Object.defineProperty(PanelSectionRenderer.prototype,"renderSize",{get:function(){if(null==this._renderSize){this._renderSize=this.size.clone();this.renderableColumnsCount>1&&(this._renderSize.width-=this._borderWidth*(this.renderableColumnsCount-1));this.renderableRowsCount>1&&(this._renderSize.height-=this._borderWidth*(this.renderableRowsCount-1))}return this._renderSize},enumerable:!0,configurable:!0});PanelSectionRenderer.prototype._getRangeWidth=function(e,t){for(var r=0,o=0,n=this.panel,i=e;i<=t;i++){var l=n.columns[i];if(this._gr.isRenderableColumn(l)){o++;r+=l.renderWidth}}r=pdf.pxToPt(r);o>1&&(r-=this._borderWidth*(o-1));return r};PanelSectionRenderer.prototype._getRangeHeight=function(e,t){for(var r=0,o=0,n=this.panel,i=e;i<=t;i++){var l=n.rows[i];if(this._gr.isRenderableRow(l)){o++;r+=l.renderHeight}}r=pdf.pxToPt(r);o>1&&(r-=this._borderWidth*(o-1));return r};PanelSectionRenderer.prototype.getCellsCount=function(){var e=this,t=0,r=this.range,o=this.panel,n=new GetMergedRangeProxy(this._gr.flex);if(!r.isValid)return t;r.forEach(o,(function(i,l,s){if(e._gr.isRenderableRow(i))for(var a=r.leftCol;a<=r.rightCol;a++)if(e._gr.isRenderableColumn(o.columns[a])){var d=!1,u=void 0,p=n.getMergedRange(o,s,a);if(p){var c=s===p.firstVisibleRow,f=a===p.leftCol,h=s===l.topRow,g=a===l.leftCol,_=p.rowSpan>1,w=p.columnSpan>1;if(_&&w&&(c&&f||h&&g)||_&&!w&&(c||h)||!_&&w&&(f||g)){d=!0;w&&(u=Math.min(r.rightCol,p.rightCol))}}else d=!0;d&&t++;u&&(a=u)}}));return t};PanelSectionRenderer.prototype.render=function(e,t,r,o,n){var i=this,l=this.range;if(l.isValid){for(var s={},a=this.panel,d=new GetMergedRangeProxy(this._gr.flex),u=new _CellRangeExt(a,0,0,0,0),p=new _CellRenderer(this,e,this._borderWidth),c=l.leftCol;c<=l.rightCol;c++)s[c]=r;l.forEach(a,(function(r,c,f){if(i._gr.isRenderableRow(r))for(var h=n?n.getTR(f,a.cellType):null,g=t,_=l.leftCol;_<=l.rightCol;_++){var w=i.gr.getColumn(a,f,_);if(i._gr.isRenderableColumn(w)){var C,m=void 0,b=void 0,R=!1,y=void 0,x=i._gr.flex.getCellContent(i.panel,r,w,_),v=d.getMergedRange(a,f,_);if(v){if(f>=v.topRow){u.copyFrom(v);var P=f===v.firstVisibleRow,S=_===v.leftCol,T=f===c.topRow,G=_===c.leftCol,F=v.rowSpan>1,A=v.columnSpan>1;if(F&&A&&(P&&S||T&&G)||F&&!A&&(P||T)||!F&&A&&(S||G)){R=!0;C=P&&S||i.gr.settings.repeatMergedValuesAcrossPages?x:"";m=F?i._getRangeHeight(f,Math.min(v.bottomRow,c.bottomRow)):i._getRangeHeight(f,f);if(A){b=i._getRangeWidth(Math.max(l.leftCol,v.leftCol),Math.min(l.rightCol,v.rightCol));y=Math.min(l.rightCol,v.rightCol);for(var M=_+1;M<=y;M++)s[M]+=m-i._borderWidth}}}else m=i._getRangeHeight(f,f);null==b&&(b=i._getRangeWidth(_,_))}else{u.setRange(f,_,f,_);R=!0;C=x;m=i._getRangeHeight(f,f);b=i._getRangeWidth(_,_)}if(R&&b>0&&m>0){var W=p.renderCell(C,r,w,u,new Rect(g,s[_],b,m));if(h){var J=e.tag(a.cellType===_CellType.ColumnHeader||a.cellType==_CellType.TopLeft?pdf.PdfTagType.TH:pdf.PdfTagType.TD);W&&J.add(W);h.add(J)}o&&o()}m&&(s[_]+=m-i._borderWidth);b&&(g+=b-i._borderWidth);y&&(_=y)}}}))}};return PanelSectionRenderer}(PanelSection),TrStructCache=function(){function TrStructCache(e,t){this.doc=e;this.tableSection=t;this._trh=[];this._trb=[];this._trf=[]}Object.defineProperty(TrStructCache.prototype,"el",{get:function(){return this.tableSection},enumerable:!0,configurable:!0});TrStructCache.prototype.getTR=function(e,t){var r=t===_CellType.TopLeft||t===_CellType.ColumnHeader?this._trh:t===_CellType.RowHeader||t===_CellType.Cell?this._trb:this._trf,o=r[e];o||this.tableSection.add(r[e]=o=this.doc.tag(pdf.PdfTagType.TR));return o};return TrStructCache}(),_CellRenderer=function(){function _CellRenderer(e,t,r){this.InvisiblePen=new pdf.PdfPen(Color.fromRgba(0,0,0,0),0);this._pr=e;this._area=t;this._borderWidth=r}_CellRenderer.prototype.renderCell=function(e,t,r,o,n){var i,l=this,s=this._pr.gr.flex,a=this._pr.panel,getGridCell=function(e){return s.getCell(a,o.topRow,o.leftCol,e)},d=null,u=this._pr.gr.getCellStyle(a,t,r),p=this._pr.gr.settings.customCellContent,c=isFunction(this._pr.gr.settings.formatItem);if(p){var f=s.getComputedStyle(a,d=getGridCell(c));u.color=f.color;u.backgroundColor=f.backgroundColor;var h=s.getComputedDefBorderColor();u.borderLeftColor="none"!=f.borderLeftStyle?f.borderLeftColor:h;u.borderRightColor="none"!=f.borderRightStyle?f.borderRightColor:h;u.borderTopColor="none"!=f.borderTopStyle?f.borderTopColor:h;u.borderBottomColor="none"!=f.borderBottomStyle?f.borderBottomColor:h;u.font=new pdf.PdfFont(f.fontFamily,pdf._asPt(f.fontSize,!0,void 0),f.fontStyle,f.fontWeight);u.textAlign=f.textAlign}if(u.font&&!(u.font instanceof pdf.PdfFont)){var g=u.font;u.font=new pdf.PdfFont(g.family,g.size,g.style,g.weight)}u.boxSizing="border-box";u.borderWidth=this._borderWidth;u.borderStyle="solid";p||this._pr.gr.isExpandableGroupRow(t)&&0===r.visibleIndex||(u.textAlign=r.getAlignment(t));if(a.cellType===_CellType.Cell&&s.rows.maxGroupLevel>=0&&o.leftCol===s.columns.firstVisibleIndex){var _=s.isGroupRow(t)?Math.max(t.level,0):s.rows.maxGroupLevel+1,w=pdf._asPt(u.paddingLeft||u.padding),C=pdf.pxToPt(_*s.treeIndent);u.paddingLeft=w+C}var m,b=this._measureCell(e,a,t,r,u,n),R=o.rowSpan>1&&o.visibleRowsCount>1&&this._pr.gr.alignMergedTextToTheTopRow(a)?new Rect(b.contentRect.left,b.contentRect.top,b.contentRect.width,b.contentRect.height/(o.visibleRowsCount||1)):b.contentRect,y=!0,x=!0;if(c){(i=new PdfFormatItemEventArgs(a,o,d,this._area,b.rect,b.contentRect,u,(function(){return d||getGridCell(!0)}),(function(){return b.textRect=l._calculateTextRect(e,a,t,r,R,u)}))).data=e;this._pr.gr.settings.formatItem(i);if(i.data!==e){e=asString(i.data);b.textRect=null}y=!i.cancel;x=!i.cancelBorders;m=i.tagContent}y&&!b.textRect&&(b.textRect=this._calculateTextRect(e,a,t,r,R,u));return this._renderCell(e,t,r,o,b,u,y,x,null==m)||m};_CellRenderer.prototype._renderCell=function(e,t,r,o,n,i,l,s,a){if(l||s){var d,u=this._area.document.tagged,p=this._area.document;u&&p.beginArtifact({type:pdf.PdfArtifactType.Layout});this._renderEmptyCell(n,i,l,s);u&&p.endArtifact();if(l){a=!0===u&&!0===a;var c=void 0;if(this._isBooleanCellAndValue(e,this._pr.panel,t,r)){if(a){d=p.tag(pdf.PdfTagType.Span,null,{actual:e.toString()});c=p.beginTagContent(pdf.PdfTagType.Span)}this._renderBooleanCell(e,n,i)}else{if(a){d=p.tag(pdf.PdfTagType.P);c=p.beginTagContent(pdf.PdfTagType.P)}this._renderTextCell(e,n,i)}if(a){p.endTagContent();d.add(c)}}return d}};_CellRenderer.prototype._isBooleanCellAndValue=function(e,t,r,o){return this._pr.gr.isBooleanCell(t,r,o)&&this._isBoolean(e)};_CellRenderer.prototype._isBoolean=function(e){var t=isString(e)&&e.toLowerCase();return"true"===t||"false"===t||!0===e||!1===e};_CellRenderer.prototype._measureCell=function(e,t,r,o,n,i){this._decompositeStyle(n);var l=i.left,s=i.top,a=i.height,d=i.width,u=this._parseBorder(n),p=u.left.width,c=u.top.width,f=u.bottom.width,h=u.right.width,g=this._parsePadding(n),_=0,w=0,C=0,m=0;if("content-box"===n.boxSizing||void 0===n.boxSizing){_=g.top+a+g.bottom;w=g.left+d+g.right;C=a;m=d}else{if("border-box"!==n.boxSizing)throw"Invalid value: "+n.boxSizing;if(pdf._IE&&n instanceof CSSStyleDeclaration){_=g.top+g.bottom+a;w=g.left+g.right+d}else{_=Math.max(a-c-f,0);w=Math.max(d-p-h,0)}C=Math.max(_-g.top-g.bottom,0);m=Math.max(w-g.left-g.right,0)}return{rect:i=new Rect(l,s,d,a),clientRect:new Rect(l+p,s+c,w,_),contentRect:new Rect(l+p+g.left,s+c+g.top,m,C),textRect:null}};_CellRenderer.prototype._decompositeStyle=function(e){if(e){var t;if(t=e.borderColor){e.borderLeftColor||(e.borderLeftColor=t);e.borderRightColor||(e.borderRightColor=t);e.borderTopColor||(e.borderTopColor=t);e.borderBottomColor||(e.borderBottomColor=t)}if(t=e.borderWidth){e.borderLeftWidth||(e.borderLeftWidth=t);e.borderRightWidth||(e.borderRightWidth=t);e.borderTopWidth||(e.borderTopWidth=t);e.borderBottomWidth||(e.borderBottomWidth=t)}if(t=e.borderStyle){e.borderLeftStyle||(e.borderLeftStyle=t);e.borderRightStyle||(e.borderRightStyle=t);e.borderTopStyle||(e.borderTopStyle=t);e.borderBottomStyle||(e.borderBottomStyle=t)}if(t=e.padding){e.paddingLeft||(e.paddingLeft=t);e.paddingRight||(e.paddingRight=t);e.paddingTop||(e.paddingTop=t);e.paddingBottom||(e.paddingBottom=t)}}};_CellRenderer.prototype._parseBorder=function(e){var t={left:{width:0},top:{width:0},bottom:{width:0},right:{width:0}};"none"!==e.borderLeftStyle&&(t.left={width:pdf._asPt(e.borderLeftWidth),style:e.borderLeftStyle,color:e.borderLeftColor});"none"!==e.borderTopStyle&&(t.top={width:pdf._asPt(e.borderTopWidth),style:e.borderTopStyle,color:e.borderTopColor});"none"!==e.borderBottomStyle&&(t.bottom={width:pdf._asPt(e.borderBottomWidth),style:e.borderBottomStyle,color:e.borderBottomColor});"none"!==e.borderRightStyle&&(t.right={width:pdf._asPt(e.borderRightWidth),style:e.borderRightStyle,color:e.borderRightColor});return t};_CellRenderer.prototype._parsePadding=function(e){return{left:pdf._asPt(e.paddingLeft),top:pdf._asPt(e.paddingTop),bottom:pdf._asPt(e.paddingBottom),right:pdf._asPt(e.paddingRight)}};_CellRenderer.prototype._renderEmptyCell=function(e,t,r,o){var n=e.rect.left,i=e.rect.top,l=e.clientRect.width,s=e.clientRect.height,a=e.clientRect.left-e.rect.left,d=e.clientRect.top-e.rect.top,u=e.rect.top+e.rect.height-(e.clientRect.top+e.clientRect.height),p=e.rect.left+e.rect.width-(e.clientRect.left+e.clientRect.width);r=r&&t.backgroundColor&&l>0&&s>0;if(o&&(a||p||u||d)){var c=t.borderLeftColor||t.borderColor,f=t.borderRightColor||t.borderColor,h=t.borderTopColor||t.borderColor,g=t.borderBottomColor||t.borderColor;if(a&&d&&u&&p&&a===p&&a===u&&a===d&&c===f&&c===g&&c===h){var _=a,w=_/2,C=this._area.paths.rect(n+w,i+w,l+_,s+_);if(r){C.fillAndStroke(t.backgroundColor,new pdf.PdfPen(c,_));return}C.stroke(new pdf.PdfPen(c,_))}else{a&&this._area.paths.polygon([[n,i],[n+a,i+d],[n+a,i+d+s],[n,i+d+s+u]]).fill(c);d&&this._area.paths.polygon([[n,i],[n+a,i+d],[n+a+l,i+d],[n+a+l+p,i]]).fill(h);p&&this._area.paths.polygon([[n+a+l+p,i],[n+a+l,i+d],[n+a+l,i+d+s],[n+a+l+p,i+d+s+u]]).fill(f);u&&this._area.paths.polygon([[n,i+d+s+u],[n+a,i+d+s],[n+a+l,i+d+s],[n+a+l+p,i+d+s+u]]).fill(g)}}r&&this._area.paths.rect(e.clientRect.left,e.clientRect.top,e.clientRect.width,e.clientRect.height).fillAndStroke(t.backgroundColor,this.InvisiblePen)};_CellRenderer.prototype._renderBooleanCell=function(e,t,r){if(!(!t.textRect||t.textRect.height<=0||t.textRect.width<=0)){var o=t.textRect.left,n=t.textRect.top,i=t.textRect.height;this._area.paths.rect(o,n,i,i).fillAndStroke(Color.fromRgba(255,255,255),new pdf.PdfPen(void 0,.5));if(!0===changeType(e,DataType.Boolean,"")){var l=i/20,s=i-.5-2*l,a=i/8;this._area.document.saveState();this._area.translate(o+.25+l,n+.25+l).paths.moveTo(a/2,.6*s).lineTo(s-.6*s,s-a).lineTo(s-a/2,a/2).stroke(new pdf.PdfPen(void 0,a));this._area.document.restoreState()}}};_CellRenderer.prototype._renderTextCell=function(e,t,r){!e||!t.textRect||t.textRect.height<=0||t.textRect.width<=0||this._area.drawText(e,t.textRect.left,t.textRect.top,{brush:r.color,font:r.font,height:t.textRect.height,width:t.textRect.width,align:"center"===r.textAlign?pdf.PdfTextHorizontalAlign.Center:"right"===r.textAlign?pdf.PdfTextHorizontalAlign.Right:"justify"===r.textAlign?pdf.PdfTextHorizontalAlign.Justify:pdf.PdfTextHorizontalAlign.Left})};_CellRenderer.prototype._calculateTextRect=function(e,t,r,o,n,i){if(null!=e&&!isString(e))return null;var l=n.clone();if(this._isBooleanCellAndValue(e,t,r,o)){var s=this._getTextLineHeight(i.font);switch(i.verticalAlign){case"middle":l.top=n.top+n.height/2-s/2;break;case"bottom":l.top=n.top+n.height-s}switch(i.textAlign){case"justify":case"center":l.left=n.left+n.width/2-s/2;break;case"right":l.left=n.left+n.width-s}l.height=l.width=s}else if(l.height>0&&l.width>0)switch(i.verticalAlign){case"bottom":if((d=this._area.measureText(e,i.font,{height:l.height,width:l.width})).size.height<l.height){var a=(u=this._area.document._document).currentLineHeight(!0)-u.currentLineHeight(!1);l.top+=l.height-d.size.height-a;l.height=d.size.height}break;case"middle":var d;if((d=this._area.measureText(e,i.font,{height:l.height,width:l.width})).size.height<l.height){var u;a=(u=this._area.document._document).currentLineHeight(!0)-u.currentLineHeight(!1);l.top+=l.height/2-(d.size.height-a)/2;l.height=d.size.height}}return l};_CellRenderer.prototype._getTextLineHeight=function(e){return this._area.lineHeight(e)};return _CellRenderer}();export{_CellRenderer};var GetMergedRangeProxy=function(){function GetMergedRangeProxy(e){this._columns={};this._flex=e}GetMergedRangeProxy.prototype.getMergedRange=function(e,t,r){var o=this._columns[r];if(o&&t>=o.topRow&&t<=o.bottomRow)return o;var n=this._flex.getMergedRange(e,t,r),i=e.columns,l=e.rows;if(n&&!n.isSingleCell&&(!i[n.col].isVisible||!i[n.col2].isVisible||!l[n.row].isVisible||!l[n.row2].isVisible)){n=n.clone();for(;n.col<n.col2&&!i[n.col].isVisible;)n.col++;for(;n.col2>n.col&&!i[n.col2].isVisible;)n.col2--;for(;n.row<n.row2&&!l[n.row].isVisible;)n.row++;for(;n.row2>n.row&&!l[n.row2].isVisible;)n.row2--}n&&n.isSingleCell&&(n=null);return this._columns[r]=n?new _CellRangeExt(e,n):null};return GetMergedRangeProxy}(),_CellRange=function(){function _CellRange(e,t,r,o){if("number"==typeof e){this._row=e;this._col=t;this._row2=r;this._col2=o}else{this._row=e.row;this._col=e.col;this._row2=e.row2;this._col2=e.col2}(this._row<0||this._row2<0)&&(this._row=this._row2=-1);(this._col<0||this._col2<0)&&(this._col=this._col2=-1)}Object.defineProperty(_CellRange.prototype,"row",{get:function(){return this._row},set:function(e){this._row=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"col",{get:function(){return this._col},set:function(e){this._col=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"row2",{get:function(){return this._row2},set:function(e){this._row2=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"col2",{get:function(){return this._col2},set:function(e){this._col2=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"topRow",{get:function(){return Math.min(this._row,this._row2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"bottomRow",{get:function(){return Math.max(this._row,this._row2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"leftCol",{get:function(){return Math.min(this._col,this._col2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"rightCol",{get:function(){return Math.max(this._col,this._col2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"columnSpan",{get:function(){return Math.abs(this._col2-this._col)+1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"rowSpan",{get:function(){return Math.abs(this._row2-this._row)+1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"isValid",{get:function(){return this._row>-1&&this._col>-1&&this._row2>-1&&this._col2>-1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"isSingleCell",{get:function(){return this._row===this._row2&&this._col===this._col2},enumerable:!0,configurable:!0});_CellRange.prototype.copyFrom=function(e){this.setRange(e.row,e.col,e.row2,e.col2)};_CellRange.prototype.clone=function(){return new _CellRange(this._row,this._col,this._row2,this._col2)};_CellRange.prototype.getRenderSize=function(e,t){var r=new Size(0,0);if(this.isValid){for(var o=this.topRow;o<=this.bottomRow;o++){var n=t.rows[o];e.isRenderableRow(n)&&(r.height+=n.renderHeight)}for(var i=this.leftCol;i<=this.rightCol;i++){var l=t.columns[i];e.isRenderableColumn(l)&&(r.width+=l.renderWidth)}}return r};_CellRange.prototype.setRange=function(e,t,r,o){void 0===e&&(e=-1);void 0===t&&(t=-1);void 0===r&&(r=e);void 0===o&&(o=t);this._row=asInt(e);this._col=asInt(t);this._row2=asInt(r);this._col2=asInt(o)};return _CellRange}();export{_CellRange};var _CellRangeExt=function(e){__extends(_CellRangeExt,e);function _CellRangeExt(t,r,o,n,i){var l=e.call(this,r,o,n,i)||this;l.firstVisibleRow=-1;l.visibleRowsCount=0;if(t){var s=l.topRow,a=l.bottomRow,d=t.rows.length;if(d>0)for(var u=s;u<=a&&u<d;u++)if(t.rows[u].isVisible){l.firstVisibleRow<0&&(l.firstVisibleRow=u);l.visibleRowsCount++}}return l}_CellRangeExt.prototype.copyFrom=function(t){e.prototype.copyFrom.call(this,t);this.firstVisibleRow=t.firstVisibleRow;this.visibleRowsCount=t.visibleRowsCount};_CellRangeExt.prototype.clone=function(){return new _CellRangeExt(null,this.row,this.col,this.row2,this.col2)};return _CellRangeExt}(_CellRange);export{_CellRangeExt};var _fc,RowRange=function(){function RowRange(e){this._ranges=e||[]}RowRange.prototype.length=function(){for(var e=0,t=0;t<this._ranges.length;t++){var r=this._ranges[t];r.isValid&&(e+=r.bottomRow-r.topRow+1)}return e};Object.defineProperty(RowRange.prototype,"isValid",{get:function(){return this._ranges.length&&this._ranges[0].isValid},enumerable:!0,configurable:!0});Object.defineProperty(RowRange.prototype,"leftCol",{get:function(){return this._ranges.length?this._ranges[0].leftCol:-1},enumerable:!0,configurable:!0});Object.defineProperty(RowRange.prototype,"rightCol",{get:function(){return this._ranges.length?this._ranges[0].rightCol:-1},enumerable:!0,configurable:!0});RowRange.prototype.clone=function(e,t){for(var r=[],o=0;o<this._ranges.length;o++){var n=this._ranges[o].clone();arguments.length>0&&(n.col=e);arguments.length>1&&(n.col2=t);r.push(n)}return new RowRange(r)};RowRange.prototype.getRenderSize=function(e,t){for(var r=new Size(0,0),o=0;o<this._ranges.length;o++){var n=this._ranges[o].getRenderSize(e,t);r.width=Math.max(r.width,n.width);r.height+=n.height}return r};RowRange.prototype.find=function(e,t){var r=null;this.forEach(e,(function(e){if(!0===t(e)){r=e;return!1}}));return r};RowRange.prototype.forEach=function(e,t){for(var r=0,o=!1,n=0;n<this._ranges.length&&!o;n++){var i=this._ranges[n];if(i.isValid)for(var l=i.topRow;l<=i.bottomRow&&!o;l++)o=!1===t(e.rows[l],i,l,r++)}};RowRange.prototype.subrange=function(e,t,r,o){var n=[];if(e>=0&&t>0)for(var i=0,l=0,s=0;s<this._ranges.length&&t>0;s++,i=l+1){var a=this._ranges[s];if(!(e>(l=i+(a.bottomRow-a.topRow)))){var d=e>i?a.topRow+(e-i):a.topRow,u=Math.min(a.bottomRow,d+t-1),p=arguments.length>2?r:a.leftCol,c=arguments.length>2?o:a.rightCol;n.push(new _CellRange(d,p,u,c));t-=u-d+1}}return new RowRange(n)};return RowRange}(),PdfPageRowRange=function(){function PdfPageRowRange(e,t,r){this._col=t;this._row=r;this._range=e}Object.defineProperty(PdfPageRowRange.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(PdfPageRowRange.prototype,"pageCol",{get:function(){return this._col},enumerable:!0,configurable:!0});Object.defineProperty(PdfPageRowRange.prototype,"pageRow",{get:function(){return this._row},enumerable:!0,configurable:!0});return PdfPageRowRange}(),FAKE_CELL="wj-pdf-fake-cell";function getFakeCell(e){if(!_fc){(_fc=document.createElement("div")).setAttribute(FAKE_CELL,"true");softGrid()&&_fc.setAttribute(softGrid().FlexGrid._WJS_MEASURE,"true")}var t=_fc.style;t.cssText="";t.position="absolute";t.overflow="hidden";t.width="1px";t.height="1px";t.clipPath="inset(100%)";t.clip="rect(0 0 0 0)";var r=e.hostElement,o=r.children.length?r.children[0]:r;_fc.parentNode!==o&&o.appendChild(_fc);return _fc}export function _removeFakeCell(){if(_fc){removeChild(_fc);_fc=null}}var FlexGridPdfConverter=function(){function FlexGridPdfConverter(){}FlexGridPdfConverter.draw=function(e,t,r,o,n){this.drawToPosition(e,t,null,r,o,n)};FlexGridPdfConverter.drawToPosition=function(e,t,r,o,n,i){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The doc argument cannot be null.");var l,s=softGrid()&&e instanceof softGrid().FlexGrid,a=e;try{i=_FlexGridPdfCoreConverter._applyDefaultDrawSettings(i);var d=e;if(s){if(i&&i.recalculateStarWidths){l=a.columns.getTotalSize();a.columns._updateStarSizes(pdf.ptToPx(t.width))}d=this._getFlexGridAdapter(a,i)}_FlexGridPdfCoreConverter.draw(d,t,r,o,n,i)}finally{_removeFakeCell();s&&i&&i.recalculateStarWidths&&a.columns._updateStarSizes(l)}};FlexGridPdfConverter.export=function(e,t,r){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The fileName argument cannot be empty.");var o=(r=this._applyDefaultExportSettings(r)).documentOptions.ended;r.documentOptions.ended=function(e,i){r.progress&&r.progress(1);o&&!1===o.apply(n,[e,i])||pdf.saveBlob(i.blob,t);e.dispose()};var n=new pdf.PdfDocument(r.documentOptions);this.drawToPosition(e,n,null,null,null,r);n.end()};FlexGridPdfConverter._getFlexGridAdapter=function(e,t){return new(softMultiRow()&&e instanceof softMultiRow().MultiRow&&MultiRowAdapter||softSheet()&&e instanceof softSheet().FlexSheet&&FlexSheetAdapter||softOlap()&&e instanceof softOlap().PivotGrid&&PivotGridAdapter||softTransposed()&&e instanceof softTransposed().TransposedGrid&&_TransposedGridAdapter||softTransposedMultiRow()&&e instanceof softTransposedMultiRow().TransposedMultiRow&&TransposedMultiRowAdapter||FlexGridAdapter)(e,t)};FlexGridPdfConverter._applyDefaultExportSettings=function(e){return _merge(_merge({},e),this._DefaultExportSettings)};FlexGridPdfConverter._DefaultExportSettings=_merge({scaleMode:ScaleMode.PageWidth,documentOptions:{compress:!1,pageSettings:{margins:{left:36,right:36,top:18,bottom:18}}},_progressMax:.9},_FlexGridPdfCoreConverter.DefaultDrawSettings);return FlexGridPdfConverter}();export{FlexGridPdfConverter};var PdfWebWorkerResponseStatus,FlexGridAdapter=function(){function FlexGridAdapter(e,t){this._defBorderColor=null;this._flex=e;this._settings=t;t.quickCellStyles&&(this._styleCache=new StyleCache(500))}Object.defineProperty(FlexGridAdapter.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"settings",{get:function(){return this._settings},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columns",{get:function(){return this._flex.columns},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"rows",{get:function(){return this._flex.rows},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"bottomLeftCells",{get:function(){return this._flex.bottomLeftCells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"cells",{get:function(){return this._flex.cells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columnFooters",{get:function(){return this._flex.columnFooters},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columnHeaders",{get:function(){return this._flex.columnHeaders},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"rowHeaders",{get:function(){return this._flex.rowHeaders},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"topLeftCells",{get:function(){return this._flex.topLeftCells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"treeIndent",{get:function(){return this._flex.treeIndent},enumerable:!0,configurable:!0});FlexGridAdapter.prototype.getSelection=function(){var e=[],t=this._flex.selection,r=softGrid();switch(this._flex.selectionMode){case r.SelectionMode.None:break;case r.SelectionMode.Cell:case r.SelectionMode.CellRange:e.push(new _CellRange(t.row,t.col,t.row2,t.col2));break;case r.SelectionMode.Row:e.push(new _CellRange(t.topRow,0,t.topRow,this._flex.cells.columns.length-1));break;case r.SelectionMode.RowRange:e.push(new _CellRange(t.topRow,0,t.bottomRow,this._flex.cells.columns.length-1));break;case r.SelectionMode.ListBox:for(var o=-1,n=0;n<this._flex.rows.length;n++){if(this._flex.rows[n].isSelected){o<0&&(o=n);n===this._flex.rows.length-1&&e.push(new _CellRange(o,0,n,this._flex.cells.columns.length-1))}else{o>=0&&e.push(new _CellRange(o,0,n-1,this._flex.cells.columns.length-1));o=-1}}}return e};FlexGridAdapter.prototype.getCell=function(e,t,r,o){var n=e.getCellElement(t,r);if(!n){n=getFakeCell(e);this._flex.cellFactory.updateCell(e,t,r,n,null,o)}return n};FlexGridAdapter.prototype.getComputedDefBorderColor=function(){if(null==this._defBorderColor){var e=window.getComputedStyle(this._flex.hostElement);this._defBorderColor="none"!=e.borderRightStyle?e.borderRightColor:"none"!=e.borderBottomStyle?e.borderBottomColor:"none"!=e.borderLeftStyle?e.borderLeftColor:"none"!=e.borderTopStyle?e.borderTopColor:"rgba(0,0,0,0.2)"}return this._defBorderColor};FlexGridAdapter.prototype.getComputedStyle=function(e,t){var r,o=null==t.getAttribute(FAKE_CELL),n=t.className,i=n.indexOf("wj-state-selected")>=0||n.indexOf("wj-state-multi-selected")>=0;i&&(t.className=n.replace("wj-state-selected","").replace("wj-state-multi-selected",""));if(this._styleCache){var l=e.hostElement,s=t.style.cssText.split(/;\s+/).filter((function(e){var t=e.substring(0,e.indexOf(":"));return/^(color|background-color|border-color|border-left-color|border-right-color|border-top-color|border-bottom-color|font|textAlign)/i.test(t)})).join(";"),a=t;do{s=a.className+s}while(a!==l&&(a=a.parentElement));if(!(r=this._styleCache.getValue(s))){r=window.getComputedStyle(t);r=this._styleCache.add(s,r)}}else r=_cloneStyle(window.getComputedStyle(t));o&&i&&(t.className=n);return r};FlexGridAdapter.prototype.getMergedRange=function(e,t,r){var o=this._flex.getMergedRange(e,t,r,!1);return o?new _CellRange(o.row,o.col,o.row2,o.col2):null};Object.defineProperty(FlexGridAdapter.prototype,"showColumnHeader",{get:function(){return!!(this._flex.headersVisibility&softGrid().HeadersVisibility.Column)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"showRowHeader",{get:function(){return!!(this._flex.headersVisibility&softGrid().HeadersVisibility.Row)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"showColumnFooter",{get:function(){return this._flex.columnFooters.rows.length>0},enumerable:!0,configurable:!0});FlexGridAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!1};FlexGridAdapter.prototype.getCellData=function(e,t,r){return e.getCellData(t,r,!0)};FlexGridAdapter.prototype.getCellContent=function(e,t,r,o){var n,i=softGrid();if(this.settings.customCellContent){var l=this.getCell(e,t.index,o,!0);!(n=(n=l.innerText.trim()).replace(/\r/gm,"").replace(/\n+/gm,"\n"))&&this.isBooleanCell(e,t,r)&&(n=null==(n=this._extractCheckboxValue(l))?"":n+"")}else{var s=r.isContentHtml;n=this.getCellData(e,t.index,o);if(this.isGroupRow(t)&&e.cellType===i.CellType.Cell&&r.index===e.columns.firstVisibleIndex){s=!0;n||(n=t.getGroupHeader())}s&&(n=toPlainText(n).trim())}return n};FlexGridAdapter.prototype.isBooleanCell=function(e,t,r){return r.dataType===DataType.Boolean&&e.cellType===softGrid().CellType.Cell&&(!this.isExpandableGroupRow(t)||r.visibleIndex>0)};FlexGridAdapter.prototype.getColumn=function(e,t,r){return e.columns[r]};FlexGridAdapter.prototype.isAlternatingRow=function(e){var t=!1,r=this._flex.alternatingRowStep;if(r){t=e.visibleIndex%(r+1)==0;1==r&&(t=!t)}return t};FlexGridAdapter.prototype.isGroupRow=function(e){return e instanceof softGrid().GroupRow};FlexGridAdapter.prototype.isNewRow=function(e){return e instanceof softGrid()._NewRowTemplate};FlexGridAdapter.prototype.isDetailRow=function(e){return softDetail()&&e instanceof softDetail().DetailRow};FlexGridAdapter.prototype.isExpandableGroupRow=function(e){return e instanceof softGrid().GroupRow&&e.hasChildren};FlexGridAdapter.prototype.isRenderableRow=function(e){return e.isVisible&&e.renderHeight>0&&!this.isNewRow(e)};FlexGridAdapter.prototype.isRenderableColumn=function(e){return e.isVisible&&e.renderWidth>0};FlexGridAdapter.prototype.getCellStyle=function(e,t,r){var o=this.settings.styles,n=_merge({},o.cellStyle),i=this._flex,l=softGrid();switch(e.cellType){case l.CellType.Cell:this.isExpandableGroupRow(t)?_merge(n,o.groupCellStyle,!0):this.isAlternatingRow(t)&&_merge(n,o.altCellStyle,!0);break;case l.CellType.ColumnHeader:case l.CellType.RowHeader:case l.CellType.TopLeft:case l.CellType.BottomLeft:_merge(n,o.headerCellStyle,!0);break;case l.CellType.ColumnFooter:_merge(n,o.headerCellStyle,!0);_merge(n,o.footerCellStyle,!0)}!this.settings.customCellContent&&i._getShowErrors()&&i._getError(e,t.index,r.index)&&_merge(n,o.errorCellStyle,!0);return n};FlexGridAdapter.prototype._extractCheckboxValue=function(e){var t=e.querySelector("input[type=checkbox]");if(t&&"none"!==t.style.display&&"hidden"!==t.style.visibility)return t.checked};return FlexGridAdapter}(),FlexSheetAdapter=function(e){__extends(FlexSheetAdapter,e);function FlexSheetAdapter(){return null!==e&&e.apply(this,arguments)||this}FlexSheetAdapter.prototype.getCellData=function(t,r,o){return t.cellType===softGrid().CellType.Cell?t.rows[r]instanceof softSheet().HeaderRow?this.flex.columnHeaders.getCellData(r,o,!0):this.flex.getCellValue(r,o,!0):e.prototype.getCellData.call(this,t,r,o)};FlexSheetAdapter.prototype.getCellStyle=function(t,r,o){var n=e.prototype.getCellStyle.call(this,t,r,o),i=this.flex.selectedSheet.findTable(r.index,o.index);if(i){var l=i.getRange(),s=r.index-l.topRow,a=o.index-l.leftCol,d=i._getTableCellAppliedStyles(s,a);d&&(d.font=new pdf.PdfFont(d.fontFamily,pdf._asPt(d.fontSize,!0,void 0),d.fontStyle,d.fontWeight));_merge(n,d,!0)}return n};Object.defineProperty(FlexSheetAdapter.prototype,"showColumnHeader",{get:function(){return!1},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheetAdapter.prototype,"showRowHeader",{get:function(){return!1},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheetAdapter.prototype,"showColumnFooter",{get:function(){return!1},enumerable:!0,configurable:!0});return FlexSheetAdapter}(FlexGridAdapter),MultiRowAdapter=function(e){__extends(MultiRowAdapter,e);function MultiRowAdapter(){return null!==e&&e.apply(this,arguments)||this}MultiRowAdapter.prototype.getColumn=function(t,r,o){return _combineColumns(e.prototype.getColumn.call(this,t,r,o),this.flex.getBindingColumn(t,r,o))};MultiRowAdapter.prototype.isAlternatingRow=function(t){if(t instanceof softMultiRow()._MultiRow){var r=!1,o=this.flex.alternatingRowStep;if(o){r=t.dataIndex%(o+1)==0;1==o&&(r=!r)}return r}return e.prototype.isAlternatingRow.call(this,t)};return MultiRowAdapter}(FlexGridAdapter),PivotGridAdapter=function(e){__extends(PivotGridAdapter,e);function PivotGridAdapter(){return null!==e&&e.apply(this,arguments)||this}PivotGridAdapter.prototype.alignMergedTextToTheTopRow=function(e){var t=softGrid();return!this.flex.centerHeadersVertically&&(e.cellType===t.CellType.ColumnHeader||e.cellType===t.CellType.RowHeader)};return PivotGridAdapter}(FlexGridAdapter),_TransposedGridAdapter=function(e){__extends(_TransposedGridAdapter,e);function _TransposedGridAdapter(){return null!==e&&e.apply(this,arguments)||this}_TransposedGridAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!=softGrid().CellType.Cell)return n;var i=t.grid._getBindingColumn(t,r,n);return i?_combineColumns(n,i):n};return _TransposedGridAdapter}(FlexGridAdapter),TransposedMultiRowAdapter=function(e){__extends(TransposedMultiRowAdapter,e);function TransposedMultiRowAdapter(){return null!==e&&e.apply(this,arguments)||this}TransposedMultiRowAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!=softGrid().CellType.Cell)return n;var i=this.flex.getBindingColumn(t,r,o);return i?_combineColumns(n,i):n};return TransposedMultiRowAdapter}(FlexGridAdapter),StyleCache=function(){function StyleCache(e){this._cache={};this._size=0;this._max=e}StyleCache.prototype.add=function(e,t){this._size>=this._max&&this.clear();var r=this._cache[e]=_cloneStyle(t);this._size++;return r};StyleCache.prototype.clear=function(){this._cache={};this._size=0};StyleCache.prototype.getValue=function(e){return this._cache[e]||null};StyleCache.prototype.hasKey=function(e){return!!this._cache[e]};return StyleCache}();!function(e){e[e.Done=1]="Done";e[e.Progress=2]="Progress"}(PdfWebWorkerResponseStatus||(PdfWebWorkerResponseStatus={}));var DefGridName="",PdfWebWorkerExportDoneEventArgs=function(e){__extends(PdfWebWorkerExportDoneEventArgs,e);function PdfWebWorkerExportDoneEventArgs(t){var r=e.call(this)||this;r._buf=t;return r}Object.defineProperty(PdfWebWorkerExportDoneEventArgs.prototype,"blob",{get:function(){this._blob||(this._blob=new Blob([new Uint8Array(this._buf)],{type:"application/pdf"}));return this._blob},enumerable:!0,configurable:!0});Object.defineProperty(PdfWebWorkerExportDoneEventArgs.prototype,"buffer",{get:function(){return this._buf},enumerable:!0,configurable:!0});return PdfWebWorkerExportDoneEventArgs}(EventArgs);export{PdfWebWorkerExportDoneEventArgs};var PdfWebWorkerClient=function(){function PdfWebWorkerClient(){}PdfWebWorkerClient.exportGrid=function(e,t,r,o,n,i){(o=FlexGridPdfConverter._applyDefaultExportSettings(o)).progress=o.progress||i;this.addGrid(e,t,DefGridName,o);this.export(e,o.documentOptions,(function(e){isFunction(n)&&!1===n(e)||pdf.saveBlob(e.blob,r)}),i)};PdfWebWorkerClient.export=function(e,t,r,o){e.addEventListener("message",(function handler(t){var n=t.data;switch(n.status){case PdfWebWorkerResponseStatus.Done:e.removeEventListener("message",handler);isFunction(r)&&r(new PdfWebWorkerExportDoneEventArgs(n.data));break;case PdfWebWorkerResponseStatus.Progress:o&&o(n.data);break;default:throw"Unknown status: "+n.status}}));var n=this._clientDataToArrayBuffer(e);e.postMessage({content:n,settings:t},[n]);this._clearClientData(e)};PdfWebWorkerClient.addGrid=function(e,t,r,o){var n=this._gridToJson(t,o);this._addClientData(e,JSON.stringify(n),r,o,!0)};PdfWebWorkerClient.addImage=function(e,t,r,o){var n=isString(t)&&t.indexOf("data:image/svg")>=0?t:pdf._PdfImageHelper.getDataUri(t);this._addClientData(e,n,r,o)};PdfWebWorkerClient.addString=function(e,t,r){this._addClientData(e,t,r,null)};PdfWebWorkerClient.serializeGrid=function(e,t){var r=this._gridToJson(e,t);return strToBuf(JSON.stringify(r))};PdfWebWorkerClient._addClientData=function(e,t,r,o,n){void 0===n&&(n=!1);asType(e,Worker);asString(r);asString(t,!0);var i=e;i.clientData=i.clientData||{};i.clientData[r]={content:t,settings:o?JSON.stringify(o):null};var l=i.clientData[r];if(n){l.isGrid=!0;l.progressMessaging=!!o&&isFunction(o.progress)}};PdfWebWorkerClient._clearClientData=function(e){delete e.clientData};PdfWebWorkerClient._clientDataToArrayBuffer=function(e){var t=e;return strToBuf(JSON.stringify(t.clientData||{}))};PdfWebWorkerClient._gridToJson=function(e,t){t=FlexGridPdfConverter._applyDefaultExportSettings(t);var r,o;try{r=new pdf.PdfDocument(t.documentOptions);if(t&&t.recalculateStarWidths){o=e.columns.getTotalSize();e.columns._updateStarSizes(pdf.ptToPx(r.width))}return this._getJsonConverter(e,t).convert()}finally{_removeFakeCell();t&&t.recalculateStarWidths&&e.columns._updateStarSizes(o);if(null!=r){r.dispose();r=null}}};PdfWebWorkerClient._getJsonConverter=function(e,t){return new(softMultiRow()&&e instanceof softMultiRow().MultiRow&&MultiRowJsonConverter||softOlap()&&e instanceof softOlap().PivotGrid&&PivotGridJsonConverter||softTransposed()&&e instanceof softTransposed().TransposedGrid&&TransposedGridJsonConverter||softTransposedMultiRow()&&e instanceof softTransposedMultiRow().TransposedMultiRow&&TransposedMultirowJsonConverter||FlexGridJsonConverter)(e,t,FlexGridPdfConverter._getFlexGridAdapter(e,t))};return PdfWebWorkerClient}();export{PdfWebWorkerClient};var RowState,ColState,PdfWebWorker=function(){function PdfWebWorker(){}PdfWebWorker.initExportGrid=function(){var e=this;this.initExport((function(t,r){var o=r[DefGridName];if(o.progressMessaging){o.settings._progressMax=FlexGridPdfConverter._DefaultExportSettings._progressMax;o.settings.progress=function(t){e.sendExportProgress(t)};t.ended.addHandler((function(){e.sendExportProgress(1)}))}FlexGridPdfConverter.draw(o.content,t,null,null,o.settings);t.end()}))};PdfWebWorker.initExport=function(e){self.addEventListener("message",(function handler(t){self.removeEventListener("message",handler);var r=t.data,o=JSON.parse(bufToStr(r.content)),n=r.settings||{};n.ended=function(e,t){blobToBuf(t.blob,(function(e){self.postMessage({data:e,status:PdfWebWorkerResponseStatus.Done},[e])}))};var i=new pdf.PdfDocument(n);Object.keys(o).forEach((function(e){var t=o[e];t.settings&&(t.settings=JSON.parse(t.settings));if(t.isGrid){t.settings&&PdfWebWorker._disableUnsupportedFeatures(t.settings);t.content=PdfWebWorker._deserializeGridFromString(t.content,t.settings)}}));e(i,o)}))};PdfWebWorker.sendExportProgress=function(e){e=clamp(e,0,1);self.postMessage({data:e,status:PdfWebWorkerResponseStatus.Progress})};PdfWebWorker.deserializeGrid=function(e,t){return this._deserializeGridFromString(bufToStr(e),t)};PdfWebWorker._deserializeGridFromString=function(e,t){return this._getJsonAdapter(JSON.parse(e),FlexGridPdfConverter._applyDefaultExportSettings(t))};PdfWebWorker._disableUnsupportedFeatures=function(e){e.customCellContent=!1};PdfWebWorker._getJsonAdapter=function(e,t){switch(e.typeName){case"MultiRow":return new MultiRowJsonAdapter(e,t);case"PivotGrid":return new PivotGridJsonAdapter(e,t);case"TransposedGrid":return new TransposedGridJsonAdapter(e,t);case"TransposedMultiRow":return new TransposedMultiRowJsonAdapter(e,t);default:return new FlexGridJsonAdapter(e,t)}};return PdfWebWorker}();export{PdfWebWorker};function bufToStr(e){for(var t=new Uint16Array(e),r="",o=0,n=t.length;o<n;o++)r+=String.fromCharCode(t[o]);return r}function strToBuf(e){for(var t=new ArrayBuffer(2*e.length),r=new Uint16Array(t),o=0,n=e.length;o<n;o++)r[o]=e.charCodeAt(o);return t}function blobToBuf(e,t){asFunction(t);var r=new FileReader;r.onload=function(e){t(e.target.result)};r.readAsArrayBuffer(e)}!function(e){e[e.None=0]="None";e[e.Alternate=1]="Alternate";e[e.Group=2]="Group";e[e.ExpandableGroup=4]="ExpandableGroup";e[e.New=8]="New";e[e.Visible=16]="Visible";e[e.Detail=32]="Detail"}(RowState||(RowState={}));!function(e){e[e.None=0]="None";e[e.Visible=1]="Visible"}(ColState||(ColState={}));var FlexGridJsonConverter=function(){function FlexGridJsonConverter(e,t,r){this._flex=e;this._settings=t;this._adapter=r}FlexGridJsonConverter.prototype.convert=function(){var e={};e.typeName=this._getTypeName(this._flex);e.selection=this._serializeSelection();e.showColumnFooter=this.adapter.showColumnFooter;e.showColumnHeader=this.adapter.showColumnHeader;e.showRowHeader=this.adapter.showRowHeader;e.treeIndent=this._flex.treeIndent;e.bottomLeftCells=this._serializePanel(this._flex.bottomLeftCells);e.cells=this._serializePanel(this._flex.cells);e.columnFooters=this._serializePanel(this._flex.columnFooters);e.columnHeaders=this._serializePanel(this._flex.columnHeaders);e.rowHeaders=this._serializePanel(this._flex.rowHeaders);e.topLeftCells=this._serializePanel(this._flex.topLeftCells);return e};Object.defineProperty(FlexGridJsonConverter.prototype,"adapter",{get:function(){return this._adapter},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridJsonConverter.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});FlexGridJsonConverter.prototype._getTypeName=function(e){return e.constructor.toString().match(/function\s*(\w+)/)[1]};FlexGridJsonConverter.prototype._getRowState=function(e){var t=RowState.None;this.adapter.isAlternatingRow(e)&&(t|=RowState.Alternate);e instanceof softGrid().GroupRow&&(t|=RowState.Group);this.adapter.isDetailRow(e)&&(t|=RowState.Detail);this.adapter.isExpandableGroupRow(e)&&(t|=RowState.ExpandableGroup);e instanceof softGrid()._NewRowTemplate&&(t|=RowState.New);e.isVisible&&(t|=RowState.Visible);return t};FlexGridJsonConverter.prototype._getColumnState=function(e){var t=ColState.None;e.isVisible&&(t|=ColState.Visible);return t};FlexGridJsonConverter.prototype._serializeSelection=function(){for(var e=this.adapter.getSelection(),t=[],r=0;r<e.length;r++){var o=e[r];t.push([o.row,o.col,o.row2,o.col2])}return t};FlexGridJsonConverter.prototype._serializeColumns=function(e){for(var t=[],r=0,o=(e||[]).length;r<o;r++){var n=e[r],i=null;if(n){i={aggregate:n.aggregate,renderWidth:n.renderWidth,visibleIndex:n.visibleIndex};var l=n.getAlignment();l&&(i.alignment=l);var s=this._getColumnState(n);s!==ColState.None&&(i.state=s);n.binding&&(i.binding=n.binding);null!=n.dataType&&(i.dataType=n.dataType);null!=n.name&&(i.name=n.name);n.wordWrap&&(i.wordWrap=!0);n.multiLine&&(i.multiLine=!0)}t.push(i)}return t};FlexGridJsonConverter.prototype._serializePanel=function(e){var t=this,r={cellType:e.cellType,height:e.height,width:e.width};r.mergedRanges=this._serializeMergedRanges(e);r.columns=this._serializeColumns(e.columns);r.columnsFirstVisibleIndex=e.columns.firstVisibleIndex;r.rows=[];r.rowsMaxGroupLevel=e.rows.maxGroupLevel;for(var o=!this._settings.customCellContent&&this._flex._getShowErrors(),_loop_1=function(i,l,s){var a=e.rows[i],d={renderHeight:a.renderHeight};r.rows.push(d);var u=function(e){if(e.align)return e.align;if(!e.dataMap)switch(e.dataType){case DataType.Boolean:return"center";case DataType.Number:return"right"}return null}(a);u&&(d.alignment=u);a instanceof softGrid().GroupRow&&(d.level=a.level);var p=n._getRowState(a);p!==RowState.None&&(d.state=p);a.binding&&(d.binding=a.binding);null!=a.dataType&&(d.dataType=a.dataType);a.wordWrap&&(d.wordWrap=!0);a.multiLine&&(d.multiLine=!0);d.cells=[];for(var c=softGrid(),_loop_2=function(r){var l=n._adapter.getCellContent(e,e.rows[i],e.columns[r],r);if(isFunction(n._settings.formatItem)){var s=new PdfFormatItemEventArgs(e,new c.CellRange(i,r),null,null,null,null,null,(function(){return t._adapter.getCell(e,i,r,!0)}),null);s.data=l;n._settings.formatItem(s);s.data!==l&&(l=s.data)}d.cells[r]=l;if(o&&n._flex._getError(e,i,r)){d.errors||(d.errors={});d.errors[r]=1}},f=0;f<s;f++)_loop_2(f)},n=this,i=0,l=e.rows.length,s=e.columns.length;i<l;i++)_loop_1(i,0,s);return r};FlexGridJsonConverter.prototype._serializeMergedRanges=function(e){for(var t=[],r=[],o=0;o<e.columns.length;o++)r[o]=0;for(var n=0;n<e.rows.length;n++)for(var i=0;i<e.columns.length;i++)if(!(n<r[i])){var l=e.grid.getMergedRange(e,n,i);if(null!=l&&!l.isSingleCell){t.push([l.row,l.col,l.row2,l.col2]);for(var s=l.col;s<=l.col2;s++)r[s]=l.row2+1;l.col===l.col2||(i=l.col2)}}return t};return FlexGridJsonConverter}(),MultiRowJsonConverter=function(e){__extends(MultiRowJsonConverter,e);function MultiRowJsonConverter(){return null!==e&&e.apply(this,arguments)||this}MultiRowJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.rowsPerItem=this.flex.rowsPerItem;return t};MultiRowJsonConverter.prototype._serializePanel=function(t){var r=e.prototype._serializePanel.call(this,t);r.cellGroups=this._serializeCellGroup(t);return r};MultiRowJsonConverter.prototype._serializeCellGroup=function(e){var t=[],r=[],o=softGrid(),n=this.flex.rowsPerItem;e.cellType!==o.CellType.TopLeft&&e.cellType!==o.CellType.ColumnHeader||(n=e.rows.length);for(var i=0;i<n;i++){r[i]=[];for(var l=0;l<e.columns.length;l++){var s=this.flex.getBindingColumn(e,i,l),a=t.indexOf(s);r[i][l]=a<0?t.push(s)-1:a}}return{bindingColumns:this._serializeColumns(t),mappings:r}};return MultiRowJsonConverter}(FlexGridJsonConverter),PivotGridJsonConverter=function(e){__extends(PivotGridJsonConverter,e);function PivotGridJsonConverter(){return null!==e&&e.apply(this,arguments)||this}PivotGridJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.centerHeadersVertically=this.flex.centerHeadersVertically;return t};return PivotGridJsonConverter}(FlexGridJsonConverter),TransposedGridJsonConverter=function(e){__extends(TransposedGridJsonConverter,e);function TransposedGridJsonConverter(){return null!==e&&e.apply(this,arguments)||this}TransposedGridJsonConverter.prototype.convert=function(){for(var t=e.prototype.convert.call(this),r=new Array(this.flex.cells.rows.length),o=this.flex.cells,n=softGrid(),i=0,l=o.rows.length;i<l;i++){var s=o.rows[i].dataItem,a=s&&s._rowInfo;a instanceof n.Column||(a=_combineColumns(a,a));r[i]=a}t.rowInfo=this._serializeColumns(r);return t};return TransposedGridJsonConverter}(FlexGridJsonConverter),TransposedMultirowJsonConverter=function(e){__extends(TransposedMultirowJsonConverter,e);function TransposedMultirowJsonConverter(){return null!==e&&e.apply(this,arguments)||this}TransposedMultirowJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.cellGroups=this._serializeCellGroup();t.columnsPerItem=this.flex.columnsPerItem;return t};TransposedMultirowJsonConverter.prototype._serializeCellGroup=function(){for(var e=[],t=[],r=this.flex.columnsPerItem,o=this.flex.cells,n=0;n<o.rows.length;n++){t[n]=[];for(var i=0;i<r;i++){var l=this.flex.getBindingColumn(o,n,i),s=e.indexOf(l);t[n][i]=s<0?e.push(l)-1:s}}return{bindingColumns:this._serializeColumns(e),mappings:t}};return TransposedMultirowJsonConverter}(FlexGridJsonConverter),RowJson=function(){function RowJson(e,t){this.index=t;this.binding=e.binding;this.dataType=e.dataType;this.alignment=e.alignment;this.level=e.level;this.renderHeight=e.renderHeight;this.cells=e.cells;this.wordWrap=e.wordWrap||!1;this.multiLine=e.multiLine||!1;this.errors=e.errors;this._state=e.state}Object.defineProperty(RowJson.prototype,"isAlternatingRow",{get:function(){return(this._state&RowState.Alternate)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isGroupRow",{get:function(){return(this._state&RowState.Group)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isDetailRow",{get:function(){return(this._state&RowState.Detail)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isExpandableGroupRow",{get:function(){return(this._state&RowState.ExpandableGroup)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isNewRow",{get:function(){return(this._state&RowState.New)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isVisible",{get:function(){return(this._state&RowState.Visible)!==RowState.None},enumerable:!0,configurable:!0});return RowJson}(),ColumnJson=function(){function ColumnJson(e,t){this.index=t;this.binding=e.binding;this.dataType=e.dataType;this.aggregate=e.aggregate;this.name=e.name;this.renderWidth=e.renderWidth;this.visibleIndex=e.visibleIndex;this.wordWrap=e.wordWrap||!1;this.multiLine=e.multiLine||!1;this._alignment=e.alignment;this._state=e.state}ColumnJson.prototype.getAlignment=function(e){return this._alignment?this._alignment:e&&e.alignment?e.alignment:""};Object.defineProperty(ColumnJson.prototype,"isVisible",{get:function(){return(this._state&ColState.Visible)!==ColState.None},enumerable:!0,configurable:!0});return ColumnJson}(),RowJsonCollection=function RowJsonCollection(e,t){void 0===t&&(t=-1);this.maxGroupLevel=t;this.length=e.length;for(var r=0;r<e.length;r++)this[r]=new RowJson(e[r],r)},ColumnJsonCollection=function ColumnJsonCollection(e,t){void 0===t&&(t=-1);this.firstVisibleIndex=t;this.length=e.length;for(var r=0;r<e.length;r++){var o=e[r];this[r]=o?new ColumnJson(e[r],r):null}},GridJsonPanel=function(){function GridJsonPanel(e){this.height=e.height;this.width=e.width;this.cellType=e.cellType;this.columns=new ColumnJsonCollection(e.columns,e.columnsFirstVisibleIndex);this.rows=new RowJsonCollection(e.rows,e.rowsMaxGroupLevel);this._mergedRanges=this._deserializeMergedRanges(e.mergedRanges)}GridJsonPanel.prototype.getCellData=function(e,t){return this.rows[e].cells[t]};GridJsonPanel.prototype.getMergedRange=function(e,t){var r=this._mergedRanges[e];if(r)for(var o=0,n=r.length;o<n;o++){var i=r[o];if(t>=i.col&&t<=i.col2)return i}return null};GridJsonPanel.prototype._deserializeMergedRanges=function(e){var t=[];e=e||[];for(var r=0,o=this.rows.length;r<o;r++)t[r]=[];for(r=0,o=e.length;r<o;r++)for(var n=e[r],i=new _CellRange(n[0],n[1],n[2],n[3]),l=i.row;l<=i.row2;l++)t[l].push(i);return t};return GridJsonPanel}(),FlexGridJsonAdapter=function(){function FlexGridJsonAdapter(e,t){this.settings=t;this.bottomLeftCells=this.deserializePanel(e.bottomLeftCells);this.cells=this.deserializePanel(e.cells);this.columnFooters=this.deserializePanel(e.columnFooters);this.columnHeaders=this.deserializePanel(e.columnHeaders);this.rowHeaders=this.deserializePanel(e.rowHeaders);this.topLeftCells=this.deserializePanel(e.topLeftCells);this.treeIndent=e.treeIndent;this.showColumnFooter=e.showColumnFooter;this.showColumnHeader=e.showColumnHeader;this.showRowHeader=e.showRowHeader;this._selection=[];for(var r=0;r<e.selection.length;r++){var o=e.selection[r];this._selection.push(new _CellRange(o[0],o[1],o[2],o[3]))}}Object.defineProperty(FlexGridJsonAdapter.prototype,"columns",{get:function(){return this.cells.columns},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridJsonAdapter.prototype,"rows",{get:function(){return this.cells.rows},enumerable:!0,configurable:!0});FlexGridJsonAdapter.prototype.getSelection=function(){return this._selection};FlexGridJsonAdapter.prototype.getCell=function(e,t,r,o){throw"Not implemented"};FlexGridJsonAdapter.prototype.getComputedDefBorderColor=function(){throw"Not implemented"};FlexGridJsonAdapter.prototype.getComputedStyle=function(e,t){throw"Not implemented"};FlexGridJsonAdapter.prototype.getMergedRange=function(e,t,r){return e.getMergedRange(t,r)};FlexGridJsonAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!1};FlexGridJsonAdapter.prototype.getCellData=function(e,t,r){return e.getCellData(t,r)};FlexGridJsonAdapter.prototype.getCellContent=function(e,t,r,o){return this.getCellData(e,t.index,o)};FlexGridJsonAdapter.prototype.isBooleanCell=function(e,t,r){return r.dataType===DataType.Boolean&&e.cellType===_CellType.Cell&&!this.isExpandableGroupRow(t)};FlexGridJsonAdapter.prototype.getColumn=function(e,t,r){return e.columns[r]};FlexGridJsonAdapter.prototype.isAlternatingRow=function(e){return e.isAlternatingRow};FlexGridJsonAdapter.prototype.isGroupRow=function(e){return e.isGroupRow};FlexGridJsonAdapter.prototype.isNewRow=function(e){return e.isNewRow};FlexGridJsonAdapter.prototype.isDetailRow=function(e){return e.isDetailRow};FlexGridJsonAdapter.prototype.isExpandableGroupRow=function(e){return e.isExpandableGroupRow};FlexGridJsonAdapter.prototype.isRenderableRow=function(e){return e.isVisible&&e.renderHeight>0&&!this.isNewRow(e)};FlexGridJsonAdapter.prototype.isRenderableColumn=function(e){return e.isVisible&&e.renderWidth>0};FlexGridJsonAdapter.prototype.getCellStyle=function(e,t,r){var o=this.settings.styles,n=_merge({},o.cellStyle);switch(e.cellType){case _CellType.Cell:this.isExpandableGroupRow(t)?_merge(n,o.groupCellStyle,!0):this.isAlternatingRow(t)&&_merge(n,o.altCellStyle,!0);break;case _CellType.ColumnHeader:case _CellType.RowHeader:case _CellType.TopLeft:case _CellType.BottomLeft:_merge(n,o.headerCellStyle,!0);break;case _CellType.ColumnFooter:_merge(n,o.headerCellStyle,!0);_merge(n,o.footerCellStyle,!0)}t.errors&&t.errors[r.index]&&_merge(n,o.errorCellStyle,!0);return n};FlexGridJsonAdapter.prototype.deserializePanel=function(e){return new GridJsonPanel(e)};return FlexGridJsonAdapter}(),PivotGridJsonAdapter=function(e){__extends(PivotGridJsonAdapter,e);function PivotGridJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._centerHeadersVertically=t.centerHeadersVertically;return o}PivotGridJsonAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!this._centerHeadersVertically&&(e.cellType===_CellType.ColumnHeader||e.cellType===_CellType.RowHeader)};return PivotGridJsonAdapter}(FlexGridJsonAdapter),MultiRowJsonPanel=function(e){__extends(MultiRowJsonPanel,e);function MultiRowJsonPanel(t){var r=e.call(this,t)||this;t.cellGroups&&(r._cellGroups={bindingColumns:new ColumnJsonCollection(t.cellGroups.bindingColumns),mappings:t.cellGroups.mappings});return r}MultiRowJsonPanel.prototype.getColumn=function(e,t,r){var o=this.columns[t];if(this._cellGroups){this.cellType!==_CellType.ColumnHeader&&this.cellType!==_CellType.BottomLeft&&(e%=r);return _combineColumns(o,this._cellGroups.bindingColumns[this._cellGroups.mappings[e][t]])}return o};return MultiRowJsonPanel}(GridJsonPanel),MultiRowJsonAdapter=function(e){__extends(MultiRowJsonAdapter,e);function MultiRowJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._rowsPerItem=t.rowsPerItem;return o}MultiRowJsonAdapter.prototype.deserializePanel=function(e){return new MultiRowJsonPanel(e)};MultiRowJsonAdapter.prototype.getColumn=function(e,t,r){return e.getColumn(t,r,this._rowsPerItem)};return MultiRowJsonAdapter}(FlexGridJsonAdapter),TransposedGridJsonAdapter=function(e){__extends(TransposedGridJsonAdapter,e);function TransposedGridJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._rowInfo=new ColumnJsonCollection(t.rowInfo);return o}TransposedGridJsonAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!==_CellType.Cell)return n;var i=this._rowInfo[r];return i?_combineColumns(n,i):n};return TransposedGridJsonAdapter}(FlexGridJsonAdapter),TransposedMultiRowJsonAdapter=function(e){__extends(TransposedMultiRowJsonAdapter,e);function TransposedMultiRowJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._columnsPerItem=t.columnsPerItem;t.cellGroups&&(o._cellGroups={bindingColumns:new ColumnJsonCollection(t.cellGroups.bindingColumns),mappings:t.cellGroups.mappings});return o}TransposedMultiRowJsonAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(this._cellGroups&&t.cellType===_CellType.Cell){o%=this._columnsPerItem;return _combineColumns(n,this._cellGroups.bindingColumns[this._cellGroups.mappings[r][o]])}return n};return TransposedMultiRowJsonAdapter}(FlexGridJsonAdapter);_registerModule("wijmo.grid.pdf",selfModule);