UNPKG

31.8 kBJavaScriptView Raw
1/*!
2 *
3 * jsPDF AutoTable plugin v3.3.2
4 *
5 * Copyright (c) 2014 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
6 * Licensed under the MIT License.
7 * http://opensource.org/licenses/mit-license
8 *
9 */
10!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(function(){try{return require("jspdf")}catch(t){}}());else if("function"==typeof define&&define.amd)define(["jspdf"],e);else{var n="object"==typeof exports?e(function(){try{return require("jspdf")}catch(t){}}()):e(t.jsPDF);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,function(o){return i={},r.m=n=[function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o,r=null,i=null;n.globalDefaults={},n.documentDefaults={},n.default=function(){return i},n.getGlobalOptions=function(){return n.globalDefaults},n.getDocumentOptions=function(){return n.documentDefaults};var l=(a.prototype.pageHeight=function(){return this.pageSize().height},a.prototype.pageWidth=function(){return this.pageSize().width},a.prototype.pageSize=function(){var t=this.doc.internal.pageSize;return null==t.width&&(t={width:t.getWidth(),height:t.getHeight()}),t},a.prototype.scaleFactor=function(){return this.doc.internal.scaleFactor},a.prototype.pageNumber=function(){var t=this.doc.internal.getCurrentPageInfo();return t?t.pageNumber:this.doc.internal.getNumberOfPages()},a);function a(t){this.doc=t}n.setupState=function(t){o=i,i=new l(t),t!==r&&(r=t,n.documentDefaults={})},n.resetState=function(){i=o},n.setDefaults=function(t,e){void 0===e&&(e=null),e?(n.documentDefaults=t||{},r=e):n.globalDefaults=t||{}}},function(t,e,n){"use strict";var o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),r=0;for(e=0;e<n;e++)for(var i=arguments[e],l=0,a=i.length;l<a;l++,r++)o[r]=i[l];return o};Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),a=n(0),i=n(5);function s(t,e){d(e);var n=(Array.isArray(t)?t:[t]).map(function(t){return a.default().doc.getTextWidth(t)}).map(function(t){return Math.floor(1e4*t)/1e4}).reduce(function(t,e){return Math.max(t,e)},0);e.fontSize,a.default().scaleFactor();return n}function l(t){var e=0<t.lineWidth,n=t.fillColor||0===t.fillColor;return e&&n?"DF":e?"S":!!n&&"F"}function d(o){var t=a.default().doc,r={fillColor:t.setFillColor,textColor:t.setTextColor,fontStyle:t.setFontStyle,lineColor:t.setDrawColor,lineWidth:t.setLineWidth,font:t.setFont,fontSize:t.setFontSize};Object.keys(r).forEach(function(t){var e=o[t],n=r[t];void 0!==e&&(Array.isArray(e)?n.apply(this,e):n(e))})}e.getStringWidth=s,e.ellipsize=function n(t,o,r,i){if(void 0===i&&(i="..."),Array.isArray(t)){var l=[];return t.forEach(function(t,e){l[e]=n(t,o,r,i)}),l}var e=1e4*a.default().scaleFactor();if((o=Math.ceil(o*e)/e)>=s(t,r))return t;for(;o<s(t+i,r)&&!(t.length<=1);)t=t.substring(0,t.length-1);return t.trim()+i},e.addTableBorder=function(){var t=a.default().table,e={lineWidth:t.settings.tableLineWidth,lineColor:t.settings.tableLineColor};d(e);var n=l(e);n&&a.default().doc.rect(t.pageStartX,t.pageStartY,t.width,t.cursor.y-t.pageStartY,n)},e.getFillStyle=l,e.applyUserStyles=function(){d(a.default().table.userStyles)},e.applyStyles=d,e.marginOrPadding=function(t,e){var n={};if(Array.isArray(t))4<=t.length?n={top:t[0],right:t[1],bottom:t[2],left:t[3]}:3===t.length?n={top:t[0],right:t[1],bottom:t[2],left:t[1]}:2===t.length?n={top:t[0],right:t[1],bottom:t[0],left:t[1]}:t=1===t.length?t[0]:e;else if("object"==typeof t){t.vertical&&(t.top=t.vertical,t.bottom=t.vertical),t.horizontal&&(t.right=t.horizontal,t.left=t.horizontal);for(var o=0,r=["top","right","bottom","left"];o<r.length;o++){var i=r[o];n[i]=t[i]||0===t[i]?t[i]:e}}return"number"==typeof t&&(n={top:t,right:t,bottom:t,left:t}),n},e.styles=function(t){return t=Array.isArray(t)?t:[t],i.assign.apply(void 0,o([r.defaultStyles()],t))},e.entries=function(t){for(var e=Object.keys(t),n=e.length,o=new Array(n);n--;)o[n]=[e[n],t[e[n]]];return o}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FONT_ROW_RATIO=1.15;var o=n(0);e.defaultConfig=function(){return{html:null,head:null,body:null,foot:null,includeHiddenHtml:!1,startY:null,margin:40/o.default().scaleFactor(),pageBreak:"auto",rowPageBreak:"auto",tableWidth:"auto",showHead:"everyPage",showFoot:"everyPage",tableLineWidth:0,tableLineColor:200,tableId:null,theme:"striped",useCss:!1,styles:{},headStyles:{},bodyStyles:{},footStyles:{},alternateRowStyles:{},columnStyles:{},didParseCell:function(t){},willDrawCell:function(t){},didDrawCell:function(t){},didDrawPage:function(t){}}},e.defaultStyles=function(){return{font:"helvetica",fontStyle:"normal",overflow:"linebreak",fillColor:!1,textColor:20,halign:"left",valign:"top",fontSize:10,cellPadding:5/o.default().scaleFactor(),lineColor:200,lineWidth:0/o.default().scaleFactor(),cellWidth:"auto",minCellHeight:0}},e.getTheme=function(t){return{striped:{table:{fillColor:255,textColor:80,fontStyle:"normal"},head:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},body:{},foot:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1},head:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},body:{},foot:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},alternateRow:{}},plain:{head:{fontStyle:"bold"},foot:{fontStyle:"bold"}}}[t]}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n,o,r){o=o||{},"number"==typeof e&&"number"==typeof n||console.error("The x and y parameters are required. Missing for text: ",t);var i=r.internal.scaleFactor,l=r.internal.getFontSize()/i,a=null,s=1;if("middle"!==o.valign&&"bottom"!==o.valign&&"center"!==o.halign&&"right"!==o.halign||(s=(a="string"==typeof t?t.split(/\r\n|\r|\n/g):t).length||1),n+=l*(2-1.15),"middle"===o.valign?n-=s/2*l*1.15:"bottom"===o.valign&&(n-=s*l*1.15),"center"===o.halign||"right"===o.halign){var d=l;if("center"===o.halign&&(d*=.5),a&&1<=s){for(var u=0;u<a.length;u++)r.text(a[u],e-r.getStringUnitWidth(a[u])*d,n),n+=1.15*l;return r}e-=r.getStringUnitWidth(t)*d}return"justify"===o.halign?r.text(t,e,n,{maxWidth:o.maxWidth||100,align:"justify"}):r.text(t,e,n),r}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var u=n(10),c=n(0);function h(t,e,n,o){for(var r=[],i=o?u.parseCss(e,c.default().scaleFactor(),["cellPadding","lineWidth","lineColor"]):{},l=0;l<e.cells.length;l++){var a=e.cells[l],s=t.getComputedStyle(a);if(n||"none"!==s.display){var d=o?u.parseCss(a,c.default().scaleFactor()):{};r.push({rowSpan:a.rowSpan,colSpan:a.colSpan,styles:o?d:null,_element:a,content:f(a)})}}if(0<r.length&&(n||"none"!==i.display))return r._element=e,r}function f(t){var e=t.cloneNode(!0);return e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/ +/g," "),e.innerHTML=e.innerHTML.split("<br>").map(function(t){return t.trim()}).join("\n"),e.innerText||e.textContent||""}e.parseHtml=function(t,e,n){var o;if(void 0===e&&(e=!1),void 0===n&&(n=!1),o="string"==typeof t?window.document.querySelector(t):t){for(var r=[],i=[],l=[],a=0,s=o.rows;a<s.length;a++){var d=s[a],u=d.parentNode.tagName.toLowerCase(),c=h(window,d,e,n);c&&("thead"===u?r.push(c):"tfoot"===u?l.push(c):i.push(c))}return{head:r,body:i,foot:l}}console.error("Html table could not be found with input: ",t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(t),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(o[l]=i[l])}return o}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=n(2),a=n(0),s=n(13),o=n(1),i=n(7),r=function(){this.didParseCell=[],this.willDrawCell=[],this.didDrawCell=[],this.didDrawPage=[]},d=(u.prototype.allRows=function(){return this.head.concat(this.body).concat(this.foot)},u.prototype.callCellHooks=function(t,e,n,o){for(var r=0,i=t;r<i.length;r++)if(!1===(0,i[r])(new s.CellHookData(e,n,o)))return!1;return!0},u.prototype.callEndPageHooks=function(){o.applyUserStyles();for(var t=0,e=this.cellHooks.didDrawPage;t<e.length;t++)(0,e[t])(new s.HookData)},u.prototype.margin=function(t){return o.marginOrPadding(this.settings.margin,l.defaultConfig().margin)[t]},u);function u(){this.columns=[],this.head=[],this.body=[],this.foot=[],this.height=0,this.width=0,this.preferredWidth=0,this.wrappedWidth=0,this.minWidth=0,this.headHeight=0,this.footHeight=0,this.startPageNumber=1,this.pageNumber=1,this.pageCount=1,this.styles={styles:{},headStyles:{},bodyStyles:{},footStyles:{},alternateRowStyles:{},columnStyles:{}},this.cellHooks=new r}e.Table=d;var c=(h.prototype.hasRowSpan=function(){var n=this;return 0<a.default().table.columns.filter(function(t){var e=n.cells[t.index];return!!e&&1<e.rowSpan}).length},h.prototype.canEntireRowFit=function(t){return this.maxCellHeight<=t},h.prototype.getMinimumRowHeight=function(){var i=this;return a.default().table.columns.reduce(function(t,e){var n=i.cells[e.index];if(!n)return 0;var o=n.styles.fontSize/a.default().scaleFactor()*l.FONT_ROW_RATIO,r=n.padding("vertical")+o;return t<r?r:t},0)},h);function h(t,e,n){this.cells={},this.height=0,this.maxCellHeight=0,this.spansMultiplePages=!1,(this.raw=t)._element&&(this.raw=t._element),this.index=e,this.section=n}e.Row=c;var f=(g.prototype.getContentHeight=function(){return(Array.isArray(this.text)?this.text.length:1)*(this.styles.fontSize/a.default().scaleFactor()*l.FONT_ROW_RATIO)+this.padding("vertical")},g.prototype.padding=function(t){var e=o.marginOrPadding(this.styles.cellPadding,o.styles([]).cellPadding);return"vertical"===t?e.top+e.bottom:"horizontal"===t?e.left+e.right:e[t]},g);function g(t,e,n){var o;this.contentHeight=0,this.contentWidth=0,this.longestWordWidth=0,this.wrappedWidth=0,this.minWidth=0,this.textPos={},this.height=0,this.width=0,this.rowSpan=t&&t.rowSpan||1,this.colSpan=t&&t.colSpan||1,this.styles=i(e,t&&t.styles||{}),this.section=n;var r=t&&null!=t.content?t.content:t;r=r&&null!=r.title?r.title:r,this.raw=t&&t._element?t._element:t,o=null!=r?""+r:"";this.text=o.split(/\r\n|\r|\n/g)}e.Cell=f;var p=(y.prototype.hasCustomWidth=function(){for(var t=0,e=a.default().table.allRows();t<e.length;t++){var n=e[t].cells[this.index];if(n&&"number"==typeof n.styles.cellWidth)return!0}return!1},y);function y(t,e,n){this.preferredWidth=0,this.minWidth=0,this.longestWordWidth=0,this.wrappedWidth=0,this.width=0,this.dataKey=t,this.raw=e,this.index=n}e.Column=p},function(t,e,n){"use strict";
11/*
12object-assign
13(c) Sindre Sorhus
14@license MIT
15*/var s=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,o,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),i=1;i<arguments.length;i++){for(var l in n=Object(arguments[i]))d.call(n,l)&&(r[l]=n[l]);if(s){o=s(n);for(var a=0;a<o.length;a++)u.call(n,o[a])&&(r[o[a]]=n[o[a]])}}return r}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(9);function r(t){o.default(t)}e.applyPlugin=r;try{r(n(17))}catch(t){}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);n(3);var l=n(4),r=n(3),i=n(11);e.default=function(e){e.API.autoTable=i.default,e.API.lastAutoTable=!1,e.API.previousAutoTable=!1,e.API.autoTable.previous=!1,e.API.autoTableText=function(t,e,n,o){r.default(t,e,n,o,this)},e.API.autoTableSetDefaults=function(t){return o.setDefaults(t,this),this},e.autoTableSetDefaults=function(t,e){return o.setDefaults(t,e),this},e.API.autoTableHtmlToJson=function(t,e){if(e=e||!1,!(t&&t instanceof HTMLTableElement))return console.error("An HTMLTableElement has to be sent to autoTableHtmlToJson"),null;var n=l.parseHtml(t,e,!1),o=n.head,r=n.body,i=n.foot;return{columns:o[0]||r[0]||i[0],rows:r,data:r}},e.API.autoTableEndPosY=function(){console.error("Use of deprecated function: autoTableEndPosY. Use doc.previousAutoTable.finalY instead.");var t=this.previousAutoTable;return t.cursor&&"number"==typeof t.cursor.y?t.cursor.y:0},e.API.autoTableAddPageContent=function(t){return console.error("Use of deprecated function: autoTableAddPageContent. Use jsPDF.autoTableSetDefaults({didDrawPage: () => {}}) instead."),e.API.autoTable.globalDefaults||(e.API.autoTable.globalDefaults={}),e.API.autoTable.globalDefaults.addPageContent=t,this},e.API.autoTableAddPage=function(){return console.error("Use of deprecated function: autoTableAddPage. Use doc.addPage()"),this.addPage(),this}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=n(1),s=n(0);function d(t,e){var n=function t(e,n){if(!e)return null;var o=window.getComputedStyle(e)[n];return"rgba(0, 0, 0, 0)"===o||"transparent"===o||"initial"===o||"inherit"===o?t(e.parentElement,n):o}(t,e);if(!n)return null;var o=n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);if(!o||!Array.isArray(o))return null;var r=[parseInt(o[1]),parseInt(o[2]),parseInt(o[3])];return 0===parseInt(o[4])||isNaN(r[0])||isNaN(r[1])||isNaN(r[2])?null:r}e.parseCss=function(t,e,o){void 0===o&&(o=[]);var r={},n=window.getComputedStyle(t);function i(t,e,n){void 0===n&&(n=[]),0!==n.length&&-1===n.indexOf(e)||-1!==o.indexOf(t)||0!==e&&!e||(r[t]=e)}i("fillColor",d(t,"backgroundColor")),i("fontStyle",function(t){var e="";("bold"===t.fontWeight||"bolder"===t.fontWeight||700<=parseInt(t.fontWeight))&&(e+="bold");"italic"!==t.fontStyle&&"oblique"!==t.fontStyle||(e+="italic");return e}(n)),i("textColor",d(t,"color")),i("halign",n.textAlign,["left","right","center","justify"]),i("valign",n.verticalAlign,["middle","bottom","top"]),i("fontSize",parseInt(n.fontSize||"")/(96/72)),i("cellPadding",function(t,e,n,o){if(!t)return null;var r=96/(72/o),i=(parseInt(n)-parseInt(e))/o/2,l=t.map(function(t){return parseInt(t)/r});l=a.marginOrPadding(l,0),i>l.top&&(l.top=i);i>l.bottom&&(l.bottom=i);return l}([n.paddingTop,n.paddingRight,n.paddingBottom,n.paddingLeft],n.fontSize,n.lineHeight,e)),i("lineWidth",parseInt(n.borderTopWidth||"")/(96/72)/e),i("lineColor",d(t,"borderTopColor"));var l=(n.fontFamily||"").toLowerCase();return s.default().doc.getFontList()[l]&&i("font",l),r}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(12),i=n(15),l=n(16),a=n(1);e.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];o.setupState(this);var n=r.parseInput(t);return i.calculateWidths(n),l.drawTable(n),n.finalY=n.cursor.y,this.previousAutoTable=n,this.lastAutoTable=n,this.autoTable.previous=n,a.applyUserStyles(),o.resetState(),this}},function(t,e,n){"use strict";var C=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),r=0;for(e=0;e<n;e++)for(var i=arguments[e],l=0,a=i.length;l<a;l++,r++)o[r]=i[l];return o};Object.defineProperty(e,"__esModule",{value:!0});var W=n(6),H=n(2),v=n(4),O=n(5),m=n(1),T=n(0),b=n(14);e.parseInput=function(t){var e=function(t){{if(1===t.length)return t[0];var e=t[2]||{};return e.body=t[1],e.columns=t[0],e.columns.forEach(function(t){"object"==typeof t&&null==t.header&&(t.header=t.title)}),e}}(t),n=[T.getGlobalOptions(),T.getDocumentOptions(),e];b.default(n);var o=new W.Table;(T.default().table=o).id=e.tableId;var r=T.default().doc;o.userStyles={textColor:r.getTextColor?r.getTextColor():0,fontSize:r.internal.getFontSize(),fontStyle:r.internal.getFont().fontStyle,font:r.internal.getFont().fontName};for(var i=function(e){var t=n.map(function(t){return t[e]||{}});o.styles[e]=O.assign.apply(void 0,C([{}],t))},l=0,a=Object.keys(o.styles);l<a.length;l++){i(a[l])}for(var s=0,d=n;s<d.length;s++)for(var u=d[s],c=0,h=Object.keys(o.cellHooks);c<h.length;c++){var f=h[c];u&&"function"==typeof u[f]&&o.cellHooks[f].push(u[f])}o.settings=O.assign.apply(void 0,C([{},H.defaultConfig()],n)),o.settings.margin=m.marginOrPadding(o.settings.margin,H.defaultConfig().margin),"auto"===o.settings.theme&&(o.settings.theme=o.settings.useCss?"plain":"striped"),!1===o.settings.startY&&delete o.settings.startY;var g=T.default().doc.previousAutoTable,p=g&&g.startPageNumber+g.pageNumber-1===T.default().pageNumber();null==o.settings.startY&&p&&(o.settings.startY=g.finalY+20/T.default().scaleFactor());var y={};return o.settings.html&&(y=v.parseHtml(o.settings.html,o.settings.includeHiddenHtml,o.settings.useCss)||{}),o.settings.head=y.head||o.settings.head||[],o.settings.body=y.body||o.settings.body||[],o.settings.foot=y.foot||o.settings.foot||[],function(P){var n=P.settings;P.columns=function(t){{if(t.columns)return t.columns.map(function(t,e){var n=t.dataKey||t.key||e;return new W.Column(n,t,e)});var r=t.head[0]||t.body[0]||t.foot[0]||[],i=[];return Object.keys(r).filter(function(t){return"_element"!==t}).forEach(function(t){for(var e=r[t]&&r[t].colSpan?r[t].colSpan:1,n=0;n<e;n++){var o=void 0;o=Array.isArray(r)?i.length:t+(0<n?"_"+n:""),i.push(new W.Column(o,o,i.length))}}),i}}(n);for(var t=function(x){var S={},t=n[x];if(0===t.length&&n.columns&&"body"!==x){var e=function(t,o){var r={};return t.columns.forEach(function(t){var e=t.raw;if("head"===o){var n=e&&e.header?e.header:e;n&&(r[t.dataKey]=n)}else"foot"===o&&e.footer&&(r[t.dataKey]=e.footer)}),0<Object.keys(r).length?r:null}(P,x);e&&t.push(e)}t.forEach(function(t,e){var n=0,o=new W.Row(t,e,x);P[x].push(o);for(var r,i,l,a,s,d,u,c,h,f=0,g=0,p=0,y=P.columns;p<y.length;p++){var v=y[p];if(null==S[v.index]||0===S[v.index].left)if(0===g){var m=void 0;m=Array.isArray(t)?t[v.index-f-n]:t[v.dataKey];var b=(r=x,i=v,l=e,void 0,a=T.default().table,s=H.getTheme(a.settings.theme),d=[s.table,s[r],a.styles.styles,a.styles[r+"Styles"]],u=a.styles.columnStyles[i.dataKey]||a.styles.columnStyles[i.index]||{},c="body"===r?u:{},h="body"===r&&l%2==0?O.assign({},s.alternateRow,a.styles.alternateRowStyles):{},O.assign.apply(void 0,C([H.defaultStyles()],C(d,[h,c])))),w=new W.Cell(m,b,x);o.cells[v.dataKey]=w,g=(o.cells[v.index]=w).colSpan-1,S[v.index]={left:w.rowSpan-1,times:g}}else g--,f++;else S[v.index].left--,g=S[v.index].times,n++}})},e=0,o=["head","body","foot"];e<o.length;e++){t(o[e])}P.allRows().forEach(function(r){for(var t=function(t){var e=r.cells[t.index];if(!e)return"continue";P.callCellHooks(P.cellHooks.didParseCell,e,r,t),e.text=Array.isArray(e.text)?e.text:[e.text];var n=(""+e.text.join(" ")).trim().split(/\s+/).map(function(t){return m.getStringWidth(t,e.styles)});if(n.sort(),e.longestWordWidth=n[n.length-1]+e.padding("horizontal"),e.contentWidth=e.padding("horizontal")+m.getStringWidth(e.text,e.styles),"number"==typeof e.styles.cellWidth)e.minWidth=e.styles.cellWidth,e.wrappedWidth=e.styles.cellWidth;else if("wrap"===e.styles.cellWidth)e.minWidth=e.contentWidth,e.wrappedWidth=e.contentWidth;else{var o=10/T.default().scaleFactor();e.minWidth=e.styles.minCellWidth||o,e.wrappedWidth=e.contentWidth,e.minWidth>e.wrappedWidth&&(e.wrappedWidth=e.minWidth)}},e=0,n=P.columns;e<n.length;e++){t(n[e])}}),P.allRows().forEach(function(t){for(var e=0,n=P.columns;e<n.length;e++){var o=n[e],r=t.cells[o.index];if(r&&1===r.colSpan)o.wrappedWidth=Math.max(o.wrappedWidth,r.wrappedWidth),o.minWidth=Math.max(o.minWidth,r.minWidth),o.longestWordWidth=Math.max(o.longestWordWidth,r.longestWordWidth);else{var i=(P.styles.columnStyles[o.dataKey]||P.styles.columnStyles[o.index]||{}).cellWidth;i&&"number"==typeof i&&(o.minWidth=i,o.wrappedWidth=i)}r&&(1<r.colSpan&&!o.minWidth&&(o.minWidth=r.minWidth),1<r.colSpan&&!o.wrappedWidth&&(o.wrappedWidth=r.minWidth),P.callCellHooks(P.cellHooks.didParseCell,r,t,o))}})}(o),o.minWidth=o.columns.reduce(function(t,e){return t+e.minWidth},0),o.wrappedWidth=o.columns.reduce(function(t,e){return t+e.wrappedWidth},0),"number"==typeof o.settings.tableWidth?o.width=o.settings.tableWidth:"wrap"===o.settings.tableWidth?o.width=o.wrappedWidth:o.width=T.default().pageWidth()-o.margin("left")-o.margin("right"),o}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});function i(){var t=l.default().table;this.table=t,this.pageNumber=t.pageNumber,this.pageCount=this.pageNumber,this.settings=t.settings,this.cursor=t.cursor,this.doc=l.default().doc}var l=n(0);e.HookData=i;var a,s=(r(d,a=i),d);function d(t,e,n){var o=a.call(this)||this;return o.cell=t,o.row=e,o.column=n,o.section=e.section,o}e.CellHookData=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=n(1);function a(t){t.rowHeight?(console.error("Use of deprecated style rowHeight. It is renamed to minCellHeight."),t.minCellHeight||(t.minCellHeight=t.rowHeight)):t.columnWidth&&(console.error("Use of deprecated style columnWidth. It is renamed to cellWidth."),t.cellWidth||(t.cellWidth=t.columnWidth))}e.default=function(t){for(var e=function(o){o&&"object"!=typeof o&&console.error("The options parameter should be of type object, is: "+typeof o),void 0!==o.extendWidth&&(o.tableWidth=o.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),void 0!==o.margins&&(void 0===o.margin&&(o.margin=o.margins),console.error("Use of deprecated option: margins, use margin instead.")),o.startY&&"number"!=typeof o.startY&&(console.error("Invalid value for startY option",o.startY),delete o.startY),!o.didDrawPage&&(o.afterPageContent||o.beforePageContent||o.afterPageAdd)&&(console.error("The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead"),o.didDrawPage=function(t){l.applyUserStyles(),o.beforePageContent&&o.beforePageContent(t),l.applyUserStyles(),o.afterPageContent&&o.afterPageContent(t),l.applyUserStyles(),o.afterPageAdd&&1<t.pageNumber&&t.afterPageAdd(t),l.applyUserStyles()}),["createdHeaderCell","drawHeaderRow","drawRow","drawHeaderCell"].forEach(function(t){o[t]&&console.error('The "'+t+'" hook has changed in version 3.0, check the changelog for how to migrate.')}),[["showFoot","showFooter"],["showHead","showHeader"],["didDrawPage","addPageContent"],["didParseCell","createdCell"],["headStyles","headerStyles"]].forEach(function(t){var e=t[0],n=t[1];o[n]&&(console.error("Use of deprecated option "+n+". Use "+e+" instead"),o[e]=o[n])}),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(t){var e="string"==typeof t?t:t[0],n="string"==typeof t?t:t[1];void 0!==o[e]&&(void 0===o.styles[n]&&(o.styles[n]=o[e]),console.error("Use of deprecated option: "+e+", use the style "+n+" instead."))});for(var t=0,e=["styles","bodyStyles","headStyles","footStyles"];t<e.length;t++){a(o[e[t]]||{})}for(var n=o.columnStyles||{},r=0,i=Object.keys(n);r<i.length;r++){a(n[i[r]]||{})}},n=0,o=t;n<o.length;n++){e(o[n])}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var f=n(1),g=n(0);e.calculateWidths=function(t){10/g.default().scaleFactor()*t.columns.length>t.width?console.error("Columns could not fit on page"):t.minWidth>t.width&&console.error("Column widths too wide and can't fit page"),function t(e,n,o){var r=n-o;for(var i=0,l=f.entries(e);i<l.length;i++){var a=l[i],s=a[0],d=a[1],u=d.wrappedWidth/o,c=r*u,h=d.wrappedWidth+c;if(h<d.minWidth||d.hasCustomWidth()){d.width=d.minWidth+1/g.default().scaleFactor(),o-=d.wrappedWidth,n-=d.width,e.splice(s,1),t(e,n,o);break}d.width=h}}(t.columns.slice(0),t.width,t.wrappedWidth),function(t){for(var e=t.allRows(),n=0;n<e.length;n++)for(var o=e[n],r=null,i=0,l=0,a=0;a<t.columns.length;a++){var s=t.columns[a],d=null;if(1<(l-=1)&&t.columns[a+1])i+=s.width,delete o.cells[s.index];else{if(r)d=r,delete o.cells[s.index],r=null;else{if(!(d=o.cells[s.index]))continue;if(l=d.colSpan,i=0,1<d.colSpan){r=d,i+=s.width;continue}}d.width=s.width+i}}}(t),function(t){for(var e={count:0,height:0},n=0,o=t.allRows();n<o.length;n++){for(var r=o[n],i=0,l=t.columns;i<l.length;i++){var a=l[i],s=r.cells[a.index];if(s){f.applyStyles(s.styles);var d=s.width-s.padding("horizontal");"linebreak"===s.styles.overflow?s.text=g.default().doc.splitTextToSize(s.text,d+1/(g.default().scaleFactor()||1),{fontSize:s.styles.fontSize}):"ellipsize"===s.styles.overflow?s.text=f.ellipsize(s.text,d,s.styles):"hidden"===s.styles.overflow?s.text=f.ellipsize(s.text,d,s.styles,""):"function"==typeof s.styles.overflow&&(s.text=s.styles.overflow(s.text,d)),s.contentHeight=s.getContentHeight(),s.styles.minCellHeight>s.contentHeight&&(s.contentHeight=s.styles.minCellHeight);var u=s.contentHeight/s.rowSpan;1<s.rowSpan&&e.count*e.height<u*s.rowSpan?e={height:u,count:s.rowSpan}:e&&0<e.count&&e.height>u&&(u=e.height),u>r.height&&(r.height=u,r.maxCellHeight=u)}}e.count--}}(t),function(t){for(var e={},n=1,o=t.allRows(),r=0;r<o.length;r++){for(var i=o[r],l=0,a=t.columns;l<a.length;l++){var s=a[l],d=e[s.index];if(1<n)n--,delete i.cells[s.index];else if(d)d.cell.height+=i.height,d.cell.height>i.maxCellHeight&&(d.row.maxCellHeight=d.cell.height),n=d.cell.colSpan,delete i.cells[s.index],d.left--,d.left<=1&&delete e[s.index];else{var u=i.cells[s.index];if(!u)continue;if(u.height=i.height,1<u.rowSpan){var c=o.length-r,h=u.rowSpan>c?c:u.rowSpan;e[s.index]={cell:u,left:h,row:i}}}}"head"===i.section&&(t.headHeight+=i.maxCellHeight),"foot"===i.section&&(t.footHeight+=i.maxCellHeight),t.height+=i.height}}(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var v=n(2),a=n(1),m=n(6),b=n(0),w=n(7);function l(t,e,n){var o,r,i,l,a,s=new m.Row(t.raw,-1,t.section);s.spansMultiplePages=!0,t.spansMultiplePages=!0,t.height=0;for(var d=t.maxCellHeight=0,u=n.columns;d<u.length;d++){var c=u[d];if(y=t.cells[c.index]){Array.isArray(y.text)||(y.text=[y.text]);var h=new m.Cell(y.raw,{},y.section);(h=w(h,y)).textPos=w({},y.textPos),h.text=[];var f=(r=e,void 0,i=(o=y).styles.fontSize/b.default().scaleFactor()*v.FONT_ROW_RATIO,l=o.padding("vertical"),a=Math.floor((r-l)/i),Math.max(0,a));y.text.length>f&&(h.text=y.text.splice(f,y.text.length)),y.contentHeight=y.getContentHeight(),y.contentHeight>t.height&&(t.height=y.contentHeight,t.maxCellHeight=y.contentHeight),h.contentHeight=h.getContentHeight(),h.contentHeight>s.height&&(s.height=h.contentHeight,s.maxCellHeight=h.contentHeight),s.cells[c.index]=h}}for(var g=0,p=n.columns;g<p.length;g++){var y;c=p[g];(h=s.cells[c.index])&&(h.height=s.height),(y=t.cells[c.index])&&(y.height=t.height)}return s}function s(t,e,n){var o=b.default().pageHeight()-(n.margin("top")+n.margin("bottom"));"body"===t.section&&(o-=n.headHeight+n.footHeight);var r=t.getMinimumRowHeight()<e;if(t.getMinimumRowHeight()>o)return console.error("Will not be able to print row "+t.index+" correctly since it's minimum height is larger than page height"),!0;var i=t.hasRowSpan();return r&&(t.maxCellHeight>o?(i&&console.error("The content of row "+t.index+" will not be drawn correctly since drawing rows with a height larger than the page height and has cells with rowspans is not supported."),!0):!i&&"avoid"!==n.settings.rowPageBreak)}function d(t){var e=b.default().table;e.cursor.x=e.margin("left"),t.y=e.cursor.y,t.x=e.cursor.x;for(var n=0,o=e.columns;n<o.length;n++){var r=o[n],i=t.cells[r.index];if(i)if(a.applyStyles(i.styles),i.x=e.cursor.x,i.y=t.y,"top"===i.styles.valign?i.textPos.y=e.cursor.y+i.padding("top"):"bottom"===i.styles.valign?i.textPos.y=e.cursor.y+i.height-i.padding("bottom"):i.textPos.y=e.cursor.y+i.height/2,"right"===i.styles.halign?i.textPos.x=i.x+i.width-i.padding("right"):"center"===i.styles.halign?i.textPos.x=i.x+i.width/2:i.textPos.x=i.x+i.padding("left"),!1!==e.callCellHooks(e.cellHooks.willDrawCell,i,t,r)){var l=a.getFillStyle(i.styles);l&&b.default().doc.rect(i.x,e.cursor.y,i.width,i.height,l),b.default().doc.autoTableText(i.text,i.textPos.x,i.textPos.y,{halign:i.styles.halign,valign:i.styles.valign,maxWidth:Math.ceil(i.width-i.padding("left")-i.padding("right"))}),e.callCellHooks(e.cellHooks.didDrawCell,i,t,r),e.cursor.x+=r.width}else e.cursor.x+=r.width;else e.cursor.x+=r.width}e.cursor.y+=t.height}function u(t){var e=b.default().table,n=e.margin("bottom"),o=e.settings.showFoot;return(!0===o||"everyPage"===o||"lastPage"===o&&t)&&(n+=e.footHeight),b.default().pageHeight()-e.cursor.y-n}function c(){var t=b.default().table;a.applyUserStyles(),!0!==t.settings.showFoot&&"everyPage"!==t.settings.showFoot||t.foot.forEach(function(t){return d(t)}),t.finalY=t.cursor.y,t.callEndPageHooks(),a.addTableBorder(),o(b.default().doc),t.pageNumber++,t.pageCount++,t.cursor={x:t.margin("left"),y:t.margin("top")},t.pageStartX=t.cursor.x,t.pageStartY=t.cursor.y,!0!==t.settings.showHead&&"everyPage"!==t.settings.showHead||t.head.forEach(function(t){return d(t)})}function o(t){var e=b.default().pageNumber();t.setPage(e+1),b.default().pageNumber()===e&&t.addPage()}e.drawTable=function(n){var t=n.settings;n.cursor={x:n.margin("left"),y:null==t.startY?n.margin("top"):t.startY};var e=t.startY+n.margin("bottom")+n.headHeight+n.footHeight;"avoid"===t.pageBreak&&(e+=n.height),("always"===t.pageBreak||null!=t.startY&&!1!==t.startY&&e>b.default().pageHeight())&&(o(b.default().doc),n.cursor.y=n.margin("top")),n.pageStartX=n.cursor.x,n.pageStartY=n.cursor.y,n.startPageNumber=b.default().pageNumber(),a.applyUserStyles(),!0!==t.showHead&&"firstPage"!==t.showHead&&"everyPage"!==t.showHead||n.head.forEach(function(t){return d(t)}),a.applyUserStyles(),n.body.forEach(function(t,e){!function t(e,n){var o=b.default().table;var r=u(n);if(e.canEntireRowFit(r))d(e);else if(s(e,r,o)){var i=l(e,r,o);d(e),c(),t(i,n)}else c(),t(e,n)}(t,e===n.body.length-1)}),a.applyUserStyles(),!0!==t.showFoot&&"lastPage"!==t.showFoot&&"everyPage"!==t.showFoot||n.foot.forEach(function(t){return d(t)}),a.addTableBorder(),n.callEndPageHooks()},e.addPage=c},function(t,e){if(void 0===o){var n=new Error("Cannot find module 'undefined'");throw n.code="MODULE_NOT_FOUND",n}t.exports=o}],r.c=i,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=8);function r(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}var n,i});
\No newline at end of file